@hyzyn/dsh-tty 0.1.2 → 0.2.0

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/client.js CHANGED
@@ -1,38 +1,38 @@
1
- "use strict";(()=>{var xi=Object.create;var Tt=Object.defineProperty;var ki=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var Di=Object.getPrototypeOf,Ri=Object.prototype.hasOwnProperty;var At=(a,d)=>()=>(d||a((d={exports:{}}).exports,d),d.exports);var Ti=(a,d,w,E)=>{if(d&&typeof d=="object"||typeof d=="function")for(let k of Li(d))!Ri.call(a,k)&&k!==w&&Tt(a,k,{get:()=>d[k],enumerable:!(E=ki(d,k))||E.enumerable});return a};var Bt=(a,d,w)=>(w=a!=null?xi(Di(a)):{},Ti(d||!a||!a.__esModule?Tt(w,"default",{value:a,enumerable:!0}):w,a));var Ot=At(($e,dt)=>{(function(a,d){if(typeof $e=="object"&&typeof dt=="object")dt.exports=d();else if(typeof define=="function"&&define.amd)define([],d);else{var w=d();for(var E in w)(typeof $e=="object"?$e:a)[E]=w[E]}})(globalThis,()=>(()=>{"use strict";var a={4567:function(k,r,n){var h=this&&this.__decorate||function(e,i,l,g){var p,m=arguments.length,c=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,l):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,i,l,g);else for(var C=e.length-1;C>=0;C--)(p=e[C])&&(c=(m<3?p(c):m>3?p(i,l,c):p(i,l))||c);return m>3&&c&&Object.defineProperty(i,l,c),c},_=this&&this.__param||function(e,i){return function(l,g){i(l,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let o=n(9042),f=n(9924),v=n(844),S=n(4725),u=n(2585),t=n(3656),s=r.AccessibilityManager=class extends v.Disposable{constructor(e,i,l,g){super(),this._terminal=e,this._coreBrowserService=l,this._renderService=g,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 p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,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 f.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(p=>this._handleResize(p.rows))),this.register(this._terminal.onRender(p=>this._refreshRows(p.start,p.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(p=>this._handleChar(p))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
1
+ "use strict";(()=>{var Ii=Object.create;var Ft=Object.defineProperty;var Pi=Object.getOwnPropertyDescriptor;var Hi=Object.getOwnPropertyNames;var Fi=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var Nt=(a,l)=>()=>(l||a((l={exports:{}}).exports,l),l.exports);var Wi=(a,l,w,y)=>{if(l&&typeof l=="object"||typeof l=="function")for(let E of Hi(l))!Ni.call(a,E)&&E!==w&&Ft(a,E,{get:()=>l[E],enumerable:!(y=Pi(l,E))||y.enumerable});return a};var Wt=(a,l,w)=>(w=a!=null?Ii(Fi(a)):{},Wi(l||!a||!a.__esModule?Ft(w,"default",{value:a,enumerable:!0}):w,a));var zt=Nt((Ge,mt)=>{(function(a,l){if(typeof Ge=="object"&&typeof mt=="object")mt.exports=l();else if(typeof define=="function"&&define.amd)define([],l);else{var w=l();for(var y in w)(typeof Ge=="object"?Ge:a)[y]=w[y]}})(globalThis,()=>(()=>{"use strict";var a={4567:function(E,r,n){var h=this&&this.__decorate||function(e,i,c,g){var p,m=arguments.length,d=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(e,i,c,g);else for(var b=e.length-1;b>=0;b--)(p=e[b])&&(d=(m<3?p(d):m>3?p(i,c,d):p(i,c))||d);return m>3&&d&&Object.defineProperty(i,c,d),d},f=this&&this.__param||function(e,i){return function(c,g){i(c,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let o=n(9042),_=n(9924),v=n(844),S=n(4725),u=n(2585),t=n(3656),s=r.AccessibilityManager=class extends v.Disposable{constructor(e,i,c,g){super(),this._terminal=e,this._coreBrowserService=c,this._renderService=g,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 p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,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(p=>this._handleResize(p.rows))),this.register(this._terminal.onRender(p=>this._refreshRows(p.start,p.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(p=>this._handleChar(p))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
2
  `))),this.register(this._terminal.onA11yTab(p=>this._handleTab(p))),this.register(this._terminal.onKey(p=>this._handleKey(p.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,t.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)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,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let l=this._terminal.buffer,g=l.lines.length.toString();for(let p=e;p<=i;p++){let m=l.lines.get(l.ydisp+p),c=[],C=m?.translateToString(!0,void 0,void 0,c)||"",R=(l.ydisp+p+1).toString(),T=this._rowElements[p];T&&(C.length===0?(T.innerText="\xA0",this._rowColumns.set(T,[0,1])):(T.textContent=C,this._rowColumns.set(T,c)),T.setAttribute("aria-posinset",R),T.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let l=e.target,g=this._rowElements[i===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")===(i===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==g)return;let p,m;if(i===0?(p=l,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(p=this._rowElements.shift(),m=l,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===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 i={node:e.anchorNode,offset:e.anchorOffset},l={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(l.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===l.node&&i.offset>l.offset)&&([i,l]=[l,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let g=this._rowElements.slice(-1)[0];if(l.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(l={node:g,offset:g.textContent?.length??0}),!this._rowContainer.contains(l.node))return;let p=({node:C,offset:R})=>{let T=C instanceof Text?C.parentNode:C,B=parseInt(T?.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;let D=this._rowColumns.get(T);if(!D)return console.warn("columns is null. Race condition?"),null;let F=R<D.length?D[R]:D.slice(-1)[0]+1;return F>=this._terminal.cols&&(++B,F=0),{row:B,column:F}},m=p(i),c=p(l);if(m&&c){if(m.row>c.row||m.row===c.row&&m.column>=c.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(c.row-m.row)*this._terminal.cols-m.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);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=h([_(1,u.IInstantiationService),_(2,S.ICoreBrowserService),_(3,S.IRenderService)],s)},3614:(k,r)=>{function n(f){return f.replace(/\r?\n/g,"\r")}function h(f,v){return v?"\x1B[200~"+f+"\x1B[201~":f}function _(f,v,S,u){f=h(f=n(f),S.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(f,!0),v.value=""}function o(f,v,S){let u=S.getBoundingClientRect(),t=f.clientX-u.left-10,s=f.clientY-u.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${t}px`,v.style.top=`${s}px`,v.style.zIndex="1000",v.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=h,r.copyHandler=function(f,v){f.clipboardData&&f.clipboardData.setData("text/plain",v.selectionText),f.preventDefault()},r.handlePasteEvent=function(f,v,S,u){f.stopPropagation(),f.clipboardData&&_(f.clipboardData.getData("text/plain"),v,S,u)},r.paste=_,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(f,v,S,u,t){o(f,v,S),t&&u.rightClickSelect(f),v.value=u.selectionText,v.select()}},7239:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let h=n(1505);r.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(_,o,f){this._css.set(_,o,f)}getCss(_,o){return this._css.get(_,o)}setColor(_,o,f){this._color.set(_,o,f)}getColor(_,o){return this._color.get(_,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(n,h,_,o){n.addEventListener(h,_,o);let f=!1;return{dispose:()=>{f||(f=!0,n.removeEventListener(h,_,o))}}}},3551:function(k,r,n){var h=this&&this.__decorate||function(s,e,i,l){var g,p=arguments.length,m=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,l);else for(var c=s.length-1;c>=0;c--)(g=s[c])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},_=this&&this.__param||function(s,e){return function(i,l){e(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let o=n(3656),f=n(8460),v=n(844),S=n(2585),u=n(4725),t=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(s,e,i,l,g){super(),this._element=s,this._mouseService=e,this._renderService=i,this._bufferService=l,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new f.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new f.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.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 i=s.composedPath();for(let l=0;l<i.length;l++){let g=i[l];if(g.classList.contains("xterm"))break;if(g.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(l=>{l?.forEach(g=>{g.link.dispose&&g.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let i=!1;for(let[l,g]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(l)&&(i=this._checkLinkProviderResult(l,s,i)):g.provideLinks(s.y,p=>{if(this._isMouseOut)return;let m=p?.map(c=>({link:c}));this._activeProviderReplies?.set(l,m),i=this._checkLinkProviderResult(l,s,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,e){let i=new Set;for(let l=0;l<e.size;l++){let g=e.get(l);if(g)for(let p=0;p<g.length;p++){let m=g[p],c=m.link.range.start.y<s?0:m.link.range.start.x,C=m.link.range.end.y>s?this._bufferService.cols:m.link.range.end.x;for(let R=c;R<=C;R++){if(i.has(R)){g.splice(p--,1);break}i.add(R)}}}}_checkLinkProviderResult(s,e,i){if(!this._activeProviderReplies)return i;let l=this._activeProviderReplies.get(s),g=!1;for(let p=0;p<s;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(g=!0);if(!g&&l){let p=l.find(m=>this._linkAtPosition(m.link,e));p&&(i=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let p=0;p<this._activeProviderReplies.size;p++){let m=this._activeProviderReplies.get(p)?.find(c=>this._linkAtPosition(c.link,e));if(m){i=!0,this._handleNewLink(m);break}}return i}_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,v.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:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let l=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(l,g),this._lastMouseEvent)){let p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!1)}})))}_linkHover(s,e,i){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(i,e.text)}_fireUnderlineEvent(s,e){let i=s.range,l=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-l-1,i.end.x,i.end.y-l-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(s,e,i){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(i,e.text)}_linkAtPosition(s,e){let i=s.range.start.y*this._bufferService.cols+s.range.start.x,l=s.range.end.y*this._bufferService.cols+s.range.end.x,g=e.y*this._bufferService.cols+e.x;return i<=g&&g<=l}_positionFromMouseEvent(s,e,i){let l=i.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,i,l,g){return{x1:s,y1:e,x2:i,y2:l,cols:this._bufferService.cols,fg:g}}};r.Linkifier=t=h([_(1,u.IMouseService),_(2,u.IRenderService),_(3,S.IBufferService),_(4,u.ILinkProviderService)],t)},9042:(k,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(k,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,l=arguments.length,g=l<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(l<3?i(g):l>3?i(t,s,g):i(t,s))||g);return l>3&&g&&Object.defineProperty(t,s,g),g},_=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let o=n(511),f=n(2585),v=r.OscLinkProvider=class{constructor(u,t,s){this._bufferService=u,this._optionsService=t,this._oscLinkService=s}provideLinks(u,t){let s=this._bufferService.buffer.lines.get(u-1);if(!s)return void t(void 0);let e=[],i=this._optionsService.rawOptions.linkHandler,l=new o.CellData,g=s.getTrimmedLength(),p=-1,m=-1,c=!1;for(let C=0;C<g;C++)if(m!==-1||s.hasContent(C)){if(s.loadCell(C,l),l.hasExtendedAttrs()&&l.extended.urlId){if(m===-1){m=C,p=l.extended.urlId;continue}c=l.extended.urlId!==p}else m!==-1&&(c=!0);if(c||m!==-1&&C===g-1){let R=this._oscLinkService.getLinkData(p)?.uri;if(R){let T={start:{x:m+1,y:u},end:{x:C+(c||C!==g-1?0:1),y:u}},B=!1;if(!i?.allowNonHttpProtocols)try{let D=new URL(R);["http:","https:"].includes(D.protocol)||(B=!0)}catch{B=!0}B||e.push({text:R,range:T,activate:(D,F)=>i?i.activate(D,F,T):S(0,F),hover:(D,F)=>i?.hover?.(D,F,T),leave:(D,F)=>i?.leave?.(D,F,T)})}c=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=C,p=l.extended.urlId):(m=-1,p=-1)}}t(e)}};function S(u,t){if(confirm(`Do you want to navigate to ${t}?
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,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let c=this._terminal.buffer,g=c.lines.length.toString();for(let p=e;p<=i;p++){let m=c.lines.get(c.ydisp+p),d=[],b=m?.translateToString(!0,void 0,void 0,d)||"",L=(c.ydisp+p+1).toString(),T=this._rowElements[p];T&&(b.length===0?(T.innerText="\xA0",this._rowColumns.set(T,[0,1])):(T.textContent=b,this._rowColumns.set(T,d)),T.setAttribute("aria-posinset",L),T.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let c=e.target,g=this._rowElements[i===0?1:this._rowElements.length-2];if(c.getAttribute("aria-posinset")===(i===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==g)return;let p,m;if(i===0?(p=c,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(p=this._rowElements.shift(),m=c,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{let d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===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 i={node:e.anchorNode,offset:e.anchorOffset},c={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(c.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===c.node&&i.offset>c.offset)&&([i,c]=[c,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let g=this._rowElements.slice(-1)[0];if(c.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(c={node:g,offset:g.textContent?.length??0}),!this._rowContainer.contains(c.node))return;let p=({node:b,offset:L})=>{let T=b instanceof Text?b.parentNode:b,B=parseInt(T?.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;let D=this._rowColumns.get(T);if(!D)return console.warn("columns is null. Race condition?"),null;let F=L<D.length?D[L]:D.slice(-1)[0]+1;return F>=this._terminal.cols&&(++B,F=0),{row:B,column:F}},m=p(i),d=p(c);if(m&&d){if(m.row>d.row||m.row===d.row&&m.column>=d.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(d.row-m.row)*this._terminal.cols-m.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);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=h([f(1,u.IInstantiationService),f(2,S.ICoreBrowserService),f(3,S.IRenderService)],s)},3614:(E,r)=>{function n(_){return _.replace(/\r?\n/g,"\r")}function h(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function f(_,v,S,u){_=h(_=n(_),S.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(_,!0),v.value=""}function o(_,v,S){let u=S.getBoundingClientRect(),t=_.clientX-u.left-10,s=_.clientY-u.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${t}px`,v.style.top=`${s}px`,v.style.zIndex="1000",v.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=h,r.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},r.handlePasteEvent=function(_,v,S,u){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),v,S,u)},r.paste=f,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(_,v,S,u,t){o(_,v,S),t&&u.rightClickSelect(_),v.value=u.selectionText,v.select()}},7239:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let h=n(1505);r.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(f,o,_){this._css.set(f,o,_)}getCss(f,o){return this._css.get(f,o)}setColor(f,o,_){this._color.set(f,o,_)}getColor(f,o){return this._color.get(f,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(n,h,f,o){n.addEventListener(h,f,o);let _=!1;return{dispose:()=>{_||(_=!0,n.removeEventListener(h,f,o))}}}},3551:function(E,r,n){var h=this&&this.__decorate||function(s,e,i,c){var g,p=arguments.length,m=p<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,c);else for(var d=s.length-1;d>=0;d--)(g=s[d])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(s,e){return function(i,c){e(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let o=n(3656),_=n(8460),v=n(844),S=n(2585),u=n(4725),t=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(s,e,i,c,g){super(),this._element=s,this._mouseService=e,this._renderService=i,this._bufferService=c,this._linkProviderService=g,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,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.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 i=s.composedPath();for(let c=0;c<i.length;c++){let g=i[c];if(g.classList.contains("xterm"))break;if(g.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(c=>{c?.forEach(g=>{g.link.dispose&&g.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let i=!1;for(let[c,g]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(c)&&(i=this._checkLinkProviderResult(c,s,i)):g.provideLinks(s.y,p=>{if(this._isMouseOut)return;let m=p?.map(d=>({link:d}));this._activeProviderReplies?.set(c,m),i=this._checkLinkProviderResult(c,s,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,e){let i=new Set;for(let c=0;c<e.size;c++){let g=e.get(c);if(g)for(let p=0;p<g.length;p++){let m=g[p],d=m.link.range.start.y<s?0:m.link.range.start.x,b=m.link.range.end.y>s?this._bufferService.cols:m.link.range.end.x;for(let L=d;L<=b;L++){if(i.has(L)){g.splice(p--,1);break}i.add(L)}}}}_checkLinkProviderResult(s,e,i){if(!this._activeProviderReplies)return i;let c=this._activeProviderReplies.get(s),g=!1;for(let p=0;p<s;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(g=!0);if(!g&&c){let p=c.find(m=>this._linkAtPosition(m.link,e));p&&(i=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let p=0;p<this._activeProviderReplies.size;p++){let m=this._activeProviderReplies.get(p)?.find(d=>this._linkAtPosition(d.link,e));if(m){i=!0,this._handleNewLink(m);break}}return i}_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,v.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:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let c=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=c&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(c,g),this._lastMouseEvent)){let p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!1)}})))}_linkHover(s,e,i){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(i,e.text)}_fireUnderlineEvent(s,e){let i=s.range,c=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-c-1,i.end.x,i.end.y-c-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(s,e,i){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(i,e.text)}_linkAtPosition(s,e){let i=s.range.start.y*this._bufferService.cols+s.range.start.x,c=s.range.end.y*this._bufferService.cols+s.range.end.x,g=e.y*this._bufferService.cols+e.x;return i<=g&&g<=c}_positionFromMouseEvent(s,e,i){let c=i.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(c)return{x:c[0],y:c[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,i,c,g){return{x1:s,y1:e,x2:i,y2:c,cols:this._bufferService.cols,fg:g}}};r.Linkifier=t=h([f(1,u.IMouseService),f(2,u.IRenderService),f(3,S.IBufferService),f(4,u.ILinkProviderService)],t)},9042:(E,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(E,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,c=arguments.length,g=c<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(c<3?i(g):c>3?i(t,s,g):i(t,s))||g);return c>3&&g&&Object.defineProperty(t,s,g),g},f=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let o=n(511),_=n(2585),v=r.OscLinkProvider=class{constructor(u,t,s){this._bufferService=u,this._optionsService=t,this._oscLinkService=s}provideLinks(u,t){let s=this._bufferService.buffer.lines.get(u-1);if(!s)return void t(void 0);let e=[],i=this._optionsService.rawOptions.linkHandler,c=new o.CellData,g=s.getTrimmedLength(),p=-1,m=-1,d=!1;for(let b=0;b<g;b++)if(m!==-1||s.hasContent(b)){if(s.loadCell(b,c),c.hasExtendedAttrs()&&c.extended.urlId){if(m===-1){m=b,p=c.extended.urlId;continue}d=c.extended.urlId!==p}else m!==-1&&(d=!0);if(d||m!==-1&&b===g-1){let L=this._oscLinkService.getLinkData(p)?.uri;if(L){let T={start:{x:m+1,y:u},end:{x:b+(d||b!==g-1?0:1),y:u}},B=!1;if(!i?.allowNonHttpProtocols)try{let D=new URL(L);["http:","https:"].includes(D.protocol)||(B=!0)}catch{B=!0}B||e.push({text:L,range:T,activate:(D,F)=>i?i.activate(D,F,T):S(0,F),hover:(D,F)=>i?.hover?.(D,F,T),leave:(D,F)=>i?.leave?.(D,F,T)})}d=!1,c.hasExtendedAttrs()&&c.extended.urlId?(m=b,p=c.extended.urlId):(m=-1,p=-1)}}t(e)}};function S(u,t){if(confirm(`Do you want to navigate to ${t}?
4
4
 
5
- WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=h([_(0,f.IBufferService),_(1,f.IOptionsService),_(2,f.IOscLinkService)],v)},6193:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(n,h){this._renderCallback=n,this._coreBrowserService=h,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,h,_){this._rowCount=_,n=n!==void 0?n:0,h=h!==void 0?h: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,h):h,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),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let h=n(3614),_=n(3656),o=n(3551),f=n(9042),v=n(3730),S=n(1680),u=n(3107),t=n(5744),s=n(2950),e=n(1296),i=n(428),l=n(4269),g=n(5114),p=n(8934),m=n(3230),c=n(9312),C=n(4725),R=n(6731),T=n(8055),B=n(8969),D=n(8460),F=n(844),I=n(6114),O=n(8437),H=n(2584),P=n(7399),b=n(5941),x=n(9074),L=n(2585),A=n(5435),W=n(4567),$=n(779);class q extends B.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(M={}){super(M),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new F.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($.LinkProviderService),this._instantiationService.setService(C.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((y,N)=>this.refresh(y,N))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(y=>this._reportWindowsOptions(y))),this.register(this._inputHandler.onColor(y=>this._handleColorEvent(y))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(y=>this._afterResize(y.cols,y.rows))),this.register((0,F.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(M){if(this._themeService)for(let y of M){let N,U="";switch(y.index){case 256:N="foreground",U="10";break;case 257:N="background",U="11";break;case 258:N="cursor",U="12";break;default:N="ansi",U="4;"+y.index}switch(y.type){case 0:let j=T.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[y.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${U};${(0,b.toRgbString)(j)}${H.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors(z=>z.ansi[y.index]=T.channels.toColor(...y.color));else{let z=N;this._themeService.modifyColors(G=>G[z]=T.channels.toColor(...y.color))}break;case 2:this._themeService.restoreColor(y.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(M){M?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(M){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.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(H.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 M=this.buffer.ybase+this.buffer.y,y=this.buffer.lines.get(M);if(!y)return;let N=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,j=y.getWidth(N),z=this._renderService.dimensions.css.cell.width*j,G=this.buffer.y*this._renderService.dimensions.css.cell.height,Z=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Z+"px",this.textarea.style.top=G+"px",this.textarea.style.width=z+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",y=>{this.hasSelection()&&(0,h.copyHandler)(y,this._selectionService)}));let M=y=>(0,h.handlePasteEvent)(y,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",M)),this.register((0,_.addDisposableDomListener)(this.element,"paste",M)),I.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",y=>{y.button===2&&(0,h.rightClickHandler)(y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",y=>{(0,h.rightClickHandler)(y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",y=>{y.button===1&&(0,h.moveTextAreaUnderMouseCursor)(y,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",M=>this._keyUp(M),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",M=>this._keyDown(M),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",M=>this._keyPress(M),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",M=>this._compositionHelper.compositionupdate(M))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,_.addDisposableDomListener)(this.textarea,"input",M=>this._inputEvent(M),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(M){if(!M)throw new Error("Terminal requires a parent element.");if(M.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=M.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"),M.appendChild(this.element);let y=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),y.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,_.addDisposableDomListener)(this.screenElement,"mousemove",N=>this.updateCursorStyle(N))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),y.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",f.promptLabel),I.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(g.CoreBrowserService,this.textarea,M.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(C.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",N=>this._handleTextAreaFocus(N))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(C.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(C.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(l.CharacterJoinerService),this._instantiationService.setService(C.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(C.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(N=>this._onRender.fire(N))),this.onResize(N=>this._renderService.resize(N.cols,N.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(p.MouseService),this._instantiationService.setService(C.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.Linkifier,this.screenElement)),this.element.appendChild(y);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(N=>this.scrollLines(N.amount,N.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(c.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(C.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(N=>this.scrollLines(N.amount,N.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",N=>this._selectionService.handleMouseDown(N))),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(W.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",N=>this._handleScreenReaderModeOptionChange(N))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.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 M=this,y=this.element;function N(z){let G=M._mouseService.getMouseReportCoords(z,M.screenElement);if(!G)return!1;let Z,Q;switch(z.overrideType||z.type){case"mousemove":Q=32,z.buttons===void 0?(Z=3,z.button!==void 0&&(Z=z.button<3?z.button:3)):Z=1&z.buttons?0:4&z.buttons?1:2&z.buttons?2:3;break;case"mouseup":Q=0,Z=z.button<3?z.button:3;break;case"mousedown":Q=1,Z=z.button<3?z.button:3;break;case"wheel":if(M._customWheelEventHandler&&M._customWheelEventHandler(z)===!1||M.viewport.getLinesScrolled(z)===0)return!1;Q=z.deltaY<0?0:1,Z=4;break;default:return!1}return!(Q===void 0||Z===void 0||Z>4)&&M.coreMouseService.triggerMouseEvent({col:G.col,row:G.row,x:G.x,y:G.y,button:Z,action:Q,ctrl:z.ctrlKey,alt:z.altKey,shift:z.shiftKey})}let U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},j={mouseup:z=>(N(z),z.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(z)),wheel:z=>(N(z),this.cancel(z,!0)),mousedrag:z=>{z.buttons&&N(z)},mousemove:z=>{z.buttons||N(z)}};this.register(this.coreMouseService.onProtocolChange(z=>{z?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(z)),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&z?U.mousemove||(y.addEventListener("mousemove",j.mousemove),U.mousemove=j.mousemove):(y.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&z?U.wheel||(y.addEventListener("wheel",j.wheel,{passive:!1}),U.wheel=j.wheel):(y.removeEventListener("wheel",U.wheel),U.wheel=null),2&z?U.mouseup||(U.mouseup=j.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&z?U.mousedrag||(U.mousedrag=j.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(y,"mousedown",z=>{if(z.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(z))return N(z),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(z)})),this.register((0,_.addDisposableDomListener)(y,"wheel",z=>{if(!U.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(z)===!1)return!1;if(!this.buffer.hasScrollback){let G=this.viewport.getLinesScrolled(z);if(G===0)return;let Z=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(z.deltaY<0?"A":"B"),Q="";for(let te=0;te<Math.abs(G);te++)Q+=Z;return this.coreService.triggerDataEvent(Q,!0),this.cancel(z,!0)}return this.viewport.handleWheel(z)?this.cancel(z):void 0}},{passive:!1})),this.register((0,_.addDisposableDomListener)(y,"touchstart",z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(z),this.cancel(z)},{passive:!0})),this.register((0,_.addDisposableDomListener)(y,"touchmove",z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(z)?void 0:this.cancel(z)},{passive:!1}))}refresh(M,y){this._renderService?.refreshRows(M,y)}updateCursorStyle(M){this._selectionService?.shouldColumnSelect(M)?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(M,y,N=0){N===1?(super.scrollLines(M,y,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(M)}paste(M){(0,h.paste)(M,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(M){this._customKeyEventHandler=M}attachCustomWheelEventHandler(M){this._customWheelEventHandler=M}registerLinkProvider(M){return this._linkProviderService.registerLinkProvider(M)}registerCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let y=this._characterJoinerService.register(M);return this.refresh(0,this.rows-1),y}deregisterCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(M)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(M){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+M)}registerDecoration(M){return this._decorationService.registerDecoration(M)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(M,y,N){this._selectionService.setSelection(M,y,N)}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(M,y){this._selectionService?.selectLines(M,y)}_keyDown(M){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;let y=this.browser.isMac&&this.options.macOptionIsMeta&&M.altKey;if(!y&&!this._compositionHelper.keydown(M))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;y||M.key!=="Dead"&&M.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,P.evaluateKeyboardEvent)(M,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(M),N.type===3||N.type===2){let U=this.rows-1;return this.scrollLines(N.type===2?-U:U),this.cancel(M,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,M)||(N.cancel&&this.cancel(M,!0),!N.key||!!(M.key&&!M.ctrlKey&&!M.altKey&&!M.metaKey&&M.key.length===1&&M.key.charCodeAt(0)>=65&&M.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==H.C0.ETX&&N.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||M.altKey||M.ctrlKey?this.cancel(M,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(M,y){let N=M.isMac&&!this.options.macOptionIsMeta&&y.altKey&&!y.ctrlKey&&!y.metaKey||M.isWindows&&y.altKey&&y.ctrlKey&&!y.metaKey||M.isWindows&&y.getModifierState("AltGraph");return y.type==="keypress"?N:N&&(!y.keyCode||y.keyCode>47)}_keyUp(M){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1||(function(y){return y.keyCode===16||y.keyCode===17||y.keyCode===18}(M)||this.focus(),this.updateCursorStyle(M),this._keyPressHandled=!1)}_keyPress(M){let y;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;if(this.cancel(M),M.charCode)y=M.charCode;else if(M.which===null||M.which===void 0)y=M.keyCode;else{if(M.which===0||M.charCode===0)return!1;y=M.which}return!(!y||(M.altKey||M.ctrlKey||M.metaKey)&&!this._isThirdLevelShift(this.browser,M)||(y=String.fromCharCode(y),this._onKey.fire({key:y,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(y,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(M){if(M.data&&M.inputType==="insertText"&&(!M.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let y=M.data;return this.coreService.triggerDataEvent(y,!0),this.cancel(M),!0}return!1}resize(M,y){M!==this.cols||y!==this.rows?super.resize(M,y):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(M,y){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 M=1;M<this.rows;M++)this.buffer.lines.push(this.buffer.getBlankLine(O.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 M=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=M,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(M){if(this._renderService)switch(M){case A.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let y=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${N};${y}t`);break;case A.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let U=this._renderService.dimensions.css.cell.width.toFixed(0),j=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${j};${U}t`)}}cancel(M,y){if(this.options.cancelEvents||y)return M.preventDefault(),M.stopPropagation(),!1}}r.Terminal=q},9924:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(n,h=1e3){this._renderCallback=n,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,h,_){this._rowCount=_,n=n!==void 0?n:0,h=h!==void 0?h: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,h):h;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let f=o-this._lastRefreshMs,v=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h)}}},1680:function(k,r,n){var h=this&&this.__decorate||function(s,e,i,l){var g,p=arguments.length,m=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,l);else for(var c=s.length-1;c>=0;c--)(g=s[c])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},_=this&&this.__param||function(s,e){return function(i,l){e(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let o=n(3656),f=n(4725),v=n(8460),S=n(844),u=n(2585),t=r.Viewport=class extends S.Disposable{constructor(s,e,i,l,g,p,m,c){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=i,this._optionsService=l,this._charSizeService=g,this._renderService=p,this._coreBrowserService=m,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.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(C=>this._activeBuffer=C.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(C=>this._renderDimensions=C)),this._handleThemeChange(c.colors),this.register(c.onChangeColors(C=>this._handleThemeChange(C))),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 i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&i<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 i,l="",g=[],p=e??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let c=s;c<p;c++){let C=m.get(c);if(!C)continue;let R=m.get(c+1)?.isWrapped;if(l+=C.translateToString(!R),!R||c===m.length-1){let T=document.createElement("div");T.textContent=l,g.push(T),l.length>0&&(i=T),l=""}}return{bufferElements:g,cursorElement:i}}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 i=this._optionsService.rawOptions.fastScrollModifier;return i==="alt"&&e.altKey||i==="ctrl"&&e.ctrlKey||i==="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=t=h([_(2,u.IBufferService),_(3,u.IOptionsService),_(4,f.ICharSizeService),_(5,f.IRenderService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],t)},3107:function(k,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,l=arguments.length,g=l<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(l<3?i(g):l>3?i(t,s,g):i(t,s))||g);return l>3&&g&&Object.defineProperty(t,s,g),g},_=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let o=n(4725),f=n(844),v=n(2585),S=r.BufferDecorationRenderer=class extends f.Disposable{constructor(u,t,s,e,i){super(),this._screenElement=u,this._bufferService=t,this._coreBrowserService=s,this._decorationService=e,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(l=>this._removeDecoration(l))),this.register((0,f.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let u of this._decorationService.decorations)this._renderDecoration(u);this._dimensionsChanged=!1}_renderDecoration(u){this._refreshStyle(u),this._dimensionsChanged&&this._refreshXPosition(u)}_createElement(u){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",u?.options?.layer==="top"),t.style.width=`${Math.round((u.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(u.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(u.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=u.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(u,t),t}_refreshStyle(u){let t=u.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)u.element&&(u.element.style.display="none",u.onRenderEmitter.fire(u.element));else{let s=this._decorationElements.get(u);s||(s=this._createElement(u),u.element=s,this._decorationElements.set(u,s),this._container.appendChild(s),u.onDispose(()=>{this._decorationElements.delete(u),s.remove()})),s.style.top=t*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",u.onRenderEmitter.fire(s)}}_refreshXPosition(u,t=u.element){if(!t)return;let s=u.options.x??0;(u.options.anchor||"left")==="right"?t.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(u){this._decorationElements.get(u)?.remove(),this._decorationElements.delete(u),u.dispose()}};r.BufferDecorationRenderer=S=h([_(1,v.IBufferService),_(2,o.ICoreBrowserService),_(3,v.IDecorationService),_(4,o.IRenderService)],S)},5871:(k,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 h of this._zones)if(h.color===n.options.overviewRulerOptions.color&&h.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,n.marker.line))return;if(this._lineAdjacentToZone(h,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(h,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,h){return h>=n.startBufferLine&&h<=n.endBufferLine}_lineAdjacentToZone(n,h,_){return h>=n.startBufferLine-this._linePadding[_||"full"]&&h<=n.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(n,h){n.startBufferLine=Math.min(n.startBufferLine,h),n.endBufferLine=Math.max(n.endBufferLine,h)}}},5744:function(k,r,n){var h=this&&this.__decorate||function(i,l,g,p){var m,c=arguments.length,C=c<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,l,g,p);else for(var R=i.length-1;R>=0;R--)(m=i[R])&&(C=(c<3?m(C):c>3?m(l,g,C):m(l,g))||C);return c>3&&C&&Object.defineProperty(l,g,C),C},_=this&&this.__param||function(i,l){return function(g,p){l(g,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let o=n(5871),f=n(4725),v=n(844),S=n(2585),u={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(i,l,g,p,m,c,C){super(),this._viewportElement=i,this._screenElement=l,this._bufferService=g,this._decorationService=p,this._renderService=m,this._optionsService=c,this._coreBrowserService=C,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 R=this._canvas.getContext("2d");if(!R)throw new Error("Ctx cannot be null");this._ctx=R,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.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 i=Math.floor(this._canvas.width/3),l=Math.ceil(this._canvas.width/3);t.full=this._canvas.width,t.left=i,t.center=l,t.right=i,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=t.left,s.right=t.left+t.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowserService.dpr);let i=this._canvas.height/this._bufferService.buffer.lines.length,l=Math.round(Math.max(Math.min(i,12),6)*this._coreBrowserService.dpr);u.left=l,u.center=l,u.right=l}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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 l of this._decorationService.decorations)this._colorZoneStore.addDecoration(l);this._ctx.lineWidth=1;let i=this._colorZoneStore.zones;for(let l of i)l.position!=="full"&&this._renderColorZone(l);for(let l of i)l.position==="full"&&this._renderColorZone(l);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(i){this._ctx.fillStyle=i.color,this._ctx.fillRect(s[i.position||"full"],Math.round((this._canvas.height-1)*(i.startBufferLine/this._bufferService.buffers.active.lines.length)-u[i.position||"full"]/2),t[i.position||"full"],Math.round((this._canvas.height-1)*((i.endBufferLine-i.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[i.position||"full"]))}_queueRefresh(i,l){this._shouldUpdateDimensions=i||this._shouldUpdateDimensions,this._shouldUpdateAnchor=l||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};r.OverviewRulerRenderer=e=h([_(2,S.IBufferService),_(3,S.IDecorationService),_(4,f.IRenderService),_(5,S.IOptionsService),_(6,f.ICoreBrowserService)],e)},2950:function(k,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,l=arguments.length,g=l<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(l<3?i(g):l>3?i(t,s,g):i(t,s))||g);return l>3&&g&&Object.defineProperty(t,s,g),g},_=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let o=n(4725),f=n(2585),v=n(2584),S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,t,s,e,i,l){this._textarea=u,this._compositionView=t,this._bufferService=s,this._optionsService=e,this._coreService=i,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,t.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(t.start,t.end):this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let u=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(u,"");this._dataAlreadySent=s,t.length>u.length?this._coreService.triggerDataEvent(s,!0):t.length<u.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):t.length===u.length&&t!==u&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=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,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"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 l=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}u||setTimeout(()=>this.updateCompositionElements(!0),0)}}};r.CompositionHelper=S=h([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,f.ICoreService),_(5,o.IRenderService)],S)},9806:(k,r)=>{function n(h,_,o){let f=o.getBoundingClientRect(),v=h.getComputedStyle(o),S=parseInt(v.getPropertyValue("padding-left")),u=parseInt(v.getPropertyValue("padding-top"));return[_.clientX-f.left-S,_.clientY-f.top-u]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=n,r.getCoords=function(h,_,o,f,v,S,u,t,s){if(!S)return;let e=n(h,_,o);return e?(e[0]=Math.ceil((e[0]+(s?u/2:0))/u),e[1]=Math.ceil(e[1]/t),e[0]=Math.min(Math.max(e[0],1),f+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),v),e):void 0}},9504:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let h=n(2584);function _(t,s,e,i){let l=t-o(t,e),g=s-o(s,e),p=Math.abs(l-g)-function(m,c,C){let R=0,T=m-o(m,C),B=c-o(c,C);for(let D=0;D<Math.abs(T-B);D++){let F=f(m,c)==="A"?-1:1;C.buffer.lines.get(T+F*D)?.isWrapped&&R++}return R}(t,s,e);return u(p,S(f(t,s),i))}function o(t,s){let e=0,i=s.buffer.lines.get(t),l=i?.isWrapped;for(;l&&t>=0&&t<s.rows;)e++,i=s.buffer.lines.get(--t),l=i?.isWrapped;return e}function f(t,s){return t>s?"A":"B"}function v(t,s,e,i,l,g){let p=t,m=s,c="";for(;p!==e||m!==i;)p+=l?1:-1,l&&p>g.cols-1?(c+=g.buffer.translateBufferLineToString(m,!1,t,p),p=0,t=0,m++):!l&&p<0&&(c+=g.buffer.translateBufferLineToString(m,!1,0,t+1),p=g.cols-1,t=p,m--);return c+g.buffer.translateBufferLineToString(m,!1,t,p)}function S(t,s){let e=s?"O":"[";return h.C0.ESC+e+t}function u(t,s){t=Math.floor(t);let e="";for(let i=0;i<t;i++)e+=s;return e}r.moveToCellSequence=function(t,s,e,i){let l=e.buffer.x,g=e.buffer.y;if(!e.buffer.hasScrollback)return function(c,C,R,T,B,D){return _(C,T,B,D).length===0?"":u(v(c,C,c,C-o(C,B),!1,B).length,S("D",D))}(l,g,0,s,e,i)+_(g,s,e,i)+function(c,C,R,T,B,D){let F;F=_(C,T,B,D).length>0?T-o(T,B):C;let I=T,O=function(H,P,b,x,L,A){let W;return W=_(b,x,L,A).length>0?x-o(x,L):P,H<b&&W<=x||H>=b&&W<x?"C":"D"}(c,C,R,T,B,D);return u(v(c,F,R,I,O==="C",B).length,S(O,D))}(l,g,t,s,e,i);let p;if(g===s)return p=l>t?"D":"C",u(Math.abs(l-t),S(p,i));p=g>s?"D":"C";let m=Math.abs(g-s);return u(function(c,C){return C.cols-c}(g>s?t:l,e)+(m-1)*e.cols+1+((g>s?l:t)-1),S(p,i))}},1296:function(k,r,n){var h=this&&this.__decorate||function(D,F,I,O){var H,P=arguments.length,b=P<3?F:O===null?O=Object.getOwnPropertyDescriptor(F,I):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(D,F,I,O);else for(var x=D.length-1;x>=0;x--)(H=D[x])&&(b=(P<3?H(b):P>3?H(F,I,b):H(F,I))||b);return P>3&&b&&Object.defineProperty(F,I,b),b},_=this&&this.__param||function(D,F){return function(I,O){F(I,O,D)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let o=n(3787),f=n(2550),v=n(2223),S=n(6171),u=n(6052),t=n(4725),s=n(8055),e=n(8460),i=n(844),l=n(2585),g="xterm-dom-renderer-owner-",p="xterm-rows",m="xterm-fg-",c="xterm-bg-",C="xterm-focus",R="xterm-selection",T=1,B=r.DomRenderer=class extends i.Disposable{constructor(D,F,I,O,H,P,b,x,L,A,W,$,q){super(),this._terminal=D,this._document=F,this._element=I,this._screenElement=O,this._viewportElement=H,this._helperContainer=P,this._linkifier2=b,this._charSizeService=L,this._optionsService=A,this._bufferService=W,this._coreBrowserService=$,this._themeService=q,this._terminalClass=T++,this._rowElements=[],this._selectionRenderModel=(0,u.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(p),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(R),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(K=>this._injectCss(K))),this._injectCss(this._themeService.colors),this._rowFactory=x.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(K=>this._handleLinkHover(K))),this.register(this._linkifier2.onHideLinkUnderline(K=>this._handleLinkLeave(K))),this.register((0,i.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new f.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 D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let F=`${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=F,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let F=`${this._terminalSelector} .${p} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;F+=`${this._terminalSelector} .${p} .xterm-dim { color: ${s.color.multiplyOpacity(D.foreground,.5).css};}`,F+=`${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 I=`blink_underline_${this._terminalClass}`,O=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;F+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,F+=`@keyframes ${O} { 50% { box-shadow: none; }}`,F+=`@keyframes ${H} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,F+=`${this._terminalSelector} .${p}.${C} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${p}.${C} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${p}.${C} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,F+=`${this._terminalSelector} .${R} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${R} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${R} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(let[P,b]of D.ansi.entries())F+=`${this._terminalSelector} .${m}${P} { color: ${b.css}; }${this._terminalSelector} .${m}${P}.xterm-dim { color: ${s.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${c}${P} { background-color: ${b.css}; }`;F+=`${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(D.background).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${c}${v.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=F}_setDefaultSpacing(){let D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,F){for(let I=this._rowElements.length;I<=F;I++){let O=this._document.createElement("div");this._rowContainer.appendChild(O),this._rowElements.push(O)}for(;this._rowElements.length>F;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,F){this._refreshRowElements(D,F),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(C),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(C),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,F,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,F,I),this.renderRows(0,this._bufferService.rows-1),!D||!F)return;this._selectionRenderModel.update(this._terminal,D,F,I);let O=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,P=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(P>=this._bufferService.rows||b<0)return;let x=this._document.createDocumentFragment();if(I){let L=D[0]>F[0];x.appendChild(this._createSelectionElement(P,L?F[0]:D[0],L?D[0]:F[0],b-P+1))}else{let L=O===P?D[0]:0,A=P===H?F[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(P,L,A));let W=b-P-1;if(x.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,W)),P!==b){let $=H===b?F[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(b,0,$))}}this._selectionContainer.appendChild(x)}_createSelectionElement(D,F,I,O=1){let H=this._document.createElement("div"),P=F*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(I-F);return P+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-P),H.style.height=O*this.dimensions.css.cell.height+"px",H.style.top=D*this.dimensions.css.cell.height+"px",H.style.left=`${P}px`,H.style.width=`${b}px`,H}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 D of this._rowElements)D.replaceChildren()}renderRows(D,F){let I=this._bufferService.buffer,O=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=D;L<=F;L++){let A=L+I.ydisp,W=this._rowElements[L],$=I.lines.get(A);if(!W||!$)break;W.replaceChildren(...this._rowFactory.createRow($,A,A===O,b,x,H,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,F,I,O,H,P){I<0&&(D=0),O<0&&(F=0);let b=this._bufferService.rows-1;I=Math.max(Math.min(I,b),0),O=Math.max(Math.min(O,b),0),H=Math.min(H,this._bufferService.cols);let x=this._bufferService.buffer,L=x.ybase+x.y,A=Math.min(x.x,H-1),W=this._optionsService.rawOptions.cursorBlink,$=this._optionsService.rawOptions.cursorStyle,q=this._optionsService.rawOptions.cursorInactiveStyle;for(let K=I;K<=O;++K){let M=K+x.ydisp,y=this._rowElements[K],N=x.lines.get(M);if(!y||!N)break;y.replaceChildren(...this._rowFactory.createRow(N,M,M===L,$,q,A,W,this.dimensions.css.cell.width,this._widthCache,P?K===I?D:0:-1,P?(K===O?F:H)-1:-1))}}};r.DomRenderer=B=h([_(7,l.IInstantiationService),_(8,t.ICharSizeService),_(9,l.IOptionsService),_(10,l.IBufferService),_(11,t.ICoreBrowserService),_(12,t.IThemeService)],B)},3787:function(k,r,n){var h=this&&this.__decorate||function(p,m,c,C){var R,T=arguments.length,B=T<3?m:C===null?C=Object.getOwnPropertyDescriptor(m,c):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(p,m,c,C);else for(var D=p.length-1;D>=0;D--)(R=p[D])&&(B=(T<3?R(B):T>3?R(m,c,B):R(m,c))||B);return T>3&&B&&Object.defineProperty(m,c,B),B},_=this&&this.__param||function(p,m){return function(c,C){m(c,C,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let o=n(2223),f=n(643),v=n(511),S=n(2585),u=n(8055),t=n(4725),s=n(4269),e=n(6171),i=n(3734),l=r.DomRendererRowFactory=class{constructor(p,m,c,C,R,T,B){this._document=p,this._characterJoinerService=m,this._optionsService=c,this._coreBrowserService=C,this._coreService=R,this._decorationService=T,this._themeService=B,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,m,c){this._selectionStart=p,this._selectionEnd=m,this._columnSelectMode=c}createRow(p,m,c,C,R,T,B,D,F,I,O){let H=[],P=this._characterJoinerService.getJoinedCharacters(m),b=this._themeService.colors,x,L=p.getNoBgTrimmedLength();c&&L<T+1&&(L=T+1);let A=0,W="",$=0,q=0,K=0,M=!1,y=0,N=!1,U=0,j=[],z=I!==-1&&O!==-1;for(let G=0;G<L;G++){p.loadCell(G,this._workCell);let Z=this._workCell.getWidth();if(Z===0)continue;let Q=!1,te=G,V=this._workCell;if(P.length>0&&G===P[0][0]){Q=!0;let Y=P.shift();V=new s.JoinedCellData(this._workCell,p.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),te=Y[1]-1,Z=V.getWidth()}let Ae=this._isCellInSelection(G,m),at=c&&G===T,ht=z&&G>=I&&G<=O,lt=!1;this._decorationService.forEachDecorationAtCell(G,m,void 0,Y=>{lt=!0});let Ne=V.getChars()||f.WHITESPACE_CELL_CHAR;if(Ne===" "&&(V.isUnderline()||V.isOverline())&&(Ne="\xA0"),U=Z*D-F.get(Ne,V.isBold(),V.isItalic()),x){if(A&&(Ae&&N||!Ae&&!N&&V.bg===$)&&(Ae&&N&&b.selectionForeground||V.fg===q)&&V.extended.ext===K&&ht===M&&U===y&&!at&&!Q&&!lt){V.isInvisible()?W+=f.WHITESPACE_CELL_CHAR:W+=Ne,A++;continue}A&&(x.textContent=W),x=this._document.createElement("span"),A=0,W=""}else x=this._document.createElement("span");if($=V.bg,q=V.fg,K=V.extended.ext,M=ht,y=U,N=Ae,Q&&T>=G&&T<=te&&(T=G),!this._coreService.isCursorHidden&&at&&this._coreService.isCursorInitialized){if(j.push("xterm-cursor"),this._coreBrowserService.isFocused)B&&j.push("xterm-cursor-blink"),j.push(C==="bar"?"xterm-cursor-bar":C==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){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"),W=V.isInvisible()?f.WHITESPACE_CELL_CHAR:V.getChars()||f.WHITESPACE_CELL_CHAR,V.isUnderline()&&(j.push(`xterm-underline-${V.extended.underlineStyle}`),W===" "&&(W="\xA0"),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let Y=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&Y<8&&(Y+=8),x.style.textDecorationColor=b.ansi[Y].css}V.isOverline()&&(j.push("xterm-overline"),W===" "&&(W="\xA0")),V.isStrikethrough()&&j.push("xterm-strikethrough"),ht&&(x.style.textDecoration="underline");let ne=V.getFgColor(),Be=V.getFgColorMode(),ae=V.getBgColor(),Me=V.getBgColorMode(),ct=!!V.isInverse();if(ct){let Y=ne;ne=ae,ae=Y;let Ei=Be;Be=Me,Me=Ei}let fe,Ue,pe,Oe=!1;switch(this._decorationService.forEachDecorationAtCell(G,m,void 0,Y=>{Y.options.layer!=="top"&&Oe||(Y.backgroundColorRGB&&(Me=50331648,ae=Y.backgroundColorRGB.rgba>>8&16777215,fe=Y.backgroundColorRGB),Y.foregroundColorRGB&&(Be=50331648,ne=Y.foregroundColorRGB.rgba>>8&16777215,Ue=Y.foregroundColorRGB),Oe=Y.options.layer==="top")}),!Oe&&Ae&&(fe=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ae=fe.rgba>>8&16777215,Me=50331648,Oe=!0,b.selectionForeground&&(Be=50331648,ne=b.selectionForeground.rgba>>8&16777215,Ue=b.selectionForeground)),Oe&&j.push("xterm-decoration-top"),Me){case 16777216:case 33554432:pe=b.ansi[ae],j.push(`xterm-bg-${ae}`);break;case 50331648:pe=u.channels.toColor(ae>>16,ae>>8&255,255&ae),this._addStyle(x,`background-color:#${g((ae>>>0).toString(16),"0",6)}`);break;default:ct?(pe=b.foreground,j.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):pe=b.background}switch(fe||V.isDim()&&(fe=u.color.multiplyOpacity(pe,.5)),Be){case 16777216:case 33554432:V.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(x,pe,b.ansi[ne],V,fe,void 0)||j.push(`xterm-fg-${ne}`);break;case 50331648:let Y=u.channels.toColor(ne>>16&255,ne>>8&255,255&ne);this._applyMinimumContrast(x,pe,Y,V,fe,Ue)||this._addStyle(x,`color:#${g(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,pe,b.foreground,V,fe,Ue)||ct&&j.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}j.length&&(x.className=j.join(" "),j.length=0),at||Q||lt?x.textContent=W:A++,U!==this.defaultSpacing&&(x.style.letterSpacing=`${U}px`),H.push(x),G=te}return x&&A&&(x.textContent=W),H}_applyMinimumContrast(p,m,c,C,R,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(C.getCode()))return!1;let B=this._getContrastCache(C),D;if(R||T||(D=B.getColor(m.rgba,c.rgba)),D===void 0){let F=this._optionsService.rawOptions.minimumContrastRatio/(C.isDim()?2:1);D=u.color.ensureContrastRatio(R||m,T||c,F),B.setColor((R||m).rgba,(T||c).rgba,D??null)}return!!D&&(this._addStyle(p,`color:${D.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,m){p.setAttribute("style",`${p.getAttribute("style")||""}${m};`)}_isCellInSelection(p,m){let c=this._selectionStart,C=this._selectionEnd;return!(!c||!C)&&(this._columnSelectMode?c[0]<=C[0]?p>=c[0]&&m>=c[1]&&p<C[0]&&m<=C[1]:p<c[0]&&m>=c[1]&&p>=C[0]&&m<=C[1]:m>c[1]&&m<C[1]||c[1]===C[1]&&m===c[1]&&p>=c[0]&&p<C[0]||c[1]<C[1]&&m===C[1]&&p<C[0]||c[1]<C[1]&&m===c[1]&&p>=c[0])}};function g(p,m,c){for(;p.length<c;)p=m+p;return p}r.DomRendererRowFactory=l=h([_(1,t.ICharacterJoinerService),_(2,S.IOptionsService),_(3,t.ICoreBrowserService),_(4,S.ICoreService),_(5,S.IDecorationService),_(6,t.IThemeService)],l)},2550:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(n,h){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 _=n.createElement("span");_.classList.add("xterm-char-measure-element");let o=n.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let f=n.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontStyle="italic";let v=n.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[_,o,f,v],this._container.appendChild(_),this._container.appendChild(o),this._container.appendChild(f),this._container.appendChild(v),h.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,h,_,o){n===this._font&&h===this._fontSize&&_===this._weight&&o===this._weightBold||(this._font=n,this._fontSize=h,this._weight=_,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(n,h,_){let o=0;if(!h&&!_&&n.length===1&&(o=n.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let S=this._measure(n,0);return S>0&&(this._flat[o]=S),S}let f=n;h&&(f+="B"),_&&(f+="I");let v=this._holey.get(f);if(v===void 0){let S=0;h&&(S|=1),_&&(S|=2),v=this._measure(n,S),v>0&&this._holey.set(f,v)}return v}_measure(n,h){let _=this._measureElements[h];return _.textContent=n.repeat(32),_.offsetWidth/32}}},2223:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let h=n(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(k,r)=>{function n(_){return 57508<=_&&_<=57558}function h(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=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(_){if(!_)throw new Error("value must not be falsy");return _},r.isPowerlineGlyph=n,r.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},r.isEmoji=h,r.allowRescaling=function(_,o,f,v){return o===1&&f>Math.ceil(1.5*v)&&_!==void 0&&_>255&&!h(_)&&!n(_)&&!function(S){return 57344<=S&&S<=63743}(_)},r.treatGlyphAsBackgroundColor=function(_){return n(_)||function(o){return 9472<=o&&o<=9631}(_)},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(_,o,f=0){return(_-(2*Math.round(o)-f))%(2*Math.round(o))}},6052:(k,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(_,o,f,v=!1){if(this.selectionStart=o,this.selectionEnd=f,!o||!f||o[0]===f[0]&&o[1]===f[1])return void this.clear();let S=_.buffers.active.ydisp,u=o[1]-S,t=f[1]-S,s=Math.max(u,0),e=Math.min(t,_.rows-1);s>=_.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=u,this.viewportEndRow=t,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=o[0],this.endCol=f[0])}isCellSelected(_,o,f){return!!this.hasSelection&&(f-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&f>=this.viewportCappedStartRow&&o<this.endCol&&f<=this.viewportCappedEndRow:o<this.startCol&&f>=this.viewportCappedStartRow&&o>=this.endCol&&f<=this.viewportCappedEndRow:f>this.viewportStartRow&&f<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&f===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportStartRow&&o>=this.startCol)}}r.createSelectionRenderModel=function(){return new n}},456:(k,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,h=this.selectionEnd;return!(!n||!h)&&(n[1]>h[1]||n[1]===h[1]&&n[0]>h[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(k,r,n){var h=this&&this.__decorate||function(e,i,l,g){var p,m=arguments.length,c=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,l):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,i,l,g);else for(var C=e.length-1;C>=0;C--)(p=e[C])&&(c=(m<3?p(c):m>3?p(i,l,c):p(i,l))||c);return m>3&&c&&Object.defineProperty(i,l,c),c},_=this&&this.__param||function(e,i){return function(l,g){i(l,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let o=n(2585),f=n(8460),v=n(844),S=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,i,l){super(),this._optionsService=l,this.width=0,this.height=0,this._onCharSizeChange=this.register(new f.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new t(e,i,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=S=h([_(2,o.IOptionsService)],S);class u extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(i,l){i!==void 0&&i>0&&l!==void 0&&l>0&&(this._result.width=i,this._result.height=l)}}class t extends u{constructor(i,l,g){super(),this._document=i,this._parentElement=l,this._optionsService=g,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 u{constructor(i){super(),this._optionsService=i,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let l=this._ctx.measureText("W");if(!("width"in l&&"fontBoundingBoxAscent"in l&&"fontBoundingBoxDescent"in l))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let i=this._ctx.measureText("W");return this._validateAndSet(i.width,i.fontBoundingBoxAscent+i.fontBoundingBoxDescent),this._result}}},4269:function(k,r,n){var h=this&&this.__decorate||function(s,e,i,l){var g,p=arguments.length,m=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,l);else for(var c=s.length-1;c>=0;c--)(g=s[c])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},_=this&&this.__param||function(s,e){return function(i,l){e(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let o=n(3734),f=n(643),v=n(511),S=n(2585);class u extends o.AttributeData{constructor(e,i,l){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=l}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=u;let t=r.CharacterJoinerService=class Mt{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||i.length===0)return[];let l=[],g=i.translateToString(!0),p=0,m=0,c=0,C=i.getFg(0),R=i.getBg(0);for(let T=0;T<i.getTrimmedLength();T++)if(i.loadCell(T,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==C||this._workCell.bg!==R){if(T-p>1){let B=this._getJoinedRanges(g,c,m,i,p);for(let D=0;D<B.length;D++)l.push(B[D])}p=T,c=m,C=this._workCell.fg,R=this._workCell.bg}m+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){let T=this._getJoinedRanges(g,c,m,i,p);for(let B=0;B<T.length;B++)l.push(T[B])}return l}_getJoinedRanges(e,i,l,g,p){let m=e.substring(i,l),c=[];try{c=this._characterJoiners[0].handler(m)}catch(C){console.error(C)}for(let C=1;C<this._characterJoiners.length;C++)try{let R=this._characterJoiners[C].handler(m);for(let T=0;T<R.length;T++)Mt._mergeRanges(c,R[T])}catch(R){console.error(R)}return this._stringRangesToCellRanges(c,g,p),c}_stringRangesToCellRanges(e,i,l){let g=0,p=!1,m=0,c=e[g];if(c){for(let C=l;C<this._bufferService.cols;C++){let R=i.getWidth(C),T=i.getString(C).length||f.WHITESPACE_CELL_CHAR.length;if(R!==0){if(!p&&c[0]<=m&&(c[0]=C,p=!0),c[1]<=m){if(c[1]=C,c=e[++g],!c)break;c[0]<=m?(c[0]=C,p=!0):p=!1}m+=T}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let l=!1;for(let g=0;g<e.length;g++){let p=e[g];if(l){if(i[1]<=p[0])return e[g-1][1]=i[1],e;if(i[1]<=p[1])return e[g-1][1]=Math.max(i[1],p[1]),e.splice(g,1),e;e.splice(g,1),g--}else{if(i[1]<=p[0])return e.splice(g,0,i),e;if(i[1]<=p[1])return p[0]=Math.min(i[0],p[0]),e;i[0]<p[1]&&(p[0]=Math.min(i[0],p[0]),l=!0)}}return l?e[e.length-1][1]=i[1]:e.push(i),e}};r.CharacterJoinerService=t=h([_(0,S.IBufferService)],t)},5114:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let h=n(844),_=n(8460),o=n(3656);class f extends h.Disposable{constructor(u,t,s){super(),this._textarea=u,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this.register((0,_.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(u){this._window!==u&&(this._window=u,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=f;class v extends h.Disposable{constructor(u){super(),this._parentWindow=u,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(u){this._parentWindow=u,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:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let h=n(844);class _ extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(f){return this.linkProviders.push(f),{dispose:()=>{let v=this.linkProviders.indexOf(f);v!==-1&&this.linkProviders.splice(v,1)}}}}r.LinkProviderService=_},8934:function(k,r,n){var h=this&&this.__decorate||function(S,u,t,s){var e,i=arguments.length,l=i<3?u:s===null?s=Object.getOwnPropertyDescriptor(u,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(S,u,t,s);else for(var g=S.length-1;g>=0;g--)(e=S[g])&&(l=(i<3?e(l):i>3?e(u,t,l):e(u,t))||l);return i>3&&l&&Object.defineProperty(u,t,l),l},_=this&&this.__param||function(S,u){return function(t,s){u(t,s,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let o=n(4725),f=n(9806),v=r.MouseService=class{constructor(S,u){this._renderService=S,this._charSizeService=u}getCoords(S,u,t,s,e){return(0,f.getCoords)(window,S,u,t,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(S,u){let t=(0,f.getCoordsRelativeToElement)(window,S,u);if(this._charSizeService.hasValidSize)return t[0]=Math.min(Math.max(t[0],0),this._renderService.dimensions.css.canvas.width-1),t[1]=Math.min(Math.max(t[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(t[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(t[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(t[0]),y:Math.floor(t[1])}}};r.MouseService=v=h([_(0,o.IRenderService),_(1,o.ICharSizeService)],v)},3230:function(k,r,n){var h=this&&this.__decorate||function(e,i,l,g){var p,m=arguments.length,c=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,l):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,i,l,g);else for(var C=e.length-1;C>=0;C--)(p=e[C])&&(c=(m<3?p(c):m>3?p(i,l,c):p(i,l))||c);return m>3&&c&&Object.defineProperty(i,l,c),c},_=this&&this.__param||function(e,i){return function(l,g){i(l,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let o=n(6193),f=n(4725),v=n(8460),S=n(844),u=n(7226),t=n(2585),s=r.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,i,l,g,p,m,c,C){super(),this._rowCount=e,this._charSizeService=g,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer((R,T)=>this._renderRows(R,T),c),this.register(this._renderDebouncer),this.register(c.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(l.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(p.onDecorationRegistered(()=>this._fullRefresh())),this.register(p.onDecorationRemoved(()=>this._fullRefresh())),this.register(l.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(l.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(C.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(c.window,i),this.register(c.onWindowChange(R=>this._registerIntersectionObserver(R,i)))}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let l=new e.IntersectionObserver(g=>this._handleIntersectionChange(g[g.length-1]),{threshold:0});l.observe(i),this._observerDisposable.value=(0,S.toDisposable)(()=>l.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,i,l=!1){this._isPaused?this._needsFullRefresh=!0:(l||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount))}_renderRows(e,i){this._renderer.value&&(e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0)}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.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,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,l){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=l,this._renderer.value?.handleSelectionChanged(e,i,l)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=s=h([_(2,t.IOptionsService),_(3,f.ICharSizeService),_(4,t.IDecorationService),_(5,t.IBufferService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],s)},9312:function(k,r,n){var h=this&&this.__decorate||function(c,C,R,T){var B,D=arguments.length,F=D<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,R):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(c,C,R,T);else for(var I=c.length-1;I>=0;I--)(B=c[I])&&(F=(D<3?B(F):D>3?B(C,R,F):B(C,R))||F);return D>3&&F&&Object.defineProperty(C,R,F),F},_=this&&this.__param||function(c,C){return function(R,T){C(R,T,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let o=n(9806),f=n(9504),v=n(456),S=n(4725),u=n(8460),t=n(844),s=n(6114),e=n(4841),i=n(511),l=n(2585),g="\xA0",p=new RegExp(g,"g"),m=r.SelectionService=class extends t.Disposable{constructor(c,C,R,T,B,D,F,I,O){super(),this._element=c,this._screenElement=C,this._linkifier=R,this._bufferService=T,this._coreService=B,this._mouseService=D,this._optionsService=F,this._renderService=I,this._coreBrowserService=O,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new i.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(H=>this._handleTrim(H)),this.register(this._bufferService.buffers.onBufferActivate(H=>this._handleBufferActivate(H))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,t.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 c=this._model.finalSelectionStart,C=this._model.finalSelectionEnd;return!(!c||!C||c[0]===C[0]&&c[1]===C[1])}get selectionText(){let c=this._model.finalSelectionStart,C=this._model.finalSelectionEnd;if(!c||!C)return"";let R=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(c[0]===C[0])return"";let B=c[0]<C[0]?c[0]:C[0],D=c[0]<C[0]?C[0]:c[0];for(let F=c[1];F<=C[1];F++){let I=R.translateBufferLineToString(F,!0,B,D);T.push(I)}}else{let B=c[1]===C[1]?C[0]:void 0;T.push(R.translateBufferLineToString(c[1],!0,c[0],B));for(let D=c[1]+1;D<=C[1]-1;D++){let F=R.lines.get(D),I=R.translateBufferLineToString(D,!0);F?.isWrapped?T[T.length-1]+=I:T.push(I)}if(c[1]!==C[1]){let D=R.lines.get(C[1]),F=R.translateBufferLineToString(C[1],!0,0,C[0]);D&&D.isWrapped?T[T.length-1]+=F:T.push(F)}}return T.map(B=>B.replace(p," ")).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=t}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=h([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],v)},6193:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(n,h){this._renderCallback=n,this._coreBrowserService=h,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,h,f){this._rowCount=f,n=n!==void 0?n:0,h=h!==void 0?h: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,h):h,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),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let h=n(3614),f=n(3656),o=n(3551),_=n(9042),v=n(3730),S=n(1680),u=n(3107),t=n(5744),s=n(2950),e=n(1296),i=n(428),c=n(4269),g=n(5114),p=n(8934),m=n(3230),d=n(9312),b=n(4725),L=n(6731),T=n(8055),B=n(8969),D=n(8460),F=n(844),I=n(6114),O=n(8437),H=n(2584),P=n(7399),C=n(5941),k=n(9074),R=n(2585),A=n(5435),N=n(4567),z=n(779);class q extends B.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(M={}){super(M),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new F.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(k.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(b.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((x,W)=>this.refresh(x,W))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(x=>this._reportWindowsOptions(x))),this.register(this._inputHandler.onColor(x=>this._handleColorEvent(x))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(x=>this._afterResize(x.cols,x.rows))),this.register((0,F.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(M){if(this._themeService)for(let x of M){let W,U="";switch(x.index){case 256:W="foreground",U="10";break;case 257:W="background",U="11";break;case 258:W="cursor",U="12";break;default:W="ansi",U="4;"+x.index}switch(x.type){case 0:let $=T.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[x.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${U};${(0,C.toRgbString)($)}${H.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(j=>j.ansi[x.index]=T.channels.toColor(...x.color));else{let j=W;this._themeService.modifyColors(G=>G[j]=T.channels.toColor(...x.color))}break;case 2:this._themeService.restoreColor(x.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(M){M?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(M){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.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(H.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 M=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(M);if(!x)return;let W=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,$=x.getWidth(W),j=this._renderService.dimensions.css.cell.width*$,G=this.buffer.y*this._renderService.dimensions.css.cell.height,Z=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Z+"px",this.textarea.style.top=G+"px",this.textarea.style.width=j+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",x=>{this.hasSelection()&&(0,h.copyHandler)(x,this._selectionService)}));let M=x=>(0,h.handlePasteEvent)(x,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",M)),this.register((0,f.addDisposableDomListener)(this.element,"paste",M)),I.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",x=>{x.button===2&&(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",x=>{(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",x=>{x.button===1&&(0,h.moveTextAreaUnderMouseCursor)(x,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",M=>this._keyUp(M),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",M=>this._keyDown(M),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",M=>this._keyPress(M),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",M=>this._compositionHelper.compositionupdate(M))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,f.addDisposableDomListener)(this.textarea,"input",M=>this._inputEvent(M),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(M){if(!M)throw new Error("Terminal requires a parent element.");if(M.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=M.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"),M.appendChild(this.element);let x=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),x.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,f.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),x.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),I.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(g.CoreBrowserService,this.textarea,M.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(b.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(b.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(L.ThemeService),this._instantiationService.setService(b.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(c.CharacterJoinerService),this._instantiationService.setService(b.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(b.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.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(p.MouseService),this._instantiationService.setService(b.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.Linkifier,this.screenElement)),this.element.appendChild(x);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(W=>this.scrollLines(W.amount,W.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(d.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(b.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.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 M=this,x=this.element;function W(j){let G=M._mouseService.getMouseReportCoords(j,M.screenElement);if(!G)return!1;let Z,Q;switch(j.overrideType||j.type){case"mousemove":Q=32,j.buttons===void 0?(Z=3,j.button!==void 0&&(Z=j.button<3?j.button:3)):Z=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":Q=0,Z=j.button<3?j.button:3;break;case"mousedown":Q=1,Z=j.button<3?j.button:3;break;case"wheel":if(M._customWheelEventHandler&&M._customWheelEventHandler(j)===!1||M.viewport.getLinesScrolled(j)===0)return!1;Q=j.deltaY<0?0:1,Z=4;break;default:return!1}return!(Q===void 0||Z===void 0||Z>4)&&M.coreMouseService.triggerMouseEvent({col:G.col,row:G.row,x:G.x,y:G.y,button:Z,action:Q,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:j=>(W(j),j.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(j)),wheel:j=>(W(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&W(j)},mousemove:j=>{j.buttons||W(j)}};this.register(this.coreMouseService.onProtocolChange(j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),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&j?U.mousemove||(x.addEventListener("mousemove",$.mousemove),U.mousemove=$.mousemove):(x.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&j?U.wheel||(x.addEventListener("wheel",$.wheel,{passive:!1}),U.wheel=$.wheel):(x.removeEventListener("wheel",U.wheel),U.wheel=null),2&j?U.mouseup||(U.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&j?U.mousedrag||(U.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(x,"mousedown",j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return W(j),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(j)})),this.register((0,f.addDisposableDomListener)(x,"wheel",j=>{if(!U.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let G=this.viewport.getLinesScrolled(j);if(G===0)return;let Z=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),Q="";for(let te=0;te<Math.abs(G);te++)Q+=Z;return this.coreService.triggerDataEvent(Q,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}},{passive:!1})),this.register((0,f.addDisposableDomListener)(x,"touchstart",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)},{passive:!0})),this.register((0,f.addDisposableDomListener)(x,"touchmove",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)},{passive:!1}))}refresh(M,x){this._renderService?.refreshRows(M,x)}updateCursorStyle(M){this._selectionService?.shouldColumnSelect(M)?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(M,x,W=0){W===1?(super.scrollLines(M,x,W),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(M)}paste(M){(0,h.paste)(M,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(M){this._customKeyEventHandler=M}attachCustomWheelEventHandler(M){this._customWheelEventHandler=M}registerLinkProvider(M){return this._linkProviderService.registerLinkProvider(M)}registerCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let x=this._characterJoinerService.register(M);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(M)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(M){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+M)}registerDecoration(M){return this._decorationService.registerDecoration(M)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(M,x,W){this._selectionService.setSelection(M,x,W)}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(M,x){this._selectionService?.selectLines(M,x)}_keyDown(M){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;let x=this.browser.isMac&&this.options.macOptionIsMeta&&M.altKey;if(!x&&!this._compositionHelper.keydown(M))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;x||M.key!=="Dead"&&M.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let W=(0,P.evaluateKeyboardEvent)(M,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(M),W.type===3||W.type===2){let U=this.rows-1;return this.scrollLines(W.type===2?-U:U),this.cancel(M,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,M)||(W.cancel&&this.cancel(M,!0),!W.key||!!(M.key&&!M.ctrlKey&&!M.altKey&&!M.metaKey&&M.key.length===1&&M.key.charCodeAt(0)>=65&&M.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==H.C0.ETX&&W.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||M.altKey||M.ctrlKey?this.cancel(M,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(M,x){let W=M.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||M.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||M.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?W:W&&(!x.keyCode||x.keyCode>47)}_keyUp(M){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1||(function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18}(M)||this.focus(),this.updateCursorStyle(M),this._keyPressHandled=!1)}_keyPress(M){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;if(this.cancel(M),M.charCode)x=M.charCode;else if(M.which===null||M.which===void 0)x=M.keyCode;else{if(M.which===0||M.charCode===0)return!1;x=M.which}return!(!x||(M.altKey||M.ctrlKey||M.metaKey)&&!this._isThirdLevelShift(this.browser,M)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(M){if(M.data&&M.inputType==="insertText"&&(!M.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let x=M.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(M),!0}return!1}resize(M,x){M!==this.cols||x!==this.rows?super.resize(M,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(M,x){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 M=1;M<this.rows;M++)this.buffer.lines.push(this.buffer.getBlankLine(O.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 M=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=M,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(M){if(this._renderService)switch(M){case A.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let x=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${W};${x}t`);break;case A.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let U=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${$};${U}t`)}}cancel(M,x){if(this.options.cancelEvents||x)return M.preventDefault(),M.stopPropagation(),!1}}r.Terminal=q},9924:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(n,h=1e3){this._renderCallback=n,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,h,f){this._rowCount=f,n=n!==void 0?n:0,h=h!==void 0?h: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,h):h;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=o-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h)}}},1680:function(E,r,n){var h=this&&this.__decorate||function(s,e,i,c){var g,p=arguments.length,m=p<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,c);else for(var d=s.length-1;d>=0;d--)(g=s[d])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(s,e){return function(i,c){e(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let o=n(3656),_=n(4725),v=n(8460),S=n(844),u=n(2585),t=r.Viewport=class extends S.Disposable{constructor(s,e,i,c,g,p,m,d){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=i,this._optionsService=c,this._charSizeService=g,this._renderService=p,this._coreBrowserService=m,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.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(b=>this._activeBuffer=b.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(b=>this._renderDimensions=b)),this._handleThemeChange(d.colors),this.register(d.onChangeColors(b=>this._handleThemeChange(b))),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 i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&i<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 i,c="",g=[],p=e??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let d=s;d<p;d++){let b=m.get(d);if(!b)continue;let L=m.get(d+1)?.isWrapped;if(c+=b.translateToString(!L),!L||d===m.length-1){let T=document.createElement("div");T.textContent=c,g.push(T),c.length>0&&(i=T),c=""}}return{bufferElements:g,cursorElement:i}}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 i=this._optionsService.rawOptions.fastScrollModifier;return i==="alt"&&e.altKey||i==="ctrl"&&e.ctrlKey||i==="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=t=h([f(2,u.IBufferService),f(3,u.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],t)},3107:function(E,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,c=arguments.length,g=c<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(c<3?i(g):c>3?i(t,s,g):i(t,s))||g);return c>3&&g&&Object.defineProperty(t,s,g),g},f=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let o=n(4725),_=n(844),v=n(2585),S=r.BufferDecorationRenderer=class extends _.Disposable{constructor(u,t,s,e,i){super(),this._screenElement=u,this._bufferService=t,this._coreBrowserService=s,this._decorationService=e,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(c=>this._removeDecoration(c))),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 u of this._decorationService.decorations)this._renderDecoration(u);this._dimensionsChanged=!1}_renderDecoration(u){this._refreshStyle(u),this._dimensionsChanged&&this._refreshXPosition(u)}_createElement(u){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",u?.options?.layer==="top"),t.style.width=`${Math.round((u.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(u.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(u.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=u.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(u,t),t}_refreshStyle(u){let t=u.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)u.element&&(u.element.style.display="none",u.onRenderEmitter.fire(u.element));else{let s=this._decorationElements.get(u);s||(s=this._createElement(u),u.element=s,this._decorationElements.set(u,s),this._container.appendChild(s),u.onDispose(()=>{this._decorationElements.delete(u),s.remove()})),s.style.top=t*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",u.onRenderEmitter.fire(s)}}_refreshXPosition(u,t=u.element){if(!t)return;let s=u.options.x??0;(u.options.anchor||"left")==="right"?t.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(u){this._decorationElements.get(u)?.remove(),this._decorationElements.delete(u),u.dispose()}};r.BufferDecorationRenderer=S=h([f(1,v.IBufferService),f(2,o.ICoreBrowserService),f(3,v.IDecorationService),f(4,o.IRenderService)],S)},5871:(E,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 h of this._zones)if(h.color===n.options.overviewRulerOptions.color&&h.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,n.marker.line))return;if(this._lineAdjacentToZone(h,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(h,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,h){return h>=n.startBufferLine&&h<=n.endBufferLine}_lineAdjacentToZone(n,h,f){return h>=n.startBufferLine-this._linePadding[f||"full"]&&h<=n.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(n,h){n.startBufferLine=Math.min(n.startBufferLine,h),n.endBufferLine=Math.max(n.endBufferLine,h)}}},5744:function(E,r,n){var h=this&&this.__decorate||function(i,c,g,p){var m,d=arguments.length,b=d<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,c,g,p);else for(var L=i.length-1;L>=0;L--)(m=i[L])&&(b=(d<3?m(b):d>3?m(c,g,b):m(c,g))||b);return d>3&&b&&Object.defineProperty(c,g,b),b},f=this&&this.__param||function(i,c){return function(g,p){c(g,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let o=n(5871),_=n(4725),v=n(844),S=n(2585),u={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(i,c,g,p,m,d,b){super(),this._viewportElement=i,this._screenElement=c,this._bufferService=g,this._decorationService=p,this._renderService=m,this._optionsService=d,this._coreBrowserService=b,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 L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.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 i=Math.floor(this._canvas.width/3),c=Math.ceil(this._canvas.width/3);t.full=this._canvas.width,t.left=i,t.center=c,t.right=i,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=t.left,s.right=t.left+t.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowserService.dpr);let i=this._canvas.height/this._bufferService.buffer.lines.length,c=Math.round(Math.max(Math.min(i,12),6)*this._coreBrowserService.dpr);u.left=c,u.center=c,u.right=c}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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 c of this._decorationService.decorations)this._colorZoneStore.addDecoration(c);this._ctx.lineWidth=1;let i=this._colorZoneStore.zones;for(let c of i)c.position!=="full"&&this._renderColorZone(c);for(let c of i)c.position==="full"&&this._renderColorZone(c);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(i){this._ctx.fillStyle=i.color,this._ctx.fillRect(s[i.position||"full"],Math.round((this._canvas.height-1)*(i.startBufferLine/this._bufferService.buffers.active.lines.length)-u[i.position||"full"]/2),t[i.position||"full"],Math.round((this._canvas.height-1)*((i.endBufferLine-i.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[i.position||"full"]))}_queueRefresh(i,c){this._shouldUpdateDimensions=i||this._shouldUpdateDimensions,this._shouldUpdateAnchor=c||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};r.OverviewRulerRenderer=e=h([f(2,S.IBufferService),f(3,S.IDecorationService),f(4,_.IRenderService),f(5,S.IOptionsService),f(6,_.ICoreBrowserService)],e)},2950:function(E,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,c=arguments.length,g=c<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(c<3?i(g):c>3?i(t,s,g):i(t,s))||g);return c>3&&g&&Object.defineProperty(t,s,g),g},f=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let o=n(4725),_=n(2585),v=n(2584),S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,t,s,e,i,c){this._textarea=u,this._compositionView=t,this._bufferService=s,this._optionsService=e,this._coreService=i,this._renderService=c,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(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,t.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(t.start,t.end):this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let u=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(u,"");this._dataAlreadySent=s,t.length>u.length?this._coreService.triggerDataEvent(s,!0):t.length<u.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):t.length===u.length&&t!==u&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=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,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"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 c=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}u||setTimeout(()=>this.updateCompositionElements(!0),0)}}};r.CompositionHelper=S=h([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,o.IRenderService)],S)},9806:(E,r)=>{function n(h,f,o){let _=o.getBoundingClientRect(),v=h.getComputedStyle(o),S=parseInt(v.getPropertyValue("padding-left")),u=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-_.left-S,f.clientY-_.top-u]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=n,r.getCoords=function(h,f,o,_,v,S,u,t,s){if(!S)return;let e=n(h,f,o);return e?(e[0]=Math.ceil((e[0]+(s?u/2:0))/u),e[1]=Math.ceil(e[1]/t),e[0]=Math.min(Math.max(e[0],1),_+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),v),e):void 0}},9504:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let h=n(2584);function f(t,s,e,i){let c=t-o(t,e),g=s-o(s,e),p=Math.abs(c-g)-function(m,d,b){let L=0,T=m-o(m,b),B=d-o(d,b);for(let D=0;D<Math.abs(T-B);D++){let F=_(m,d)==="A"?-1:1;b.buffer.lines.get(T+F*D)?.isWrapped&&L++}return L}(t,s,e);return u(p,S(_(t,s),i))}function o(t,s){let e=0,i=s.buffer.lines.get(t),c=i?.isWrapped;for(;c&&t>=0&&t<s.rows;)e++,i=s.buffer.lines.get(--t),c=i?.isWrapped;return e}function _(t,s){return t>s?"A":"B"}function v(t,s,e,i,c,g){let p=t,m=s,d="";for(;p!==e||m!==i;)p+=c?1:-1,c&&p>g.cols-1?(d+=g.buffer.translateBufferLineToString(m,!1,t,p),p=0,t=0,m++):!c&&p<0&&(d+=g.buffer.translateBufferLineToString(m,!1,0,t+1),p=g.cols-1,t=p,m--);return d+g.buffer.translateBufferLineToString(m,!1,t,p)}function S(t,s){let e=s?"O":"[";return h.C0.ESC+e+t}function u(t,s){t=Math.floor(t);let e="";for(let i=0;i<t;i++)e+=s;return e}r.moveToCellSequence=function(t,s,e,i){let c=e.buffer.x,g=e.buffer.y;if(!e.buffer.hasScrollback)return function(d,b,L,T,B,D){return f(b,T,B,D).length===0?"":u(v(d,b,d,b-o(b,B),!1,B).length,S("D",D))}(c,g,0,s,e,i)+f(g,s,e,i)+function(d,b,L,T,B,D){let F;F=f(b,T,B,D).length>0?T-o(T,B):b;let I=T,O=function(H,P,C,k,R,A){let N;return N=f(C,k,R,A).length>0?k-o(k,R):P,H<C&&N<=k||H>=C&&N<k?"C":"D"}(d,b,L,T,B,D);return u(v(d,F,L,I,O==="C",B).length,S(O,D))}(c,g,t,s,e,i);let p;if(g===s)return p=c>t?"D":"C",u(Math.abs(c-t),S(p,i));p=g>s?"D":"C";let m=Math.abs(g-s);return u(function(d,b){return b.cols-d}(g>s?t:c,e)+(m-1)*e.cols+1+((g>s?c:t)-1),S(p,i))}},1296:function(E,r,n){var h=this&&this.__decorate||function(D,F,I,O){var H,P=arguments.length,C=P<3?F:O===null?O=Object.getOwnPropertyDescriptor(F,I):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(D,F,I,O);else for(var k=D.length-1;k>=0;k--)(H=D[k])&&(C=(P<3?H(C):P>3?H(F,I,C):H(F,I))||C);return P>3&&C&&Object.defineProperty(F,I,C),C},f=this&&this.__param||function(D,F){return function(I,O){F(I,O,D)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let o=n(3787),_=n(2550),v=n(2223),S=n(6171),u=n(6052),t=n(4725),s=n(8055),e=n(8460),i=n(844),c=n(2585),g="xterm-dom-renderer-owner-",p="xterm-rows",m="xterm-fg-",d="xterm-bg-",b="xterm-focus",L="xterm-selection",T=1,B=r.DomRenderer=class extends i.Disposable{constructor(D,F,I,O,H,P,C,k,R,A,N,z,q){super(),this._terminal=D,this._document=F,this._element=I,this._screenElement=O,this._viewportElement=H,this._helperContainer=P,this._linkifier2=C,this._charSizeService=R,this._optionsService=A,this._bufferService=N,this._coreBrowserService=z,this._themeService=q,this._terminalClass=T++,this._rowElements=[],this._selectionRenderModel=(0,u.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(p),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(L),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(K=>this._injectCss(K))),this._injectCss(this._themeService.colors),this._rowFactory=k.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(K=>this._handleLinkHover(K))),this.register(this._linkifier2.onHideLinkUnderline(K=>this._handleLinkLeave(K))),this.register((0,i.toDisposable)(()=>{this._element.classList.remove(g+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 D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let F=`${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=F,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let F=`${this._terminalSelector} .${p} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;F+=`${this._terminalSelector} .${p} .xterm-dim { color: ${s.color.multiplyOpacity(D.foreground,.5).css};}`,F+=`${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 I=`blink_underline_${this._terminalClass}`,O=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;F+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,F+=`@keyframes ${O} { 50% { box-shadow: none; }}`,F+=`@keyframes ${H} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,F+=`${this._terminalSelector} .${p}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${p}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${p}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,F+=`${this._terminalSelector} .${L} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${L} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${L} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(let[P,C]of D.ansi.entries())F+=`${this._terminalSelector} .${m}${P} { color: ${C.css}; }${this._terminalSelector} .${m}${P}.xterm-dim { color: ${s.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${d}${P} { background-color: ${C.css}; }`;F+=`${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(D.background).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${d}${v.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=F}_setDefaultSpacing(){let D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,F){for(let I=this._rowElements.length;I<=F;I++){let O=this._document.createElement("div");this._rowContainer.appendChild(O),this._rowElements.push(O)}for(;this._rowElements.length>F;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,F){this._refreshRowElements(D,F),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(b),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(b),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,F,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,F,I),this.renderRows(0,this._bufferService.rows-1),!D||!F)return;this._selectionRenderModel.update(this._terminal,D,F,I);let O=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,P=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(P>=this._bufferService.rows||C<0)return;let k=this._document.createDocumentFragment();if(I){let R=D[0]>F[0];k.appendChild(this._createSelectionElement(P,R?F[0]:D[0],R?D[0]:F[0],C-P+1))}else{let R=O===P?D[0]:0,A=P===H?F[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(P,R,A));let N=C-P-1;if(k.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,N)),P!==C){let z=H===C?F[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(C,0,z))}}this._selectionContainer.appendChild(k)}_createSelectionElement(D,F,I,O=1){let H=this._document.createElement("div"),P=F*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(I-F);return P+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-P),H.style.height=O*this.dimensions.css.cell.height+"px",H.style.top=D*this.dimensions.css.cell.height+"px",H.style.left=`${P}px`,H.style.width=`${C}px`,H}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 D of this._rowElements)D.replaceChildren()}renderRows(D,F){let I=this._bufferService.buffer,O=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,k=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=D;R<=F;R++){let A=R+I.ydisp,N=this._rowElements[R],z=I.lines.get(A);if(!N||!z)break;N.replaceChildren(...this._rowFactory.createRow(z,A,A===O,C,k,H,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,F,I,O,H,P){I<0&&(D=0),O<0&&(F=0);let C=this._bufferService.rows-1;I=Math.max(Math.min(I,C),0),O=Math.max(Math.min(O,C),0),H=Math.min(H,this._bufferService.cols);let k=this._bufferService.buffer,R=k.ybase+k.y,A=Math.min(k.x,H-1),N=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,q=this._optionsService.rawOptions.cursorInactiveStyle;for(let K=I;K<=O;++K){let M=K+k.ydisp,x=this._rowElements[K],W=k.lines.get(M);if(!x||!W)break;x.replaceChildren(...this._rowFactory.createRow(W,M,M===R,z,q,A,N,this.dimensions.css.cell.width,this._widthCache,P?K===I?D:0:-1,P?(K===O?F:H)-1:-1))}}};r.DomRenderer=B=h([f(7,c.IInstantiationService),f(8,t.ICharSizeService),f(9,c.IOptionsService),f(10,c.IBufferService),f(11,t.ICoreBrowserService),f(12,t.IThemeService)],B)},3787:function(E,r,n){var h=this&&this.__decorate||function(p,m,d,b){var L,T=arguments.length,B=T<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(p,m,d,b);else for(var D=p.length-1;D>=0;D--)(L=p[D])&&(B=(T<3?L(B):T>3?L(m,d,B):L(m,d))||B);return T>3&&B&&Object.defineProperty(m,d,B),B},f=this&&this.__param||function(p,m){return function(d,b){m(d,b,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let o=n(2223),_=n(643),v=n(511),S=n(2585),u=n(8055),t=n(4725),s=n(4269),e=n(6171),i=n(3734),c=r.DomRendererRowFactory=class{constructor(p,m,d,b,L,T,B){this._document=p,this._characterJoinerService=m,this._optionsService=d,this._coreBrowserService=b,this._coreService=L,this._decorationService=T,this._themeService=B,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,m,d){this._selectionStart=p,this._selectionEnd=m,this._columnSelectMode=d}createRow(p,m,d,b,L,T,B,D,F,I,O){let H=[],P=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors,k,R=p.getNoBgTrimmedLength();d&&R<T+1&&(R=T+1);let A=0,N="",z=0,q=0,K=0,M=!1,x=0,W=!1,U=0,$=[],j=I!==-1&&O!==-1;for(let G=0;G<R;G++){p.loadCell(G,this._workCell);let Z=this._workCell.getWidth();if(Z===0)continue;let Q=!1,te=G,V=this._workCell;if(P.length>0&&G===P[0][0]){Q=!0;let Y=P.shift();V=new s.JoinedCellData(this._workCell,p.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),te=Y[1]-1,Z=V.getWidth()}let Pe=this._isCellInSelection(G,m),ft=d&&G===T,pt=j&&G>=I&&G<=O,vt=!1;this._decorationService.forEachDecorationAtCell(G,m,void 0,Y=>{vt=!0});let Ke=V.getChars()||_.WHITESPACE_CELL_CHAR;if(Ke===" "&&(V.isUnderline()||V.isOverline())&&(Ke="\xA0"),U=Z*D-F.get(Ke,V.isBold(),V.isItalic()),k){if(A&&(Pe&&W||!Pe&&!W&&V.bg===z)&&(Pe&&W&&C.selectionForeground||V.fg===q)&&V.extended.ext===K&&pt===M&&U===x&&!ft&&!Q&&!vt){V.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=Ke,A++;continue}A&&(k.textContent=N),k=this._document.createElement("span"),A=0,N=""}else k=this._document.createElement("span");if(z=V.bg,q=V.fg,K=V.extended.ext,M=pt,x=U,W=Pe,Q&&T>=G&&T<=te&&(T=G),!this._coreService.isCursorHidden&&ft&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)B&&$.push("xterm-cursor-blink"),$.push(b==="bar"?"xterm-cursor-bar":b==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){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(V.isBold()&&$.push("xterm-bold"),V.isItalic()&&$.push("xterm-italic"),V.isDim()&&$.push("xterm-dim"),N=V.isInvisible()?_.WHITESPACE_CELL_CHAR:V.getChars()||_.WHITESPACE_CELL_CHAR,V.isUnderline()&&($.push(`xterm-underline-${V.extended.underlineStyle}`),N===" "&&(N="\xA0"),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let Y=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&Y<8&&(Y+=8),k.style.textDecorationColor=C.ansi[Y].css}V.isOverline()&&($.push("xterm-overline"),N===" "&&(N="\xA0")),V.isStrikethrough()&&$.push("xterm-strikethrough"),pt&&(k.style.textDecoration="underline");let ne=V.getFgColor(),He=V.getFgColorMode(),ae=V.getBgColor(),Fe=V.getBgColorMode(),gt=!!V.isInverse();if(gt){let Y=ne;ne=ae,ae=Y;let Oi=He;He=Fe,Fe=Oi}let pe,Ve,ve,Ne=!1;switch(this._decorationService.forEachDecorationAtCell(G,m,void 0,Y=>{Y.options.layer!=="top"&&Ne||(Y.backgroundColorRGB&&(Fe=50331648,ae=Y.backgroundColorRGB.rgba>>8&16777215,pe=Y.backgroundColorRGB),Y.foregroundColorRGB&&(He=50331648,ne=Y.foregroundColorRGB.rgba>>8&16777215,Ve=Y.foregroundColorRGB),Ne=Y.options.layer==="top")}),!Ne&&Pe&&(pe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ae=pe.rgba>>8&16777215,Fe=50331648,Ne=!0,C.selectionForeground&&(He=50331648,ne=C.selectionForeground.rgba>>8&16777215,Ve=C.selectionForeground)),Ne&&$.push("xterm-decoration-top"),Fe){case 16777216:case 33554432:ve=C.ansi[ae],$.push(`xterm-bg-${ae}`);break;case 50331648:ve=u.channels.toColor(ae>>16,ae>>8&255,255&ae),this._addStyle(k,`background-color:#${g((ae>>>0).toString(16),"0",6)}`);break;default:gt?(ve=C.foreground,$.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):ve=C.background}switch(pe||V.isDim()&&(pe=u.color.multiplyOpacity(ve,.5)),He){case 16777216:case 33554432:V.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(k,ve,C.ansi[ne],V,pe,void 0)||$.push(`xterm-fg-${ne}`);break;case 50331648:let Y=u.channels.toColor(ne>>16&255,ne>>8&255,255&ne);this._applyMinimumContrast(k,ve,Y,V,pe,Ve)||this._addStyle(k,`color:#${g(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,ve,C.foreground,V,pe,Ve)||gt&&$.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}$.length&&(k.className=$.join(" "),$.length=0),ft||Q||vt?k.textContent=N:A++,U!==this.defaultSpacing&&(k.style.letterSpacing=`${U}px`),H.push(k),G=te}return k&&A&&(k.textContent=N),H}_applyMinimumContrast(p,m,d,b,L,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(b.getCode()))return!1;let B=this._getContrastCache(b),D;if(L||T||(D=B.getColor(m.rgba,d.rgba)),D===void 0){let F=this._optionsService.rawOptions.minimumContrastRatio/(b.isDim()?2:1);D=u.color.ensureContrastRatio(L||m,T||d,F),B.setColor((L||m).rgba,(T||d).rgba,D??null)}return!!D&&(this._addStyle(p,`color:${D.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,m){p.setAttribute("style",`${p.getAttribute("style")||""}${m};`)}_isCellInSelection(p,m){let d=this._selectionStart,b=this._selectionEnd;return!(!d||!b)&&(this._columnSelectMode?d[0]<=b[0]?p>=d[0]&&m>=d[1]&&p<b[0]&&m<=b[1]:p<d[0]&&m>=d[1]&&p>=b[0]&&m<=b[1]:m>d[1]&&m<b[1]||d[1]===b[1]&&m===d[1]&&p>=d[0]&&p<b[0]||d[1]<b[1]&&m===b[1]&&p<b[0]||d[1]<b[1]&&m===d[1]&&p>=d[0])}};function g(p,m,d){for(;p.length<d;)p=m+p;return p}r.DomRendererRowFactory=c=h([f(1,t.ICharacterJoinerService),f(2,S.IOptionsService),f(3,t.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,t.IThemeService)],c)},2550:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(n,h){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 f=n.createElement("span");f.classList.add("xterm-char-measure-element");let o=n.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let _=n.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let v=n.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,o,_,v],this._container.appendChild(f),this._container.appendChild(o),this._container.appendChild(_),this._container.appendChild(v),h.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,h,f,o){n===this._font&&h===this._fontSize&&f===this._weight&&o===this._weightBold||(this._font=n,this._fontSize=h,this._weight=f,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(n,h,f){let o=0;if(!h&&!f&&n.length===1&&(o=n.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let S=this._measure(n,0);return S>0&&(this._flat[o]=S),S}let _=n;h&&(_+="B"),f&&(_+="I");let v=this._holey.get(_);if(v===void 0){let S=0;h&&(S|=1),f&&(S|=2),v=this._measure(n,S),v>0&&this._holey.set(_,v)}return v}_measure(n,h){let f=this._measureElements[h];return f.textContent=n.repeat(32),f.offsetWidth/32}}},2223:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let h=n(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(E,r)=>{function n(f){return 57508<=f&&f<=57558}function h(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=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(f){if(!f)throw new Error("value must not be falsy");return f},r.isPowerlineGlyph=n,r.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},r.isEmoji=h,r.allowRescaling=function(f,o,_,v){return o===1&&_>Math.ceil(1.5*v)&&f!==void 0&&f>255&&!h(f)&&!n(f)&&!function(S){return 57344<=S&&S<=63743}(f)},r.treatGlyphAsBackgroundColor=function(f){return n(f)||function(o){return 9472<=o&&o<=9631}(f)},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(f,o,_=0){return(f-(2*Math.round(o)-_))%(2*Math.round(o))}},6052:(E,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(f,o,_,v=!1){if(this.selectionStart=o,this.selectionEnd=_,!o||!_||o[0]===_[0]&&o[1]===_[1])return void this.clear();let S=f.buffers.active.ydisp,u=o[1]-S,t=_[1]-S,s=Math.max(u,0),e=Math.min(t,f.rows-1);s>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=u,this.viewportEndRow=t,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=o[0],this.endCol=_[0])}isCellSelected(f,o,_){return!!this.hasSelection&&(_-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&_>=this.viewportCappedStartRow&&o<this.endCol&&_<=this.viewportCappedEndRow:o<this.startCol&&_>=this.viewportCappedStartRow&&o>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol)}}r.createSelectionRenderModel=function(){return new n}},456:(E,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,h=this.selectionEnd;return!(!n||!h)&&(n[1]>h[1]||n[1]===h[1]&&n[0]>h[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(E,r,n){var h=this&&this.__decorate||function(e,i,c,g){var p,m=arguments.length,d=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(e,i,c,g);else for(var b=e.length-1;b>=0;b--)(p=e[b])&&(d=(m<3?p(d):m>3?p(i,c,d):p(i,c))||d);return m>3&&d&&Object.defineProperty(i,c,d),d},f=this&&this.__param||function(e,i){return function(c,g){i(c,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let o=n(2585),_=n(8460),v=n(844),S=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,i,c){super(),this._optionsService=c,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 t(e,i,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=S=h([f(2,o.IOptionsService)],S);class u extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(i,c){i!==void 0&&i>0&&c!==void 0&&c>0&&(this._result.width=i,this._result.height=c)}}class t extends u{constructor(i,c,g){super(),this._document=i,this._parentElement=c,this._optionsService=g,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 u{constructor(i){super(),this._optionsService=i,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let c=this._ctx.measureText("W");if(!("width"in c&&"fontBoundingBoxAscent"in c&&"fontBoundingBoxDescent"in c))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let i=this._ctx.measureText("W");return this._validateAndSet(i.width,i.fontBoundingBoxAscent+i.fontBoundingBoxDescent),this._result}}},4269:function(E,r,n){var h=this&&this.__decorate||function(s,e,i,c){var g,p=arguments.length,m=p<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,c);else for(var d=s.length-1;d>=0;d--)(g=s[d])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(s,e){return function(i,c){e(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let o=n(3734),_=n(643),v=n(511),S=n(2585);class u extends o.AttributeData{constructor(e,i,c){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=c}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=u;let t=r.CharacterJoinerService=class Ut{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||i.length===0)return[];let c=[],g=i.translateToString(!0),p=0,m=0,d=0,b=i.getFg(0),L=i.getBg(0);for(let T=0;T<i.getTrimmedLength();T++)if(i.loadCell(T,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==b||this._workCell.bg!==L){if(T-p>1){let B=this._getJoinedRanges(g,d,m,i,p);for(let D=0;D<B.length;D++)c.push(B[D])}p=T,d=m,b=this._workCell.fg,L=this._workCell.bg}m+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){let T=this._getJoinedRanges(g,d,m,i,p);for(let B=0;B<T.length;B++)c.push(T[B])}return c}_getJoinedRanges(e,i,c,g,p){let m=e.substring(i,c),d=[];try{d=this._characterJoiners[0].handler(m)}catch(b){console.error(b)}for(let b=1;b<this._characterJoiners.length;b++)try{let L=this._characterJoiners[b].handler(m);for(let T=0;T<L.length;T++)Ut._mergeRanges(d,L[T])}catch(L){console.error(L)}return this._stringRangesToCellRanges(d,g,p),d}_stringRangesToCellRanges(e,i,c){let g=0,p=!1,m=0,d=e[g];if(d){for(let b=c;b<this._bufferService.cols;b++){let L=i.getWidth(b),T=i.getString(b).length||_.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!p&&d[0]<=m&&(d[0]=b,p=!0),d[1]<=m){if(d[1]=b,d=e[++g],!d)break;d[0]<=m?(d[0]=b,p=!0):p=!1}m+=T}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let c=!1;for(let g=0;g<e.length;g++){let p=e[g];if(c){if(i[1]<=p[0])return e[g-1][1]=i[1],e;if(i[1]<=p[1])return e[g-1][1]=Math.max(i[1],p[1]),e.splice(g,1),e;e.splice(g,1),g--}else{if(i[1]<=p[0])return e.splice(g,0,i),e;if(i[1]<=p[1])return p[0]=Math.min(i[0],p[0]),e;i[0]<p[1]&&(p[0]=Math.min(i[0],p[0]),c=!0)}}return c?e[e.length-1][1]=i[1]:e.push(i),e}};r.CharacterJoinerService=t=h([f(0,S.IBufferService)],t)},5114:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let h=n(844),f=n(8460),o=n(3656);class _ extends h.Disposable{constructor(u,t,s){super(),this._textarea=u,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(u){this._window!==u&&(this._window=u,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=_;class v extends h.Disposable{constructor(u){super(),this._parentWindow=u,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(u){this._parentWindow=u,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:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let h=n(844);class f extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}r.LinkProviderService=f},8934:function(E,r,n){var h=this&&this.__decorate||function(S,u,t,s){var e,i=arguments.length,c=i<3?u:s===null?s=Object.getOwnPropertyDescriptor(u,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(S,u,t,s);else for(var g=S.length-1;g>=0;g--)(e=S[g])&&(c=(i<3?e(c):i>3?e(u,t,c):e(u,t))||c);return i>3&&c&&Object.defineProperty(u,t,c),c},f=this&&this.__param||function(S,u){return function(t,s){u(t,s,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let o=n(4725),_=n(9806),v=r.MouseService=class{constructor(S,u){this._renderService=S,this._charSizeService=u}getCoords(S,u,t,s,e){return(0,_.getCoords)(window,S,u,t,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(S,u){let t=(0,_.getCoordsRelativeToElement)(window,S,u);if(this._charSizeService.hasValidSize)return t[0]=Math.min(Math.max(t[0],0),this._renderService.dimensions.css.canvas.width-1),t[1]=Math.min(Math.max(t[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(t[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(t[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(t[0]),y:Math.floor(t[1])}}};r.MouseService=v=h([f(0,o.IRenderService),f(1,o.ICharSizeService)],v)},3230:function(E,r,n){var h=this&&this.__decorate||function(e,i,c,g){var p,m=arguments.length,d=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(e,i,c,g);else for(var b=e.length-1;b>=0;b--)(p=e[b])&&(d=(m<3?p(d):m>3?p(i,c,d):p(i,c))||d);return m>3&&d&&Object.defineProperty(i,c,d),d},f=this&&this.__param||function(e,i){return function(c,g){i(c,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let o=n(6193),_=n(4725),v=n(8460),S=n(844),u=n(7226),t=n(2585),s=r.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,i,c,g,p,m,d,b){super(),this._rowCount=e,this._charSizeService=g,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer((L,T)=>this._renderRows(L,T),d),this.register(this._renderDebouncer),this.register(d.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(c.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(p.onDecorationRegistered(()=>this._fullRefresh())),this.register(p.onDecorationRemoved(()=>this._fullRefresh())),this.register(c.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(c.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(b.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(d.window,i),this.register(d.onWindowChange(L=>this._registerIntersectionObserver(L,i)))}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let c=new e.IntersectionObserver(g=>this._handleIntersectionChange(g[g.length-1]),{threshold:0});c.observe(i),this._observerDisposable.value=(0,S.toDisposable)(()=>c.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,i,c=!1){this._isPaused?this._needsFullRefresh=!0:(c||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount))}_renderRows(e,i){this._renderer.value&&(e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0)}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.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,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,c){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=c,this._renderer.value?.handleSelectionChanged(e,i,c)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=s=h([f(2,t.IOptionsService),f(3,_.ICharSizeService),f(4,t.IDecorationService),f(5,t.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],s)},9312:function(E,r,n){var h=this&&this.__decorate||function(d,b,L,T){var B,D=arguments.length,F=D<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,L):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(d,b,L,T);else for(var I=d.length-1;I>=0;I--)(B=d[I])&&(F=(D<3?B(F):D>3?B(b,L,F):B(b,L))||F);return D>3&&F&&Object.defineProperty(b,L,F),F},f=this&&this.__param||function(d,b){return function(L,T){b(L,T,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let o=n(9806),_=n(9504),v=n(456),S=n(4725),u=n(8460),t=n(844),s=n(6114),e=n(4841),i=n(511),c=n(2585),g="\xA0",p=new RegExp(g,"g"),m=r.SelectionService=class extends t.Disposable{constructor(d,b,L,T,B,D,F,I,O){super(),this._element=d,this._screenElement=b,this._linkifier=L,this._bufferService=T,this._coreService=B,this._mouseService=D,this._optionsService=F,this._renderService=I,this._coreBrowserService=O,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new i.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(H=>this._handleTrim(H)),this.register(this._bufferService.buffers.onBufferActivate(H=>this._handleBufferActivate(H))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,t.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 d=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;return!(!d||!b||d[0]===b[0]&&d[1]===b[1])}get selectionText(){let d=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;if(!d||!b)return"";let L=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(d[0]===b[0])return"";let B=d[0]<b[0]?d[0]:b[0],D=d[0]<b[0]?b[0]:d[0];for(let F=d[1];F<=b[1];F++){let I=L.translateBufferLineToString(F,!0,B,D);T.push(I)}}else{let B=d[1]===b[1]?b[0]:void 0;T.push(L.translateBufferLineToString(d[1],!0,d[0],B));for(let D=d[1]+1;D<=b[1]-1;D++){let F=L.lines.get(D),I=L.translateBufferLineToString(D,!0);F?.isWrapped?T[T.length-1]+=I:T.push(I)}if(d[1]!==b[1]){let D=L.lines.get(b[1]),F=L.translateBufferLineToString(b[1],!0,0,b[0]);D&&D.isWrapped?T[T.length-1]+=F:T.push(F)}}return T.map(B=>B.replace(p," ")).join(s.isWindows?`\r
6
6
  `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(c){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s.isLinux&&c&&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(c){let C=this._getMouseBufferCoords(c),R=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(R&&T&&C)&&this._areCoordsInSelection(C,R,T)}isCellInSelection(c,C){let R=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!R||!T)&&this._areCoordsInSelection([c,C],R,T)}_areCoordsInSelection(c,C,R){return c[1]>C[1]&&c[1]<R[1]||C[1]===R[1]&&c[1]===C[1]&&c[0]>=C[0]&&c[0]<R[0]||C[1]<R[1]&&c[1]===R[1]&&c[0]<R[0]||C[1]<R[1]&&c[1]===C[1]&&c[0]>=C[0]}_selectWordAtCursor(c,C){let R=this._linkifier.currentLink?.link?.range;if(R)return this._model.selectionStart=[R.start.x-1,R.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(R,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let T=this._getMouseBufferCoords(c);return!!T&&(this._selectWordAt(T,C),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(c,C){this._model.clearSelection(),c=Math.max(c,0),C=Math.min(C,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,c],this._model.selectionEnd=[this._bufferService.cols,C],this.refresh(),this._onSelectionChange.fire()}_handleTrim(c){this._model.handleTrim(c)&&this.refresh()}_getMouseBufferCoords(c){let C=this._mouseService.getCoords(c,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(C)return C[0]--,C[1]--,C[1]+=this._bufferService.buffer.ydisp,C}_getMouseEventScrollAmount(c){let C=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,c,this._screenElement)[1],R=this._renderService.dimensions.css.canvas.height;return C>=0&&C<=R?0:(C>R&&(C-=R),C=Math.min(Math.max(C,-50),50),C/=50,C/Math.abs(C)+Math.round(14*C))}shouldForceSelection(c){return s.isMac?c.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:c.shiftKey}handleMouseDown(c){if(this._mouseDownTimeStamp=c.timeStamp,(c.button!==2||!this.hasSelection)&&c.button===0){if(!this._enabled){if(!this.shouldForceSelection(c))return;c.stopPropagation()}c.preventDefault(),this._dragScrollAmount=0,this._enabled&&c.shiftKey?this._handleIncrementalClick(c):c.detail===1?this._handleSingleClick(c):c.detail===2?this._handleDoubleClick(c):c.detail===3&&this._handleTripleClick(c),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(c){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(c))}_handleSingleClick(c){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(c)?3:0,this._model.selectionStart=this._getMouseBufferCoords(c),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let C=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);C&&C.length!==this._model.selectionStart[0]&&C.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(c){this._selectWordAtCursor(c,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(c){let C=this._getMouseBufferCoords(c);C&&(this._activeSelectionMode=2,this._selectLineAt(C[1]))}shouldColumnSelect(c){return c.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(c){if(c.stopImmediatePropagation(),!this._model.selectionStart)return;let C=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(c),!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(c),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){let T=R.lines.get(this._model.selectionEnd[1]);T&&T.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}C&&C[0]===this._model.selectionEnd[0]&&C[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 c=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(c.ydisp+this._bufferService.rows,c.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=c.ydisp),this.refresh()}}_handleMouseUp(c){let C=c.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&C<500&&c.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let R=this._mouseService.getCoords(c,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){let T=(0,f.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(T,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let c=this._model.finalSelectionStart,C=this._model.finalSelectionEnd,R=!(!c||!C||c[0]===C[0]&&c[1]===C[1]);R?c&&C&&(this._oldSelectionStart&&this._oldSelectionEnd&&c[0]===this._oldSelectionStart[0]&&c[1]===this._oldSelectionStart[1]&&C[0]===this._oldSelectionEnd[0]&&C[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(c,C,R)):this._oldHasSelection&&this._fireOnSelectionChange(c,C,R)}_fireOnSelectionChange(c,C,R){this._oldSelectionStart=c,this._oldSelectionEnd=C,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(c){this.clearSelection(),this._trimListener.dispose(),this._trimListener=c.activeBuffer.lines.onTrim(C=>this._handleTrim(C))}_convertViewportColToCharacterIndex(c,C){let R=C;for(let T=0;C>=T;T++){let B=c.loadCell(T,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:B>1&&C!==T&&(R+=B-1)}return R}setSelection(c,C,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[c,C],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(c){this._isClickInSelection(c)||(this._selectWordAtCursor(c,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(c,C,R=!0,T=!0){if(c[0]>=this._bufferService.cols)return;let B=this._bufferService.buffer,D=B.lines.get(c[1]);if(!D)return;let F=B.translateBufferLineToString(c[1],!1),I=this._convertViewportColToCharacterIndex(D,c[0]),O=I,H=c[0]-I,P=0,b=0,x=0,L=0;if(F.charAt(I)===" "){for(;I>0&&F.charAt(I-1)===" ";)I--;for(;O<F.length&&F.charAt(O+1)===" ";)O++}else{let $=c[0],q=c[0];D.getWidth($)===0&&(P++,$--),D.getWidth(q)===2&&(b++,q++);let K=D.getString(q).length;for(K>1&&(L+=K-1,O+=K-1);$>0&&I>0&&!this._isCharWordSeparator(D.loadCell($-1,this._workCell));){D.loadCell($-1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===0?(P++,$--):M>1&&(x+=M-1,I-=M-1),I--,$--}for(;q<D.length&&O+1<F.length&&!this._isCharWordSeparator(D.loadCell(q+1,this._workCell));){D.loadCell(q+1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,q++):M>1&&(L+=M-1,O+=M-1),O++,q++}}O++;let A=I+H-P+x,W=Math.min(this._bufferService.cols,O-I+P+b-x-L);if(C||F.slice(I,O).trim()!==""){if(R&&A===0&&D.getCodePoint(0)!==32){let $=B.lines.get(c[1]-1);if($&&D.isWrapped&&$.getCodePoint(this._bufferService.cols-1)!==32){let q=this._getWordAt([this._bufferService.cols-1,c[1]-1],!1,!0,!1);if(q){let K=this._bufferService.cols-q.start;A-=K,W+=K}}}if(T&&A+W===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){let $=B.lines.get(c[1]+1);if($?.isWrapped&&$.getCodePoint(0)!==32){let q=this._getWordAt([0,c[1]+1],!1,!1,!0);q&&(W+=q.length)}}return{start:A,length:W}}}_selectWordAt(c,C){let R=this._getWordAt(c,C);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,c[1]--;this._model.selectionStart=[R.start,c[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(c){let C=this._getWordAt(c,!0);if(C){let R=c[1];for(;C.start<0;)C.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;C.start+C.length>this._bufferService.cols;)C.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?C.start:C.start+C.length,R]}}_isCharWordSeparator(c){return c.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(c.getChars())>=0}_selectLineAt(c){let C=this._bufferService.buffer.getWrappedRangeForLine(c),R={start:{x:0,y:C.first},end:{x:this._bufferService.cols-1,y:C.last}};this._model.selectionStart=[0,C.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(R,this._bufferService.cols)}};r.SelectionService=m=h([_(3,l.IBufferService),_(4,l.ICoreService),_(5,S.IMouseService),_(6,l.IOptionsService),_(7,S.IRenderService),_(8,S.ICoreBrowserService)],m)},4725:(k,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 h=n(8343);r.ICharSizeService=(0,h.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),r.IMouseService=(0,h.createDecorator)("MouseService"),r.IRenderService=(0,h.createDecorator)("RenderService"),r.ISelectionService=(0,h.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,h.createDecorator)("ThemeService"),r.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(k,r,n){var h=this&&this.__decorate||function(m,c,C,R){var T,B=arguments.length,D=B<3?c:R===null?R=Object.getOwnPropertyDescriptor(c,C):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(m,c,C,R);else for(var F=m.length-1;F>=0;F--)(T=m[F])&&(D=(B<3?T(D):B>3?T(c,C,D):T(c,C))||D);return B>3&&D&&Object.defineProperty(c,C,D),D},_=this&&this.__param||function(m,c){return function(C,R){c(C,R,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let o=n(7239),f=n(8055),v=n(8460),S=n(844),u=n(2585),t=f.css.toColor("#ffffff"),s=f.css.toColor("#000000"),e=f.css.toColor("#ffffff"),i=f.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let m=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],c=[0,95,135,175,215,255];for(let C=0;C<216;C++){let R=c[C/36%6|0],T=c[C/6%6|0],B=c[C%6];m.push({css:f.channels.toCss(R,T,B),rgba:f.channels.toRgba(R,T,B)})}for(let C=0;C<24;C++){let R=8+10*C;m.push({css:f.channels.toCss(R,R,R),rgba:f.channels.toRgba(R,R,R)})}return m})());let g=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:t,background:s,cursor:e,cursorAccent:i,selectionForeground:void 0,selectionBackgroundTransparent:l,selectionBackgroundOpaque:f.color.blend(s,l),selectionInactiveBackgroundTransparent:l,selectionInactiveBackgroundOpaque:f.color.blend(s,l),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(m={}){let c=this._colors;if(c.foreground=p(m.foreground,t),c.background=p(m.background,s),c.cursor=p(m.cursor,e),c.cursorAccent=p(m.cursorAccent,i),c.selectionBackgroundTransparent=p(m.selectionBackground,l),c.selectionBackgroundOpaque=f.color.blend(c.background,c.selectionBackgroundTransparent),c.selectionInactiveBackgroundTransparent=p(m.selectionInactiveBackground,c.selectionBackgroundTransparent),c.selectionInactiveBackgroundOpaque=f.color.blend(c.background,c.selectionInactiveBackgroundTransparent),c.selectionForeground=m.selectionForeground?p(m.selectionForeground,f.NULL_COLOR):void 0,c.selectionForeground===f.NULL_COLOR&&(c.selectionForeground=void 0),f.color.isOpaque(c.selectionBackgroundTransparent)&&(c.selectionBackgroundTransparent=f.color.opacity(c.selectionBackgroundTransparent,.3)),f.color.isOpaque(c.selectionInactiveBackgroundTransparent)&&(c.selectionInactiveBackgroundTransparent=f.color.opacity(c.selectionInactiveBackgroundTransparent,.3)),c.ansi=r.DEFAULT_ANSI_COLORS.slice(),c.ansi[0]=p(m.black,r.DEFAULT_ANSI_COLORS[0]),c.ansi[1]=p(m.red,r.DEFAULT_ANSI_COLORS[1]),c.ansi[2]=p(m.green,r.DEFAULT_ANSI_COLORS[2]),c.ansi[3]=p(m.yellow,r.DEFAULT_ANSI_COLORS[3]),c.ansi[4]=p(m.blue,r.DEFAULT_ANSI_COLORS[4]),c.ansi[5]=p(m.magenta,r.DEFAULT_ANSI_COLORS[5]),c.ansi[6]=p(m.cyan,r.DEFAULT_ANSI_COLORS[6]),c.ansi[7]=p(m.white,r.DEFAULT_ANSI_COLORS[7]),c.ansi[8]=p(m.brightBlack,r.DEFAULT_ANSI_COLORS[8]),c.ansi[9]=p(m.brightRed,r.DEFAULT_ANSI_COLORS[9]),c.ansi[10]=p(m.brightGreen,r.DEFAULT_ANSI_COLORS[10]),c.ansi[11]=p(m.brightYellow,r.DEFAULT_ANSI_COLORS[11]),c.ansi[12]=p(m.brightBlue,r.DEFAULT_ANSI_COLORS[12]),c.ansi[13]=p(m.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),c.ansi[14]=p(m.brightCyan,r.DEFAULT_ANSI_COLORS[14]),c.ansi[15]=p(m.brightWhite,r.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){let C=Math.min(c.ansi.length-16,m.extendedAnsi.length);for(let R=0;R<C;R++)c.ansi[R+16]=p(m.extendedAnsi[R],r.DEFAULT_ANSI_COLORS[R+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(m){this._restoreColor(m),this._onChangeColors.fire(this.colors)}_restoreColor(m){if(m!==void 0)switch(m){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[m]=this._restoreColors.ansi[m]}else for(let c=0;c<this._restoreColors.ansi.length;++c)this._colors.ansi[c]=this._restoreColors.ansi[c]}modifyColors(m){m(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function p(m,c){if(m!==void 0)try{return f.css.toColor(m)}catch{}return c}r.ThemeService=g=h([_(0,u.IOptionsService)],g)},6349:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let h=n(8460),_=n(844);class o extends _.Disposable{constructor(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;let S=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)S[u]=this._array[this._getCyclicIndex(u)];this._array=S,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let S=this._length;S<v;S++)this._array[S]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,S){this._array[this._getCyclicIndex(v)]=S}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,S,...u){if(S){for(let t=v;t<this._length-S;t++)this._array[this._getCyclicIndex(t)]=this._array[this._getCyclicIndex(t+S)];this._length-=S,this.onDeleteEmitter.fire({index:v,amount:S})}for(let t=this._length-1;t>=v;t--)this._array[this._getCyclicIndex(t+u.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<u.length;t++)this._array[this._getCyclicIndex(v+t)]=u[t];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){let t=this._length+u.length-this._maxLength;this._startIndex+=t,this._length=this._maxLength,this.onTrimEmitter.fire(t)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,S,u){if(!(S<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let s=S-1;s>=0;s--)this.set(v+s+u,this.get(v+s));let t=v+S+u-this._length;if(t>0)for(this._length+=t;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let t=0;t<S;t++)this.set(v+t+u,this.get(v+t))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=o},1439:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function n(h,_=5){if(typeof h!="object")return h;let o=Array.isArray(h)?[]:{};for(let f in h)o[f]=_<=1?h[f]:h[f]&&n(h[f],_-1);return o}},8055:(k,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,h=0,_=0,o=0;var f,v,S,u,t;function s(i){let l=i.toString(16);return l.length<2?"0"+l:l}function e(i,l){return i<l?(l+.05)/(i+.05):(i+.05)/(l+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},function(i){i.toCss=function(l,g,p,m){return m!==void 0?`#${s(l)}${s(g)}${s(p)}${s(m)}`:`#${s(l)}${s(g)}${s(p)}`},i.toRgba=function(l,g,p,m=255){return(l<<24|g<<16|p<<8|m)>>>0},i.toColor=function(l,g,p,m){return{css:i.toCss(l,g,p,m),rgba:i.toRgba(l,g,p,m)}}}(f||(r.channels=f={})),function(i){function l(g,p){return o=Math.round(255*p),[n,h,_]=t.toChannels(g.rgba),{css:f.toCss(n,h,_,o),rgba:f.toRgba(n,h,_,o)}}i.blend=function(g,p){if(o=(255&p.rgba)/255,o===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,c=p.rgba>>16&255,C=p.rgba>>8&255,R=g.rgba>>24&255,T=g.rgba>>16&255,B=g.rgba>>8&255;return n=R+Math.round((m-R)*o),h=T+Math.round((c-T)*o),_=B+Math.round((C-B)*o),{css:f.toCss(n,h,_),rgba:f.toRgba(n,h,_)}},i.isOpaque=function(g){return(255&g.rgba)==255},i.ensureContrastRatio=function(g,p,m){let c=t.ensureContrastRatio(g.rgba,p.rgba,m);if(c)return f.toColor(c>>24&255,c>>16&255,c>>8&255)},i.opaque=function(g){let p=(255|g.rgba)>>>0;return[n,h,_]=t.toChannels(p),{css:f.toCss(n,h,_),rgba:p}},i.opacity=l,i.multiplyOpacity=function(g,p){return o=255&g.rgba,l(g,o*p/255)},i.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(v||(r.color=v={})),function(i){let l,g;try{let p=document.createElement("canvas");p.width=1,p.height=1;let m=p.getContext("2d",{willReadFrequently:!0});m&&(l=m,l.globalCompositeOperation="copy",g=l.createLinearGradient(0,0,1,1))}catch{}i.toColor=function(p){if(p.match(/#[\da-f]{3,8}/i))switch(p.length){case 4:return n=parseInt(p.slice(1,2).repeat(2),16),h=parseInt(p.slice(2,3).repeat(2),16),_=parseInt(p.slice(3,4).repeat(2),16),f.toColor(n,h,_);case 5:return n=parseInt(p.slice(1,2).repeat(2),16),h=parseInt(p.slice(2,3).repeat(2),16),_=parseInt(p.slice(3,4).repeat(2),16),o=parseInt(p.slice(4,5).repeat(2),16),f.toColor(n,h,_,o);case 7:return{css:p,rgba:(parseInt(p.slice(1),16)<<8|255)>>>0};case 9:return{css:p,rgba:parseInt(p.slice(1),16)>>>0}}let m=p.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return n=parseInt(m[1]),h=parseInt(m[2]),_=parseInt(m[3]),o=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),f.toColor(n,h,_,o);if(!l||!g)throw new Error("css.toColor: Unsupported css format");if(l.fillStyle=g,l.fillStyle=p,typeof l.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(l.fillRect(0,0,1,1),[n,h,_,o]=l.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(n,h,_,o),css:p}}}(S||(r.css=S={})),function(i){function l(g,p,m){let c=g/255,C=p/255,R=m/255;return .2126*(c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4))+.7152*(C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4))+.0722*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))}i.relativeLuminance=function(g){return l(g>>16&255,g>>8&255,255&g)},i.relativeLuminance2=l}(u||(r.rgb=u={})),function(i){function l(p,m,c){let C=p>>24&255,R=p>>16&255,T=p>>8&255,B=m>>24&255,D=m>>16&255,F=m>>8&255,I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(C,R,T));for(;I<c&&(B>0||D>0||F>0);)B-=Math.max(0,Math.ceil(.1*B)),D-=Math.max(0,Math.ceil(.1*D)),F-=Math.max(0,Math.ceil(.1*F)),I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(C,R,T));return(B<<24|D<<16|F<<8|255)>>>0}function g(p,m,c){let C=p>>24&255,R=p>>16&255,T=p>>8&255,B=m>>24&255,D=m>>16&255,F=m>>8&255,I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(C,R,T));for(;I<c&&(B<255||D<255||F<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),D=Math.min(255,D+Math.ceil(.1*(255-D))),F=Math.min(255,F+Math.ceil(.1*(255-F))),I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(C,R,T));return(B<<24|D<<16|F<<8|255)>>>0}i.blend=function(p,m){if(o=(255&m)/255,o===1)return m;let c=m>>24&255,C=m>>16&255,R=m>>8&255,T=p>>24&255,B=p>>16&255,D=p>>8&255;return n=T+Math.round((c-T)*o),h=B+Math.round((C-B)*o),_=D+Math.round((R-D)*o),f.toRgba(n,h,_)},i.ensureContrastRatio=function(p,m,c){let C=u.relativeLuminance(p>>8),R=u.relativeLuminance(m>>8);if(e(C,R)<c){if(R<C){let D=l(p,m,c),F=e(C,u.relativeLuminance(D>>8));if(F<c){let I=g(p,m,c);return F>e(C,u.relativeLuminance(I>>8))?D:I}return D}let T=g(p,m,c),B=e(C,u.relativeLuminance(T>>8));if(B<c){let D=l(p,m,c);return B>e(C,u.relativeLuminance(D>>8))?T:D}return T}},i.reduceLuminance=l,i.increaseLuminance=g,i.toChannels=function(p){return[p>>24&255,p>>16&255,p>>8&255,255&p]}}(t||(r.rgba=t={})),r.toPaddedHex=s,r.contrastRatio=e},8969:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let h=n(844),_=n(2585),o=n(4348),f=n(7866),v=n(744),S=n(7302),u=n(6975),t=n(8460),s=n(1753),e=n(1480),i=n(7994),l=n(9282),g=n(5435),p=n(5981),m=n(2660),c=!1;class C extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new t.EventEmitter),this._onScroll.event(T=>{this._onScrollApi?.fire(T.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(T){for(let B in T)this.optionsService.options[B]=T[B]}constructor(T){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new t.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new t.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new t.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new t.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new t.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new S.OptionsService(T)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.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,t.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,t.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,t.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,t.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new p.WriteBuffer((B,D)=>this._inputHandler.parse(B,D))),this.register((0,t.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(T,B){this._writeBuffer.write(T,B)}writeSync(T,B){this._logService.logLevel<=_.LogLevelEnum.WARN&&!c&&(this._logService.warn("writeSync is unreliable and will be removed soon."),c=!0),this._writeBuffer.writeSync(T,B)}input(T,B=!0){this.coreService.triggerDataEvent(T,B)}resize(T,B){isNaN(T)||isNaN(B)||(T=Math.max(T,v.MINIMUM_COLS),B=Math.max(B,v.MINIMUM_ROWS),this._bufferService.resize(T,B))}scroll(T,B=!1){this._bufferService.scroll(T,B)}scrollLines(T,B,D){this._bufferService.scrollLines(T,B,D)}scrollPages(T){this.scrollLines(T*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(T){let B=T-this._bufferService.buffer.ydisp;B!==0&&this.scrollLines(B)}registerEscHandler(T,B){return this._inputHandler.registerEscHandler(T,B)}registerDcsHandler(T,B){return this._inputHandler.registerDcsHandler(T,B)}registerCsiHandler(T,B){return this._inputHandler.registerCsiHandler(T,B)}registerOscHandler(T,B){return this._inputHandler.registerOscHandler(T,B)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let T=!1,B=this.optionsService.rawOptions.windowsPty;B&&B.buildNumber!==void 0&&B.buildNumber!==void 0?T=B.backend==="conpty"&&B.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(T=!0),T?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let T=[];T.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),T.push(this.registerCsiHandler({final:"H"},()=>((0,l.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(let B of T)B.dispose()})}}}r.CoreTerminal=C},8460:(k,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 h=0;h<this._listeners.length;h++)if(this._listeners[h]===n)return void this._listeners.splice(h,1)}}})),this._event}fire(n,h){let _=[];for(let o=0;o<this._listeners.length;o++)_.push(this._listeners[o]);for(let o=0;o<_.length;o++)_[o].call(void 0,n,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(n,h){return n(_=>h.fire(_))},r.runAndSubscribe=function(n,h){return h(void 0),n(_=>h(_))}},5435:function(k,r,n){var h=this&&this.__decorate||function(P,b,x,L){var A,W=arguments.length,$=W<3?b:L===null?L=Object.getOwnPropertyDescriptor(b,x):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(P,b,x,L);else for(var q=P.length-1;q>=0;q--)(A=P[q])&&($=(W<3?A($):W>3?A(b,x,$):A(b,x))||$);return W>3&&$&&Object.defineProperty(b,x,$),$},_=this&&this.__param||function(P,b){return function(x,L){b(x,L,P)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let o=n(2584),f=n(7116),v=n(2015),S=n(844),u=n(482),t=n(8437),s=n(8460),e=n(643),i=n(511),l=n(3734),g=n(2585),p=n(1480),m=n(6242),c=n(6351),C=n(5941),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function B(P,b){if(P>24)return b.setWinLines||!1;switch(P){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.setWinLines}return!1}var D;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(r.WindowsOptionsReportType=D={}));let F=0;class I extends S.Disposable{getAttrData(){return this._curAttrData}constructor(b,x,L,A,W,$,q,K,M=new v.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=x,this._coreService=L,this._logService=A,this._optionsService=W,this._oscLinkService=$,this._coreMouseService=q,this._unicodeService=K,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new i.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.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 O(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(y=>this._activeBuffer=y.activeBuffer)),this._parser.setCsiHandlerFallback((y,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(y),params:N.toArray()})}),this._parser.setEscHandlerFallback(y=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(y)})}),this._parser.setExecuteHandlerFallback(y=>{this._logService.debug("Unknown EXECUTE code: ",{code:y})}),this._parser.setOscHandlerFallback((y,N,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:y,action:N,data:U})}),this._parser.setDcsHandlerFallback((y,N,U)=>{N==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(y),action:N,payload:U})}),this._parser.setPrintHandler((y,N,U)=>this.print(y,N,U)),this._parser.registerCsiHandler({final:"@"},y=>this.insertChars(y)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},y=>this.scrollLeft(y)),this._parser.registerCsiHandler({final:"A"},y=>this.cursorUp(y)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},y=>this.scrollRight(y)),this._parser.registerCsiHandler({final:"B"},y=>this.cursorDown(y)),this._parser.registerCsiHandler({final:"C"},y=>this.cursorForward(y)),this._parser.registerCsiHandler({final:"D"},y=>this.cursorBackward(y)),this._parser.registerCsiHandler({final:"E"},y=>this.cursorNextLine(y)),this._parser.registerCsiHandler({final:"F"},y=>this.cursorPrecedingLine(y)),this._parser.registerCsiHandler({final:"G"},y=>this.cursorCharAbsolute(y)),this._parser.registerCsiHandler({final:"H"},y=>this.cursorPosition(y)),this._parser.registerCsiHandler({final:"I"},y=>this.cursorForwardTab(y)),this._parser.registerCsiHandler({final:"J"},y=>this.eraseInDisplay(y,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},y=>this.eraseInDisplay(y,!0)),this._parser.registerCsiHandler({final:"K"},y=>this.eraseInLine(y,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},y=>this.eraseInLine(y,!0)),this._parser.registerCsiHandler({final:"L"},y=>this.insertLines(y)),this._parser.registerCsiHandler({final:"M"},y=>this.deleteLines(y)),this._parser.registerCsiHandler({final:"P"},y=>this.deleteChars(y)),this._parser.registerCsiHandler({final:"S"},y=>this.scrollUp(y)),this._parser.registerCsiHandler({final:"T"},y=>this.scrollDown(y)),this._parser.registerCsiHandler({final:"X"},y=>this.eraseChars(y)),this._parser.registerCsiHandler({final:"Z"},y=>this.cursorBackwardTab(y)),this._parser.registerCsiHandler({final:"`"},y=>this.charPosAbsolute(y)),this._parser.registerCsiHandler({final:"a"},y=>this.hPositionRelative(y)),this._parser.registerCsiHandler({final:"b"},y=>this.repeatPrecedingCharacter(y)),this._parser.registerCsiHandler({final:"c"},y=>this.sendDeviceAttributesPrimary(y)),this._parser.registerCsiHandler({prefix:">",final:"c"},y=>this.sendDeviceAttributesSecondary(y)),this._parser.registerCsiHandler({final:"d"},y=>this.linePosAbsolute(y)),this._parser.registerCsiHandler({final:"e"},y=>this.vPositionRelative(y)),this._parser.registerCsiHandler({final:"f"},y=>this.hVPosition(y)),this._parser.registerCsiHandler({final:"g"},y=>this.tabClear(y)),this._parser.registerCsiHandler({final:"h"},y=>this.setMode(y)),this._parser.registerCsiHandler({prefix:"?",final:"h"},y=>this.setModePrivate(y)),this._parser.registerCsiHandler({final:"l"},y=>this.resetMode(y)),this._parser.registerCsiHandler({prefix:"?",final:"l"},y=>this.resetModePrivate(y)),this._parser.registerCsiHandler({final:"m"},y=>this.charAttributes(y)),this._parser.registerCsiHandler({final:"n"},y=>this.deviceStatus(y)),this._parser.registerCsiHandler({prefix:"?",final:"n"},y=>this.deviceStatusPrivate(y)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},y=>this.softReset(y)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},y=>this.setCursorStyle(y)),this._parser.registerCsiHandler({final:"r"},y=>this.setScrollRegion(y)),this._parser.registerCsiHandler({final:"s"},y=>this.saveCursor(y)),this._parser.registerCsiHandler({final:"t"},y=>this.windowOptions(y)),this._parser.registerCsiHandler({final:"u"},y=>this.restoreCursor(y)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},y=>this.insertColumns(y)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},y=>this.deleteColumns(y)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},y=>this.selectProtected(y)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},y=>this.requestMode(y,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},y=>this.requestMode(y,!1)),this._parser.setExecuteHandler(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 m.OscHandler(y=>(this.setTitle(y),this.setIconName(y),!0))),this._parser.registerOscHandler(1,new m.OscHandler(y=>this.setIconName(y))),this._parser.registerOscHandler(2,new m.OscHandler(y=>this.setTitle(y))),this._parser.registerOscHandler(4,new m.OscHandler(y=>this.setOrReportIndexedColor(y))),this._parser.registerOscHandler(8,new m.OscHandler(y=>this.setHyperlink(y))),this._parser.registerOscHandler(10,new m.OscHandler(y=>this.setOrReportFgColor(y))),this._parser.registerOscHandler(11,new m.OscHandler(y=>this.setOrReportBgColor(y))),this._parser.registerOscHandler(12,new m.OscHandler(y=>this.setOrReportCursorColor(y))),this._parser.registerOscHandler(104,new m.OscHandler(y=>this.restoreIndexedColor(y))),this._parser.registerOscHandler(110,new m.OscHandler(y=>this.restoreFgColor(y))),this._parser.registerOscHandler(111,new m.OscHandler(y=>this.restoreBgColor(y))),this._parser.registerOscHandler(112,new m.OscHandler(y=>this.restoreCursorColor(y))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let y in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:y},()=>this.selectCharset("("+y)),this._parser.registerEscHandler({intermediates:")",final:y},()=>this.selectCharset(")"+y)),this._parser.registerEscHandler({intermediates:"*",final:y},()=>this.selectCharset("*"+y)),this._parser.registerEscHandler({intermediates:"+",final:y},()=>this.selectCharset("+"+y)),this._parser.registerEscHandler({intermediates:"-",final:y},()=>this.selectCharset("-"+y)),this._parser.registerEscHandler({intermediates:".",final:y},()=>this.selectCharset("."+y)),this._parser.registerEscHandler({intermediates:"/",final:y},()=>this.selectCharset("/"+y));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(y=>(this._logService.error("Parsing error: ",y),y)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new c.DcsHandler((y,N)=>this.requestStatusString(y,N)))}_preserveStack(b,x,L,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=L,this._parseStack.position=A}_logSlowResolvingAsync(b){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([b,new Promise((x,L)=>setTimeout(()=>L("#SLOW_TIMEOUT"),5e3))]).catch(x=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,x){let L,A=this._activeBuffer.x,W=this._activeBuffer.y,$=0,q=this._parseStack.paused;if(q){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(L),L;A=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>T&&($=this._parseStack.position+T)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,y=>String.fromCharCode(y)).join("")}"`),typeof b=="string"?b.split("").map(y=>y.charCodeAt(0)):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(b.length,T))),q||this._dirtyRowTracker.clearRange(),b.length>T)for(let y=$;y<b.length;y+=T){let N=y+T<b.length?y+T:b.length,U=typeof b=="string"?this._stringDecoder.decode(b.substring(y,N),this._parseBuffer):this._utf8Decoder.decode(b.subarray(y,N),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,U))return this._preserveStack(A,W,U,y),this._logSlowResolvingAsync(L),L}else if(!q){let y=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,y))return this._preserveStack(A,W,y,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===A&&this._activeBuffer.y===W||this._onCursorMove.fire();let K=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M,this._bufferService.rows-1),Math.min(K,this._bufferService.rows-1))}print(b,x,L){let A,W,$=this._charsetService.charset,q=this._optionsService.rawOptions.screenReaderMode,K=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,y=this._coreService.modes.insertMode,N=this._curAttrData,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-x>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let j=this._parser.precedingJoinState;for(let z=x;z<L;++z){if(A=b[z],A<127&&$){let te=$[String.fromCharCode(A)];te&&(A=te.charCodeAt(0))}let G=this._unicodeService.charProperties(A,j);W=p.UnicodeService.extractWidth(G);let Z=p.UnicodeService.extractShouldJoin(G),Q=Z?p.UnicodeService.extractWidth(j):0;if(j=G,q&&this._onA11yChar.fire((0,u.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-Q>K){if(M){let te=U,V=this._activeBuffer.x-Q;for(this._activeBuffer.x=Q,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Q>0&&U instanceof t.BufferLine&&U.copyCellsFrom(te,V,0,Q,!1);V<K;)te.setCellFromCodepoint(V++,0,1,N)}else if(this._activeBuffer.x=K-1,W===2)continue}if(Z&&this._activeBuffer.x){let te=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-te,A,W);for(let V=W-Q;--V>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(y&&(U.insertCells(this._activeBuffer.x,W-Q,this._activeBuffer.getNullCell(N)),U.getWidth(K-1)===2&&U.setCellFromCodepoint(K-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,N)),U.setCellFromCodepoint(this._activeBuffer.x++,A,W,N),W>0)for(;--W;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=j,this._activeBuffer.x<K&&L-x>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,x){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,x):this._parser.registerCsiHandler(b,L=>!B(L.params[0],this._optionsService.rawOptions.windowOptions)||x(L))}registerDcsHandler(b,x){return this._parser.registerDcsHandler(b,new c.DcsHandler(x))}registerEscHandler(b,x){return this._parser.registerEscHandler(b,x)}registerOscHandler(b,x){return this._parser.registerOscHandler(b,new m.OscHandler(x))}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 b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,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(b,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=b,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+x)}cursorUp(b){let x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let x=b.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=b.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=b.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let x=b.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,x,L,A=!1,W=!1){let $=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);$.replaceCells(x,L,this._activeBuffer.getNullCell(this._eraseAttrData()),W),A&&($.isWrapped=!1)}_resetBufferLine(b,x=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),L.isWrapped=!1)}eraseInDisplay(b,x=!1){let L;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);L<this._bufferService.rows;L++)this._resetBufferLine(L,x);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,x);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,x);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(b,x=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let x=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=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(;x--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let x=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=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;x--;)this._activeBuffer.lines.splice(L,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(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let x=b.params[0]||1;for(;x--;)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(b){let x=b.params[0]||1;for(;x--;)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(t.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let x=this._parser.precedingJoinState;if(!x)return!0;let L=b.params[0]||1,A=p.UnicodeService.extractWidth(x),W=this._activeBuffer.x-A,$=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),q=new Uint32Array($.length*L),K=0;for(let y=0;y<$.length;){let N=$.codePointAt(y)||0;q[K++]=N,y+=N>65535?2:1}let M=K;for(let y=1;y<L;++y)q.copyWithin(M,0,K),M+=K;return this.print(q,0,M),!0}sendDeviceAttributesPrimary(b){return b.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(b){return b.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(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),this._charsetService.setgCharset(1,f.DEFAULT_CHARSET),this._charsetService.setgCharset(2,f.DEFAULT_CHARSET),this._charsetService.setgCharset(3,f.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let x=0;x<b.length;x++)switch(b.params[x]){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(),b.params[x]===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(b,x){let L=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:W}=this._coreMouseService,$=this._coreService,{buffers:q,cols:K}=this._bufferService,{active:M,alt:y}=q,N=this._optionsService.rawOptions,U=Z=>Z?1:2,j=b.params[0];return z=j,G=x?j===2?4:j===4?U($.modes.insertMode):j===12?3:j===20?U(N.convertEol):0:j===1?U(L.applicationCursorKeys):j===3?N.windowOptions.setWinLines?K===80?2:K===132?1:0:0:j===6?U(L.origin):j===7?U(L.wraparound):j===8?3:j===9?U(A==="X10"):j===12?U(N.cursorBlink):j===25?U(!$.isCursorHidden):j===45?U(L.reverseWraparound):j===66?U(L.applicationKeypad):j===67?4:j===1e3?U(A==="VT200"):j===1002?U(A==="DRAG"):j===1003?U(A==="ANY"):j===1004?U(L.sendFocus):j===1005?4:j===1006?U(W==="SGR"):j===1015?4:j===1016?U(W==="SGR_PIXELS"):j===1048?1:j===47||j===1047||j===1049?U(M===y):j===2004?U(L.bracketedPasteMode):0,$.triggerDataEvent(`${o.C0.ESC}[${x?"":"?"}${z};${G}$y`),!0;var z,G}_updateAttrColor(b,x,L,A,W){return x===2?(b|=50331648,b&=-16777216,b|=l.AttributeData.fromColorRGB([L,A,W])):x===5&&(b&=-50331904,b|=33554432|255&L),b}_extractColor(b,x,L){let A=[0,0,-1,0,0,0],W=0,$=0;do{if(A[$+W]=b.params[x+$],b.hasSubParams(x+$)){let q=b.getSubParams(x+$),K=0;do A[1]===5&&(W=1),A[$+K+1+W]=q[K];while(++K<q.length&&K+$+1+W<A.length);break}if(A[1]===5&&$+W>=2||A[1]===2&&$+W>=5)break;A[1]&&(W=1)}while(++$+x<b.length&&$+W<A.length);for(let q=2;q<A.length;++q)A[q]===-1&&(A[q]=0);switch(A[0]){case 38:L.fg=this._updateAttrColor(L.fg,A[1],A[3],A[4],A[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,A[1],A[3],A[4],A[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,A[1],A[3],A[4],A[5])}return $}_processUnderline(b,x){x.extended=x.extended.clone(),(!~b||b>5)&&(b=1),x.extended.underlineStyle=b,x.fg|=268435456,b===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(b){b.fg=t.DEFAULT_ATTR_DATA.fg,b.bg=t.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let x=b.length,L,A=this._curAttrData;for(let W=0;W<x;W++)L=b.params[W],L>=30&&L<=37?(A.fg&=-50331904,A.fg|=16777216|L-30):L>=40&&L<=47?(A.bg&=-50331904,A.bg|=16777216|L-40):L>=90&&L<=97?(A.fg&=-50331904,A.fg|=16777224|L-90):L>=100&&L<=107?(A.bg&=-50331904,A.bg|=16777224|L-100):L===0?this._processSGR0(A):L===1?A.fg|=134217728:L===3?A.bg|=67108864:L===4?(A.fg|=268435456,this._processUnderline(b.hasSubParams(W)?b.getSubParams(W)[0]:1,A)):L===5?A.fg|=536870912:L===7?A.fg|=67108864:L===8?A.fg|=1073741824:L===9?A.fg|=2147483648:L===2?A.bg|=134217728:L===21?this._processUnderline(2,A):L===22?(A.fg&=-134217729,A.bg&=-134217729):L===23?A.bg&=-67108865:L===24?(A.fg&=-268435457,this._processUnderline(0,A)):L===25?A.fg&=-536870913:L===27?A.fg&=-67108865:L===28?A.fg&=-1073741825:L===29?A.fg&=2147483647:L===39?(A.fg&=-67108864,A.fg|=16777215&t.DEFAULT_ATTR_DATA.fg):L===49?(A.bg&=-67108864,A.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?W+=this._extractColor(b,W,A):L===53?A.bg|=1073741824:L===55?A.bg&=-1073741825:L===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):L===100?(A.fg&=-67108864,A.fg|=16777215&t.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let x=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${x};${L}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let x=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${x};${L}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=t.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(b){let x=b.params[0]||1;switch(x){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 L=x%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(b){let x=b.params[0]||1,L;return(b.length<2||(L=b.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(b){if(!B(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let x=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:x!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){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(b){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(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let x=[],L=b.split(";");for(;L.length>1;){let A=L.shift(),W=L.shift();if(/^\d+$/.exec(A)){let $=parseInt(A);if(H($))if(W==="?")x.push({type:0,index:$});else{let q=(0,C.parseColor)(W);q&&x.push({type:1,index:$,color:q})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(b){let x=b.split(";");return!(x.length<2)&&(x[1]?this._createHyperlink(x[0],x[1]):!x[0]&&this._finishHyperlink())}_createHyperlink(b,x){this._getCurrentLinkId()&&this._finishHyperlink();let L=b.split(":"),A,W=L.findIndex($=>$.startsWith("id="));return W!==-1&&(A=L[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,x){let L=b.split(";");for(let A=0;A<L.length&&!(x>=this._specialColors.length);++A,++x)if(L[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{let W=(0,C.parseColor)(L[A]);W&&this._onColor.fire([{type:1,index:this._specialColors[x],color:W}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let x=[],L=b.split(";");for(let A=0;A<L.length;++A)if(/^\d+$/.exec(L[A])){let W=parseInt(L[A]);H(W)&&x.push({type:2,index:W})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){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,f.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(R[b[0]],f.CHARSETS[b[1]]||f.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 b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,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=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new i.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let x=0;x<this._bufferService.rows;++x){let L=this._activeBuffer.ybase+this._activeBuffer.y+x,A=this._activeBuffer.lines.get(L);A&&(A.fill(b),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,x){let L=this._bufferService.buffer,A=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${W}${o.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,x){this._dirtyRowTracker.markRangeDirty(b,x)}}r.InputHandler=I;let O=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){P<this.start?this.start=P:P>this.end&&(this.end=P)}markRangeDirty(P,b){P>b&&(F=P,P=b,b=F),P<this.start&&(this.start=P),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(P){return 0<=P&&P<256}O=h([_(0,g.IBufferService)],O)},844:(k,r)=>{function n(h){for(let _ of h)_.dispose();h.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 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)}},r.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}},r.toDisposable=function(h){return{dispose:h}},r.disposeArray=n,r.getDisposeArrayDisposable=function(h){return{dispose:()=>n(h)}}},1505:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(_,o,f){this._data[_]||(this._data[_]={}),this._data[_][o]=f}get(_,o){return this._data[_]?this._data[_][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=n,r.FourKeyMap=class{constructor(){this._data=new n}set(h,_,o,f,v){this._data.get(h,_)||this._data.set(h,_,new n),this._data.get(h,_).set(o,f,v)}get(h,_,o,f){return this._data.get(h,_)?.get(o,f)}clear(){this._data.clear()}}},6114:(k,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,h=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 _=n.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),r.isIpad=h==="iPad",r.isIphone=h==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),r.isLinux=h.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(n)},6106:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let n=0;r.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(n=this._search(this._getKey(h)),this._array.splice(n,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;let _=this._getKey(h);if(_===void 0||(n=this._search(_),n===-1)||this._getKey(this._array[n])!==_)return!1;do if(this._array[n]===h)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===_);return!1}*getKeyIterator(h){if(this._array.length!==0&&(n=this._search(h),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===h))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===h)}forEachByKey(h,_){if(this._array.length!==0&&(n=this._search(h),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===h))do _(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===h)}values(){return[...this._array].values()}_search(h){let _=0,o=this._array.length-1;for(;o>=_;){let f=_+o>>1,v=this._getKey(this._array[f]);if(v>h)o=f-1;else{if(!(v<h)){for(;f>0&&this._getKey(this._array[f-1])===h;)f--;return f}_=f+1}}return _}}},7226:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let h=n(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let S=0,u=0,t=v.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),u=Math.max(S,u),s=v.timeRemaining(),1.5*u>s)return t-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(t-S))}ms`),void this._start();t=s}this.clear()}}class o extends _{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){let S=Date.now()+v;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let h=n(643);r.updateWindowsModeWrappedState=function(_){let o=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),f=o?.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&f&&(v.isWrapped=f[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&f[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(k,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 h}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 h{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,f=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=f}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let h=n(6349),_=n(7226),o=n(3734),f=n(8437),v=n(4634),S=n(511),u=n(643),t=n(4863),s=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,i,l){this._hasScrollback=e,this._optionsService=i,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.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(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,i){return new f.BufferLine(this._bufferService.cols,this.getNullCell(e),i)}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 i=e+this._optionsService.rawOptions.scrollback;return i>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=f.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}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(e,i){let l=this.getNullCell(f.DEFAULT_ATTR_DATA),g=0,p=this._getCorrectBufferLength(i);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)g+=+this.lines.get(c).resize(e,l);let m=0;if(this._rows<i)for(let c=this._rows;c<i;c++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new f.BufferLine(e,l)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(e,l)));else for(let c=this._rows;c>i;c--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(p<this.lines.maxLength){let c=this.lines.length-p;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=p}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let m=0;m<this.lines.length;m++)g+=+this.lines.get(m).resize(e,l);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),g>.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 i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>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,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let l=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(l.length>0){let g=(0,v.reflowLargerCreateNewLayout)(this.lines,l);(0,v.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(e,i,g.countRemoved)}}_reflowLargerAdjustViewport(e,i,l){let g=this.getNullCell(f.DEFAULT_ATTR_DATA),p=l;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new f.BufferLine(e,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-l,0)}_reflowSmaller(e,i){let l=this.getNullCell(f.DEFAULT_ATTR_DATA),g=[],p=0;for(let m=this.lines.length-1;m>=0;m--){let c=this.lines.get(m);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let C=[c];for(;c.isWrapped&&m>0;)c=this.lines.get(--m),C.unshift(c);let R=this.ybase+this.y;if(R>=m&&R<m+C.length)continue;let T=C[C.length-1].getTrimmedLength(),B=(0,v.reflowSmallerGetNewLineLengths)(C,this._cols,e),D=B.length-C.length,F;F=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);let I=[];for(let L=0;L<D;L++){let A=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);I.push(A)}I.length>0&&(g.push({start:m+C.length+p,newLines:I}),p+=I.length),C.push(...I);let O=B.length-1,H=B[O];H===0&&(O--,H=B[O]);let P=C.length-D-1,b=T;for(;P>=0;){let L=Math.min(b,H);if(C[O]===void 0)break;if(C[O].copyCellsFrom(C[P],b-L,H-L,L,!0),H-=L,H===0&&(O--,H=B[O]),b-=L,b===0){P--;let A=Math.max(P,0);b=(0,v.getWrappedLineTrimmedLength)(C,A,this._cols)}}for(let L=0;L<C.length;L++)B[L]<e&&C[L].setCell(B[L],l);let x=D-F;for(;x-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+i-1)}if(g.length>0){let m=[],c=[];for(let O=0;O<this.lines.length;O++)c.push(this.lines.get(O));let C=this.lines.length,R=C-1,T=0,B=g[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let D=0;for(let O=Math.min(this.lines.maxLength-1,C+p-1);O>=0;O--)if(B&&B.start>R+D){for(let H=B.newLines.length-1;H>=0;H--)this.lines.set(O--,B.newLines[H]);O++,m.push({index:R+1,amount:B.newLines.length}),D+=B.newLines.length,B=g[++T]}else this.lines.set(O,c[R--]);let F=0;for(let O=m.length-1;O>=0;O--)m[O].index+=F,this.lines.onInsertEmitter.fire(m[O]),F+=m[O].amount;let I=Math.max(0,C+p-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(e,i,l=0,g){let p=this.lines.get(e);return p?p.translateToString(i,l,g):""}getWrappedRangeForLine(e){let i=e,l=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;l+1<this.lines.length&&this.lines.get(l+1).isWrapped;)l++;return{first:i,last:l}}setupTabStops(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 i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,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 i=new t.Marker(e);return this.markers.push(i),i.register(this.lines.onTrim(l=>{i.line-=l,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(l=>{i.line>=l.index&&(i.line+=l.amount)})),i.register(this.lines.onDelete(l=>{i.line>=l.index&&i.line<l.index+l.amount&&i.dispose(),i.line>l.index&&(i.line-=l.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let h=n(3734),_=n(511),o=n(643),f=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class S{constructor(t,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);let i=s||_.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let l=0;l<t;++l)this.setCell(l,i);this.length=t}get(t){let s=this._data[3*t+0],e=2097151&s;return[this._data[3*t+1],2097152&s?this._combined[t]:e?(0,f.stringFromCodePoint)(e):"",s>>22,2097152&s?this._combined[t].charCodeAt(this._combined[t].length-1):e]}set(t,s){this._data[3*t+1]=s[o.CHAR_DATA_ATTR_INDEX],s[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[t]=s[1],this._data[3*t+0]=2097152|t|s[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*t+0]=s[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(t){return this._data[3*t+0]>>22}hasWidth(t){return 12582912&this._data[3*t+0]}getFg(t){return this._data[3*t+1]}getBg(t){return this._data[3*t+2]}hasContent(t){return 4194303&this._data[3*t+0]}getCodePoint(t){let s=this._data[3*t+0];return 2097152&s?this._combined[t].charCodeAt(this._combined[t].length-1):2097151&s}isCombined(t){return 2097152&this._data[3*t+0]}getString(t){let s=this._data[3*t+0];return 2097152&s?this._combined[t]:2097151&s?(0,f.stringFromCodePoint)(2097151&s):""}isProtected(t){return 536870912&this._data[3*t+2]}loadCell(t,s){return v=3*t,s.content=this._data[v+0],s.fg=this._data[v+1],s.bg=this._data[v+2],2097152&s.content&&(s.combinedData=this._combined[t]),268435456&s.bg&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){2097152&s.content&&(this._combined[t]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[t]=s.extended),this._data[3*t+0]=s.content,this._data[3*t+1]=s.fg,this._data[3*t+2]=s.bg}setCellFromCodepoint(t,s,e,i){268435456&i.bg&&(this._extendedAttrs[t]=i.extended),this._data[3*t+0]=s|e<<22,this._data[3*t+1]=i.fg,this._data[3*t+2]=i.bg}addCodepointToCell(t,s,e){let i=this._data[3*t+0];2097152&i?this._combined[t]+=(0,f.stringFromCodePoint)(s):2097151&i?(this._combined[t]=(0,f.stringFromCodePoint)(2097151&i)+(0,f.stringFromCodePoint)(s),i&=-2097152,i|=2097152):i=s|4194304,e&&(i&=-12582913,i|=e<<22),this._data[3*t+0]=i}insertCells(t,s,e){if((t%=this.length)&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length-t){let i=new _.CellData;for(let l=this.length-t-s-1;l>=0;--l)this.setCell(t+s+l,this.loadCell(t+l,i));for(let l=0;l<s;++l)this.setCell(t+l,e)}else for(let i=t;i<this.length;++i)this.setCell(i,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(t,s,e){if(t%=this.length,s<this.length-t){let i=new _.CellData;for(let l=0;l<this.length-t-s;++l)this.setCell(t+l,this.loadCell(t+s+l,i));for(let l=this.length-s;l<this.length;++l)this.setCell(l,e)}else for(let i=t;i<this.length;++i)this.setCell(i,e);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),this.getWidth(t)!==0||this.hasContent(t)||this.setCellFromCodepoint(t,0,1,e)}replaceCells(t,s,e,i=!1){if(i)for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,e);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,e),t++;else for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,e);t<s&&t<this.length;)this.setCell(t++,e)}resize(t,s){if(t===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*t;if(t>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let i=new Uint32Array(e);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,s)}else{this._data=this._data.subarray(0,e);let i=Object.keys(this._combined);for(let g=0;g<i.length;g++){let p=parseInt(i[g],10);p>=t&&delete this._combined[p]}let l=Object.keys(this._extendedAttrs);for(let g=0;g<l.length;g++){let p=parseInt(l[g],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,t);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,t)}}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new S(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0])return t+(this._data[3*t+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0]||50331648&this._data[3*t+2])return t+(this._data[3*t+0]>>22);return 0}copyCellsFrom(t,s,e,i,l){let g=t._data;if(l)for(let m=i-1;m>=0;m--){for(let c=0;c<3;c++)this._data[3*(e+m)+c]=g[3*(s+m)+c];268435456&g[3*(s+m)+2]&&(this._extendedAttrs[e+m]=t._extendedAttrs[s+m])}else for(let m=0;m<i;m++){for(let c=0;c<3;c++)this._data[3*(e+m)+c]=g[3*(s+m)+c];268435456&g[3*(s+m)+2]&&(this._extendedAttrs[e+m]=t._extendedAttrs[s+m])}let p=Object.keys(t._combined);for(let m=0;m<p.length;m++){let c=parseInt(p[m],10);c>=s&&(this._combined[c-s+e]=t._combined[c])}}translateToString(t,s,e,i){s=s??0,e=e??this.length,t&&(e=Math.min(e,this.getTrimmedLength())),i&&(i.length=0);let l="";for(;s<e;){let g=this._data[3*s+0],p=2097151&g,m=2097152&g?this._combined[s]:p?(0,f.stringFromCodePoint)(p):o.WHITESPACE_CELL_CHAR;if(l+=m,i)for(let c=0;c<m.length;++c)i.push(s);s+=g>>22||1}return i&&i.push(s),l}}r.BufferLine=S},4841:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(n,h){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 h*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(k,r)=>{function n(h,_,o){if(_===h.length-1)return h[_].getTrimmedLength();let f=!h[_].hasContent(o-1)&&h[_].getWidth(o-1)===1,v=h[_+1].getWidth(0)===2;return f&&v?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(h,_,o,f,v){let S=[];for(let u=0;u<h.length-1;u++){let t=u,s=h.get(++t);if(!s.isWrapped)continue;let e=[h.get(u)];for(;t<h.length&&s.isWrapped;)e.push(s),s=h.get(++t);if(f>=u&&f<t){u+=e.length-1;continue}let i=0,l=n(e,i,_),g=1,p=0;for(;g<e.length;){let c=n(e,g,_),C=c-p,R=o-l,T=Math.min(C,R);e[i].copyCellsFrom(e[g],p,l,T,!1),l+=T,l===o&&(i++,l=0),p+=T,p===c&&(g++,p=0),l===0&&i!==0&&e[i-1].getWidth(o-1)===2&&(e[i].copyCellsFrom(e[i-1],o-1,l++,1,!1),e[i-1].setCell(o-1,v))}e[i].replaceCells(l,o,v);let m=0;for(let c=e.length-1;c>0&&(c>i||e[c].getTrimmedLength()===0);c--)m++;m>0&&(S.push(u+e.length-m),S.push(m)),u+=e.length-1}return S},r.reflowLargerCreateNewLayout=function(h,_){let o=[],f=0,v=_[f],S=0;for(let u=0;u<h.length;u++)if(v===u){let t=_[++f];h.onDeleteEmitter.fire({index:u-S,amount:t}),u+=t-1,S+=t,v=_[++f]}else o.push(u);return{layout:o,countRemoved:S}},r.reflowLargerApplyNewLayout=function(h,_){let o=[];for(let f=0;f<_.length;f++)o.push(h.get(_[f]));for(let f=0;f<o.length;f++)h.set(f,o[f]);h.length=_.length},r.reflowSmallerGetNewLineLengths=function(h,_,o){let f=[],v=h.map((s,e)=>n(h,e,_)).reduce((s,e)=>s+e),S=0,u=0,t=0;for(;t<v;){if(v-t<o){f.push(v-t);break}S+=o;let s=n(h,u,_);S>s&&(S-=s,u++);let e=h[u].getWidth(S-1)===2;e&&S--;let i=e?o-1:o;f.push(i),t+=i}return f},r.getWrappedLineTrimmedLength=n},5295:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let h=n(8460),_=n(844),o=n(9092);class f extends _.Disposable{constructor(S,u){super(),this._optionsService=S,this._bufferService=u,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 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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,u){this._normal.resize(S,u),this._alt.resize(S,u),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}r.BufferSet=f},511:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let h=n(482),_=n(643),o=n(3734);class f extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(S){let u=new f;return u.setFromCharData(S),u}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(S){this.fg=S[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(S[_.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(S[_.CHAR_DATA_CHAR_INDEX].length===2){let t=S[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=t&&t<=56319){let s=S[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(t-55296)+s-56320+65536|S[_.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=S[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[_.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=S[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=f},643:(k,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:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let h=n(8460),_=n(844);class o{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=o._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(v){return this._disposables.push(v),v}}r.Marker=o,o._nextId=1},7116:(k,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:(k,r)=>{var n,h,_;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"}(h||(r.C1=h={})),function(o){o.ST=`${n.ESC}\\`}(_||(r.C1_ESCAPED=_={}))},7399:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let h=n(2584),_={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,f,v,S){let u={type:0,cancel:!1,key:void 0},t=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?u.key=f?h.C0.ESC+"OA":h.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?u.key=f?h.C0.ESC+"OD":h.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?u.key=f?h.C0.ESC+"OC":h.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(u.key=f?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:u.key=o.ctrlKey?"\b":h.C0.DEL,o.altKey&&(u.key=h.C0.ESC+u.key);break;case 9:if(o.shiftKey){u.key=h.C0.ESC+"[Z";break}u.key=h.C0.HT,u.cancel=!0;break;case 13:u.key=o.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,u.cancel=!0;break;case 27:u.key=h.C0.ESC,o.altKey&&(u.key=h.C0.ESC+h.C0.ESC),u.cancel=!0;break;case 37:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"D",u.key===h.C0.ESC+"[1;3D"&&(u.key=h.C0.ESC+(v?"b":"[1;5D"))):u.key=f?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"C",u.key===h.C0.ESC+"[1;3C"&&(u.key=h.C0.ESC+(v?"f":"[1;5C"))):u.key=f?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"A",v||u.key!==h.C0.ESC+"[1;3A"||(u.key=h.C0.ESC+"[1;5A")):u.key=f?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"B",v||u.key!==h.C0.ESC+"[1;3B"||(u.key=h.C0.ESC+"[1;5B")):u.key=f?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(u.key=h.C0.ESC+"[2~");break;case 46:u.key=t?h.C0.ESC+"[3;"+(t+1)+"~":h.C0.ESC+"[3~";break;case 36:u.key=t?h.C0.ESC+"[1;"+(t+1)+"H":f?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:u.key=t?h.C0.ESC+"[1;"+(t+1)+"F":f?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:o.shiftKey?u.type=2:o.ctrlKey?u.key=h.C0.ESC+"[5;"+(t+1)+"~":u.key=h.C0.ESC+"[5~";break;case 34:o.shiftKey?u.type=3:o.ctrlKey?u.key=h.C0.ESC+"[6;"+(t+1)+"~":u.key=h.C0.ESC+"[6~";break;case 112:u.key=t?h.C0.ESC+"[1;"+(t+1)+"P":h.C0.ESC+"OP";break;case 113:u.key=t?h.C0.ESC+"[1;"+(t+1)+"Q":h.C0.ESC+"OQ";break;case 114:u.key=t?h.C0.ESC+"[1;"+(t+1)+"R":h.C0.ESC+"OR";break;case 115:u.key=t?h.C0.ESC+"[1;"+(t+1)+"S":h.C0.ESC+"OS";break;case 116:u.key=t?h.C0.ESC+"[15;"+(t+1)+"~":h.C0.ESC+"[15~";break;case 117:u.key=t?h.C0.ESC+"[17;"+(t+1)+"~":h.C0.ESC+"[17~";break;case 118:u.key=t?h.C0.ESC+"[18;"+(t+1)+"~":h.C0.ESC+"[18~";break;case 119:u.key=t?h.C0.ESC+"[19;"+(t+1)+"~":h.C0.ESC+"[19~";break;case 120:u.key=t?h.C0.ESC+"[20;"+(t+1)+"~":h.C0.ESC+"[20~";break;case 121:u.key=t?h.C0.ESC+"[21;"+(t+1)+"~":h.C0.ESC+"[21~";break;case 122:u.key=t?h.C0.ESC+"[23;"+(t+1)+"~":h.C0.ESC+"[23~";break;case 123:u.key=t?h.C0.ESC+"[24;"+(t+1)+"~":h.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(v&&!S||!o.altKey||o.metaKey)!v||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?u.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(u.key=h.C0.US),o.key==="@"&&(u.key=h.C0.NUL)):o.keyCode===65&&(u.type=1);else{let s=_[o.keyCode],e=s?.[o.shiftKey?1:0];if(e)u.key=h.C0.ESC+e;else if(o.keyCode>=65&&o.keyCode<=90){let i=o.ctrlKey?o.keyCode-64:o.keyCode+32,l=String.fromCharCode(i);o.shiftKey&&(l=l.toUpperCase()),u.key=h.C0.ESC+l}else if(o.keyCode===32)u.key=h.C0.ESC+(o.ctrlKey?h.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let i=o.code.slice(3,4);o.shiftKey||(i=i.toLowerCase()),u.key=h.C0.ESC+i,u.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?u.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?u.key=h.C0.NUL:o.keyCode>=51&&o.keyCode<=55?u.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?u.key=h.C0.DEL:o.keyCode===219?u.key=h.C0.ESC:o.keyCode===220?u.key=h.C0.FS:o.keyCode===221&&(u.key=h.C0.GS)}return u}},482:(k,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,h=0,_=n.length){let o="";for(let f=h;f<_;++f){let v=n[f];v>65535?(v-=65536,o+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):o+=String.fromCharCode(v)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,h){let _=n.length;if(!_)return 0;let o=0,f=0;if(this._interim){let v=n.charCodeAt(f++);56320<=v&&v<=57343?h[o++]=1024*(this._interim-55296)+v-56320+65536:(h[o++]=this._interim,h[o++]=v),this._interim=0}for(let v=f;v<_;++v){let S=n.charCodeAt(v);if(55296<=S&&S<=56319){if(++v>=_)return this._interim=S,o;let u=n.charCodeAt(v);56320<=u&&u<=57343?h[o++]=1024*(S-55296)+u-56320+65536:(h[o++]=S,h[o++]=u)}else S!==65279&&(h[o++]=S)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,h){let _=n.length;if(!_)return 0;let o,f,v,S,u=0,t=0,s=0;if(this.interim[0]){let l=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let p,m=0;for(;(p=63&this.interim[++m])&&m<4;)g<<=6,g|=p;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,C=c-m;for(;s<C;){if(s>=_)return 0;if(p=n[s++],(192&p)!=128){s--,l=!0;break}this.interim[m++]=p,g<<=6,g|=63&p}l||(c===2?g<128?s--:h[u++]=g:c===3?g<2048||g>=55296&&g<=57343||g===65279||(h[u++]=g):g<65536||g>1114111||(h[u++]=g)),this.interim.fill(0)}let e=_-4,i=s;for(;i<_;){for(;!(!(i<e)||128&(o=n[i])||128&(f=n[i+1])||128&(v=n[i+2])||128&(S=n[i+3]));)h[u++]=o,h[u++]=f,h[u++]=v,h[u++]=S,i+=4;if(o=n[i++],o<128)h[u++]=o;else if((224&o)==192){if(i>=_)return this.interim[0]=o,u;if(f=n[i++],(192&f)!=128){i--;continue}if(t=(31&o)<<6|63&f,t<128){i--;continue}h[u++]=t}else if((240&o)==224){if(i>=_)return this.interim[0]=o,u;if(f=n[i++],(192&f)!=128){i--;continue}if(i>=_)return this.interim[0]=o,this.interim[1]=f,u;if(v=n[i++],(192&v)!=128){i--;continue}if(t=(15&o)<<12|(63&f)<<6|63&v,t<2048||t>=55296&&t<=57343||t===65279)continue;h[u++]=t}else if((248&o)==240){if(i>=_)return this.interim[0]=o,u;if(f=n[i++],(192&f)!=128){i--;continue}if(i>=_)return this.interim[0]=o,this.interim[1]=f,u;if(v=n[i++],(192&v)!=128){i--;continue}if(i>=_)return this.interim[0]=o,this.interim[1]=f,this.interim[2]=v,u;if(S=n[i++],(192&S)!=128){i--;continue}if(t=(7&o)<<18|(63&f)<<12|(63&v)<<6|63&S,t<65536||t>1114111)continue;h[u++]=t}}return u}}},225:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let h=n(1480),_=[[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]],f;r.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let v=0;v<_.length;++v)f.fill(0,_[v][0],_[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?f[v]:function(S,u){let t,s=0,e=u.length-1;if(S<u[0][0]||S>u[e][1])return!1;for(;e>=s;)if(t=s+e>>1,S>u[t][1])s=t+1;else{if(!(S<u[t][0]))return!0;e=t-1}return!1}(v,o)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,S){let u=this.wcwidth(v),t=u===0&&S!==0;if(t){let s=h.UnicodeService.extractWidth(S);s===0?t=!1:s>u&&(u=s)}return h.UnicodeService.createPropertyValue(0,u,t)}}},5981:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let h=n(8460),_=n(844);class o extends _.Disposable{constructor(v){super(),this._action=v,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(v,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);let t=this._callbacks.shift();t&&t()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,S){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(S),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(S)}_innerWrite(v=0,S=!0){let u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let t=this._writeBuffer[this._bufferOffset],s=this._action(t,S);if(s){let i=l=>Date.now()-u>=12?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(u,l);return void s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(i)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=t.length,Date.now()-u>=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:(k,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})$/,h=/^[\da-f]+$/;function _(o,f){let v=o.toString(16),S=v.length<2?"0"+v:v;switch(f){case 4:return v[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}r.parseColor=function(o){if(!o)return;let f=o.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);let v=n.exec(f);if(v){let S=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/S*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/S*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/S*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),h.exec(f)&&[3,6,9,12].includes(f.length))){let v=f.length/3,S=[0,0,0];for(let u=0;u<3;++u){let t=parseInt(f.slice(v*u,v*u+v),16);S[u]=v===1?t<<4:v===2?t:v===3?t>>4:t>>8}return S}},r.toRgbString=function(o,f=16){let[v,S,u]=o;return`rgb:${_(v,f)}/${_(S,f)}/${_(u,f)}`}},5770:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let h=n(482),_=n(8742),o=n(5770),f=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(S,u){this._handlers[S]===void 0&&(this._handlers[S]=[]);let t=this._handlers[S];return t.push(u),{dispose:()=>{let s=t.indexOf(u);s!==-1&&t.splice(s,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(S,u){if(this.reset(),this._ident=S,this._active=this._handlers[S]||f,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(S,u,t){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(S,u,t);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(S,u,t))}unhook(S,u=!0){if(this._active.length){let t=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,t=u,e=this._stack.fallThrough,this._stack.paused=!1),!e&&t===!1){for(;s>=0&&(t=this._active[s].unhook(S),t!==!0);s--)if(t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,t;s--}for(;s>=0;s--)if(t=this._active[s].unhook(!1),t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,t}else this._handlerFb(this._ident,"UNHOOK",S);this._active=f,this._ident=0}};let v=new _.Params;v.addParam(0),r.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=v,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():v,this._data="",this._hitLimit=!1}put(S,u,t){this._hitLimit||(this._data+=(0,h.utf32ToString)(S,u,t),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let u=!1;if(this._hitLimit)u=!1;else if(S&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then(t=>(this._params=v,this._data="",this._hitLimit=!1,t));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let h=n(844),_=n(8742),o=n(6242),f=n(6351);class v{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,i,l){this.table[e<<8|s]=i<<4|l}addMany(s,e,i,l){for(let g=0;g<s.length;g++)this.table[e<<8|s[g]]=i<<4|l}}r.TransitionTable=v;let S=160;r.VT500_TRANSITION_TABLE=function(){let t=new v(4095),s=Array.apply(null,Array(256)).map((m,c)=>c),e=(m,c)=>s.slice(m,c),i=e(32,127),l=e(0,24);l.push(25),l.push.apply(l,e(28,32));let g=e(0,14),p;for(p in t.setDefault(1,0),t.addMany(i,0,2,0),g)t.addMany([24,26,153,154],p,3,0),t.addMany(e(128,144),p,3,0),t.addMany(e(144,152),p,3,0),t.add(156,p,0,0),t.add(27,p,11,1),t.add(157,p,4,8),t.addMany([152,158,159],p,0,7),t.add(155,p,11,3),t.add(144,p,11,9);return t.addMany(l,0,3,0),t.addMany(l,1,3,1),t.add(127,1,0,1),t.addMany(l,8,0,8),t.addMany(l,3,3,3),t.add(127,3,0,3),t.addMany(l,4,3,4),t.add(127,4,0,4),t.addMany(l,6,3,6),t.addMany(l,5,3,5),t.add(127,5,0,5),t.addMany(l,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(i,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(e(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(i,7,0,7),t.addMany(l,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(e(64,127),3,7,0),t.addMany(e(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(e(48,60),4,8,4),t.addMany(e(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(e(32,64),6,0,6),t.add(127,6,0,6),t.addMany(e(64,127),6,0,0),t.addMany(e(32,48),3,9,5),t.addMany(e(32,48),5,9,5),t.addMany(e(48,64),5,0,6),t.addMany(e(64,127),5,7,0),t.addMany(e(32,48),4,9,5),t.addMany(e(32,48),1,9,2),t.addMany(e(32,48),2,9,2),t.addMany(e(48,127),2,10,0),t.addMany(e(48,80),1,10,0),t.addMany(e(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(e(96,127),1,10,0),t.add(80,1,11,9),t.addMany(l,9,0,9),t.add(127,9,0,9),t.addMany(e(28,32),9,0,9),t.addMany(e(32,48),9,9,12),t.addMany(e(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(l,11,0,11),t.addMany(e(32,128),11,0,11),t.addMany(e(28,32),11,0,11),t.addMany(l,10,0,10),t.add(127,10,0,10),t.addMany(e(28,32),10,0,10),t.addMany(e(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(e(32,48),10,9,12),t.addMany(l,12,0,12),t.add(127,12,0,12),t.addMany(e(28,32),12,0,12),t.addMany(e(32,48),12,9,12),t.addMany(e(48,64),12,0,11),t.addMany(e(64,127),12,12,13),t.addMany(e(64,127),10,12,13),t.addMany(e(64,127),9,12,13),t.addMany(l,13,13,13),t.addMany(i,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(S,0,2,0),t.add(S,8,5,8),t.add(S,6,0,6),t.add(S,11,0,11),t.add(S,13,13,13),t}();class u extends h.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 _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,l)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},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,h.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 f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(s,e=[64,126]){let i=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=s.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<s.intermediates.length;++g){let p=s.intermediates.charCodeAt(g);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=p}}if(s.final.length!==1)throw new Error("final must be a single byte");let l=s.final.charCodeAt(0);if(e[0]>l||l>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return i<<=8,i|=l,i}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 i=this._identifier(s,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let l=this._escHandlers[i];return l.push(e),{dispose:()=>{let g=l.indexOf(e);g!==-1&&l.splice(g,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 i=this._identifier(s);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let l=this._csiHandlers[i];return l.push(e),{dispose:()=>{let g=l.indexOf(e);g!==-1&&l.splice(g,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,i,l,g){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=i,this._parseStack.transition=l,this._parseStack.chunkPos=g}parse(s,e,i){let l,g=0,p=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,C=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&C>-1){for(;C>=0&&(l=c[C](this._params),l!==!0);C--)if(l instanceof Promise)return this._parseStack.handlerPos=C,l}this._parseStack.handlers=[];break;case 4:if(i===!1&&C>-1){for(;C>=0&&(l=c[C](),l!==!0);C--)if(l instanceof Promise)return this._parseStack.handlerPos=C,l}this._parseStack.handlers=[];break;case 6:if(g=s[this._parseStack.chunkPos],l=this._dcsParser.unhook(g!==24&&g!==26,i),l)return l;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=s[this._parseStack.chunkPos],l=this._oscParser.end(g!==24&&g!==26,i),l)return l;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,m=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let c=m;c<e;++c){switch(g=s[c],p=this._transitions.table[this.currentState<<8|(g<160?g:S)],p>>4){case 2:for(let D=c+1;;++D){if(D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,c,D),c=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,c,D),c=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,c,D),c=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,c,D),c=D-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:c,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let C=this._csiHandlers[this._collect<<8|g],R=C?C.length-1:-1;for(;R>=0&&(l=C[R](this._params),l!==!0);R--)if(l instanceof Promise)return this._preserveStack(3,C,R,p,c),l;R<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(++c<e&&(g=s[c])>47&&g<60);c--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:let T=this._escHandlers[this._collect<<8|g],B=T?T.length-1:-1;for(;B>=0&&(l=T[B](),l!==!0);B--)if(l instanceof Promise)return this._preserveStack(4,T,B,p,c),l;B<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 D=c+1;;++D)if(D>=e||(g=s[D])===24||g===26||g===27||g>127&&g<S){this._dcsParser.put(s,c,D),c=D-1;break}break;case 14:if(l=this._dcsParser.unhook(g!==24&&g!==26),l)return this._preserveStack(6,[],0,p,c),l;g===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let D=c+1;;D++)if(D>=e||(g=s[D])<32||g>127&&g<S){this._oscParser.put(s,c,D),c=D-1;break}break;case 6:if(l=this._oscParser.end(g!==24&&g!==26),l)return this._preserveStack(5,[],0,p,c),l;g===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&p}}}r.EscapeSequenceParser=u},6242:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let h=n(5770),_=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(f,v){this._handlers[f]===void 0&&(this._handlers[f]=[]);let S=this._handlers[f];return S.push(v),{dispose:()=>{let u=S.indexOf(v);u!==-1&&S.splice(u,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].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 f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,v,S){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(f,v,S);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(f,v,S))}start(){this.reset(),this._state=1}put(f,v,S){if(this._state!==3){if(this._state===1)for(;v<S;){let u=f[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&S-v>0&&this._put(f,v,S)}}end(f,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,u=this._active.length-1,t=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,S=v,t=this._stack.fallThrough,this._stack.paused=!1),!t&&S===!1){for(;u>=0&&(S=this._active[u].end(f),S!==!0);u--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,S;u--}for(;u>=0;u--)if(S=this._active[u].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",f);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,v,S){this._hitLimit||(this._data+=(0,_.utf32ToString)(f,v,S),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let v=!1;if(this._hitLimit)v=!1;else if(f&&(v=this._handler(this._data),v instanceof Promise))return v.then(S=>(this._data="",this._hitLimit=!1,S));return this._data="",this._hitLimit=!1,v}}},8742:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let n=2147483647;class h{static fromArray(o){let f=new h;if(!o.length)return f;for(let v=Array.isArray(o[0])?1:0;v<o.length;++v){let S=o[v];if(Array.isArray(S))for(let u=0;u<S.length;++u)f.addSubParam(S[u]);else f.addParam(S)}return f}constructor(o=32,f=32){if(this.maxLength=o,this.maxSubParamsLength=f,f>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new h(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 f=0;f<this.length;++f){o.push(this.params[f]);let v=this._subParamsIdx[f]>>8,S=255&this._subParamsIdx[f];S-v>0&&o.push(Array.prototype.slice.call(this._subParams,v,S))}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 f=this._subParamsIdx[o]>>8,v=255&this._subParamsIdx[o];return v-f>0?this._subParams.subarray(f,v):null}getSubParamsAll(){let o={};for(let f=0;f<this.length;++f){let v=this._subParamsIdx[f]>>8,S=255&this._subParamsIdx[f];S-v>0&&(o[f]=this._subParams.slice(v,S))}return o}addDigit(o){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let v=this._digitIsSub?this._subParams:this.params,S=v[f-1];v[f-1]=~S?Math.min(10*S+o,n):o}}r.Params=h},5741:(k,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,h){let _={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(_),h.dispose=()=>this._wrappedAddonDispose(_),h.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let h=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===n){h=_;break}if(h===-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(h,1)}}},8771:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let h=n(3785),_=n(511);r.BufferApiView=class{constructor(o,f){this._buffer=o,this.type=f}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 f=this._buffer.lines.get(o);if(f)return new h.BufferLineApiView(f)}getNullCell(){return new _.CellData}}},3785:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let h=n(511);r.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,o){if(!(_<0||_>=this._line.length))return o?(this._line.loadCell(_,o),o):this._line.loadCell(_,new h.CellData)}translateToString(_,o,f){return this._line.translateToString(_,o,f)}}},8285:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let h=n(8771),_=n(8460),o=n(844);class f extends o.Disposable{constructor(S){super(),this._core=S,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)}}r.BufferNamespaceApi=f},7975:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,h){return this._core.registerCsiHandler(n,_=>h(_.toArray()))}addCsiHandler(n,h){return this.registerCsiHandler(n,h)}registerDcsHandler(n,h){return this._core.registerDcsHandler(n,(_,o)=>h(_,o.toArray()))}addDcsHandler(n,h){return this.registerDcsHandler(n,h)}registerEscHandler(n,h){return this._core.registerEscHandler(n,h)}addEscHandler(n,h){return this.registerEscHandler(n,h)}registerOscHandler(n,h){return this._core.registerOscHandler(n,h)}addOscHandler(n,h){return this.registerOscHandler(n,h)}}},7090:(k,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(k,r,n){var h=this&&this.__decorate||function(t,s,e,i){var l,g=arguments.length,p=g<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,e,i);else for(var m=t.length-1;m>=0;m--)(l=t[m])&&(p=(g<3?l(p):g>3?l(s,e,p):l(s,e))||p);return g>3&&p&&Object.defineProperty(s,e,p),p},_=this&&this.__param||function(t,s){return function(e,i){s(e,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let o=n(8460),f=n(844),v=n(5295),S=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let u=r.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(t){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(t.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(t.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(t,this))}resize(t,s){this.cols=t,this.rows=s,this.buffers.resize(t,s),this._onResize.fire({cols:t,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,s=!1){let e=this.buffer,i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===t.fg&&i.getBg(0)===t.bg||(i=e.getBlankLine(t,s),this._cachedBlankLine=i),i.isWrapped=s;let l=e.ybase+e.scrollTop,g=e.ybase+e.scrollBottom;if(e.scrollTop===0){let p=e.lines.isFull;g===e.lines.length-1?p?e.lines.recycle().copyFrom(i):e.lines.push(i.clone()):e.lines.splice(g+1,0,i.clone()),p?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let p=g-l+1;e.lines.shiftElements(l+1,p-1,-1),e.lines.set(g,i.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(t,s,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let l=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),l!==i.ydisp&&(s||this._onScroll.fire(i.ydisp))}};r.BufferService=u=h([_(0,S.IOptionsService)],u)},7994:(k,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,h){this._charsets[n]=h,this.glevel===n&&(this.charset=h)}}},1753:function(k,r,n){var h=this&&this.__decorate||function(i,l,g,p){var m,c=arguments.length,C=c<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,l,g,p);else for(var R=i.length-1;R>=0;R--)(m=i[R])&&(C=(c<3?m(C):c>3?m(l,g,C):m(l,g))||C);return c>3&&C&&Object.defineProperty(l,g,C),C},_=this&&this.__param||function(i,l){return function(g,p){l(g,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let o=n(2585),f=n(8460),v=n(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button!==4&&i.action===1&&(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>i.action!==32||i.button!==3},ANY:{events:31,restrict:i=>!0}};function u(i,l){let g=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(g|=64,g|=i.action):(g|=3&i.button,4&i.button&&(g|=64),8&i.button&&(g|=128),i.action===32?g|=32:i.action!==0||l||(g|=3)),g}let t=String.fromCharCode,s={DEFAULT:i=>{let l=[u(i,!1)+32,i.col+32,i.row+32];return l[0]>255||l[1]>255||l[2]>255?"":`\x1B[M${t(l[0])}${t(l[1])}${t(l[2])}`},SGR:i=>{let l=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${u(i,!0)};${i.col};${i.row}${l}`},SGR_PIXELS:i=>{let l=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${u(i,!0)};${i.x};${i.y}${l}`}},e=r.CoreMouseService=class extends v.Disposable{constructor(i,l){super(),this._bufferService=i,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let g of Object.keys(S))this.addProtocol(g,S[g]);for(let g of Object.keys(s))this.addEncoding(g,s[g]);this.reset()}addProtocol(i,l){this._protocols[i]=l}addEncoding(i,l){this._encodings[i]=l}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;let l=this._encodings[this._activeEncoding](i);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(1&i),up:!!(2&i),drag:!!(4&i),move:!!(8&i),wheel:!!(16&i)}}_equalEvents(i,l,g){if(g){if(i.x!==l.x||i.y!==l.y)return!1}else if(i.col!==l.col||i.row!==l.row)return!1;return i.button===l.button&&i.action===l.action&&i.ctrl===l.ctrl&&i.alt===l.alt&&i.shift===l.shift}};r.CoreMouseService=e=h([_(0,o.IBufferService),_(1,o.ICoreService)],e)},6975:function(k,r,n){var h=this&&this.__decorate||function(e,i,l,g){var p,m=arguments.length,c=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,l):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,i,l,g);else for(var C=e.length-1;C>=0;C--)(p=e[C])&&(c=(m<3?p(c):m>3?p(i,l,c):p(i,l))||c);return m>3&&c&&Object.defineProperty(i,l,c),c},_=this&&this.__param||function(e,i){return function(l,g){i(l,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let o=n(1439),f=n(8460),v=n(844),S=n(2585),u=Object.freeze({insertMode:!1}),t=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=r.CoreService=class extends v.Disposable{constructor(e,i,l){super(),this._bufferService=e,this._logService=i,this._optionsService=l,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(u),this.decPrivateModes=(0,o.clone)(t)}reset(){this.modes=(0,o.clone)(u),this.decPrivateModes=(0,o.clone)(t)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let l=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(g=>g.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};r.CoreService=s=h([_(0,S.IBufferService),_(1,S.ILogService),_(2,S.IOptionsService)],s)},9074:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let h=n(8055),_=n(8460),o=n(844),f=n(6106),v=0,S=0;class u extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;let i=new t(e);if(i){let l=i.marker.onDispose(()=>i.dispose());i.onDispose(()=>{i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),l.dispose())}),this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,l){let g=0,p=0;for(let m of this._decorations.getKeyIterator(i))g=m.options.x??0,p=g+(m.options.width??1),e>=g&&e<p&&(!l||(m.options.layer??"bottom")===l)&&(yield m)}forEachDecorationAtCell(e,i,l,g){this._decorations.forEachByKey(i,p=>{v=p.options.x??0,S=v+(p.options.width??1),e>=v&&e<S&&(!l||(p.options.layer??"bottom")===l)&&g(p)})}}r.DecorationService=u;class t extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.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:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let h=n(2585),_=n(8343);class o{constructor(...v){this._entries=new Map;for(let[S,u]of v)this.set(S,u)}set(v,S){let u=this._entries.get(v);return this._entries.set(v,S),u}forEach(v){for(let[S,u]of this._entries.entries())v(S,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(h.IInstantiationService,this)}setService(f,v){this._services.set(f,v)}getService(f){return this._services.get(f)}createInstance(f,...v){let S=(0,_.getServiceDependencies)(f).sort((s,e)=>s.index-e.index),u=[];for(let s of S){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${s.id}.`);u.push(e)}let t=S.length>0?S[0].index:v.length;if(v.length!==t)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${t+1} conflicts with ${v.length} static arguments`);return new f(...v,...u)}}},7866:function(k,r,n){var h=this&&this.__decorate||function(t,s,e,i){var l,g=arguments.length,p=g<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,e,i);else for(var m=t.length-1;m>=0;m--)(l=t[m])&&(p=(g<3?l(p):g>3?l(s,e,p):l(s,e))||p);return g>3&&p&&Object.defineProperty(s,e,p),p},_=this&&this.__param||function(t,s){return function(e,i){s(e,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let o=n(844),f=n(2585),v={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF},S,u=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(t){super(),this._optionsService=t,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),S=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let s=0;s<t.length;s++)typeof t[s]=="function"&&(t[s]=t[s]())}_log(t,s,e){this._evalLazyOptionalParams(e),t.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(t,...s){this._logLevel<=f.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,s)}debug(t,...s){this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,s)}info(t,...s){this._logLevel<=f.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,s)}warn(t,...s){this._logLevel<=f.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,s)}error(t,...s){this._logLevel<=f.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,s)}};r.LogService=u=h([_(0,f.IOptionsService)],u),r.setTraceLogger=function(t){S=t},r.traceCall=function(t,s,e){if(typeof e.value!="function")throw new Error("not supported");let i=e.value;e.value=function(...l){if(S.logLevel!==f.LogLevelEnum.TRACE)return i.apply(this,l);S.trace(`GlyphRenderer#${i.name}(${l.map(p=>JSON.stringify(p)).join(", ")})`);let g=i.apply(this,l);return S.trace(`GlyphRenderer#${i.name} return`,g),g}}},7302:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let h=n(8460),_=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 f=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends _.Disposable{constructor(u){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let t={...r.DEFAULT_OPTIONS};for(let s in u)if(s in t)try{let e=u[s];t[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this.register((0,_.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(u,t){return this.onOptionChange(s=>{s===u&&t(this.rawOptions[u])})}onMultipleOptionChange(u,t){return this.onOptionChange(s=>{u.indexOf(s)!==-1&&t()})}_setupOptions(){let u=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(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:u.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(u,t){switch(u){case"cursorStyle":if(t||(t=r.DEFAULT_OPTIONS[u]),!function(s){return s==="block"||s==="underline"||s==="bar"}(t))throw new Error(`"${t}" is not a valid value for ${u}`);break;case"wordSeparator":t||(t=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=f.includes(t)?t:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${u} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${u} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}return t}}r.OptionsService=v},2660:function(k,r,n){var h=this&&this.__decorate||function(v,S,u,t){var s,e=arguments.length,i=e<3?S:t===null?t=Object.getOwnPropertyDescriptor(S,u):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(v,S,u,t);else for(var l=v.length-1;l>=0;l--)(s=v[l])&&(i=(e<3?s(i):e>3?s(S,u,i):s(S,u))||i);return e>3&&i&&Object.defineProperty(S,u,i),i},_=this&&this.__param||function(v,S){return function(u,t){S(u,t,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let o=n(2585),f=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){let S=this._bufferService.buffer;if(v.id===void 0){let l=S.addMarker(S.ybase+S.y),g={data:v,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(g,l)),this._dataByLinkId.set(g.id,g),g.id}let u=v,t=this._getEntryIdKey(u),s=this._entriesWithId.get(t);if(s)return this.addLineToLink(s.id,S.ybase+S.y),s.id;let e=S.addMarker(S.ybase+S.y),i={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[e]};return e.onDispose(()=>this._removeMarkerFromLink(i,e)),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(v,S){let u=this._dataByLinkId.get(v);if(u&&u.lines.every(t=>t.line!==S)){let t=this._bufferService.buffer.addMarker(S);u.lines.push(t),t.onDispose(()=>this._removeMarkerFromLink(u,t))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,S){let u=v.lines.indexOf(S);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=f=h([_(0,o.IBufferService)],f)},8343:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let n="di$target",h="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[h]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);let o=function(f,v,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,t,s){t[n]===t?t[h].push({id:u,index:s}):(t[h]=[{id:u,index:s}],t[n]=t)})(o,f,S)};return o.toString=()=>_,r.serviceRegistry.set(_,o),o}},2585:(k,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 h=n(8343);var _;r.IBufferService=(0,h.createDecorator)("BufferService"),r.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),r.ICoreService=(0,h.createDecorator)("CoreService"),r.ICharsetService=(0,h.createDecorator)("CharsetService"),r.IInstantiationService=(0,h.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"}(_||(r.LogLevelEnum=_={})),r.ILogService=(0,h.createDecorator)("LogService"),r.IOptionsService=(0,h.createDecorator)("OptionsService"),r.IOscLinkService=(0,h.createDecorator)("OscLinkService"),r.IUnicodeService=(0,h.createDecorator)("UnicodeService"),r.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(k,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let h=n(8460),_=n(225);class o{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,S,u=!1){return(16777215&v)<<3|(3&S)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let v=new _.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let S=0,u=0,t=v.length;for(let s=0;s<t;++s){let e=v.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=t)return S+this.wcwidth(e);let g=v.charCodeAt(s);56320<=g&&g<=57343?e=1024*(e-55296)+g-56320+65536:S+=this.wcwidth(g)}let i=this.charProperties(e,u),l=o.extractWidth(i);o.extractShouldJoin(i)&&(l-=o.extractWidth(u)),S+=l,u=i}return S}charProperties(v,S){return this._activeProvider.charProperties(v,S)}}r.UnicodeService=o}},d={};function w(k){var r=d[k];if(r!==void 0)return r.exports;var n=d[k]={exports:{}};return a[k].call(n.exports,n,n.exports,w),n.exports}var E={};return(()=>{var k=E;Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;let r=w(9042),n=w(3236),h=w(844),_=w(5741),o=w(8285),f=w(7975),v=w(7090),S=["cols","rows"];class u extends h.Disposable{constructor(s){super(),this._core=this.register(new n.Terminal(s)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};let e=l=>this._core.options[l],i=(l,g)=>{this._checkReadonlyOptions(l),this._core.options[l]=g};for(let l in this._core.options){let g={get:e.bind(this,l),set:i.bind(this,l)};Object.defineProperty(this._publicOptions,l,g)}}_checkReadonlyOptions(s){if(S.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 f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.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,i){this._verifyIntegers(s,e,i),this._core.select(s,e,i)}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")}}k.Terminal=u})(),E})())});var It=At((ze,ut)=>{(function(a,d){typeof ze=="object"&&typeof ut=="object"?ut.exports=d():typeof define=="function"&&define.amd?define([],d):typeof ze=="object"?ze.FitAddon=d():a.FitAddon=d()})(self,()=>(()=>{"use strict";var a={};return(()=>{var d=a;Object.defineProperty(d,"__esModule",{value:!0}),d.FitAddon=void 0,d.FitAddon=class{activate(w){this._terminal=w}dispose(){}fit(){let w=this.proposeDimensions();if(!w||!this._terminal||isNaN(w.cols)||isNaN(w.rows))return;let E=this._terminal._core;this._terminal.rows===w.rows&&this._terminal.cols===w.cols||(E._renderService.clear(),this._terminal.resize(w.cols,w.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let w=this._terminal._core,E=w._renderService.dimensions;if(E.css.cell.width===0||E.css.cell.height===0)return;let k=this._terminal.options.scrollback===0?0:w.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),h=Math.max(0,parseInt(r.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),o=n-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),f=h-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-k;return{cols:Math.max(2,Math.floor(f/E.css.cell.width)),rows:Math.max(1,Math.floor(o/E.css.cell.height))}}}})(),a})())});var ui=Bt(Ot(),1),_i=Bt(It(),1);var Ai=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(a){setTimeout(()=>{throw a.stack?Pt.isErrorNoTelemetry(a)?new Pt(a.message+`
7
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(d){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s.isLinux&&d&&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(d){let b=this._getMouseBufferCoords(d),L=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(L&&T&&b)&&this._areCoordsInSelection(b,L,T)}isCellInSelection(d,b){let L=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!L||!T)&&this._areCoordsInSelection([d,b],L,T)}_areCoordsInSelection(d,b,L){return d[1]>b[1]&&d[1]<L[1]||b[1]===L[1]&&d[1]===b[1]&&d[0]>=b[0]&&d[0]<L[0]||b[1]<L[1]&&d[1]===L[1]&&d[0]<L[0]||b[1]<L[1]&&d[1]===b[1]&&d[0]>=b[0]}_selectWordAtCursor(d,b){let L=this._linkifier.currentLink?.link?.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let T=this._getMouseBufferCoords(d);return!!T&&(this._selectWordAt(T,b),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(d,b){this._model.clearSelection(),d=Math.max(d,0),b=Math.min(b,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,d],this._model.selectionEnd=[this._bufferService.cols,b],this.refresh(),this._onSelectionChange.fire()}_handleTrim(d){this._model.handleTrim(d)&&this.refresh()}_getMouseBufferCoords(d){let b=this._mouseService.getCoords(d,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(b)return b[0]--,b[1]--,b[1]+=this._bufferService.buffer.ydisp,b}_getMouseEventScrollAmount(d){let b=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,d,this._screenElement)[1],L=this._renderService.dimensions.css.canvas.height;return b>=0&&b<=L?0:(b>L&&(b-=L),b=Math.min(Math.max(b,-50),50),b/=50,b/Math.abs(b)+Math.round(14*b))}shouldForceSelection(d){return s.isMac?d.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:d.shiftKey}handleMouseDown(d){if(this._mouseDownTimeStamp=d.timeStamp,(d.button!==2||!this.hasSelection)&&d.button===0){if(!this._enabled){if(!this.shouldForceSelection(d))return;d.stopPropagation()}d.preventDefault(),this._dragScrollAmount=0,this._enabled&&d.shiftKey?this._handleIncrementalClick(d):d.detail===1?this._handleSingleClick(d):d.detail===2?this._handleDoubleClick(d):d.detail===3&&this._handleTripleClick(d),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(d){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(d))}_handleSingleClick(d){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(d)?3:0,this._model.selectionStart=this._getMouseBufferCoords(d),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let b=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);b&&b.length!==this._model.selectionStart[0]&&b.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(d){this._selectWordAtCursor(d,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(d){let b=this._getMouseBufferCoords(d);b&&(this._activeSelectionMode=2,this._selectLineAt(b[1]))}shouldColumnSelect(d){return d.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(d){if(d.stopImmediatePropagation(),!this._model.selectionStart)return;let b=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(d),!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(d),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){let T=L.lines.get(this._model.selectionEnd[1]);T&&T.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}b&&b[0]===this._model.selectionEnd[0]&&b[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 d=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(d.ydisp+this._bufferService.rows,d.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=d.ydisp),this.refresh()}}_handleMouseUp(d){let b=d.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&b<500&&d.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let L=this._mouseService.getCoords(d,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){let T=(0,_.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(T,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let d=this._model.finalSelectionStart,b=this._model.finalSelectionEnd,L=!(!d||!b||d[0]===b[0]&&d[1]===b[1]);L?d&&b&&(this._oldSelectionStart&&this._oldSelectionEnd&&d[0]===this._oldSelectionStart[0]&&d[1]===this._oldSelectionStart[1]&&b[0]===this._oldSelectionEnd[0]&&b[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(d,b,L)):this._oldHasSelection&&this._fireOnSelectionChange(d,b,L)}_fireOnSelectionChange(d,b,L){this._oldSelectionStart=d,this._oldSelectionEnd=b,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(d){this.clearSelection(),this._trimListener.dispose(),this._trimListener=d.activeBuffer.lines.onTrim(b=>this._handleTrim(b))}_convertViewportColToCharacterIndex(d,b){let L=b;for(let T=0;b>=T;T++){let B=d.loadCell(T,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:B>1&&b!==T&&(L+=B-1)}return L}setSelection(d,b,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[d,b],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(d){this._isClickInSelection(d)||(this._selectWordAtCursor(d,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(d,b,L=!0,T=!0){if(d[0]>=this._bufferService.cols)return;let B=this._bufferService.buffer,D=B.lines.get(d[1]);if(!D)return;let F=B.translateBufferLineToString(d[1],!1),I=this._convertViewportColToCharacterIndex(D,d[0]),O=I,H=d[0]-I,P=0,C=0,k=0,R=0;if(F.charAt(I)===" "){for(;I>0&&F.charAt(I-1)===" ";)I--;for(;O<F.length&&F.charAt(O+1)===" ";)O++}else{let z=d[0],q=d[0];D.getWidth(z)===0&&(P++,z--),D.getWidth(q)===2&&(C++,q++);let K=D.getString(q).length;for(K>1&&(R+=K-1,O+=K-1);z>0&&I>0&&!this._isCharWordSeparator(D.loadCell(z-1,this._workCell));){D.loadCell(z-1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===0?(P++,z--):M>1&&(k+=M-1,I-=M-1),I--,z--}for(;q<D.length&&O+1<F.length&&!this._isCharWordSeparator(D.loadCell(q+1,this._workCell));){D.loadCell(q+1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,q++):M>1&&(R+=M-1,O+=M-1),O++,q++}}O++;let A=I+H-P+k,N=Math.min(this._bufferService.cols,O-I+P+C-k-R);if(b||F.slice(I,O).trim()!==""){if(L&&A===0&&D.getCodePoint(0)!==32){let z=B.lines.get(d[1]-1);if(z&&D.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){let q=this._getWordAt([this._bufferService.cols-1,d[1]-1],!1,!0,!1);if(q){let K=this._bufferService.cols-q.start;A-=K,N+=K}}}if(T&&A+N===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){let z=B.lines.get(d[1]+1);if(z?.isWrapped&&z.getCodePoint(0)!==32){let q=this._getWordAt([0,d[1]+1],!1,!1,!0);q&&(N+=q.length)}}return{start:A,length:N}}}_selectWordAt(d,b){let L=this._getWordAt(d,b);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,d[1]--;this._model.selectionStart=[L.start,d[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(d){let b=this._getWordAt(d,!0);if(b){let L=d[1];for(;b.start<0;)b.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;b.start+b.length>this._bufferService.cols;)b.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?b.start:b.start+b.length,L]}}_isCharWordSeparator(d){return d.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars())>=0}_selectLineAt(d){let b=this._bufferService.buffer.getWrappedRangeForLine(d),L={start:{x:0,y:b.first},end:{x:this._bufferService.cols-1,y:b.last}};this._model.selectionStart=[0,b.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(L,this._bufferService.cols)}};r.SelectionService=m=h([f(3,c.IBufferService),f(4,c.ICoreService),f(5,S.IMouseService),f(6,c.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],m)},4725:(E,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 h=n(8343);r.ICharSizeService=(0,h.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),r.IMouseService=(0,h.createDecorator)("MouseService"),r.IRenderService=(0,h.createDecorator)("RenderService"),r.ISelectionService=(0,h.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,h.createDecorator)("ThemeService"),r.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(E,r,n){var h=this&&this.__decorate||function(m,d,b,L){var T,B=arguments.length,D=B<3?d:L===null?L=Object.getOwnPropertyDescriptor(d,b):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(m,d,b,L);else for(var F=m.length-1;F>=0;F--)(T=m[F])&&(D=(B<3?T(D):B>3?T(d,b,D):T(d,b))||D);return B>3&&D&&Object.defineProperty(d,b,D),D},f=this&&this.__param||function(m,d){return function(b,L){d(b,L,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let o=n(7239),_=n(8055),v=n(8460),S=n(844),u=n(2585),t=_.css.toColor("#ffffff"),s=_.css.toColor("#000000"),e=_.css.toColor("#ffffff"),i=_.css.toColor("#000000"),c={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let m=[_.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")],d=[0,95,135,175,215,255];for(let b=0;b<216;b++){let L=d[b/36%6|0],T=d[b/6%6|0],B=d[b%6];m.push({css:_.channels.toCss(L,T,B),rgba:_.channels.toRgba(L,T,B)})}for(let b=0;b<24;b++){let L=8+10*b;m.push({css:_.channels.toCss(L,L,L),rgba:_.channels.toRgba(L,L,L)})}return m})());let g=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:t,background:s,cursor:e,cursorAccent:i,selectionForeground:void 0,selectionBackgroundTransparent:c,selectionBackgroundOpaque:_.color.blend(s,c),selectionInactiveBackgroundTransparent:c,selectionInactiveBackgroundOpaque:_.color.blend(s,c),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(m={}){let d=this._colors;if(d.foreground=p(m.foreground,t),d.background=p(m.background,s),d.cursor=p(m.cursor,e),d.cursorAccent=p(m.cursorAccent,i),d.selectionBackgroundTransparent=p(m.selectionBackground,c),d.selectionBackgroundOpaque=_.color.blend(d.background,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundTransparent=p(m.selectionInactiveBackground,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundOpaque=_.color.blend(d.background,d.selectionInactiveBackgroundTransparent),d.selectionForeground=m.selectionForeground?p(m.selectionForeground,_.NULL_COLOR):void 0,d.selectionForeground===_.NULL_COLOR&&(d.selectionForeground=void 0),_.color.isOpaque(d.selectionBackgroundTransparent)&&(d.selectionBackgroundTransparent=_.color.opacity(d.selectionBackgroundTransparent,.3)),_.color.isOpaque(d.selectionInactiveBackgroundTransparent)&&(d.selectionInactiveBackgroundTransparent=_.color.opacity(d.selectionInactiveBackgroundTransparent,.3)),d.ansi=r.DEFAULT_ANSI_COLORS.slice(),d.ansi[0]=p(m.black,r.DEFAULT_ANSI_COLORS[0]),d.ansi[1]=p(m.red,r.DEFAULT_ANSI_COLORS[1]),d.ansi[2]=p(m.green,r.DEFAULT_ANSI_COLORS[2]),d.ansi[3]=p(m.yellow,r.DEFAULT_ANSI_COLORS[3]),d.ansi[4]=p(m.blue,r.DEFAULT_ANSI_COLORS[4]),d.ansi[5]=p(m.magenta,r.DEFAULT_ANSI_COLORS[5]),d.ansi[6]=p(m.cyan,r.DEFAULT_ANSI_COLORS[6]),d.ansi[7]=p(m.white,r.DEFAULT_ANSI_COLORS[7]),d.ansi[8]=p(m.brightBlack,r.DEFAULT_ANSI_COLORS[8]),d.ansi[9]=p(m.brightRed,r.DEFAULT_ANSI_COLORS[9]),d.ansi[10]=p(m.brightGreen,r.DEFAULT_ANSI_COLORS[10]),d.ansi[11]=p(m.brightYellow,r.DEFAULT_ANSI_COLORS[11]),d.ansi[12]=p(m.brightBlue,r.DEFAULT_ANSI_COLORS[12]),d.ansi[13]=p(m.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),d.ansi[14]=p(m.brightCyan,r.DEFAULT_ANSI_COLORS[14]),d.ansi[15]=p(m.brightWhite,r.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){let b=Math.min(d.ansi.length-16,m.extendedAnsi.length);for(let L=0;L<b;L++)d.ansi[L+16]=p(m.extendedAnsi[L],r.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(m){this._restoreColor(m),this._onChangeColors.fire(this.colors)}_restoreColor(m){if(m!==void 0)switch(m){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[m]=this._restoreColors.ansi[m]}else for(let d=0;d<this._restoreColors.ansi.length;++d)this._colors.ansi[d]=this._restoreColors.ansi[d]}modifyColors(m){m(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function p(m,d){if(m!==void 0)try{return _.css.toColor(m)}catch{}return d}r.ThemeService=g=h([f(0,u.IOptionsService)],g)},6349:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let h=n(8460),f=n(844);class o extends f.Disposable{constructor(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;let S=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)S[u]=this._array[this._getCyclicIndex(u)];this._array=S,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let S=this._length;S<v;S++)this._array[S]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,S){this._array[this._getCyclicIndex(v)]=S}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,S,...u){if(S){for(let t=v;t<this._length-S;t++)this._array[this._getCyclicIndex(t)]=this._array[this._getCyclicIndex(t+S)];this._length-=S,this.onDeleteEmitter.fire({index:v,amount:S})}for(let t=this._length-1;t>=v;t--)this._array[this._getCyclicIndex(t+u.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<u.length;t++)this._array[this._getCyclicIndex(v+t)]=u[t];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){let t=this._length+u.length-this._maxLength;this._startIndex+=t,this._length=this._maxLength,this.onTrimEmitter.fire(t)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,S,u){if(!(S<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let s=S-1;s>=0;s--)this.set(v+s+u,this.get(v+s));let t=v+S+u-this._length;if(t>0)for(this._length+=t;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let t=0;t<S;t++)this.set(v+t+u,this.get(v+t))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=o},1439:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function n(h,f=5){if(typeof h!="object")return h;let o=Array.isArray(h)?[]:{};for(let _ in h)o[_]=f<=1?h[_]:h[_]&&n(h[_],f-1);return o}},8055:(E,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,h=0,f=0,o=0;var _,v,S,u,t;function s(i){let c=i.toString(16);return c.length<2?"0"+c:c}function e(i,c){return i<c?(c+.05)/(i+.05):(i+.05)/(c+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},function(i){i.toCss=function(c,g,p,m){return m!==void 0?`#${s(c)}${s(g)}${s(p)}${s(m)}`:`#${s(c)}${s(g)}${s(p)}`},i.toRgba=function(c,g,p,m=255){return(c<<24|g<<16|p<<8|m)>>>0},i.toColor=function(c,g,p,m){return{css:i.toCss(c,g,p,m),rgba:i.toRgba(c,g,p,m)}}}(_||(r.channels=_={})),function(i){function c(g,p){return o=Math.round(255*p),[n,h,f]=t.toChannels(g.rgba),{css:_.toCss(n,h,f,o),rgba:_.toRgba(n,h,f,o)}}i.blend=function(g,p){if(o=(255&p.rgba)/255,o===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,d=p.rgba>>16&255,b=p.rgba>>8&255,L=g.rgba>>24&255,T=g.rgba>>16&255,B=g.rgba>>8&255;return n=L+Math.round((m-L)*o),h=T+Math.round((d-T)*o),f=B+Math.round((b-B)*o),{css:_.toCss(n,h,f),rgba:_.toRgba(n,h,f)}},i.isOpaque=function(g){return(255&g.rgba)==255},i.ensureContrastRatio=function(g,p,m){let d=t.ensureContrastRatio(g.rgba,p.rgba,m);if(d)return _.toColor(d>>24&255,d>>16&255,d>>8&255)},i.opaque=function(g){let p=(255|g.rgba)>>>0;return[n,h,f]=t.toChannels(p),{css:_.toCss(n,h,f),rgba:p}},i.opacity=c,i.multiplyOpacity=function(g,p){return o=255&g.rgba,c(g,o*p/255)},i.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(v||(r.color=v={})),function(i){let c,g;try{let p=document.createElement("canvas");p.width=1,p.height=1;let m=p.getContext("2d",{willReadFrequently:!0});m&&(c=m,c.globalCompositeOperation="copy",g=c.createLinearGradient(0,0,1,1))}catch{}i.toColor=function(p){if(p.match(/#[\da-f]{3,8}/i))switch(p.length){case 4:return n=parseInt(p.slice(1,2).repeat(2),16),h=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),_.toColor(n,h,f);case 5:return n=parseInt(p.slice(1,2).repeat(2),16),h=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),o=parseInt(p.slice(4,5).repeat(2),16),_.toColor(n,h,f,o);case 7:return{css:p,rgba:(parseInt(p.slice(1),16)<<8|255)>>>0};case 9:return{css:p,rgba:parseInt(p.slice(1),16)>>>0}}let m=p.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return n=parseInt(m[1]),h=parseInt(m[2]),f=parseInt(m[3]),o=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(n,h,f,o);if(!c||!g)throw new Error("css.toColor: Unsupported css format");if(c.fillStyle=g,c.fillStyle=p,typeof c.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(c.fillRect(0,0,1,1),[n,h,f,o]=c.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(n,h,f,o),css:p}}}(S||(r.css=S={})),function(i){function c(g,p,m){let d=g/255,b=p/255,L=m/255;return .2126*(d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4))+.7152*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}i.relativeLuminance=function(g){return c(g>>16&255,g>>8&255,255&g)},i.relativeLuminance2=c}(u||(r.rgb=u={})),function(i){function c(p,m,d){let b=p>>24&255,L=p>>16&255,T=p>>8&255,B=m>>24&255,D=m>>16&255,F=m>>8&255,I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));for(;I<d&&(B>0||D>0||F>0);)B-=Math.max(0,Math.ceil(.1*B)),D-=Math.max(0,Math.ceil(.1*D)),F-=Math.max(0,Math.ceil(.1*F)),I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));return(B<<24|D<<16|F<<8|255)>>>0}function g(p,m,d){let b=p>>24&255,L=p>>16&255,T=p>>8&255,B=m>>24&255,D=m>>16&255,F=m>>8&255,I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));for(;I<d&&(B<255||D<255||F<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),D=Math.min(255,D+Math.ceil(.1*(255-D))),F=Math.min(255,F+Math.ceil(.1*(255-F))),I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));return(B<<24|D<<16|F<<8|255)>>>0}i.blend=function(p,m){if(o=(255&m)/255,o===1)return m;let d=m>>24&255,b=m>>16&255,L=m>>8&255,T=p>>24&255,B=p>>16&255,D=p>>8&255;return n=T+Math.round((d-T)*o),h=B+Math.round((b-B)*o),f=D+Math.round((L-D)*o),_.toRgba(n,h,f)},i.ensureContrastRatio=function(p,m,d){let b=u.relativeLuminance(p>>8),L=u.relativeLuminance(m>>8);if(e(b,L)<d){if(L<b){let D=c(p,m,d),F=e(b,u.relativeLuminance(D>>8));if(F<d){let I=g(p,m,d);return F>e(b,u.relativeLuminance(I>>8))?D:I}return D}let T=g(p,m,d),B=e(b,u.relativeLuminance(T>>8));if(B<d){let D=c(p,m,d);return B>e(b,u.relativeLuminance(D>>8))?T:D}return T}},i.reduceLuminance=c,i.increaseLuminance=g,i.toChannels=function(p){return[p>>24&255,p>>16&255,p>>8&255,255&p]}}(t||(r.rgba=t={})),r.toPaddedHex=s,r.contrastRatio=e},8969:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let h=n(844),f=n(2585),o=n(4348),_=n(7866),v=n(744),S=n(7302),u=n(6975),t=n(8460),s=n(1753),e=n(1480),i=n(7994),c=n(9282),g=n(5435),p=n(5981),m=n(2660),d=!1;class b extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new t.EventEmitter),this._onScroll.event(T=>{this._onScrollApi?.fire(T.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(T){for(let B in T)this.optionsService.options[B]=T[B]}constructor(T){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new t.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new t.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new t.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new t.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new t.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new S.OptionsService(T)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,t.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,t.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,t.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,t.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new p.WriteBuffer((B,D)=>this._inputHandler.parse(B,D))),this.register((0,t.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(T,B){this._writeBuffer.write(T,B)}writeSync(T,B){this._logService.logLevel<=f.LogLevelEnum.WARN&&!d&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d=!0),this._writeBuffer.writeSync(T,B)}input(T,B=!0){this.coreService.triggerDataEvent(T,B)}resize(T,B){isNaN(T)||isNaN(B)||(T=Math.max(T,v.MINIMUM_COLS),B=Math.max(B,v.MINIMUM_ROWS),this._bufferService.resize(T,B))}scroll(T,B=!1){this._bufferService.scroll(T,B)}scrollLines(T,B,D){this._bufferService.scrollLines(T,B,D)}scrollPages(T){this.scrollLines(T*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(T){let B=T-this._bufferService.buffer.ydisp;B!==0&&this.scrollLines(B)}registerEscHandler(T,B){return this._inputHandler.registerEscHandler(T,B)}registerDcsHandler(T,B){return this._inputHandler.registerDcsHandler(T,B)}registerCsiHandler(T,B){return this._inputHandler.registerCsiHandler(T,B)}registerOscHandler(T,B){return this._inputHandler.registerOscHandler(T,B)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let T=!1,B=this.optionsService.rawOptions.windowsPty;B&&B.buildNumber!==void 0&&B.buildNumber!==void 0?T=B.backend==="conpty"&&B.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(T=!0),T?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let T=[];T.push(this.onLineFeed(c.updateWindowsModeWrappedState.bind(null,this._bufferService))),T.push(this.registerCsiHandler({final:"H"},()=>((0,c.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(let B of T)B.dispose()})}}}r.CoreTerminal=b},8460:(E,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 h=0;h<this._listeners.length;h++)if(this._listeners[h]===n)return void this._listeners.splice(h,1)}}})),this._event}fire(n,h){let f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,n,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(n,h){return n(f=>h.fire(f))},r.runAndSubscribe=function(n,h){return h(void 0),n(f=>h(f))}},5435:function(E,r,n){var h=this&&this.__decorate||function(P,C,k,R){var A,N=arguments.length,z=N<3?C:R===null?R=Object.getOwnPropertyDescriptor(C,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(P,C,k,R);else for(var q=P.length-1;q>=0;q--)(A=P[q])&&(z=(N<3?A(z):N>3?A(C,k,z):A(C,k))||z);return N>3&&z&&Object.defineProperty(C,k,z),z},f=this&&this.__param||function(P,C){return function(k,R){C(k,R,P)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let o=n(2584),_=n(7116),v=n(2015),S=n(844),u=n(482),t=n(8437),s=n(8460),e=n(643),i=n(511),c=n(3734),g=n(2585),p=n(1480),m=n(6242),d=n(6351),b=n(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function B(P,C){if(P>24)return C.setWinLines||!1;switch(P){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 D;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(r.WindowsOptionsReportType=D={}));let F=0;class I extends S.Disposable{getAttrData(){return this._curAttrData}constructor(C,k,R,A,N,z,q,K,M=new v.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=k,this._coreService=R,this._logService=A,this._optionsService=N,this._oscLinkService=z,this._coreMouseService=q,this._unicodeService=K,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new i.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.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 O(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(x=>this._activeBuffer=x.activeBuffer)),this._parser.setCsiHandlerFallback((x,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:W.toArray()})}),this._parser.setEscHandlerFallback(x=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(x)})}),this._parser.setExecuteHandlerFallback(x=>{this._logService.debug("Unknown EXECUTE code: ",{code:x})}),this._parser.setOscHandlerFallback((x,W,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:W,data:U})}),this._parser.setDcsHandlerFallback((x,W,U)=>{W==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:W,payload:U})}),this._parser.setPrintHandler((x,W,U)=>this.print(x,W,U)),this._parser.registerCsiHandler({final:"@"},x=>this.insertChars(x)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},x=>this.scrollLeft(x)),this._parser.registerCsiHandler({final:"A"},x=>this.cursorUp(x)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},x=>this.scrollRight(x)),this._parser.registerCsiHandler({final:"B"},x=>this.cursorDown(x)),this._parser.registerCsiHandler({final:"C"},x=>this.cursorForward(x)),this._parser.registerCsiHandler({final:"D"},x=>this.cursorBackward(x)),this._parser.registerCsiHandler({final:"E"},x=>this.cursorNextLine(x)),this._parser.registerCsiHandler({final:"F"},x=>this.cursorPrecedingLine(x)),this._parser.registerCsiHandler({final:"G"},x=>this.cursorCharAbsolute(x)),this._parser.registerCsiHandler({final:"H"},x=>this.cursorPosition(x)),this._parser.registerCsiHandler({final:"I"},x=>this.cursorForwardTab(x)),this._parser.registerCsiHandler({final:"J"},x=>this.eraseInDisplay(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},x=>this.eraseInDisplay(x,!0)),this._parser.registerCsiHandler({final:"K"},x=>this.eraseInLine(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},x=>this.eraseInLine(x,!0)),this._parser.registerCsiHandler({final:"L"},x=>this.insertLines(x)),this._parser.registerCsiHandler({final:"M"},x=>this.deleteLines(x)),this._parser.registerCsiHandler({final:"P"},x=>this.deleteChars(x)),this._parser.registerCsiHandler({final:"S"},x=>this.scrollUp(x)),this._parser.registerCsiHandler({final:"T"},x=>this.scrollDown(x)),this._parser.registerCsiHandler({final:"X"},x=>this.eraseChars(x)),this._parser.registerCsiHandler({final:"Z"},x=>this.cursorBackwardTab(x)),this._parser.registerCsiHandler({final:"`"},x=>this.charPosAbsolute(x)),this._parser.registerCsiHandler({final:"a"},x=>this.hPositionRelative(x)),this._parser.registerCsiHandler({final:"b"},x=>this.repeatPrecedingCharacter(x)),this._parser.registerCsiHandler({final:"c"},x=>this.sendDeviceAttributesPrimary(x)),this._parser.registerCsiHandler({prefix:">",final:"c"},x=>this.sendDeviceAttributesSecondary(x)),this._parser.registerCsiHandler({final:"d"},x=>this.linePosAbsolute(x)),this._parser.registerCsiHandler({final:"e"},x=>this.vPositionRelative(x)),this._parser.registerCsiHandler({final:"f"},x=>this.hVPosition(x)),this._parser.registerCsiHandler({final:"g"},x=>this.tabClear(x)),this._parser.registerCsiHandler({final:"h"},x=>this.setMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"h"},x=>this.setModePrivate(x)),this._parser.registerCsiHandler({final:"l"},x=>this.resetMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"l"},x=>this.resetModePrivate(x)),this._parser.registerCsiHandler({final:"m"},x=>this.charAttributes(x)),this._parser.registerCsiHandler({final:"n"},x=>this.deviceStatus(x)),this._parser.registerCsiHandler({prefix:"?",final:"n"},x=>this.deviceStatusPrivate(x)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},x=>this.softReset(x)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},x=>this.setCursorStyle(x)),this._parser.registerCsiHandler({final:"r"},x=>this.setScrollRegion(x)),this._parser.registerCsiHandler({final:"s"},x=>this.saveCursor(x)),this._parser.registerCsiHandler({final:"t"},x=>this.windowOptions(x)),this._parser.registerCsiHandler({final:"u"},x=>this.restoreCursor(x)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},x=>this.insertColumns(x)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},x=>this.deleteColumns(x)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},x=>this.selectProtected(x)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},x=>this.requestMode(x,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},x=>this.requestMode(x,!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 m.OscHandler(x=>(this.setTitle(x),this.setIconName(x),!0))),this._parser.registerOscHandler(1,new m.OscHandler(x=>this.setIconName(x))),this._parser.registerOscHandler(2,new m.OscHandler(x=>this.setTitle(x))),this._parser.registerOscHandler(4,new m.OscHandler(x=>this.setOrReportIndexedColor(x))),this._parser.registerOscHandler(8,new m.OscHandler(x=>this.setHyperlink(x))),this._parser.registerOscHandler(10,new m.OscHandler(x=>this.setOrReportFgColor(x))),this._parser.registerOscHandler(11,new m.OscHandler(x=>this.setOrReportBgColor(x))),this._parser.registerOscHandler(12,new m.OscHandler(x=>this.setOrReportCursorColor(x))),this._parser.registerOscHandler(104,new m.OscHandler(x=>this.restoreIndexedColor(x))),this._parser.registerOscHandler(110,new m.OscHandler(x=>this.restoreFgColor(x))),this._parser.registerOscHandler(111,new m.OscHandler(x=>this.restoreBgColor(x))),this._parser.registerOscHandler(112,new m.OscHandler(x=>this.restoreCursorColor(x))),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 x in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:x},()=>this.selectCharset("("+x)),this._parser.registerEscHandler({intermediates:")",final:x},()=>this.selectCharset(")"+x)),this._parser.registerEscHandler({intermediates:"*",final:x},()=>this.selectCharset("*"+x)),this._parser.registerEscHandler({intermediates:"+",final:x},()=>this.selectCharset("+"+x)),this._parser.registerEscHandler({intermediates:"-",final:x},()=>this.selectCharset("-"+x)),this._parser.registerEscHandler({intermediates:".",final:x},()=>this.selectCharset("."+x)),this._parser.registerEscHandler({intermediates:"/",final:x},()=>this.selectCharset("/"+x));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(x=>(this._logService.error("Parsing error: ",x),x)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new d.DcsHandler((x,W)=>this.requestStatusString(x,W)))}_preserveStack(C,k,R,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=k,this._parseStack.decodedLength=R,this._parseStack.position=A}_logSlowResolvingAsync(C){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([C,new Promise((k,R)=>setTimeout(()=>R("#SLOW_TIMEOUT"),5e3))]).catch(k=>{if(k!=="#SLOW_TIMEOUT")throw k;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,k){let R,A=this._activeBuffer.x,N=this._activeBuffer.y,z=0,q=this._parseStack.paused;if(q){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,k))return this._logSlowResolvingAsync(R),R;A=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>T&&(z=this._parseStack.position+T)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,x=>String.fromCharCode(x)).join("")}"`),typeof C=="string"?C.split("").map(x=>x.charCodeAt(0)):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(C.length,T))),q||this._dirtyRowTracker.clearRange(),C.length>T)for(let x=z;x<C.length;x+=T){let W=x+T<C.length?x+T:C.length,U=typeof C=="string"?this._stringDecoder.decode(C.substring(x,W),this._parseBuffer):this._utf8Decoder.decode(C.subarray(x,W),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,U))return this._preserveStack(A,N,U,x),this._logSlowResolvingAsync(R),R}else if(!q){let x=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,x))return this._preserveStack(A,N,x,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===A&&this._activeBuffer.y===N||this._onCursorMove.fire();let K=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M,this._bufferService.rows-1),Math.min(K,this._bufferService.rows-1))}print(C,k,R){let A,N,z=this._charsetService.charset,q=this._optionsService.rawOptions.screenReaderMode,K=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,x=this._coreService.modes.insertMode,W=this._curAttrData,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-k>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let $=this._parser.precedingJoinState;for(let j=k;j<R;++j){if(A=C[j],A<127&&z){let te=z[String.fromCharCode(A)];te&&(A=te.charCodeAt(0))}let G=this._unicodeService.charProperties(A,$);N=p.UnicodeService.extractWidth(G);let Z=p.UnicodeService.extractShouldJoin(G),Q=Z?p.UnicodeService.extractWidth($):0;if($=G,q&&this._onA11yChar.fire((0,u.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-Q>K){if(M){let te=U,V=this._activeBuffer.x-Q;for(this._activeBuffer.x=Q,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Q>0&&U instanceof t.BufferLine&&U.copyCellsFrom(te,V,0,Q,!1);V<K;)te.setCellFromCodepoint(V++,0,1,W)}else if(this._activeBuffer.x=K-1,N===2)continue}if(Z&&this._activeBuffer.x){let te=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-te,A,N);for(let V=N-Q;--V>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(x&&(U.insertCells(this._activeBuffer.x,N-Q,this._activeBuffer.getNullCell(W)),U.getWidth(K-1)===2&&U.setCellFromCodepoint(K-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,W)),U.setCellFromCodepoint(this._activeBuffer.x++,A,N,W),N>0)for(;--N;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=$,this._activeBuffer.x<K&&R-k>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,k){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,k):this._parser.registerCsiHandler(C,R=>!B(R.params[0],this._optionsService.rawOptions.windowOptions)||k(R))}registerDcsHandler(C,k){return this._parser.registerDcsHandler(C,new d.DcsHandler(k))}registerEscHandler(C,k){return this._parser.registerEscHandler(C,k)}registerOscHandler(C,k){return this._parser.registerOscHandler(C,new m.OscHandler(k))}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,k){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+k):(this._activeBuffer.x=C,this._activeBuffer.y=k),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,k){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+k)}cursorUp(C){let k=this._activeBuffer.y-this._activeBuffer.scrollTop;return k>=0?this._moveCursor(0,-Math.min(k,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){let k=this._activeBuffer.scrollBottom-this._activeBuffer.y;return k>=0?this._moveCursor(0,Math.min(k,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 k=C.params[0];return k===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:k===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=C.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=C.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){let k=C.params[0];return k===1&&(this._curAttrData.bg|=536870912),k!==2&&k!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,k,R,A=!1,N=!1){let z=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);z.replaceCells(k,R,this._activeBuffer.getNullCell(this._eraseAttrData()),N),A&&(z.isWrapped=!1)}_resetBufferLine(C,k=!1){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),k),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),R.isWrapped=!1)}eraseInDisplay(C,k=!1){let R;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,k);R<this._bufferService.rows;R++)this._resetBufferLine(R,k);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,k),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,k);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,k);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(C,k=!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,k);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,k);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,k)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let k=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let R=this._activeBuffer.ybase+this._activeBuffer.y,A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-A+1;for(;k--;)this._activeBuffer.lines.splice(N-1,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}deleteLines(C){this._restrictCursor();let k=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let R=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;k--;)this._activeBuffer.lines.splice(R,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(C){this._restrictCursor();let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.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 k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let k=C.params[0]||1;for(;k--;)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 k=C.params[0]||1;for(;k--;)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(t.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 k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.deleteCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.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 k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.insertCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.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 k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.insertCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.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 k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.deleteCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.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 k=this._parser.precedingJoinState;if(!k)return!0;let R=C.params[0]||1,A=p.UnicodeService.extractWidth(k),N=this._activeBuffer.x-A,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),q=new Uint32Array(z.length*R),K=0;for(let x=0;x<z.length;){let W=z.codePointAt(x)||0;q[K++]=W,x+=W>65535?2:1}let M=K;for(let x=1;x<R;++x)q.copyWithin(M,0,K),M+=K;return this.print(q,0,M),!0}sendDeviceAttributesPrimary(C){return C.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(C){return C.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(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let k=0;k<C.length;k++)switch(C.params[k]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let k=0;k<C.length;k++)switch(C.params[k]){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 k=0;k<C.length;k++)switch(C.params[k]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let k=0;k<C.length;k++)switch(C.params[k]){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[k]===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,k){let R=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:N}=this._coreMouseService,z=this._coreService,{buffers:q,cols:K}=this._bufferService,{active:M,alt:x}=q,W=this._optionsService.rawOptions,U=Z=>Z?1:2,$=C.params[0];return j=$,G=k?$===2?4:$===4?U(z.modes.insertMode):$===12?3:$===20?U(W.convertEol):0:$===1?U(R.applicationCursorKeys):$===3?W.windowOptions.setWinLines?K===80?2:K===132?1:0:0:$===6?U(R.origin):$===7?U(R.wraparound):$===8?3:$===9?U(A==="X10"):$===12?U(W.cursorBlink):$===25?U(!z.isCursorHidden):$===45?U(R.reverseWraparound):$===66?U(R.applicationKeypad):$===67?4:$===1e3?U(A==="VT200"):$===1002?U(A==="DRAG"):$===1003?U(A==="ANY"):$===1004?U(R.sendFocus):$===1005?4:$===1006?U(N==="SGR"):$===1015?4:$===1016?U(N==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?U(M===x):$===2004?U(R.bracketedPasteMode):0,z.triggerDataEvent(`${o.C0.ESC}[${k?"":"?"}${j};${G}$y`),!0;var j,G}_updateAttrColor(C,k,R,A,N){return k===2?(C|=50331648,C&=-16777216,C|=c.AttributeData.fromColorRGB([R,A,N])):k===5&&(C&=-50331904,C|=33554432|255&R),C}_extractColor(C,k,R){let A=[0,0,-1,0,0,0],N=0,z=0;do{if(A[z+N]=C.params[k+z],C.hasSubParams(k+z)){let q=C.getSubParams(k+z),K=0;do A[1]===5&&(N=1),A[z+K+1+N]=q[K];while(++K<q.length&&K+z+1+N<A.length);break}if(A[1]===5&&z+N>=2||A[1]===2&&z+N>=5)break;A[1]&&(N=1)}while(++z+k<C.length&&z+N<A.length);for(let q=2;q<A.length;++q)A[q]===-1&&(A[q]=0);switch(A[0]){case 38:R.fg=this._updateAttrColor(R.fg,A[1],A[3],A[4],A[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,A[1],A[3],A[4],A[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,A[1],A[3],A[4],A[5])}return z}_processUnderline(C,k){k.extended=k.extended.clone(),(!~C||C>5)&&(C=1),k.extended.underlineStyle=C,k.fg|=268435456,C===0&&(k.fg&=-268435457),k.updateExtended()}_processSGR0(C){C.fg=t.DEFAULT_ATTR_DATA.fg,C.bg=t.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 k=C.length,R,A=this._curAttrData;for(let N=0;N<k;N++)R=C.params[N],R>=30&&R<=37?(A.fg&=-50331904,A.fg|=16777216|R-30):R>=40&&R<=47?(A.bg&=-50331904,A.bg|=16777216|R-40):R>=90&&R<=97?(A.fg&=-50331904,A.fg|=16777224|R-90):R>=100&&R<=107?(A.bg&=-50331904,A.bg|=16777224|R-100):R===0?this._processSGR0(A):R===1?A.fg|=134217728:R===3?A.bg|=67108864:R===4?(A.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,A)):R===5?A.fg|=536870912:R===7?A.fg|=67108864:R===8?A.fg|=1073741824:R===9?A.fg|=2147483648:R===2?A.bg|=134217728:R===21?this._processUnderline(2,A):R===22?(A.fg&=-134217729,A.bg&=-134217729):R===23?A.bg&=-67108865:R===24?(A.fg&=-268435457,this._processUnderline(0,A)):R===25?A.fg&=-536870913:R===27?A.fg&=-67108865:R===28?A.fg&=-1073741825:R===29?A.fg&=2147483647:R===39?(A.fg&=-67108864,A.fg|=16777215&t.DEFAULT_ATTR_DATA.fg):R===49?(A.bg&=-67108864,A.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?N+=this._extractColor(C,N,A):R===53?A.bg|=1073741824:R===55?A.bg&=-1073741825:R===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):R===100?(A.fg&=-67108864,A.fg|=16777215&t.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let k=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${k};${R}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){let k=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${k};${R}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=t.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 k=C.params[0]||1;switch(k){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 R=k%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(C){let k=C.params[0]||1,R;return(C.length<2||(R=C.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>k&&(this._activeBuffer.scrollTop=k-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(C){if(!B(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;let k=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:k!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:k!==0&&k!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),k!==0&&k!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:k!==0&&k!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),k!==0&&k!==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 k=[],R=C.split(";");for(;R.length>1;){let A=R.shift(),N=R.shift();if(/^\d+$/.exec(A)){let z=parseInt(A);if(H(z))if(N==="?")k.push({type:0,index:z});else{let q=(0,b.parseColor)(N);q&&k.push({type:1,index:z,color:q})}}}return k.length&&this._onColor.fire(k),!0}setHyperlink(C){let k=C.split(";");return!(k.length<2)&&(k[1]?this._createHyperlink(k[0],k[1]):!k[0]&&this._finishHyperlink())}_createHyperlink(C,k){this._getCurrentLinkId()&&this._finishHyperlink();let R=C.split(":"),A,N=R.findIndex(z=>z.startsWith("id="));return N!==-1&&(A=R[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:k}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,k){let R=C.split(";");for(let A=0;A<R.length&&!(k>=this._specialColors.length);++A,++k)if(R[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[k]}]);else{let N=(0,b.parseColor)(R[A]);N&&this._onColor.fire([{type:1,index:this._specialColors[k],color:N}])}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 k=[],R=C.split(";");for(let A=0;A<R.length;++A)if(/^\d+$/.exec(R[A])){let N=parseInt(R[A]);H(N)&&k.push({type:2,index:N})}return k.length&&this._onColor.fire(k),!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(L[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=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.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 i.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let k=0;k<this._bufferService.rows;++k){let R=this._activeBuffer.ybase+this._activeBuffer.y+k,A=this._activeBuffer.lines.get(R);A&&(A.fill(C),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,k){let R=this._bufferService.buffer,A=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${N}${o.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,k){this._dirtyRowTracker.markRangeDirty(C,k)}}r.InputHandler=I;let O=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){P<this.start?this.start=P:P>this.end&&(this.end=P)}markRangeDirty(P,C){P>C&&(F=P,P=C,C=F),P<this.start&&(this.start=P),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(P){return 0<=P&&P<256}O=h([f(0,g.IBufferService)],O)},844:(E,r)=>{function n(h){for(let f of h)f.dispose();h.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 h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){let f=this._disposables.indexOf(h);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(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}},r.toDisposable=function(h){return{dispose:h}},r.disposeArray=n,r.getDisposeArrayDisposable=function(h){return{dispose:()=>n(h)}}},1505:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(f,o,_){this._data[f]||(this._data[f]={}),this._data[f][o]=_}get(f,o){return this._data[f]?this._data[f][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=n,r.FourKeyMap=class{constructor(){this._data=new n}set(h,f,o,_,v){this._data.get(h,f)||this._data.set(h,f,new n),this._data.get(h,f).set(o,_,v)}get(h,f,o,_){return this._data.get(h,f)?.get(o,_)}clear(){this._data.clear()}}},6114:(E,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,h=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 f=n.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),r.isIpad=h==="iPad",r.isIphone=h==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),r.isLinux=h.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(n)},6106:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let n=0;r.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(n=this._search(this._getKey(h)),this._array.splice(n,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;let f=this._getKey(h);if(f===void 0||(n=this._search(f),n===-1)||this._getKey(this._array[n])!==f)return!1;do if(this._array[n]===h)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===f);return!1}*getKeyIterator(h){if(this._array.length!==0&&(n=this._search(h),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===h))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===h)}forEachByKey(h,f){if(this._array.length!==0&&(n=this._search(h),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===h))do f(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===h)}values(){return[...this._array].values()}_search(h){let f=0,o=this._array.length-1;for(;o>=f;){let _=f+o>>1,v=this._getKey(this._array[_]);if(v>h)o=_-1;else{if(!(v<h)){for(;_>0&&this._getKey(this._array[_-1])===h;)_--;return _}f=_+1}}return f}}},7226:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let h=n(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let S=0,u=0,t=v.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),u=Math.max(S,u),s=v.timeRemaining(),1.5*u>s)return t-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(t-S))}ms`),void this._start();t=s}this.clear()}}class o extends f{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){let S=Date.now()+v;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let h=n(643);r.updateWindowsModeWrappedState=function(f){let o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=o?.get(f.cols-1),v=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);v&&_&&(v.isWrapped=_[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&_[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(E,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 h}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 h{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,_=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let h=n(6349),f=n(7226),o=n(3734),_=n(8437),v=n(4634),S=n(511),u=n(643),t=n(4863),s=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,i,c){this._hasScrollback=e,this._optionsService=i,this._bufferService=c,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=S.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.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,i){return new _.BufferLine(this._bufferService.cols,this.getNullCell(e),i)}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 i=e+this._optionsService.rawOptions.scrollback;return i>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=_.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}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(e,i){let c=this.getNullCell(_.DEFAULT_ATTR_DATA),g=0,p=this._getCorrectBufferLength(i);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)g+=+this.lines.get(d).resize(e,c);let m=0;if(this._rows<i)for(let d=this._rows;d<i;d++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(e,c)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(e,c)));else for(let d=this._rows;d>i;d--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(p<this.lines.maxLength){let d=this.lines.length-p;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=p}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let m=0;m<this.lines.length;m++)g+=+this.lines.get(m).resize(e,c);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),g>.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 i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>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,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let c=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(c.length>0){let g=(0,v.reflowLargerCreateNewLayout)(this.lines,c);(0,v.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(e,i,g.countRemoved)}}_reflowLargerAdjustViewport(e,i,c){let g=this.getNullCell(_.DEFAULT_ATTR_DATA),p=c;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new _.BufferLine(e,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-c,0)}_reflowSmaller(e,i){let c=this.getNullCell(_.DEFAULT_ATTR_DATA),g=[],p=0;for(let m=this.lines.length-1;m>=0;m--){let d=this.lines.get(m);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let b=[d];for(;d.isWrapped&&m>0;)d=this.lines.get(--m),b.unshift(d);let L=this.ybase+this.y;if(L>=m&&L<m+b.length)continue;let T=b[b.length-1].getTrimmedLength(),B=(0,v.reflowSmallerGetNewLineLengths)(b,this._cols,e),D=B.length-b.length,F;F=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);let I=[];for(let R=0;R<D;R++){let A=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);I.push(A)}I.length>0&&(g.push({start:m+b.length+p,newLines:I}),p+=I.length),b.push(...I);let O=B.length-1,H=B[O];H===0&&(O--,H=B[O]);let P=b.length-D-1,C=T;for(;P>=0;){let R=Math.min(C,H);if(b[O]===void 0)break;if(b[O].copyCellsFrom(b[P],C-R,H-R,R,!0),H-=R,H===0&&(O--,H=B[O]),C-=R,C===0){P--;let A=Math.max(P,0);C=(0,v.getWrappedLineTrimmedLength)(b,A,this._cols)}}for(let R=0;R<b.length;R++)B[R]<e&&b[R].setCell(B[R],c);let k=D-F;for(;k-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+i-1)}if(g.length>0){let m=[],d=[];for(let O=0;O<this.lines.length;O++)d.push(this.lines.get(O));let b=this.lines.length,L=b-1,T=0,B=g[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let D=0;for(let O=Math.min(this.lines.maxLength-1,b+p-1);O>=0;O--)if(B&&B.start>L+D){for(let H=B.newLines.length-1;H>=0;H--)this.lines.set(O--,B.newLines[H]);O++,m.push({index:L+1,amount:B.newLines.length}),D+=B.newLines.length,B=g[++T]}else this.lines.set(O,d[L--]);let F=0;for(let O=m.length-1;O>=0;O--)m[O].index+=F,this.lines.onInsertEmitter.fire(m[O]),F+=m[O].amount;let I=Math.max(0,b+p-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(e,i,c=0,g){let p=this.lines.get(e);return p?p.translateToString(i,c,g):""}getWrappedRangeForLine(e){let i=e,c=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;c+1<this.lines.length&&this.lines.get(c+1).isWrapped;)c++;return{first:i,last:c}}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 i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,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 i=new t.Marker(e);return this.markers.push(i),i.register(this.lines.onTrim(c=>{i.line-=c,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(c=>{i.line>=c.index&&(i.line+=c.amount)})),i.register(this.lines.onDelete(c=>{i.line>=c.index&&i.line<c.index+c.amount&&i.dispose(),i.line>c.index&&(i.line-=c.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let h=n(3734),f=n(511),o=n(643),_=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class S{constructor(t,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);let i=s||f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let c=0;c<t;++c)this.setCell(c,i);this.length=t}get(t){let s=this._data[3*t+0],e=2097151&s;return[this._data[3*t+1],2097152&s?this._combined[t]:e?(0,_.stringFromCodePoint)(e):"",s>>22,2097152&s?this._combined[t].charCodeAt(this._combined[t].length-1):e]}set(t,s){this._data[3*t+1]=s[o.CHAR_DATA_ATTR_INDEX],s[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[t]=s[1],this._data[3*t+0]=2097152|t|s[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*t+0]=s[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(t){return this._data[3*t+0]>>22}hasWidth(t){return 12582912&this._data[3*t+0]}getFg(t){return this._data[3*t+1]}getBg(t){return this._data[3*t+2]}hasContent(t){return 4194303&this._data[3*t+0]}getCodePoint(t){let s=this._data[3*t+0];return 2097152&s?this._combined[t].charCodeAt(this._combined[t].length-1):2097151&s}isCombined(t){return 2097152&this._data[3*t+0]}getString(t){let s=this._data[3*t+0];return 2097152&s?this._combined[t]:2097151&s?(0,_.stringFromCodePoint)(2097151&s):""}isProtected(t){return 536870912&this._data[3*t+2]}loadCell(t,s){return v=3*t,s.content=this._data[v+0],s.fg=this._data[v+1],s.bg=this._data[v+2],2097152&s.content&&(s.combinedData=this._combined[t]),268435456&s.bg&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){2097152&s.content&&(this._combined[t]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[t]=s.extended),this._data[3*t+0]=s.content,this._data[3*t+1]=s.fg,this._data[3*t+2]=s.bg}setCellFromCodepoint(t,s,e,i){268435456&i.bg&&(this._extendedAttrs[t]=i.extended),this._data[3*t+0]=s|e<<22,this._data[3*t+1]=i.fg,this._data[3*t+2]=i.bg}addCodepointToCell(t,s,e){let i=this._data[3*t+0];2097152&i?this._combined[t]+=(0,_.stringFromCodePoint)(s):2097151&i?(this._combined[t]=(0,_.stringFromCodePoint)(2097151&i)+(0,_.stringFromCodePoint)(s),i&=-2097152,i|=2097152):i=s|4194304,e&&(i&=-12582913,i|=e<<22),this._data[3*t+0]=i}insertCells(t,s,e){if((t%=this.length)&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length-t){let i=new f.CellData;for(let c=this.length-t-s-1;c>=0;--c)this.setCell(t+s+c,this.loadCell(t+c,i));for(let c=0;c<s;++c)this.setCell(t+c,e)}else for(let i=t;i<this.length;++i)this.setCell(i,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(t,s,e){if(t%=this.length,s<this.length-t){let i=new f.CellData;for(let c=0;c<this.length-t-s;++c)this.setCell(t+c,this.loadCell(t+s+c,i));for(let c=this.length-s;c<this.length;++c)this.setCell(c,e)}else for(let i=t;i<this.length;++i)this.setCell(i,e);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),this.getWidth(t)!==0||this.hasContent(t)||this.setCellFromCodepoint(t,0,1,e)}replaceCells(t,s,e,i=!1){if(i)for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,e);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,e),t++;else for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,e);t<s&&t<this.length;)this.setCell(t++,e)}resize(t,s){if(t===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*t;if(t>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let i=new Uint32Array(e);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,s)}else{this._data=this._data.subarray(0,e);let i=Object.keys(this._combined);for(let g=0;g<i.length;g++){let p=parseInt(i[g],10);p>=t&&delete this._combined[p]}let c=Object.keys(this._extendedAttrs);for(let g=0;g<c.length;g++){let p=parseInt(c[g],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,t);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,t)}}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new S(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0])return t+(this._data[3*t+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0]||50331648&this._data[3*t+2])return t+(this._data[3*t+0]>>22);return 0}copyCellsFrom(t,s,e,i,c){let g=t._data;if(c)for(let m=i-1;m>=0;m--){for(let d=0;d<3;d++)this._data[3*(e+m)+d]=g[3*(s+m)+d];268435456&g[3*(s+m)+2]&&(this._extendedAttrs[e+m]=t._extendedAttrs[s+m])}else for(let m=0;m<i;m++){for(let d=0;d<3;d++)this._data[3*(e+m)+d]=g[3*(s+m)+d];268435456&g[3*(s+m)+2]&&(this._extendedAttrs[e+m]=t._extendedAttrs[s+m])}let p=Object.keys(t._combined);for(let m=0;m<p.length;m++){let d=parseInt(p[m],10);d>=s&&(this._combined[d-s+e]=t._combined[d])}}translateToString(t,s,e,i){s=s??0,e=e??this.length,t&&(e=Math.min(e,this.getTrimmedLength())),i&&(i.length=0);let c="";for(;s<e;){let g=this._data[3*s+0],p=2097151&g,m=2097152&g?this._combined[s]:p?(0,_.stringFromCodePoint)(p):o.WHITESPACE_CELL_CHAR;if(c+=m,i)for(let d=0;d<m.length;++d)i.push(s);s+=g>>22||1}return i&&i.push(s),c}}r.BufferLine=S},4841:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(n,h){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 h*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(E,r)=>{function n(h,f,o){if(f===h.length-1)return h[f].getTrimmedLength();let _=!h[f].hasContent(o-1)&&h[f].getWidth(o-1)===1,v=h[f+1].getWidth(0)===2;return _&&v?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(h,f,o,_,v){let S=[];for(let u=0;u<h.length-1;u++){let t=u,s=h.get(++t);if(!s.isWrapped)continue;let e=[h.get(u)];for(;t<h.length&&s.isWrapped;)e.push(s),s=h.get(++t);if(_>=u&&_<t){u+=e.length-1;continue}let i=0,c=n(e,i,f),g=1,p=0;for(;g<e.length;){let d=n(e,g,f),b=d-p,L=o-c,T=Math.min(b,L);e[i].copyCellsFrom(e[g],p,c,T,!1),c+=T,c===o&&(i++,c=0),p+=T,p===d&&(g++,p=0),c===0&&i!==0&&e[i-1].getWidth(o-1)===2&&(e[i].copyCellsFrom(e[i-1],o-1,c++,1,!1),e[i-1].setCell(o-1,v))}e[i].replaceCells(c,o,v);let m=0;for(let d=e.length-1;d>0&&(d>i||e[d].getTrimmedLength()===0);d--)m++;m>0&&(S.push(u+e.length-m),S.push(m)),u+=e.length-1}return S},r.reflowLargerCreateNewLayout=function(h,f){let o=[],_=0,v=f[_],S=0;for(let u=0;u<h.length;u++)if(v===u){let t=f[++_];h.onDeleteEmitter.fire({index:u-S,amount:t}),u+=t-1,S+=t,v=f[++_]}else o.push(u);return{layout:o,countRemoved:S}},r.reflowLargerApplyNewLayout=function(h,f){let o=[];for(let _=0;_<f.length;_++)o.push(h.get(f[_]));for(let _=0;_<o.length;_++)h.set(_,o[_]);h.length=f.length},r.reflowSmallerGetNewLineLengths=function(h,f,o){let _=[],v=h.map((s,e)=>n(h,e,f)).reduce((s,e)=>s+e),S=0,u=0,t=0;for(;t<v;){if(v-t<o){_.push(v-t);break}S+=o;let s=n(h,u,f);S>s&&(S-=s,u++);let e=h[u].getWidth(S-1)===2;e&&S--;let i=e?o-1:o;_.push(i),t+=i}return _},r.getWrappedLineTrimmedLength=n},5295:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let h=n(8460),f=n(844),o=n(9092);class _ extends f.Disposable{constructor(S,u){super(),this._optionsService=S,this._bufferService=u,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 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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,u){this._normal.resize(S,u),this._alt.resize(S,u),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}r.BufferSet=_},511:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let h=n(482),f=n(643),o=n(3734);class _ extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(S){let u=new _;return u.setFromCharData(S),u}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(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){let t=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=t&&t<=56319){let s=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(t-55296)+s-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},643:(E,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:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let h=n(8460),f=n(844);class o{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=o._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,f.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}r.Marker=o,o._nextId=1},7116:(E,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:(E,r)=>{var n,h,f;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"}(h||(r.C1=h={})),function(o){o.ST=`${n.ESC}\\`}(f||(r.C1_ESCAPED=f={}))},7399:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let h=n(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(o,_,v,S){let u={type:0,cancel:!1,key:void 0},t=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?u.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?u.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?u.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(u.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:u.key=o.ctrlKey?"\b":h.C0.DEL,o.altKey&&(u.key=h.C0.ESC+u.key);break;case 9:if(o.shiftKey){u.key=h.C0.ESC+"[Z";break}u.key=h.C0.HT,u.cancel=!0;break;case 13:u.key=o.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,u.cancel=!0;break;case 27:u.key=h.C0.ESC,o.altKey&&(u.key=h.C0.ESC+h.C0.ESC),u.cancel=!0;break;case 37:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"D",u.key===h.C0.ESC+"[1;3D"&&(u.key=h.C0.ESC+(v?"b":"[1;5D"))):u.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"C",u.key===h.C0.ESC+"[1;3C"&&(u.key=h.C0.ESC+(v?"f":"[1;5C"))):u.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"A",v||u.key!==h.C0.ESC+"[1;3A"||(u.key=h.C0.ESC+"[1;5A")):u.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"B",v||u.key!==h.C0.ESC+"[1;3B"||(u.key=h.C0.ESC+"[1;5B")):u.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(u.key=h.C0.ESC+"[2~");break;case 46:u.key=t?h.C0.ESC+"[3;"+(t+1)+"~":h.C0.ESC+"[3~";break;case 36:u.key=t?h.C0.ESC+"[1;"+(t+1)+"H":_?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:u.key=t?h.C0.ESC+"[1;"+(t+1)+"F":_?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:o.shiftKey?u.type=2:o.ctrlKey?u.key=h.C0.ESC+"[5;"+(t+1)+"~":u.key=h.C0.ESC+"[5~";break;case 34:o.shiftKey?u.type=3:o.ctrlKey?u.key=h.C0.ESC+"[6;"+(t+1)+"~":u.key=h.C0.ESC+"[6~";break;case 112:u.key=t?h.C0.ESC+"[1;"+(t+1)+"P":h.C0.ESC+"OP";break;case 113:u.key=t?h.C0.ESC+"[1;"+(t+1)+"Q":h.C0.ESC+"OQ";break;case 114:u.key=t?h.C0.ESC+"[1;"+(t+1)+"R":h.C0.ESC+"OR";break;case 115:u.key=t?h.C0.ESC+"[1;"+(t+1)+"S":h.C0.ESC+"OS";break;case 116:u.key=t?h.C0.ESC+"[15;"+(t+1)+"~":h.C0.ESC+"[15~";break;case 117:u.key=t?h.C0.ESC+"[17;"+(t+1)+"~":h.C0.ESC+"[17~";break;case 118:u.key=t?h.C0.ESC+"[18;"+(t+1)+"~":h.C0.ESC+"[18~";break;case 119:u.key=t?h.C0.ESC+"[19;"+(t+1)+"~":h.C0.ESC+"[19~";break;case 120:u.key=t?h.C0.ESC+"[20;"+(t+1)+"~":h.C0.ESC+"[20~";break;case 121:u.key=t?h.C0.ESC+"[21;"+(t+1)+"~":h.C0.ESC+"[21~";break;case 122:u.key=t?h.C0.ESC+"[23;"+(t+1)+"~":h.C0.ESC+"[23~";break;case 123:u.key=t?h.C0.ESC+"[24;"+(t+1)+"~":h.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(v&&!S||!o.altKey||o.metaKey)!v||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?u.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(u.key=h.C0.US),o.key==="@"&&(u.key=h.C0.NUL)):o.keyCode===65&&(u.type=1);else{let s=f[o.keyCode],e=s?.[o.shiftKey?1:0];if(e)u.key=h.C0.ESC+e;else if(o.keyCode>=65&&o.keyCode<=90){let i=o.ctrlKey?o.keyCode-64:o.keyCode+32,c=String.fromCharCode(i);o.shiftKey&&(c=c.toUpperCase()),u.key=h.C0.ESC+c}else if(o.keyCode===32)u.key=h.C0.ESC+(o.ctrlKey?h.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let i=o.code.slice(3,4);o.shiftKey||(i=i.toLowerCase()),u.key=h.C0.ESC+i,u.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?u.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?u.key=h.C0.NUL:o.keyCode>=51&&o.keyCode<=55?u.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?u.key=h.C0.DEL:o.keyCode===219?u.key=h.C0.ESC:o.keyCode===220?u.key=h.C0.FS:o.keyCode===221&&(u.key=h.C0.GS)}return u}},482:(E,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,h=0,f=n.length){let o="";for(let _=h;_<f;++_){let v=n[_];v>65535?(v-=65536,o+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):o+=String.fromCharCode(v)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,h){let f=n.length;if(!f)return 0;let o=0,_=0;if(this._interim){let v=n.charCodeAt(_++);56320<=v&&v<=57343?h[o++]=1024*(this._interim-55296)+v-56320+65536:(h[o++]=this._interim,h[o++]=v),this._interim=0}for(let v=_;v<f;++v){let S=n.charCodeAt(v);if(55296<=S&&S<=56319){if(++v>=f)return this._interim=S,o;let u=n.charCodeAt(v);56320<=u&&u<=57343?h[o++]=1024*(S-55296)+u-56320+65536:(h[o++]=S,h[o++]=u)}else S!==65279&&(h[o++]=S)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,h){let f=n.length;if(!f)return 0;let o,_,v,S,u=0,t=0,s=0;if(this.interim[0]){let c=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let p,m=0;for(;(p=63&this.interim[++m])&&m<4;)g<<=6,g|=p;let d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,b=d-m;for(;s<b;){if(s>=f)return 0;if(p=n[s++],(192&p)!=128){s--,c=!0;break}this.interim[m++]=p,g<<=6,g|=63&p}c||(d===2?g<128?s--:h[u++]=g:d===3?g<2048||g>=55296&&g<=57343||g===65279||(h[u++]=g):g<65536||g>1114111||(h[u++]=g)),this.interim.fill(0)}let e=f-4,i=s;for(;i<f;){for(;!(!(i<e)||128&(o=n[i])||128&(_=n[i+1])||128&(v=n[i+2])||128&(S=n[i+3]));)h[u++]=o,h[u++]=_,h[u++]=v,h[u++]=S,i+=4;if(o=n[i++],o<128)h[u++]=o;else if((224&o)==192){if(i>=f)return this.interim[0]=o,u;if(_=n[i++],(192&_)!=128){i--;continue}if(t=(31&o)<<6|63&_,t<128){i--;continue}h[u++]=t}else if((240&o)==224){if(i>=f)return this.interim[0]=o,u;if(_=n[i++],(192&_)!=128){i--;continue}if(i>=f)return this.interim[0]=o,this.interim[1]=_,u;if(v=n[i++],(192&v)!=128){i--;continue}if(t=(15&o)<<12|(63&_)<<6|63&v,t<2048||t>=55296&&t<=57343||t===65279)continue;h[u++]=t}else if((248&o)==240){if(i>=f)return this.interim[0]=o,u;if(_=n[i++],(192&_)!=128){i--;continue}if(i>=f)return this.interim[0]=o,this.interim[1]=_,u;if(v=n[i++],(192&v)!=128){i--;continue}if(i>=f)return this.interim[0]=o,this.interim[1]=_,this.interim[2]=v,u;if(S=n[i++],(192&S)!=128){i--;continue}if(t=(7&o)<<18|(63&_)<<12|(63&v)<<6|63&S,t<65536||t>1114111)continue;h[u++]=t}}return u}}},225:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let h=n(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],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]],_;r.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 v=0;v<f.length;++v)_.fill(0,f[v][0],f[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?_[v]:function(S,u){let t,s=0,e=u.length-1;if(S<u[0][0]||S>u[e][1])return!1;for(;e>=s;)if(t=s+e>>1,S>u[t][1])s=t+1;else{if(!(S<u[t][0]))return!0;e=t-1}return!1}(v,o)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,S){let u=this.wcwidth(v),t=u===0&&S!==0;if(t){let s=h.UnicodeService.extractWidth(S);s===0?t=!1:s>u&&(u=s)}return h.UnicodeService.createPropertyValue(0,u,t)}}},5981:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let h=n(8460),f=n(844);class o extends f.Disposable{constructor(v){super(),this._action=v,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(v,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);let t=this._callbacks.shift();t&&t()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,S){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(S),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(S)}_innerWrite(v=0,S=!0){let u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let t=this._writeBuffer[this._bufferOffset],s=this._action(t,S);if(s){let i=c=>Date.now()-u>=12?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(u,c);return void s.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(i)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=t.length,Date.now()-u>=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:(E,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})$/,h=/^[\da-f]+$/;function f(o,_){let v=o.toString(16),S=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}r.parseColor=function(o){if(!o)return;let _=o.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let v=n.exec(_);if(v){let S=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/S*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/S*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/S*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),h.exec(_)&&[3,6,9,12].includes(_.length))){let v=_.length/3,S=[0,0,0];for(let u=0;u<3;++u){let t=parseInt(_.slice(v*u,v*u+v),16);S[u]=v===1?t<<4:v===2?t:v===3?t>>4:t>>8}return S}},r.toRgbString=function(o,_=16){let[v,S,u]=o;return`rgb:${f(v,_)}/${f(S,_)}/${f(u,_)}`}},5770:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let h=n(482),f=n(8742),o=n(5770),_=[];r.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(S,u){this._handlers[S]===void 0&&(this._handlers[S]=[]);let t=this._handlers[S];return t.push(u),{dispose:()=>{let s=t.indexOf(u);s!==-1&&t.splice(s,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(S,u){if(this.reset(),this._ident=S,this._active=this._handlers[S]||_,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(S,u,t){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(S,u,t);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(S,u,t))}unhook(S,u=!0){if(this._active.length){let t=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,t=u,e=this._stack.fallThrough,this._stack.paused=!1),!e&&t===!1){for(;s>=0&&(t=this._active[s].unhook(S),t!==!0);s--)if(t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,t;s--}for(;s>=0;s--)if(t=this._active[s].unhook(!1),t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,t}else this._handlerFb(this._ident,"UNHOOK",S);this._active=_,this._ident=0}};let v=new f.Params;v.addParam(0),r.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=v,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():v,this._data="",this._hitLimit=!1}put(S,u,t){this._hitLimit||(this._data+=(0,h.utf32ToString)(S,u,t),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let u=!1;if(this._hitLimit)u=!1;else if(S&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then(t=>(this._params=v,this._data="",this._hitLimit=!1,t));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let h=n(844),f=n(8742),o=n(6242),_=n(6351);class v{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,i,c){this.table[e<<8|s]=i<<4|c}addMany(s,e,i,c){for(let g=0;g<s.length;g++)this.table[e<<8|s[g]]=i<<4|c}}r.TransitionTable=v;let S=160;r.VT500_TRANSITION_TABLE=function(){let t=new v(4095),s=Array.apply(null,Array(256)).map((m,d)=>d),e=(m,d)=>s.slice(m,d),i=e(32,127),c=e(0,24);c.push(25),c.push.apply(c,e(28,32));let g=e(0,14),p;for(p in t.setDefault(1,0),t.addMany(i,0,2,0),g)t.addMany([24,26,153,154],p,3,0),t.addMany(e(128,144),p,3,0),t.addMany(e(144,152),p,3,0),t.add(156,p,0,0),t.add(27,p,11,1),t.add(157,p,4,8),t.addMany([152,158,159],p,0,7),t.add(155,p,11,3),t.add(144,p,11,9);return t.addMany(c,0,3,0),t.addMany(c,1,3,1),t.add(127,1,0,1),t.addMany(c,8,0,8),t.addMany(c,3,3,3),t.add(127,3,0,3),t.addMany(c,4,3,4),t.add(127,4,0,4),t.addMany(c,6,3,6),t.addMany(c,5,3,5),t.add(127,5,0,5),t.addMany(c,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(i,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(e(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(i,7,0,7),t.addMany(c,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(e(64,127),3,7,0),t.addMany(e(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(e(48,60),4,8,4),t.addMany(e(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(e(32,64),6,0,6),t.add(127,6,0,6),t.addMany(e(64,127),6,0,0),t.addMany(e(32,48),3,9,5),t.addMany(e(32,48),5,9,5),t.addMany(e(48,64),5,0,6),t.addMany(e(64,127),5,7,0),t.addMany(e(32,48),4,9,5),t.addMany(e(32,48),1,9,2),t.addMany(e(32,48),2,9,2),t.addMany(e(48,127),2,10,0),t.addMany(e(48,80),1,10,0),t.addMany(e(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(e(96,127),1,10,0),t.add(80,1,11,9),t.addMany(c,9,0,9),t.add(127,9,0,9),t.addMany(e(28,32),9,0,9),t.addMany(e(32,48),9,9,12),t.addMany(e(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(c,11,0,11),t.addMany(e(32,128),11,0,11),t.addMany(e(28,32),11,0,11),t.addMany(c,10,0,10),t.add(127,10,0,10),t.addMany(e(28,32),10,0,10),t.addMany(e(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(e(32,48),10,9,12),t.addMany(c,12,0,12),t.add(127,12,0,12),t.addMany(e(28,32),12,0,12),t.addMany(e(32,48),12,9,12),t.addMany(e(48,64),12,0,11),t.addMany(e(64,127),12,12,13),t.addMany(e(64,127),10,12,13),t.addMany(e(64,127),9,12,13),t.addMany(c,13,13,13),t.addMany(i,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(S,0,2,0),t.add(S,8,5,8),t.add(S,6,0,6),t.add(S,11,0,11),t.add(S,13,13,13),t}();class u extends h.Disposable{constructor(s=r.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,c)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},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,h.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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(s,e=[64,126]){let i=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=s.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<s.intermediates.length;++g){let p=s.intermediates.charCodeAt(g);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=p}}if(s.final.length!==1)throw new Error("final must be a single byte");let c=s.final.charCodeAt(0);if(e[0]>c||c>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return i<<=8,i|=c,i}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 i=this._identifier(s,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let c=this._escHandlers[i];return c.push(e),{dispose:()=>{let g=c.indexOf(e);g!==-1&&c.splice(g,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 i=this._identifier(s);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let c=this._csiHandlers[i];return c.push(e),{dispose:()=>{let g=c.indexOf(e);g!==-1&&c.splice(g,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,i,c,g){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=i,this._parseStack.transition=c,this._parseStack.chunkPos=g}parse(s,e,i){let c,g=0,p=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,b=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&b>-1){for(;b>=0&&(c=d[b](this._params),c!==!0);b--)if(c instanceof Promise)return this._parseStack.handlerPos=b,c}this._parseStack.handlers=[];break;case 4:if(i===!1&&b>-1){for(;b>=0&&(c=d[b](),c!==!0);b--)if(c instanceof Promise)return this._parseStack.handlerPos=b,c}this._parseStack.handlers=[];break;case 6:if(g=s[this._parseStack.chunkPos],c=this._dcsParser.unhook(g!==24&&g!==26,i),c)return c;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=s[this._parseStack.chunkPos],c=this._oscParser.end(g!==24&&g!==26,i),c)return c;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,m=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let d=m;d<e;++d){switch(g=s[d],p=this._transitions.table[this.currentState<<8|(g<160?g:S)],p>>4){case 2:for(let D=d+1;;++D){if(D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-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:d,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let b=this._csiHandlers[this._collect<<8|g],L=b?b.length-1:-1;for(;L>=0&&(c=b[L](this._params),c!==!0);L--)if(c instanceof Promise)return this._preserveStack(3,b,L,p,d),c;L<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(++d<e&&(g=s[d])>47&&g<60);d--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:let T=this._escHandlers[this._collect<<8|g],B=T?T.length-1:-1;for(;B>=0&&(c=T[B](),c!==!0);B--)if(c instanceof Promise)return this._preserveStack(4,T,B,p,d),c;B<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 D=d+1;;++D)if(D>=e||(g=s[D])===24||g===26||g===27||g>127&&g<S){this._dcsParser.put(s,d,D),d=D-1;break}break;case 14:if(c=this._dcsParser.unhook(g!==24&&g!==26),c)return this._preserveStack(6,[],0,p,d),c;g===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let D=d+1;;D++)if(D>=e||(g=s[D])<32||g>127&&g<S){this._oscParser.put(s,d,D),d=D-1;break}break;case 6:if(c=this._oscParser.end(g!==24&&g!==26),c)return this._preserveStack(5,[],0,p,d),c;g===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&p}}}r.EscapeSequenceParser=u},6242:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let h=n(5770),f=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(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);let S=this._handlers[_];return S.push(v),{dispose:()=>{let u=S.indexOf(v);u!==-1&&S.splice(u,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}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=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,S){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(_,v,S);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,v,S))}start(){this.reset(),this._state=1}put(_,v,S){if(this._state!==3){if(this._state===1)for(;v<S;){let u=_[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&S-v>0&&this._put(_,v,S)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,u=this._active.length-1,t=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,S=v,t=this._stack.fallThrough,this._stack.paused=!1),!t&&S===!1){for(;u>=0&&(S=this._active[u].end(_),S!==!0);u--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,S;u--}for(;u>=0;u--)if(S=this._active[u].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",_);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,S){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,v,S),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then(S=>(this._data="",this._hitLimit=!1,S));return this._data="",this._hitLimit=!1,v}}},8742:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let n=2147483647;class h{static fromArray(o){let _=new h;if(!o.length)return _;for(let v=Array.isArray(o[0])?1:0;v<o.length;++v){let S=o[v];if(Array.isArray(S))for(let u=0;u<S.length;++u)_.addSubParam(S[u]);else _.addParam(S)}return _}constructor(o=32,_=32){if(this.maxLength=o,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new h(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 _=0;_<this.length;++_){o.push(this.params[_]);let v=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-v>0&&o.push(Array.prototype.slice.call(this._subParams,v,S))}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 _=this._subParamsIdx[o]>>8,v=255&this._subParamsIdx[o];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){let o={};for(let _=0;_<this.length;++_){let v=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-v>0&&(o[_]=this._subParams.slice(v,S))}return o}addDigit(o){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let v=this._digitIsSub?this._subParams:this.params,S=v[_-1];v[_-1]=~S?Math.min(10*S+o,n):o}}r.Params=h},5741:(E,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,h){let f={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(f),h.dispose=()=>this._wrappedAddonDispose(f),h.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let h=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===n){h=f;break}if(h===-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(h,1)}}},8771:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let h=n(3785),f=n(511);r.BufferApiView=class{constructor(o,_){this._buffer=o,this.type=_}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 _=this._buffer.lines.get(o);if(_)return new h.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let h=n(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,o){if(!(f<0||f>=this._line.length))return o?(this._line.loadCell(f,o),o):this._line.loadCell(f,new h.CellData)}translateToString(f,o,_){return this._line.translateToString(f,o,_)}}},8285:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let h=n(8771),f=n(8460),o=n(844);class _ extends o.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new f.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)}}r.BufferNamespaceApi=_},7975:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,h){return this._core.registerCsiHandler(n,f=>h(f.toArray()))}addCsiHandler(n,h){return this.registerCsiHandler(n,h)}registerDcsHandler(n,h){return this._core.registerDcsHandler(n,(f,o)=>h(f,o.toArray()))}addDcsHandler(n,h){return this.registerDcsHandler(n,h)}registerEscHandler(n,h){return this._core.registerEscHandler(n,h)}addEscHandler(n,h){return this.registerEscHandler(n,h)}registerOscHandler(n,h){return this._core.registerOscHandler(n,h)}addOscHandler(n,h){return this.registerOscHandler(n,h)}}},7090:(E,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(E,r,n){var h=this&&this.__decorate||function(t,s,e,i){var c,g=arguments.length,p=g<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,e,i);else for(var m=t.length-1;m>=0;m--)(c=t[m])&&(p=(g<3?c(p):g>3?c(s,e,p):c(s,e))||p);return g>3&&p&&Object.defineProperty(s,e,p),p},f=this&&this.__param||function(t,s){return function(e,i){s(e,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let o=n(8460),_=n(844),v=n(5295),S=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let u=r.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(t){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(t.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(t.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(t,this))}resize(t,s){this.cols=t,this.rows=s,this.buffers.resize(t,s),this._onResize.fire({cols:t,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,s=!1){let e=this.buffer,i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===t.fg&&i.getBg(0)===t.bg||(i=e.getBlankLine(t,s),this._cachedBlankLine=i),i.isWrapped=s;let c=e.ybase+e.scrollTop,g=e.ybase+e.scrollBottom;if(e.scrollTop===0){let p=e.lines.isFull;g===e.lines.length-1?p?e.lines.recycle().copyFrom(i):e.lines.push(i.clone()):e.lines.splice(g+1,0,i.clone()),p?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let p=g-c+1;e.lines.shiftElements(c+1,p-1,-1),e.lines.set(g,i.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(t,s,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let c=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),c!==i.ydisp&&(s||this._onScroll.fire(i.ydisp))}};r.BufferService=u=h([f(0,S.IOptionsService)],u)},7994:(E,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,h){this._charsets[n]=h,this.glevel===n&&(this.charset=h)}}},1753:function(E,r,n){var h=this&&this.__decorate||function(i,c,g,p){var m,d=arguments.length,b=d<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,c,g,p);else for(var L=i.length-1;L>=0;L--)(m=i[L])&&(b=(d<3?m(b):d>3?m(c,g,b):m(c,g))||b);return d>3&&b&&Object.defineProperty(c,g,b),b},f=this&&this.__param||function(i,c){return function(g,p){c(g,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let o=n(2585),_=n(8460),v=n(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button!==4&&i.action===1&&(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>i.action!==32||i.button!==3},ANY:{events:31,restrict:i=>!0}};function u(i,c){let g=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(g|=64,g|=i.action):(g|=3&i.button,4&i.button&&(g|=64),8&i.button&&(g|=128),i.action===32?g|=32:i.action!==0||c||(g|=3)),g}let t=String.fromCharCode,s={DEFAULT:i=>{let c=[u(i,!1)+32,i.col+32,i.row+32];return c[0]>255||c[1]>255||c[2]>255?"":`\x1B[M${t(c[0])}${t(c[1])}${t(c[2])}`},SGR:i=>{let c=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${u(i,!0)};${i.col};${i.row}${c}`},SGR_PIXELS:i=>{let c=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${u(i,!0)};${i.x};${i.y}${c}`}},e=r.CoreMouseService=class extends v.Disposable{constructor(i,c){super(),this._bufferService=i,this._coreService=c,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let g of Object.keys(S))this.addProtocol(g,S[g]);for(let g of Object.keys(s))this.addEncoding(g,s[g]);this.reset()}addProtocol(i,c){this._protocols[i]=c}addEncoding(i,c){this._encodings[i]=c}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;let c=this._encodings[this._activeEncoding](i);return c&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(c):this._coreService.triggerDataEvent(c,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(1&i),up:!!(2&i),drag:!!(4&i),move:!!(8&i),wheel:!!(16&i)}}_equalEvents(i,c,g){if(g){if(i.x!==c.x||i.y!==c.y)return!1}else if(i.col!==c.col||i.row!==c.row)return!1;return i.button===c.button&&i.action===c.action&&i.ctrl===c.ctrl&&i.alt===c.alt&&i.shift===c.shift}};r.CoreMouseService=e=h([f(0,o.IBufferService),f(1,o.ICoreService)],e)},6975:function(E,r,n){var h=this&&this.__decorate||function(e,i,c,g){var p,m=arguments.length,d=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(e,i,c,g);else for(var b=e.length-1;b>=0;b--)(p=e[b])&&(d=(m<3?p(d):m>3?p(i,c,d):p(i,c))||d);return m>3&&d&&Object.defineProperty(i,c,d),d},f=this&&this.__param||function(e,i){return function(c,g){i(c,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let o=n(1439),_=n(8460),v=n(844),S=n(2585),u=Object.freeze({insertMode:!1}),t=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=r.CoreService=class extends v.Disposable{constructor(e,i,c){super(),this._bufferService=e,this._logService=i,this._optionsService=c,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,o.clone)(u),this.decPrivateModes=(0,o.clone)(t)}reset(){this.modes=(0,o.clone)(u),this.decPrivateModes=(0,o.clone)(t)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let c=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&c.ybase!==c.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(g=>g.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};r.CoreService=s=h([f(0,S.IBufferService),f(1,S.ILogService),f(2,S.IOptionsService)],s)},9074:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let h=n(8055),f=n(8460),o=n(844),_=n(6106),v=0,S=0;class u extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;let i=new t(e);if(i){let c=i.marker.onDispose(()=>i.dispose());i.onDispose(()=>{i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),c.dispose())}),this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,c){let g=0,p=0;for(let m of this._decorations.getKeyIterator(i))g=m.options.x??0,p=g+(m.options.width??1),e>=g&&e<p&&(!c||(m.options.layer??"bottom")===c)&&(yield m)}forEachDecorationAtCell(e,i,c,g){this._decorations.forEachByKey(i,p=>{v=p.options.x??0,S=v+(p.options.width??1),e>=v&&e<S&&(!c||(p.options.layer??"bottom")===c)&&g(p)})}}r.DecorationService=u;class t extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let h=n(2585),f=n(8343);class o{constructor(...v){this._entries=new Map;for(let[S,u]of v)this.set(S,u)}set(v,S){let u=this._entries.get(v);return this._entries.set(v,S),u}forEach(v){for(let[S,u]of this._entries.entries())v(S,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(h.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){let S=(0,f.getServiceDependencies)(_).sort((s,e)=>s.index-e.index),u=[];for(let s of S){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${s.id}.`);u.push(e)}let t=S.length>0?S[0].index:v.length;if(v.length!==t)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${t+1} conflicts with ${v.length} static arguments`);return new _(...v,...u)}}},7866:function(E,r,n){var h=this&&this.__decorate||function(t,s,e,i){var c,g=arguments.length,p=g<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,e,i);else for(var m=t.length-1;m>=0;m--)(c=t[m])&&(p=(g<3?c(p):g>3?c(s,e,p):c(s,e))||p);return g>3&&p&&Object.defineProperty(s,e,p),p},f=this&&this.__param||function(t,s){return function(e,i){s(e,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let o=n(844),_=n(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},S,u=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(t){super(),this._optionsService=t,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),S=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let s=0;s<t.length;s++)typeof t[s]=="function"&&(t[s]=t[s]())}_log(t,s,e){this._evalLazyOptionalParams(e),t.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(t,...s){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,s)}debug(t,...s){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,s)}info(t,...s){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,s)}warn(t,...s){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,s)}error(t,...s){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,s)}};r.LogService=u=h([f(0,_.IOptionsService)],u),r.setTraceLogger=function(t){S=t},r.traceCall=function(t,s,e){if(typeof e.value!="function")throw new Error("not supported");let i=e.value;e.value=function(...c){if(S.logLevel!==_.LogLevelEnum.TRACE)return i.apply(this,c);S.trace(`GlyphRenderer#${i.name}(${c.map(p=>JSON.stringify(p)).join(", ")})`);let g=i.apply(this,c);return S.trace(`GlyphRenderer#${i.name} return`,g),g}}},7302:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let h=n(8460),f=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 _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends f.Disposable{constructor(u){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let t={...r.DEFAULT_OPTIONS};for(let s in u)if(s in t)try{let e=u[s];t[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this.register((0,f.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(u,t){return this.onOptionChange(s=>{s===u&&t(this.rawOptions[u])})}onMultipleOptionChange(u,t){return this.onOptionChange(s=>{u.indexOf(s)!==-1&&t()})}_setupOptions(){let u=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(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:u.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(u,t){switch(u){case"cursorStyle":if(t||(t=r.DEFAULT_OPTIONS[u]),!function(s){return s==="block"||s==="underline"||s==="bar"}(t))throw new Error(`"${t}" is not a valid value for ${u}`);break;case"wordSeparator":t||(t=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=_.includes(t)?t:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${u} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${u} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}return t}}r.OptionsService=v},2660:function(E,r,n){var h=this&&this.__decorate||function(v,S,u,t){var s,e=arguments.length,i=e<3?S:t===null?t=Object.getOwnPropertyDescriptor(S,u):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(v,S,u,t);else for(var c=v.length-1;c>=0;c--)(s=v[c])&&(i=(e<3?s(i):e>3?s(S,u,i):s(S,u))||i);return e>3&&i&&Object.defineProperty(S,u,i),i},f=this&&this.__param||function(v,S){return function(u,t){S(u,t,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let o=n(2585),_=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){let S=this._bufferService.buffer;if(v.id===void 0){let c=S.addMarker(S.ybase+S.y),g={data:v,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(g,c)),this._dataByLinkId.set(g.id,g),g.id}let u=v,t=this._getEntryIdKey(u),s=this._entriesWithId.get(t);if(s)return this.addLineToLink(s.id,S.ybase+S.y),s.id;let e=S.addMarker(S.ybase+S.y),i={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[e]};return e.onDispose(()=>this._removeMarkerFromLink(i,e)),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(v,S){let u=this._dataByLinkId.get(v);if(u&&u.lines.every(t=>t.line!==S)){let t=this._bufferService.buffer.addMarker(S);u.lines.push(t),t.onDispose(()=>this._removeMarkerFromLink(u,t))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,S){let u=v.lines.indexOf(S);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=_=h([f(0,o.IBufferService)],_)},8343:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let n="di$target",h="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[h]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);let o=function(_,v,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,t,s){t[n]===t?t[h].push({id:u,index:s}):(t[h]=[{id:u,index:s}],t[n]=t)})(o,_,S)};return o.toString=()=>f,r.serviceRegistry.set(f,o),o}},2585:(E,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 h=n(8343);var f;r.IBufferService=(0,h.createDecorator)("BufferService"),r.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),r.ICoreService=(0,h.createDecorator)("CoreService"),r.ICharsetService=(0,h.createDecorator)("CharsetService"),r.IInstantiationService=(0,h.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"}(f||(r.LogLevelEnum=f={})),r.ILogService=(0,h.createDecorator)("LogService"),r.IOptionsService=(0,h.createDecorator)("OptionsService"),r.IOscLinkService=(0,h.createDecorator)("OscLinkService"),r.IUnicodeService=(0,h.createDecorator)("UnicodeService"),r.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let h=n(8460),f=n(225);class o{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,S,u=!1){return(16777215&v)<<3|(3&S)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let v=new f.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let S=0,u=0,t=v.length;for(let s=0;s<t;++s){let e=v.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=t)return S+this.wcwidth(e);let g=v.charCodeAt(s);56320<=g&&g<=57343?e=1024*(e-55296)+g-56320+65536:S+=this.wcwidth(g)}let i=this.charProperties(e,u),c=o.extractWidth(i);o.extractShouldJoin(i)&&(c-=o.extractWidth(u)),S+=c,u=i}return S}charProperties(v,S){return this._activeProvider.charProperties(v,S)}}r.UnicodeService=o}},l={};function w(E){var r=l[E];if(r!==void 0)return r.exports;var n=l[E]={exports:{}};return a[E].call(n.exports,n,n.exports,w),n.exports}var y={};return(()=>{var E=y;Object.defineProperty(E,"__esModule",{value:!0}),E.Terminal=void 0;let r=w(9042),n=w(3236),h=w(844),f=w(5741),o=w(8285),_=w(7975),v=w(7090),S=["cols","rows"];class u extends h.Disposable{constructor(s){super(),this._core=this.register(new n.Terminal(s)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let e=c=>this._core.options[c],i=(c,g)=>{this._checkReadonlyOptions(c),this._core.options[c]=g};for(let c in this._core.options){let g={get:e.bind(this,c),set:i.bind(this,c)};Object.defineProperty(this._publicOptions,c,g)}}_checkReadonlyOptions(s){if(S.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 v.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,i){this._verifyIntegers(s,e,i),this._core.select(s,e,i)}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")}}E.Terminal=u})(),y})())});var jt=Nt((Xe,St)=>{(function(a,l){typeof Xe=="object"&&typeof St=="object"?St.exports=l():typeof define=="function"&&define.amd?define([],l):typeof Xe=="object"?Xe.FitAddon=l():a.FitAddon=l()})(self,()=>(()=>{"use strict";var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.FitAddon=void 0,l.FitAddon=class{activate(w){this._terminal=w}dispose(){}fit(){let w=this.proposeDimensions();if(!w||!this._terminal||isNaN(w.cols)||isNaN(w.rows))return;let y=this._terminal._core;this._terminal.rows===w.rows&&this._terminal.cols===w.cols||(y._renderService.clear(),this._terminal.resize(w.cols,w.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let w=this._terminal._core,y=w._renderService.dimensions;if(y.css.cell.width===0||y.css.cell.height===0)return;let E=this._terminal.options.scrollback===0?0:w.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),h=Math.max(0,parseInt(r.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),o=n-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),_=h-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-E;return{cols:Math.max(2,Math.floor(_/y.css.cell.width)),rows:Math.max(1,Math.floor(o/y.css.cell.height))}}}})(),a})())});var bi=Wt(zt(),1),Ci=Wt(jt(),1);var Ui=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(a){setTimeout(()=>{throw a.stack?$t.isErrorNoTelemetry(a)?new $t(a.message+`
10
10
 
11
11
  `+a.stack):new Error(a.message+`
12
12
 
13
- `+a.stack):a},0)}}addListener(a){return this.listeners.push(a),()=>{this._removeListener(a)}}emit(a){this.listeners.forEach(d=>{d(a)})}_removeListener(a){this.listeners.splice(this.listeners.indexOf(a),1)}setUnexpectedErrorHandler(a){this.unexpectedErrorHandler=a}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(a){this.unexpectedErrorHandler(a),this.emit(a)}onUnexpectedExternalError(a){this.unexpectedErrorHandler(a)}},Bi=new Ai;function _t(a){Mi(a)||Bi.onUnexpectedError(a)}var vt="Canceled";function Mi(a){return a instanceof Oi?!0:a instanceof Error&&a.name===vt&&a.message===vt}var Oi=class extends Error{constructor(){super(vt),this.name=this.message}},Pt=class gt extends Error{constructor(d){super(d),this.name="CodeExpectedError"}static fromError(d){if(d instanceof gt)return d;let w=new gt;return w.message=d.message,w.stack=d.stack,w}static isErrorNoTelemetry(d){return d.name==="CodeExpectedError"}};function Ii(a,d,w=0,E=a.length){let k=w,r=E;for(;k<r;){let n=Math.floor((k+r)/2);d(a[n])?k=n+1:r=n}return k-1}var Pi=class qt{constructor(d){this._array=d,this._findLastMonotonousLastIdx=0}findLastMonotonous(d){if(qt.assertInvariants){if(this._prevFindLastPredicate){for(let E of this._array)if(this._prevFindLastPredicate(E)&&!d(E))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=d}let w=Ii(this._array,d,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=w+1,w===-1?void 0:this._array[w]}};Pi.assertInvariants=!1;var Kt;(a=>{function d(r){return r<0}a.isLessThan=d;function w(r){return r<=0}a.isLessThanOrEqual=w;function E(r){return r>0}a.isGreaterThan=E;function k(r){return r===0}a.isNeitherLessOrGreaterThan=k,a.greaterThan=1,a.lessThan=-1,a.neitherLessOrGreaterThan=0})(Kt||(Kt={}));function Hi(a,d){return(w,E)=>d(a(w),a(E))}var Fi=(a,d)=>a-d,Ht=class mt{constructor(d){this.iterate=d}forEach(d){this.iterate(w=>(d(w),!0))}toArray(){let d=[];return this.iterate(w=>(d.push(w),!0)),d}filter(d){return new mt(w=>this.iterate(E=>d(E)?w(E):!0))}map(d){return new mt(w=>this.iterate(E=>w(d(E))))}some(d){let w=!1;return this.iterate(E=>(w=d(E),!w)),w}findFirst(d){let w;return this.iterate(E=>d(E)?(w=E,!1):!0),w}findLast(d){let w;return this.iterate(E=>(d(E)&&(w=E),!0)),w}findLastMaxBy(d){let w,E=!0;return this.iterate(k=>((E||Kt.isGreaterThan(d(k,w)))&&(E=!1,w=k),!0)),w}};Ht.empty=new Ht(a=>{});function Wi(a,d){let w=Object.create(null);for(let E of a){let k=d(E),r=w[k];r||(r=w[k]=[]),r.push(E)}return w}var Ft,Wt,zr=class{constructor(a,d){this.toKey=d,this._map=new Map,this[Ft]="SetWithKey";for(let w of a)this.add(w)}get size(){return this._map.size}add(a){let d=this.toKey(a);return this._map.set(d,a),this}delete(a){return this._map.delete(this.toKey(a))}has(a){return this._map.has(this.toKey(a))}*entries(){for(let a of this._map.values())yield[a,a]}keys(){return this.values()}*values(){for(let a of this._map.values())yield a}clear(){this._map.clear()}forEach(a,d){this._map.forEach(w=>a.call(d,w,w,this))}[(Wt=Symbol.iterator,Ft=Symbol.toStringTag,Wt)](){return this.values()}},Ni=class{constructor(){this.map=new Map}add(a,d){let w=this.map.get(a);w||(w=new Set,this.map.set(a,w)),w.add(d)}delete(a,d){let w=this.map.get(a);w&&(w.delete(d),w.size===0&&this.map.delete(a))}forEach(a,d){let w=this.map.get(a);w&&w.forEach(d)}get(a){return this.map.get(a)||new Set}};function Ui(a,d){let w=this,E=!1,k;return function(){if(E)return k;if(E=!0,d)try{k=a.apply(w,arguments)}finally{d()}else k=a.apply(w,arguments);return k}}var Vt;(a=>{function d(p){return p&&typeof p=="object"&&typeof p[Symbol.iterator]=="function"}a.is=d;let w=Object.freeze([]);function E(){return w}a.empty=E;function*k(p){yield p}a.single=k;function r(p){return d(p)?p:k(p)}a.wrap=r;function n(p){return p||w}a.from=n;function*h(p){for(let m=p.length-1;m>=0;m--)yield p[m]}a.reverse=h;function _(p){return!p||p[Symbol.iterator]().next().done===!0}a.isEmpty=_;function o(p){return p[Symbol.iterator]().next().value}a.first=o;function f(p,m){let c=0;for(let C of p)if(m(C,c++))return!0;return!1}a.some=f;function v(p,m){for(let c of p)if(m(c))return c}a.find=v;function*S(p,m){for(let c of p)m(c)&&(yield c)}a.filter=S;function*u(p,m){let c=0;for(let C of p)yield m(C,c++)}a.map=u;function*t(p,m){let c=0;for(let C of p)yield*m(C,c++)}a.flatMap=t;function*s(...p){for(let m of p)yield*m}a.concat=s;function e(p,m,c){let C=c;for(let R of p)C=m(C,R);return C}a.reduce=e;function*i(p,m,c=p.length){for(m<0&&(m+=p.length),c<0?c+=p.length:c>p.length&&(c=p.length);m<c;m++)yield p[m]}a.slice=i;function l(p,m=Number.POSITIVE_INFINITY){let c=[];if(m===0)return[c,p];let C=p[Symbol.iterator]();for(let R=0;R<m;R++){let T=C.next();if(T.done)return[c,a.empty()];c.push(T.value)}return[c,{[Symbol.iterator](){return C}}]}a.consume=l;async function g(p){let m=[];for await(let c of p)m.push(c);return Promise.resolve(m)}a.asyncToArray=g})(Vt||(Vt={}));var $i=!1,ye=null,zi=class Gt{constructor(){this.livingDisposables=new Map}getDisposableData(d){let w=this.livingDisposables.get(d);return w||(w={parent:null,source:null,isSingleton:!1,value:d,idx:Gt.idx++},this.livingDisposables.set(d,w)),w}trackDisposable(d){let w=this.getDisposableData(d);w.source||(w.source=new Error().stack)}setParent(d,w){let E=this.getDisposableData(d);E.parent=w}markAsDisposed(d){this.livingDisposables.delete(d)}markAsSingleton(d){this.getDisposableData(d).isSingleton=!0}getRootParent(d,w){let E=w.get(d);if(E)return E;let k=d.parent?this.getRootParent(this.getDisposableData(d.parent),w):d;return w.set(d,k),k}getTrackedDisposables(){let d=new Map;return[...this.livingDisposables.entries()].filter(([,w])=>w.source!==null&&!this.getRootParent(w,d).isSingleton).flatMap(([w])=>w)}computeLeakingDisposables(d=10,w){let E;if(w)E=w;else{let _=new Map,o=[...this.livingDisposables.values()].filter(v=>v.source!==null&&!this.getRootParent(v,_).isSingleton);if(o.length===0)return;let f=new Set(o.map(v=>v.value));if(E=o.filter(v=>!(v.parent&&f.has(v.parent))),E.length===0)throw new Error("There are cyclic diposable chains!")}if(!E)return;function k(_){function o(v,S){for(;v.length>0&&S.some(u=>typeof u=="string"?u===v[0]:v[0].match(u));)v.shift()}let f=_.source.split(`
14
- `).map(v=>v.trim().replace("at ","")).filter(v=>v!=="");return o(f,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),f.reverse()}let r=new Ni;for(let _ of E){let o=k(_);for(let f=0;f<=o.length;f++)r.add(o.slice(0,f).join(`
15
- `),_)}E.sort(Hi(_=>_.idx,Fi));let n="",h=0;for(let _ of E.slice(0,d)){h++;let o=k(_),f=[];for(let v=0;v<o.length;v++){let S=o[v];S=`(shared with ${r.get(o.slice(0,v+1).join(`
16
- `)).size}/${E.length} leaks) at ${S}`;let u=r.get(o.slice(0,v).join(`
17
- `)),t=Wi([...u].map(s=>k(s)[v]),s=>s);delete t[o[v]];for(let[s,e]of Object.entries(t))f.unshift(` - stacktraces of ${e.length} other leaks continue with ${s}`);f.unshift(S)}n+=`
13
+ `+a.stack):a},0)}}addListener(a){return this.listeners.push(a),()=>{this._removeListener(a)}}emit(a){this.listeners.forEach(l=>{l(a)})}_removeListener(a){this.listeners.splice(this.listeners.indexOf(a),1)}setUnexpectedErrorHandler(a){this.unexpectedErrorHandler=a}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(a){this.unexpectedErrorHandler(a),this.emit(a)}onUnexpectedExternalError(a){this.unexpectedErrorHandler(a)}},zi=new Ui;function bt(a){ji(a)||zi.onUnexpectedError(a)}var yt="Canceled";function ji(a){return a instanceof $i?!0:a instanceof Error&&a.name===yt&&a.message===yt}var $i=class extends Error{constructor(){super(yt),this.name=this.message}},$t=class Et extends Error{constructor(l){super(l),this.name="CodeExpectedError"}static fromError(l){if(l instanceof Et)return l;let w=new Et;return w.message=l.message,w.stack=l.stack,w}static isErrorNoTelemetry(l){return l.name==="CodeExpectedError"}};function qi(a,l,w=0,y=a.length){let E=w,r=y;for(;E<r;){let n=Math.floor((E+r)/2);l(a[n])?E=n+1:r=n}return E-1}var Ki=class Qt{constructor(l){this._array=l,this._findLastMonotonousLastIdx=0}findLastMonotonous(l){if(Qt.assertInvariants){if(this._prevFindLastPredicate){for(let y of this._array)if(this._prevFindLastPredicate(y)&&!l(y))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=l}let w=qi(this._array,l,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=w+1,w===-1?void 0:this._array[w]}};Ki.assertInvariants=!1;var ei;(a=>{function l(r){return r<0}a.isLessThan=l;function w(r){return r<=0}a.isLessThanOrEqual=w;function y(r){return r>0}a.isGreaterThan=y;function E(r){return r===0}a.isNeitherLessOrGreaterThan=E,a.greaterThan=1,a.lessThan=-1,a.neitherLessOrGreaterThan=0})(ei||(ei={}));function Vi(a,l){return(w,y)=>l(a(w),a(y))}var Gi=(a,l)=>a-l,qt=class xt{constructor(l){this.iterate=l}forEach(l){this.iterate(w=>(l(w),!0))}toArray(){let l=[];return this.iterate(w=>(l.push(w),!0)),l}filter(l){return new xt(w=>this.iterate(y=>l(y)?w(y):!0))}map(l){return new xt(w=>this.iterate(y=>w(l(y))))}some(l){let w=!1;return this.iterate(y=>(w=l(y),!w)),w}findFirst(l){let w;return this.iterate(y=>l(y)?(w=y,!1):!0),w}findLast(l){let w;return this.iterate(y=>(l(y)&&(w=y),!0)),w}findLastMaxBy(l){let w,y=!0;return this.iterate(E=>((y||ei.isGreaterThan(l(E,w)))&&(y=!1,w=E),!0)),w}};qt.empty=new qt(a=>{});function Xi(a,l){let w=Object.create(null);for(let y of a){let E=l(y),r=w[E];r||(r=w[E]=[]),r.push(y)}return w}var Kt,Vt,nn=class{constructor(a,l){this.toKey=l,this._map=new Map,this[Kt]="SetWithKey";for(let w of a)this.add(w)}get size(){return this._map.size}add(a){let l=this.toKey(a);return this._map.set(l,a),this}delete(a){return this._map.delete(this.toKey(a))}has(a){return this._map.has(this.toKey(a))}*entries(){for(let a of this._map.values())yield[a,a]}keys(){return this.values()}*values(){for(let a of this._map.values())yield a}clear(){this._map.clear()}forEach(a,l){this._map.forEach(w=>a.call(l,w,w,this))}[(Vt=Symbol.iterator,Kt=Symbol.toStringTag,Vt)](){return this.values()}},Ji=class{constructor(){this.map=new Map}add(a,l){let w=this.map.get(a);w||(w=new Set,this.map.set(a,w)),w.add(l)}delete(a,l){let w=this.map.get(a);w&&(w.delete(l),w.size===0&&this.map.delete(a))}forEach(a,l){let w=this.map.get(a);w&&w.forEach(l)}get(a){return this.map.get(a)||new Set}};function Yi(a,l){let w=this,y=!1,E;return function(){if(y)return E;if(y=!0,l)try{E=a.apply(w,arguments)}finally{l()}else E=a.apply(w,arguments);return E}}var ti;(a=>{function l(p){return p&&typeof p=="object"&&typeof p[Symbol.iterator]=="function"}a.is=l;let w=Object.freeze([]);function y(){return w}a.empty=y;function*E(p){yield p}a.single=E;function r(p){return l(p)?p:E(p)}a.wrap=r;function n(p){return p||w}a.from=n;function*h(p){for(let m=p.length-1;m>=0;m--)yield p[m]}a.reverse=h;function f(p){return!p||p[Symbol.iterator]().next().done===!0}a.isEmpty=f;function o(p){return p[Symbol.iterator]().next().value}a.first=o;function _(p,m){let d=0;for(let b of p)if(m(b,d++))return!0;return!1}a.some=_;function v(p,m){for(let d of p)if(m(d))return d}a.find=v;function*S(p,m){for(let d of p)m(d)&&(yield d)}a.filter=S;function*u(p,m){let d=0;for(let b of p)yield m(b,d++)}a.map=u;function*t(p,m){let d=0;for(let b of p)yield*m(b,d++)}a.flatMap=t;function*s(...p){for(let m of p)yield*m}a.concat=s;function e(p,m,d){let b=d;for(let L of p)b=m(b,L);return b}a.reduce=e;function*i(p,m,d=p.length){for(m<0&&(m+=p.length),d<0?d+=p.length:d>p.length&&(d=p.length);m<d;m++)yield p[m]}a.slice=i;function c(p,m=Number.POSITIVE_INFINITY){let d=[];if(m===0)return[d,p];let b=p[Symbol.iterator]();for(let L=0;L<m;L++){let T=b.next();if(T.done)return[d,a.empty()];d.push(T.value)}return[d,{[Symbol.iterator](){return b}}]}a.consume=c;async function g(p){let m=[];for await(let d of p)m.push(d);return Promise.resolve(m)}a.asyncToArray=g})(ti||(ti={}));var Zi=!1,xe=null,Qi=class ii{constructor(){this.livingDisposables=new Map}getDisposableData(l){let w=this.livingDisposables.get(l);return w||(w={parent:null,source:null,isSingleton:!1,value:l,idx:ii.idx++},this.livingDisposables.set(l,w)),w}trackDisposable(l){let w=this.getDisposableData(l);w.source||(w.source=new Error().stack)}setParent(l,w){let y=this.getDisposableData(l);y.parent=w}markAsDisposed(l){this.livingDisposables.delete(l)}markAsSingleton(l){this.getDisposableData(l).isSingleton=!0}getRootParent(l,w){let y=w.get(l);if(y)return y;let E=l.parent?this.getRootParent(this.getDisposableData(l.parent),w):l;return w.set(l,E),E}getTrackedDisposables(){let l=new Map;return[...this.livingDisposables.entries()].filter(([,w])=>w.source!==null&&!this.getRootParent(w,l).isSingleton).flatMap(([w])=>w)}computeLeakingDisposables(l=10,w){let y;if(w)y=w;else{let f=new Map,o=[...this.livingDisposables.values()].filter(v=>v.source!==null&&!this.getRootParent(v,f).isSingleton);if(o.length===0)return;let _=new Set(o.map(v=>v.value));if(y=o.filter(v=>!(v.parent&&_.has(v.parent))),y.length===0)throw new Error("There are cyclic diposable chains!")}if(!y)return;function E(f){function o(v,S){for(;v.length>0&&S.some(u=>typeof u=="string"?u===v[0]:v[0].match(u));)v.shift()}let _=f.source.split(`
14
+ `).map(v=>v.trim().replace("at ","")).filter(v=>v!=="");return o(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let r=new Ji;for(let f of y){let o=E(f);for(let _=0;_<=o.length;_++)r.add(o.slice(0,_).join(`
15
+ `),f)}y.sort(Vi(f=>f.idx,Gi));let n="",h=0;for(let f of y.slice(0,l)){h++;let o=E(f),_=[];for(let v=0;v<o.length;v++){let S=o[v];S=`(shared with ${r.get(o.slice(0,v+1).join(`
16
+ `)).size}/${y.length} leaks) at ${S}`;let u=r.get(o.slice(0,v).join(`
17
+ `)),t=Xi([...u].map(s=>E(s)[v]),s=>s);delete t[o[v]];for(let[s,e]of Object.entries(t))_.unshift(` - stacktraces of ${e.length} other leaks continue with ${s}`);_.unshift(S)}n+=`
18
18
 
19
19
 
20
- ==================== Leaking disposable ${h}/${E.length}: ${_.value.constructor.name} ====================
21
- ${f.join(`
20
+ ==================== Leaking disposable ${h}/${y.length}: ${f.value.constructor.name} ====================
21
+ ${_.join(`
22
22
  `)}
23
23
  ============================================================
24
24
 
25
- `}return E.length>d&&(n+=`
25
+ `}return y.length>l&&(n+=`
26
26
 
27
27
 
28
- ... and ${E.length-d} more leaking disposables
28
+ ... and ${y.length-l} more leaking disposables
29
29
 
30
- `),{leaks:E,details:n}}};zi.idx=0;function ji(a){ye=a}if($i){let a="__is_disposable_tracked__";ji(new class{trackDisposable(d){let w=new Error("Potentially leaked disposable").stack;setTimeout(()=>{d[a]||console.log(w)},3e3)}setParent(d,w){if(d&&d!==le.None)try{d[a]=!0}catch{}}markAsDisposed(d){if(d&&d!==le.None)try{d[a]=!0}catch{}}markAsSingleton(d){}})}function Je(a){return ye?.trackDisposable(a),a}function Ye(a){ye?.markAsDisposed(a)}function Pe(a,d){ye?.setParent(a,d)}function qi(a,d){if(ye)for(let w of a)ye.setParent(w,d)}function Ie(a){if(Vt.is(a)){let d=[];for(let w of a)if(w)try{w.dispose()}catch(E){d.push(E)}if(d.length===1)throw d[0];if(d.length>1)throw new AggregateError(d,"Encountered errors while disposing of store");return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function Xt(...a){let d=Ee(()=>Ie(a));return qi(a,d),d}function Ee(a){let d=Je({dispose:Ui(()=>{Ye(d),a()})});return d}var Jt=class Yt{constructor(){this._toDispose=new Set,this._isDisposed=!1,Je(this)}dispose(){this._isDisposed||(Ye(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ie(this._toDispose)}finally{this._toDispose.clear()}}add(d){if(!d)return d;if(d===this)throw new Error("Cannot register a disposable on itself!");return Pe(d,this),this._isDisposed?Yt.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(d),d}delete(d){if(d){if(d===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(d),d.dispose()}}deleteAndLeak(d){d&&this._toDispose.has(d)&&(this._toDispose.delete(d),Pe(d,null))}};Jt.DISABLE_DISPOSED_WARNING=!1;var xt=Jt,le=class{constructor(){this._store=new xt,Je(this),Pe(this._store,this)}dispose(){Ye(this),this._store.dispose()}_register(a){if(a===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(a)}};le.None=Object.freeze({dispose(){}});var Xe=class{constructor(){this._isDisposed=!1,Je(this)}get value(){return this._isDisposed?void 0:this._value}set value(a){this._isDisposed||a===this._value||(this._value?.dispose(),a&&Pe(a,this),this._value=a)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Ye(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let a=this._value;return this._value=void 0,a&&Pe(a,null),a}},Nt=class St{constructor(d){this.element=d,this.next=St.Undefined,this.prev=St.Undefined}};Nt.Undefined=new Nt(void 0);var Ki=globalThis.performance&&typeof globalThis.performance.now=="function",Vi=class Zt{static create(d){return new Zt(d)}constructor(d){this._now=Ki&&d===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Gi=!1,Ut=!1,Xi=!1,kt;(a=>{a.None=()=>le.None;function d(I){if(Xi){let{onDidAddListener:O}=I,H=wt.create(),P=0;I.onDidAddListener=()=>{++P===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),H.print()),O?.()}}}function w(I,O){return S(I,()=>{},0,void 0,!0,void 0,O)}a.defer=w;function E(I){return(O,H=null,P)=>{let b=!1,x;return x=I(L=>{if(!b)return x?x.dispose():b=!0,O.call(H,L)},null,P),b&&x.dispose(),x}}a.once=E;function k(I,O,H){return f((P,b=null,x)=>I(L=>P.call(b,O(L)),null,x),H)}a.map=k;function r(I,O,H){return f((P,b=null,x)=>I(L=>{O(L),P.call(b,L)},null,x),H)}a.forEach=r;function n(I,O,H){return f((P,b=null,x)=>I(L=>O(L)&&P.call(b,L),null,x),H)}a.filter=n;function h(I){return I}a.signal=h;function _(...I){return(O,H=null,P)=>{let b=Xt(...I.map(x=>x(L=>O.call(H,L))));return v(b,P)}}a.any=_;function o(I,O,H,P){let b=H;return k(I,x=>(b=O(b,x),b),P)}a.reduce=o;function f(I,O){let H,P={onWillAddFirstListener(){H=I(b.fire,b)},onDidRemoveLastListener(){H?.dispose()}};O||d(P);let b=new he(P);return O?.add(b),b.event}function v(I,O){return O instanceof Array?O.push(I):O&&O.add(I),I}function S(I,O,H=100,P=!1,b=!1,x,L){let A,W,$,q=0,K,M={leakWarningThreshold:x,onWillAddFirstListener(){A=I(N=>{q++,W=O(W,N),P&&!$&&(y.fire(W),W=void 0),K=()=>{let U=W;W=void 0,$=void 0,(!P||q>1)&&y.fire(U),q=0},typeof H=="number"?(clearTimeout($),$=setTimeout(K,H)):$===void 0&&($=0,queueMicrotask(K))})},onWillRemoveListener(){b&&q>0&&K?.()},onDidRemoveLastListener(){K=void 0,A.dispose()}};L||d(M);let y=new he(M);return L?.add(y),y.event}a.debounce=S;function u(I,O=0,H){return a.debounce(I,(P,b)=>P?(P.push(b),P):[b],O,void 0,!0,void 0,H)}a.accumulate=u;function t(I,O=(P,b)=>P===b,H){let P=!0,b;return n(I,x=>{let L=P||!O(x,b);return P=!1,b=x,L},H)}a.latch=t;function s(I,O,H){return[a.filter(I,O,H),a.filter(I,P=>!O(P),H)]}a.split=s;function e(I,O=!1,H=[],P){let b=H.slice(),x=I(W=>{b?b.push(W):A.fire(W)});P&&P.add(x);let L=()=>{b?.forEach(W=>A.fire(W)),b=null},A=new he({onWillAddFirstListener(){x||(x=I(W=>A.fire(W)),P&&P.add(x))},onDidAddFirstListener(){b&&(O?setTimeout(L):L())},onDidRemoveLastListener(){x&&x.dispose(),x=null}});return P&&P.add(A),A.event}a.buffer=e;function i(I,O){return(H,P,b)=>{let x=O(new g);return I(function(L){let A=x.evaluate(L);A!==l&&H.call(P,A)},void 0,b)}}a.chain=i;let l=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(H=>(O(H),H)),this}filter(O){return this.steps.push(H=>O(H)?H:l),this}reduce(O,H){let P=H;return this.steps.push(b=>(P=O(P,b),P)),this}latch(O=(H,P)=>H===P){let H=!0,P;return this.steps.push(b=>{let x=H||!O(b,P);return H=!1,P=b,x?b:l}),this}evaluate(O){for(let H of this.steps)if(O=H(O),O===l)break;return O}}function p(I,O,H=P=>P){let P=(...A)=>L.fire(H(...A)),b=()=>I.on(O,P),x=()=>I.removeListener(O,P),L=new he({onWillAddFirstListener:b,onDidRemoveLastListener:x});return L.event}a.fromNodeEventEmitter=p;function m(I,O,H=P=>P){let P=(...A)=>L.fire(H(...A)),b=()=>I.addEventListener(O,P),x=()=>I.removeEventListener(O,P),L=new he({onWillAddFirstListener:b,onDidRemoveLastListener:x});return L.event}a.fromDOMEventEmitter=m;function c(I){return new Promise(O=>E(I)(O))}a.toPromise=c;function C(I){let O=new he;return I.then(H=>{O.fire(H)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}a.fromPromise=C;function R(I,O){return I(H=>O.fire(H))}a.forward=R;function T(I,O,H){return O(H),I(P=>O(P))}a.runAndSubscribe=T;class B{constructor(O,H){this._observable=O,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};H||d(P),this.emitter=new he(P),H&&H.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,H){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(I,O){return new B(I,O).emitter.event}a.fromObservable=D;function F(I){return(O,H,P)=>{let b=0,x=!1,L={beginUpdate(){b++},endUpdate(){b--,b===0&&(I.reportChanges(),x&&(x=!1,O.call(H)))},handlePossibleChange(){},handleChange(){x=!0}};I.addObserver(L),I.reportChanges();let A={dispose(){I.removeObserver(L)}};return P instanceof xt?P.add(A):Array.isArray(P)&&P.push(A),A}}a.fromObservableLight=F})(kt||(kt={}));var bt=class Ct{constructor(d){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${d}_${Ct._idPool++}`,Ct.all.add(this)}start(d){this._stopWatch=new Vi,this.listenerCount=d}stop(){if(this._stopWatch){let d=this._stopWatch.elapsed();this.durations.push(d),this.elapsedOverall+=d,this.invocationCount+=1,this._stopWatch=void 0}}};bt.all=new Set,bt._idPool=0;var Ji=bt,$t=-1,Qt=class ei{constructor(d,w,E=(ei._idPool++).toString(16).padStart(3,"0")){this._errorHandler=d,this.threshold=w,this.name=E,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(d,w){let E=this.threshold;if(E<=0||w<E)return;this._stacks||(this._stacks=new Map);let k=this._stacks.get(d.value)||0;if(this._stacks.set(d.value,k+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=E*.5;let[r,n]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${w} listeners already. MOST frequent listener (${n}):`;console.warn(h),console.warn(r);let _=new Zi(h,r);this._errorHandler(_)}return()=>{let r=this._stacks.get(d.value)||0;this._stacks.set(d.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let d,w=0;for(let[E,k]of this._stacks)(!d||w<k)&&(d=[E,k],w=k);return d}};Qt._idPool=1;var Yi=Qt,wt=class ti{constructor(d){this.value=d}static create(){let d=new Error;return new ti(d.stack??"")}print(){console.warn(this.value.split(`
30
+ `),{leaks:y,details:n}}};Qi.idx=0;function es(a){xe=a}if(Zi){let a="__is_disposable_tracked__";es(new class{trackDisposable(l){let w=new Error("Potentially leaked disposable").stack;setTimeout(()=>{l[a]||console.log(w)},3e3)}setParent(l,w){if(l&&l!==he.None)try{l[a]=!0}catch{}}markAsDisposed(l){if(l&&l!==he.None)try{l[a]=!0}catch{}}markAsSingleton(l){}})}function it(a){return xe?.trackDisposable(a),a}function st(a){xe?.markAsDisposed(a)}function Ue(a,l){xe?.setParent(a,l)}function ts(a,l){if(xe)for(let w of a)xe.setParent(w,l)}function We(a){if(ti.is(a)){let l=[];for(let w of a)if(w)try{w.dispose()}catch(y){l.push(y)}if(l.length===1)throw l[0];if(l.length>1)throw new AggregateError(l,"Encountered errors while disposing of store");return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function si(...a){let l=ke(()=>We(a));return ts(a,l),l}function ke(a){let l=it({dispose:Yi(()=>{st(l),a()})});return l}var ri=class ni{constructor(){this._toDispose=new Set,this._isDisposed=!1,it(this)}dispose(){this._isDisposed||(st(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{We(this._toDispose)}finally{this._toDispose.clear()}}add(l){if(!l)return l;if(l===this)throw new Error("Cannot register a disposable on itself!");return Ue(l,this),this._isDisposed?ni.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(l),l}delete(l){if(l){if(l===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(l),l.dispose()}}deleteAndLeak(l){l&&this._toDispose.has(l)&&(this._toDispose.delete(l),Ue(l,null))}};ri.DISABLE_DISPOSED_WARNING=!1;var Bt=ri,he=class{constructor(){this._store=new Bt,it(this),Ue(this._store,this)}dispose(){st(this),this._store.dispose()}_register(a){if(a===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(a)}};he.None=Object.freeze({dispose(){}});var tt=class{constructor(){this._isDisposed=!1,it(this)}get value(){return this._isDisposed?void 0:this._value}set value(a){this._isDisposed||a===this._value||(this._value?.dispose(),a&&Ue(a,this),this._value=a)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,st(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let a=this._value;return this._value=void 0,a&&Ue(a,null),a}},Gt=class kt{constructor(l){this.element=l,this.next=kt.Undefined,this.prev=kt.Undefined}};Gt.Undefined=new Gt(void 0);var is=globalThis.performance&&typeof globalThis.performance.now=="function",ss=class oi{static create(l){return new oi(l)}constructor(l){this._now=is&&l===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},rs=!1,Xt=!1,ns=!1,Mt;(a=>{a.None=()=>he.None;function l(I){if(ns){let{onDidAddListener:O}=I,H=Rt.create(),P=0;I.onDidAddListener=()=>{++P===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),H.print()),O?.()}}}function w(I,O){return S(I,()=>{},0,void 0,!0,void 0,O)}a.defer=w;function y(I){return(O,H=null,P)=>{let C=!1,k;return k=I(R=>{if(!C)return k?k.dispose():C=!0,O.call(H,R)},null,P),C&&k.dispose(),k}}a.once=y;function E(I,O,H){return _((P,C=null,k)=>I(R=>P.call(C,O(R)),null,k),H)}a.map=E;function r(I,O,H){return _((P,C=null,k)=>I(R=>{O(R),P.call(C,R)},null,k),H)}a.forEach=r;function n(I,O,H){return _((P,C=null,k)=>I(R=>O(R)&&P.call(C,R),null,k),H)}a.filter=n;function h(I){return I}a.signal=h;function f(...I){return(O,H=null,P)=>{let C=si(...I.map(k=>k(R=>O.call(H,R))));return v(C,P)}}a.any=f;function o(I,O,H,P){let C=H;return E(I,k=>(C=O(C,k),C),P)}a.reduce=o;function _(I,O){let H,P={onWillAddFirstListener(){H=I(C.fire,C)},onDidRemoveLastListener(){H?.dispose()}};O||l(P);let C=new le(P);return O?.add(C),C.event}function v(I,O){return O instanceof Array?O.push(I):O&&O.add(I),I}function S(I,O,H=100,P=!1,C=!1,k,R){let A,N,z,q=0,K,M={leakWarningThreshold:k,onWillAddFirstListener(){A=I(W=>{q++,N=O(N,W),P&&!z&&(x.fire(N),N=void 0),K=()=>{let U=N;N=void 0,z=void 0,(!P||q>1)&&x.fire(U),q=0},typeof H=="number"?(clearTimeout(z),z=setTimeout(K,H)):z===void 0&&(z=0,queueMicrotask(K))})},onWillRemoveListener(){C&&q>0&&K?.()},onDidRemoveLastListener(){K=void 0,A.dispose()}};R||l(M);let x=new le(M);return R?.add(x),x.event}a.debounce=S;function u(I,O=0,H){return a.debounce(I,(P,C)=>P?(P.push(C),P):[C],O,void 0,!0,void 0,H)}a.accumulate=u;function t(I,O=(P,C)=>P===C,H){let P=!0,C;return n(I,k=>{let R=P||!O(k,C);return P=!1,C=k,R},H)}a.latch=t;function s(I,O,H){return[a.filter(I,O,H),a.filter(I,P=>!O(P),H)]}a.split=s;function e(I,O=!1,H=[],P){let C=H.slice(),k=I(N=>{C?C.push(N):A.fire(N)});P&&P.add(k);let R=()=>{C?.forEach(N=>A.fire(N)),C=null},A=new le({onWillAddFirstListener(){k||(k=I(N=>A.fire(N)),P&&P.add(k))},onDidAddFirstListener(){C&&(O?setTimeout(R):R())},onDidRemoveLastListener(){k&&k.dispose(),k=null}});return P&&P.add(A),A.event}a.buffer=e;function i(I,O){return(H,P,C)=>{let k=O(new g);return I(function(R){let A=k.evaluate(R);A!==c&&H.call(P,A)},void 0,C)}}a.chain=i;let c=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(H=>(O(H),H)),this}filter(O){return this.steps.push(H=>O(H)?H:c),this}reduce(O,H){let P=H;return this.steps.push(C=>(P=O(P,C),P)),this}latch(O=(H,P)=>H===P){let H=!0,P;return this.steps.push(C=>{let k=H||!O(C,P);return H=!1,P=C,k?C:c}),this}evaluate(O){for(let H of this.steps)if(O=H(O),O===c)break;return O}}function p(I,O,H=P=>P){let P=(...A)=>R.fire(H(...A)),C=()=>I.on(O,P),k=()=>I.removeListener(O,P),R=new le({onWillAddFirstListener:C,onDidRemoveLastListener:k});return R.event}a.fromNodeEventEmitter=p;function m(I,O,H=P=>P){let P=(...A)=>R.fire(H(...A)),C=()=>I.addEventListener(O,P),k=()=>I.removeEventListener(O,P),R=new le({onWillAddFirstListener:C,onDidRemoveLastListener:k});return R.event}a.fromDOMEventEmitter=m;function d(I){return new Promise(O=>y(I)(O))}a.toPromise=d;function b(I){let O=new le;return I.then(H=>{O.fire(H)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}a.fromPromise=b;function L(I,O){return I(H=>O.fire(H))}a.forward=L;function T(I,O,H){return O(H),I(P=>O(P))}a.runAndSubscribe=T;class B{constructor(O,H){this._observable=O,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};H||l(P),this.emitter=new le(P),H&&H.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,H){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(I,O){return new B(I,O).emitter.event}a.fromObservable=D;function F(I){return(O,H,P)=>{let C=0,k=!1,R={beginUpdate(){C++},endUpdate(){C--,C===0&&(I.reportChanges(),k&&(k=!1,O.call(H)))},handlePossibleChange(){},handleChange(){k=!0}};I.addObserver(R),I.reportChanges();let A={dispose(){I.removeObserver(R)}};return P instanceof Bt?P.add(A):Array.isArray(P)&&P.push(A),A}}a.fromObservableLight=F})(Mt||(Mt={}));var Lt=class Dt{constructor(l){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${l}_${Dt._idPool++}`,Dt.all.add(this)}start(l){this._stopWatch=new ss,this.listenerCount=l}stop(){if(this._stopWatch){let l=this._stopWatch.elapsed();this.durations.push(l),this.elapsedOverall+=l,this.invocationCount+=1,this._stopWatch=void 0}}};Lt.all=new Set,Lt._idPool=0;var os=Lt,Jt=-1,ai=class li{constructor(l,w,y=(li._idPool++).toString(16).padStart(3,"0")){this._errorHandler=l,this.threshold=w,this.name=y,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(l,w){let y=this.threshold;if(y<=0||w<y)return;this._stacks||(this._stacks=new Map);let E=this._stacks.get(l.value)||0;if(this._stacks.set(l.value,E+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=y*.5;let[r,n]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${w} listeners already. MOST frequent listener (${n}):`;console.warn(h),console.warn(r);let f=new ls(h,r);this._errorHandler(f)}return()=>{let r=this._stacks.get(l.value)||0;this._stacks.set(l.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let l,w=0;for(let[y,E]of this._stacks)(!l||w<E)&&(l=[y,E],w=E);return l}};ai._idPool=1;var as=ai,Rt=class hi{constructor(l){this.value=l}static create(){let l=new Error;return new hi(l.stack??"")}print(){console.warn(this.value.split(`
31
31
  `).slice(2).join(`
32
- `))}},Zi=class extends Error{constructor(a,d){super(a),this.name="ListenerLeakError",this.stack=d}},Qi=class extends Error{constructor(a,d){super(a),this.name="ListenerRefusalError",this.stack=d}},es=0,qe=class{constructor(a){this.value=a,this.id=es++}},ts=2,is=(a,d)=>{if(a instanceof qe)d(a);else for(let w=0;w<a.length;w++){let E=a[w];E&&d(E)}},Ke;if(Gi){let a=[];setInterval(()=>{a.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(a.join(`
33
- `)),a.length=0)},3e3),Ke=new FinalizationRegistry(d=>{typeof d=="string"&&a.push(d)})}var he=class{constructor(a){this._size=0,this._options=a,this._leakageMon=$t>0||this._options?.leakWarningThreshold?new Yi(a?.onListenerError??_t,this._options?.leakWarningThreshold??$t):void 0,this._perfMon=this._options?._profName?new Ji(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ut){let a=this._listeners;queueMicrotask(()=>{is(a,d=>d.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(a,d,w)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],o=new Qi(`${h}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(this._options?.onListenerError||_t)(o),le.None}if(this._disposed)return le.None;d&&(a=a.bind(d));let E=new qe(a),k,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(E.stack=wt.create(),k=this._leakageMon.check(E.stack,this._size+1)),Ut&&(E.stack=r??wt.create()),this._listeners?this._listeners instanceof qe?(this._deliveryQueue??(this._deliveryQueue=new ss),this._listeners=[this._listeners,E]):this._listeners.push(E):(this._options?.onWillAddFirstListener?.(this),this._listeners=E,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=Ee(()=>{Ke?.unregister(n),k?.(),this._removeListener(E)});if(w instanceof xt?w.add(n):Array.isArray(w)&&w.push(n),Ke){let h=new Error().stack.split(`
32
+ `))}},ls=class extends Error{constructor(a,l){super(a),this.name="ListenerLeakError",this.stack=l}},hs=class extends Error{constructor(a,l){super(a),this.name="ListenerRefusalError",this.stack=l}},cs=0,Ye=class{constructor(a){this.value=a,this.id=cs++}},ds=2,us=(a,l)=>{if(a instanceof Ye)l(a);else for(let w=0;w<a.length;w++){let y=a[w];y&&l(y)}},Ze;if(rs){let a=[];setInterval(()=>{a.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(a.join(`
33
+ `)),a.length=0)},3e3),Ze=new FinalizationRegistry(l=>{typeof l=="string"&&a.push(l)})}var le=class{constructor(a){this._size=0,this._options=a,this._leakageMon=Jt>0||this._options?.leakWarningThreshold?new as(a?.onListenerError??bt,this._options?.leakWarningThreshold??Jt):void 0,this._perfMon=this._options?._profName?new os(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Xt){let a=this._listeners;queueMicrotask(()=>{us(a,l=>l.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(a,l,w)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],o=new hs(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||bt)(o),he.None}if(this._disposed)return he.None;l&&(a=a.bind(l));let y=new Ye(a),E,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(y.stack=Rt.create(),E=this._leakageMon.check(y.stack,this._size+1)),Xt&&(y.stack=r??Rt.create()),this._listeners?this._listeners instanceof Ye?(this._deliveryQueue??(this._deliveryQueue=new _s),this._listeners=[this._listeners,y]):this._listeners.push(y):(this._options?.onWillAddFirstListener?.(this),this._listeners=y,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=ke(()=>{Ze?.unregister(n),E?.(),this._removeListener(y)});if(w instanceof Bt?w.add(n):Array.isArray(w)&&w.push(n),Ze){let h=new Error().stack.split(`
34
34
  `).slice(2,3).join(`
35
- `).trim(),_=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(h);Ke.register(n,_?.[2]??h,n)}return n}),this._event}_removeListener(a){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let d=this._listeners,w=d.indexOf(a);if(w===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,d[w]=void 0;let E=this._deliveryQueue.current===this;if(this._size*ts<=d.length){let k=0;for(let r=0;r<d.length;r++)d[r]?d[k++]=d[r]:E&&(this._deliveryQueue.end--,k<this._deliveryQueue.i&&this._deliveryQueue.i--);d.length=k}}_deliver(a,d){if(!a)return;let w=this._options?.onListenerError||_t;if(!w){a.value(d);return}try{a.value(d)}catch(E){w(E)}}_deliverQueue(a){let d=a.current._listeners;for(;a.i<a.end;)this._deliver(d[a.i++],a.value);a.reset()}fire(a){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof qe)this._deliver(this._listeners,a);else{let d=this._deliveryQueue;d.enqueue(this,a,this._listeners.length),this._deliverQueue(d)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ss=class{constructor(){this.i=-1,this.end=0}enqueue(a,d,w){this.i=0,this.end=w,this.current=a,this.value=d}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ii=Object.freeze(function(a,d){let w=setTimeout(a.bind(d),0);return{dispose(){clearTimeout(w)}}}),rs;(a=>{function d(w){return w===a.None||w===a.Cancelled||w instanceof ns?!0:!w||typeof w!="object"?!1:typeof w.isCancellationRequested=="boolean"&&typeof w.onCancellationRequested=="function"}a.isCancellationToken=d,a.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),a.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ii})})(rs||(rs={}));var ns=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ii:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},we="en",yt=!1,Et=!1,Ve=!1,os=!1,as=!1,si=!1,hs=!1,ls=!1,cs=!1,ds=!1,je,Ge=we,zt=we,us,de,ue=globalThis,re;typeof ue.vscode<"u"&&typeof ue.vscode.process<"u"?re=ue.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(re=process);var ri=typeof re?.versions?.electron=="string",_s=ri&&re?.type==="renderer";if(typeof re=="object"){yt=re.platform==="win32",Et=re.platform==="darwin",Ve=re.platform==="linux",os=Ve&&!!re.env.SNAP&&!!re.env.SNAP_REVISION,hs=ri,cs=!!re.env.CI||!!re.env.BUILD_ARTIFACTSTAGINGDIRECTORY,je=we,Ge=we;let a=re.env.VSCODE_NLS_CONFIG;if(a)try{let d=JSON.parse(a);je=d.userLocale,zt=d.osLocale,Ge=d.resolvedLanguage||we,us=d.languagePack?.translationsConfigFile}catch{}as=!0}else typeof navigator=="object"&&!_s?(de=navigator.userAgent,yt=de.indexOf("Windows")>=0,Et=de.indexOf("Macintosh")>=0,ls=(de.indexOf("Macintosh")>=0||de.indexOf("iPad")>=0||de.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ve=de.indexOf("Linux")>=0,ds=de?.indexOf("Mobi")>=0,si=!0,Ge=globalThis._VSCODE_NLS_LANGUAGE||we,je=navigator.language.toLowerCase(),zt=je):console.error("Unable to resolve platform.");var ft=0;Et?ft=1:yt?ft=3:Ve&&(ft=2);var fs=si&&typeof ue.importScripts=="function",jr=fs?ue.origin:void 0,ce=de,ve=Ge,ps;(a=>{function d(){return ve}a.value=d;function w(){return ve.length===2?ve==="en":ve.length>=3?ve[0]==="e"&&ve[1]==="n"&&ve[2]==="-":!1}a.isDefaultVariant=w;function E(){return ve==="en"}a.isDefault=E})(ps||(ps={}));var vs=typeof ue.postMessage=="function"&&!ue.importScripts,gs=(()=>{if(vs){let a=[];ue.addEventListener("message",w=>{if(w.data&&w.data.vscodeScheduleAsyncWork)for(let E=0,k=a.length;E<k;E++){let r=a[E];if(r.id===w.data.vscodeScheduleAsyncWork){a.splice(E,1),r.callback();return}}});let d=0;return w=>{let E=++d;a.push({id:E,callback:w}),ue.postMessage({vscodeScheduleAsyncWork:E},"*")}}return a=>setTimeout(a)})(),ms=!!(ce&&ce.indexOf("Chrome")>=0),qr=!!(ce&&ce.indexOf("Firefox")>=0),Kr=!!(!ms&&ce&&ce.indexOf("Safari")>=0),Vr=!!(ce&&ce.indexOf("Edg/")>=0),Gr=!!(ce&&ce.indexOf("Android")>=0),Xr=Symbol("MicrotaskDelay");function ni(a,d=0,w){let E=setTimeout(()=>{a(),w&&k.dispose()},d),k=Ee(()=>{clearTimeout(E),w?.deleteAndLeak(k)});return w?.add(k),k}var Ss,pt;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?pt=(a,d)=>{gs(()=>{if(w)return;let E=Date.now()+15;d(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,E-Date.now())}}))});let w=!1;return{dispose(){w||(w=!0)}}}:pt=(a,d,w)=>{let E=a.requestIdleCallback(d,typeof w=="number"?{timeout:w}:void 0),k=!1;return{dispose(){k||(k=!0,a.cancelIdleCallback(E))}}},Ss=a=>pt(globalThis,a)})();var bs;(a=>{async function d(E){let k,r=await Promise.all(E.map(n=>n.then(h=>h,h=>{k||(k=h)})));if(typeof k<"u")throw k;return r}a.settled=d;function w(E){return new Promise(async(k,r)=>{try{await E(k,r)}catch(n){r(n)}})}a.withAsyncBody=w})(bs||(bs={}));var jt=class oe{static fromArray(d){return new oe(w=>{w.emitMany(d)})}static fromPromise(d){return new oe(async w=>{w.emitMany(await d)})}static fromPromises(d){return new oe(async w=>{await Promise.all(d.map(async E=>w.emitOne(await E)))})}static merge(d){return new oe(async w=>{await Promise.all(d.map(async E=>{for await(let k of E)w.emitOne(k)}))})}constructor(d,w){this._state=0,this._results=[],this._error=null,this._onReturn=w,this._onStateChanged=new he,queueMicrotask(async()=>{let E={emitOne:k=>this.emitOne(k),emitMany:k=>this.emitMany(k),reject:k=>this.reject(k)};try{await Promise.resolve(d(E)),this.resolve()}catch(k){this.reject(k)}finally{E.emitOne=void 0,E.emitMany=void 0,E.reject=void 0}})}[Symbol.asyncIterator](){let d=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(d<this._results.length)return{done:!1,value:this._results[d++]};if(this._state===1)return{done:!0,value:void 0};await kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(d,w){return new oe(async E=>{for await(let k of d)E.emitOne(w(k))})}map(d){return oe.map(this,d)}static filter(d,w){return new oe(async E=>{for await(let k of d)w(k)&&E.emitOne(k)})}filter(d){return oe.filter(this,d)}static coalesce(d){return oe.filter(d,w=>!!w)}coalesce(){return oe.coalesce(this)}static async toPromise(d){let w=[];for await(let E of d)w.push(E);return w}toPromise(){return oe.toPromise(this)}emitOne(d){this._state===0&&(this._results.push(d),this._onStateChanged.fire())}emitMany(d){this._state===0&&(this._results=this._results.concat(d),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(d){this._state===0&&(this._state=2,this._error=d,this._onStateChanged.fire())}};jt.EMPTY=jt.fromArray([]);var Cs=class extends le{constructor(a){super(),this._terminal=a,this._linesCacheTimeout=this._register(new Xe),this._linesCacheDisposables=this._register(new Xe),this._register(Ee(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Xt(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=ni(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(a){return this._linesCache?.[a]}setLineInCache(a,d){this._linesCache&&(this._linesCache[a]=d)}translateBufferLineToStringWithWrap(a,d){let w=[],E=[0],k=this._terminal.buffer.active.getLine(a);for(;k;){let r=this._terminal.buffer.active.getLine(a+1),n=r?r.isWrapped:!1,h=k.translateToString(!n&&d);if(n&&r){let _=k.getCell(k.length-1);_&&_.getCode()===0&&_.getWidth()===1&&r.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(w.push(h),n)E.push(E[E.length-1]+h.length);else break;a++,k=r}return[w.join(""),E]}},ws=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(a){this._cachedSearchTerm=a}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(a){this._lastSearchOptions=a}isValidSearchTerm(a){return!!(a&&a.length>0)}didOptionsChange(a){return this._lastSearchOptions?a?this._lastSearchOptions.caseSensitive!==a.caseSensitive||this._lastSearchOptions.regex!==a.regex||this._lastSearchOptions.wholeWord!==a.wholeWord:!1:!0}shouldUpdateHighlighting(a,d){return d?.decorations?this._cachedSearchTerm===void 0||a!==this._cachedSearchTerm||this.didOptionsChange(d):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},ys=class{constructor(a,d){this._terminal=a,this._lineCache=d}find(a,d,w,E){if(!a||a.length===0){this._terminal.clearSelection();return}if(w>this._terminal.cols)throw new Error(`Invalid col: ${w} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let k={startRow:d,startCol:w},r=this._findInLine(a,k,E);if(!r)for(let n=d+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(k.startRow=n,k.startCol=0,r=this._findInLine(a,k,E),!r);n++);return r}findNextWithSelection(a,d,w){if(!a||a.length===0){this._terminal.clearSelection();return}let E=this._terminal.getSelectionPosition();this._terminal.clearSelection();let k=0,r=0;E&&(w===a?(k=E.end.x,r=E.end.y):(k=E.start.x,r=E.start.y)),this._lineCache.initLinesCache();let n={startRow:r,startCol:k},h=this._findInLine(a,n,d);if(!h)for(let _=r+1;_<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=_,n.startCol=0,h=this._findInLine(a,n,d),!h);_++);if(!h&&r!==0)for(let _=0;_<r&&(n.startRow=_,n.startCol=0,h=this._findInLine(a,n,d),!h);_++);return!h&&E&&(n.startRow=E.start.y,n.startCol=0,h=this._findInLine(a,n,d)),h}findPreviousWithSelection(a,d,w){if(!a||a.length===0){this._terminal.clearSelection();return}let E=this._terminal.getSelectionPosition();this._terminal.clearSelection();let k=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let h={startRow:k,startCol:r},_;if(E&&(h.startRow=k=E.start.y,h.startCol=r=E.start.x,w!==a&&(_=this._findInLine(a,h,d,!1),_||(h.startRow=k=E.end.y,h.startCol=r=E.end.x))),_||(_=this._findInLine(a,h,d,n)),!_){h.startCol=Math.max(h.startCol,this._terminal.cols);for(let o=k-1;o>=0&&(h.startRow=o,_=this._findInLine(a,h,d,n),!_);o--);}if(!_&&k!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let o=this._terminal.buffer.active.baseY+this._terminal.rows-1;o>=k&&(h.startRow=o,_=this._findInLine(a,h,d,n),!_);o--);return _}_isWholeWord(a,d,w){return(a===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(d[a-1]))&&(a+w.length===d.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(d[a+w.length]))}_findInLine(a,d,w={},E=!1){let k=d.startRow,r=d.startCol;if(this._terminal.buffer.active.getLine(k)?.isWrapped){if(E){d.startCol+=this._terminal.cols;return}return d.startRow--,d.startCol+=this._terminal.cols,this._findInLine(a,d,w)}let n=this._lineCache.getLineFromCache(k);n||(n=this._lineCache.translateBufferLineToStringWithWrap(k,!0),this._lineCache.setLineInCache(k,n));let[h,_]=n,o=this._bufferColsToStringOffset(k,r),f=a,v=h;w.regex||(f=w.caseSensitive?a:a.toLowerCase(),v=w.caseSensitive?h:h.toLowerCase());let S=-1;if(w.regex){let u=RegExp(f,w.caseSensitive?"g":"gi"),t;if(E)for(;t=u.exec(v.slice(0,o));)S=u.lastIndex-t[0].length,a=t[0],u.lastIndex-=a.length-1;else t=u.exec(v.slice(o)),t&&t[0].length>0&&(S=o+(u.lastIndex-t[0].length),a=t[0])}else E?o-f.length>=0&&(S=v.lastIndexOf(f,o-f.length)):S=v.indexOf(f,o);if(S>=0){if(w.wholeWord&&!this._isWholeWord(S,v,a))return;let u=0;for(;u<_.length-1&&S>=_[u+1];)u++;let t=u;for(;t<_.length-1&&S+a.length>=_[t+1];)t++;let s=S-_[u],e=S+a.length-_[t],i=this._stringLengthToBufferSize(k+u,s),l=this._stringLengthToBufferSize(k+t,e)-i+this._terminal.cols*(t-u);return{term:a,col:i,row:k+u,size:l}}}_stringLengthToBufferSize(a,d){let w=this._terminal.buffer.active.getLine(a);if(!w)return 0;for(let E=0;E<d;E++){let k=w.getCell(E);if(!k)break;let r=k.getChars();r.length>1&&(d-=r.length-1);let n=w.getCell(E+1);n&&n.getWidth()===0&&d++}return d}_bufferColsToStringOffset(a,d){let w=a,E=0,k=this._terminal.buffer.active.getLine(w);for(;d>0&&k;){for(let r=0;r<d&&r<this._terminal.cols;r++){let n=k.getCell(r);if(!n)break;n.getWidth()&&(E+=n.getCode()===0?1:n.getChars().length)}if(w++,k=this._terminal.buffer.active.getLine(w),k&&!k.isWrapped)break;d-=this._terminal.cols}return E}},Es=class extends le{constructor(a){super(),this._terminal=a,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Ee(()=>this.clearHighlightDecorations()))}createHighlightDecorations(a,d){this.clearHighlightDecorations();for(let w of a){let E=this._createResultDecorations(w,d,!1);if(E)for(let k of E)this._storeDecoration(k,w)}}createActiveDecoration(a,d){let w=this._createResultDecorations(a,d,!0);if(w)return{decorations:w,match:a,dispose(){Ie(w)}}}clearHighlightDecorations(){Ie(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(a,d){this._highlightedLines.add(a.marker.line),this._highlightDecorations.push({decoration:a,match:d,dispose(){a.dispose()}})}_applyStyles(a,d,w){a.classList.contains("xterm-find-result-decoration")||(a.classList.add("xterm-find-result-decoration"),d&&(a.style.outline=`1px solid ${d}`)),w&&a.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(a,d,w){let E=[],k=a.col,r=a.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+a.row;for(;r>0;){let _=Math.min(this._terminal.cols-k,r);E.push([n,k,_]),k=0,r-=_,n++}let h=[];for(let _ of E){let o=this._terminal.registerMarker(_[0]),f=this._terminal.registerDecoration({marker:o,x:_[1],width:_[2],backgroundColor:w?d.activeMatchBackground:d.matchBackground,overviewRulerOptions:this._highlightedLines.has(o.line)?void 0:{color:w?d.activeMatchColorOverviewRuler:d.matchOverviewRuler,position:"center"}});if(f){let v=[];v.push(o),v.push(f.onRender(S=>this._applyStyles(S,w?d.activeMatchBorder:d.matchBorder,!1))),v.push(f.onDispose(()=>Ie(v))),h.push(f)}}return h.length===0?void 0:h}},xs=class extends le{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new he)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(a){this._selectedDecoration=a}updateResults(a,d){this._searchResults=a.slice(0,d)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(a){for(let d=0;d<this._searchResults.length;d++){let w=this._searchResults[d];if(w.row===a.row&&w.col===a.col&&w.size===a.size)return d}return-1}fireResultsChanged(a){if(!a)return;let d=-1;this._selectedDecoration&&(d=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:d,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},oi=class extends le{constructor(a){super(),this._highlightTimeout=this._register(new Xe),this._lineCache=this._register(new Xe),this._state=new ws,this._resultTracker=this._register(new xs),this._highlightLimit=a?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(a){this._terminal=a,this._lineCache.value=new Cs(a),this._engine=new ys(a,this._lineCache.value),this._decorationManager=new Es(a),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ee(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=ni(()=>{let a=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(a,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(a){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),a||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(a,d,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=d,this._state.shouldUpdateHighlighting(a,d)&&this._highlightAllMatches(a,d);let E=this._findNextAndSelect(a,d,w);return this._fireResults(d),this._state.cachedSearchTerm=a,E}_highlightAllMatches(a,d){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(a)){this.clearDecorations();return}this.clearDecorations(!0);let w=[],E,k=this._engine.find(a,0,0,d);for(;k&&(E?.row!==k.row||E?.col!==k.col)&&!(w.length>=this._highlightLimit);)E=k,w.push(E),k=this._engine.find(a,E.col+E.term.length>=this._terminal.cols?E.row+1:E.row,E.col+E.term.length>=this._terminal.cols?0:E.col+1,d);this._resultTracker.updateResults(w,this._highlightLimit),d.decorations&&this._decorationManager.createHighlightDecorations(w,d.decorations)}_findNextAndSelect(a,d,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(a))return this._terminal.clearSelection(),this.clearDecorations(),!1;let E=this._engine.findNextWithSelection(a,d,this._state.cachedSearchTerm);return this._selectResult(E,d?.decorations,w?.noScroll)}findPrevious(a,d,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=d,this._state.shouldUpdateHighlighting(a,d)&&this._highlightAllMatches(a,d);let E=this._findPreviousAndSelect(a,d,w);return this._fireResults(d),this._state.cachedSearchTerm=a,E}_fireResults(a){this._resultTracker.fireResultsChanged(!!a?.decorations)}_findPreviousAndSelect(a,d,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(a))return this._terminal.clearSelection(),this.clearDecorations(),!1;let E=this._engine.findPreviousWithSelection(a,d,this._state.cachedSearchTerm);return this._selectResult(E,d?.decorations,w?.noScroll)}_selectResult(a,d,w){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!a)return this._terminal.clearSelection(),!1;if(this._terminal.select(a.col,a.row,a.size),d){let E=this._decorationManager.createActiveDecoration(a,d);E&&(this._resultTracker.selectedDecoration=E)}if(!w&&(a.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||a.row<this._terminal.buffer.active.viewportY)){let E=a.row-this._terminal.buffer.active.viewportY;E-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(E)}return!0}};var ks=class{constructor(a,d,w,E={}){this._terminal=a,this._regex=d,this._handler=w,this._options=E}provideLinks(a,d){let w=Ds.computeLink(a,this._regex,this._terminal,this._handler);d(this._addCallbacks(w))}_addCallbacks(a){return a.map(d=>(d.leave=this._options.leave,d.hover=(w,E)=>{if(this._options.hover){let{range:k}=d;this._options.hover(w,E,k)}},d))}};function Ls(a){try{let d=new URL(a),w=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return a.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}var Ds=class Ze{static computeLink(d,w,E,k){let r=new RegExp(w.source,(w.flags||"")+"g"),[n,h]=Ze._getWindowedLineStrings(d-1,E),_=n.join(""),o,f=[];for(;o=r.exec(_);){let v=o[0];if(!Ls(v))continue;let[S,u]=Ze._mapStrIdx(E,h,0,o.index),[t,s]=Ze._mapStrIdx(E,S,u,v.length);if(S===-1||u===-1||t===-1||s===-1)continue;let e={start:{x:u+1,y:S+1},end:{x:s,y:t+1}};f.push({range:e,text:v,activate:k})}return f}static _getWindowedLineStrings(d,w){let E,k=d,r=d,n=0,h="",_=[];if(E=w.buffer.active.getLine(d)){let o=E.translateToString(!0);if(E.isWrapped&&o[0]!==" "){for(n=0;(E=w.buffer.active.getLine(--k))&&n<2048&&(h=E.translateToString(!0),n+=h.length,_.push(h),!(!E.isWrapped||h.indexOf(" ")!==-1)););_.reverse()}for(_.push(o),n=0;(E=w.buffer.active.getLine(++r))&&E.isWrapped&&n<2048&&(h=E.translateToString(!0),n+=h.length,_.push(h),h.indexOf(" ")===-1););}return[_,k]}static _mapStrIdx(d,w,E,k){let r=d.buffer.active,n=r.getNullCell(),h=E;for(;k;){let _=r.getLine(w);if(!_)return[-1,-1];for(let o=h;o<_.length;++o){_.getCell(o,n);let f=n.getChars();if(n.getWidth()&&(k-=f.length||1,o===_.length-1&&f==="")){let v=r.getLine(w+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(k+=1))}if(k<0)return[w,o]}w++,h=0}return[w,h]}},Rs=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Ts(a,d){let w=window.open();if(w){try{w.opener=null}catch{}w.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}var ai=class{constructor(a=Ts,d={}){this._handler=a,this._options=d}activate(a){this._terminal=a;let d=this._options,w=d.urlRegex||Rs;this._linkProvider=this._terminal.registerLinkProvider(new ks(this._terminal,w,this._handler,d))}dispose(){this._linkProvider?.dispose()}};var hi=`/**
35
+ `).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(h);Ze.register(n,f?.[2]??h,n)}return n}),this._event}_removeListener(a){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let l=this._listeners,w=l.indexOf(a);if(w===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,l[w]=void 0;let y=this._deliveryQueue.current===this;if(this._size*ds<=l.length){let E=0;for(let r=0;r<l.length;r++)l[r]?l[E++]=l[r]:y&&(this._deliveryQueue.end--,E<this._deliveryQueue.i&&this._deliveryQueue.i--);l.length=E}}_deliver(a,l){if(!a)return;let w=this._options?.onListenerError||bt;if(!w){a.value(l);return}try{a.value(l)}catch(y){w(y)}}_deliverQueue(a){let l=a.current._listeners;for(;a.i<a.end;)this._deliver(l[a.i++],a.value);a.reset()}fire(a){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ye)this._deliver(this._listeners,a);else{let l=this._deliveryQueue;l.enqueue(this,a,this._listeners.length),this._deliverQueue(l)}this._perfMon?.stop()}hasListeners(){return this._size>0}},_s=class{constructor(){this.i=-1,this.end=0}enqueue(a,l,w){this.i=0,this.end=w,this.current=a,this.value=l}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ci=Object.freeze(function(a,l){let w=setTimeout(a.bind(l),0);return{dispose(){clearTimeout(w)}}}),fs;(a=>{function l(w){return w===a.None||w===a.Cancelled||w instanceof ps?!0:!w||typeof w!="object"?!1:typeof w.isCancellationRequested=="boolean"&&typeof w.onCancellationRequested=="function"}a.isCancellationToken=l,a.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Mt.None}),a.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ci})})(fs||(fs={}));var ps=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ci:(this._emitter||(this._emitter=new le),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ee="en",Tt=!1,At=!1,Qe=!1,vs=!1,gs=!1,di=!1,ms=!1,Ss=!1,bs=!1,Cs=!1,Je,et=Ee,Yt=Ee,ws,ue,_e=globalThis,re;typeof _e.vscode<"u"&&typeof _e.vscode.process<"u"?re=_e.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(re=process);var ui=typeof re?.versions?.electron=="string",ys=ui&&re?.type==="renderer";if(typeof re=="object"){Tt=re.platform==="win32",At=re.platform==="darwin",Qe=re.platform==="linux",vs=Qe&&!!re.env.SNAP&&!!re.env.SNAP_REVISION,ms=ui,bs=!!re.env.CI||!!re.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Je=Ee,et=Ee;let a=re.env.VSCODE_NLS_CONFIG;if(a)try{let l=JSON.parse(a);Je=l.userLocale,Yt=l.osLocale,et=l.resolvedLanguage||Ee,ws=l.languagePack?.translationsConfigFile}catch{}gs=!0}else typeof navigator=="object"&&!ys?(ue=navigator.userAgent,Tt=ue.indexOf("Windows")>=0,At=ue.indexOf("Macintosh")>=0,Ss=(ue.indexOf("Macintosh")>=0||ue.indexOf("iPad")>=0||ue.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Qe=ue.indexOf("Linux")>=0,Cs=ue?.indexOf("Mobi")>=0,di=!0,et=globalThis._VSCODE_NLS_LANGUAGE||Ee,Je=navigator.language.toLowerCase(),Yt=Je):console.error("Unable to resolve platform.");var Ct=0;At?Ct=1:Tt?Ct=3:Qe&&(Ct=2);var Es=di&&typeof _e.importScripts=="function",on=Es?_e.origin:void 0,ce=ue,ge=et,xs;(a=>{function l(){return ge}a.value=l;function w(){return ge.length===2?ge==="en":ge.length>=3?ge[0]==="e"&&ge[1]==="n"&&ge[2]==="-":!1}a.isDefaultVariant=w;function y(){return ge==="en"}a.isDefault=y})(xs||(xs={}));var ks=typeof _e.postMessage=="function"&&!_e.importScripts,Ls=(()=>{if(ks){let a=[];_e.addEventListener("message",w=>{if(w.data&&w.data.vscodeScheduleAsyncWork)for(let y=0,E=a.length;y<E;y++){let r=a[y];if(r.id===w.data.vscodeScheduleAsyncWork){a.splice(y,1),r.callback();return}}});let l=0;return w=>{let y=++l;a.push({id:y,callback:w}),_e.postMessage({vscodeScheduleAsyncWork:y},"*")}}return a=>setTimeout(a)})(),Ds=!!(ce&&ce.indexOf("Chrome")>=0),an=!!(ce&&ce.indexOf("Firefox")>=0),ln=!!(!Ds&&ce&&ce.indexOf("Safari")>=0),hn=!!(ce&&ce.indexOf("Edg/")>=0),cn=!!(ce&&ce.indexOf("Android")>=0),dn=Symbol("MicrotaskDelay");function _i(a,l=0,w){let y=setTimeout(()=>{a(),w&&E.dispose()},l),E=ke(()=>{clearTimeout(y),w?.deleteAndLeak(E)});return w?.add(E),E}var Rs,wt;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?wt=(a,l)=>{Ls(()=>{if(w)return;let y=Date.now()+15;l(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,y-Date.now())}}))});let w=!1;return{dispose(){w||(w=!0)}}}:wt=(a,l,w)=>{let y=a.requestIdleCallback(l,typeof w=="number"?{timeout:w}:void 0),E=!1;return{dispose(){E||(E=!0,a.cancelIdleCallback(y))}}},Rs=a=>wt(globalThis,a)})();var Ts;(a=>{async function l(y){let E,r=await Promise.all(y.map(n=>n.then(h=>h,h=>{E||(E=h)})));if(typeof E<"u")throw E;return r}a.settled=l;function w(y){return new Promise(async(E,r)=>{try{await y(E,r)}catch(n){r(n)}})}a.withAsyncBody=w})(Ts||(Ts={}));var Zt=class oe{static fromArray(l){return new oe(w=>{w.emitMany(l)})}static fromPromise(l){return new oe(async w=>{w.emitMany(await l)})}static fromPromises(l){return new oe(async w=>{await Promise.all(l.map(async y=>w.emitOne(await y)))})}static merge(l){return new oe(async w=>{await Promise.all(l.map(async y=>{for await(let E of y)w.emitOne(E)}))})}constructor(l,w){this._state=0,this._results=[],this._error=null,this._onReturn=w,this._onStateChanged=new le,queueMicrotask(async()=>{let y={emitOne:E=>this.emitOne(E),emitMany:E=>this.emitMany(E),reject:E=>this.reject(E)};try{await Promise.resolve(l(y)),this.resolve()}catch(E){this.reject(E)}finally{y.emitOne=void 0,y.emitMany=void 0,y.reject=void 0}})}[Symbol.asyncIterator](){let l=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(l<this._results.length)return{done:!1,value:this._results[l++]};if(this._state===1)return{done:!0,value:void 0};await Mt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(l,w){return new oe(async y=>{for await(let E of l)y.emitOne(w(E))})}map(l){return oe.map(this,l)}static filter(l,w){return new oe(async y=>{for await(let E of l)w(E)&&y.emitOne(E)})}filter(l){return oe.filter(this,l)}static coalesce(l){return oe.filter(l,w=>!!w)}coalesce(){return oe.coalesce(this)}static async toPromise(l){let w=[];for await(let y of l)w.push(y);return w}toPromise(){return oe.toPromise(this)}emitOne(l){this._state===0&&(this._results.push(l),this._onStateChanged.fire())}emitMany(l){this._state===0&&(this._results=this._results.concat(l),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(l){this._state===0&&(this._state=2,this._error=l,this._onStateChanged.fire())}};Zt.EMPTY=Zt.fromArray([]);var As=class extends he{constructor(a){super(),this._terminal=a,this._linesCacheTimeout=this._register(new tt),this._linesCacheDisposables=this._register(new tt),this._register(ke(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=si(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=_i(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(a){return this._linesCache?.[a]}setLineInCache(a,l){this._linesCache&&(this._linesCache[a]=l)}translateBufferLineToStringWithWrap(a,l){let w=[],y=[0],E=this._terminal.buffer.active.getLine(a);for(;E;){let r=this._terminal.buffer.active.getLine(a+1),n=r?r.isWrapped:!1,h=E.translateToString(!n&&l);if(n&&r){let f=E.getCell(E.length-1);f&&f.getCode()===0&&f.getWidth()===1&&r.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(w.push(h),n)y.push(y[y.length-1]+h.length);else break;a++,E=r}return[w.join(""),y]}},Bs=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(a){this._cachedSearchTerm=a}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(a){this._lastSearchOptions=a}isValidSearchTerm(a){return!!(a&&a.length>0)}didOptionsChange(a){return this._lastSearchOptions?a?this._lastSearchOptions.caseSensitive!==a.caseSensitive||this._lastSearchOptions.regex!==a.regex||this._lastSearchOptions.wholeWord!==a.wholeWord:!1:!0}shouldUpdateHighlighting(a,l){return l?.decorations?this._cachedSearchTerm===void 0||a!==this._cachedSearchTerm||this.didOptionsChange(l):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Ms=class{constructor(a,l){this._terminal=a,this._lineCache=l}find(a,l,w,y){if(!a||a.length===0){this._terminal.clearSelection();return}if(w>this._terminal.cols)throw new Error(`Invalid col: ${w} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let E={startRow:l,startCol:w},r=this._findInLine(a,E,y);if(!r)for(let n=l+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(E.startRow=n,E.startCol=0,r=this._findInLine(a,E,y),!r);n++);return r}findNextWithSelection(a,l,w){if(!a||a.length===0){this._terminal.clearSelection();return}let y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let E=0,r=0;y&&(w===a?(E=y.end.x,r=y.end.y):(E=y.start.x,r=y.start.y)),this._lineCache.initLinesCache();let n={startRow:r,startCol:E},h=this._findInLine(a,n,l);if(!h)for(let f=r+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=f,n.startCol=0,h=this._findInLine(a,n,l),!h);f++);if(!h&&r!==0)for(let f=0;f<r&&(n.startRow=f,n.startCol=0,h=this._findInLine(a,n,l),!h);f++);return!h&&y&&(n.startRow=y.start.y,n.startCol=0,h=this._findInLine(a,n,l)),h}findPreviousWithSelection(a,l,w){if(!a||a.length===0){this._terminal.clearSelection();return}let y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let E=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let h={startRow:E,startCol:r},f;if(y&&(h.startRow=E=y.start.y,h.startCol=r=y.start.x,w!==a&&(f=this._findInLine(a,h,l,!1),f||(h.startRow=E=y.end.y,h.startCol=r=y.end.x))),f||(f=this._findInLine(a,h,l,n)),!f){h.startCol=Math.max(h.startCol,this._terminal.cols);for(let o=E-1;o>=0&&(h.startRow=o,f=this._findInLine(a,h,l,n),!f);o--);}if(!f&&E!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let o=this._terminal.buffer.active.baseY+this._terminal.rows-1;o>=E&&(h.startRow=o,f=this._findInLine(a,h,l,n),!f);o--);return f}_isWholeWord(a,l,w){return(a===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(l[a-1]))&&(a+w.length===l.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(l[a+w.length]))}_findInLine(a,l,w={},y=!1){let E=l.startRow,r=l.startCol;if(this._terminal.buffer.active.getLine(E)?.isWrapped){if(y){l.startCol+=this._terminal.cols;return}return l.startRow--,l.startCol+=this._terminal.cols,this._findInLine(a,l,w)}let n=this._lineCache.getLineFromCache(E);n||(n=this._lineCache.translateBufferLineToStringWithWrap(E,!0),this._lineCache.setLineInCache(E,n));let[h,f]=n,o=this._bufferColsToStringOffset(E,r),_=a,v=h;w.regex||(_=w.caseSensitive?a:a.toLowerCase(),v=w.caseSensitive?h:h.toLowerCase());let S=-1;if(w.regex){let u=RegExp(_,w.caseSensitive?"g":"gi"),t;if(y)for(;t=u.exec(v.slice(0,o));)S=u.lastIndex-t[0].length,a=t[0],u.lastIndex-=a.length-1;else t=u.exec(v.slice(o)),t&&t[0].length>0&&(S=o+(u.lastIndex-t[0].length),a=t[0])}else y?o-_.length>=0&&(S=v.lastIndexOf(_,o-_.length)):S=v.indexOf(_,o);if(S>=0){if(w.wholeWord&&!this._isWholeWord(S,v,a))return;let u=0;for(;u<f.length-1&&S>=f[u+1];)u++;let t=u;for(;t<f.length-1&&S+a.length>=f[t+1];)t++;let s=S-f[u],e=S+a.length-f[t],i=this._stringLengthToBufferSize(E+u,s),c=this._stringLengthToBufferSize(E+t,e)-i+this._terminal.cols*(t-u);return{term:a,col:i,row:E+u,size:c}}}_stringLengthToBufferSize(a,l){let w=this._terminal.buffer.active.getLine(a);if(!w)return 0;for(let y=0;y<l;y++){let E=w.getCell(y);if(!E)break;let r=E.getChars();r.length>1&&(l-=r.length-1);let n=w.getCell(y+1);n&&n.getWidth()===0&&l++}return l}_bufferColsToStringOffset(a,l){let w=a,y=0,E=this._terminal.buffer.active.getLine(w);for(;l>0&&E;){for(let r=0;r<l&&r<this._terminal.cols;r++){let n=E.getCell(r);if(!n)break;n.getWidth()&&(y+=n.getCode()===0?1:n.getChars().length)}if(w++,E=this._terminal.buffer.active.getLine(w),E&&!E.isWrapped)break;l-=this._terminal.cols}return y}},Os=class extends he{constructor(a){super(),this._terminal=a,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(ke(()=>this.clearHighlightDecorations()))}createHighlightDecorations(a,l){this.clearHighlightDecorations();for(let w of a){let y=this._createResultDecorations(w,l,!1);if(y)for(let E of y)this._storeDecoration(E,w)}}createActiveDecoration(a,l){let w=this._createResultDecorations(a,l,!0);if(w)return{decorations:w,match:a,dispose(){We(w)}}}clearHighlightDecorations(){We(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(a,l){this._highlightedLines.add(a.marker.line),this._highlightDecorations.push({decoration:a,match:l,dispose(){a.dispose()}})}_applyStyles(a,l,w){a.classList.contains("xterm-find-result-decoration")||(a.classList.add("xterm-find-result-decoration"),l&&(a.style.outline=`1px solid ${l}`)),w&&a.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(a,l,w){let y=[],E=a.col,r=a.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+a.row;for(;r>0;){let f=Math.min(this._terminal.cols-E,r);y.push([n,E,f]),E=0,r-=f,n++}let h=[];for(let f of y){let o=this._terminal.registerMarker(f[0]),_=this._terminal.registerDecoration({marker:o,x:f[1],width:f[2],backgroundColor:w?l.activeMatchBackground:l.matchBackground,overviewRulerOptions:this._highlightedLines.has(o.line)?void 0:{color:w?l.activeMatchColorOverviewRuler:l.matchOverviewRuler,position:"center"}});if(_){let v=[];v.push(o),v.push(_.onRender(S=>this._applyStyles(S,w?l.activeMatchBorder:l.matchBorder,!1))),v.push(_.onDispose(()=>We(v))),h.push(_)}}return h.length===0?void 0:h}},Is=class extends he{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new le)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(a){this._selectedDecoration=a}updateResults(a,l){this._searchResults=a.slice(0,l)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(a){for(let l=0;l<this._searchResults.length;l++){let w=this._searchResults[l];if(w.row===a.row&&w.col===a.col&&w.size===a.size)return l}return-1}fireResultsChanged(a){if(!a)return;let l=-1;this._selectedDecoration&&(l=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:l,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},fi=class extends he{constructor(a){super(),this._highlightTimeout=this._register(new tt),this._lineCache=this._register(new tt),this._state=new Bs,this._resultTracker=this._register(new Is),this._highlightLimit=a?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(a){this._terminal=a,this._lineCache.value=new As(a),this._engine=new Ms(a,this._lineCache.value),this._decorationManager=new Os(a),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(ke(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=_i(()=>{let a=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(a,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(a){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),a||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(a,l,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=l,this._state.shouldUpdateHighlighting(a,l)&&this._highlightAllMatches(a,l);let y=this._findNextAndSelect(a,l,w);return this._fireResults(l),this._state.cachedSearchTerm=a,y}_highlightAllMatches(a,l){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(a)){this.clearDecorations();return}this.clearDecorations(!0);let w=[],y,E=this._engine.find(a,0,0,l);for(;E&&(y?.row!==E.row||y?.col!==E.col)&&!(w.length>=this._highlightLimit);)y=E,w.push(y),E=this._engine.find(a,y.col+y.term.length>=this._terminal.cols?y.row+1:y.row,y.col+y.term.length>=this._terminal.cols?0:y.col+1,l);this._resultTracker.updateResults(w,this._highlightLimit),l.decorations&&this._decorationManager.createHighlightDecorations(w,l.decorations)}_findNextAndSelect(a,l,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(a))return this._terminal.clearSelection(),this.clearDecorations(),!1;let y=this._engine.findNextWithSelection(a,l,this._state.cachedSearchTerm);return this._selectResult(y,l?.decorations,w?.noScroll)}findPrevious(a,l,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=l,this._state.shouldUpdateHighlighting(a,l)&&this._highlightAllMatches(a,l);let y=this._findPreviousAndSelect(a,l,w);return this._fireResults(l),this._state.cachedSearchTerm=a,y}_fireResults(a){this._resultTracker.fireResultsChanged(!!a?.decorations)}_findPreviousAndSelect(a,l,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(a))return this._terminal.clearSelection(),this.clearDecorations(),!1;let y=this._engine.findPreviousWithSelection(a,l,this._state.cachedSearchTerm);return this._selectResult(y,l?.decorations,w?.noScroll)}_selectResult(a,l,w){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!a)return this._terminal.clearSelection(),!1;if(this._terminal.select(a.col,a.row,a.size),l){let y=this._decorationManager.createActiveDecoration(a,l);y&&(this._resultTracker.selectedDecoration=y)}if(!w&&(a.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||a.row<this._terminal.buffer.active.viewportY)){let y=a.row-this._terminal.buffer.active.viewportY;y-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(y)}return!0}};var Ps=class{constructor(a,l,w,y={}){this._terminal=a,this._regex=l,this._handler=w,this._options=y}provideLinks(a,l){let w=Fs.computeLink(a,this._regex,this._terminal,this._handler);l(this._addCallbacks(w))}_addCallbacks(a){return a.map(l=>(l.leave=this._options.leave,l.hover=(w,y)=>{if(this._options.hover){let{range:E}=l;this._options.hover(w,y,E)}},l))}};function Hs(a){try{let l=new URL(a),w=l.password&&l.username?`${l.protocol}//${l.username}:${l.password}@${l.host}`:l.username?`${l.protocol}//${l.username}@${l.host}`:`${l.protocol}//${l.host}`;return a.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}var Fs=class rt{static computeLink(l,w,y,E){let r=new RegExp(w.source,(w.flags||"")+"g"),[n,h]=rt._getWindowedLineStrings(l-1,y),f=n.join(""),o,_=[];for(;o=r.exec(f);){let v=o[0];if(!Hs(v))continue;let[S,u]=rt._mapStrIdx(y,h,0,o.index),[t,s]=rt._mapStrIdx(y,S,u,v.length);if(S===-1||u===-1||t===-1||s===-1)continue;let e={start:{x:u+1,y:S+1},end:{x:s,y:t+1}};_.push({range:e,text:v,activate:E})}return _}static _getWindowedLineStrings(l,w){let y,E=l,r=l,n=0,h="",f=[];if(y=w.buffer.active.getLine(l)){let o=y.translateToString(!0);if(y.isWrapped&&o[0]!==" "){for(n=0;(y=w.buffer.active.getLine(--E))&&n<2048&&(h=y.translateToString(!0),n+=h.length,f.push(h),!(!y.isWrapped||h.indexOf(" ")!==-1)););f.reverse()}for(f.push(o),n=0;(y=w.buffer.active.getLine(++r))&&y.isWrapped&&n<2048&&(h=y.translateToString(!0),n+=h.length,f.push(h),h.indexOf(" ")===-1););}return[f,E]}static _mapStrIdx(l,w,y,E){let r=l.buffer.active,n=r.getNullCell(),h=y;for(;E;){let f=r.getLine(w);if(!f)return[-1,-1];for(let o=h;o<f.length;++o){f.getCell(o,n);let _=n.getChars();if(n.getWidth()&&(E-=_.length||1,o===f.length-1&&_==="")){let v=r.getLine(w+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(E+=1))}if(E<0)return[w,o]}w++,h=0}return[w,h]}},Ns=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Ws(a,l){let w=window.open();if(w){try{w.opener=null}catch{}w.location.href=l}else console.warn("Opening link blocked as opener could not be cleared")}var pi=class{constructor(a=Ws,l={}){this._handler=a,this._options=l}activate(a){this._terminal=a;let l=this._options,w=l.urlRegex||Ns;this._linkProvider=this._terminal.registerLinkProvider(new Ps(this._terminal,w,this._handler,l))}dispose(){this._linkProvider?.dispose()}};var vi=`/**
36
36
  * Copyright (c) 2014 The xterm.js authors. All rights reserved.
37
37
  * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
38
38
  * https://github.com/chjj/term.js
@@ -250,9 +250,9 @@ ${f.join(`
250
250
  z-index: 2;
251
251
  position: relative;
252
252
  }
253
- `;var Bs=[".tt_sidebarEntry{width:100%;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:8px;align-items:center;gap:8px;padding:0 12px;font-size:13px;display:flex}",".tt_sidebarEntry:hover{background:var(--dsw-specific-sidebar-nav-item-hover);color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_sidebarEntryIcon{flex:none;justify-content:center;align-items:center;display:inline-flex}",".tt_sidebarEntryLabel{text-overflow:ellipsis;overflow:hidden}","[data-sidebar-collapsed] .tt_sidebarEntry{justify-content:center;width:100%;padding:0}","[data-sidebar-collapsed] .tt_sidebarEntryLabel{display:none}",".tt_modalBackdrop{z-index:1300;background:var(--dsw-alias-bg-mask-1);justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0;padding-top:5vh}",".tt_modal{background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);width:min(1180px,96vw);height:min(84vh,920px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);border-radius:14px;flex-direction:column;gap:0;display:flex;overflow:hidden}",".tt_header{flex:none;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);display:flex}",".tt_title{flex:1;margin:0;font-size:14px;font-weight:600;white-space:nowrap;align-items:center;gap:8px;display:flex}",".tt_status{font-size:11px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;display:flex;white-space:nowrap}",".tt_statusDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_statusDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_statusDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_toolBtn{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;height:28px;padding:0 10px;cursor:pointer;font-size:12px;flex:none;white-space:nowrap}",".tt_toolBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_searchInput{width:120px;height:28px;background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;font:inherit;font-size:12px;padding:0 8px;flex:none}",".tt_searchInput:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_min{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:16px;line-height:1;flex:none}",".tt_close{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:18px;line-height:1;flex:none}",".tt_min:hover,.tt_close:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_modalBackdrop[data-minimized]{display:none}",".tt_sidebarEntryBadge{display:none;align-items:center;gap:5px;margin-left:auto;padding-left:8px;flex:none}",".tt_sidebarEntry[data-minimized]{color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-minimized] .tt_sidebarEntryBadge{display:inline-flex}","[data-sidebar-collapsed] .tt_sidebarEntryBadge{margin-left:0;padding-left:0}","[data-sidebar-collapsed] .tt_sidebarBadgeCount{display:none}",".tt_sidebarBadgeDot{width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_sidebarBadgeDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_sidebarBadgeDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}","@keyframes ttPulse{from{box-shadow:0 0 0 5px rgba(63,185,80,.35)}to{box-shadow:0 0 0 0 rgba(63,185,80,0)}}",".tt_sidebarBadgeDot[data-active],.tt_dockDot[data-active]{animation:ttPulse .9s ease-out}",".tt_dockCompact .tt_dockStatus{display:none}",".tt_dock{position:fixed;right:18px;bottom:18px;z-index:1300;display:inline-flex;align-items:center;gap:10px;height:38px;padding:0 8px 0 16px;border-radius:999px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);font-size:13px;cursor:pointer;user-select:none}",".tt_dock:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_dockTitle{display:flex;align-items:center;gap:8px;font-weight:600;white-space:nowrap}",".tt_dockCount{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400}",".tt_dockStatus{max-width:220px;color:var(--dsw-alias-label-tertiary);font-size:12px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}",".tt_dockDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_dockDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_dockDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_dockClose{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:50%;width:26px;height:26px;cursor:pointer;font-size:14px;line-height:1;flex:none;display:inline-flex;align-items:center;justify-content:center}",".tt_dockClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabbar{flex:none;display:flex;align-items:center;gap:6px;padding:6px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);overflow-x:auto}",".tt_tab{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 8px 0 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;cursor:pointer;flex:none;white-space:nowrap}",".tt_tab:hover{color:var(--dsw-alias-label-primary)}",".tt_tab[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_tabClose{appearance:none;background:0 0;border:none;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:0 2px}",".tt_tabClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabAdd{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:1px dashed var(--dsw-alias-border-l2);border-radius:8px;background:0 0;color:var(--dsw-alias-label-secondary);font-size:16px;cursor:pointer;flex:none}",".tt_tabAdd:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-secondary)}",".tt_body{flex:1;min-height:0;position:relative;background:#0d1117;overflow:hidden}",".tt_term{position:absolute;inset:0;padding:8px 10px}",".tt_term .xterm{height:100%}",".tt_overlay{position:absolute;inset:0;align-items:center;justify-content:center;background:rgba(0,0,0,.55);color:#e6edf3;font-size:13px;cursor:pointer;display:flex;z-index:5}",".tt_overlay:empty{display:none}",".tt_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}",".tt_card:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}",".tt_cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}",".tt_cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}",".tt_cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}",".tt_cardDescription{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}",".tt_cardChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}",".tt_cardChevronOpen{transform:rotate(180deg)}",".tt_cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}",".tt_cardField{flex-direction:column;gap:6px;padding:12px 0;display:flex}",".tt_cardField+.tt_cardField{border-top:1px solid var(--dsw-alias-border-l2)}",".tt_cardLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}",".tt_cardInput{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5;box-sizing:border-box}",".tt_cardInput:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_cardCheckbox{width:16px;height:16px;accent-color:var(--dsw-alias-state-business-primary)}",".tt_cardRow{align-items:center;gap:8px;display:flex;flex-direction:row}",".tt_cardHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5;margin-top:2px}",".tt_cardSave{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border:1px solid transparent}",".tt_cardSave:disabled{opacity:.4;cursor:default}",".tt_cardMessage{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",".tt_cardMessageOk{color:var(--dsw-alias-state-success-primary)}",".tt_cardMessageError{color:var(--dsw-alias-state-error-primary)}"].join(`
254
- `),Ms="/api/dsh-tty/ws";function Os(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+Ms}function fi(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var Qe;function pi(){document.getElementById("dsh-tty-style")||(Qe=document.createElement("style"),Qe.id="dsh-tty-style",Qe.textContent=Bs+`
255
- `+hi,document.head.appendChild(Qe))}var Rt='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',vi=null,ie=null,X=null,Re=null,Se=null,xe=null,Le=null,se=null,De=null,Lt=!1,Fe=null,_e=!1,ee=null,tt=null,Te=null,be=null,it=null,J=new Map,Ce=null,gi=0,et=!1;function me(a,d){if(Re===null)return;Re.textContent=a,Se.dataset.state=d,Te!==null&&(Te.textContent=a),be!==null&&(be.dataset.state=d);let w=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");w!==null&&(w.dataset.state=d)}function ge(a){ie!==null&&ie.readyState===WebSocket.OPEN&&ie.send(JSON.stringify(a))}function ke(){return Ce!==null?J.get(Ce):void 0}function mi(){try{let a=vi?.list?.getSnapshot?.(),d=a?.byId?.[a?.current]?.cwd;return typeof d=="string"&&d!==""?d:void 0}catch{return}}function st(a){if(a===void 0||a.fit===void 0)return;let d=a.fit.proposeDimensions();d!==void 0&&ge({t:"resize",sid:a.sid,cols:d.cols,rows:d.rows})}function He(a,d){a.overlayEl===null||a.overlayEl===void 0||(a.overlayEl.textContent=d)}function Si(a){let d=new ui.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"SF Mono", Menlo, Consolas, "Courier New", monospace',scrollback:5e3,convertEol:!1,allowProposedApi:!0}),w=new _i.FitAddon,E=new oi;d.loadAddon(w),d.loadAddon(E),d.loadAddon(new ai);let k=document.createElement("div");k.className="tt_term";let r=document.createElement("div");r.className="tt_overlay",r.addEventListener("click",()=>{r.textContent="",Is(a.sid)}),k.appendChild(r),d.open(k);try{w.fit()}catch{}d.onData(n=>{ge({t:"input",sid:a.sid,d:n})}),d.attachCustomKeyEventHandler(n=>(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="f"?(n.preventDefault(),Ci(),!1):!0),a.term=d,a.fit=w,a.search=E,a.termEl=k,a.overlayEl=r}function bi(){let a=fi(),d={sid:a,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1};Si(d),J.set(a,d),gi+=1,nt(),rt(a);let w=d.fit.proposeDimensions();return ge({t:"spawn",sid:a,cols:w!==void 0?w.cols:80,rows:w!==void 0?w.rows:24,cwd:mi()}),d}function Is(a){let d=J.get(a);if(d===void 0)return;if(d.exited||ge({t:"kill",sid:a}),d.term!==null)try{d.term.dispose()}catch{}d.termEl!==null&&d.termEl.remove(),J.delete(a);let w={sid:fi(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1};Si(w),J.set(w.sid,w),nt(),rt(w.sid);let E=w.fit.proposeDimensions();ge({t:"spawn",sid:w.sid,cols:E!==void 0?E.cols:80,rows:E!==void 0?E.rows:24,cwd:mi()})}function Ps(a){let d=J.get(a);if(d!==void 0){if(d.exited||ge({t:"kill",sid:a}),J.delete(a),d.term!==null)try{d.term.dispose()}catch{}if(d.termEl!==null&&d.termEl.remove(),Ce===a){Ce=null;let w=[...J.keys()].pop()??null;w!==null&&rt(w)}nt(),J.size===0&&ot()}}function rt(a){let d=J.get(a);if(d!==void 0){Ce=a;for(let[w,E]of J)E.termEl!==null&&(E.termEl.style.display=w===a?"":"none");Le!==null&&d.termEl!==null&&d.termEl.parentElement!==Le&&Le.appendChild(d.termEl),nt();try{d.fit.fit()}catch{}d.spawned&&!d.exited&&st(d),He(d,d.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"")}}function nt(){if(xe===null)return;xe.textContent="";for(let[d,w]of J){let E=document.createElement("button");E.className="tt_tab",d===Ce&&(E.dataset.active=""),E.innerHTML="<span>\u7EC8\u7AEF "+Hs(d)+'</span><span class="tt_tabClose" title="\u5173\u95ED">\u2715</span>',E.addEventListener("click",k=>{if(k.target.closest(".tt_tabClose")!==null){k.stopPropagation(),Ps(d);return}rt(d)}),xe.appendChild(E)}let a=document.createElement("button");a.className="tt_tabAdd",a.title="\u65B0\u5EFA\u7EC8\u7AEF",a.textContent="+",a.addEventListener("click",()=>{bi()}),xe.appendChild(a)}function Hs(a){let d=1;for(let w of J.keys()){if(w===a)return String(d);d+=1}return String(d)}function Ci(){if(se===null)return;let a=se.style.display==="none"||se.style.display==="";se.style.display=a?"":"none",a&&se.focus()}var Fs={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function Ws(a){let d=ke();if(d===void 0||d.search===void 0)return;let w=se.value;if(w==="")return;let E={decorations:Fs};a?d.search.findPrevious(w,E):d.search.findNext(w,E)}function li(){if(ie!==null){try{ie.close()}catch{}ie=null}Lt=!1,et=!0,me("\u8FDE\u63A5\u4E2D\u2026","");try{ie=new WebSocket(Os())}catch(a){et=!1,me("\u8FDE\u63A5\u5931\u8D25\uFF1A"+a.message,"error"),ci("\u70B9\u51FB\u91CD\u8BD5");return}ie.onopen=()=>{et=!1,me("\u5DF2\u8FDE\u63A5","connected"),J.size===0&&bi()},ie.onmessage=a=>{let d;try{d=JSON.parse(a.data)}catch{return}let w=d.sid;if(d.t==="ready"){me("\u5DF2\u8FDE\u63A5 pid="+d.pid,"connected");let E=J.get(w);E!==void 0&&(E.exited=!1,E.spawned=!0,He(E,""),st(E),We())}else if(d.t==="data"){let E=J.get(w);E!==void 0&&E.term!==null&&(E.term.write(String(d.d??"")),$s())}else if(d.t==="exit"){let E=J.get(w);if(E!==void 0){E.exited=!0;let k=d.code!==null&&d.code!==void 0?"code="+d.code:"",r=d.signal!==null&&d.signal!==void 0?"signal="+d.signal:"";me("\u5DF2\u9000\u51FA "+[k,r].filter(Boolean).join(" "),""),He(E,"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00"),We()}}else if(d.t==="error")if(me("\u9519\u8BEF\uFF1A"+String(d.m??""),"error"),typeof w=="string"){let E=J.get(w);E!==void 0&&He(E,"\u9519\u8BEF\uFF1A"+String(d.m??"")+" \u2014 \u70B9\u51FB\u91CD\u8BD5")}else ci("\u70B9\u51FB\u91CD\u8BD5")},ie.onclose=()=>{if(et=!1,!Lt){me("\u8FDE\u63A5\u65AD\u5F00","error");for(let a of J.values())a.exited=!0,He(a,"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u70B9\u51FB\u91CD\u65B0\u8FDE\u63A5")}},ie.onerror=()=>{}}function ci(a){De!==null&&(De.textContent=a)}function Ns(){if(X!==null){_e&&wi();return}pi(),X=document.createElement("div"),X.className="tt_modalBackdrop",X.innerHTML='<div class="tt_modal"><div class="tt_header"><div class="tt_title">'+Rt+'<span>\u7EC8\u7AEF</span></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><button class="tt_toolBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">\u641C\u7D22</button><button class="tt_toolBtn" data-act="clear" title="\u6E05\u5C4F">\u6E05\u5C4F</button><button class="tt_toolBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">\u590D\u5236</button><button class="tt_toolBtn" data-act="paste" title="\u7C98\u8D34">\u7C98\u8D34</button><button class="tt_min" title="\u6700\u5C0F\u5316\u5230\u60AC\u6D6E\u6761\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09">\u2014</button><button class="tt_close" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button></div><div class="tt_tabbar"></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(X),Re=X.querySelector(".tt_statusText"),Se=X.querySelector(".tt_statusDot"),xe=X.querySelector(".tt_tabbar"),Le=X.querySelector(".tt_body"),De=X.querySelector(".tt_body > .tt_overlay"),se=X.querySelector(".tt_searchInput"),De.addEventListener("click",()=>{De.textContent="",li()}),X.querySelector("[data-act=search]").addEventListener("click",()=>{Ci(),se.style.display!=="none"&&se.focus()}),se.addEventListener("keydown",a=>{a.key==="Enter"?(a.preventDefault(),Ws(a.shiftKey)):a.key==="Escape"&&(a.stopPropagation(),se.style.display="none")}),X.querySelector("[data-act=clear]").addEventListener("click",()=>{let a=ke();a!==void 0&&a.term!==null&&a.term.clear()}),X.querySelector("[data-act=copy]").addEventListener("click",()=>{let a=ke();if(a===void 0||a.term===null)return;let d=a.term.getSelection();d!==""&&navigator.clipboard.writeText(d).catch(()=>{})}),X.querySelector("[data-act=paste]").addEventListener("click",()=>{let a=ke();a!==void 0&&navigator.clipboard.readText().then(d=>{ge({t:"input",sid:a.sid,d})}).catch(()=>{})}),X.querySelector(".tt_min").addEventListener("click",()=>{Dt()}),X.querySelector(".tt_close").addEventListener("click",()=>{ot()}),X.addEventListener("mousedown",a=>{a.target===X&&Dt()}),document.addEventListener("keydown",yi),Fe=new ResizeObserver(()=>{if(_e)return;let a=ke();if(a!==void 0&&a.fit!==void 0){try{a.fit.fit()}catch{return}a.exited||st(a)}}),Fe.observe(Le),li()}function Us(){ee=document.createElement("div"),ee.className="tt_dock",ee.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",ee.innerHTML='<span class="tt_dockTitle">'+Rt+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button>',tt=ee.querySelector(".tt_dockCount"),Te=ee.querySelector(".tt_dockStatus"),be=ee.querySelector(".tt_dockDot");let a=[...J.values()].filter(d=>!d.exited).length;tt.textContent=J.size>0?"\xB7 "+a+"/"+J.size:"",Re!==null&&(Te.textContent=Re.textContent),Se!==null&&(be.dataset.state=Se.dataset.state??""),ee.addEventListener("click",d=>{if(d.target.closest(".tt_dockClose")!==null){d.stopPropagation(),ot();return}wi()}),document.body.appendChild(ee)}function Dt(){X===null||_e||(_e=!0,se!==null&&(se.style.display="none"),X.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?We():(Us(),ee.classList.add("tt_dockCompact")))}function We(){let a=document.querySelector("[data-dsh-tty-entry]");if(a===null)return;let d=a.querySelector(".tt_sidebarEntryBadge");if(!_e){d!==null&&d.remove(),delete a.dataset.minimized,a.removeAttribute("title");return}d===null&&(d=document.createElement("span"),d.className="tt_sidebarEntryBadge",d.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',a.appendChild(d)),a.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let w=[...J.values()].filter(k=>!k.exited).length;d.querySelector(".tt_sidebarBadgeCount").textContent=w+"/"+J.size;let E=d.querySelector(".tt_sidebarBadgeDot");E!==null&&Se!==null&&(E.dataset.state=Se.dataset.state??"")}function $s(){if(!_e)return;let a=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??be;a!==null&&(a.dataset.active="",clearTimeout(it),it=setTimeout(()=>{delete a.dataset.active},900))}function wi(){if(X===null||!_e)return;_e=!1,delete X.dataset.minimized,clearTimeout(it),ee!==null&&(ee.remove(),ee=null),tt=null,Te=null,be=null,We();let a=ke();if(a!==void 0&&a.fit!==void 0){try{a.fit.fit()}catch{}a.spawned&&!a.exited&&st(a)}a!==void 0&&a.term!==null&&a.term.focus()}function ot(){if(X!==null){if(Lt=!0,_e=!1,clearTimeout(it),ee!==null&&(ee.remove(),ee=null),tt=null,Te=null,be=null,We(),ie!==null){for(let a of J.values())a.exited||ge({t:"kill",sid:a.sid});try{ie.close()}catch{}ie=null}Fe!==null&&(Fe.disconnect(),Fe=null);for(let a of J.values())if(a.term!==null)try{a.term.dispose()}catch{}J.clear(),Ce=null,document.removeEventListener("keydown",yi),X.remove(),X=null,Re=null,Se=null,xe=null,Le=null,De=null,se=null,gi=0}}function yi(a){a.key==="Escape"&&X!==null&&(a.preventDefault(),Dt())}function zs(){let a=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(a!==null)return a.querySelector('[class*="logoRow"]')?.parentElement??a.firstElementChild}function js(a){let d=a.querySelector('button[class*="newSession"]');if(d!==null)return d;for(let w of a.children)if(w.tagName==="BUTTON")return w}function qs(){let a=document.createElement("div");return a.dataset.dshTtyEntry="",a.className="tt_sidebarEntry",a.setAttribute("role","button"),a.setAttribute("aria-label","\u7EC8\u7AEF"),a.innerHTML='<span class="tt_sidebarEntryIcon">'+Rt+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',a.addEventListener("click",d=>{d.preventDefault(),Ns()}),a}function di(a,d){let w=js(a);if(w===void 0)return!1;if(d.parentElement!==a){let E=w.closest('[class*="logoRow"]'),k=E!==null&&E.parentElement===a?E:w,r=Array.from(a.children).filter(n=>n instanceof HTMLElement&&n.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(r.length>0){let n=r[r.length-1];a.insertBefore(d,n.nextSibling)}else a.insertBefore(d,k.nextElementSibling)}return!0}function Ks(){if(pi(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let a=qs(),d,w=!1,E=()=>{if(d!==void 0&&!d.isConnected&&(r.disconnect(),d=void 0,w=!1),w){if(document.body.contains(a))return;r.disconnect(),d=void 0,w=!1}d??(d=zs()),d!==void 0&&(w=di(d,a),w&&r.observe(d,{childList:!0,subtree:!0}))},k=new MutationObserver(()=>{E()});k.observe(document.body,{childList:!0,subtree:!0});let r=new MutationObserver(()=>{if(d===void 0||!d.isConnected){w=!1,E();return}d.contains(a)||(w=di(d,a))});return E(),()=>{k.disconnect(),r.disconnect(),a.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:a=>{let d={},w=a("react"),{jsx:E,jsxs:k}=a("react/jsx-runtime"),r="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function n(){let[h,_]=w.useState(!1),[o,f]=w.useState(null),[v,S]=w.useState(!1),[u,t]=w.useState(!1),[s,e]=w.useState({kind:"",text:""}),i=async()=>{try{let C=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();C.ok&&typeof C.config=="object"&&C.config!==null?f(C.config):e({kind:"error",text:String(C.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(c){e({kind:"error",text:String(c&&c.message?c.message:c)})}};w.useEffect(()=>{h&&!v&&(S(!0),i())},[h]);let l=(c,C)=>f(R=>({...R||{},[c]:C})),g=async()=>{t(!0),e({kind:"",text:""});try{let c=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o||{})}),C=await c.json();!c.ok||!C.ok?e({kind:"error",text:String(C.error||"\u4FDD\u5B58\u5931\u8D25")}):(e({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),C.config&&f(C.config))}catch(c){e({kind:"error",text:String(c&&c.message?c.message:c)})}t(!1)},p=(c,C,R,T)=>k("label",{className:"tt_cardField",children:[E("span",{className:"tt_cardLabel",children:c}),E("input",{className:"tt_cardInput",value:o[C]??"",placeholder:R??"",onChange:B=>l(C,B.target.value)}),T?E("span",{className:"tt_cardHint",children:T}):null]}),m=(c,C)=>k("label",{className:"tt_cardField tt_cardRow",children:[E("input",{type:"checkbox",className:"tt_cardCheckbox",checked:o[C]===!0,onChange:R=>l(C,R.target.checked)}),E("span",{className:"tt_cardLabel",children:c})]});return k("li",{className:h?"tt_card tt_cardOpen":"tt_card",children:[k("button",{type:"button",className:"tt_cardHeader","aria-expanded":h,onClick:()=>_(c=>!c),children:[k("span",{className:"tt_cardHeadText",children:[E("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),E("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),E("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:h?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:E("path",{d:r,fill:"currentColor"})})]}),h?k("div",{className:"tt_cardBody",children:[o===null?E("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):k("div",{children:[m("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),m("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),p("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),p("Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","shell","","\u7559\u7A7A\u4F7F\u7528 $SHELL"),p("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),p("COLORTERM","colorTerm","truecolor",""),p("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),k("div",{className:"tt_cardField tt_cardRow",children:[E("button",{className:"tt_cardSave",disabled:u,onClick:()=>void g(),children:u?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),E("span",{className:"tt_cardMessage"+(s.kind==="ok"?" tt_cardMessageOk":s.kind==="error"?" tt_cardMessageError":""),children:s.text})]})]})]}):null]})}return d.inject=["slots","sessions"],d.apply=h=>(vi=h.sessions,Ks(),h.slots.inject("settings.plugin.item",()=>h.slots.register({name:"settings.plugin.item",key:"tty",order:110},n)),()=>{ot()}),d}});})();
253
+ `;var zs=[".tt_sidebarEntry{width:100%;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:8px;align-items:center;gap:8px;padding:0 12px;font-size:13px;display:flex}",".tt_sidebarEntry:hover{background:var(--dsw-specific-sidebar-nav-item-hover);color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_sidebarEntryIcon{flex:none;justify-content:center;align-items:center;display:inline-flex}",".tt_sidebarEntryLabel{text-overflow:ellipsis;overflow:hidden}","[data-sidebar-collapsed] .tt_sidebarEntry{justify-content:center;width:100%;padding:0}","[data-sidebar-collapsed] .tt_sidebarEntryLabel{display:none}",".tt_modalBackdrop{z-index:1300;background:var(--dsw-alias-bg-mask-1);justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0;padding-top:5vh}",".tt_modal{background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);width:min(1180px,96vw);height:min(84vh,920px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);border-radius:14px;flex-direction:column;gap:0;display:flex;overflow:hidden}",".tt_header{flex:none;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);display:flex}",".tt_title{flex:1;margin:0;font-size:14px;font-weight:600;white-space:nowrap;align-items:center;gap:8px;display:flex}",".tt_status{font-size:11px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;display:flex;white-space:nowrap}",".tt_statusDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_statusDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_statusDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_toolBtn{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;height:28px;padding:0 10px;cursor:pointer;font-size:12px;flex:none;white-space:nowrap}",".tt_toolBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_searchInput{width:120px;height:28px;background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;font:inherit;font-size:12px;padding:0 8px;flex:none}",".tt_searchInput:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_min{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:16px;line-height:1;flex:none}",".tt_close{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:18px;line-height:1;flex:none}",".tt_min:hover,.tt_close:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_modalBackdrop[data-minimized]{display:none}",".tt_sidebarEntryBadge{display:none;align-items:center;gap:5px;margin-left:auto;padding-left:8px;flex:none}",".tt_sidebarEntry[data-minimized]{color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-minimized] .tt_sidebarEntryBadge{display:inline-flex}","[data-sidebar-collapsed] .tt_sidebarEntryBadge{margin-left:0;padding-left:0}","[data-sidebar-collapsed] .tt_sidebarBadgeCount{display:none}",".tt_sidebarBadgeDot{width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_sidebarBadgeDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_sidebarBadgeDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}","@keyframes ttPulse{from{box-shadow:0 0 0 5px rgba(63,185,80,.35)}to{box-shadow:0 0 0 0 rgba(63,185,80,0)}}",".tt_sidebarBadgeDot[data-active],.tt_dockDot[data-active]{animation:ttPulse .9s ease-out}",".tt_dockCompact .tt_dockStatus{display:none}",".tt_dock{position:fixed;right:18px;bottom:18px;z-index:1300;display:inline-flex;align-items:center;gap:10px;height:38px;padding:0 8px 0 16px;border-radius:999px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);font-size:13px;cursor:pointer;user-select:none}",".tt_dock:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_dockTitle{display:flex;align-items:center;gap:8px;font-weight:600;white-space:nowrap}",".tt_dockCount{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400}",".tt_dockStatus{max-width:220px;color:var(--dsw-alias-label-tertiary);font-size:12px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}",".tt_dockDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_dockDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_dockDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_dockClose{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:50%;width:26px;height:26px;cursor:pointer;font-size:14px;line-height:1;flex:none;display:inline-flex;align-items:center;justify-content:center}",".tt_dockClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabbar{flex:none;display:flex;align-items:center;gap:6px;padding:6px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);overflow-x:auto}",".tt_tab{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 8px 0 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;cursor:pointer;flex:none;white-space:nowrap}",".tt_tab:hover{color:var(--dsw-alias-label-primary)}",".tt_tab[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_tabClose{appearance:none;background:0 0;border:none;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:0 2px}",".tt_tabClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabAdd{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:1px dashed var(--dsw-alias-border-l2);border-radius:8px;background:0 0;color:var(--dsw-alias-label-secondary);font-size:16px;cursor:pointer;flex:none}",".tt_tabAdd:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-secondary)}",".tt_body{flex:1;min-height:0;position:relative;background:#0d1117;overflow:hidden}",".tt_term{position:absolute;inset:0;padding:8px 10px}",".tt_term .xterm{height:100%}",".tt_overlay{position:absolute;inset:0;align-items:center;justify-content:center;background:rgba(0,0,0,.55);color:#e6edf3;font-size:13px;cursor:pointer;display:flex;z-index:5}",".tt_overlay:empty{display:none}",".tt_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}",".tt_card:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}",".tt_cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}",".tt_cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}",".tt_cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}",".tt_cardDescription{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}",".tt_cardChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}",".tt_cardChevronOpen{transform:rotate(180deg)}",".tt_cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}",".tt_cardField{flex-direction:column;gap:6px;padding:12px 0;display:flex}",".tt_cardField+.tt_cardField{border-top:1px solid var(--dsw-alias-border-l2)}",".tt_cardLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}",".tt_cardInput{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5;box-sizing:border-box}",".tt_cardInput:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_cardCheckbox{width:16px;height:16px;accent-color:var(--dsw-alias-state-business-primary)}",".tt_cardRow{align-items:center;gap:8px;display:flex;flex-direction:row}",".tt_cardHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5;margin-top:2px}",".tt_cardSave{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border:1px solid transparent}",".tt_cardSave:disabled{opacity:.4;cursor:default}",".tt_cardMessage{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",".tt_cardMessageOk{color:var(--dsw-alias-state-success-primary)}",".tt_cardMessageError{color:var(--dsw-alias-state-error-primary)}",".tt_addMenu{position:fixed;z-index:1400;min-width:220px;max-width:320px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:var(--dsw-shadow-lv3);padding:6px;display:flex;flex-direction:column;gap:2px}",".tt_addMenuItem{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-primary);text-align:left;font:inherit;font-size:13px;padding:7px 10px;border-radius:8px;cursor:pointer;display:flex;flex-direction:column;gap:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".tt_addMenuItem:hover{background:var(--dsw-alias-interactive-bg-hover)}",".tt_addMenuSub{font-size:11px;color:var(--dsw-alias-label-tertiary)}",".tt_addMenuSep{height:1px;background:var(--dsw-alias-border-l1);margin:4px 2px}",".tt_addMenuTitle{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:4px 10px 2px}",".tt_sshBackdrop{position:fixed;inset:0;z-index:1400;background:var(--dsw-alias-bg-mask-1);display:flex;align-items:center;justify-content:center}",".tt_sshCard{width:min(430px,92vw);max-height:86vh;overflow-y:auto;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:14px;box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);padding:18px;display:flex;flex-direction:column;gap:10px}",".tt_sshTitle{margin:0;font-size:15px;font-weight:600}",".tt_sshRow{display:flex;flex-direction:column;gap:5px}",".tt_sshGrid{display:grid;grid-template-columns:1fr 110px;gap:10px}",".tt_sshActions{display:flex;gap:10px;justify-content:flex-end;margin-top:4px}",".tt_sshError{color:var(--dsw-alias-state-error-primary);font-size:12px;min-height:16px;line-height:1.4}",".tt_sshHostRow{display:flex;align-items:center;gap:8px;padding:6px 0;border-top:1px solid var(--dsw-alias-border-l1)}",".tt_sshHostMeta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}",".tt_sshHostName{font-size:13px;font-weight:500;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",".tt_sshHostTarget{font-size:12px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"].join(`
254
+ `),js="/api/dsh-tty/ws";function $s(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+js}function wi(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var nt;function yi(){document.getElementById("dsh-tty-style")||(nt=document.createElement("style"),nt.id="dsh-tty-style",nt.textContent=zs+`
255
+ `+vi,document.head.appendChild(nt))}var Ht='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',Ei=null,ie=null,X=null,Me=null,be=null,Le=null,Re=null,se=null,Te=null,It=!1,je=null,fe=!1,ee=null,at=null,Oe=null,Ce=null,lt=null,J=new Map,we=null,xi=0,ot=!1,de=null,Ae=null,Ie=[];function Se(a,l){if(Me===null)return;Me.textContent=a,be.dataset.state=l,Oe!==null&&(Oe.textContent=a),Ce!==null&&(Ce.dataset.state=l);let w=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");w!==null&&(w.dataset.state=l)}function ye(a){ie!==null&&ie.readyState===WebSocket.OPEN&&ie.send(JSON.stringify(a))}function De(){return we!==null?J.get(we):void 0}function qs(){try{let a=Ei?.list?.getSnapshot?.(),l=a?.byId?.[a?.current]?.cwd;return typeof l=="string"&&l!==""?l:void 0}catch{return}}function dt(a){if(a===void 0||a.fit===void 0)return;let l=a.fit.proposeDimensions();l!==void 0&&ye({t:"resize",sid:a.sid,cols:l.cols,rows:l.rows})}function ze(a,l){a.overlayEl===null||a.overlayEl===void 0||(a.overlayEl.textContent=l)}function ki(a){let l=new bi.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"SF Mono", Menlo, Consolas, "Courier New", monospace',scrollback:5e3,convertEol:!1,allowProposedApi:!0}),w=new Ci.FitAddon,y=new fi;l.loadAddon(w),l.loadAddon(y),l.loadAddon(new pi);let E=document.createElement("div");E.className="tt_term";let r=document.createElement("div");r.className="tt_overlay",r.addEventListener("click",()=>{r.textContent="",Ks(a.sid)}),E.appendChild(r),l.open(E);try{w.fit()}catch{}l.onData(n=>{ye({t:"input",sid:a.sid,d:n})}),l.attachCustomKeyEventHandler(n=>(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="f"?(n.preventDefault(),Ai(),!1):!0),a.term=l,a.fit=w,a.search=y,a.termEl=E,a.overlayEl=r}function ht(a,l){let w=wi(),y={sid:w,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:a??{t:"spawn",cwd:qs()},label:l};return ki(y),J.set(w,y),xi+=1,qe(),ut(w),Li(y),y}function Li(a){let l=a.fit!==null?a.fit.proposeDimensions():void 0;ye({...a.spawnSpec,sid:a.sid,cols:l!==void 0?l.cols:80,rows:l!==void 0?l.rows:24})}function Ks(a){let l=J.get(a);if(l===void 0)return;let w=l.spawnSpec,y=l.label;if(l.exited||ye({t:"kill",sid:a}),l.term!==null)try{l.term.dispose()}catch{}l.termEl!==null&&l.termEl.remove(),J.delete(a);let E={sid:wi(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:w,label:y};ki(E),J.set(E.sid,E),qe(),ut(E.sid),Li(E)}function Vs(a){let l=J.get(a);if(l!==void 0){if(l.exited||ye({t:"kill",sid:a}),J.delete(a),l.term!==null)try{l.term.dispose()}catch{}if(l.termEl!==null&&l.termEl.remove(),we===a){we=null;let w=[...J.keys()].pop()??null;w!==null&&ut(w)}qe(),J.size===0&&_t()}}function ut(a){let l=J.get(a);if(l!==void 0){we=a;for(let[w,y]of J)y.termEl!==null&&(y.termEl.style.display=w===a?"":"none");Re!==null&&l.termEl!==null&&l.termEl.parentElement!==Re&&Re.appendChild(l.termEl),qe();try{l.fit.fit()}catch{}l.spawned&&!l.exited&&dt(l),ze(l,l.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"")}}function qe(){if(Le===null)return;Le.textContent="";for(let[l,w]of J){let y=document.createElement("button");y.className="tt_tab",l===we&&(y.dataset.active="");let E=document.createElement("span");E.textContent=w.label||"\u7EC8\u7AEF "+Gs(l);let r=document.createElement("span");r.className="tt_tabClose",r.title="\u5173\u95ED",r.textContent="\u2715",y.title=E.textContent,y.appendChild(E),y.appendChild(r),y.addEventListener("click",n=>{if(n.target.closest(".tt_tabClose")!==null){n.stopPropagation(),Vs(l);return}ut(l)}),Le.appendChild(y)}let a=document.createElement("button");a.className="tt_tabAdd",a.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",a.textContent="+",a.addEventListener("click",()=>{Js(a)}),Le.appendChild(a)}function Gs(a){let l=1;for(let w of J.keys()){if(w===a)return String(l);l+=1}return String(l)}function ct(a){a!==null&&typeof a=="object"&&Array.isArray(a.sshHosts)&&(Ie=a.sshHosts)}function Di(a){let l=Number(a?.port),w=Number.isInteger(l)&&l!==22?":"+l:"",y=a?.auth==="key"?"key":a?.auth==="password"?"password":"agent";return String(a?.username??"")+"@"+String(a?.host??"")+w+" \xB7 "+y}async function Xs(){try{let l=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(l.ok&&typeof l.config=="object"&&l.config!==null){let w=Ie;ct(l.config),de!==null&&Ie!==w&&Ti(de)}}catch{}}function Ri(a){de!==null&&(a.target instanceof Element&&(de.contains(a.target)||a.target.closest(".tt_tabAdd")!==null)||me())}function Js(a){if(de!==null){me();return}Xs();let l=document.createElement("div");l.className="tt_addMenu",de=l,Ti(l),document.body.appendChild(l);let w=a.getBoundingClientRect();l.style.left=Math.max(8,Math.min(w.left,window.innerWidth-340))+"px",l.style.top=w.bottom+4+"px",document.addEventListener("mousedown",Ri,!0)}function me(){de!==null&&(document.removeEventListener("mousedown",Ri,!0),de.remove(),de=null)}function Ot(a,l,w,y){let E=document.createElement("button");E.type="button",E.className="tt_addMenuItem";let r=document.createElement("span");if(r.textContent=l,E.appendChild(r),w!==""){let n=document.createElement("span");n.className="tt_addMenuSub",n.textContent=w,E.appendChild(n)}E.addEventListener("click",y),a.appendChild(E)}function Ti(a){a.textContent="",Ot(a,"\u672C\u5730\u7EC8\u7AEF","\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",()=>{me(),ht()});let l=document.createElement("div");l.className="tt_addMenuSep",a.appendChild(l);let w=document.createElement("div");w.className="tt_addMenuTitle",w.textContent="SSH \u8FDE\u63A5\u7C3F",a.appendChild(w);for(let E of Ie)E===null||typeof E!="object"||typeof E.name!="string"||E.name===""||Ot(a,E.name,Di(E),()=>{me(),ht({t:"ssh",name:E.name},E.name)});if(Ie.length===0){let E=document.createElement("div");E.className="tt_addMenuTitle",E.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",a.appendChild(E)}let y=document.createElement("div");y.className="tt_addMenuSep",a.appendChild(y),Ot(a,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{me(),Ys()})}function Ys(){if(Ae!==null)return;let a=document.createElement("div");a.className="tt_sshBackdrop";let l=document.createElement("div");l.className="tt_sshCard";let w=document.createElement("div");w.className="tt_sshTitle",w.textContent="SSH \u8FDE\u63A5",l.appendChild(w);let y={},E=(c,g,p)=>{let m=document.createElement("label");m.className="tt_sshRow";let d=document.createElement("span");d.className="tt_cardLabel",d.textContent=g,m.appendChild(d);let b;if(p?.select!==void 0){b=document.createElement("select");for(let L of p.select){let T=document.createElement("option");T.value=L.value,T.textContent=L.label,b.appendChild(T)}}else b=document.createElement("input"),b.type=p?.type??"text",b.placeholder=p?.placeholder??"";return b.className="tt_cardInput",b.autocomplete="off",b.spellcheck=!1,m.appendChild(b),y[c]=b,m},r=document.createElement("div");r.className="tt_sshGrid",r.appendChild(E("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),r.appendChild(E("port","\u7AEF\u53E3",{placeholder:"22"})),l.appendChild(r),l.appendChild(E("username","\u7528\u6237\u540D",{placeholder:"root"})),l.appendChild(E("auth","\u8BA4\u8BC1\u65B9\u5F0F",{select:[{value:"agent",label:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"},{value:"key",label:"key \u2014 \u79C1\u94A5\u6587\u4EF6"},{value:"password",label:"password \u2014 \u5BC6\u7801"}]}));let n=E("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),h=E("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),f=E("password","\u5BC6\u7801",{type:"password"});l.appendChild(n),l.appendChild(h),l.appendChild(f);let o=document.createElement("label");o.className="tt_cardRow";let _=document.createElement("input");_.type="checkbox",_.className="tt_cardCheckbox";let v=document.createElement("span");v.className="tt_cardLabel",v.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",o.appendChild(_),o.appendChild(v),l.appendChild(o);let S=E("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});S.style.display="none",l.appendChild(S),_.addEventListener("change",()=>{S.style.display=_.checked?"":"none",_.checked&&y.name.value.trim()===""&&y.host.value.trim()!==""&&(y.name.value=y.host.value.trim()),_.checked&&y.name.focus()});let u=document.createElement("div");u.className="tt_sshError",l.appendChild(u);let t=document.createElement("div");t.className="tt_sshActions";let s=document.createElement("button");s.type="button",s.className="tt_toolBtn",s.textContent="\u53D6\u6D88";let e=document.createElement("button");e.type="button",e.className="tt_cardSave",e.textContent="\u8FDE\u63A5",t.appendChild(s),t.appendChild(e),l.appendChild(t);let i=()=>{n.style.display=y.auth.value==="key"?"":"none",h.style.display=y.auth.value==="key"?"":"none",f.style.display=y.auth.value==="password"?"":"none"};y.auth.addEventListener("change",i),i(),s.addEventListener("click",()=>Be()),a.addEventListener("mousedown",c=>{c.target===a&&Be()}),e.addEventListener("click",()=>{u.textContent="";let c=y.host.value.trim(),g=y.username.value.trim(),p=Number(y.port.value);if((!Number.isInteger(p)||p<1||p>65535)&&(p=22),c===""||g===""){u.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let m=y.auth.value,d={t:"ssh",host:c,port:p,username:g,auth:m};if(m==="key"){let B=y.keyPath.value.trim();B!==""&&(d.keyPath=B);let D=y.passphrase.value;D!==""&&(d.passphrase=D)}if(m==="password"){let B=y.password.value;B!==""&&(d.password=B)}let b=p!==22?g+"@"+c+":"+p:g+"@"+c,L=B=>{Be(),X!==null&&ht(d,B!==""?B:b)};if(!_.checked){L("");return}let T=y.name.value.trim()||c;e.disabled=!0,Zs({name:T,host:c,port:p,username:g,auth:m,keyPath:d.keyPath??"",passphrase:d.passphrase??"",password:d.password??""}).then(B=>{if(e.disabled=!1,B!==void 0){u.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+B;return}L(T)})}),a.appendChild(l),document.body.appendChild(a),Ae=a,y.host.focus()}function Be(){Ae!==null&&(Ae.remove(),Ae=null)}async function Zs(a){let l=[...Ie.filter(w=>w?.name!==a.name),a];try{let w=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:l})}),y=await w.json().catch(()=>({}));if(!w.ok||!y.ok)return String(y.error||"HTTP "+w.status);ct(y.config);return}catch(w){return String(w&&w.message?w.message:w)}}function Ai(){if(se===null)return;let a=se.style.display==="none"||se.style.display==="";se.style.display=a?"":"none",a&&se.focus()}var Qs={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function er(a){let l=De();if(l===void 0||l.search===void 0)return;let w=se.value;if(w==="")return;let y={decorations:Qs};a?l.search.findPrevious(w,y):l.search.findNext(w,y)}function gi(){if(ie!==null){try{ie.close()}catch{}ie=null}It=!1,ot=!0,Se("\u8FDE\u63A5\u4E2D\u2026","");try{ie=new WebSocket($s())}catch(a){ot=!1,Se("\u8FDE\u63A5\u5931\u8D25\uFF1A"+a.message,"error"),mi("\u70B9\u51FB\u91CD\u8BD5");return}ie.onopen=()=>{ot=!1,Se("\u5DF2\u8FDE\u63A5","connected"),J.size===0&&ht()},ie.onmessage=a=>{let l;try{l=JSON.parse(a.data)}catch{return}let w=l.sid;if(l.t==="ready"){let y=typeof l.target=="string"?l.target:"";Se(l.kind==="ssh"?"SSH "+(y!==""?y+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+l.pid,"connected");let E=J.get(w);E!==void 0&&(E.exited=!1,E.spawned=!0,l.kind==="ssh"&&y!==""&&!E.label&&(E.label=y,qe()),ze(E,""),dt(E),$e())}else if(l.t==="data"){let y=J.get(w);y!==void 0&&y.term!==null&&(y.term.write(String(l.d??"")),sr())}else if(l.t==="exit"){let y=J.get(w);if(y!==void 0){y.exited=!0;let E=l.code!==null&&l.code!==void 0?"code="+l.code:"",r=l.signal!==null&&l.signal!==void 0?"signal="+l.signal:"";Se("\u5DF2\u9000\u51FA "+[E,r].filter(Boolean).join(" "),""),ze(y,"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00"),$e()}}else if(l.t==="error")if(Se("\u9519\u8BEF\uFF1A"+String(l.m??""),"error"),typeof w=="string"){let y=J.get(w);y!==void 0&&ze(y,"\u9519\u8BEF\uFF1A"+String(l.m??"")+" \u2014 \u70B9\u51FB\u91CD\u8BD5")}else mi("\u70B9\u51FB\u91CD\u8BD5")},ie.onclose=()=>{if(ot=!1,!It){Se("\u8FDE\u63A5\u65AD\u5F00","error");for(let a of J.values())a.exited=!0,ze(a,"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u70B9\u51FB\u91CD\u65B0\u8FDE\u63A5")}},ie.onerror=()=>{}}function mi(a){Te!==null&&(Te.textContent=a)}function tr(){if(X!==null){fe&&Bi();return}yi(),X=document.createElement("div"),X.className="tt_modalBackdrop",X.innerHTML='<div class="tt_modal"><div class="tt_header"><div class="tt_title">'+Ht+'<span>\u7EC8\u7AEF</span></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><button class="tt_toolBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">\u641C\u7D22</button><button class="tt_toolBtn" data-act="clear" title="\u6E05\u5C4F">\u6E05\u5C4F</button><button class="tt_toolBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">\u590D\u5236</button><button class="tt_toolBtn" data-act="paste" title="\u7C98\u8D34">\u7C98\u8D34</button><button class="tt_min" title="\u6700\u5C0F\u5316\u5230\u60AC\u6D6E\u6761\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09">\u2014</button><button class="tt_close" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button></div><div class="tt_tabbar"></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(X),Me=X.querySelector(".tt_statusText"),be=X.querySelector(".tt_statusDot"),Le=X.querySelector(".tt_tabbar"),Re=X.querySelector(".tt_body"),Te=X.querySelector(".tt_body > .tt_overlay"),se=X.querySelector(".tt_searchInput"),Te.addEventListener("click",()=>{Te.textContent="",gi()}),X.querySelector("[data-act=search]").addEventListener("click",()=>{Ai(),se.style.display!=="none"&&se.focus()}),se.addEventListener("keydown",a=>{a.key==="Enter"?(a.preventDefault(),er(a.shiftKey)):a.key==="Escape"&&(a.stopPropagation(),se.style.display="none")}),X.querySelector("[data-act=clear]").addEventListener("click",()=>{let a=De();a!==void 0&&a.term!==null&&a.term.clear()}),X.querySelector("[data-act=copy]").addEventListener("click",()=>{let a=De();if(a===void 0||a.term===null)return;let l=a.term.getSelection();l!==""&&navigator.clipboard.writeText(l).catch(()=>{})}),X.querySelector("[data-act=paste]").addEventListener("click",()=>{let a=De();a!==void 0&&navigator.clipboard.readText().then(l=>{ye({t:"input",sid:a.sid,d:l})}).catch(()=>{})}),X.querySelector(".tt_min").addEventListener("click",()=>{Pt()}),X.querySelector(".tt_close").addEventListener("click",()=>{_t()}),X.addEventListener("mousedown",a=>{a.target===X&&Pt()}),document.addEventListener("keydown",Mi),je=new ResizeObserver(()=>{if(fe)return;let a=De();if(a!==void 0&&a.fit!==void 0){try{a.fit.fit()}catch{return}a.exited||dt(a)}}),je.observe(Re),gi()}function ir(){ee=document.createElement("div"),ee.className="tt_dock",ee.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",ee.innerHTML='<span class="tt_dockTitle">'+Ht+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button>',at=ee.querySelector(".tt_dockCount"),Oe=ee.querySelector(".tt_dockStatus"),Ce=ee.querySelector(".tt_dockDot");let a=[...J.values()].filter(l=>!l.exited).length;at.textContent=J.size>0?"\xB7 "+a+"/"+J.size:"",Me!==null&&(Oe.textContent=Me.textContent),be!==null&&(Ce.dataset.state=be.dataset.state??""),ee.addEventListener("click",l=>{if(l.target.closest(".tt_dockClose")!==null){l.stopPropagation(),_t();return}Bi()}),document.body.appendChild(ee)}function Pt(){X===null||fe||(me(),Be(),fe=!0,se!==null&&(se.style.display="none"),X.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?$e():(ir(),ee.classList.add("tt_dockCompact")))}function $e(){let a=document.querySelector("[data-dsh-tty-entry]");if(a===null)return;let l=a.querySelector(".tt_sidebarEntryBadge");if(!fe){l!==null&&l.remove(),delete a.dataset.minimized,a.removeAttribute("title");return}l===null&&(l=document.createElement("span"),l.className="tt_sidebarEntryBadge",l.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',a.appendChild(l)),a.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let w=[...J.values()].filter(E=>!E.exited).length;l.querySelector(".tt_sidebarBadgeCount").textContent=w+"/"+J.size;let y=l.querySelector(".tt_sidebarBadgeDot");y!==null&&be!==null&&(y.dataset.state=be.dataset.state??"")}function sr(){if(!fe)return;let a=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Ce;a!==null&&(a.dataset.active="",clearTimeout(lt),lt=setTimeout(()=>{delete a.dataset.active},900))}function Bi(){if(X===null||!fe)return;fe=!1,delete X.dataset.minimized,clearTimeout(lt),ee!==null&&(ee.remove(),ee=null),at=null,Oe=null,Ce=null,$e();let a=De();if(a!==void 0&&a.fit!==void 0){try{a.fit.fit()}catch{}a.spawned&&!a.exited&&dt(a)}a!==void 0&&a.term!==null&&a.term.focus()}function _t(){if(X!==null){if(It=!0,fe=!1,me(),Be(),clearTimeout(lt),ee!==null&&(ee.remove(),ee=null),at=null,Oe=null,Ce=null,$e(),ie!==null){for(let a of J.values())a.exited||ye({t:"kill",sid:a.sid});try{ie.close()}catch{}ie=null}je!==null&&(je.disconnect(),je=null);for(let a of J.values())if(a.term!==null)try{a.term.dispose()}catch{}J.clear(),we=null,document.removeEventListener("keydown",Mi),X.remove(),X=null,Me=null,be=null,Le=null,Re=null,Te=null,se=null,xi=0}}function Mi(a){if(a.key==="Escape"&&X!==null){if(a.preventDefault(),Ae!==null){Be();return}if(de!==null){me();return}Pt()}}function rr(){let a=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(a!==null)return a.querySelector('[class*="logoRow"]')?.parentElement??a.firstElementChild}function nr(a){let l=a.querySelector('button[class*="newSession"]');if(l!==null)return l;for(let w of a.children)if(w.tagName==="BUTTON")return w}function or(){let a=document.createElement("div");return a.dataset.dshTtyEntry="",a.className="tt_sidebarEntry",a.setAttribute("role","button"),a.setAttribute("aria-label","\u7EC8\u7AEF"),a.innerHTML='<span class="tt_sidebarEntryIcon">'+Ht+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',a.addEventListener("click",l=>{l.preventDefault(),tr()}),a}function Si(a,l){let w=nr(a);if(w===void 0)return!1;if(l.parentElement!==a){let y=w.closest('[class*="logoRow"]'),E=y!==null&&y.parentElement===a?y:w,r=Array.from(a.children).filter(n=>n instanceof HTMLElement&&n.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(r.length>0){let n=r[r.length-1];a.insertBefore(l,n.nextSibling)}else a.insertBefore(l,E.nextElementSibling)}return!0}function ar(){if(yi(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let a=or(),l,w=!1,y=()=>{if(l!==void 0&&!l.isConnected&&(r.disconnect(),l=void 0,w=!1),w){if(document.body.contains(a))return;r.disconnect(),l=void 0,w=!1}l??(l=rr()),l!==void 0&&(w=Si(l,a),w&&r.observe(l,{childList:!0,subtree:!0}))},E=new MutationObserver(()=>{y()});E.observe(document.body,{childList:!0,subtree:!0});let r=new MutationObserver(()=>{if(l===void 0||!l.isConnected){w=!1,y();return}l.contains(a)||(w=Si(l,a))});return y(),()=>{E.disconnect(),r.disconnect(),a.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:a=>{let l={},w=a("react"),{jsx:y,jsxs:E}=a("react/jsx-runtime"),r="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function n(){let[h,f]=w.useState(!1),[o,_]=w.useState(null),[v,S]=w.useState(!1),[u,t]=w.useState(!1),[s,e]=w.useState({kind:"",text:""}),i=async()=>{try{let L=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();L.ok&&typeof L.config=="object"&&L.config!==null?(_(L.config),ct(L.config)):e({kind:"error",text:String(L.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(b){e({kind:"error",text:String(b&&b.message?b.message:b)})}};w.useEffect(()=>{h&&!v&&(S(!0),i())},[h]);let c=(b,L)=>_(T=>({...T||{},[b]:L})),g=b=>_(L=>({...L||{},sshHosts:(Array.isArray(L?.sshHosts)?L.sshHosts:[]).filter(T=>T?.name!==b)})),p=async()=>{t(!0),e({kind:"",text:""});let b={};for(let L of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd"]){let T=(o||{})[L];T!==void 0&&T!==""&&(b[L]=T)}b.sshHosts=Array.isArray(o?.sshHosts)?o.sshHosts:[];try{let L=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)}),T=await L.json();!L.ok||!T.ok?e({kind:"error",text:String(T.error||"\u4FDD\u5B58\u5931\u8D25")}):(e({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),T.config&&(_(T.config),ct(T.config)))}catch(L){e({kind:"error",text:String(L&&L.message?L.message:L)})}t(!1)},m=(b,L,T,B)=>E("label",{className:"tt_cardField",children:[y("span",{className:"tt_cardLabel",children:b}),y("input",{className:"tt_cardInput",value:o[L]??"",placeholder:T??"",onChange:D=>c(L,D.target.value)}),B?y("span",{className:"tt_cardHint",children:B}):null]}),d=(b,L)=>E("label",{className:"tt_cardField tt_cardRow",children:[y("input",{type:"checkbox",className:"tt_cardCheckbox",checked:o[L]===!0,onChange:T=>c(L,T.target.checked)}),y("span",{className:"tt_cardLabel",children:b})]});return E("li",{className:h?"tt_card tt_cardOpen":"tt_card",children:[E("button",{type:"button",className:"tt_cardHeader","aria-expanded":h,onClick:()=>f(b=>!b),children:[E("span",{className:"tt_cardHeadText",children:[y("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),y("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\u3001SSH \u8FDE\u63A5\u7C3F\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),y("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:h?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:y("path",{d:r,fill:"currentColor"})})]}),h?E("div",{className:"tt_cardBody",children:[o===null?y("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):E("div",{children:[d("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),d("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),m("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),m("Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","shell","","\u7559\u7A7A\u4F7F\u7528 $SHELL"),m("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),m("COLORTERM","colorTerm","truecolor",""),m("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),E("div",{className:"tt_cardField",children:[y("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(o.sshHosts)&&o.sshHosts.length>0?[y("div",{children:o.sshHosts.map(b=>E("div",{className:"tt_sshHostRow",children:[y("div",{className:"tt_sshHostMeta",children:[y("span",{className:"tt_sshHostName",children:b?.name??""}),y("span",{className:"tt_sshHostTarget",children:Di(b??{})})]}),y("button",{type:"button",className:"tt_toolBtn",onClick:()=>g(b?.name),children:"\u5220\u9664"})]},String(b?.name??"")))})]:[y("span",{className:"tt_cardHint",children:"\u6682\u65E0\u6761\u76EE \u2014 \u7EC8\u7AEF\u9762\u677F\u300C+\u300D\u2192 SSH \u8FDE\u63A5\u2026 \u52FE\u9009\u300C\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\u300D\u5373\u53EF\u6DFB\u52A0"})],y("span",{className:"tt_cardHint",children:"\u968F\u300C\u4FDD\u5B58\u300D\u4E00\u5E76\u5199\u5165\u914D\u7F6E\uFF1B\u5BC6\u7801/\u53E3\u4EE4\u652F\u6301 env:VAR \u5F15\u7528\uFF0C\u907F\u514D\u660E\u6587\u5165\u5E93"})]}),E("div",{className:"tt_cardField tt_cardRow",children:[y("button",{className:"tt_cardSave",disabled:u,onClick:()=>void p(),children:u?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),y("span",{className:"tt_cardMessage"+(s.kind==="ok"?" tt_cardMessageOk":s.kind==="error"?" tt_cardMessageError":""),children:s.text})]})]})]}):null]})}return l.inject=["slots","sessions"],l.apply=h=>(Ei=h.sessions,ar(),h.slots.inject("settings.plugin.item",()=>h.slots.register({name:"settings.plugin.item",key:"tty",order:110},n)),()=>{_t()}),l}});})();
256
256
  /*! Bundled license information:
257
257
 
258
258
  @xterm/addon-search/lib/addon-search.mjs: