-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchunk-FQ53TWPT.js
12 lines (11 loc) · 309 KB
/
chunk-FQ53TWPT.js
1
2
3
4
5
6
7
8
9
10
11
12
import{a as lt,b as dt}from"./chunk-AMKYUFTK.js";import{a as _t,b as ut}from"./chunk-KFOOQGOY.js";import{F as ct,l as ot,n as at,u as ht,w as ke}from"./chunk-LRGM5MED.js";import{E as rt,Ea as nt,a as he,aa as te,d as it,e as Pe,ga as ie,hb as Y,k as ye,l as Ee,u as st}from"./chunk-DXS2GHCC.js";var Ze=it((Ae,Je)=>{"use strict";(function(L,T){if(typeof Ae=="object"&&typeof Je=="object")Je.exports=T();else if(typeof define=="function"&&define.amd)define([],T);else{var P=T();for(var E in P)(typeof Ae=="object"?Ae:L)[E]=P[E]}})(globalThis,()=>(()=>{"use strict";var L={4567:function(y,r,n){var h=this&&this.__decorate||function(e,t,a,p){var f,g=arguments.length,l=g<3?t:p===null?p=Object.getOwnPropertyDescriptor(t,a):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,a,p);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(g<3?f(l):g>3?f(t,a,l):f(t,a))||l);return g>3&&l&&Object.defineProperty(t,a,l),l},_=this&&this.__param||function(e,t){return function(a,p){t(a,p,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let o=n(9042),d=n(9924),u=n(844),v=n(4725),c=n(2585),i=n(3656),s=r.AccessibilityManager=class extends u.Disposable{constructor(e,t,a,p){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=p,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let f=0;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);if(this._topBoundaryFocusListener=f=>this._handleBoundaryFocus(f,0),this._bottomBoundaryFocusListener=f=>this._handleBoundaryFocus(f,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(f=>this._handleResize(f.rows))),this.register(this._terminal.onRender(f=>this._refreshRows(f.start,f.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(f=>this._handleChar(f))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
`))),this.register(this._terminal.onA11yTab(f=>this._handleTab(f))),this.register(this._terminal.onKey(f=>this._handleKey(f.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,u.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let a=this._terminal.buffer,p=a.lines.length.toString();for(let f=e;f<=t;f++){let g=a.lines.get(a.ydisp+f),l=[],m=g?.translateToString(!0,void 0,void 0,l)||"",R=(a.ydisp+f+1).toString(),D=this._rowElements[f];D&&(m.length===0?(D.innerText="\xA0",this._rowColumns.set(D,[0,1])):(D.textContent=m,this._rowColumns.set(D,l)),D.setAttribute("aria-posinset",R),D.setAttribute("aria-setsize",p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let a=e.target,p=this._rowElements[t===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==p)return;let f,g;if(t===0?(f=a,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(f=this._rowElements.shift(),g=a,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},a={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(a.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===a.node&&t.offset>a.offset)&&([t,a]=[a,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let p=this._rowElements.slice(-1)[0];if(a.node.compareDocumentPosition(p)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(a={node:p,offset:p.textContent?.length??0}),!this._rowContainer.contains(a.node))return;let f=({node:m,offset:R})=>{let D=m instanceof Text?m.parentNode:m,x=parseInt(D?.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(D);if(!b)return console.warn("columns is null. Race condition?"),null;let O=R<b.length?b[R]:b.slice(-1)[0]+1;return O>=this._terminal.cols&&(++x,O=0),{row:x,column:O}},g=f(t),l=f(a);if(g&&l){if(g.row>l.row||g.row===l.row&&g.column>=l.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(l.row-g.row)*this._terminal.cols-g.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=s=h([_(1,c.IInstantiationService),_(2,v.ICoreBrowserService),_(3,v.IRenderService)],s)},3614:(y,r)=>{function n(d){return d.replace(/\r?\n/g,"\r")}function h(d,u){return u?"\x1B[200~"+d+"\x1B[201~":d}function _(d,u,v,c){d=h(d=n(d),v.decPrivateModes.bracketedPasteMode&&c.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(d,!0),u.value=""}function o(d,u,v){let c=v.getBoundingClientRect(),i=d.clientX-c.left-10,s=d.clientY-c.top-10;u.style.width="20px",u.style.height="20px",u.style.left=`${i}px`,u.style.top=`${s}px`,u.style.zIndex="1000",u.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=n,r.bracketTextForPaste=h,r.copyHandler=function(d,u){d.clipboardData&&d.clipboardData.setData("text/plain",u.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,u,v,c){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),u,v,c)},r.paste=_,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(d,u,v,c,i){o(d,u,v),i&&c.rightClickSelect(d),u.value=c.selectionText,u.select()}},7239:(y,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,d){this._css.set(_,o,d)}getCss(_,o){return this._css.get(_,o)}setColor(_,o,d){this._color.set(_,o,d)}getColor(_,o){return this._color.get(_,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(y,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(n,h,_,o){n.addEventListener(h,_,o);let d=!1;return{dispose:()=>{d||(d=!0,n.removeEventListener(h,_,o))}}}},3551:function(y,r,n){var h=this&&this.__decorate||function(s,e,t,a){var p,f=arguments.length,g=f<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,a);else for(var l=s.length-1;l>=0;l--)(p=s[l])&&(g=(f<3?p(g):f>3?p(e,t,g):p(e,t))||g);return f>3&&g&&Object.defineProperty(e,t,g),g},_=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let o=n(3656),d=n(8460),u=n(844),v=n(2585),c=n(4725),i=r.Linkifier=class extends u.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,a,p){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=a,this._linkProviderService=p,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,u.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,u.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let t=s.composedPath();for(let a=0;a<t.length;a++){let p=t[a];if(p.classList.contains("xterm"))break;if(p.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(a=>{a?.forEach(p=>{p.link.dispose&&p.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let t=!1;for(let[a,p]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(a)&&(t=this._checkLinkProviderResult(a,s,t)):p.provideLinks(s.y,f=>{if(this._isMouseOut)return;let g=f?.map(l=>({link:l}));this._activeProviderReplies?.set(a,g),t=this._checkLinkProviderResult(a,s,t),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,e){let t=new Set;for(let a=0;a<e.size;a++){let p=e.get(a);if(p)for(let f=0;f<p.length;f++){let g=p[f],l=g.link.range.start.y<s?0:g.link.range.start.x,m=g.link.range.end.y>s?this._bufferService.cols:g.link.range.end.x;for(let R=l;R<=m;R++){if(t.has(R)){p.splice(f--,1);break}t.add(R)}}}}_checkLinkProviderResult(s,e,t){if(!this._activeProviderReplies)return t;let a=this._activeProviderReplies.get(s),p=!1;for(let f=0;f<s;f++)this._activeProviderReplies.has(f)&&!this._activeProviderReplies.get(f)||(p=!0);if(!p&&a){let f=a.find(g=>this._linkAtPosition(g.link,e));f&&(t=!0,this._handleNewLink(f))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let f=0;f<this._activeProviderReplies.size;f++){let g=this._activeProviderReplies.get(f)?.find(l=>this._linkAtPosition(l.link,e));if(g){t=!0,this._handleNewLink(g);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,u.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:t=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;let a=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,p=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=p&&(this._clearCurrentLink(a,p),this._lastMouseEvent)){let f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._askForLink(f,!1)}})))}_linkHover(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){let t=s.range,a=this._bufferService.buffer.ydisp,p=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-a-1,t.end.x,t.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(p)}_linkLeave(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){let t=s.range.start.y*this._bufferService.cols+s.range.start.x,a=s.range.end.y*this._bufferService.cols+s.range.end.x,p=e.y*this._bufferService.cols+e.x;return t<=p&&p<=a}_positionFromMouseEvent(s,e,t){let a=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,a,p){return{x1:s,y1:e,x2:t,y2:a,cols:this._bufferService.cols,fg:p}}};r.Linkifier=i=h([_(1,c.IMouseService),_(2,c.IRenderService),_(3,v.IBufferService),_(4,c.ILinkProviderService)],i)},9042:(y,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(y,r,n){var h=this&&this.__decorate||function(c,i,s,e){var t,a=arguments.length,p=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(c,i,s,e);else for(var f=c.length-1;f>=0;f--)(t=c[f])&&(p=(a<3?t(p):a>3?t(i,s,p):t(i,s))||p);return a>3&&p&&Object.defineProperty(i,s,p),p},_=this&&this.__param||function(c,i){return function(s,e){i(s,e,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let o=n(511),d=n(2585),u=r.OscLinkProvider=class{constructor(c,i,s){this._bufferService=c,this._optionsService=i,this._oscLinkService=s}provideLinks(c,i){let s=this._bufferService.buffer.lines.get(c-1);if(!s)return void i(void 0);let e=[],t=this._optionsService.rawOptions.linkHandler,a=new o.CellData,p=s.getTrimmedLength(),f=-1,g=-1,l=!1;for(let m=0;m<p;m++)if(g!==-1||s.hasContent(m)){if(s.loadCell(m,a),a.hasExtendedAttrs()&&a.extended.urlId){if(g===-1){g=m,f=a.extended.urlId;continue}l=a.extended.urlId!==f}else g!==-1&&(l=!0);if(l||g!==-1&&m===p-1){let R=this._oscLinkService.getLinkData(f)?.uri;if(R){let D={start:{x:g+1,y:c},end:{x:m+(l||m!==p-1?0:1),y:c}},x=!1;if(!t?.allowNonHttpProtocols)try{let b=new URL(R);["http:","https:"].includes(b.protocol)||(x=!0)}catch{x=!0}x||e.push({text:R,range:D,activate:(b,O)=>t?t.activate(b,O,D):v(0,O),hover:(b,O)=>t?.hover?.(b,O,D),leave:(b,O)=>t?.leave?.(b,O,D)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(g=m,f=a.extended.urlId):(g=-1,f=-1)}}i(e)}};function v(c,i){if(confirm(`Do you want to navigate to ${i}?
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=u=h([_(0,d.IBufferService),_(1,d.IOptionsService),_(2,d.IOscLinkService)],u)},6193:(y,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:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let h=n(3614),_=n(3656),o=n(3551),d=n(9042),u=n(3730),v=n(1680),c=n(3107),i=n(5744),s=n(2950),e=n(1296),t=n(428),a=n(4269),p=n(5114),f=n(8934),g=n(3230),l=n(9312),m=n(4725),R=n(6731),D=n(8055),x=n(8969),b=n(8460),O=n(844),H=n(6114),N=n(8437),z=n(2584),W=n(7399),S=n(5941),w=n(9074),k=n(2585),A=n(5435),I=n(4567),U=n(779);class K extends x.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(B={}){super(B),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new O.MutableDisposable),this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new b.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new b.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new b.EventEmitter),this._onBlur=this.register(new b.EventEmitter),this._onA11yCharEmitter=this.register(new b.EventEmitter),this._onA11yTabEmitter=this.register(new b.EventEmitter),this._onWillOpen=this.register(new b.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(w.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(U.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(u.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((C,M)=>this.refresh(C,M))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(C=>this._reportWindowsOptions(C))),this.register(this._inputHandler.onColor(C=>this._handleColorEvent(C))),this.register((0,b.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,b.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(C=>this._afterResize(C.cols,C.rows))),this.register((0,O.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(B){if(this._themeService)for(let C of B){let M,F="";switch(C.index){case 256:M="foreground",F="10";break;case 257:M="background",F="11";break;case 258:M="cursor",F="12";break;default:M="ansi",F="4;"+C.index}switch(C.type){case 0:let $=D.color.toColorRGB(M==="ansi"?this._themeService.colors.ansi[C.index]:this._themeService.colors[M]);this.coreService.triggerDataEvent(`${z.C0.ESC}]${F};${(0,S.toRgbString)($)}${z.C1_ESCAPED.ST}`);break;case 1:if(M==="ansi")this._themeService.modifyColors(j=>j.ansi[C.index]=D.channels.toColor(...C.color));else{let j=M;this._themeService.modifyColors(G=>G[j]=D.channels.toColor(...C.color))}break;case 2:this._themeService.restoreColor(C.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(B){B?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(I.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(B){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let B=this.buffer.ybase+this.buffer.y,C=this.buffer.lines.get(B);if(!C)return;let M=Math.min(this.buffer.x,this.cols-1),F=this._renderService.dimensions.css.cell.height,$=C.getWidth(M),j=this._renderService.dimensions.css.cell.width*$,G=this.buffer.y*this._renderService.dimensions.css.cell.height,J=M*this._renderService.dimensions.css.cell.width;this.textarea.style.left=J+"px",this.textarea.style.top=G+"px",this.textarea.style.width=j+"px",this.textarea.style.height=F+"px",this.textarea.style.lineHeight=F+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",C=>{this.hasSelection()&&(0,h.copyHandler)(C,this._selectionService)}));let B=C=>(0,h.handlePasteEvent)(C,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",B)),this.register((0,_.addDisposableDomListener)(this.element,"paste",B)),H.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",C=>{C.button===2&&(0,h.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",C=>{(0,h.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),H.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",C=>{C.button===1&&(0,h.moveTextAreaUnderMouseCursor)(C,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",B=>this._keyUp(B),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",B=>this._keyDown(B),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",B=>this._keyPress(B),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",B=>this._compositionHelper.compositionupdate(B))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,_.addDisposableDomListener)(this.textarea,"input",B=>this._inputEvent(B),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(B){if(!B)throw new Error("Terminal requires a parent element.");if(B.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=B.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"),B.appendChild(this.element);let C=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),C.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,_.addDisposableDomListener)(this.screenElement,"mousemove",M=>this.updateCursorStyle(M))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),C.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(p.CoreBrowserService,this.textarea,B.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",M=>this._handleTextAreaFocus(M))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(t.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(a.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(M=>this._onRender.fire(M))),this.onResize(M=>this._renderService.resize(M.cols,M.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(f.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.Linkifier,this.screenElement)),this.element.appendChild(C);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(v.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(M=>this.scrollLines(M.amount,M.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(l.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(M=>this.scrollLines(M.amount,M.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(M=>this._renderService.handleSelectionChanged(M.start,M.end,M.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(M=>{this.textarea.value=M,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(M=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",M=>this._selectionService.handleMouseDown(M))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(I.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",M=>this._handleScreenReaderModeOptionChange(M))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",M=>{!this._overviewRulerRenderer&&M&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let B=this,C=this.element;function M(j){let G=B._mouseService.getMouseReportCoords(j,B.screenElement);if(!G)return!1;let J,Z;switch(j.overrideType||j.type){case"mousemove":Z=32,j.buttons===void 0?(J=3,j.button!==void 0&&(J=j.button<3?j.button:3)):J=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":Z=0,J=j.button<3?j.button:3;break;case"mousedown":Z=1,J=j.button<3?j.button:3;break;case"wheel":if(B._customWheelEventHandler&&B._customWheelEventHandler(j)===!1||B.viewport.getLinesScrolled(j)===0)return!1;Z=j.deltaY<0?0:1,J=4;break;default:return!1}return!(Z===void 0||J===void 0||J>4)&&B.coreMouseService.triggerMouseEvent({col:G.col,row:G.row,x:G.x,y:G.y,button:J,action:Z,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let F={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:j=>(M(j),j.buttons||(this._document.removeEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.removeEventListener("mousemove",F.mousedrag)),this.cancel(j)),wheel:j=>(M(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&M(j)},mousemove:j=>{j.buttons||M(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?F.mousemove||(C.addEventListener("mousemove",$.mousemove),F.mousemove=$.mousemove):(C.removeEventListener("mousemove",F.mousemove),F.mousemove=null),16&j?F.wheel||(C.addEventListener("wheel",$.wheel,{passive:!1}),F.wheel=$.wheel):(C.removeEventListener("wheel",F.wheel),F.wheel=null),2&j?F.mouseup||(F.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",F.mouseup),F.mouseup=null),4&j?F.mousedrag||(F.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",F.mousedrag),F.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(C,"mousedown",j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return M(j),F.mouseup&&this._document.addEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.addEventListener("mousemove",F.mousedrag),this.cancel(j)})),this.register((0,_.addDisposableDomListener)(C,"wheel",j=>{if(!F.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 J=z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),Z="";for(let ee=0;ee<Math.abs(G);ee++)Z+=J;return this.coreService.triggerDataEvent(Z,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}},{passive:!1})),this.register((0,_.addDisposableDomListener)(C,"touchstart",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)},{passive:!0})),this.register((0,_.addDisposableDomListener)(C,"touchmove",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)},{passive:!1}))}refresh(B,C){this._renderService?.refreshRows(B,C)}updateCursorStyle(B){this._selectionService?.shouldColumnSelect(B)?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(B,C,M=0){M===1?(super.scrollLines(B,C,M),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(B)}paste(B){(0,h.paste)(B,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(B){this._customKeyEventHandler=B}attachCustomWheelEventHandler(B){this._customWheelEventHandler=B}registerLinkProvider(B){return this._linkProviderService.registerLinkProvider(B)}registerCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let C=this._characterJoinerService.register(B);return this.refresh(0,this.rows-1),C}deregisterCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(B)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(B){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+B)}registerDecoration(B){return this._decorationService.registerDecoration(B)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(B,C,M){this._selectionService.setSelection(B,C,M)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(B,C){this._selectionService?.selectLines(B,C)}_keyDown(B){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;let C=this.browser.isMac&&this.options.macOptionIsMeta&&B.altKey;if(!C&&!this._compositionHelper.keydown(B))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;C||B.key!=="Dead"&&B.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let M=(0,W.evaluateKeyboardEvent)(B,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(B),M.type===3||M.type===2){let F=this.rows-1;return this.scrollLines(M.type===2?-F:F),this.cancel(B,!0)}return M.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,B)||(M.cancel&&this.cancel(B,!0),!M.key||!!(B.key&&!B.ctrlKey&&!B.altKey&&!B.metaKey&&B.key.length===1&&B.key.charCodeAt(0)>=65&&B.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(M.key!==z.C0.ETX&&M.key!==z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:M.key,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(M.key,!0),!this.optionsService.rawOptions.screenReaderMode||B.altKey||B.ctrlKey?this.cancel(B,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(B,C){let M=B.isMac&&!this.options.macOptionIsMeta&&C.altKey&&!C.ctrlKey&&!C.metaKey||B.isWindows&&C.altKey&&C.ctrlKey&&!C.metaKey||B.isWindows&&C.getModifierState("AltGraph");return C.type==="keypress"?M:M&&(!C.keyCode||C.keyCode>47)}_keyUp(B){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1||(function(C){return C.keyCode===16||C.keyCode===17||C.keyCode===18}(B)||this.focus(),this.updateCursorStyle(B),this._keyPressHandled=!1)}_keyPress(B){let C;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;if(this.cancel(B),B.charCode)C=B.charCode;else if(B.which===null||B.which===void 0)C=B.keyCode;else{if(B.which===0||B.charCode===0)return!1;C=B.which}return!(!C||(B.altKey||B.ctrlKey||B.metaKey)&&!this._isThirdLevelShift(this.browser,B)||(C=String.fromCharCode(C),this._onKey.fire({key:C,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(C,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(B){if(B.data&&B.inputType==="insertText"&&(!B.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let C=B.data;return this.coreService.triggerDataEvent(C,!0),this.cancel(B),!0}return!1}resize(B,C){B!==this.cols||C!==this.rows?super.resize(B,C):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(B,C){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let B=1;B<this.rows;B++)this.buffer.lines.push(this.buffer.getBlankLine(N.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let B=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=B,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(z.C0.ESC+"[I"):this.coreService.triggerDataEvent(z.C0.ESC+"[O")}_reportWindowsOptions(B){if(this._renderService)switch(B){case A.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let C=this._renderService.dimensions.css.canvas.width.toFixed(0),M=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[4;${M};${C}t`);break;case A.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let F=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[6;${$};${F}t`)}}cancel(B,C){if(this.options.cancelEvents||C)return B.preventDefault(),B.stopPropagation(),!1}}r.Terminal=K},9924:(y,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 d=o-this._lastRefreshMs,u=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},u)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;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(y,r,n){var h=this&&this.__decorate||function(s,e,t,a){var p,f=arguments.length,g=f<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,a);else for(var l=s.length-1;l>=0;l--)(p=s[l])&&(g=(f<3?p(g):f>3?p(e,t,g):p(e,t))||g);return f>3&&g&&Object.defineProperty(e,t,g),g},_=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let o=n(3656),d=n(4725),u=n(8460),v=n(844),c=n(2585),i=r.Viewport=class extends v.Disposable{constructor(s,e,t,a,p,f,g,l){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=t,this._optionsService=a,this._charSizeService=p,this._renderService=f,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(m=>this._renderDimensions=m)),this._handleThemeChange(l.colors),this.register(l.onChangeColors(m=>this._handleThemeChange(m))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,e){let t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&t<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){let e=this._getPixelsScrolled(s);return e!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(s,e){let t,a="",p=[],f=e??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let l=s;l<f;l++){let m=g.get(l);if(!m)continue;let R=g.get(l+1)?.isWrapped;if(a+=m.translateToString(!R),!R||l===g.length-1){let D=document.createElement("div");D.textContent=a,p.push(D),a.length>0&&(t=D),a=""}}return{bufferElements:p,cursorElement:t}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){let t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&e.altKey||t==="ctrl"&&e.ctrlKey||t==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){let e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};r.Viewport=i=h([_(2,c.IBufferService),_(3,c.IOptionsService),_(4,d.ICharSizeService),_(5,d.IRenderService),_(6,d.ICoreBrowserService),_(7,d.IThemeService)],i)},3107:function(y,r,n){var h=this&&this.__decorate||function(c,i,s,e){var t,a=arguments.length,p=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(c,i,s,e);else for(var f=c.length-1;f>=0;f--)(t=c[f])&&(p=(a<3?t(p):a>3?t(i,s,p):t(i,s))||p);return a>3&&p&&Object.defineProperty(i,s,p),p},_=this&&this.__param||function(c,i){return function(s,e){i(s,e,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let o=n(4725),d=n(844),u=n(2585),v=r.BufferDecorationRenderer=class extends d.Disposable{constructor(c,i,s,e,t){super(),this._screenElement=c,this._bufferService=i,this._coreBrowserService=s,this._decorationService=e,this._renderService=t,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this.register((0,d.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let c of this._decorationService.decorations)this._renderDecoration(c);this._dimensionsChanged=!1}_renderDecoration(c){this._refreshStyle(c),this._dimensionsChanged&&this._refreshXPosition(c)}_createElement(c){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",c?.options?.layer==="top"),i.style.width=`${Math.round((c.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(c.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(c.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=c.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(c,i),i}_refreshStyle(c){let i=c.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)c.element&&(c.element.style.display="none",c.onRenderEmitter.fire(c.element));else{let s=this._decorationElements.get(c);s||(s=this._createElement(c),c.element=s,this._decorationElements.set(c,s),this._container.appendChild(s),c.onDispose(()=>{this._decorationElements.delete(c),s.remove()})),s.style.top=i*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",c.onRenderEmitter.fire(s)}}_refreshXPosition(c,i=c.element){if(!i)return;let s=c.options.x??0;(c.options.anchor||"left")==="right"?i.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(c){this._decorationElements.get(c)?.remove(),this._decorationElements.delete(c),c.dispose()}};r.BufferDecorationRenderer=v=h([_(1,u.IBufferService),_(2,o.ICoreBrowserService),_(3,u.IDecorationService),_(4,o.IRenderService)],v)},5871:(y,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(y,r,n){var h=this&&this.__decorate||function(t,a,p,f){var g,l=arguments.length,m=l<3?a:f===null?f=Object.getOwnPropertyDescriptor(a,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(t,a,p,f);else for(var R=t.length-1;R>=0;R--)(g=t[R])&&(m=(l<3?g(m):l>3?g(a,p,m):g(a,p))||m);return l>3&&m&&Object.defineProperty(a,p,m),m},_=this&&this.__param||function(t,a){return function(p,f){a(p,f,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let o=n(5871),d=n(4725),u=n(844),v=n(2585),c={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=r.OverviewRulerRenderer=class extends u.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(t,a,p,f,g,l,m){super(),this._viewportElement=t,this._screenElement=a,this._bufferService=p,this._decorationService=f,this._renderService=g,this._optionsService=l,this._coreBrowserService=m,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let 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,u.toDisposable)(()=>{this._canvas?.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){let t=Math.floor(this._canvas.width/3),a=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=t,i.center=a,i.right=t,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=i.left,s.right=i.left+i.center}_refreshDrawHeightConstants(){c.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,a=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);c.left=a,c.center=a,c.right=a}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let a of this._decorationService.decorations)this._colorZoneStore.addDecoration(a);this._ctx.lineWidth=1;let t=this._colorZoneStore.zones;for(let a of t)a.position!=="full"&&this._renderColorZone(a);for(let a of t)a.position==="full"&&this._renderColorZone(a);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(s[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-c[t.position||"full"]/2),i[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+c[t.position||"full"]))}_queueRefresh(t,a){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=a||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};r.OverviewRulerRenderer=e=h([_(2,v.IBufferService),_(3,v.IDecorationService),_(4,d.IRenderService),_(5,v.IOptionsService),_(6,d.ICoreBrowserService)],e)},2950:function(y,r,n){var h=this&&this.__decorate||function(c,i,s,e){var t,a=arguments.length,p=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(c,i,s,e);else for(var f=c.length-1;f>=0;f--)(t=c[f])&&(p=(a<3?t(p):a>3?t(i,s,p):t(i,s))||p);return a>3&&p&&Object.defineProperty(i,s,p),p},_=this&&this.__param||function(c,i){return function(s,e){i(s,e,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let o=n(4725),d=n(2585),u=n(2584),v=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(c,i,s,e,t,a){this._textarea=c,this._compositionView=i,this._bufferService=s,this._optionsService=e,this._coreService=t,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(c){this._compositionView.textContent=c.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(c){if(this._isComposing||this._isSendingComposition){if(c.keyCode===229||c.keyCode===16||c.keyCode===17||c.keyCode===18)return!1;this._finalizeComposition(!1)}return c.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(c){if(this._compositionView.classList.remove("active"),this._isComposing=!1,c){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let c=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(c,"");this._dataAlreadySent=s,i.length>c.length?this._coreService.triggerDataEvent(s,!0):i.length<c.length?this._coreService.triggerDataEvent(`${u.C0.DEL}`,!0):i.length===c.length&&i!==c&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(c){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,t=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=t+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=t+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}c||setTimeout(()=>this.updateCompositionElements(!0),0)}}};r.CompositionHelper=v=h([_(2,d.IBufferService),_(3,d.IOptionsService),_(4,d.ICoreService),_(5,o.IRenderService)],v)},9806:(y,r)=>{function n(h,_,o){let d=o.getBoundingClientRect(),u=h.getComputedStyle(o),v=parseInt(u.getPropertyValue("padding-left")),c=parseInt(u.getPropertyValue("padding-top"));return[_.clientX-d.left-v,_.clientY-d.top-c]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=n,r.getCoords=function(h,_,o,d,u,v,c,i,s){if(!v)return;let e=n(h,_,o);return e?(e[0]=Math.ceil((e[0]+(s?c/2:0))/c),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),d+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),u),e):void 0}},9504:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let h=n(2584);function _(i,s,e,t){let a=i-o(i,e),p=s-o(s,e),f=Math.abs(a-p)-function(g,l,m){let R=0,D=g-o(g,m),x=l-o(l,m);for(let b=0;b<Math.abs(D-x);b++){let O=d(g,l)==="A"?-1:1;m.buffer.lines.get(D+O*b)?.isWrapped&&R++}return R}(i,s,e);return c(f,v(d(i,s),t))}function o(i,s){let e=0,t=s.buffer.lines.get(i),a=t?.isWrapped;for(;a&&i>=0&&i<s.rows;)e++,t=s.buffer.lines.get(--i),a=t?.isWrapped;return e}function d(i,s){return i>s?"A":"B"}function u(i,s,e,t,a,p){let f=i,g=s,l="";for(;f!==e||g!==t;)f+=a?1:-1,a&&f>p.cols-1?(l+=p.buffer.translateBufferLineToString(g,!1,i,f),f=0,i=0,g++):!a&&f<0&&(l+=p.buffer.translateBufferLineToString(g,!1,0,i+1),f=p.cols-1,i=f,g--);return l+p.buffer.translateBufferLineToString(g,!1,i,f)}function v(i,s){let e=s?"O":"[";return h.C0.ESC+e+i}function c(i,s){i=Math.floor(i);let e="";for(let t=0;t<i;t++)e+=s;return e}r.moveToCellSequence=function(i,s,e,t){let a=e.buffer.x,p=e.buffer.y;if(!e.buffer.hasScrollback)return function(l,m,R,D,x,b){return _(m,D,x,b).length===0?"":c(u(l,m,l,m-o(m,x),!1,x).length,v("D",b))}(a,p,0,s,e,t)+_(p,s,e,t)+function(l,m,R,D,x,b){let O;O=_(m,D,x,b).length>0?D-o(D,x):m;let H=D,N=function(z,W,S,w,k,A){let I;return I=_(S,w,k,A).length>0?w-o(w,k):W,z<S&&I<=w||z>=S&&I<w?"C":"D"}(l,m,R,D,x,b);return c(u(l,O,R,H,N==="C",x).length,v(N,b))}(a,p,i,s,e,t);let f;if(p===s)return f=a>i?"D":"C",c(Math.abs(a-i),v(f,t));f=p>s?"D":"C";let g=Math.abs(p-s);return c(function(l,m){return m.cols-l}(p>s?i:a,e)+(g-1)*e.cols+1+((p>s?a:i)-1),v(f,t))}},1296:function(y,r,n){var h=this&&this.__decorate||function(b,O,H,N){var z,W=arguments.length,S=W<3?O:N===null?N=Object.getOwnPropertyDescriptor(O,H):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,O,H,N);else for(var w=b.length-1;w>=0;w--)(z=b[w])&&(S=(W<3?z(S):W>3?z(O,H,S):z(O,H))||S);return W>3&&S&&Object.defineProperty(O,H,S),S},_=this&&this.__param||function(b,O){return function(H,N){O(H,N,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let o=n(3787),d=n(2550),u=n(2223),v=n(6171),c=n(6052),i=n(4725),s=n(8055),e=n(8460),t=n(844),a=n(2585),p="xterm-dom-renderer-owner-",f="xterm-rows",g="xterm-fg-",l="xterm-bg-",m="xterm-focus",R="xterm-selection",D=1,x=r.DomRenderer=class extends t.Disposable{constructor(b,O,H,N,z,W,S,w,k,A,I,U,K){super(),this._terminal=b,this._document=O,this._element=H,this._screenElement=N,this._viewportElement=z,this._helperContainer=W,this._linkifier2=S,this._charSizeService=k,this._optionsService=A,this._bufferService=I,this._coreBrowserService=U,this._themeService=K,this._terminalClass=D++,this._rowElements=[],this._selectionRenderModel=(0,c.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(f),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(R),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,v.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(q=>this._injectCss(q))),this._injectCss(this._themeService.colors),this._rowFactory=w.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(q=>this._handleLinkHover(q))),this.register(this._linkifier2.onHideLinkUnderline(q=>this._handleLinkLeave(q))),this.register((0,t.toDisposable)(()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new d.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let b=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*b,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*b),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/b),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/b),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let O=`${this._terminalSelector} .${f} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=O,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(b){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let O=`${this._terminalSelector} .${f} { color: ${b.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;O+=`${this._terminalSelector} .${f} .xterm-dim { color: ${s.color.multiplyOpacity(b.foreground,.5).css};}`,O+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let H=`blink_underline_${this._terminalClass}`,N=`blink_bar_${this._terminalClass}`,z=`blink_block_${this._terminalClass}`;O+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,O+=`@keyframes ${N} { 50% { box-shadow: none; }}`,O+=`@keyframes ${z} { 0% { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css}; } 50% { background-color: inherit; color: ${b.cursor.css}; }}`,O+=`${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css};}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${b.cursor.css} !important; color: ${b.cursorAccent.css} !important;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${b.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${b.cursor.css} inset;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${b.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,O+=`${this._terminalSelector} .${R} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${R} div { position: absolute; background-color: ${b.selectionBackgroundOpaque.css};}${this._terminalSelector} .${R} div { position: absolute; background-color: ${b.selectionInactiveBackgroundOpaque.css};}`;for(let[W,S]of b.ansi.entries())O+=`${this._terminalSelector} .${g}${W} { color: ${S.css}; }${this._terminalSelector} .${g}${W}.xterm-dim { color: ${s.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${l}${W} { background-color: ${S.css}; }`;O+=`${this._terminalSelector} .${g}${u.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(b.background).css}; }${this._terminalSelector} .${g}${u.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(b.background),.5).css}; }${this._terminalSelector} .${l}${u.INVERTED_DEFAULT_COLOR} { background-color: ${b.foreground.css}; }`,this._themeStyleElement.textContent=O}_setDefaultSpacing(){let b=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${b}px`,this._rowFactory.defaultSpacing=b}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(b,O){for(let H=this._rowElements.length;H<=O;H++){let N=this._document.createElement("div");this._rowContainer.appendChild(N),this._rowElements.push(N)}for(;this._rowElements.length>O;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(b,O){this._refreshRowElements(b,O),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(b,O,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(b,O,H),this.renderRows(0,this._bufferService.rows-1),!b||!O)return;this._selectionRenderModel.update(this._terminal,b,O,H);let N=this._selectionRenderModel.viewportStartRow,z=this._selectionRenderModel.viewportEndRow,W=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if(W>=this._bufferService.rows||S<0)return;let w=this._document.createDocumentFragment();if(H){let k=b[0]>O[0];w.appendChild(this._createSelectionElement(W,k?O[0]:b[0],k?b[0]:O[0],S-W+1))}else{let k=N===W?b[0]:0,A=W===z?O[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(W,k,A));let I=S-W-1;if(w.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,I)),W!==S){let U=z===S?O[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(S,0,U))}}this._selectionContainer.appendChild(w)}_createSelectionElement(b,O,H,N=1){let z=this._document.createElement("div"),W=O*this.dimensions.css.cell.width,S=this.dimensions.css.cell.width*(H-O);return W+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-W),z.style.height=N*this.dimensions.css.cell.height+"px",z.style.top=b*this.dimensions.css.cell.height+"px",z.style.left=`${W}px`,z.style.width=`${S}px`,z}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let b of this._rowElements)b.replaceChildren()}renderRows(b,O){let H=this._bufferService.buffer,N=H.ybase+H.y,z=Math.min(H.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=b;k<=O;k++){let A=k+H.ydisp,I=this._rowElements[k],U=H.lines.get(A);if(!I||!U)break;I.replaceChildren(...this._rowFactory.createRow(U,A,A===N,S,w,z,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!0)}_handleLinkLeave(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!1)}_setCellUnderline(b,O,H,N,z,W){H<0&&(b=0),N<0&&(O=0);let S=this._bufferService.rows-1;H=Math.max(Math.min(H,S),0),N=Math.max(Math.min(N,S),0),z=Math.min(z,this._bufferService.cols);let w=this._bufferService.buffer,k=w.ybase+w.y,A=Math.min(w.x,z-1),I=this._optionsService.rawOptions.cursorBlink,U=this._optionsService.rawOptions.cursorStyle,K=this._optionsService.rawOptions.cursorInactiveStyle;for(let q=H;q<=N;++q){let B=q+w.ydisp,C=this._rowElements[q],M=w.lines.get(B);if(!C||!M)break;C.replaceChildren(...this._rowFactory.createRow(M,B,B===k,U,K,A,I,this.dimensions.css.cell.width,this._widthCache,W?q===H?b:0:-1,W?(q===N?O:z)-1:-1))}}};r.DomRenderer=x=h([_(7,a.IInstantiationService),_(8,i.ICharSizeService),_(9,a.IOptionsService),_(10,a.IBufferService),_(11,i.ICoreBrowserService),_(12,i.IThemeService)],x)},3787:function(y,r,n){var h=this&&this.__decorate||function(f,g,l,m){var R,D=arguments.length,x=D<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,l):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,g,l,m);else for(var b=f.length-1;b>=0;b--)(R=f[b])&&(x=(D<3?R(x):D>3?R(g,l,x):R(g,l))||x);return D>3&&x&&Object.defineProperty(g,l,x),x},_=this&&this.__param||function(f,g){return function(l,m){g(l,m,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let o=n(2223),d=n(643),u=n(511),v=n(2585),c=n(8055),i=n(4725),s=n(4269),e=n(6171),t=n(3734),a=r.DomRendererRowFactory=class{constructor(f,g,l,m,R,D,x){this._document=f,this._characterJoinerService=g,this._optionsService=l,this._coreBrowserService=m,this._coreService=R,this._decorationService=D,this._themeService=x,this._workCell=new u.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(f,g,l){this._selectionStart=f,this._selectionEnd=g,this._columnSelectMode=l}createRow(f,g,l,m,R,D,x,b,O,H,N){let z=[],W=this._characterJoinerService.getJoinedCharacters(g),S=this._themeService.colors,w,k=f.getNoBgTrimmedLength();l&&k<D+1&&(k=D+1);let A=0,I="",U=0,K=0,q=0,B=!1,C=0,M=!1,F=0,$=[],j=H!==-1&&N!==-1;for(let G=0;G<k;G++){f.loadCell(G,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let Z=!1,ee=G,V=this._workCell;if(W.length>0&&G===W[0][0]){Z=!0;let X=W.shift();V=new s.JoinedCellData(this._workCell,f.translateToString(!0,X[0],X[1]),X[1]-X[0]),ee=X[1]-1,J=V.getWidth()}let fe=this._isCellInSelection(G,g),Te=l&&G===D,Be=j&&G>=H&&G<=N,Oe=!1;this._decorationService.forEachDecorationAtCell(G,g,void 0,X=>{Oe=!0});let be=V.getChars()||d.WHITESPACE_CELL_CHAR;if(be===" "&&(V.isUnderline()||V.isOverline())&&(be="\xA0"),F=J*b-O.get(be,V.isBold(),V.isItalic()),w){if(A&&(fe&&M||!fe&&!M&&V.bg===U)&&(fe&&M&&S.selectionForeground||V.fg===K)&&V.extended.ext===q&&Be===B&&F===C&&!Te&&!Z&&!Oe){V.isInvisible()?I+=d.WHITESPACE_CELL_CHAR:I+=be,A++;continue}A&&(w.textContent=I),w=this._document.createElement("span"),A=0,I=""}else w=this._document.createElement("span");if(U=V.bg,K=V.fg,q=V.extended.ext,B=Be,C=F,M=fe,Z&&D>=G&&D<=ee&&(D=G),!this._coreService.isCursorHidden&&Te&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)x&&$.push("xterm-cursor-blink"),$.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){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"),I=V.isInvisible()?d.WHITESPACE_CELL_CHAR:V.getChars()||d.WHITESPACE_CELL_CHAR,V.isUnderline()&&($.push(`xterm-underline-${V.extended.underlineStyle}`),I===" "&&(I="\xA0"),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${t.AttributeData.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let X=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&X<8&&(X+=8),w.style.textDecorationColor=S.ansi[X].css}V.isOverline()&&($.push("xterm-overline"),I===" "&&(I="\xA0")),V.isStrikethrough()&&$.push("xterm-strikethrough"),Be&&(w.style.textDecoration="underline");let se=V.getFgColor(),pe=V.getFgColorMode(),ne=V.getBgColor(),ve=V.getBgColorMode(),Me=!!V.isInverse();if(Me){let X=se;se=ne,ne=X;let Mt=pe;pe=ve,ve=Mt}let oe,we,ae,ge=!1;switch(this._decorationService.forEachDecorationAtCell(G,g,void 0,X=>{X.options.layer!=="top"&&ge||(X.backgroundColorRGB&&(ve=50331648,ne=X.backgroundColorRGB.rgba>>8&16777215,oe=X.backgroundColorRGB),X.foregroundColorRGB&&(pe=50331648,se=X.foregroundColorRGB.rgba>>8&16777215,we=X.foregroundColorRGB),ge=X.options.layer==="top")}),!ge&&fe&&(oe=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ne=oe.rgba>>8&16777215,ve=50331648,ge=!0,S.selectionForeground&&(pe=50331648,se=S.selectionForeground.rgba>>8&16777215,we=S.selectionForeground)),ge&&$.push("xterm-decoration-top"),ve){case 16777216:case 33554432:ae=S.ansi[ne],$.push(`xterm-bg-${ne}`);break;case 50331648:ae=c.channels.toColor(ne>>16,ne>>8&255,255&ne),this._addStyle(w,`background-color:#${p((ne>>>0).toString(16),"0",6)}`);break;default:Me?(ae=S.foreground,$.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):ae=S.background}switch(oe||V.isDim()&&(oe=c.color.multiplyOpacity(ae,.5)),pe){case 16777216:case 33554432:V.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(w,ae,S.ansi[se],V,oe,void 0)||$.push(`xterm-fg-${se}`);break;case 50331648:let X=c.channels.toColor(se>>16&255,se>>8&255,255&se);this._applyMinimumContrast(w,ae,X,V,oe,we)||this._addStyle(w,`color:#${p(se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,ae,S.foreground,V,oe,we)||Me&&$.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}$.length&&(w.className=$.join(" "),$.length=0),Te||Z||Oe?w.textContent=I:A++,F!==this.defaultSpacing&&(w.style.letterSpacing=`${F}px`),z.push(w),G=ee}return w&&A&&(w.textContent=I),z}_applyMinimumContrast(f,g,l,m,R,D){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let x=this._getContrastCache(m),b;if(R||D||(b=x.getColor(g.rgba,l.rgba)),b===void 0){let O=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);b=c.color.ensureContrastRatio(R||g,D||l,O),x.setColor((R||g).rgba,(D||l).rgba,b??null)}return!!b&&(this._addStyle(f,`color:${b.css}`),!0)}_getContrastCache(f){return f.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(f,g){f.setAttribute("style",`${f.getAttribute("style")||""}${g};`)}_isCellInSelection(f,g){let l=this._selectionStart,m=this._selectionEnd;return!(!l||!m)&&(this._columnSelectMode?l[0]<=m[0]?f>=l[0]&&g>=l[1]&&f<m[0]&&g<=m[1]:f<l[0]&&g>=l[1]&&f>=m[0]&&g<=m[1]:g>l[1]&&g<m[1]||l[1]===m[1]&&g===l[1]&&f>=l[0]&&f<m[0]||l[1]<m[1]&&g===m[1]&&f<m[0]||l[1]<m[1]&&g===l[1]&&f>=l[0])}};function p(f,g,l){for(;f.length<l;)f=g+f;return f}r.DomRendererRowFactory=a=h([_(1,i.ICharacterJoinerService),_(2,v.IOptionsService),_(3,i.ICoreBrowserService),_(4,v.ICoreService),_(5,v.IDecorationService),_(6,i.IThemeService)],a)},2550:(y,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 d=n.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";let u=n.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold",u.style.fontStyle="italic",this._measureElements=[_,o,d,u],this._container.appendChild(_),this._container.appendChild(o),this._container.appendChild(d),this._container.appendChild(u),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 v=this._measure(n,0);return v>0&&(this._flat[o]=v),v}let d=n;h&&(d+="B"),_&&(d+="I");let u=this._holey.get(d);if(u===void 0){let v=0;h&&(v|=1),_&&(v|=2),u=this._measure(n,v),u>0&&this._holey.set(d,u)}return u}_measure(n,h){let _=this._measureElements[h];return _.textContent=n.repeat(32),_.offsetWidth/32}}},2223:(y,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:(y,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,d,u){return o===1&&d>Math.ceil(1.5*u)&&_!==void 0&&_>255&&!h(_)&&!n(_)&&!function(v){return 57344<=v&&v<=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,d=0){return(_-(2*Math.round(o)-d))%(2*Math.round(o))}},6052:(y,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,d,u=!1){if(this.selectionStart=o,this.selectionEnd=d,!o||!d||o[0]===d[0]&&o[1]===d[1])return void this.clear();let v=_.buffers.active.ydisp,c=o[1]-v,i=d[1]-v,s=Math.max(c,0),e=Math.min(i,_.rows-1);s>=_.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=u,this.viewportStartRow=c,this.viewportEndRow=i,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=o[0],this.endCol=d[0])}isCellSelected(_,o,d){return!!this.hasSelection&&(d-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&d>=this.viewportCappedStartRow&&o<this.endCol&&d<=this.viewportCappedEndRow:o<this.startCol&&d>=this.viewportCappedStartRow&&o>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&o>=this.startCol)}}r.createSelectionRenderModel=function(){return new n}},456:(y,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(y,r,n){var h=this&&this.__decorate||function(e,t,a,p){var f,g=arguments.length,l=g<3?t:p===null?p=Object.getOwnPropertyDescriptor(t,a):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,a,p);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(g<3?f(l):g>3?f(t,a,l):f(t,a))||l);return g>3&&l&&Object.defineProperty(t,a,l),l},_=this&&this.__param||function(e,t){return function(a,p){t(a,p,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let o=n(2585),d=n(8460),u=n(844),v=r.CharSizeService=class extends u.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,a){super(),this._optionsService=a,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=v=h([_(2,o.IOptionsService)],v);class c extends u.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,a){t!==void 0&&t>0&&a!==void 0&&a>0&&(this._result.width=t,this._result.height=a)}}class i extends c{constructor(t,a,p){super(),this._document=t,this._parentElement=a,this._optionsService=p,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends c{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let a=this._ctx.measureText("W");if(!("width"in a&&"fontBoundingBoxAscent"in a&&"fontBoundingBoxDescent"in a))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}}},4269:function(y,r,n){var h=this&&this.__decorate||function(s,e,t,a){var p,f=arguments.length,g=f<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,a);else for(var l=s.length-1;l>=0;l--)(p=s[l])&&(g=(f<3?p(g):f>3?p(e,t,g):p(e,t))||g);return f>3&&g&&Object.defineProperty(e,t,g),g},_=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let o=n(3734),d=n(643),u=n(511),v=n(2585);class c extends o.AttributeData{constructor(e,t,a){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=a}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=c;let i=r.CharacterJoinerService=class Dt{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new u.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let a=[],p=t.translateToString(!0),f=0,g=0,l=0,m=t.getFg(0),R=t.getBg(0);for(let D=0;D<t.getTrimmedLength();D++)if(t.loadCell(D,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==R){if(D-f>1){let x=this._getJoinedRanges(p,l,g,t,f);for(let b=0;b<x.length;b++)a.push(x[b])}f=D,l=g,m=this._workCell.fg,R=this._workCell.bg}g+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){let D=this._getJoinedRanges(p,l,g,t,f);for(let x=0;x<D.length;x++)a.push(D[x])}return a}_getJoinedRanges(e,t,a,p,f){let g=e.substring(t,a),l=[];try{l=this._characterJoiners[0].handler(g)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{let R=this._characterJoiners[m].handler(g);for(let D=0;D<R.length;D++)Dt._mergeRanges(l,R[D])}catch(R){console.error(R)}return this._stringRangesToCellRanges(l,p,f),l}_stringRangesToCellRanges(e,t,a){let p=0,f=!1,g=0,l=e[p];if(l){for(let m=a;m<this._bufferService.cols;m++){let R=t.getWidth(m),D=t.getString(m).length||d.WHITESPACE_CELL_CHAR.length;if(R!==0){if(!f&&l[0]<=g&&(l[0]=m,f=!0),l[1]<=g){if(l[1]=m,l=e[++p],!l)break;l[0]<=g?(l[0]=m,f=!0):f=!1}g+=D}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let a=!1;for(let p=0;p<e.length;p++){let f=e[p];if(a){if(t[1]<=f[0])return e[p-1][1]=t[1],e;if(t[1]<=f[1])return e[p-1][1]=Math.max(t[1],f[1]),e.splice(p,1),e;e.splice(p,1),p--}else{if(t[1]<=f[0])return e.splice(p,0,t),e;if(t[1]<=f[1])return f[0]=Math.min(t[0],f[0]),e;t[0]<f[1]&&(f[0]=Math.min(t[0],f[0]),a=!0)}}return a?e[e.length-1][1]=t[1]:e.push(t),e}};r.CharacterJoinerService=i=h([_(0,v.IBufferService)],i)},5114:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let h=n(844),_=n(8460),o=n(3656);class d extends h.Disposable{constructor(c,i,s){super(),this._textarea=c,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new u(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(c){this._window!==c&&(this._window=c,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}r.CoreBrowserService=d;class u extends h.Disposable{constructor(c){super(),this._parentWindow=c,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(c){this._parentWindow=c,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,o.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(y,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(d){return this.linkProviders.push(d),{dispose:()=>{let u=this.linkProviders.indexOf(d);u!==-1&&this.linkProviders.splice(u,1)}}}}r.LinkProviderService=_},8934:function(y,r,n){var h=this&&this.__decorate||function(v,c,i,s){var e,t=arguments.length,a=t<3?c:s===null?s=Object.getOwnPropertyDescriptor(c,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(v,c,i,s);else for(var p=v.length-1;p>=0;p--)(e=v[p])&&(a=(t<3?e(a):t>3?e(c,i,a):e(c,i))||a);return t>3&&a&&Object.defineProperty(c,i,a),a},_=this&&this.__param||function(v,c){return function(i,s){c(i,s,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let o=n(4725),d=n(9806),u=r.MouseService=class{constructor(v,c){this._renderService=v,this._charSizeService=c}getCoords(v,c,i,s,e){return(0,d.getCoords)(window,v,c,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(v,c){let i=(0,d.getCoordsRelativeToElement)(window,v,c);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};r.MouseService=u=h([_(0,o.IRenderService),_(1,o.ICharSizeService)],u)},3230:function(y,r,n){var h=this&&this.__decorate||function(e,t,a,p){var f,g=arguments.length,l=g<3?t:p===null?p=Object.getOwnPropertyDescriptor(t,a):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,a,p);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(g<3?f(l):g>3?f(t,a,l):f(t,a))||l);return g>3&&l&&Object.defineProperty(t,a,l),l},_=this&&this.__param||function(e,t){return function(a,p){t(a,p,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let o=n(6193),d=n(4725),u=n(8460),v=n(844),c=n(7226),i=n(2585),s=r.RenderService=class extends v.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,a,p,f,g,l,m){super(),this._rowCount=e,this._charSizeService=p,this._renderer=this.register(new v.MutableDisposable),this._pausedResizeTask=new c.DebouncedIdleTask,this._observerDisposable=this.register(new v.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 u.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new u.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new u.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new u.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer((R,D)=>this._renderRows(R,D),l),this.register(this._renderDebouncer),this.register(l.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(g.onResize(()=>this._fullRefresh())),this.register(g.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(a.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(f.onDecorationRegistered(()=>this._fullRefresh())),this.register(f.onDecorationRemoved(()=>this._fullRefresh())),this.register(a.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()})),this.register(a.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(g.buffer.y,g.buffer.y,!0))),this.register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(l.window,t),this.register(l.onWindowChange(R=>this._registerIntersectionObserver(R,t)))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let a=new e.IntersectionObserver(p=>this._handleIntersectionChange(p[p.length-1]),{threshold:0});a.observe(t),this._observerDisposable.value=(0,v.toDisposable)(()=>a.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,a=!1){this._isPaused?this._needsFullRefresh=!0:(a||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,a){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=a,this._renderer.value?.handleSelectionChanged(e,t,a)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=s=h([_(2,i.IOptionsService),_(3,d.ICharSizeService),_(4,i.IDecorationService),_(5,i.IBufferService),_(6,d.ICoreBrowserService),_(7,d.IThemeService)],s)},9312:function(y,r,n){var h=this&&this.__decorate||function(l,m,R,D){var x,b=arguments.length,O=b<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,R):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(l,m,R,D);else for(var H=l.length-1;H>=0;H--)(x=l[H])&&(O=(b<3?x(O):b>3?x(m,R,O):x(m,R))||O);return b>3&&O&&Object.defineProperty(m,R,O),O},_=this&&this.__param||function(l,m){return function(R,D){m(R,D,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let o=n(9806),d=n(9504),u=n(456),v=n(4725),c=n(8460),i=n(844),s=n(6114),e=n(4841),t=n(511),a=n(2585),p="\xA0",f=new RegExp(p,"g"),g=r.SelectionService=class extends i.Disposable{constructor(l,m,R,D,x,b,O,H,N){super(),this._element=l,this._screenElement=m,this._linkifier=R,this._bufferService=D,this._coreService=x,this._mouseService=b,this._optionsService=O,this._renderService=H,this._coreBrowserService=N,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new t.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=z=>this._handleMouseMove(z),this._mouseUpListener=z=>this._handleMouseUp(z),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(z=>this._handleTrim(z)),this.register(this._bufferService.buffers.onBufferActivate(z=>this._handleBufferActivate(z))),this.enable(),this._model=new u.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let l=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!l||!m||l[0]===m[0]&&l[1]===m[1])}get selectionText(){let l=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!l||!m)return"";let R=this._bufferService.buffer,D=[];if(this._activeSelectionMode===3){if(l[0]===m[0])return"";let x=l[0]<m[0]?l[0]:m[0],b=l[0]<m[0]?m[0]:l[0];for(let O=l[1];O<=m[1];O++){let H=R.translateBufferLineToString(O,!0,x,b);D.push(H)}}else{let x=l[1]===m[1]?m[0]:void 0;D.push(R.translateBufferLineToString(l[1],!0,l[0],x));for(let b=l[1]+1;b<=m[1]-1;b++){let O=R.lines.get(b),H=R.translateBufferLineToString(b,!0);O?.isWrapped?D[D.length-1]+=H:D.push(H)}if(l[1]!==m[1]){let b=R.lines.get(m[1]),O=R.translateBufferLineToString(m[1],!0,0,m[0]);b&&b.isWrapped?D[D.length-1]+=O:D.push(O)}}return D.map(x=>x.replace(f," ")).join(s.isWindows?`\r
`:`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(l){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s.isLinux&&l&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(l){let m=this._getMouseBufferCoords(l),R=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!!(R&&D&&m)&&this._areCoordsInSelection(m,R,D)}isCellInSelection(l,m){let R=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!R||!D)&&this._areCoordsInSelection([l,m],R,D)}_areCoordsInSelection(l,m,R){return l[1]>m[1]&&l[1]<R[1]||m[1]===R[1]&&l[1]===m[1]&&l[0]>=m[0]&&l[0]<R[0]||m[1]<R[1]&&l[1]===R[1]&&l[0]<R[0]||m[1]<R[1]&&l[1]===m[1]&&l[0]>=m[0]}_selectWordAtCursor(l,m){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 D=this._getMouseBufferCoords(l);return!!D&&(this._selectWordAt(D,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(l,m){this._model.clearSelection(),l=Math.max(l,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,l],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(l){this._model.handleTrim(l)&&this.refresh()}_getMouseBufferCoords(l){let m=this._mouseService.getCoords(l,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(l){let m=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,l,this._screenElement)[1],R=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=R?0:(m>R&&(m-=R),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(l){return s.isMac?l.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:l.shiftKey}handleMouseDown(l){if(this._mouseDownTimeStamp=l.timeStamp,(l.button!==2||!this.hasSelection)&&l.button===0){if(!this._enabled){if(!this.shouldForceSelection(l))return;l.stopPropagation()}l.preventDefault(),this._dragScrollAmount=0,this._enabled&&l.shiftKey?this._handleIncrementalClick(l):l.detail===1?this._handleSingleClick(l):l.detail===2?this._handleDoubleClick(l):l.detail===3&&this._handleTripleClick(l),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(l){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(l))}_handleSingleClick(l){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(l)?3:0,this._model.selectionStart=this._getMouseBufferCoords(l),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(l){this._selectWordAtCursor(l,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(l){let m=this._getMouseBufferCoords(l);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(l){return l.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(l){if(l.stopImmediatePropagation(),!this._model.selectionStart)return;let m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(l),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(l),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){let D=R.lines.get(this._model.selectionEnd[1]);D&&D.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let l=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(l.ydisp+this._bufferService.rows,l.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=l.ydisp),this.refresh()}}_handleMouseUp(l){let m=l.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&l.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let R=this._mouseService.getCoords(l,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){let D=(0,d.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(D,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let l=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,R=!(!l||!m||l[0]===m[0]&&l[1]===m[1]);R?l&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&l[0]===this._oldSelectionStart[0]&&l[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(l,m,R)):this._oldHasSelection&&this._fireOnSelectionChange(l,m,R)}_fireOnSelectionChange(l,m,R){this._oldSelectionStart=l,this._oldSelectionEnd=m,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(l){this.clearSelection(),this._trimListener.dispose(),this._trimListener=l.activeBuffer.lines.onTrim(m=>this._handleTrim(m))}_convertViewportColToCharacterIndex(l,m){let R=m;for(let D=0;m>=D;D++){let x=l.loadCell(D,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:x>1&&m!==D&&(R+=x-1)}return R}setSelection(l,m,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[l,m],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(l){this._isClickInSelection(l)||(this._selectWordAtCursor(l,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(l,m,R=!0,D=!0){if(l[0]>=this._bufferService.cols)return;let x=this._bufferService.buffer,b=x.lines.get(l[1]);if(!b)return;let O=x.translateBufferLineToString(l[1],!1),H=this._convertViewportColToCharacterIndex(b,l[0]),N=H,z=l[0]-H,W=0,S=0,w=0,k=0;if(O.charAt(H)===" "){for(;H>0&&O.charAt(H-1)===" ";)H--;for(;N<O.length&&O.charAt(N+1)===" ";)N++}else{let U=l[0],K=l[0];b.getWidth(U)===0&&(W++,U--),b.getWidth(K)===2&&(S++,K++);let q=b.getString(K).length;for(q>1&&(k+=q-1,N+=q-1);U>0&&H>0&&!this._isCharWordSeparator(b.loadCell(U-1,this._workCell));){b.loadCell(U-1,this._workCell);let B=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,U--):B>1&&(w+=B-1,H-=B-1),H--,U--}for(;K<b.length&&N+1<O.length&&!this._isCharWordSeparator(b.loadCell(K+1,this._workCell));){b.loadCell(K+1,this._workCell);let B=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,K++):B>1&&(k+=B-1,N+=B-1),N++,K++}}N++;let A=H+z-W+w,I=Math.min(this._bufferService.cols,N-H+W+S-w-k);if(m||O.slice(H,N).trim()!==""){if(R&&A===0&&b.getCodePoint(0)!==32){let U=x.lines.get(l[1]-1);if(U&&b.isWrapped&&U.getCodePoint(this._bufferService.cols-1)!==32){let K=this._getWordAt([this._bufferService.cols-1,l[1]-1],!1,!0,!1);if(K){let q=this._bufferService.cols-K.start;A-=q,I+=q}}}if(D&&A+I===this._bufferService.cols&&b.getCodePoint(this._bufferService.cols-1)!==32){let U=x.lines.get(l[1]+1);if(U?.isWrapped&&U.getCodePoint(0)!==32){let K=this._getWordAt([0,l[1]+1],!1,!1,!0);K&&(I+=K.length)}}return{start:A,length:I}}}_selectWordAt(l,m){let R=this._getWordAt(l,m);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,l[1]--;this._model.selectionStart=[R.start,l[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(l){let m=this._getWordAt(l,!0);if(m){let R=l[1];for(;m.start<0;)m.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,R]}}_isCharWordSeparator(l){return l.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(l.getChars())>=0}_selectLineAt(l){let m=this._bufferService.buffer.getWrappedRangeForLine(l),R={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(R,this._bufferService.cols)}};r.SelectionService=g=h([_(3,a.IBufferService),_(4,a.ICoreService),_(5,v.IMouseService),_(6,a.IOptionsService),_(7,v.IRenderService),_(8,v.ICoreBrowserService)],g)},4725:(y,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(y,r,n){var h=this&&this.__decorate||function(g,l,m,R){var D,x=arguments.length,b=x<3?l:R===null?R=Object.getOwnPropertyDescriptor(l,m):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(g,l,m,R);else for(var O=g.length-1;O>=0;O--)(D=g[O])&&(b=(x<3?D(b):x>3?D(l,m,b):D(l,m))||b);return x>3&&b&&Object.defineProperty(l,m,b),b},_=this&&this.__param||function(g,l){return function(m,R){l(m,R,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let o=n(7239),d=n(8055),u=n(8460),v=n(844),c=n(2585),i=d.css.toColor("#ffffff"),s=d.css.toColor("#000000"),e=d.css.toColor("#ffffff"),t=d.css.toColor("#000000"),a={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let g=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],l=[0,95,135,175,215,255];for(let m=0;m<216;m++){let R=l[m/36%6|0],D=l[m/6%6|0],x=l[m%6];g.push({css:d.channels.toCss(R,D,x),rgba:d.channels.toRgba(R,D,x)})}for(let m=0;m<24;m++){let R=8+10*m;g.push({css:d.channels.toCss(R,R,R),rgba:d.channels.toRgba(R,R,R)})}return g})());let p=r.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new u.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:s,cursor:e,cursorAccent:t,selectionForeground:void 0,selectionBackgroundTransparent:a,selectionBackgroundOpaque:d.color.blend(s,a),selectionInactiveBackgroundTransparent:a,selectionInactiveBackgroundOpaque:d.color.blend(s,a),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(g={}){let l=this._colors;if(l.foreground=f(g.foreground,i),l.background=f(g.background,s),l.cursor=f(g.cursor,e),l.cursorAccent=f(g.cursorAccent,t),l.selectionBackgroundTransparent=f(g.selectionBackground,a),l.selectionBackgroundOpaque=d.color.blend(l.background,l.selectionBackgroundTransparent),l.selectionInactiveBackgroundTransparent=f(g.selectionInactiveBackground,l.selectionBackgroundTransparent),l.selectionInactiveBackgroundOpaque=d.color.blend(l.background,l.selectionInactiveBackgroundTransparent),l.selectionForeground=g.selectionForeground?f(g.selectionForeground,d.NULL_COLOR):void 0,l.selectionForeground===d.NULL_COLOR&&(l.selectionForeground=void 0),d.color.isOpaque(l.selectionBackgroundTransparent)&&(l.selectionBackgroundTransparent=d.color.opacity(l.selectionBackgroundTransparent,.3)),d.color.isOpaque(l.selectionInactiveBackgroundTransparent)&&(l.selectionInactiveBackgroundTransparent=d.color.opacity(l.selectionInactiveBackgroundTransparent,.3)),l.ansi=r.DEFAULT_ANSI_COLORS.slice(),l.ansi[0]=f(g.black,r.DEFAULT_ANSI_COLORS[0]),l.ansi[1]=f(g.red,r.DEFAULT_ANSI_COLORS[1]),l.ansi[2]=f(g.green,r.DEFAULT_ANSI_COLORS[2]),l.ansi[3]=f(g.yellow,r.DEFAULT_ANSI_COLORS[3]),l.ansi[4]=f(g.blue,r.DEFAULT_ANSI_COLORS[4]),l.ansi[5]=f(g.magenta,r.DEFAULT_ANSI_COLORS[5]),l.ansi[6]=f(g.cyan,r.DEFAULT_ANSI_COLORS[6]),l.ansi[7]=f(g.white,r.DEFAULT_ANSI_COLORS[7]),l.ansi[8]=f(g.brightBlack,r.DEFAULT_ANSI_COLORS[8]),l.ansi[9]=f(g.brightRed,r.DEFAULT_ANSI_COLORS[9]),l.ansi[10]=f(g.brightGreen,r.DEFAULT_ANSI_COLORS[10]),l.ansi[11]=f(g.brightYellow,r.DEFAULT_ANSI_COLORS[11]),l.ansi[12]=f(g.brightBlue,r.DEFAULT_ANSI_COLORS[12]),l.ansi[13]=f(g.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),l.ansi[14]=f(g.brightCyan,r.DEFAULT_ANSI_COLORS[14]),l.ansi[15]=f(g.brightWhite,r.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){let m=Math.min(l.ansi.length-16,g.extendedAnsi.length);for(let R=0;R<m;R++)l.ansi[R+16]=f(g.extendedAnsi[R],r.DEFAULT_ANSI_COLORS[R+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(g){this._restoreColor(g),this._onChangeColors.fire(this.colors)}_restoreColor(g){if(g!==void 0)switch(g){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[g]=this._restoreColors.ansi[g]}else for(let l=0;l<this._restoreColors.ansi.length;++l)this._colors.ansi[l]=this._restoreColors.ansi[l]}modifyColors(g){g(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function f(g,l){if(g!==void 0)try{return d.css.toColor(g)}catch{}return l}r.ThemeService=p=h([_(0,c.IOptionsService)],p)},6349:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let h=n(8460),_=n(844);class o extends _.Disposable{constructor(u){super(),this._maxLength=u,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(u){if(this._maxLength===u)return;let v=new Array(u);for(let c=0;c<Math.min(u,this.length);c++)v[c]=this._array[this._getCyclicIndex(c)];this._array=v,this._maxLength=u,this._startIndex=0}get length(){return this._length}set length(u){if(u>this._length)for(let v=this._length;v<u;v++)this._array[v]=void 0;this._length=u}get(u){return this._array[this._getCyclicIndex(u)]}set(u,v){this._array[this._getCyclicIndex(u)]=v}push(u){this._array[this._getCyclicIndex(this._length)]=u,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(u,v,...c){if(v){for(let i=u;i<this._length-v;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+v)];this._length-=v,this.onDeleteEmitter.fire({index:u,amount:v})}for(let i=this._length-1;i>=u;i--)this._array[this._getCyclicIndex(i+c.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<c.length;i++)this._array[this._getCyclicIndex(u+i)]=c[i];if(c.length&&this.onInsertEmitter.fire({index:u,amount:c.length}),this._length+c.length>this._maxLength){let i=this._length+c.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=c.length}trimStart(u){u>this._length&&(u=this._length),this._startIndex+=u,this._length-=u,this.onTrimEmitter.fire(u)}shiftElements(u,v,c){if(!(v<=0)){if(u<0||u>=this._length)throw new Error("start argument out of range");if(u+c<0)throw new Error("Cannot shift elements in list beyond index 0");if(c>0){for(let s=v-1;s>=0;s--)this.set(u+s+c,this.get(u+s));let i=u+v+c-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<v;i++)this.set(u+i+c,this.get(u+i))}}_getCyclicIndex(u){return(this._startIndex+u)%this._maxLength}}r.CircularList=o},1439:(y,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 d in h)o[d]=_<=1?h[d]:h[d]&&n(h[d],_-1);return o}},8055:(y,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 d,u,v,c,i;function s(t){let a=t.toString(16);return a.length<2?"0"+a:a}function e(t,a){return t<a?(a+.05)/(t+.05):(t+.05)/(a+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},function(t){t.toCss=function(a,p,f,g){return g!==void 0?`#${s(a)}${s(p)}${s(f)}${s(g)}`:`#${s(a)}${s(p)}${s(f)}`},t.toRgba=function(a,p,f,g=255){return(a<<24|p<<16|f<<8|g)>>>0},t.toColor=function(a,p,f,g){return{css:t.toCss(a,p,f,g),rgba:t.toRgba(a,p,f,g)}}}(d||(r.channels=d={})),function(t){function a(p,f){return o=Math.round(255*f),[n,h,_]=i.toChannels(p.rgba),{css:d.toCss(n,h,_,o),rgba:d.toRgba(n,h,_,o)}}t.blend=function(p,f){if(o=(255&f.rgba)/255,o===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,l=f.rgba>>16&255,m=f.rgba>>8&255,R=p.rgba>>24&255,D=p.rgba>>16&255,x=p.rgba>>8&255;return n=R+Math.round((g-R)*o),h=D+Math.round((l-D)*o),_=x+Math.round((m-x)*o),{css:d.toCss(n,h,_),rgba:d.toRgba(n,h,_)}},t.isOpaque=function(p){return(255&p.rgba)==255},t.ensureContrastRatio=function(p,f,g){let l=i.ensureContrastRatio(p.rgba,f.rgba,g);if(l)return d.toColor(l>>24&255,l>>16&255,l>>8&255)},t.opaque=function(p){let f=(255|p.rgba)>>>0;return[n,h,_]=i.toChannels(f),{css:d.toCss(n,h,_),rgba:f}},t.opacity=a,t.multiplyOpacity=function(p,f){return o=255&p.rgba,a(p,o*f/255)},t.toColorRGB=function(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}}(u||(r.color=u={})),function(t){let a,p;try{let f=document.createElement("canvas");f.width=1,f.height=1;let g=f.getContext("2d",{willReadFrequently:!0});g&&(a=g,a.globalCompositeOperation="copy",p=a.createLinearGradient(0,0,1,1))}catch{}t.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return n=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),_=parseInt(f.slice(3,4).repeat(2),16),d.toColor(n,h,_);case 5:return n=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),_=parseInt(f.slice(3,4).repeat(2),16),o=parseInt(f.slice(4,5).repeat(2),16),d.toColor(n,h,_,o);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}let g=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return n=parseInt(g[1]),h=parseInt(g[2]),_=parseInt(g[3]),o=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),d.toColor(n,h,_,o);if(!a||!p)throw new Error("css.toColor: Unsupported css format");if(a.fillStyle=p,a.fillStyle=f,typeof a.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(a.fillRect(0,0,1,1),[n,h,_,o]=a.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(n,h,_,o),css:f}}}(v||(r.css=v={})),function(t){function a(p,f,g){let l=p/255,m=f/255,R=g/255;return .2126*(l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))}t.relativeLuminance=function(p){return a(p>>16&255,p>>8&255,255&p)},t.relativeLuminance2=a}(c||(r.rgb=c={})),function(t){function a(f,g,l){let m=f>>24&255,R=f>>16&255,D=f>>8&255,x=g>>24&255,b=g>>16&255,O=g>>8&255,H=e(c.relativeLuminance2(x,b,O),c.relativeLuminance2(m,R,D));for(;H<l&&(x>0||b>0||O>0);)x-=Math.max(0,Math.ceil(.1*x)),b-=Math.max(0,Math.ceil(.1*b)),O-=Math.max(0,Math.ceil(.1*O)),H=e(c.relativeLuminance2(x,b,O),c.relativeLuminance2(m,R,D));return(x<<24|b<<16|O<<8|255)>>>0}function p(f,g,l){let m=f>>24&255,R=f>>16&255,D=f>>8&255,x=g>>24&255,b=g>>16&255,O=g>>8&255,H=e(c.relativeLuminance2(x,b,O),c.relativeLuminance2(m,R,D));for(;H<l&&(x<255||b<255||O<255);)x=Math.min(255,x+Math.ceil(.1*(255-x))),b=Math.min(255,b+Math.ceil(.1*(255-b))),O=Math.min(255,O+Math.ceil(.1*(255-O))),H=e(c.relativeLuminance2(x,b,O),c.relativeLuminance2(m,R,D));return(x<<24|b<<16|O<<8|255)>>>0}t.blend=function(f,g){if(o=(255&g)/255,o===1)return g;let l=g>>24&255,m=g>>16&255,R=g>>8&255,D=f>>24&255,x=f>>16&255,b=f>>8&255;return n=D+Math.round((l-D)*o),h=x+Math.round((m-x)*o),_=b+Math.round((R-b)*o),d.toRgba(n,h,_)},t.ensureContrastRatio=function(f,g,l){let m=c.relativeLuminance(f>>8),R=c.relativeLuminance(g>>8);if(e(m,R)<l){if(R<m){let b=a(f,g,l),O=e(m,c.relativeLuminance(b>>8));if(O<l){let H=p(f,g,l);return O>e(m,c.relativeLuminance(H>>8))?b:H}return b}let D=p(f,g,l),x=e(m,c.relativeLuminance(D>>8));if(x<l){let b=a(f,g,l);return x>e(m,c.relativeLuminance(b>>8))?D:b}return D}},t.reduceLuminance=a,t.increaseLuminance=p,t.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}}(i||(r.rgba=i={})),r.toPaddedHex=s,r.contrastRatio=e},8969:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let h=n(844),_=n(2585),o=n(4348),d=n(7866),u=n(744),v=n(7302),c=n(6975),i=n(8460),s=n(1753),e=n(1480),t=n(7994),a=n(9282),p=n(5435),f=n(5981),g=n(2660),l=!1;class m extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(D=>{this._onScrollApi?.fire(D.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(D){for(let x in D)this.optionsService.options[x]=D[x]}constructor(D){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new v.OptionsService(D)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(u.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.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(t.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new p.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(x=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(x=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new f.WriteBuffer((x,b)=>this._inputHandler.parse(x,b))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(D,x){this._writeBuffer.write(D,x)}writeSync(D,x){this._logService.logLevel<=_.LogLevelEnum.WARN&&!l&&(this._logService.warn("writeSync is unreliable and will be removed soon."),l=!0),this._writeBuffer.writeSync(D,x)}input(D,x=!0){this.coreService.triggerDataEvent(D,x)}resize(D,x){isNaN(D)||isNaN(x)||(D=Math.max(D,u.MINIMUM_COLS),x=Math.max(x,u.MINIMUM_ROWS),this._bufferService.resize(D,x))}scroll(D,x=!1){this._bufferService.scroll(D,x)}scrollLines(D,x,b){this._bufferService.scrollLines(D,x,b)}scrollPages(D){this.scrollLines(D*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(D){let x=D-this._bufferService.buffer.ydisp;x!==0&&this.scrollLines(x)}registerEscHandler(D,x){return this._inputHandler.registerEscHandler(D,x)}registerDcsHandler(D,x){return this._inputHandler.registerDcsHandler(D,x)}registerCsiHandler(D,x){return this._inputHandler.registerCsiHandler(D,x)}registerOscHandler(D,x){return this._inputHandler.registerOscHandler(D,x)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let D=!1,x=this.optionsService.rawOptions.windowsPty;x&&x.buildNumber!==void 0&&x.buildNumber!==void 0?D=x.backend==="conpty"&&x.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(D=!0),D?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let D=[];D.push(this.onLineFeed(a.updateWindowsModeWrappedState.bind(null,this._bufferService))),D.push(this.registerCsiHandler({final:"H"},()=>((0,a.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(let x of D)x.dispose()})}}}r.CoreTerminal=m},8460:(y,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(y,r,n){var h=this&&this.__decorate||function(W,S,w,k){var A,I=arguments.length,U=I<3?S:k===null?k=Object.getOwnPropertyDescriptor(S,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(W,S,w,k);else for(var K=W.length-1;K>=0;K--)(A=W[K])&&(U=(I<3?A(U):I>3?A(S,w,U):A(S,w))||U);return I>3&&U&&Object.defineProperty(S,w,U),U},_=this&&this.__param||function(W,S){return function(w,k){S(w,k,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let o=n(2584),d=n(7116),u=n(2015),v=n(844),c=n(482),i=n(8437),s=n(8460),e=n(643),t=n(511),a=n(3734),p=n(2585),f=n(1480),g=n(6242),l=n(6351),m=n(5941),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},D=131072;function x(W,S){if(W>24)return S.setWinLines||!1;switch(W){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var b;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(b||(r.WindowsOptionsReportType=b={}));let O=0;class H extends v.Disposable{getAttrData(){return this._curAttrData}constructor(S,w,k,A,I,U,K,q,B=new u.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=w,this._coreService=k,this._logService=A,this._optionsService=I,this._oscLinkService=U,this._coreMouseService=K,this._unicodeService=q,this._parser=B,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new t.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new N(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(C=>this._activeBuffer=C.activeBuffer)),this._parser.setCsiHandlerFallback((C,M)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(C),params:M.toArray()})}),this._parser.setEscHandlerFallback(C=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(C)})}),this._parser.setExecuteHandlerFallback(C=>{this._logService.debug("Unknown EXECUTE code: ",{code:C})}),this._parser.setOscHandlerFallback((C,M,F)=>{this._logService.debug("Unknown OSC code: ",{identifier:C,action:M,data:F})}),this._parser.setDcsHandlerFallback((C,M,F)=>{M==="HOOK"&&(F=F.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(C),action:M,payload:F})}),this._parser.setPrintHandler((C,M,F)=>this.print(C,M,F)),this._parser.registerCsiHandler({final:"@"},C=>this.insertChars(C)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},C=>this.scrollLeft(C)),this._parser.registerCsiHandler({final:"A"},C=>this.cursorUp(C)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},C=>this.scrollRight(C)),this._parser.registerCsiHandler({final:"B"},C=>this.cursorDown(C)),this._parser.registerCsiHandler({final:"C"},C=>this.cursorForward(C)),this._parser.registerCsiHandler({final:"D"},C=>this.cursorBackward(C)),this._parser.registerCsiHandler({final:"E"},C=>this.cursorNextLine(C)),this._parser.registerCsiHandler({final:"F"},C=>this.cursorPrecedingLine(C)),this._parser.registerCsiHandler({final:"G"},C=>this.cursorCharAbsolute(C)),this._parser.registerCsiHandler({final:"H"},C=>this.cursorPosition(C)),this._parser.registerCsiHandler({final:"I"},C=>this.cursorForwardTab(C)),this._parser.registerCsiHandler({final:"J"},C=>this.eraseInDisplay(C,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},C=>this.eraseInDisplay(C,!0)),this._parser.registerCsiHandler({final:"K"},C=>this.eraseInLine(C,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},C=>this.eraseInLine(C,!0)),this._parser.registerCsiHandler({final:"L"},C=>this.insertLines(C)),this._parser.registerCsiHandler({final:"M"},C=>this.deleteLines(C)),this._parser.registerCsiHandler({final:"P"},C=>this.deleteChars(C)),this._parser.registerCsiHandler({final:"S"},C=>this.scrollUp(C)),this._parser.registerCsiHandler({final:"T"},C=>this.scrollDown(C)),this._parser.registerCsiHandler({final:"X"},C=>this.eraseChars(C)),this._parser.registerCsiHandler({final:"Z"},C=>this.cursorBackwardTab(C)),this._parser.registerCsiHandler({final:"`"},C=>this.charPosAbsolute(C)),this._parser.registerCsiHandler({final:"a"},C=>this.hPositionRelative(C)),this._parser.registerCsiHandler({final:"b"},C=>this.repeatPrecedingCharacter(C)),this._parser.registerCsiHandler({final:"c"},C=>this.sendDeviceAttributesPrimary(C)),this._parser.registerCsiHandler({prefix:">",final:"c"},C=>this.sendDeviceAttributesSecondary(C)),this._parser.registerCsiHandler({final:"d"},C=>this.linePosAbsolute(C)),this._parser.registerCsiHandler({final:"e"},C=>this.vPositionRelative(C)),this._parser.registerCsiHandler({final:"f"},C=>this.hVPosition(C)),this._parser.registerCsiHandler({final:"g"},C=>this.tabClear(C)),this._parser.registerCsiHandler({final:"h"},C=>this.setMode(C)),this._parser.registerCsiHandler({prefix:"?",final:"h"},C=>this.setModePrivate(C)),this._parser.registerCsiHandler({final:"l"},C=>this.resetMode(C)),this._parser.registerCsiHandler({prefix:"?",final:"l"},C=>this.resetModePrivate(C)),this._parser.registerCsiHandler({final:"m"},C=>this.charAttributes(C)),this._parser.registerCsiHandler({final:"n"},C=>this.deviceStatus(C)),this._parser.registerCsiHandler({prefix:"?",final:"n"},C=>this.deviceStatusPrivate(C)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},C=>this.softReset(C)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},C=>this.setCursorStyle(C)),this._parser.registerCsiHandler({final:"r"},C=>this.setScrollRegion(C)),this._parser.registerCsiHandler({final:"s"},C=>this.saveCursor(C)),this._parser.registerCsiHandler({final:"t"},C=>this.windowOptions(C)),this._parser.registerCsiHandler({final:"u"},C=>this.restoreCursor(C)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},C=>this.insertColumns(C)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},C=>this.deleteColumns(C)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},C=>this.selectProtected(C)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},C=>this.requestMode(C,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},C=>this.requestMode(C,!1)),this._parser.setExecuteHandler(o.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(o.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(o.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(o.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(o.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(o.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(o.C1.IND,()=>this.index()),this._parser.setExecuteHandler(o.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(o.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new g.OscHandler(C=>(this.setTitle(C),this.setIconName(C),!0))),this._parser.registerOscHandler(1,new g.OscHandler(C=>this.setIconName(C))),this._parser.registerOscHandler(2,new g.OscHandler(C=>this.setTitle(C))),this._parser.registerOscHandler(4,new g.OscHandler(C=>this.setOrReportIndexedColor(C))),this._parser.registerOscHandler(8,new g.OscHandler(C=>this.setHyperlink(C))),this._parser.registerOscHandler(10,new g.OscHandler(C=>this.setOrReportFgColor(C))),this._parser.registerOscHandler(11,new g.OscHandler(C=>this.setOrReportBgColor(C))),this._parser.registerOscHandler(12,new g.OscHandler(C=>this.setOrReportCursorColor(C))),this._parser.registerOscHandler(104,new g.OscHandler(C=>this.restoreIndexedColor(C))),this._parser.registerOscHandler(110,new g.OscHandler(C=>this.restoreFgColor(C))),this._parser.registerOscHandler(111,new g.OscHandler(C=>this.restoreBgColor(C))),this._parser.registerOscHandler(112,new g.OscHandler(C=>this.restoreCursorColor(C))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let C in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:C},()=>this.selectCharset("("+C)),this._parser.registerEscHandler({intermediates:")",final:C},()=>this.selectCharset(")"+C)),this._parser.registerEscHandler({intermediates:"*",final:C},()=>this.selectCharset("*"+C)),this._parser.registerEscHandler({intermediates:"+",final:C},()=>this.selectCharset("+"+C)),this._parser.registerEscHandler({intermediates:"-",final:C},()=>this.selectCharset("-"+C)),this._parser.registerEscHandler({intermediates:".",final:C},()=>this.selectCharset("."+C)),this._parser.registerEscHandler({intermediates:"/",final:C},()=>this.selectCharset("/"+C));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(C=>(this._logService.error("Parsing error: ",C),C)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new l.DcsHandler((C,M)=>this.requestStatusString(C,M)))}_preserveStack(S,w,k,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=w,this._parseStack.decodedLength=k,this._parseStack.position=A}_logSlowResolvingAsync(S){this._logService.logLevel<=p.LogLevelEnum.WARN&&Promise.race([S,new Promise((w,k)=>setTimeout(()=>k("#SLOW_TIMEOUT"),5e3))]).catch(w=>{if(w!=="#SLOW_TIMEOUT")throw w;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,w){let k,A=this._activeBuffer.x,I=this._activeBuffer.y,U=0,K=this._parseStack.paused;if(K){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,w))return this._logSlowResolvingAsync(k),k;A=this._parseStack.cursorStartX,I=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>D&&(U=this._parseStack.position+D)}if(this._logService.logLevel<=p.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof S=="string"?` "${S}"`:` "${Array.prototype.map.call(S,C=>String.fromCharCode(C)).join("")}"`),typeof S=="string"?S.split("").map(C=>C.charCodeAt(0)):S),this._parseBuffer.length<S.length&&this._parseBuffer.length<D&&(this._parseBuffer=new Uint32Array(Math.min(S.length,D))),K||this._dirtyRowTracker.clearRange(),S.length>D)for(let C=U;C<S.length;C+=D){let M=C+D<S.length?C+D:S.length,F=typeof S=="string"?this._stringDecoder.decode(S.substring(C,M),this._parseBuffer):this._utf8Decoder.decode(S.subarray(C,M),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,F))return this._preserveStack(A,I,F,C),this._logSlowResolvingAsync(k),k}else if(!K){let C=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,C))return this._preserveStack(A,I,C,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===A&&this._activeBuffer.y===I||this._onCursorMove.fire();let q=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),B=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);B<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(B,this._bufferService.rows-1),Math.min(q,this._bufferService.rows-1))}print(S,w,k){let A,I,U=this._charsetService.charset,K=this._optionsService.rawOptions.screenReaderMode,q=this._bufferService.cols,B=this._coreService.decPrivateModes.wraparound,C=this._coreService.modes.insertMode,M=this._curAttrData,F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-w>0&&F.getWidth(this._activeBuffer.x-1)===2&&F.setCellFromCodepoint(this._activeBuffer.x-1,0,1,M);let $=this._parser.precedingJoinState;for(let j=w;j<k;++j){if(A=S[j],A<127&&U){let ee=U[String.fromCharCode(A)];ee&&(A=ee.charCodeAt(0))}let G=this._unicodeService.charProperties(A,$);I=f.UnicodeService.extractWidth(G);let J=f.UnicodeService.extractShouldJoin(G),Z=J?f.UnicodeService.extractWidth($):0;if($=G,K&&this._onA11yChar.fire((0,c.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+I-Z>q){if(B){let ee=F,V=this._activeBuffer.x-Z;for(this._activeBuffer.x=Z,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Z>0&&F instanceof i.BufferLine&&F.copyCellsFrom(ee,V,0,Z,!1);V<q;)ee.setCellFromCodepoint(V++,0,1,M)}else if(this._activeBuffer.x=q-1,I===2)continue}if(J&&this._activeBuffer.x){let ee=F.getWidth(this._activeBuffer.x-1)?1:2;F.addCodepointToCell(this._activeBuffer.x-ee,A,I);for(let V=I-Z;--V>=0;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,M)}else if(C&&(F.insertCells(this._activeBuffer.x,I-Z,this._activeBuffer.getNullCell(M)),F.getWidth(q-1)===2&&F.setCellFromCodepoint(q-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,M)),F.setCellFromCodepoint(this._activeBuffer.x++,A,I,M),I>0)for(;--I;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,M)}this._parser.precedingJoinState=$,this._activeBuffer.x<q&&k-w>0&&F.getWidth(this._activeBuffer.x)===0&&!F.hasContent(this._activeBuffer.x)&&F.setCellFromCodepoint(this._activeBuffer.x,0,1,M),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,w){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,w):this._parser.registerCsiHandler(S,k=>!x(k.params[0],this._optionsService.rawOptions.windowOptions)||w(k))}registerDcsHandler(S,w){return this._parser.registerDcsHandler(S,new l.DcsHandler(w))}registerEscHandler(S,w){return this._parser.registerEscHandler(S,w)}registerOscHandler(S,w){return this._parser.registerOscHandler(S,new g.OscHandler(w))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);S.hasWidth(this._activeBuffer.x)&&!S.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-S),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(S=this._bufferService.cols-1){this._activeBuffer.x=Math.min(S,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(S,w){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+w):(this._activeBuffer.x=S,this._activeBuffer.y=w),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,w){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+w)}cursorUp(S){let w=this._activeBuffer.y-this._activeBuffer.scrollTop;return w>=0?this._moveCursor(0,-Math.min(w,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){let w=this._activeBuffer.scrollBottom-this._activeBuffer.y;return w>=0?this._moveCursor(0,Math.min(w,S.params[0]||1)):this._moveCursor(0,S.params[0]||1),!0}cursorForward(S){return this._moveCursor(S.params[0]||1,0),!0}cursorBackward(S){return this._moveCursor(-(S.params[0]||1),0),!0}cursorNextLine(S){return this.cursorDown(S),this._activeBuffer.x=0,!0}cursorPrecedingLine(S){return this.cursorUp(S),this._activeBuffer.x=0,!0}cursorCharAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(S){return this._setCursor(S.length>=2?(S.params[1]||1)-1:0,(S.params[0]||1)-1),!0}charPosAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(S){return this._moveCursor(S.params[0]||1,0),!0}linePosAbsolute(S){return this._setCursor(this._activeBuffer.x,(S.params[0]||1)-1),!0}vPositionRelative(S){return this._moveCursor(0,S.params[0]||1),!0}hVPosition(S){return this.cursorPosition(S),!0}tabClear(S){let w=S.params[0];return w===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:w===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=S.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=S.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){let w=S.params[0];return w===1&&(this._curAttrData.bg|=536870912),w!==2&&w!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,w,k,A=!1,I=!1){let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);U.replaceCells(w,k,this._activeBuffer.getNullCell(this._eraseAttrData()),I),A&&(U.isWrapped=!1)}_resetBufferLine(S,w=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),w),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),k.isWrapped=!1)}eraseInDisplay(S,w=!1){let k;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);k<this._bufferService.rows;k++)this._resetBufferLine(k,w);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,w),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,w);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,w);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(S,w=!1){switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,w);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,w)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(S){this._restrictCursor();let w=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,I=this._bufferService.rows-1+this._activeBuffer.ybase-A+1;for(;w--;)this._activeBuffer.lines.splice(I-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(S){this._restrictCursor();let w=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A;for(A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,A=this._bufferService.rows-1+this._activeBuffer.ybase-A;w--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(S){this._restrictCursor();let w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.insertCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(S){this._restrictCursor();let w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.deleteCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(S){let w=S.params[0]||1;for(;w--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(S){let w=S.params[0]||1;for(;w--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let w=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let w=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let w=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let w=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();let w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(S.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(S){let w=this._parser.precedingJoinState;if(!w)return!0;let k=S.params[0]||1,A=f.UnicodeService.extractWidth(w),I=this._activeBuffer.x-A,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(I),K=new Uint32Array(U.length*k),q=0;for(let C=0;C<U.length;){let M=U.codePointAt(C)||0;K[q++]=M,C+=M>65535?2:1}let B=q;for(let C=1;C<k;++C)K.copyWithin(B,0,q),B+=q;return this.print(K,0,B),!0}sendDeviceAttributesPrimary(S){return S.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(S){return S.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(S.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(S){return(this._optionsService.rawOptions.termName+"").indexOf(S)===0}setMode(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),S.params[w]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(S,w){let k=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:I}=this._coreMouseService,U=this._coreService,{buffers:K,cols:q}=this._bufferService,{active:B,alt:C}=K,M=this._optionsService.rawOptions,F=J=>J?1:2,$=S.params[0];return j=$,G=w?$===2?4:$===4?F(U.modes.insertMode):$===12?3:$===20?F(M.convertEol):0:$===1?F(k.applicationCursorKeys):$===3?M.windowOptions.setWinLines?q===80?2:q===132?1:0:0:$===6?F(k.origin):$===7?F(k.wraparound):$===8?3:$===9?F(A==="X10"):$===12?F(M.cursorBlink):$===25?F(!U.isCursorHidden):$===45?F(k.reverseWraparound):$===66?F(k.applicationKeypad):$===67?4:$===1e3?F(A==="VT200"):$===1002?F(A==="DRAG"):$===1003?F(A==="ANY"):$===1004?F(k.sendFocus):$===1005?4:$===1006?F(I==="SGR"):$===1015?4:$===1016?F(I==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?F(B===C):$===2004?F(k.bracketedPasteMode):0,U.triggerDataEvent(`${o.C0.ESC}[${w?"":"?"}${j};${G}$y`),!0;var j,G}_updateAttrColor(S,w,k,A,I){return w===2?(S|=50331648,S&=-16777216,S|=a.AttributeData.fromColorRGB([k,A,I])):w===5&&(S&=-50331904,S|=33554432|255&k),S}_extractColor(S,w,k){let A=[0,0,-1,0,0,0],I=0,U=0;do{if(A[U+I]=S.params[w+U],S.hasSubParams(w+U)){let K=S.getSubParams(w+U),q=0;do A[1]===5&&(I=1),A[U+q+1+I]=K[q];while(++q<K.length&&q+U+1+I<A.length);break}if(A[1]===5&&U+I>=2||A[1]===2&&U+I>=5)break;A[1]&&(I=1)}while(++U+w<S.length&&U+I<A.length);for(let K=2;K<A.length;++K)A[K]===-1&&(A[K]=0);switch(A[0]){case 38:k.fg=this._updateAttrColor(k.fg,A[1],A[3],A[4],A[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,A[1],A[3],A[4],A[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,A[1],A[3],A[4],A[5])}return U}_processUnderline(S,w){w.extended=w.extended.clone(),(!~S||S>5)&&(S=1),w.extended.underlineStyle=S,w.fg|=268435456,S===0&&(w.fg&=-268435457),w.updateExtended()}_processSGR0(S){S.fg=i.DEFAULT_ATTR_DATA.fg,S.bg=i.DEFAULT_ATTR_DATA.bg,S.extended=S.extended.clone(),S.extended.underlineStyle=0,S.extended.underlineColor&=-67108864,S.updateExtended()}charAttributes(S){if(S.length===1&&S.params[0]===0)return this._processSGR0(this._curAttrData),!0;let w=S.length,k,A=this._curAttrData;for(let I=0;I<w;I++)k=S.params[I],k>=30&&k<=37?(A.fg&=-50331904,A.fg|=16777216|k-30):k>=40&&k<=47?(A.bg&=-50331904,A.bg|=16777216|k-40):k>=90&&k<=97?(A.fg&=-50331904,A.fg|=16777224|k-90):k>=100&&k<=107?(A.bg&=-50331904,A.bg|=16777224|k-100):k===0?this._processSGR0(A):k===1?A.fg|=134217728:k===3?A.bg|=67108864:k===4?(A.fg|=268435456,this._processUnderline(S.hasSubParams(I)?S.getSubParams(I)[0]:1,A)):k===5?A.fg|=536870912:k===7?A.fg|=67108864:k===8?A.fg|=1073741824:k===9?A.fg|=2147483648:k===2?A.bg|=134217728:k===21?this._processUnderline(2,A):k===22?(A.fg&=-134217729,A.bg&=-134217729):k===23?A.bg&=-67108865:k===24?(A.fg&=-268435457,this._processUnderline(0,A)):k===25?A.fg&=-536870913:k===27?A.fg&=-67108865:k===28?A.fg&=-1073741825:k===29?A.fg&=2147483647:k===39?(A.fg&=-67108864,A.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):k===49?(A.bg&=-67108864,A.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?I+=this._extractColor(S,I,A):k===53?A.bg|=1073741824:k===55?A.bg&=-1073741825:k===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):k===100?(A.fg&=-67108864,A.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let w=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${w};${k}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){let w=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${w};${k}R`)}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(S){let w=S.params[0]||1;switch(w){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let k=w%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(S){let w=S.params[0]||1,k;return(S.length<2||(k=S.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>w&&(this._activeBuffer.scrollTop=w-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(S){if(!x(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;let w=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:w!==2&&this._onRequestWindowsOptionsReport.fire(b.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(b.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:w!==0&&w!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),w!==0&&w!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:w!==0&&w!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),w!==0&&w!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(S){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(S){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(S){return this._windowTitle=S,this._onTitleChange.fire(S),!0}setIconName(S){return this._iconName=S,!0}setOrReportIndexedColor(S){let w=[],k=S.split(";");for(;k.length>1;){let A=k.shift(),I=k.shift();if(/^\d+$/.exec(A)){let U=parseInt(A);if(z(U))if(I==="?")w.push({type:0,index:U});else{let K=(0,m.parseColor)(I);K&&w.push({type:1,index:U,color:K})}}}return w.length&&this._onColor.fire(w),!0}setHyperlink(S){let w=S.split(";");return!(w.length<2)&&(w[1]?this._createHyperlink(w[0],w[1]):!w[0]&&this._finishHyperlink())}_createHyperlink(S,w){this._getCurrentLinkId()&&this._finishHyperlink();let k=S.split(":"),A,I=k.findIndex(U=>U.startsWith("id="));return I!==-1&&(A=k[I].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:w}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(S,w){let k=S.split(";");for(let A=0;A<k.length&&!(w>=this._specialColors.length);++A,++w)if(k[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[w]}]);else{let I=(0,m.parseColor)(k[A]);I&&this._onColor.fire([{type:1,index:this._specialColors[w],color:I}])}return!0}setOrReportFgColor(S){return this._setOrReportSpecialColor(S,0)}setOrReportBgColor(S){return this._setOrReportSpecialColor(S,1)}setOrReportCursorColor(S){return this._setOrReportSpecialColor(S,2)}restoreIndexedColor(S){if(!S)return this._onColor.fire([{type:2}]),!0;let w=[],k=S.split(";");for(let A=0;A<k.length;++A)if(/^\d+$/.exec(k[A])){let I=parseInt(k[A]);z(I)&&w.push({type:2,index:I})}return w.length&&this._onColor.fire(w),!0}restoreFgColor(S){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(S){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(S){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),!0}selectCharset(S){return S.length!==2?(this.selectDefaultCharset(),!0):(S[0]==="/"||this._charsetService.setgCharset(R[S[0]],d.CHARSETS[S[1]]||d.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let S=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,S,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(S){return this._charsetService.setgLevel(S),!0}screenAlignmentPattern(){let S=new t.CellData;S.content=4194373,S.fg=this._curAttrData.fg,S.bg=this._curAttrData.bg,this._setCursor(0,0);for(let w=0;w<this._bufferService.rows;++w){let k=this._activeBuffer.ybase+this._activeBuffer.y+w,A=this._activeBuffer.lines.get(k);A&&(A.fill(S),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,w){let k=this._bufferService.buffer,A=this._optionsService.rawOptions;return(I=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${I}${o.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:S==="m"?"P1$r0m":S===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(S,w){this._dirtyRowTracker.markRangeDirty(S,w)}}r.InputHandler=H;let N=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,S){W>S&&(O=W,W=S,S=O),W<this.start&&(this.start=W),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function z(W){return 0<=W&&W<256}N=h([_(0,p.IBufferService)],N)},844:(y,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:(y,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(_,o,d){this._data[_]||(this._data[_]={}),this._data[_][o]=d}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,d,u){this._data.get(h,_)||this._data.set(h,_,new n),this._data.get(h,_).set(o,d,u)}get(h,_,o,d){return this._data.get(h,_)?.get(o,d)}clear(){this._data.clear()}}},6114:(y,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:(y,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 d=_+o>>1,u=this._getKey(this._array[d]);if(u>h)o=d-1;else{if(!(u<h)){for(;d>0&&this._getKey(this._array[d-1])===h;)d--;return d}_=d+1}}return _}}},7226:(y,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(u){this._tasks.push(u),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(u){this._idleCallback=void 0;let v=0,c=0,i=u.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),c=Math.max(v,c),s=u.timeRemaining(),1.5*c>s)return i-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-v))}ms`),void this._start();i=s}this.clear()}}class o extends _{_requestCallback(u){return setTimeout(()=>u(this._createDeadline(16)))}_cancelCallback(u){clearTimeout(u)}_createDeadline(u){let v=Date.now()+u;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(y,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),d=o?.get(_.cols-1),u=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);u&&d&&(u.isWrapped=d[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&d[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(y,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,d=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=d}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(y,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),d=n(8437),u=n(4634),v=n(511),c=n(643),i=n(4863),s=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,t,a){this._hasScrollback=e,this._optionsService=t,this._bufferService=a,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.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,t){return new d.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=d.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let a=this.getNullCell(d.DEFAULT_ATTR_DATA),p=0,f=this._getCorrectBufferLength(t);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)p+=+this.lines.get(l).resize(e,a);let g=0;if(this._rows<t)for(let l=this._rows;l<t;l++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(e,a)):this.ybase>0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(e,a)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){let l=this.lines.length-f;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=f}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),g&&(this.y+=g),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let g=0;g<this.lines.length;g++)p+=+this.lines.get(g).resize(e,a);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),p>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let a=(0,u.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(a.length>0){let p=(0,u.reflowLargerCreateNewLayout)(this.lines,a);(0,u.reflowLargerApplyNewLayout)(this.lines,p.layout),this._reflowLargerAdjustViewport(e,t,p.countRemoved)}}_reflowLargerAdjustViewport(e,t,a){let p=this.getNullCell(d.DEFAULT_ATTR_DATA),f=a;for(;f-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new d.BufferLine(e,p))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-a,0)}_reflowSmaller(e,t){let a=this.getNullCell(d.DEFAULT_ATTR_DATA),p=[],f=0;for(let g=this.lines.length-1;g>=0;g--){let l=this.lines.get(g);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let m=[l];for(;l.isWrapped&&g>0;)l=this.lines.get(--g),m.unshift(l);let R=this.ybase+this.y;if(R>=g&&R<g+m.length)continue;let D=m[m.length-1].getTrimmedLength(),x=(0,u.reflowSmallerGetNewLineLengths)(m,this._cols,e),b=x.length-m.length,O;O=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+b):Math.max(0,this.lines.length-this.lines.maxLength+b);let H=[];for(let k=0;k<b;k++){let A=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);H.push(A)}H.length>0&&(p.push({start:g+m.length+f,newLines:H}),f+=H.length),m.push(...H);let N=x.length-1,z=x[N];z===0&&(N--,z=x[N]);let W=m.length-b-1,S=D;for(;W>=0;){let k=Math.min(S,z);if(m[N]===void 0)break;if(m[N].copyCellsFrom(m[W],S-k,z-k,k,!0),z-=k,z===0&&(N--,z=x[N]),S-=k,S===0){W--;let A=Math.max(W,0);S=(0,u.getWrappedLineTrimmedLength)(m,A,this._cols)}}for(let k=0;k<m.length;k++)x[k]<e&&m[k].setCell(x[k],a);let w=b-O;for(;w-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+f)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+b,this.ybase+t-1)}if(p.length>0){let g=[],l=[];for(let N=0;N<this.lines.length;N++)l.push(this.lines.get(N));let m=this.lines.length,R=m-1,D=0,x=p[D];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+f);let b=0;for(let N=Math.min(this.lines.maxLength-1,m+f-1);N>=0;N--)if(x&&x.start>R+b){for(let z=x.newLines.length-1;z>=0;z--)this.lines.set(N--,x.newLines[z]);N++,g.push({index:R+1,amount:x.newLines.length}),b+=x.newLines.length,x=p[++D]}else this.lines.set(N,l[R--]);let O=0;for(let N=g.length-1;N>=0;N--)g[N].index+=O,this.lines.onInsertEmitter.fire(g[N]),O+=g[N].amount;let H=Math.max(0,m+f-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(e,t,a=0,p){let f=this.lines.get(e);return f?f.translateToString(t,a,p):""}getWrappedRangeForLine(e){let t=e,a=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;a+1<this.lines.length&&this.lines.get(a+1).isWrapped;)a++;return{first:t,last:a}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new i.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim(a=>{t.line-=a,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(a=>{t.line>=a.index&&(t.line+=a.amount)})),t.register(this.lines.onDelete(a=>{t.line>=a.index&&t.line<a.index+a.amount&&t.dispose(),t.line>a.index&&(t.line-=a.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(y,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),d=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let u=0;class v{constructor(i,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let t=s||_.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let a=0;a<i;++a)this.setCell(a,t);this.length=i}get(i){let s=this._data[3*i+0],e=2097151&s;return[this._data[3*i+1],2097152&s?this._combined[i]:e?(0,d.stringFromCodePoint)(e):"",s>>22,2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,s){this._data[3*i+1]=s[o.CHAR_DATA_ATTR_INDEX],s[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=s[1],this._data[3*i+0]=2097152|i|s[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=s[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&s}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i]:2097151&s?(0,d.stringFromCodePoint)(2097151&s):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,s){return u=3*i,s.content=this._data[u+0],s.fg=this._data[u+1],s.bg=this._data[u+2],2097152&s.content&&(s.combinedData=this._combined[i]),268435456&s.bg&&(s.extended=this._extendedAttrs[i]),s}setCell(i,s){2097152&s.content&&(this._combined[i]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=s.content,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}setCellFromCodepoint(i,s,e,t){268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=s|e<<22,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}addCodepointToCell(i,s,e){let t=this._data[3*i+0];2097152&t?this._combined[i]+=(0,d.stringFromCodePoint)(s):2097151&t?(this._combined[i]=(0,d.stringFromCodePoint)(2097151&t)+(0,d.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,e&&(t&=-12582913,t|=e<<22),this._data[3*i+0]=t}insertCells(i,s,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length-i){let t=new _.CellData;for(let a=this.length-i-s-1;a>=0;--a)this.setCell(i+s+a,this.loadCell(i+a,t));for(let a=0;a<s;++a)this.setCell(i+a,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,s,e){if(i%=this.length,s<this.length-i){let t=new _.CellData;for(let a=0;a<this.length-i-s;++a)this.setCell(i+a,this.loadCell(i+s+a,t));for(let a=this.length-s;a<this.length;++a)this.setCell(a,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,s,e,t=!1){if(t)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.setCell(i++,e)}resize(i,s){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let t=new Uint32Array(e);t.set(this._data),this._data=t}for(let t=this.length;t<i;++t)this.setCell(t,s)}else{this._data=this._data.subarray(0,e);let t=Object.keys(this._combined);for(let p=0;p<t.length;p++){let f=parseInt(t[p],10);f>=i&&delete this._combined[f]}let a=Object.keys(this._extendedAttrs);for(let p=0;p<a.length;p++){let f=parseInt(a[p],10);f>=i&&delete this._extendedAttrs[f]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,s=!1){if(s)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let s in i._combined)this._combined[s]=i._combined[s];this._extendedAttrs={};for(let s in i._extendedAttrs)this._extendedAttrs[s]=i._extendedAttrs[s];this.isWrapped=i.isWrapped}clone(){let i=new v(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let s in this._combined)i._combined[s]=this._combined[s];for(let s in this._extendedAttrs)i._extendedAttrs[s]=this._extendedAttrs[s];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,s,e,t,a){let p=i._data;if(a)for(let g=t-1;g>=0;g--){for(let l=0;l<3;l++)this._data[3*(e+g)+l]=p[3*(s+g)+l];268435456&p[3*(s+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[s+g])}else for(let g=0;g<t;g++){for(let l=0;l<3;l++)this._data[3*(e+g)+l]=p[3*(s+g)+l];268435456&p[3*(s+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[s+g])}let f=Object.keys(i._combined);for(let g=0;g<f.length;g++){let l=parseInt(f[g],10);l>=s&&(this._combined[l-s+e]=i._combined[l])}}translateToString(i,s,e,t){s=s??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),t&&(t.length=0);let a="";for(;s<e;){let p=this._data[3*s+0],f=2097151&p,g=2097152&p?this._combined[s]:f?(0,d.stringFromCodePoint)(f):o.WHITESPACE_CELL_CHAR;if(a+=g,t)for(let l=0;l<g.length;++l)t.push(s);s+=p>>22||1}return t&&t.push(s),a}}r.BufferLine=v},4841:(y,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:(y,r)=>{function n(h,_,o){if(_===h.length-1)return h[_].getTrimmedLength();let d=!h[_].hasContent(o-1)&&h[_].getWidth(o-1)===1,u=h[_+1].getWidth(0)===2;return d&&u?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,d,u){let v=[];for(let c=0;c<h.length-1;c++){let i=c,s=h.get(++i);if(!s.isWrapped)continue;let e=[h.get(c)];for(;i<h.length&&s.isWrapped;)e.push(s),s=h.get(++i);if(d>=c&&d<i){c+=e.length-1;continue}let t=0,a=n(e,t,_),p=1,f=0;for(;p<e.length;){let l=n(e,p,_),m=l-f,R=o-a,D=Math.min(m,R);e[t].copyCellsFrom(e[p],f,a,D,!1),a+=D,a===o&&(t++,a=0),f+=D,f===l&&(p++,f=0),a===0&&t!==0&&e[t-1].getWidth(o-1)===2&&(e[t].copyCellsFrom(e[t-1],o-1,a++,1,!1),e[t-1].setCell(o-1,u))}e[t].replaceCells(a,o,u);let g=0;for(let l=e.length-1;l>0&&(l>t||e[l].getTrimmedLength()===0);l--)g++;g>0&&(v.push(c+e.length-g),v.push(g)),c+=e.length-1}return v},r.reflowLargerCreateNewLayout=function(h,_){let o=[],d=0,u=_[d],v=0;for(let c=0;c<h.length;c++)if(u===c){let i=_[++d];h.onDeleteEmitter.fire({index:c-v,amount:i}),c+=i-1,v+=i,u=_[++d]}else o.push(c);return{layout:o,countRemoved:v}},r.reflowLargerApplyNewLayout=function(h,_){let o=[];for(let d=0;d<_.length;d++)o.push(h.get(_[d]));for(let d=0;d<o.length;d++)h.set(d,o[d]);h.length=_.length},r.reflowSmallerGetNewLineLengths=function(h,_,o){let d=[],u=h.map((s,e)=>n(h,e,_)).reduce((s,e)=>s+e),v=0,c=0,i=0;for(;i<u;){if(u-i<o){d.push(u-i);break}v+=o;let s=n(h,c,_);v>s&&(v-=s,c++);let e=h[c].getWidth(v-1)===2;e&&v--;let t=e?o-1:o;d.push(t),i+=t}return d},r.getWrappedLineTrimmedLength=n},5295:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let h=n(8460),_=n(844),o=n(9092);class d extends _.Disposable{constructor(v,c){super(),this._optionsService=v,this._bufferService=c,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(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(v,c){this._normal.resize(v,c),this._alt.resize(v,c),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}r.BufferSet=d},511:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let h=n(482),_=n(643),o=n(3734);class d extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(v){let c=new d;return c.setFromCharData(v),c}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(v){this.fg=v[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let c=!1;if(v[_.CHAR_DATA_CHAR_INDEX].length>2)c=!0;else if(v[_.CHAR_DATA_CHAR_INDEX].length===2){let i=v[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let s=v[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|v[_.CHAR_DATA_WIDTH_INDEX]<<22:c=!0}else c=!0}else this.content=v[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[_.CHAR_DATA_WIDTH_INDEX]<<22;c&&(this.combinedData=v[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=d},643:(y,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:(y,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(u){this.line=u,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(u){return this._disposables.push(u),u}}r.Marker=o,o._nextId=1},7116:(y,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:(y,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=`
`,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:(y,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,d,u,v){let c={type:0,cancel:!1,key:void 0},i=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?c.key=d?h.C0.ESC+"OA":h.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?c.key=d?h.C0.ESC+"OD":h.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?c.key=d?h.C0.ESC+"OC":h.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(c.key=d?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:c.key=o.ctrlKey?"\b":h.C0.DEL,o.altKey&&(c.key=h.C0.ESC+c.key);break;case 9:if(o.shiftKey){c.key=h.C0.ESC+"[Z";break}c.key=h.C0.HT,c.cancel=!0;break;case 13:c.key=o.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,c.cancel=!0;break;case 27:c.key=h.C0.ESC,o.altKey&&(c.key=h.C0.ESC+h.C0.ESC),c.cancel=!0;break;case 37:if(o.metaKey)break;i?(c.key=h.C0.ESC+"[1;"+(i+1)+"D",c.key===h.C0.ESC+"[1;3D"&&(c.key=h.C0.ESC+(u?"b":"[1;5D"))):c.key=d?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(o.metaKey)break;i?(c.key=h.C0.ESC+"[1;"+(i+1)+"C",c.key===h.C0.ESC+"[1;3C"&&(c.key=h.C0.ESC+(u?"f":"[1;5C"))):c.key=d?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(o.metaKey)break;i?(c.key=h.C0.ESC+"[1;"+(i+1)+"A",u||c.key!==h.C0.ESC+"[1;3A"||(c.key=h.C0.ESC+"[1;5A")):c.key=d?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(o.metaKey)break;i?(c.key=h.C0.ESC+"[1;"+(i+1)+"B",u||c.key!==h.C0.ESC+"[1;3B"||(c.key=h.C0.ESC+"[1;5B")):c.key=d?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(c.key=h.C0.ESC+"[2~");break;case 46:c.key=i?h.C0.ESC+"[3;"+(i+1)+"~":h.C0.ESC+"[3~";break;case 36:c.key=i?h.C0.ESC+"[1;"+(i+1)+"H":d?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:c.key=i?h.C0.ESC+"[1;"+(i+1)+"F":d?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:o.shiftKey?c.type=2:o.ctrlKey?c.key=h.C0.ESC+"[5;"+(i+1)+"~":c.key=h.C0.ESC+"[5~";break;case 34:o.shiftKey?c.type=3:o.ctrlKey?c.key=h.C0.ESC+"[6;"+(i+1)+"~":c.key=h.C0.ESC+"[6~";break;case 112:c.key=i?h.C0.ESC+"[1;"+(i+1)+"P":h.C0.ESC+"OP";break;case 113:c.key=i?h.C0.ESC+"[1;"+(i+1)+"Q":h.C0.ESC+"OQ";break;case 114:c.key=i?h.C0.ESC+"[1;"+(i+1)+"R":h.C0.ESC+"OR";break;case 115:c.key=i?h.C0.ESC+"[1;"+(i+1)+"S":h.C0.ESC+"OS";break;case 116:c.key=i?h.C0.ESC+"[15;"+(i+1)+"~":h.C0.ESC+"[15~";break;case 117:c.key=i?h.C0.ESC+"[17;"+(i+1)+"~":h.C0.ESC+"[17~";break;case 118:c.key=i?h.C0.ESC+"[18;"+(i+1)+"~":h.C0.ESC+"[18~";break;case 119:c.key=i?h.C0.ESC+"[19;"+(i+1)+"~":h.C0.ESC+"[19~";break;case 120:c.key=i?h.C0.ESC+"[20;"+(i+1)+"~":h.C0.ESC+"[20~";break;case 121:c.key=i?h.C0.ESC+"[21;"+(i+1)+"~":h.C0.ESC+"[21~";break;case 122:c.key=i?h.C0.ESC+"[23;"+(i+1)+"~":h.C0.ESC+"[23~";break;case 123:c.key=i?h.C0.ESC+"[24;"+(i+1)+"~":h.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(u&&!v||!o.altKey||o.metaKey)!u||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?c.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(c.key=h.C0.US),o.key==="@"&&(c.key=h.C0.NUL)):o.keyCode===65&&(c.type=1);else{let s=_[o.keyCode],e=s?.[o.shiftKey?1:0];if(e)c.key=h.C0.ESC+e;else if(o.keyCode>=65&&o.keyCode<=90){let t=o.ctrlKey?o.keyCode-64:o.keyCode+32,a=String.fromCharCode(t);o.shiftKey&&(a=a.toUpperCase()),c.key=h.C0.ESC+a}else if(o.keyCode===32)c.key=h.C0.ESC+(o.ctrlKey?h.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let t=o.code.slice(3,4);o.shiftKey||(t=t.toLowerCase()),c.key=h.C0.ESC+t,c.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?c.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?c.key=h.C0.NUL:o.keyCode>=51&&o.keyCode<=55?c.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?c.key=h.C0.DEL:o.keyCode===219?c.key=h.C0.ESC:o.keyCode===220?c.key=h.C0.FS:o.keyCode===221&&(c.key=h.C0.GS)}return c}},482:(y,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 d=h;d<_;++d){let u=n[d];u>65535?(u-=65536,o+=String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):o+=String.fromCharCode(u)}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,d=0;if(this._interim){let u=n.charCodeAt(d++);56320<=u&&u<=57343?h[o++]=1024*(this._interim-55296)+u-56320+65536:(h[o++]=this._interim,h[o++]=u),this._interim=0}for(let u=d;u<_;++u){let v=n.charCodeAt(u);if(55296<=v&&v<=56319){if(++u>=_)return this._interim=v,o;let c=n.charCodeAt(u);56320<=c&&c<=57343?h[o++]=1024*(v-55296)+c-56320+65536:(h[o++]=v,h[o++]=c)}else v!==65279&&(h[o++]=v)}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,d,u,v,c=0,i=0,s=0;if(this.interim[0]){let a=!1,p=this.interim[0];p&=(224&p)==192?31:(240&p)==224?15:7;let f,g=0;for(;(f=63&this.interim[++g])&&g<4;)p<<=6,p|=f;let l=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=l-g;for(;s<m;){if(s>=_)return 0;if(f=n[s++],(192&f)!=128){s--,a=!0;break}this.interim[g++]=f,p<<=6,p|=63&f}a||(l===2?p<128?s--:h[c++]=p:l===3?p<2048||p>=55296&&p<=57343||p===65279||(h[c++]=p):p<65536||p>1114111||(h[c++]=p)),this.interim.fill(0)}let e=_-4,t=s;for(;t<_;){for(;!(!(t<e)||128&(o=n[t])||128&(d=n[t+1])||128&(u=n[t+2])||128&(v=n[t+3]));)h[c++]=o,h[c++]=d,h[c++]=u,h[c++]=v,t+=4;if(o=n[t++],o<128)h[c++]=o;else if((224&o)==192){if(t>=_)return this.interim[0]=o,c;if(d=n[t++],(192&d)!=128){t--;continue}if(i=(31&o)<<6|63&d,i<128){t--;continue}h[c++]=i}else if((240&o)==224){if(t>=_)return this.interim[0]=o,c;if(d=n[t++],(192&d)!=128){t--;continue}if(t>=_)return this.interim[0]=o,this.interim[1]=d,c;if(u=n[t++],(192&u)!=128){t--;continue}if(i=(15&o)<<12|(63&d)<<6|63&u,i<2048||i>=55296&&i<=57343||i===65279)continue;h[c++]=i}else if((248&o)==240){if(t>=_)return this.interim[0]=o,c;if(d=n[t++],(192&d)!=128){t--;continue}if(t>=_)return this.interim[0]=o,this.interim[1]=d,c;if(u=n[t++],(192&u)!=128){t--;continue}if(t>=_)return this.interim[0]=o,this.interim[1]=d,this.interim[2]=u,c;if(v=n[t++],(192&v)!=128){t--;continue}if(i=(7&o)<<18|(63&d)<<12|(63&u)<<6|63&v,i<65536||i>1114111)continue;h[c++]=i}}return c}}},225:(y,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]],d;r.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let u=0;u<_.length;++u)d.fill(0,_[u][0],_[u][1]+1)}}wcwidth(u){return u<32?0:u<127?1:u<65536?d[u]:function(v,c){let i,s=0,e=c.length-1;if(v<c[0][0]||v>c[e][1])return!1;for(;e>=s;)if(i=s+e>>1,v>c[i][1])s=i+1;else{if(!(v<c[i][0]))return!0;e=i-1}return!1}(u,o)?0:u>=131072&&u<=196605||u>=196608&&u<=262141?2:1}charProperties(u,v){let c=this.wcwidth(u),i=c===0&&v!==0;if(i){let s=h.UnicodeService.extractWidth(v);s===0?i=!1:s>c&&(c=s)}return h.UnicodeService.createPropertyValue(0,c,i)}}},5981:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let h=n(8460),_=n(844);class o extends _.Disposable{constructor(u){super(),this._action=u,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(u,v){if(v!==void 0&&this._syncCalls>v)return void(this._syncCalls=0);if(this._pendingData+=u.length,this._writeBuffer.push(u),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let c;for(this._isSyncWriting=!0;c=this._writeBuffer.shift();){this._action(c);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(u,v){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=u.length,this._writeBuffer.push(u),this._callbacks.push(v),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=u.length,this._writeBuffer.push(u),this._callbacks.push(v)}_innerWrite(u=0,v=!0){let c=u||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,v);if(s){let t=a=>Date.now()-c>=12?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(c,a);return void s.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(t)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-c>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=o},5941:(y,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,d){let u=o.toString(16),v=u.length<2?"0"+u:u;switch(d){case 4:return u[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}r.parseColor=function(o){if(!o)return;let d=o.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);let u=n.exec(d);if(u){let v=u[1]?15:u[4]?255:u[7]?4095:65535;return[Math.round(parseInt(u[1]||u[4]||u[7]||u[10],16)/v*255),Math.round(parseInt(u[2]||u[5]||u[8]||u[11],16)/v*255),Math.round(parseInt(u[3]||u[6]||u[9]||u[12],16)/v*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),h.exec(d)&&[3,6,9,12].includes(d.length))){let u=d.length/3,v=[0,0,0];for(let c=0;c<3;++c){let i=parseInt(d.slice(u*c,u*c+u),16);v[c]=u===1?i<<4:u===2?i:u===3?i>>4:i>>8}return v}},r.toRgbString=function(o,d=16){let[u,v,c]=o;return`rgb:${_(u,d)}/${_(v,d)}/${_(c,d)}`}},5770:(y,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let h=n(482),_=n(8742),o=n(5770),d=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(v,c){this._handlers[v]===void 0&&(this._handlers[v]=[]);let i=this._handlers[v];return i.push(c),{dispose:()=>{let s=i.indexOf(c);s!==-1&&i.splice(s,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(v,c){if(this.reset(),this._ident=v,this._active=this._handlers[v]||d,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(c);else this._handlerFb(this._ident,"HOOK",c)}put(v,c,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(v,c,i);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(v,c,i))}unhook(v,c=!0){if(this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=c,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].unhook(v),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",v);this._active=d,this._ident=0}};let u=new _.Params;u.addParam(0),r.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=u,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():u,this._data="",this._hitLimit=!1}put(v,c,i){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,c,i),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let c=!1;if(this._hitLimit)c=!1;else if(v&&(c=this._handler(this._data,this._params),c instanceof Promise))return c.then(i=>(this._params=u,this._data="",this._hitLimit=!1,i));return this._params=u,this._data="",this._hitLimit=!1,c}}},2015:(y,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),d=n(6351);class u{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,t,a){this.table[e<<8|s]=t<<4|a}addMany(s,e,t,a){for(let p=0;p<s.length;p++)this.table[e<<8|s[p]]=t<<4|a}}r.TransitionTable=u;let v=160;r.VT500_TRANSITION_TABLE=function(){let i=new u(4095),s=Array.apply(null,Array(256)).map((g,l)=>l),e=(g,l)=>s.slice(g,l),t=e(32,127),a=e(0,24);a.push(25),a.push.apply(a,e(28,32));let p=e(0,14),f;for(f in i.setDefault(1,0),i.addMany(t,0,2,0),p)i.addMany([24,26,153,154],f,3,0),i.addMany(e(128,144),f,3,0),i.addMany(e(144,152),f,3,0),i.add(156,f,0,0),i.add(27,f,11,1),i.add(157,f,4,8),i.addMany([152,158,159],f,0,7),i.add(155,f,11,3),i.add(144,f,11,9);return i.addMany(a,0,3,0),i.addMany(a,1,3,1),i.add(127,1,0,1),i.addMany(a,8,0,8),i.addMany(a,3,3,3),i.add(127,3,0,3),i.addMany(a,4,3,4),i.add(127,4,0,4),i.addMany(a,6,3,6),i.addMany(a,5,3,5),i.add(127,5,0,5),i.addMany(a,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(t,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(t,7,0,7),i.addMany(a,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(a,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(a,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(a,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(a,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(a,13,13,13),i.addMany(t,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(v,0,2,0),i.add(v,8,5,8),i.add(v,6,0,6),i.add(v,11,0,11),i.add(v,13,13,13),i}();class c 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,t,a)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,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 d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(s,e=[64,126]){let t=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=s.prefix.charCodeAt(0),t&&60>t||t>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let p=0;p<s.intermediates.length;++p){let f=s.intermediates.charCodeAt(p);if(32>f||f>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=f}}if(s.final.length!==1)throw new Error("final must be a single byte");let a=s.final.charCodeAt(0);if(e[0]>a||a>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return t<<=8,t|=a,t}identToString(s){let e=[];for(;s;)e.push(String.fromCharCode(255&s)),s>>=8;return e.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,e){let t=this._identifier(s,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);let a=this._escHandlers[t];return a.push(e),{dispose:()=>{let p=a.indexOf(e);p!==-1&&a.splice(p,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,e){this._executeHandlers[s.charCodeAt(0)]=e}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,e){let t=this._identifier(s);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);let a=this._csiHandlers[t];return a.push(e),{dispose:()=>{let p=a.indexOf(e);p!==-1&&a.splice(p,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,e){return this._dcsParser.registerHandler(this._identifier(s),e)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,e){return this._oscParser.registerHandler(s,e)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(s,e,t,a,p){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=t,this._parseStack.transition=a,this._parseStack.chunkPos=p}parse(s,e,t){let a,p=0,f=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===!1&&m>-1){for(;m>=0&&(a=l[m](this._params),a!==!0);m--)if(a instanceof Promise)return this._parseStack.handlerPos=m,a}this._parseStack.handlers=[];break;case 4:if(t===!1&&m>-1){for(;m>=0&&(a=l[m](),a!==!0);m--)if(a instanceof Promise)return this._parseStack.handlerPos=m,a}this._parseStack.handlers=[];break;case 6:if(p=s[this._parseStack.chunkPos],a=this._dcsParser.unhook(p!==24&&p!==26,t),a)return a;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(p=s[this._parseStack.chunkPos],a=this._oscParser.end(p!==24&&p!==26,t),a)return a;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let l=g;l<e;++l){switch(p=s[l],f=this._transitions.table[this.currentState<<8|(p<160?p:v)],f>>4){case 2:for(let b=l+1;;++b){if(b>=e||(p=s[b])<32||p>126&&p<v){this._printHandler(s,l,b),l=b-1;break}if(++b>=e||(p=s[b])<32||p>126&&p<v){this._printHandler(s,l,b),l=b-1;break}if(++b>=e||(p=s[b])<32||p>126&&p<v){this._printHandler(s,l,b),l=b-1;break}if(++b>=e||(p=s[b])<32||p>126&&p<v){this._printHandler(s,l,b),l=b-1;break}}break;case 3:this._executeHandlers[p]?this._executeHandlers[p]():this._executeHandlerFb(p),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:p,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|p],R=m?m.length-1:-1;for(;R>=0&&(a=m[R](this._params),a!==!0);R--)if(a instanceof Promise)return this._preserveStack(3,m,R,f,l),a;R<0&&this._csiHandlerFb(this._collect<<8|p,this._params),this.precedingJoinState=0;break;case 8:do switch(p){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(p-48)}while(++l<e&&(p=s[l])>47&&p<60);l--;break;case 9:this._collect<<=8,this._collect|=p;break;case 10:let D=this._escHandlers[this._collect<<8|p],x=D?D.length-1:-1;for(;x>=0&&(a=D[x](),a!==!0);x--)if(a instanceof Promise)return this._preserveStack(4,D,x,f,l),a;x<0&&this._escHandlerFb(this._collect<<8|p),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|p,this._params);break;case 13:for(let b=l+1;;++b)if(b>=e||(p=s[b])===24||p===26||p===27||p>127&&p<v){this._dcsParser.put(s,l,b),l=b-1;break}break;case 14:if(a=this._dcsParser.unhook(p!==24&&p!==26),a)return this._preserveStack(6,[],0,f,l),a;p===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=l+1;;b++)if(b>=e||(p=s[b])<32||p>127&&p<v){this._oscParser.put(s,l,b),l=b-1;break}break;case 6:if(a=this._oscParser.end(p!==24&&p!==26),a)return this._preserveStack(5,[],0,f,l),a;p===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&f}}}r.EscapeSequenceParser=c},6242:(y,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(d,u){this._handlers[d]===void 0&&(this._handlers[d]=[]);let v=this._handlers[d];return v.push(u),{dispose:()=>{let c=v.indexOf(u);c!==-1&&v.splice(c,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,u,v){if(this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].put(d,u,v);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(d,u,v))}start(){this.reset(),this._state=1}put(d,u,v){if(this._state!==3){if(this._state===1)for(;u<v;){let c=d[u++];if(c===59){this._state=2,this._start();break}if(c<48||57<c)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+c-48}this._state===2&&v-u>0&&this._put(d,u,v)}}end(d,u=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,c=this._active.length-1,i=!1;if(this._stack.paused&&(c=this._stack.loopPosition-1,v=u,i=this._stack.fallThrough,this._stack.paused=!1),!i&&v===!1){for(;c>=0&&(v=this._active[c].end(d),v!==!0);c--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!1,v;c--}for(;c>=0;c--)if(v=this._active[c].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!0,v}else this._handlerFb(this._id,"END",d);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,u,v){this._hitLimit||(this._data+=(0,_.utf32ToString)(d,u,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let u=!1;if(this._hitLimit)u=!1;else if(d&&(u=this._handler(this._data),u instanceof Promise))return u.then(v=>(this._data="",this._hitLimit=!1,v));return this._data="",this._hitLimit=!1,u}}},8742:(y,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let n=2147483647;class h{static fromArray(o){let d=new h;if(!o.length)return d;for(let u=Array.isArray(o[0])?1:0;u<o.length;++u){let v=o[u];if(Array.isArray(v))for(let c=0;c<v.length;++c)d.addSubParam(v[c]);else d.addParam(v)}return d}constructor(o=32,d=32){if(this.maxLength=o,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new 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 d=0;d<this.length;++d){o.push(this.params[d]);let u=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];v-u>0&&o.push(Array.prototype.slice.call(this._subParams,u,v))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>n?n:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>n?n:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){let d=this._subParamsIdx[o]>>8,u=255&this._subParamsIdx[o];return u-d>0?this._subParams.subarray(d,u):null}getSubParamsAll(){let o={};for(let d=0;d<this.length;++d){let u=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];v-u>0&&(o[d]=this._subParams.slice(u,v))}return o}addDigit(o){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let u=this._digitIsSub?this._subParams:this.params,v=u[d-1];u[d-1]=~v?Math.min(10*v+o,n):o}}r.Params=h},5741:(y,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:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let h=n(3785),_=n(511);r.BufferApiView=class{constructor(o,d){this._buffer=o,this.type=d}init(o){return this._buffer=o,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(o){let d=this._buffer.lines.get(o);if(d)return new h.BufferLineApiView(d)}getNullCell(){return new _.CellData}}},3785:(y,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,d){return this._line.translateToString(_,o,d)}}},8285:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let h=n(8771),_=n(8460),o=n(844);class d extends o.Disposable{constructor(v){super(),this._core=v,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=d},7975:(y,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:(y,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(y,r,n){var h=this&&this.__decorate||function(i,s,e,t){var a,p=arguments.length,f=p<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(a=i[g])&&(f=(p<3?a(f):p>3?a(s,e,f):a(s,e))||f);return p>3&&f&&Object.defineProperty(s,e,f),f},_=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let o=n(8460),d=n(844),u=n(5295),v=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let c=r.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new u.BufferSet(i,this))}resize(i,s){this.cols=i,this.rows=s,this.buffers.resize(i,s),this._onResize.fire({cols:i,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,s=!1){let e=this.buffer,t;t=this._cachedBlankLine,t&&t.length===this.cols&&t.getFg(0)===i.fg&&t.getBg(0)===i.bg||(t=e.getBlankLine(i,s),this._cachedBlankLine=t),t.isWrapped=s;let a=e.ybase+e.scrollTop,p=e.ybase+e.scrollBottom;if(e.scrollTop===0){let f=e.lines.isFull;p===e.lines.length-1?f?e.lines.recycle().copyFrom(t):e.lines.push(t.clone()):e.lines.splice(p+1,0,t.clone()),f?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let f=p-a+1;e.lines.shiftElements(a+1,f-1,-1),e.lines.set(p,t.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,s,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let a=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),a!==t.ydisp&&(s||this._onScroll.fire(t.ydisp))}};r.BufferService=c=h([_(0,v.IOptionsService)],c)},7994:(y,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(y,r,n){var h=this&&this.__decorate||function(t,a,p,f){var g,l=arguments.length,m=l<3?a:f===null?f=Object.getOwnPropertyDescriptor(a,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(t,a,p,f);else for(var R=t.length-1;R>=0;R--)(g=t[R])&&(m=(l<3?g(m):l>3?g(a,p,m):g(a,p))||m);return l>3&&m&&Object.defineProperty(a,p,m),m},_=this&&this.__param||function(t,a){return function(p,f){a(p,f,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let o=n(2585),d=n(8460),u=n(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function c(t,a){let p=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(p|=64,p|=t.action):(p|=3&t.button,4&t.button&&(p|=64),8&t.button&&(p|=128),t.action===32?p|=32:t.action!==0||a||(p|=3)),p}let i=String.fromCharCode,s={DEFAULT:t=>{let a=[c(t,!1)+32,t.col+32,t.row+32];return a[0]>255||a[1]>255||a[2]>255?"":`\x1B[M${i(a[0])}${i(a[1])}${i(a[2])}`},SGR:t=>{let a=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${c(t,!0)};${t.col};${t.row}${a}`},SGR_PIXELS:t=>{let a=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${c(t,!0)};${t.x};${t.y}${a}`}},e=r.CoreMouseService=class extends u.Disposable{constructor(t,a){super(),this._bufferService=t,this._coreService=a,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let p of Object.keys(v))this.addProtocol(p,v[p]);for(let p of Object.keys(s))this.addEncoding(p,s[p]);this.reset()}addProtocol(t,a){this._protocols[t]=a}addEncoding(t,a){this._encodings[t]=a}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let a=this._encodings[this._activeEncoding](t);return a&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(a):this._coreService.triggerDataEvent(a,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,a,p){if(p){if(t.x!==a.x||t.y!==a.y)return!1}else if(t.col!==a.col||t.row!==a.row)return!1;return t.button===a.button&&t.action===a.action&&t.ctrl===a.ctrl&&t.alt===a.alt&&t.shift===a.shift}};r.CoreMouseService=e=h([_(0,o.IBufferService),_(1,o.ICoreService)],e)},6975:function(y,r,n){var h=this&&this.__decorate||function(e,t,a,p){var f,g=arguments.length,l=g<3?t:p===null?p=Object.getOwnPropertyDescriptor(t,a):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,a,p);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(g<3?f(l):g>3?f(t,a,l):f(t,a))||l);return g>3&&l&&Object.defineProperty(t,a,l),l},_=this&&this.__param||function(e,t){return function(a,p){t(a,p,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let o=n(1439),d=n(8460),u=n(844),v=n(2585),c=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=r.CoreService=class extends u.Disposable{constructor(e,t,a){super(),this._bufferService=e,this._logService=t,this._optionsService=a,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(i)}reset(){this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(i)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let a=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&a.ybase!==a.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(p=>p.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};r.CoreService=s=h([_(0,v.IBufferService),_(1,v.ILogService),_(2,v.IOptionsService)],s)},9074:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let h=n(8055),_=n(8460),o=n(844),d=n(6106),u=0,v=0;class c extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this.register(new _.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 t=new i(e);if(t){let a=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),a.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,a){let p=0,f=0;for(let g of this._decorations.getKeyIterator(t))p=g.options.x??0,f=p+(g.options.width??1),e>=p&&e<f&&(!a||(g.options.layer??"bottom")===a)&&(yield g)}forEachDecorationAtCell(e,t,a,p){this._decorations.forEachByKey(t,f=>{u=f.options.x??0,v=u+(f.options.width??1),e>=u&&e<v&&(!a||(f.options.layer??"bottom")===a)&&p(f)})}}r.DecorationService=c;class i extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=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:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let h=n(2585),_=n(8343);class o{constructor(...u){this._entries=new Map;for(let[v,c]of u)this.set(v,c)}set(u,v){let c=this._entries.get(u);return this._entries.set(u,v),c}forEach(u){for(let[v,c]of this._entries.entries())u(v,c)}has(u){return this._entries.has(u)}get(u){return this._entries.get(u)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(h.IInstantiationService,this)}setService(d,u){this._services.set(d,u)}getService(d){return this._services.get(d)}createInstance(d,...u){let v=(0,_.getServiceDependencies)(d).sort((s,e)=>s.index-e.index),c=[];for(let s of v){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${s.id}.`);c.push(e)}let i=v.length>0?v[0].index:u.length;if(u.length!==i)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${i+1} conflicts with ${u.length} static arguments`);return new d(...u,...c)}}},7866:function(y,r,n){var h=this&&this.__decorate||function(i,s,e,t){var a,p=arguments.length,f=p<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(a=i[g])&&(f=(p<3?a(f):p>3?a(s,e,f):a(s,e))||f);return p>3&&f&&Object.defineProperty(s,e,f),f},_=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let o=n(844),d=n(2585),u={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF},v,c=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),v=this}_updateLogLevel(){this._logLevel=u[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let s=0;s<i.length;s++)typeof i[s]=="function"&&(i[s]=i[s]())}_log(i,s,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(i,...s){this._logLevel<=d.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,s)}debug(i,...s){this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,s)}info(i,...s){this._logLevel<=d.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,s)}warn(i,...s){this._logLevel<=d.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,s)}error(i,...s){this._logLevel<=d.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,s)}};r.LogService=c=h([_(0,d.IOptionsService)],c),r.setTraceLogger=function(i){v=i},r.traceCall=function(i,s,e){if(typeof e.value!="function")throw new Error("not supported");let t=e.value;e.value=function(...a){if(v.logLevel!==d.LogLevelEnum.TRACE)return t.apply(this,a);v.trace(`GlyphRenderer#${t.name}(${a.map(f=>JSON.stringify(f)).join(", ")})`);let p=t.apply(this,a);return v.trace(`GlyphRenderer#${t.name} return`,p),p}}},7302:(y,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 d=["normal","bold","100","200","300","400","500","600","700","800","900"];class u extends _.Disposable{constructor(c){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i=he({},r.DEFAULT_OPTIONS);for(let s in c)if(s in i)try{let e=c[s];i[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=i,this.options=he({},i),this._setupOptions(),this.register((0,_.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(c,i){return this.onOptionChange(s=>{s===c&&i(this.rawOptions[c])})}onMultipleOptionChange(c,i){return this.onOptionChange(s=>{c.indexOf(s)!==-1&&i()})}_setupOptions(){let c=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,e)=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);e=this._sanitizeAndValidateOption(s,e),this.rawOptions[s]!==e&&(this.rawOptions[s]=e,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let e={get:c.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(c,i){switch(c){case"cursorStyle":if(i||(i=r.DEFAULT_OPTIONS[c]),!function(s){return s==="block"||s==="underline"||s==="bar"}(i))throw new Error(`"${i}" is not a valid value for ${c}`);break;case"wordSeparator":i||(i=r.DEFAULT_OPTIONS[c]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=d.includes(i)?i:r.DEFAULT_OPTIONS[c];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${c} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${c} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${c} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${c} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}r.OptionsService=u},2660:function(y,r,n){var h=this&&this.__decorate||function(u,v,c,i){var s,e=arguments.length,t=e<3?v:i===null?i=Object.getOwnPropertyDescriptor(v,c):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(u,v,c,i);else for(var a=u.length-1;a>=0;a--)(s=u[a])&&(t=(e<3?s(t):e>3?s(v,c,t):s(v,c))||t);return e>3&&t&&Object.defineProperty(v,c,t),t},_=this&&this.__param||function(u,v){return function(c,i){v(c,i,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let o=n(2585),d=r.OscLinkService=class{constructor(u){this._bufferService=u,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(u){let v=this._bufferService.buffer;if(u.id===void 0){let a=v.addMarker(v.ybase+v.y),p={data:u,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(p,a)),this._dataByLinkId.set(p.id,p),p.id}let c=u,i=this._getEntryIdKey(c),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,v.ybase+v.y),s.id;let e=v.addMarker(v.ybase+v.y),t={id:this._nextId++,key:this._getEntryIdKey(c),data:c,lines:[e]};return e.onDispose(()=>this._removeMarkerFromLink(t,e)),this._entriesWithId.set(t.key,t),this._dataByLinkId.set(t.id,t),t.id}addLineToLink(u,v){let c=this._dataByLinkId.get(u);if(c&&c.lines.every(i=>i.line!==v)){let i=this._bufferService.buffer.addMarker(v);c.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(c,i))}}getLinkData(u){return this._dataByLinkId.get(u)?.data}_getEntryIdKey(u){return`${u.id};;${u.uri}`}_removeMarkerFromLink(u,v){let c=u.lines.indexOf(v);c!==-1&&(u.lines.splice(c,1),u.lines.length===0&&(u.data.id!==void 0&&this._entriesWithId.delete(u.key),this._dataByLinkId.delete(u.id)))}};r.OscLinkService=d=h([_(0,o.IBufferService)],d)},8343:(y,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(d,u,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(c,i,s){i[n]===i?i[h].push({id:c,index:s}):(i[h]=[{id:c,index:s}],i[n]=i)})(o,d,v)};return o.toString=()=>_,r.serviceRegistry.set(_,o),o}},2585:(y,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:(y,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let h=n(8460),_=n(225);class o{static extractShouldJoin(u){return(1&u)!=0}static extractWidth(u){return u>>1&3}static extractCharKind(u){return u>>3}static createPropertyValue(u,v,c=!1){return(16777215&u)<<3|(3&v)<<1|(c?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let u=new _.UnicodeV6;this.register(u),this._active=u.version,this._activeProvider=u}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(u){if(!this._providers[u])throw new Error(`unknown Unicode version "${u}"`);this._active=u,this._activeProvider=this._providers[u],this._onChange.fire(u)}register(u){this._providers[u.version]=u}wcwidth(u){return this._activeProvider.wcwidth(u)}getStringCellWidth(u){let v=0,c=0,i=u.length;for(let s=0;s<i;++s){let e=u.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=i)return v+this.wcwidth(e);let p=u.charCodeAt(s);56320<=p&&p<=57343?e=1024*(e-55296)+p-56320+65536:v+=this.wcwidth(p)}let t=this.charProperties(e,c),a=o.extractWidth(t);o.extractShouldJoin(t)&&(a-=o.extractWidth(c)),v+=a,c=t}return v}charProperties(u,v){return this._activeProvider.charProperties(u,v)}}r.UnicodeService=o}},T={};function P(y){var r=T[y];if(r!==void 0)return r.exports;var n=T[y]={exports:{}};return L[y].call(n.exports,n,n.exports,P),n.exports}var E={};return(()=>{var y=E;Object.defineProperty(y,"__esModule",{value:!0}),y.Terminal=void 0;let r=P(9042),n=P(3236),h=P(844),_=P(5741),o=P(8285),d=P(7975),u=P(7090),v=["cols","rows"];class c extends h.Disposable{constructor(s){super(),this._core=this.register(new n.Terminal(s)),this._addonManager=this.register(new _.AddonManager),this._publicOptions=he({},this._core.options);let e=a=>this._core.options[a],t=(a,p)=>{this._checkReadonlyOptions(a),this._core.options[a]=p};for(let a in this._core.options){let p={get:e.bind(this,a),set:t.bind(this,a)};Object.defineProperty(this._publicOptions,a,p)}}_checkReadonlyOptions(s){if(v.includes(s))throw new Error(`Option "${s}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new u.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let s=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(let e in s)this._publicOptions[e]=s[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,e=!0){this._core.input(s,e)}resize(s,e){this._verifyIntegers(s,e),this._core.resize(s,e)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,e,t){this._verifyIntegers(s,e,t),this._core.select(s,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,e){this._verifyIntegers(s,e),this._core.selectLines(s,e)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,e){this._core.write(s,e)}writeln(s,e){this._core.write(s),this._core.write(`\r
`,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")}}y.Terminal=c})(),E})())});var Lt=it((Ce,Qe)=>{"use strict";(function(L,T){typeof Ce=="object"&&typeof Qe=="object"?Qe.exports=T():typeof define=="function"&&define.amd?define([],T):typeof Ce=="object"?Ce.FitAddon=T():L.FitAddon=T()})(Ce,()=>(()=>{"use strict";var L={};return(()=>{var T=L;Object.defineProperty(T,"__esModule",{value:!0}),T.FitAddon=void 0,T.FitAddon=class{activate(P){this._terminal=P}dispose(){}fit(){let P=this.proposeDimensions();if(!P||!this._terminal||isNaN(P.cols)||isNaN(P.rows))return;let E=this._terminal._core;this._terminal.rows===P.rows&&this._terminal.cols===P.cols||(E._renderService.clear(),this._terminal.resize(P.cols,P.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let P=this._terminal._core,E=P._renderService.dimensions;if(E.css.cell.width===0||E.css.cell.height===0)return;let y=this._terminal.options.scrollback===0?0:P.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"))),d=h-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-y;return{cols:Math.max(2,Math.floor(d/E.css.cell.width)),rows:Math.max(1,Math.floor(o/E.css.cell.height))}}}})(),L})())});function Ie(L){let T={d:{}};for(let P of Object.keys(L)){let E=L[P];if("file"in E){let r=E.file.contents,n=typeof r=="string"?r:Pt(r),h=typeof r=="string"?{}:{b:!0};T.d[P]={f:he({c:n},h)};continue}let y=Ie(E.directory);T.d[P]=y}return T}function Pt(L){let T="";for(let P of L)T+=String.fromCharCode(P);return T}var It=Object.defineProperty,Ht=(L,T)=>{for(var P in T)It(L,P,{get:T[P],enumerable:!0})},re={};Ht(re,{createEndpoint:()=>pt,expose:()=>Ue,proxy:()=>wt,proxyMarker:()=>We,releaseProxy:()=>vt,transfer:()=>bt,transferHandlers:()=>Ne,windowEndpoint:()=>jt,wrap:()=>St});var We=Symbol("Comlink.proxy"),pt=Symbol("Comlink.endpoint"),vt=Symbol("Comlink.releaseProxy"),He=Symbol("Comlink.thrown"),gt=L=>typeof L=="object"&&L!==null||typeof L=="function",Ft={canHandle:L=>gt(L)&&L[We],serialize(L){let{port1:T,port2:P}=new MessageChannel;return Ue(L,T),[P,[P]]},deserialize(L){return L.start(),St(L)}},Wt={canHandle:L=>gt(L)&&He in L,serialize({value:L}){let T;return L instanceof Error?T={isError:!0,value:{message:L.message,name:L.name,stack:L.stack}}:T={isError:!1,value:L},[T,[]]},deserialize(L){throw L.isError?Object.assign(new Error(L.value.message),L.value):L.value}},Ne=new Map([["proxy",Ft],["throw",Wt]]);function Ue(L,T=this){T.addEventListener("message",function P(E){if(!E||!E.data)return;let{id:y,type:r,path:n}=Object.assign({path:[]},E.data),h=(E.data.argumentList||[]).map(le),_;try{let o=n.slice(0,-1).reduce((u,v)=>u[v],L),d=n.reduce((u,v)=>u[v],L);switch(r){case 0:_=d;break;case 1:o[n.slice(-1)[0]]=le(E.data.value),_=!0;break;case 2:_=d.apply(o,h);break;case 3:{let u=new d(...h);_=wt(u)}break;case 4:{let{port1:u,port2:v}=new MessageChannel;Ue(L,v),_=bt(u,[u])}break;case 5:_=void 0;break}}catch(o){_={value:o,[He]:0}}Promise.resolve(_).catch(o=>({value:o,[He]:0})).then(o=>{let[d,u]=je(o);T.postMessage(Object.assign(Object.assign({},d),{id:y}),u),r===5&&(T.removeEventListener("message",P),mt(T))})}),T.start&&T.start()}function Nt(L){return L.constructor.name==="MessagePort"}function mt(L){Nt(L)&&L.close()}function St(L,T){return Fe(L,[],T)}function Re(L){if(L)throw new Error("Proxy has been released and is not useable")}function Fe(L,T=[],P=function(){}){let E=!1,y=new Proxy(P,{get(r,n){if(Re(E),n===vt)return()=>_e(L,{type:5,path:T.map(h=>h.toString())}).then(()=>{mt(L),E=!0});if(n==="then"){if(T.length===0)return{then:()=>y};let h=_e(L,{type:0,path:T.map(_=>_.toString())}).then(le);return h.then.bind(h)}return Fe(L,[...T,n])},set(r,n,h){Re(E);let[_,o]=je(h);return _e(L,{type:1,path:[...T,n].map(d=>d.toString()),value:_},o).then(le)},apply(r,n,h){Re(E);let _=T[T.length-1];if(_===pt)return _e(L,{type:4}).then(le);if(_==="bind")return Fe(L,T.slice(0,-1));let[o,d]=ft(h);return _e(L,{type:2,path:T.map(u=>u.toString()),argumentList:o},d).then(le)},construct(r,n){Re(E);let[h,_]=ft(n);return _e(L,{type:3,path:T.map(o=>o.toString()),argumentList:h},_).then(le)}});return y}function Ut(L){return Array.prototype.concat.apply([],L)}function ft(L){let T=L.map(je);return[T.map(P=>P[0]),Ut(T.map(P=>P[1]))]}var Ct=new WeakMap;function bt(L,T){return Ct.set(L,T),L}function wt(L){return Object.assign(L,{[We]:!0})}function jt(L,T=this,P="*"){return{postMessage:(E,y)=>L.postMessage(E,P,y),addEventListener:T.addEventListener.bind(T),removeEventListener:T.removeEventListener.bind(T)}}function je(L){for(let[T,P]of Ne)if(P.canHandle(L)){let[E,y]=P.serialize(L);return[{type:3,name:T,value:E},y]}return[{type:0,value:L},Ct.get(L)||[]]}function le(L){switch(L.type){case 3:return Ne.get(L.name).deserialize(L.value);case 0:return L.value}}function _e(L,T,P){return new Promise(E=>{let y=$t();L.addEventListener("message",function r(n){!n.data||!n.data.id||n.data.id!==y||(L.removeEventListener("message",r),E(n.data))}),L.start&&L.start(),L.postMessage(Object.assign({id:y},T),P)})}function $t(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var zt="https://stackblitz.com/headless",De=null,Le=null,$e={},Kt=new TextDecoder,qt=new TextEncoder,Ge=(()=>{class L{_instance;_runtimeInfo;fs;static _instance=null;_tornDown=!1;constructor(P,E,y){this._instance=P,this._runtimeInfo=y,this.fs=new Ve(E)}async spawn(P,E,y){let r=[];Array.isArray(E)?r=E:y=E;let n,h=new ReadableStream;if(y?.output!==!1){let d=ti();n=d.push,h=d.stream}let _=yt(Xt(n)),o=await this._instance.run({command:P,args:r,env:y?.env,terminal:y?.terminal},void 0,void 0,_);return new qe(o,h)}on(P,E){let y=!1,r=()=>{},n=(...h)=>{y||E(...h)};return this._instance.on(P,re.proxy(n)).then(h=>{r=h,y&&r()}),()=>{y=!0,r()}}mount(P,E){let y=P instanceof Uint8Array?P:P instanceof ArrayBuffer?new Uint8Array(P):qt.encode(JSON.stringify(Ie(P)));return this._instance.loadFiles(re.transfer(y,[y.buffer]),{mountPoints:E?.mountPoint})}get path(){return this._runtimeInfo.path}get workdir(){return this._runtimeInfo.cwd}teardown(){if(this._tornDown)throw new Error("WebContainer already torn down");this._tornDown=!0,this.fs._teardown(),this._instance.teardown(),this._instance[re.releaseProxy](),L._instance===this&&(L._instance=null)}static async boot(P={}){let{workdirName:E}=P;if(window.crossOriginIsolated&&P.coep==="none"&&console.warn(`A Cross-Origin-Embedder-Policy header is required in cross origin isolated environments.
Set the 'coep' option to 'require-corp'.`),E?.includes("/")||E===".."||E===".")throw new Error("workdirName should be a valid folder name");for(;De;)await De;if(L._instance)throw new Error("Only a single WebContainer instance can be booted");let y=Yt(P);De=y.catch(()=>{});try{let r=await y;return L._instance=r,r}finally{De=null}}}return L})(),Vt=1,Gt=2,ze=class{name;_type;constructor(T,P){this.name=T,this._type=P}isFile(){return this._type===Vt}isDirectory(){return this._type===Gt}},Ke=class{_apiClient;_path;_options;_listener;_wrappedListener;_watcher;_closed=!1;constructor(T,P,E,y){this._apiClient=T,this._path=P,this._options=E,this._listener=y,this._apiClient._watchers.add(this),this._wrappedListener=(r,n)=>{this._listener&&!this._closed&&this._listener(r,n)},this._apiClient._fs.watch(this._path,this._options,yt(this._wrappedListener)).then(r=>{this._watcher=r,this._closed&&this._teardown()}).catch(console.error)}close(){this._closed||(this._closed=!0,this._apiClient._watchers.delete(this),this._teardown())}_teardown(){this._watcher?.close().finally(()=>{this._watcher?.[re.releaseProxy]()})}},qe=class{output;input;exit;_process;constructor(T,P){this.output=P,this._process=T,this.input=new WritableStream({write:E=>{this._getProcess()?.write(E).catch(()=>{})}}),this.exit=this._onExit()}kill(){this._getProcess()?.kill()}resize(T){this._getProcess()?.resize(T)}async _onExit(){try{return await this._process.onExit}finally{this._process?.[re.releaseProxy](),this._process=null}}_getProcess(){return this._process==null&&console.warn("This process already exited"),this._process}},Ve=class{_fs;_watchers=new Set([]);constructor(T){this._fs=T}rm(...T){return this._fs.rm(...T)}async readFile(T,P){return await this._fs.readFile(T,P)}async rename(T,P){return await this._fs.rename(T,P)}async writeFile(T,P,E){if(P instanceof Uint8Array){let y=P.buffer.slice(P.byteOffset,P.byteOffset+P.byteLength);P=re.transfer(new Uint8Array(y),[y])}await this._fs.writeFile(T,P,E)}async readdir(T,P){let E=await this._fs.readdir(T,P);return Zt(E)||Qt(E)?E:E.map(r=>new ze(r.name,r["Symbol(type)"]))}async mkdir(T,P){return await this._fs.mkdir(T,P)}watch(T,P,E){return typeof P=="function"&&(E=P,P=null),new Ke(this,T,P,E)}_teardown(){this._fs[re.releaseProxy]();for(let T of this._watchers)T.close()}};async function Yt(L){let{serverPromise:T}=Jt(L),E=await(await T).build({host:window.location.host,version:"1.1.9",workdirName:L.workdirName}),y=await E.fs(),r=await E.runtimeInfo();return new Ge(E,y,r)}function Xt(L){if(L!=null)return T=>{T instanceof Uint8Array?L(Kt.decode(T)):T==null&&L(null)}}function yt(L){if(L!=null)return re.proxy(L)}function Jt(L){if(Le!=null)return L.coep!==$e.coep&&(console.warn(`Attempting to boot WebContainer with 'coep: ${L.coep}'`),console.warn(`First boot had 'coep: ${$e.coep}', new settings will not take effect!`)),{serverPromise:Le};let T=document.createElement("iframe");T.style.display="none",T.setAttribute("allow","cross-origin-isolated");let P=ei();P.searchParams.set("version","1.1.9"),L.coep&&P.searchParams.set("coep",L.coep),T.src=P.toString();let{origin:E}=P;return $e=he({},L),Le=new Promise(y=>{let r=n=>{if(n.origin!==E)return;let{data:h}=n;if(h.type==="init"){y(re.wrap(n.ports[0]));return}if(h.type==="warning"){console[h.level].call(console,h.message);return}};window.addEventListener("message",r)}),document.body.insertBefore(T,null),{serverPromise:Le}}function Zt(L){return typeof L[0]=="string"}function Qt(L){return L[0]instanceof Uint8Array}function ei(){return new URL(window.WEBCONTAINER_API_IFRAME_URL??zt)}function ti(){let L=null;return{stream:new ReadableStream({start(E){L=E}}),push:E=>{E!=null?L?.enqueue(E):(L?.close(),L=null)}}}var ii=3,Ye="numberOfWebcontainers",me=function(L){return L[L.OUT_OF_MEMORY=0]="OUT_OF_MEMORY",L[L.MOBILE=1]="MOBILE",L}(me||{}),Et=(()=>{let T=class T{constructor(){this.localStorage=ie(ht),this.window=ie(ke),this.snackBar=ie(lt)}init(){this.listenToLocalStorageValuesChange(),this.increaseInstancesCounter(),this.decreaseInstancesCounterOnPageClose(),this.checkDevice()}listenToLocalStorageValuesChange(){this.window.addEventListener("storage",()=>{let E=this.getStoredCountOfWebcontainerInstances();this.validateRunningInstances(E)})}increaseInstancesCounter(){let E=this.getStoredCountOfWebcontainerInstances()+1;this.localStorage?.setItem(Ye,E.toString()),this.validateRunningInstances(E)}decreaseInstancesCounterOnPageClose(){this.window.addEventListener("beforeunload",()=>{let E=this.getStoredCountOfWebcontainerInstances()-1;this.localStorage?.setItem(Ye,E.toString()),this.validateRunningInstances(E)})}getStoredCountOfWebcontainerInstances(){let E=this.localStorage?.getItem(Ye);return!E||Number.isNaN(E)?0:Number(E)}validateRunningInstances(E){E>ii&&this.openSnackBar(me.OUT_OF_MEMORY)}checkDevice(){ot&&this.openSnackBar(me.MOBILE)}openSnackBar(E){let y="";switch(E){case me.OUT_OF_MEMORY:y="\u4F60\u7684\u6D4F\u89C8\u5668\u5F53\u524D\u9650\u5236\u4E86\u8FD0\u884C Angular \u6559\u7A0B\u6216\u5728\u7EBF\u6F14\u7EC3\u573A\u6240\u9700\u7684\u5185\u5B58\u3002\u5982\u679C\u4F60\u6709\u591A\u4E2A\u6807\u7B7E\u9875\u6253\u5F00\u4E86\u6559\u7A0B\u6216\u5728\u7EBF\u6F14\u7EC3\u573A\uFF0C\u8BF7\u5173\u95ED\u5176\u4E2D\u7684\u4E00\u4E9B\u5E76\u5237\u65B0\u6B64\u9875\u9762\u3002";break;case me.MOBILE:y="\u4F60\u6B63\u5728\u79FB\u52A8\u8BBE\u5907\u4E0A\u8FD0\u884C\u5D4C\u5165\u5F0F\u7F16\u8F91\u5668\uFF0C\u8FD9\u53EF\u80FD\u4F1A\u5BFC\u81F4\u5185\u5B58\u4E0D\u8DB3\u9519\u8BEF\u3002";break}this.snackBar.openFromComponent(dt,{panelClass:"docs-invert-mode",data:{message:y,actionText:"\u6211\u660E\u767D\u4E86"}})}};T.\u0275fac=function(y){return new(y||T)},T.\u0275prov=te({token:T,factory:T.\u0275fac,providedIn:"root"});let L=T;return L})();var Se="/assets/tutorials",si="source-code",ri="metadata",wi=`${Se}/${si}`,yi=`${Se}/${ri}`;var kt=(()=>{let T=class T{constructor(){this.tutorialId=Y(""),this.tutorialFilesystemTree=Y(null),this.commonFilesystemTree=Y(null),this.type=Y(void 0),this.allFiles=Y([]),this.hiddenFiles=Y([]),this.tutorialFiles=Y({}),this.openFiles=Y([]),this.answerFiles=Y({}),this.dependencies=Y(void 0),this._shouldReInstallDependencies=Y(!1),this.shouldReInstallDependencies=this._shouldReInstallDependencies.asReadonly(),this.metadata=Y(void 0),this._shouldChangeTutorial$=new Ee(!1),this.tutorialChanged$=this._shouldChangeTutorial$.asObservable(),this._filesToDeleteFromPreviousProject=Y(new Set),this.filesToDeleteFromPreviousProject=this._filesToDeleteFromPreviousProject.asReadonly()}async fetchAndSetTutorialFiles(E){let[y,r,n]=await Promise.all([this.fetchCommonFiles(),this.fetchTutorialSourceCode(E),this.fetchTutorialMetadata(E)]),h=!!this.tutorialId()&&this.tutorialId()!==E;if(this.tutorialId.set(E),this.type.set(n.type),this.metadata.set(n),r){if(h){let _=this.computeFilesToRemove(n.allFiles,this.allFiles());_&&this._filesToDeleteFromPreviousProject.set(_),this._shouldReInstallDependencies.set(this.checkIfDependenciesChanged(n.dependencies??{}))}this.tutorialFilesystemTree.set(r),this.dependencies.set(n.dependencies??{}),this.tutorialFiles.set(n.tutorialFiles),this.answerFiles.set(n.answerFiles??{}),this.openFiles.set(n.openFiles),this.hiddenFiles.set(n.hiddenFiles),this.allFiles.set(n.allFiles),this.commonFilesystemTree()||this.commonFilesystemTree.set(y)}this._shouldChangeTutorial$.next(h)}revealAnswer(){let E=Object.keys(this.answerFiles()),y=Array.from(new Set([...this.openFiles(),...E])).filter(_=>!this.hiddenFiles()?.includes(_)),r=Object.fromEntries(y.map(_=>[_,this.answerFiles()[_]])),n=[...this.allFiles(),...E],h=this.computeFilesToRemove(n,this.allFiles());h&&this._filesToDeleteFromPreviousProject.set(h),this.allFiles.set(n),this.tutorialFiles.set(r),this.openFiles.set(y),this._shouldChangeTutorial$.next(!0)}resetRevealAnswer(){let E=this.metadata().allFiles,y=this.computeFilesToRemove(E,this.allFiles());y&&this._filesToDeleteFromPreviousProject.set(y),this.tutorialFiles.set(this.metadata().tutorialFiles),this.openFiles.set(this.metadata().openFiles),this._shouldChangeTutorial$.next(!0)}async fetchCommonFiles(){return this.commonFilesystemTree()!==null?this.commonFilesystemTree():{}}async fetchTutorialSourceCode(E){let y=await fetch(`${Se}/${E}/source-code.json`);if(!y.ok)throw new Error(`\u7F3A\u5C11\u6559\u7A0B ${E} \u7684\u6E90\u4EE3\u7801\u3002`);return await y.json()}async fetchTutorialMetadata(E){let y=await fetch(`${Se}/${E}/metadata.json`);if(!y.ok)throw new Error(`\u7F3A\u5C11\u6559\u7A0B ${E} \u7684\u5143\u6570\u636E\u3002`);return await y.json()}checkIfDependenciesChanged(E){let y=this.dependencies();for(let r of Object.keys(E))if(y?.[r]!==E[r])return!0;return!1}computeFilesToRemove(E,y){let r=new Set(y);for(let n of E)r.delete(n);return r}};T.\u0275fac=function(y){return new(y||T)},T.\u0275prov=te({token:T,factory:T.\u0275fac,providedIn:"root"});let L=T;return L})();var Q=function(L){return L[L.NOT_STARTED=0]="NOT_STARTED",L[L.BOOT=1]="BOOT",L[L.LOAD_FILES=2]="LOAD_FILES",L[L.INSTALL=3]="INSTALL",L[L.START_DEV_SERVER=4]="START_DEV_SERVER",L[L.READY=5]="READY",L[L.ERROR=6]="ERROR",L}(Q||{});var ce=function(L){return L[L.UNKNOWN=0]="UNKNOWN",L[L.COOKIES=1]="COOKIES",L[L.OUT_OF_MEMORY=2]="OUT_OF_MEMORY",L[L.UNSUPPORTED_BROWSER_ENVIRONMENT=3]="UNSUPPORTED_BROWSER_ENVIRONMENT",L}(ce||{}),Rt=(()=>{let T=class T{constructor(){this._loadingStep=Y(Q.NOT_STARTED),this.loadingStep=this._loadingStep.asReadonly(),this._isResetting=Y(!1),this.isResetting=this._isResetting.asReadonly(),this._error=Y(void 0),this.error=this._error.asReadonly(),this.checkUnsupportedEnvironment()}setLoadingStep(E){this._loadingStep.set(E)}setIsResetting(E){this._isResetting.set(E)}setError({message:E,type:y}){y??=this.getErrorType(E),this._error.set({message:E,type:y}),this.setLoadingStep(Q.ERROR)}getErrorType(E){return E?.includes(Xe)?ce.OUT_OF_MEMORY:E?.toLowerCase().includes("service worker")?ce.COOKIES:ce.UNKNOWN}checkUnsupportedEnvironment(){at&&this.setError({message:"\u4E0D\u652F\u6301\u6B64\u73AF\u5883",type:ce.UNSUPPORTED_BROWSER_ENVIRONMENT})}};T.\u0275fac=function(y){return new(y||T)},T.\u0275prov=te({token:T,factory:T.\u0275fac,providedIn:"root"});let L=T;return L})();var Tt=Pe(Ze()),et=Pe(Lt());var xt=Pe(Ze());var ni=["ng serve","ng s","ng generate","ng g","ng version","ng v","ng update","ng test","ng t","ng e2e","ng e","ng add","ng config","ng new"],At=(()=>{let T=class T{validate(E){return ni.some(y=>y===E||E.startsWith(`${y} `))}};T.\u0275fac=function(y){return new(y||T)},T.\u0275prov=te({token:T,factory:T.\u0275fac,providedIn:"root"});let L=T;return L})();var oi="Angular Documentation - Not allowed command!",ai=["Backspace","ArrowUp","ArrowDown"],xe=class extends xt.Terminal{constructor(){super({convertEol:!0,disableStdin:!1}),this.window=ie(ke),this.commandValidator=ie(At),this.breakProcess=new ye,this.breakProcess$=this.breakProcess.asObservable(),this.window.location.search.includes("sudo=true")||this.handleCommandExecution()}breakCurrentProcess(){this.breakProcess.next()}handleCommandExecution(){let T="\u276F",P="\x1B[1;31m";this.attachCustomKeyEventHandler(E=>{if(ai.includes(E.key))return!0;if(["keydown","keyup"].includes(E.type))return!1;if(E.key==="Enter"){let y=Array.from(this.element.querySelectorAll(".xterm-rows>div")).map(n=>Array.from(n.querySelectorAll("span:not(.xterm-fg-6)")).map(h=>h.textContent).join("").trim()).filter(n=>!!n&&n.startsWith(T)),r=y.length>0?y[y.length-1].replace(T,"").trim():"";if(r&&!this.commandValidator.validate(r))return this.writeln(`
${P}${oi}`),this.breakCurrentProcess(),!1}return!0})}};var de=function(L){return L[L.READONLY=0]="READONLY",L[L.INTERACTIVE=1]="INTERACTIVE",L}(de||{}),Bt=(()=>{let T=class T{constructor(){this.terminals={[de.READONLY]:{instance:new Tt.Terminal({convertEol:!0,disableStdin:!0}),fitAddon:new et.FitAddon},[de.INTERACTIVE]:{instance:new xe,fitAddon:new et.FitAddon}}}get readonlyTerminalInstance(){return this.terminals[de.READONLY].instance}get interactiveTerminalInstance(){return this.terminals[de.INTERACTIVE].instance}registerTerminal(E,y){let r=this.terminals[E];this.mapTerminalToElement(r.instance,r.fitAddon,y)}resizeToFitParent(E){this.terminals[E]?.fitAddon.fit()}clearTerminals(){this.terminals[de.READONLY].instance.clear(),this.terminals[de.INTERACTIVE].instance.clear()}mapTerminalToElement(E,y,r){E.open(r),y.fit()}};T.\u0275fac=function(y){return new(y||T)},T.\u0275prov=te({token:T,factory:T.\u0275fac,providedIn:"root"});let L=T;return L})();var Ot=(()=>{let T=class T{constructor(){this.librariesToGetTypesFrom=["@angular/common","@angular/core","@angular/forms","@angular/router","@angular/platform-browser","@angular/material","@angular/cdk"],this._typings=Y([]),this.typings=this._typings.asReadonly(),this.typings$=ut(this._typings)}async retrieveTypeDefinitions(E){this.webContainer=E;let y=[];try{let r=await this.getFilesToRead();r&&r.length>0&&(await Promise.all(r.map(n=>E.fs.readFile(n,"utf-8").then(h=>{y.push({path:n,content:h})}))),this._typings.set(y))}catch(r){if(r?.message.startsWith("ENOENT"))return;throw r}}async getFilesToRead(){if(!this.webContainer)return;let E=[],y=[];for(let n of this.librariesToGetTypesFrom){let h=await this.webContainer.fs.readFile(`./node_modules/${n}/package.json`,"utf-8").catch(o=>{if(!o?.message.startsWith("ENOENT"))throw o});if(!h)continue;let _=JSON.parse(h);if(_?.exports)for(let o of Object.keys(_.exports)){let d=_.exports[o],u=d.typings??d.types;if(u){let v=`/node_modules/${n}/${this.normalizePath(u)}`;if(v.includes("*")){let c=v.substring(0,v.lastIndexOf("/"));y.push(c)}else E.push(v)}}}let r=(await Promise.all(y.map(n=>this.getTypeDefinitionFilesFromDirectory(n)))).flat();for(let n of r)E.push(n);return E}async getTypeDefinitionFilesFromDirectory(E){if(!this.webContainer)throw new Error("this.webContainer \u5C1A\u672A\u5B9A\u4E49");return(await this.webContainer.fs.readdir(E)).filter(this.isTypeDefinitionFile).map(r=>`${E}/${r}`)}isTypeDefinitionFile(E){return E.endsWith(".d.ts")}normalizePath(E){return E.startsWith("./")?E.substring(2):E.startsWith(".")?E.substring(1):E}};T.\u0275fac=function(y){return new(y||T)},T.\u0275prov=te({token:T,factory:T.\u0275fac,providedIn:"root"});let L=T;return L})();var hi="\u76D1\u89C6\u6A21\u5F0F\u5DF2\u542F\u7528\u3002\u6B63\u5728\u76D1\u89C6\u6587\u4EF6\u66F4\u6539...",Xe="\u5185\u5B58\u4E0D\u8DB3",tt="npm",sr=(()=>{let T=class T{constructor(){this._createdFile$=new ye,this.createdFile$=this._createdFile$.asObservable(),this._createdFiles=Y(new Set),this.destroyRef=ie(nt),this.alertManager=ie(Et),this.terminalHandler=ie(Bt),this.embeddedTutorialManager=ie(kt),this.nodeRuntimeState=ie(Rt),this.typingsLoader=ie(Ot),this._isProjectInitialized=Y(!1),this._isAngularCliInitialized=Y(!1),this.urlToPreview$=new Ee(""),this._previewUrl$=this.urlToPreview$.asObservable(),this.processes=new Set}get previewUrl$(){return this._previewUrl$}async init(){if(!this.nodeRuntimeState.error())try{if(!this.embeddedTutorialManager.type())throw Error("\u6559\u7A0B\u7C7B\u578B\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u521D\u59CB\u5316 NodeRuntimeSandbox\u3002");console.time("\u52A0\u8F7D\u65F6\u95F4");let E;this.nodeRuntimeState.loadingStep()===Q.NOT_STARTED?(this.alertManager.init(),E=await this.boot(),await this.handleWebcontainerErrors()):E=await this.webContainerPromise,await this.startInteractiveTerminal(E),this.terminalHandler.clearTerminals(),this.embeddedTutorialManager.type()==="cli"?await this.initAngularCli():await this.initProject(),console.timeEnd("\u52A0\u8F7D\u65F6\u95F4")}catch(E){this.setErrorState(E.message)}}async reset(){this.nodeRuntimeState.isResetting()||(this.nodeRuntimeState.setIsResetting(!0),this.nodeRuntimeState.loadingStep()===Q.READY?await this.restartDevServer():(await this.cleanup(),this.setLoading(Q.BOOT),this._isProjectInitialized.set(!1),await this.init()),this.nodeRuntimeState.setIsResetting(!1))}async restartDevServer(){this.devServerProcess?.kill(),await this.startDevServer()}async getSolutionFiles(){let E=await this.webContainerPromise,y=["node_modules",".angular","dist"];return await ct("/",E.fs,r=>!!r&&!y.includes(r))}async initProject(){if(this._isProjectInitialized())return;this._isAngularCliInitialized()&&(await this.cleanup(),this._isAngularCliInitialized.set(!1)),this._isProjectInitialized.set(!0),await this.mountProjectFiles(),this.handleProjectChanges();let E=await this.installDependencies();if(![143,0].includes(E))throw new Error("\u5B89\u88C5\u5931\u8D25");await Promise.all([this.loadTypes(),this.startDevServer()])}handleProjectChanges(){this.embeddedTutorialManager.tutorialChanged$.pipe(st(E=>({tutorialChanged:E,tutorialFiles:this.embeddedTutorialManager.tutorialFiles()})),rt(({tutorialChanged:E,tutorialFiles:y})=>E&&Object.keys(y).length>0),_t(this.destroyRef)).subscribe(async()=>{await Promise.all([this.mountProjectFiles(),this.handleFilesToDeleteOnProjectChange()]),this.embeddedTutorialManager.shouldReInstallDependencies()&&await this.handleInstallDependenciesOnProjectChange()})}async handleFilesToDeleteOnProjectChange(){let E=Array.from(new Set([...this.embeddedTutorialManager.filesToDeleteFromPreviousProject(),...Array.from(this._createdFiles())]));E.length&&await Promise.all(E.map(y=>this.deleteFile(y))),this._createdFiles.set(new Set)}async handleInstallDependenciesOnProjectChange(){this.devServerProcess?.kill(),await this.installDependencies(),await Promise.all([this.loadTypes(),this.startDevServer()])}async initAngularCli(){if(this._isAngularCliInitialized())return;this._isProjectInitialized()&&(await this.cleanup(),this.urlToPreview$.next(null),this._isProjectInitialized.set(!1)),this._isAngularCliInitialized.set(!0),this.setLoading(Q.INSTALL);let E=await this.installAngularCli();[143,0].includes(E)||this.setLoading(Q.READY)}async writeFile(E,y){let r=await this.webContainerPromise;try{await r.fs.writeFile(E,y)}catch(n){if(n.message.startsWith("ENOENT")){let h=E.split("/").slice(0,-1).join("/");await r.fs.mkdir(h,{recursive:!0}),await r.fs.writeFile(E,y)}else throw n}}async renameFile(E,y){let r=await this.webContainerPromise;try{await r.fs.rename(E,y)}catch(n){throw n}}async readFile(E){return(await this.webContainerPromise).fs.readFile(E,"utf-8")}async deleteFile(E){return(await this.webContainerPromise).fs.rm(E)}async startInteractiveTerminal(E){if(this.interactiveShellProcess)return this.interactiveShellProcess;let y=this.terminalHandler.interactiveTerminalInstance,r=await E.spawn("bash");this.interactiveShellProcess=r;let n=/(\u001b\[\d+m)?([^\s]+)(\u001b\[\d+m)?/g;r.output.pipeTo(new WritableStream({write:_=>{if(this.checkForOutOfMemoryError(_.toString()),y.write(_),_.includes("CREATE")&&_.endsWith(`\r
`)){let d=_.match(n)?.[1];d&&(this._createdFile$.next(d),this._createdFiles.update(u=>u.add(d)))}}}));let h=r.input.getWriter();return this.interactiveShellWriter=h,y.onData(_=>{h.write(_)}),y.breakProcess$.subscribe(()=>{h.write("")}),r}async mountProjectFiles(){if(!this.embeddedTutorialManager.tutorialFilesystemTree())return;this.nodeRuntimeState.loadingStep()!==Q.READY&&this.setLoading(Q.LOAD_FILES),Object.keys(this.embeddedTutorialManager.tutorialFilesystemTree()).length>0&&await Promise.all([this.mountFiles(this.embeddedTutorialManager.commonFilesystemTree()),this.mountFiles(this.embeddedTutorialManager.tutorialFilesystemTree())])}setLoading(E){this.nodeRuntimeState.setLoadingStep(E)}async mountFiles(E){await(await this.webContainerPromise).mount(E)}async boot(){return this.setLoading(Q.BOOT),this.webContainerPromise||(this.webContainerPromise=Ge.boot()),await this.webContainerPromise}terminate(E){E?.teardown(),this.webContainerPromise=void 0}async handleWebcontainerErrors(){(await this.webContainerPromise).on("error",({message:y})=>{this.checkForOutOfMemoryError(y)||this.setErrorState(y,ce.UNKNOWN)})}checkForOutOfMemoryError(E){return E.toLowerCase().includes(Xe.toLowerCase())?(this.setErrorState(E,ce.OUT_OF_MEMORY),!0):!1}setErrorState(E,y){this.nodeRuntimeState.setError({message:E,type:y}),this.nodeRuntimeState.setLoadingStep(Q.ERROR),this.terminate()}async installDependencies(){this.setLoading(Q.INSTALL);let E=await this.spawn(tt,["install"]);return E.output.pipeTo(new WritableStream({write:y=>{this.terminalHandler.readonlyTerminalInstance.write(y)}})),E.exit}async loadTypes(){let E=await this.webContainerPromise;await this.typingsLoader.retrieveTypeDefinitions(E)}async installAngularCli(){let E=await this.spawn(tt,["install","@angular/cli@latest"]);E.output.pipeTo(new WritableStream({write:r=>{this.terminalHandler.interactiveTerminalInstance.write(r)}}));let y=await E.exit;return this.interactiveShellWriter?.write("\r"),y}async startDevServer(){let E=await this.webContainerPromise;this.setLoading(Q.START_DEV_SERVER),this.devServerProcess=await this.spawn(tt,["run","start"]),E.on("server-ready",(y,r)=>{this.urlToPreview$.next(r)}),await new Promise((y,r)=>{if(!this.devServerProcess){r("\u6CA1\u6709\u8FD0\u884C\u4E2D\u7684\u5F00\u53D1\u670D\u52A1\u5668");return}this.devServerProcess.output.pipeTo(new WritableStream({write:n=>{if(this.terminalHandler.readonlyTerminalInstance.write(n),this.checkForOutOfMemoryError(n.toString())){r(new Error(n.toString()));return}this.nodeRuntimeState.loadingStep()!==Q.READY&&n.toString().includes(hi)&&(y(),this.setLoading(Q.READY))}}))})}async spawn(E,y=[]){let n=await(await this.webContainerPromise).spawn(E,y),h=new TransformStream({transform:(_,o)=>{this.checkForOutOfMemoryError(_.toString()),o.enqueue(_)}});return n.output=n.output.pipeThrough(h),this.processes.add(n),n}async cleanup(){await this.killExistingProcesses(),await this.removeFiles()}async killExistingProcesses(){await Promise.all(Array.from(this.processes).map(E=>E.kill())),this.processes.clear()}async removeFiles(){await(await this.webContainerPromise).spawn("rm",["-rf","./**"])}};T.\u0275fac=function(y){return new(y||T)},T.\u0275prov=te({token:T,factory:T.\u0275fac,providedIn:"root"});let L=T;return L})();export{kt as a,Q as b,ii as c,de as d,Bt as e,Ot as f,hi as g,Xe as h,tt as i,sr as j,ce as k,Rt as l};