@hyzyn/dsh-tty 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -42
- package/client.js +121 -24
- package/lib/index.d.ts +29 -4
- package/lib/index.js +977 -66
- package/lib/index.js.map +1 -1
- package/lib/known-hosts.d.ts +6 -0
- package/lib/known-hosts.js +129 -0
- package/lib/known-hosts.js.map +1 -0
- package/lib/shell-integration.d.ts +11 -0
- package/lib/shell-integration.js +144 -0
- package/lib/shell-integration.js.map +1 -0
- package/lib/ssh-config.d.ts +15 -0
- package/lib/ssh-config.js +74 -0
- package/lib/ssh-config.js.map +1 -0
- package/lib/ssh.d.ts +40 -0
- package/lib/ssh.js +54 -14
- package/lib/ssh.js.map +1 -1
- package/lib/tunnels.d.ts +65 -0
- package/lib/tunnels.js +327 -0
- package/lib/tunnels.js.map +1 -0
- package/package.json +7 -2
package/client.js
CHANGED
|
@@ -1,38 +1,121 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`))),this.register(this._terminal.onA11yTab(
|
|
3
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let c=this._terminal.buffer,g=c.lines.length.toString();for(let p=e;p<=i;p++){let m=c.lines.get(c.ydisp+p),d=[],b=m?.translateToString(!0,void 0,void 0,d)||"",L=(c.ydisp+p+1).toString(),T=this._rowElements[p];T&&(b.length===0?(T.innerText="\xA0",this._rowColumns.set(T,[0,1])):(T.textContent=b,this._rowColumns.set(T,d)),T.setAttribute("aria-posinset",L),T.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let c=e.target,g=this._rowElements[i===0?1:this._rowElements.length-2];if(c.getAttribute("aria-posinset")===(i===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==g)return;let p,m;if(i===0?(p=c,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(p=this._rowElements.shift(),m=c,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{let d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},c={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(c.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===c.node&&i.offset>c.offset)&&([i,c]=[c,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let g=this._rowElements.slice(-1)[0];if(c.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(c={node:g,offset:g.textContent?.length??0}),!this._rowContainer.contains(c.node))return;let p=({node:b,offset:L})=>{let T=b instanceof Text?b.parentNode:b,B=parseInt(T?.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;let D=this._rowColumns.get(T);if(!D)return console.warn("columns is null. Race condition?"),null;let F=L<D.length?D[L]:D.slice(-1)[0]+1;return F>=this._terminal.cols&&(++B,F=0),{row:B,column:F}},m=p(i),d=p(c);if(m&&d){if(m.row>d.row||m.row===d.row&&m.column>=d.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(d.row-m.row)*this._terminal.cols-m.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=s=h([f(1,u.IInstantiationService),f(2,S.ICoreBrowserService),f(3,S.IRenderService)],s)},3614:(E,r)=>{function n(_){return _.replace(/\r?\n/g,"\r")}function h(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function f(_,v,S,u){_=h(_=n(_),S.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(_,!0),v.value=""}function o(_,v,S){let u=S.getBoundingClientRect(),t=_.clientX-u.left-10,s=_.clientY-u.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${t}px`,v.style.top=`${s}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=n,r.bracketTextForPaste=h,r.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},r.handlePasteEvent=function(_,v,S,u){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),v,S,u)},r.paste=f,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(_,v,S,u,t){o(_,v,S),t&&u.rightClickSelect(_),v.value=u.selectionText,v.select()}},7239:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let h=n(1505);r.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(f,o,_){this._css.set(f,o,_)}getCss(f,o){return this._css.get(f,o)}setColor(f,o,_){this._color.set(f,o,_)}getColor(f,o){return this._color.get(f,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(n,h,f,o){n.addEventListener(h,f,o);let _=!1;return{dispose:()=>{_||(_=!0,n.removeEventListener(h,f,o))}}}},3551:function(E,r,n){var h=this&&this.__decorate||function(s,e,i,c){var g,p=arguments.length,m=p<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,c);else for(var d=s.length-1;d>=0;d--)(g=s[d])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(s,e){return function(i,c){e(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let o=n(3656),_=n(8460),v=n(844),S=n(2585),u=n(4725),t=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(s,e,i,c,g){super(),this._element=s,this._mouseService=e,this._renderService=i,this._bufferService=c,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=s.composedPath();for(let c=0;c<i.length;c++){let g=i[c];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach(c=>{c?.forEach(g=>{g.link.dispose&&g.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let i=!1;for(let[c,g]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(c)&&(i=this._checkLinkProviderResult(c,s,i)):g.provideLinks(s.y,p=>{if(this._isMouseOut)return;let m=p?.map(d=>({link:d}));this._activeProviderReplies?.set(c,m),i=this._checkLinkProviderResult(c,s,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,e){let i=new Set;for(let c=0;c<e.size;c++){let g=e.get(c);if(g)for(let p=0;p<g.length;p++){let m=g[p],d=m.link.range.start.y<s?0:m.link.range.start.x,b=m.link.range.end.y>s?this._bufferService.cols:m.link.range.end.x;for(let L=d;L<=b;L++){if(i.has(L)){g.splice(p--,1);break}i.add(L)}}}}_checkLinkProviderResult(s,e,i){if(!this._activeProviderReplies)return i;let c=this._activeProviderReplies.get(s),g=!1;for(let p=0;p<s;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(g=!0);if(!g&&c){let p=c.find(m=>this._linkAtPosition(m.link,e));p&&(i=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let p=0;p<this._activeProviderReplies.size;p++){let m=this._activeProviderReplies.get(p)?.find(d=>this._linkAtPosition(d.link,e));if(m){i=!0,this._handleNewLink(m);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let c=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=c&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(c,g),this._lastMouseEvent)){let p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!1)}})))}_linkHover(s,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(s,e){let i=s.range,c=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-c-1,i.end.x,i.end.y-c-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(s,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(s,e){let i=s.range.start.y*this._bufferService.cols+s.range.start.x,c=s.range.end.y*this._bufferService.cols+s.range.end.x,g=e.y*this._bufferService.cols+e.x;return i<=g&&g<=c}_positionFromMouseEvent(s,e,i){let c=i.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(c)return{x:c[0],y:c[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,i,c,g){return{x1:s,y1:e,x2:i,y2:c,cols:this._bufferService.cols,fg:g}}};r.Linkifier=t=h([f(1,u.IMouseService),f(2,u.IRenderService),f(3,S.IBufferService),f(4,u.ILinkProviderService)],t)},9042:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(E,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,c=arguments.length,g=c<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(c<3?i(g):c>3?i(t,s,g):i(t,s))||g);return c>3&&g&&Object.defineProperty(t,s,g),g},f=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let o=n(511),_=n(2585),v=r.OscLinkProvider=class{constructor(u,t,s){this._bufferService=u,this._optionsService=t,this._oscLinkService=s}provideLinks(u,t){let s=this._bufferService.buffer.lines.get(u-1);if(!s)return void t(void 0);let e=[],i=this._optionsService.rawOptions.linkHandler,c=new o.CellData,g=s.getTrimmedLength(),p=-1,m=-1,d=!1;for(let b=0;b<g;b++)if(m!==-1||s.hasContent(b)){if(s.loadCell(b,c),c.hasExtendedAttrs()&&c.extended.urlId){if(m===-1){m=b,p=c.extended.urlId;continue}d=c.extended.urlId!==p}else m!==-1&&(d=!0);if(d||m!==-1&&b===g-1){let L=this._oscLinkService.getLinkData(p)?.uri;if(L){let T={start:{x:m+1,y:u},end:{x:b+(d||b!==g-1?0:1),y:u}},B=!1;if(!i?.allowNonHttpProtocols)try{let D=new URL(L);["http:","https:"].includes(D.protocol)||(B=!0)}catch{B=!0}B||e.push({text:L,range:T,activate:(D,F)=>i?i.activate(D,F,T):S(0,F),hover:(D,F)=>i?.hover?.(D,F,T),leave:(D,F)=>i?.leave?.(D,F,T)})}d=!1,c.hasExtendedAttrs()&&c.extended.urlId?(m=b,p=c.extended.urlId):(m=-1,p=-1)}}t(e)}};function S(u,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
"use strict";(()=>{var Qn=Object.create;var Is=Object.defineProperty;var eo=Object.getOwnPropertyDescriptor;var to=Object.getOwnPropertyNames;var io=Object.getPrototypeOf,so=Object.prototype.hasOwnProperty;var Hs=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ro=(e,t,r,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let h of to(t))!so.call(e,h)&&h!==r&&Is(e,h,{get:()=>t[h],enumerable:!(d=eo(t,h))||d.enumerable});return e};var Fs=(e,t,r)=>(r=e!=null?Qn(io(e)):{},ro(t||!e||!e.__esModule?Is(r,"default",{value:e,enumerable:!0}):r,e));var Ws=Hs((ti,Fi)=>{(function(e,t){if(typeof ti=="object"&&typeof Fi=="object")Fi.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var d in r)(typeof ti=="object"?ti:e)[d]=r[d]}})(globalThis,()=>(()=>{"use strict";var e={4567:function(h,i,s){var l=this&&this.__decorate||function(o,u,v,C){var S,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(o,u,v,C);else for(var x=o.length-1;x>=0;x--)(S=o[x])&&(m=(y<3?S(m):y>3?S(u,v,m):S(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},_=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;let n=s(9042),f=s(9924),g=s(844),b=s(4725),p=s(2585),a=s(3656),c=i.AccessibilityManager=class extends g.Disposable{constructor(o,u,v,C){super(),this._terminal=o,this._coreBrowserService=v,this._renderService=C,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 S=0;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);if(this._topBoundaryFocusListener=S=>this._handleBoundaryFocus(S,0),this._bottomBoundaryFocusListener=S=>this._handleBoundaryFocus(S,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new f.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(S=>this._handleResize(S.rows))),this.register(this._terminal.onRender(S=>this._refreshRows(S.start,S.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(S=>this._handleChar(S))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
|
+
`))),this.register(this._terminal.onA11yTab(S=>this._handleTab(S))),this.register(this._terminal.onKey(S=>this._handleKey(S.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,a.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,g.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(o){for(let u=0;u<o;u++)this._handleChar(" ")}_handleChar(o){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==o&&(this._charsToAnnounce+=o):this._charsToAnnounce+=o,o===`
|
|
3
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(o){this._clearLiveRegion(),/\p{Control}/u.test(o)||this._charsToConsume.push(o)}_refreshRows(o,u){this._liveRegionDebouncer.refresh(o,u,this._terminal.rows)}_renderRows(o,u){let v=this._terminal.buffer,C=v.lines.length.toString();for(let S=o;S<=u;S++){let y=v.lines.get(v.ydisp+S),m=[],x=y?.translateToString(!0,void 0,void 0,m)||"",T=(v.ydisp+S+1).toString(),P=this._rowElements[S];P&&(x.length===0?(P.innerText="\xA0",this._rowColumns.set(P,[0,1])):(P.textContent=x,this._rowColumns.set(P,m)),P.setAttribute("aria-posinset",T),P.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(o,u){let v=o.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||o.relatedTarget!==C)return;let S,y;if(u===0?(S=v,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(S=this._rowElements.shift(),y=v,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),o.preventDefault(),o.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let o=document.getSelection();if(!o)return;if(o.isCollapsed)return void(this._rowContainer.contains(o.anchorNode)&&this._terminal.clearSelection());if(!o.anchorNode||!o.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:o.anchorNode,offset:o.anchorOffset},v={node:o.focusNode,offset:o.focusOffset};if((u.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===v.node&&u.offset>v.offset)&&([u,v]=[v,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;let C=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:C,offset:C.textContent?.length??0}),!this._rowContainer.contains(v.node))return;let S=({node:x,offset:T})=>{let P=x instanceof Text?x.parentNode:x,I=parseInt(P?.getAttribute("aria-posinset"),10)-1;if(isNaN(I))return console.warn("row is invalid. Race condition?"),null;let R=this._rowColumns.get(P);if(!R)return console.warn("columns is null. Race condition?"),null;let W=T<R.length?R[T]:R.slice(-1)[0]+1;return W>=this._terminal.cols&&(++I,W=0),{row:I,column:W}},y=S(u),m=S(v);if(y&&m){if(y.row>m.row||y.row===m.row&&y.column>=m.column)throw new Error("invalid range");this._terminal.select(y.column,y.row,(m.row-y.row)*this._terminal.cols-y.column+m.column)}}_handleResize(o){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>o;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let o=this._coreBrowserService.mainDocument.createElement("div");return o.setAttribute("role","listitem"),o.tabIndex=-1,this._refreshRowDimensions(o),o}_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 o=0;o<this._terminal.rows;o++)this._refreshRowDimensions(this._rowElements[o])}}_refreshRowDimensions(o){o.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=c=l([_(1,p.IInstantiationService),_(2,b.ICoreBrowserService),_(3,b.IRenderService)],c)},3614:(h,i)=>{function s(f){return f.replace(/\r?\n/g,"\r")}function l(f,g){return g?"\x1B[200~"+f+"\x1B[201~":f}function _(f,g,b,p){f=l(f=s(f),b.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),b.triggerDataEvent(f,!0),g.value=""}function n(f,g,b){let p=b.getBoundingClientRect(),a=f.clientX-p.left-10,c=f.clientY-p.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${a}px`,g.style.top=`${c}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=s,i.bracketTextForPaste=l,i.copyHandler=function(f,g){f.clipboardData&&f.clipboardData.setData("text/plain",g.selectionText),f.preventDefault()},i.handlePasteEvent=function(f,g,b,p){f.stopPropagation(),f.clipboardData&&_(f.clipboardData.getData("text/plain"),g,b,p)},i.paste=_,i.moveTextAreaUnderMouseCursor=n,i.rightClickHandler=function(f,g,b,p,a){n(f,g,b),a&&p.rightClickSelect(f),g.value=p.selectionText,g.select()}},7239:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;let l=s(1505);i.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(_,n,f){this._css.set(_,n,f)}getCss(_,n){return this._css.get(_,n)}setColor(_,n,f){this._color.set(_,n,f)}getColor(_,n){return this._color.get(_,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(s,l,_,n){s.addEventListener(l,_,n);let f=!1;return{dispose:()=>{f||(f=!0,s.removeEventListener(l,_,n))}}}},3551:function(h,i,s){var l=this&&this.__decorate||function(c,o,u,v){var C,S=arguments.length,y=S<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(c,o,u,v);else for(var m=c.length-1;m>=0;m--)(C=c[m])&&(y=(S<3?C(y):S>3?C(o,u,y):C(o,u))||y);return S>3&&y&&Object.defineProperty(o,u,y),y},_=this&&this.__param||function(c,o){return function(u,v){o(u,v,c)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;let n=s(3656),f=s(8460),g=s(844),b=s(2585),p=s(4725),a=i.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(c,o,u,v,C){super(),this._element=c,this._mouseService=o,this._renderService=u,this._bufferService=v,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new f.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new f.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(c){this._lastMouseEvent=c;let o=this._positionFromMouseEvent(c,this._element,this._mouseService);if(!o)return;this._isMouseOut=!1;let u=c.composedPath();for(let v=0;v<u.length;v++){let C=u[v];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&o.x===this._lastBufferCell.x&&o.y===this._lastBufferCell.y||(this._handleHover(o),this._lastBufferCell=o)}_handleHover(c){if(this._activeLine!==c.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(c,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,c)||(this._clearCurrentLink(),this._askForLink(c,!0))}_askForLink(c,o){this._activeProviderReplies&&o||(this._activeProviderReplies?.forEach(v=>{v?.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=c.y);let u=!1;for(let[v,C]of this._linkProviderService.linkProviders.entries())o?this._activeProviderReplies?.get(v)&&(u=this._checkLinkProviderResult(v,c,u)):C.provideLinks(c.y,S=>{if(this._isMouseOut)return;let y=S?.map(m=>({link:m}));this._activeProviderReplies?.set(v,y),u=this._checkLinkProviderResult(v,c,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(c.y,this._activeProviderReplies)})}_removeIntersectingLinks(c,o){let u=new Set;for(let v=0;v<o.size;v++){let C=o.get(v);if(C)for(let S=0;S<C.length;S++){let y=C[S],m=y.link.range.start.y<c?0:y.link.range.start.x,x=y.link.range.end.y>c?this._bufferService.cols:y.link.range.end.x;for(let T=m;T<=x;T++){if(u.has(T)){C.splice(S--,1);break}u.add(T)}}}}_checkLinkProviderResult(c,o,u){if(!this._activeProviderReplies)return u;let v=this._activeProviderReplies.get(c),C=!1;for(let S=0;S<c;S++)this._activeProviderReplies.has(S)&&!this._activeProviderReplies.get(S)||(C=!0);if(!C&&v){let S=v.find(y=>this._linkAtPosition(y.link,o));S&&(u=!0,this._handleNewLink(S))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let S=0;S<this._activeProviderReplies.size;S++){let y=this._activeProviderReplies.get(S)?.find(m=>this._linkAtPosition(m.link,o));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(c){if(!this._currentLink)return;let o=this._positionFromMouseEvent(c,this._element,this._mouseService);o&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,o)&&this._currentLink.link.activate(c,this._currentLink.link.text)}_clearCurrentLink(c,o){this._currentLink&&this._lastMouseEvent&&(!c||!o||this._currentLink.link.range.start.y>=c&&this._currentLink.link.range.end.y<=o)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(c){if(!this._lastMouseEvent)return;let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._linkAtPosition(c.link,o)&&(this._currentLink=c,this._currentLink.state={decorations:{underline:c.link.decorations===void 0||c.link.decorations.underline,pointerCursor:c.link.decorations===void 0||c.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,c.link,this._lastMouseEvent),c.link.decorations={},Object.defineProperties(c.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:u=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:u=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(c.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(u=>{if(!this._currentLink)return;let v=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(v,C),this._lastMouseEvent)){let S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}})))}_linkHover(c,o,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!0),this._currentLink.state.decorations.pointerCursor&&c.classList.add("xterm-cursor-pointer")),o.hover&&o.hover(u,o.text)}_fireUnderlineEvent(c,o){let u=c.range,v=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-v-1,u.end.x,u.end.y-v-1,void 0);(o?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(c,o,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!1),this._currentLink.state.decorations.pointerCursor&&c.classList.remove("xterm-cursor-pointer")),o.leave&&o.leave(u,o.text)}_linkAtPosition(c,o){let u=c.range.start.y*this._bufferService.cols+c.range.start.x,v=c.range.end.y*this._bufferService.cols+c.range.end.x,C=o.y*this._bufferService.cols+o.x;return u<=C&&C<=v}_positionFromMouseEvent(c,o,u){let v=u.getCoords(c,o,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(c,o,u,v,C){return{x1:c,y1:o,x2:u,y2:v,cols:this._bufferService.cols,fg:C}}};i.Linkifier=a=l([_(1,p.IMouseService),_(2,p.IRenderService),_(3,b.IBufferService),_(4,p.ILinkProviderService)],a)},9042:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(h,i,s){var l=this&&this.__decorate||function(p,a,c,o){var u,v=arguments.length,C=v<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,c):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,a,c,o);else for(var S=p.length-1;S>=0;S--)(u=p[S])&&(C=(v<3?u(C):v>3?u(a,c,C):u(a,c))||C);return v>3&&C&&Object.defineProperty(a,c,C),C},_=this&&this.__param||function(p,a){return function(c,o){a(c,o,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;let n=s(511),f=s(2585),g=i.OscLinkProvider=class{constructor(p,a,c){this._bufferService=p,this._optionsService=a,this._oscLinkService=c}provideLinks(p,a){let c=this._bufferService.buffer.lines.get(p-1);if(!c)return void a(void 0);let o=[],u=this._optionsService.rawOptions.linkHandler,v=new n.CellData,C=c.getTrimmedLength(),S=-1,y=-1,m=!1;for(let x=0;x<C;x++)if(y!==-1||c.hasContent(x)){if(c.loadCell(x,v),v.hasExtendedAttrs()&&v.extended.urlId){if(y===-1){y=x,S=v.extended.urlId;continue}m=v.extended.urlId!==S}else y!==-1&&(m=!0);if(m||y!==-1&&x===C-1){let T=this._oscLinkService.getLinkData(S)?.uri;if(T){let P={start:{x:y+1,y:p},end:{x:x+(m||x!==C-1?0:1),y:p}},I=!1;if(!u?.allowNonHttpProtocols)try{let R=new URL(T);["http:","https:"].includes(R.protocol)||(I=!0)}catch{I=!0}I||o.push({text:T,range:P,activate:(R,W)=>u?u.activate(R,W,P):b(0,W),hover:(R,W)=>u?.hover?.(R,W,P),leave:(R,W)=>u?.leave?.(R,W,P)})}m=!1,v.hasExtendedAttrs()&&v.extended.urlId?(y=x,S=v.extended.urlId):(y=-1,S=-1)}}a(o)}};function b(p,a){if(confirm(`Do you want to navigate to ${a}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=h([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],v)},6193:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(n,h){this._renderCallback=n,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(n){return this._refreshCallbacks.push(n),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(n,h,f){this._rowCount=f,n=n!==void 0?n:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let n=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let h=n(3614),f=n(3656),o=n(3551),_=n(9042),v=n(3730),S=n(1680),u=n(3107),t=n(5744),s=n(2950),e=n(1296),i=n(428),c=n(4269),g=n(5114),p=n(8934),m=n(3230),d=n(9312),b=n(4725),L=n(6731),T=n(8055),B=n(8969),D=n(8460),F=n(844),I=n(6114),O=n(8437),H=n(2584),P=n(7399),C=n(5941),k=n(9074),R=n(2585),A=n(5435),N=n(4567),z=n(779);class q extends B.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(M={}){super(M),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new F.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(k.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(b.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((x,W)=>this.refresh(x,W))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(x=>this._reportWindowsOptions(x))),this.register(this._inputHandler.onColor(x=>this._handleColorEvent(x))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(x=>this._afterResize(x.cols,x.rows))),this.register((0,F.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(M){if(this._themeService)for(let x of M){let W,U="";switch(x.index){case 256:W="foreground",U="10";break;case 257:W="background",U="11";break;case 258:W="cursor",U="12";break;default:W="ansi",U="4;"+x.index}switch(x.type){case 0:let $=T.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[x.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${U};${(0,C.toRgbString)($)}${H.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(j=>j.ansi[x.index]=T.channels.toColor(...x.color));else{let j=W;this._themeService.modifyColors(G=>G[j]=T.channels.toColor(...x.color))}break;case 2:this._themeService.restoreColor(x.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(M){M?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(M){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let M=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(M);if(!x)return;let W=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,$=x.getWidth(W),j=this._renderService.dimensions.css.cell.width*$,G=this.buffer.y*this._renderService.dimensions.css.cell.height,Z=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Z+"px",this.textarea.style.top=G+"px",this.textarea.style.width=j+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",x=>{this.hasSelection()&&(0,h.copyHandler)(x,this._selectionService)}));let M=x=>(0,h.handlePasteEvent)(x,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",M)),this.register((0,f.addDisposableDomListener)(this.element,"paste",M)),I.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",x=>{x.button===2&&(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",x=>{(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",x=>{x.button===1&&(0,h.moveTextAreaUnderMouseCursor)(x,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",M=>this._keyUp(M),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",M=>this._keyDown(M),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",M=>this._keyPress(M),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",M=>this._compositionHelper.compositionupdate(M))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,f.addDisposableDomListener)(this.textarea,"input",M=>this._inputEvent(M),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(M){if(!M)throw new Error("Terminal requires a parent element.");if(M.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=M.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),M.appendChild(this.element);let x=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),x.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,f.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),x.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),I.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(g.CoreBrowserService,this.textarea,M.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(b.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(b.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(L.ThemeService),this._instantiationService.setService(b.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(c.CharacterJoinerService),this._instantiationService.setService(b.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(b.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(b.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.Linkifier,this.screenElement)),this.element.appendChild(x);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(b.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let M=this,x=this.element;function W(j){let G=M._mouseService.getMouseReportCoords(j,M.screenElement);if(!G)return!1;let Z,Q;switch(j.overrideType||j.type){case"mousemove":Q=32,j.buttons===void 0?(Z=3,j.button!==void 0&&(Z=j.button<3?j.button:3)):Z=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":Q=0,Z=j.button<3?j.button:3;break;case"mousedown":Q=1,Z=j.button<3?j.button:3;break;case"wheel":if(M._customWheelEventHandler&&M._customWheelEventHandler(j)===!1||M.viewport.getLinesScrolled(j)===0)return!1;Q=j.deltaY<0?0:1,Z=4;break;default:return!1}return!(Q===void 0||Z===void 0||Z>4)&&M.coreMouseService.triggerMouseEvent({col:G.col,row:G.row,x:G.x,y:G.y,button:Z,action:Q,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:j=>(W(j),j.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(j)),wheel:j=>(W(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&W(j)},mousemove:j=>{j.buttons||W(j)}};this.register(this.coreMouseService.onProtocolChange(j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&j?U.mousemove||(x.addEventListener("mousemove",$.mousemove),U.mousemove=$.mousemove):(x.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&j?U.wheel||(x.addEventListener("wheel",$.wheel,{passive:!1}),U.wheel=$.wheel):(x.removeEventListener("wheel",U.wheel),U.wheel=null),2&j?U.mouseup||(U.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&j?U.mousedrag||(U.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(x,"mousedown",j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return W(j),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(j)})),this.register((0,f.addDisposableDomListener)(x,"wheel",j=>{if(!U.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let G=this.viewport.getLinesScrolled(j);if(G===0)return;let Z=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),Q="";for(let te=0;te<Math.abs(G);te++)Q+=Z;return this.coreService.triggerDataEvent(Q,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}},{passive:!1})),this.register((0,f.addDisposableDomListener)(x,"touchstart",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)},{passive:!0})),this.register((0,f.addDisposableDomListener)(x,"touchmove",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)},{passive:!1}))}refresh(M,x){this._renderService?.refreshRows(M,x)}updateCursorStyle(M){this._selectionService?.shouldColumnSelect(M)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(M,x,W=0){W===1?(super.scrollLines(M,x,W),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(M)}paste(M){(0,h.paste)(M,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(M){this._customKeyEventHandler=M}attachCustomWheelEventHandler(M){this._customWheelEventHandler=M}registerLinkProvider(M){return this._linkProviderService.registerLinkProvider(M)}registerCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let x=this._characterJoinerService.register(M);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(M)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(M){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+M)}registerDecoration(M){return this._decorationService.registerDecoration(M)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(M,x,W){this._selectionService.setSelection(M,x,W)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(M,x){this._selectionService?.selectLines(M,x)}_keyDown(M){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;let x=this.browser.isMac&&this.options.macOptionIsMeta&&M.altKey;if(!x&&!this._compositionHelper.keydown(M))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;x||M.key!=="Dead"&&M.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let W=(0,P.evaluateKeyboardEvent)(M,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(M),W.type===3||W.type===2){let U=this.rows-1;return this.scrollLines(W.type===2?-U:U),this.cancel(M,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,M)||(W.cancel&&this.cancel(M,!0),!W.key||!!(M.key&&!M.ctrlKey&&!M.altKey&&!M.metaKey&&M.key.length===1&&M.key.charCodeAt(0)>=65&&M.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==H.C0.ETX&&W.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||M.altKey||M.ctrlKey?this.cancel(M,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(M,x){let W=M.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||M.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||M.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?W:W&&(!x.keyCode||x.keyCode>47)}_keyUp(M){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1||(function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18}(M)||this.focus(),this.updateCursorStyle(M),this._keyPressHandled=!1)}_keyPress(M){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;if(this.cancel(M),M.charCode)x=M.charCode;else if(M.which===null||M.which===void 0)x=M.keyCode;else{if(M.which===0||M.charCode===0)return!1;x=M.which}return!(!x||(M.altKey||M.ctrlKey||M.metaKey)&&!this._isThirdLevelShift(this.browser,M)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(M){if(M.data&&M.inputType==="insertText"&&(!M.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let x=M.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(M),!0}return!1}resize(M,x){M!==this.cols||x!==this.rows?super.resize(M,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(M,x){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let M=1;M<this.rows;M++)this.buffer.lines.push(this.buffer.getBlankLine(O.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let M=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=M,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(M){if(this._renderService)switch(M){case A.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let x=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${W};${x}t`);break;case A.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let U=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${$};${U}t`)}}cancel(M,x){if(this.options.cancelEvents||x)return M.preventDefault(),M.stopPropagation(),!1}}r.Terminal=q},9924:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(n,h=1e3){this._renderCallback=n,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,h,f){this._rowCount=f,n=n!==void 0?n:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=o-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h)}}},1680:function(E,r,n){var h=this&&this.__decorate||function(s,e,i,c){var g,p=arguments.length,m=p<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,c);else for(var d=s.length-1;d>=0;d--)(g=s[d])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(s,e){return function(i,c){e(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let o=n(3656),_=n(4725),v=n(8460),S=n(844),u=n(2585),t=r.Viewport=class extends S.Disposable{constructor(s,e,i,c,g,p,m,d){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=i,this._optionsService=c,this._charSizeService=g,this._renderService=p,this._coreBrowserService=m,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(b=>this._activeBuffer=b.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(b=>this._renderDimensions=b)),this._handleThemeChange(d.colors),this.register(d.onChangeColors(b=>this._handleThemeChange(b))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,e){let i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&i<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){let e=this._getPixelsScrolled(s);return e!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(s,e){let i,c="",g=[],p=e??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let d=s;d<p;d++){let b=m.get(d);if(!b)continue;let L=m.get(d+1)?.isWrapped;if(c+=b.translateToString(!L),!L||d===m.length-1){let T=document.createElement("div");T.textContent=c,g.push(T),c.length>0&&(i=T),c=""}}return{bufferElements:g,cursorElement:i}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){let i=this._optionsService.rawOptions.fastScrollModifier;return i==="alt"&&e.altKey||i==="ctrl"&&e.ctrlKey||i==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){let e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};r.Viewport=t=h([f(2,u.IBufferService),f(3,u.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],t)},3107:function(E,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,c=arguments.length,g=c<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(c<3?i(g):c>3?i(t,s,g):i(t,s))||g);return c>3&&g&&Object.defineProperty(t,s,g),g},f=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let o=n(4725),_=n(844),v=n(2585),S=r.BufferDecorationRenderer=class extends _.Disposable{constructor(u,t,s,e,i){super(),this._screenElement=u,this._bufferService=t,this._coreBrowserService=s,this._decorationService=e,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(c=>this._removeDecoration(c))),this.register((0,_.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let u of this._decorationService.decorations)this._renderDecoration(u);this._dimensionsChanged=!1}_renderDecoration(u){this._refreshStyle(u),this._dimensionsChanged&&this._refreshXPosition(u)}_createElement(u){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",u?.options?.layer==="top"),t.style.width=`${Math.round((u.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(u.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(u.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=u.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(u,t),t}_refreshStyle(u){let t=u.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)u.element&&(u.element.style.display="none",u.onRenderEmitter.fire(u.element));else{let s=this._decorationElements.get(u);s||(s=this._createElement(u),u.element=s,this._decorationElements.set(u,s),this._container.appendChild(s),u.onDispose(()=>{this._decorationElements.delete(u),s.remove()})),s.style.top=t*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",u.onRenderEmitter.fire(s)}}_refreshXPosition(u,t=u.element){if(!t)return;let s=u.options.x??0;(u.options.anchor||"left")==="right"?t.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(u){this._decorationElements.get(u)?.remove(),this._decorationElements.delete(u),u.dispose()}};r.BufferDecorationRenderer=S=h([f(1,v.IBufferService),f(2,o.ICoreBrowserService),f(3,v.IDecorationService),f(4,o.IRenderService)],S)},5871:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(n){if(n.options.overviewRulerOptions){for(let h of this._zones)if(h.color===n.options.overviewRulerOptions.color&&h.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,n.marker.line))return;if(this._lineAdjacentToZone(h,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(h,n.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=n.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=n.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=n.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=n.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:n.options.overviewRulerOptions.color,position:n.options.overviewRulerOptions.position,startBufferLine:n.marker.line,endBufferLine:n.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(n){this._linePadding=n}_lineIntersectsZone(n,h){return h>=n.startBufferLine&&h<=n.endBufferLine}_lineAdjacentToZone(n,h,f){return h>=n.startBufferLine-this._linePadding[f||"full"]&&h<=n.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(n,h){n.startBufferLine=Math.min(n.startBufferLine,h),n.endBufferLine=Math.max(n.endBufferLine,h)}}},5744:function(E,r,n){var h=this&&this.__decorate||function(i,c,g,p){var m,d=arguments.length,b=d<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,c,g,p);else for(var L=i.length-1;L>=0;L--)(m=i[L])&&(b=(d<3?m(b):d>3?m(c,g,b):m(c,g))||b);return d>3&&b&&Object.defineProperty(c,g,b),b},f=this&&this.__param||function(i,c){return function(g,p){c(g,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let o=n(5871),_=n(4725),v=n(844),S=n(2585),u={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(i,c,g,p,m,d,b){super(),this._viewportElement=i,this._screenElement=c,this._bufferService=g,this._decorationService=p,this._renderService=m,this._optionsService=d,this._coreBrowserService=b,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)(()=>{this._canvas?.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){let i=Math.floor(this._canvas.width/3),c=Math.ceil(this._canvas.width/3);t.full=this._canvas.width,t.left=i,t.center=c,t.right=i,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=t.left,s.right=t.left+t.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowserService.dpr);let i=this._canvas.height/this._bufferService.buffer.lines.length,c=Math.round(Math.max(Math.min(i,12),6)*this._coreBrowserService.dpr);u.left=c,u.center=c,u.right=c}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let c of this._decorationService.decorations)this._colorZoneStore.addDecoration(c);this._ctx.lineWidth=1;let i=this._colorZoneStore.zones;for(let c of i)c.position!=="full"&&this._renderColorZone(c);for(let c of i)c.position==="full"&&this._renderColorZone(c);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(i){this._ctx.fillStyle=i.color,this._ctx.fillRect(s[i.position||"full"],Math.round((this._canvas.height-1)*(i.startBufferLine/this._bufferService.buffers.active.lines.length)-u[i.position||"full"]/2),t[i.position||"full"],Math.round((this._canvas.height-1)*((i.endBufferLine-i.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[i.position||"full"]))}_queueRefresh(i,c){this._shouldUpdateDimensions=i||this._shouldUpdateDimensions,this._shouldUpdateAnchor=c||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};r.OverviewRulerRenderer=e=h([f(2,S.IBufferService),f(3,S.IDecorationService),f(4,_.IRenderService),f(5,S.IOptionsService),f(6,_.ICoreBrowserService)],e)},2950:function(E,r,n){var h=this&&this.__decorate||function(u,t,s,e){var i,c=arguments.length,g=c<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,t,s,e);else for(var p=u.length-1;p>=0;p--)(i=u[p])&&(g=(c<3?i(g):c>3?i(t,s,g):i(t,s))||g);return c>3&&g&&Object.defineProperty(t,s,g),g},f=this&&this.__param||function(u,t){return function(s,e){t(s,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let o=n(4725),_=n(2585),v=n(2584),S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,t,s,e,i,c){this._textarea=u,this._compositionView=t,this._bufferService=s,this._optionsService=e,this._coreService=i,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,t.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(t.start,t.end):this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let u=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(u,"");this._dataAlreadySent=s,t.length>u.length?this._coreService.triggerDataEvent(s,!0):t.length<u.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):t.length===u.length&&t!==u&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}u||setTimeout(()=>this.updateCompositionElements(!0),0)}}};r.CompositionHelper=S=h([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,o.IRenderService)],S)},9806:(E,r)=>{function n(h,f,o){let _=o.getBoundingClientRect(),v=h.getComputedStyle(o),S=parseInt(v.getPropertyValue("padding-left")),u=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-_.left-S,f.clientY-_.top-u]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=n,r.getCoords=function(h,f,o,_,v,S,u,t,s){if(!S)return;let e=n(h,f,o);return e?(e[0]=Math.ceil((e[0]+(s?u/2:0))/u),e[1]=Math.ceil(e[1]/t),e[0]=Math.min(Math.max(e[0],1),_+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),v),e):void 0}},9504:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let h=n(2584);function f(t,s,e,i){let c=t-o(t,e),g=s-o(s,e),p=Math.abs(c-g)-function(m,d,b){let L=0,T=m-o(m,b),B=d-o(d,b);for(let D=0;D<Math.abs(T-B);D++){let F=_(m,d)==="A"?-1:1;b.buffer.lines.get(T+F*D)?.isWrapped&&L++}return L}(t,s,e);return u(p,S(_(t,s),i))}function o(t,s){let e=0,i=s.buffer.lines.get(t),c=i?.isWrapped;for(;c&&t>=0&&t<s.rows;)e++,i=s.buffer.lines.get(--t),c=i?.isWrapped;return e}function _(t,s){return t>s?"A":"B"}function v(t,s,e,i,c,g){let p=t,m=s,d="";for(;p!==e||m!==i;)p+=c?1:-1,c&&p>g.cols-1?(d+=g.buffer.translateBufferLineToString(m,!1,t,p),p=0,t=0,m++):!c&&p<0&&(d+=g.buffer.translateBufferLineToString(m,!1,0,t+1),p=g.cols-1,t=p,m--);return d+g.buffer.translateBufferLineToString(m,!1,t,p)}function S(t,s){let e=s?"O":"[";return h.C0.ESC+e+t}function u(t,s){t=Math.floor(t);let e="";for(let i=0;i<t;i++)e+=s;return e}r.moveToCellSequence=function(t,s,e,i){let c=e.buffer.x,g=e.buffer.y;if(!e.buffer.hasScrollback)return function(d,b,L,T,B,D){return f(b,T,B,D).length===0?"":u(v(d,b,d,b-o(b,B),!1,B).length,S("D",D))}(c,g,0,s,e,i)+f(g,s,e,i)+function(d,b,L,T,B,D){let F;F=f(b,T,B,D).length>0?T-o(T,B):b;let I=T,O=function(H,P,C,k,R,A){let N;return N=f(C,k,R,A).length>0?k-o(k,R):P,H<C&&N<=k||H>=C&&N<k?"C":"D"}(d,b,L,T,B,D);return u(v(d,F,L,I,O==="C",B).length,S(O,D))}(c,g,t,s,e,i);let p;if(g===s)return p=c>t?"D":"C",u(Math.abs(c-t),S(p,i));p=g>s?"D":"C";let m=Math.abs(g-s);return u(function(d,b){return b.cols-d}(g>s?t:c,e)+(m-1)*e.cols+1+((g>s?c:t)-1),S(p,i))}},1296:function(E,r,n){var h=this&&this.__decorate||function(D,F,I,O){var H,P=arguments.length,C=P<3?F:O===null?O=Object.getOwnPropertyDescriptor(F,I):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(D,F,I,O);else for(var k=D.length-1;k>=0;k--)(H=D[k])&&(C=(P<3?H(C):P>3?H(F,I,C):H(F,I))||C);return P>3&&C&&Object.defineProperty(F,I,C),C},f=this&&this.__param||function(D,F){return function(I,O){F(I,O,D)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let o=n(3787),_=n(2550),v=n(2223),S=n(6171),u=n(6052),t=n(4725),s=n(8055),e=n(8460),i=n(844),c=n(2585),g="xterm-dom-renderer-owner-",p="xterm-rows",m="xterm-fg-",d="xterm-bg-",b="xterm-focus",L="xterm-selection",T=1,B=r.DomRenderer=class extends i.Disposable{constructor(D,F,I,O,H,P,C,k,R,A,N,z,q){super(),this._terminal=D,this._document=F,this._element=I,this._screenElement=O,this._viewportElement=H,this._helperContainer=P,this._linkifier2=C,this._charSizeService=R,this._optionsService=A,this._bufferService=N,this._coreBrowserService=z,this._themeService=q,this._terminalClass=T++,this._rowElements=[],this._selectionRenderModel=(0,u.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(p),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(L),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(K=>this._injectCss(K))),this._injectCss(this._themeService.colors),this._rowFactory=k.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(K=>this._handleLinkHover(K))),this.register(this._linkifier2.onHideLinkUnderline(K=>this._handleLinkLeave(K))),this.register((0,i.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let F=`${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=F,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let F=`${this._terminalSelector} .${p} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;F+=`${this._terminalSelector} .${p} .xterm-dim { color: ${s.color.multiplyOpacity(D.foreground,.5).css};}`,F+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let I=`blink_underline_${this._terminalClass}`,O=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;F+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,F+=`@keyframes ${O} { 50% { box-shadow: none; }}`,F+=`@keyframes ${H} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,F+=`${this._terminalSelector} .${p}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${p}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${p}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,F+=`${this._terminalSelector} .${L} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${L} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${L} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(let[P,C]of D.ansi.entries())F+=`${this._terminalSelector} .${m}${P} { color: ${C.css}; }${this._terminalSelector} .${m}${P}.xterm-dim { color: ${s.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${d}${P} { background-color: ${C.css}; }`;F+=`${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(D.background).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${d}${v.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=F}_setDefaultSpacing(){let D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,F){for(let I=this._rowElements.length;I<=F;I++){let O=this._document.createElement("div");this._rowContainer.appendChild(O),this._rowElements.push(O)}for(;this._rowElements.length>F;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,F){this._refreshRowElements(D,F),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(b),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(b),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,F,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,F,I),this.renderRows(0,this._bufferService.rows-1),!D||!F)return;this._selectionRenderModel.update(this._terminal,D,F,I);let O=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,P=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(P>=this._bufferService.rows||C<0)return;let k=this._document.createDocumentFragment();if(I){let R=D[0]>F[0];k.appendChild(this._createSelectionElement(P,R?F[0]:D[0],R?D[0]:F[0],C-P+1))}else{let R=O===P?D[0]:0,A=P===H?F[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(P,R,A));let N=C-P-1;if(k.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,N)),P!==C){let z=H===C?F[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(C,0,z))}}this._selectionContainer.appendChild(k)}_createSelectionElement(D,F,I,O=1){let H=this._document.createElement("div"),P=F*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(I-F);return P+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-P),H.style.height=O*this.dimensions.css.cell.height+"px",H.style.top=D*this.dimensions.css.cell.height+"px",H.style.left=`${P}px`,H.style.width=`${C}px`,H}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let D of this._rowElements)D.replaceChildren()}renderRows(D,F){let I=this._bufferService.buffer,O=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,k=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=D;R<=F;R++){let A=R+I.ydisp,N=this._rowElements[R],z=I.lines.get(A);if(!N||!z)break;N.replaceChildren(...this._rowFactory.createRow(z,A,A===O,C,k,H,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,F,I,O,H,P){I<0&&(D=0),O<0&&(F=0);let C=this._bufferService.rows-1;I=Math.max(Math.min(I,C),0),O=Math.max(Math.min(O,C),0),H=Math.min(H,this._bufferService.cols);let k=this._bufferService.buffer,R=k.ybase+k.y,A=Math.min(k.x,H-1),N=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,q=this._optionsService.rawOptions.cursorInactiveStyle;for(let K=I;K<=O;++K){let M=K+k.ydisp,x=this._rowElements[K],W=k.lines.get(M);if(!x||!W)break;x.replaceChildren(...this._rowFactory.createRow(W,M,M===R,z,q,A,N,this.dimensions.css.cell.width,this._widthCache,P?K===I?D:0:-1,P?(K===O?F:H)-1:-1))}}};r.DomRenderer=B=h([f(7,c.IInstantiationService),f(8,t.ICharSizeService),f(9,c.IOptionsService),f(10,c.IBufferService),f(11,t.ICoreBrowserService),f(12,t.IThemeService)],B)},3787:function(E,r,n){var h=this&&this.__decorate||function(p,m,d,b){var L,T=arguments.length,B=T<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(p,m,d,b);else for(var D=p.length-1;D>=0;D--)(L=p[D])&&(B=(T<3?L(B):T>3?L(m,d,B):L(m,d))||B);return T>3&&B&&Object.defineProperty(m,d,B),B},f=this&&this.__param||function(p,m){return function(d,b){m(d,b,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let o=n(2223),_=n(643),v=n(511),S=n(2585),u=n(8055),t=n(4725),s=n(4269),e=n(6171),i=n(3734),c=r.DomRendererRowFactory=class{constructor(p,m,d,b,L,T,B){this._document=p,this._characterJoinerService=m,this._optionsService=d,this._coreBrowserService=b,this._coreService=L,this._decorationService=T,this._themeService=B,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,m,d){this._selectionStart=p,this._selectionEnd=m,this._columnSelectMode=d}createRow(p,m,d,b,L,T,B,D,F,I,O){let H=[],P=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors,k,R=p.getNoBgTrimmedLength();d&&R<T+1&&(R=T+1);let A=0,N="",z=0,q=0,K=0,M=!1,x=0,W=!1,U=0,$=[],j=I!==-1&&O!==-1;for(let G=0;G<R;G++){p.loadCell(G,this._workCell);let Z=this._workCell.getWidth();if(Z===0)continue;let Q=!1,te=G,V=this._workCell;if(P.length>0&&G===P[0][0]){Q=!0;let Y=P.shift();V=new s.JoinedCellData(this._workCell,p.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),te=Y[1]-1,Z=V.getWidth()}let Pe=this._isCellInSelection(G,m),ft=d&&G===T,pt=j&&G>=I&&G<=O,vt=!1;this._decorationService.forEachDecorationAtCell(G,m,void 0,Y=>{vt=!0});let Ke=V.getChars()||_.WHITESPACE_CELL_CHAR;if(Ke===" "&&(V.isUnderline()||V.isOverline())&&(Ke="\xA0"),U=Z*D-F.get(Ke,V.isBold(),V.isItalic()),k){if(A&&(Pe&&W||!Pe&&!W&&V.bg===z)&&(Pe&&W&&C.selectionForeground||V.fg===q)&&V.extended.ext===K&&pt===M&&U===x&&!ft&&!Q&&!vt){V.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=Ke,A++;continue}A&&(k.textContent=N),k=this._document.createElement("span"),A=0,N=""}else k=this._document.createElement("span");if(z=V.bg,q=V.fg,K=V.extended.ext,M=pt,x=U,W=Pe,Q&&T>=G&&T<=te&&(T=G),!this._coreService.isCursorHidden&&ft&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)B&&$.push("xterm-cursor-blink"),$.push(b==="bar"?"xterm-cursor-bar":b==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline")}}if(V.isBold()&&$.push("xterm-bold"),V.isItalic()&&$.push("xterm-italic"),V.isDim()&&$.push("xterm-dim"),N=V.isInvisible()?_.WHITESPACE_CELL_CHAR:V.getChars()||_.WHITESPACE_CELL_CHAR,V.isUnderline()&&($.push(`xterm-underline-${V.extended.underlineStyle}`),N===" "&&(N="\xA0"),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let Y=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&Y<8&&(Y+=8),k.style.textDecorationColor=C.ansi[Y].css}V.isOverline()&&($.push("xterm-overline"),N===" "&&(N="\xA0")),V.isStrikethrough()&&$.push("xterm-strikethrough"),pt&&(k.style.textDecoration="underline");let ne=V.getFgColor(),He=V.getFgColorMode(),ae=V.getBgColor(),Fe=V.getBgColorMode(),gt=!!V.isInverse();if(gt){let Y=ne;ne=ae,ae=Y;let Oi=He;He=Fe,Fe=Oi}let pe,Ve,ve,Ne=!1;switch(this._decorationService.forEachDecorationAtCell(G,m,void 0,Y=>{Y.options.layer!=="top"&&Ne||(Y.backgroundColorRGB&&(Fe=50331648,ae=Y.backgroundColorRGB.rgba>>8&16777215,pe=Y.backgroundColorRGB),Y.foregroundColorRGB&&(He=50331648,ne=Y.foregroundColorRGB.rgba>>8&16777215,Ve=Y.foregroundColorRGB),Ne=Y.options.layer==="top")}),!Ne&&Pe&&(pe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ae=pe.rgba>>8&16777215,Fe=50331648,Ne=!0,C.selectionForeground&&(He=50331648,ne=C.selectionForeground.rgba>>8&16777215,Ve=C.selectionForeground)),Ne&&$.push("xterm-decoration-top"),Fe){case 16777216:case 33554432:ve=C.ansi[ae],$.push(`xterm-bg-${ae}`);break;case 50331648:ve=u.channels.toColor(ae>>16,ae>>8&255,255&ae),this._addStyle(k,`background-color:#${g((ae>>>0).toString(16),"0",6)}`);break;default:gt?(ve=C.foreground,$.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):ve=C.background}switch(pe||V.isDim()&&(pe=u.color.multiplyOpacity(ve,.5)),He){case 16777216:case 33554432:V.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(k,ve,C.ansi[ne],V,pe,void 0)||$.push(`xterm-fg-${ne}`);break;case 50331648:let Y=u.channels.toColor(ne>>16&255,ne>>8&255,255&ne);this._applyMinimumContrast(k,ve,Y,V,pe,Ve)||this._addStyle(k,`color:#${g(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,ve,C.foreground,V,pe,Ve)||gt&&$.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}$.length&&(k.className=$.join(" "),$.length=0),ft||Q||vt?k.textContent=N:A++,U!==this.defaultSpacing&&(k.style.letterSpacing=`${U}px`),H.push(k),G=te}return k&&A&&(k.textContent=N),H}_applyMinimumContrast(p,m,d,b,L,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(b.getCode()))return!1;let B=this._getContrastCache(b),D;if(L||T||(D=B.getColor(m.rgba,d.rgba)),D===void 0){let F=this._optionsService.rawOptions.minimumContrastRatio/(b.isDim()?2:1);D=u.color.ensureContrastRatio(L||m,T||d,F),B.setColor((L||m).rgba,(T||d).rgba,D??null)}return!!D&&(this._addStyle(p,`color:${D.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,m){p.setAttribute("style",`${p.getAttribute("style")||""}${m};`)}_isCellInSelection(p,m){let d=this._selectionStart,b=this._selectionEnd;return!(!d||!b)&&(this._columnSelectMode?d[0]<=b[0]?p>=d[0]&&m>=d[1]&&p<b[0]&&m<=b[1]:p<d[0]&&m>=d[1]&&p>=b[0]&&m<=b[1]:m>d[1]&&m<b[1]||d[1]===b[1]&&m===d[1]&&p>=d[0]&&p<b[0]||d[1]<b[1]&&m===b[1]&&p<b[0]||d[1]<b[1]&&m===d[1]&&p>=d[0])}};function g(p,m,d){for(;p.length<d;)p=m+p;return p}r.DomRendererRowFactory=c=h([f(1,t.ICharacterJoinerService),f(2,S.IOptionsService),f(3,t.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,t.IThemeService)],c)},2550:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(n,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=n.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let f=n.createElement("span");f.classList.add("xterm-char-measure-element");let o=n.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let _=n.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let v=n.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,o,_,v],this._container.appendChild(f),this._container.appendChild(o),this._container.appendChild(_),this._container.appendChild(v),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(n,h,f,o){n===this._font&&h===this._fontSize&&f===this._weight&&o===this._weightBold||(this._font=n,this._fontSize=h,this._weight=f,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(n,h,f){let o=0;if(!h&&!f&&n.length===1&&(o=n.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let S=this._measure(n,0);return S>0&&(this._flat[o]=S),S}let _=n;h&&(_+="B"),f&&(_+="I");let v=this._holey.get(_);if(v===void 0){let S=0;h&&(S|=1),f&&(S|=2),v=this._measure(n,S),v>0&&this._holey.set(_,v)}return v}_measure(n,h){let f=this._measureElements[h];return f.textContent=n.repeat(32),f.offsetWidth/32}}},2223:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let h=n(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(E,r)=>{function n(f){return 57508<=f&&f<=57558}function h(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},r.isPowerlineGlyph=n,r.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},r.isEmoji=h,r.allowRescaling=function(f,o,_,v){return o===1&&_>Math.ceil(1.5*v)&&f!==void 0&&f>255&&!h(f)&&!n(f)&&!function(S){return 57344<=S&&S<=63743}(f)},r.treatGlyphAsBackgroundColor=function(f){return n(f)||function(o){return 9472<=o&&o<=9631}(f)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(f,o,_=0){return(f-(2*Math.round(o)-_))%(2*Math.round(o))}},6052:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,o,_,v=!1){if(this.selectionStart=o,this.selectionEnd=_,!o||!_||o[0]===_[0]&&o[1]===_[1])return void this.clear();let S=f.buffers.active.ydisp,u=o[1]-S,t=_[1]-S,s=Math.max(u,0),e=Math.min(t,f.rows-1);s>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=u,this.viewportEndRow=t,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=o[0],this.endCol=_[0])}isCellSelected(f,o,_){return!!this.hasSelection&&(_-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&_>=this.viewportCappedStartRow&&o<this.endCol&&_<=this.viewportCappedEndRow:o<this.startCol&&_>=this.viewportCappedStartRow&&o>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol)}}r.createSelectionRenderModel=function(){return new n}},456:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(n){this._bufferService=n,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?n%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)-1]:[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[n,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[Math.max(n,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let n=this.selectionStart,h=this.selectionEnd;return!(!n||!h)&&(n[1]>h[1]||n[1]===h[1]&&n[0]>h[0])}handleTrim(n){return this.selectionStart&&(this.selectionStart[1]-=n),this.selectionEnd&&(this.selectionEnd[1]-=n),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(E,r,n){var h=this&&this.__decorate||function(e,i,c,g){var p,m=arguments.length,d=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(e,i,c,g);else for(var b=e.length-1;b>=0;b--)(p=e[b])&&(d=(m<3?p(d):m>3?p(i,c,d):p(i,c))||d);return m>3&&d&&Object.defineProperty(i,c,d),d},f=this&&this.__param||function(e,i){return function(c,g){i(c,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let o=n(2585),_=n(8460),v=n(844),S=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,i,c){super(),this._optionsService=c,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new t(e,i,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=S=h([f(2,o.IOptionsService)],S);class u extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(i,c){i!==void 0&&i>0&&c!==void 0&&c>0&&(this._result.width=i,this._result.height=c)}}class t extends u{constructor(i,c,g){super(),this._document=i,this._parentElement=c,this._optionsService=g,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends u{constructor(i){super(),this._optionsService=i,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let c=this._ctx.measureText("W");if(!("width"in c&&"fontBoundingBoxAscent"in c&&"fontBoundingBoxDescent"in c))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let i=this._ctx.measureText("W");return this._validateAndSet(i.width,i.fontBoundingBoxAscent+i.fontBoundingBoxDescent),this._result}}},4269:function(E,r,n){var h=this&&this.__decorate||function(s,e,i,c){var g,p=arguments.length,m=p<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,e,i,c);else for(var d=s.length-1;d>=0;d--)(g=s[d])&&(m=(p<3?g(m):p>3?g(e,i,m):g(e,i))||m);return p>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(s,e){return function(i,c){e(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let o=n(3734),_=n(643),v=n(511),S=n(2585);class u extends o.AttributeData{constructor(e,i,c){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=c}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=u;let t=r.CharacterJoinerService=class Ut{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||i.length===0)return[];let c=[],g=i.translateToString(!0),p=0,m=0,d=0,b=i.getFg(0),L=i.getBg(0);for(let T=0;T<i.getTrimmedLength();T++)if(i.loadCell(T,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==b||this._workCell.bg!==L){if(T-p>1){let B=this._getJoinedRanges(g,d,m,i,p);for(let D=0;D<B.length;D++)c.push(B[D])}p=T,d=m,b=this._workCell.fg,L=this._workCell.bg}m+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){let T=this._getJoinedRanges(g,d,m,i,p);for(let B=0;B<T.length;B++)c.push(T[B])}return c}_getJoinedRanges(e,i,c,g,p){let m=e.substring(i,c),d=[];try{d=this._characterJoiners[0].handler(m)}catch(b){console.error(b)}for(let b=1;b<this._characterJoiners.length;b++)try{let L=this._characterJoiners[b].handler(m);for(let T=0;T<L.length;T++)Ut._mergeRanges(d,L[T])}catch(L){console.error(L)}return this._stringRangesToCellRanges(d,g,p),d}_stringRangesToCellRanges(e,i,c){let g=0,p=!1,m=0,d=e[g];if(d){for(let b=c;b<this._bufferService.cols;b++){let L=i.getWidth(b),T=i.getString(b).length||_.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!p&&d[0]<=m&&(d[0]=b,p=!0),d[1]<=m){if(d[1]=b,d=e[++g],!d)break;d[0]<=m?(d[0]=b,p=!0):p=!1}m+=T}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let c=!1;for(let g=0;g<e.length;g++){let p=e[g];if(c){if(i[1]<=p[0])return e[g-1][1]=i[1],e;if(i[1]<=p[1])return e[g-1][1]=Math.max(i[1],p[1]),e.splice(g,1),e;e.splice(g,1),g--}else{if(i[1]<=p[0])return e.splice(g,0,i),e;if(i[1]<=p[1])return p[0]=Math.min(i[0],p[0]),e;i[0]<p[1]&&(p[0]=Math.min(i[0],p[0]),c=!0)}}return c?e[e.length-1][1]=i[1]:e.push(i),e}};r.CharacterJoinerService=t=h([f(0,S.IBufferService)],t)},5114:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let h=n(844),f=n(8460),o=n(3656);class _ extends h.Disposable{constructor(u,t,s){super(),this._textarea=u,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(u){this._window!==u&&(this._window=u,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}r.CoreBrowserService=_;class v extends h.Disposable{constructor(u){super(),this._parentWindow=u,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(u){this._parentWindow=u,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,o.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let h=n(844);class f extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}r.LinkProviderService=f},8934:function(E,r,n){var h=this&&this.__decorate||function(S,u,t,s){var e,i=arguments.length,c=i<3?u:s===null?s=Object.getOwnPropertyDescriptor(u,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(S,u,t,s);else for(var g=S.length-1;g>=0;g--)(e=S[g])&&(c=(i<3?e(c):i>3?e(u,t,c):e(u,t))||c);return i>3&&c&&Object.defineProperty(u,t,c),c},f=this&&this.__param||function(S,u){return function(t,s){u(t,s,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let o=n(4725),_=n(9806),v=r.MouseService=class{constructor(S,u){this._renderService=S,this._charSizeService=u}getCoords(S,u,t,s,e){return(0,_.getCoords)(window,S,u,t,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(S,u){let t=(0,_.getCoordsRelativeToElement)(window,S,u);if(this._charSizeService.hasValidSize)return t[0]=Math.min(Math.max(t[0],0),this._renderService.dimensions.css.canvas.width-1),t[1]=Math.min(Math.max(t[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(t[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(t[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(t[0]),y:Math.floor(t[1])}}};r.MouseService=v=h([f(0,o.IRenderService),f(1,o.ICharSizeService)],v)},3230:function(E,r,n){var h=this&&this.__decorate||function(e,i,c,g){var p,m=arguments.length,d=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(e,i,c,g);else for(var b=e.length-1;b>=0;b--)(p=e[b])&&(d=(m<3?p(d):m>3?p(i,c,d):p(i,c))||d);return m>3&&d&&Object.defineProperty(i,c,d),d},f=this&&this.__param||function(e,i){return function(c,g){i(c,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let o=n(6193),_=n(4725),v=n(8460),S=n(844),u=n(7226),t=n(2585),s=r.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,i,c,g,p,m,d,b){super(),this._rowCount=e,this._charSizeService=g,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,this._observerDisposable=this.register(new S.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer((L,T)=>this._renderRows(L,T),d),this.register(this._renderDebouncer),this.register(d.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(c.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(p.onDecorationRegistered(()=>this._fullRefresh())),this.register(p.onDecorationRemoved(()=>this._fullRefresh())),this.register(c.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(c.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(b.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(d.window,i),this.register(d.onWindowChange(L=>this._registerIntersectionObserver(L,i)))}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let c=new e.IntersectionObserver(g=>this._handleIntersectionChange(g[g.length-1]),{threshold:0});c.observe(i),this._observerDisposable.value=(0,S.toDisposable)(()=>c.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,c=!1){this._isPaused?this._needsFullRefresh=!0:(c||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount))}_renderRows(e,i){this._renderer.value&&(e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0)}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,c){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=c,this._renderer.value?.handleSelectionChanged(e,i,c)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=s=h([f(2,t.IOptionsService),f(3,_.ICharSizeService),f(4,t.IDecorationService),f(5,t.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],s)},9312:function(E,r,n){var h=this&&this.__decorate||function(d,b,L,T){var B,D=arguments.length,F=D<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,L):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(d,b,L,T);else for(var I=d.length-1;I>=0;I--)(B=d[I])&&(F=(D<3?B(F):D>3?B(b,L,F):B(b,L))||F);return D>3&&F&&Object.defineProperty(b,L,F),F},f=this&&this.__param||function(d,b){return function(L,T){b(L,T,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let o=n(9806),_=n(9504),v=n(456),S=n(4725),u=n(8460),t=n(844),s=n(6114),e=n(4841),i=n(511),c=n(2585),g="\xA0",p=new RegExp(g,"g"),m=r.SelectionService=class extends t.Disposable{constructor(d,b,L,T,B,D,F,I,O){super(),this._element=d,this._screenElement=b,this._linkifier=L,this._bufferService=T,this._coreService=B,this._mouseService=D,this._optionsService=F,this._renderService=I,this._coreBrowserService=O,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new i.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(H=>this._handleTrim(H)),this.register(this._bufferService.buffers.onBufferActivate(H=>this._handleBufferActivate(H))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,t.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let d=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;return!(!d||!b||d[0]===b[0]&&d[1]===b[1])}get selectionText(){let d=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;if(!d||!b)return"";let L=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(d[0]===b[0])return"";let B=d[0]<b[0]?d[0]:b[0],D=d[0]<b[0]?b[0]:d[0];for(let F=d[1];F<=b[1];F++){let I=L.translateBufferLineToString(F,!0,B,D);T.push(I)}}else{let B=d[1]===b[1]?b[0]:void 0;T.push(L.translateBufferLineToString(d[1],!0,d[0],B));for(let D=d[1]+1;D<=b[1]-1;D++){let F=L.lines.get(D),I=L.translateBufferLineToString(D,!0);F?.isWrapped?T[T.length-1]+=I:T.push(I)}if(d[1]!==b[1]){let D=L.lines.get(b[1]),F=L.translateBufferLineToString(b[1],!0,0,b[0]);D&&D.isWrapped?T[T.length-1]+=F:T.push(F)}}return T.map(B=>B.replace(p," ")).join(s.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){let c=window.open();if(c){try{c.opener=null}catch{}c.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=g=l([_(0,f.IBufferService),_(1,f.IOptionsService),_(2,f.IOscLinkService)],g)},6193:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(s,l){this._renderCallback=s,this._coreBrowserService=l,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(s){return this._refreshCallbacks.push(s),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(s,l,_){this._rowCount=_,s=s!==void 0?s:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l,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 s=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let s of this._refreshCallbacks)s(0);this._refreshCallbacks=[]}}},3236:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;let l=s(3614),_=s(3656),n=s(3551),f=s(9042),g=s(3730),b=s(1680),p=s(3107),a=s(5744),c=s(2950),o=s(1296),u=s(428),v=s(4269),C=s(5114),S=s(8934),y=s(3230),m=s(9312),x=s(4725),T=s(6731),P=s(8055),I=s(8969),R=s(8460),W=s(844),B=s(6114),M=s(8437),O=s(2584),D=s(7399),w=s(5941),E=s(9074),L=s(2585),A=s(5435),F=s(4567),$=s(779);class q extends I.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(H={}){super(H),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new W.MutableDisposable),this._onCursorMove=this.register(new R.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new R.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new R.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new R.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new R.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new R.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new R.EventEmitter),this._onBlur=this.register(new R.EventEmitter),this._onA11yCharEmitter=this.register(new R.EventEmitter),this._onA11yTabEmitter=this.register(new R.EventEmitter),this._onWillOpen=this.register(new R.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($.LinkProviderService),this._instantiationService.setService(x.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((k,U)=>this.refresh(k,U))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(k=>this._reportWindowsOptions(k))),this.register(this._inputHandler.onColor(k=>this._handleColorEvent(k))),this.register((0,R.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,R.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(k=>this._afterResize(k.cols,k.rows))),this.register((0,W.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(H){if(this._themeService)for(let k of H){let U,z="";switch(k.index){case 256:U="foreground",z="10";break;case 257:U="background",z="11";break;case 258:U="cursor",z="12";break;default:U="ansi",z="4;"+k.index}switch(k.type){case 0:let G=P.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${O.C0.ESC}]${z};${(0,w.toRgbString)(G)}${O.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors(V=>V.ansi[k.index]=P.channels.toColor(...k.color));else{let V=U;this._themeService.modifyColors(N=>N[V]=P.channels.toColor(...k.color))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(H){H?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(H){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.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(O.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 H=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(H);if(!k)return;let U=Math.min(this.buffer.x,this.cols-1),z=this._renderService.dimensions.css.cell.height,G=k.getWidth(U),V=this._renderService.dimensions.css.cell.width*G,N=this.buffer.y*this._renderService.dimensions.css.cell.height,j=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=j+"px",this.textarea.style.top=N+"px",this.textarea.style.width=V+"px",this.textarea.style.height=z+"px",this.textarea.style.lineHeight=z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",k=>{this.hasSelection()&&(0,l.copyHandler)(k,this._selectionService)}));let H=k=>(0,l.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",H)),this.register((0,_.addDisposableDomListener)(this.element,"paste",H)),B.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",k=>{k.button===2&&(0,l.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",k=>{(0,l.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),B.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",k=>{k.button===1&&(0,l.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",H=>this._keyUp(H),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",H=>this._keyDown(H),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",H=>this._keyPress(H),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",H=>this._compositionHelper.compositionupdate(H))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,_.addDisposableDomListener)(this.textarea,"input",H=>this._inputEvent(H),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(H){if(!H)throw new Error("Terminal requires a parent element.");if(H.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=H.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"),H.appendChild(this.element);let k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.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",U=>this.updateCursorStyle(U))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",f.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(C.CoreBrowserService,this.textarea,H.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(x.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",U=>this._handleTextAreaFocus(U))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(x.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(x.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(x.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(U=>this._onRender.fire(U))),this.onResize(U=>this._renderService.resize(U.cols,U.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(c.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(S.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(b.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(U=>this.scrollLines(U.amount,U.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(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",U=>this._selectionService.handleMouseDown(U))),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(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",U=>this._handleScreenReaderModeOptionChange(U))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(o.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let H=this,k=this.element;function U(V){let N=H._mouseService.getMouseReportCoords(V,H.screenElement);if(!N)return!1;let j,K;switch(V.overrideType||V.type){case"mousemove":K=32,V.buttons===void 0?(j=3,V.button!==void 0&&(j=V.button<3?V.button:3)):j=1&V.buttons?0:4&V.buttons?1:2&V.buttons?2:3;break;case"mouseup":K=0,j=V.button<3?V.button:3;break;case"mousedown":K=1,j=V.button<3?V.button:3;break;case"wheel":if(H._customWheelEventHandler&&H._customWheelEventHandler(V)===!1||H.viewport.getLinesScrolled(V)===0)return!1;K=V.deltaY<0?0:1,j=4;break;default:return!1}return!(K===void 0||j===void 0||j>4)&&H.coreMouseService.triggerMouseEvent({col:N.col,row:N.row,x:N.x,y:N.y,button:j,action:K,ctrl:V.ctrlKey,alt:V.altKey,shift:V.shiftKey})}let z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:V=>(U(V),V.buttons||(this._document.removeEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.removeEventListener("mousemove",z.mousedrag)),this.cancel(V)),wheel:V=>(U(V),this.cancel(V,!0)),mousedrag:V=>{V.buttons&&U(V)},mousemove:V=>{V.buttons||U(V)}};this.register(this.coreMouseService.onProtocolChange(V=>{V?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(V)),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&V?z.mousemove||(k.addEventListener("mousemove",G.mousemove),z.mousemove=G.mousemove):(k.removeEventListener("mousemove",z.mousemove),z.mousemove=null),16&V?z.wheel||(k.addEventListener("wheel",G.wheel,{passive:!1}),z.wheel=G.wheel):(k.removeEventListener("wheel",z.wheel),z.wheel=null),2&V?z.mouseup||(z.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",z.mouseup),z.mouseup=null),4&V?z.mousedrag||(z.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",z.mousedrag),z.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(k,"mousedown",V=>{if(V.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(V))return U(V),z.mouseup&&this._document.addEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.addEventListener("mousemove",z.mousedrag),this.cancel(V)})),this.register((0,_.addDisposableDomListener)(k,"wheel",V=>{if(!z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(V)===!1)return!1;if(!this.buffer.hasScrollback){let N=this.viewport.getLinesScrolled(V);if(N===0)return;let j=O.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(V.deltaY<0?"A":"B"),K="";for(let Y=0;Y<Math.abs(N);Y++)K+=j;return this.coreService.triggerDataEvent(K,!0),this.cancel(V,!0)}return this.viewport.handleWheel(V)?this.cancel(V):void 0}},{passive:!1})),this.register((0,_.addDisposableDomListener)(k,"touchstart",V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(V),this.cancel(V)},{passive:!0})),this.register((0,_.addDisposableDomListener)(k,"touchmove",V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(V)?void 0:this.cancel(V)},{passive:!1}))}refresh(H,k){this._renderService?.refreshRows(H,k)}updateCursorStyle(H){this._selectionService?.shouldColumnSelect(H)?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(H,k,U=0){U===1?(super.scrollLines(H,k,U),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(H)}paste(H){(0,l.paste)(H,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(H){this._customKeyEventHandler=H}attachCustomWheelEventHandler(H){this._customWheelEventHandler=H}registerLinkProvider(H){return this._linkProviderService.registerLinkProvider(H)}registerCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(H);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(H)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(H){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+H)}registerDecoration(H){return this._decorationService.registerDecoration(H)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(H,k,U){this._selectionService.setSelection(H,k,U)}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(H,k){this._selectionService?.selectLines(H,k)}_keyDown(H){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&H.altKey;if(!k&&!this._compositionHelper.keydown(H))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||H.key!=="Dead"&&H.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let U=(0,D.evaluateKeyboardEvent)(H,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(H),U.type===3||U.type===2){let z=this.rows-1;return this.scrollLines(U.type===2?-z:z),this.cancel(H,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,H)||(U.cancel&&this.cancel(H,!0),!U.key||!!(H.key&&!H.ctrlKey&&!H.altKey&&!H.metaKey&&H.key.length===1&&H.key.charCodeAt(0)>=65&&H.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==O.C0.ETX&&U.key!==O.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||H.altKey||H.ctrlKey?this.cancel(H,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(H,k){let U=H.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||H.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||H.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?U:U&&(!k.keyCode||k.keyCode>47)}_keyUp(H){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1||(function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18}(H)||this.focus(),this.updateCursorStyle(H),this._keyPressHandled=!1)}_keyPress(H){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;if(this.cancel(H),H.charCode)k=H.charCode;else if(H.which===null||H.which===void 0)k=H.keyCode;else{if(H.which===0||H.charCode===0)return!1;k=H.which}return!(!k||(H.altKey||H.ctrlKey||H.metaKey)&&!this._isThirdLevelShift(this.browser,H)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(H){if(H.data&&H.inputType==="insertText"&&(!H.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=H.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(H),!0}return!1}resize(H,k){H!==this.cols||k!==this.rows?super.resize(H,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(H,k){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 H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(M.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 H=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=H,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(O.C0.ESC+"[I"):this.coreService.triggerDataEvent(O.C0.ESC+"[O")}_reportWindowsOptions(H){if(this._renderService)switch(H){case A.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),U=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[4;${U};${k}t`);break;case A.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let z=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[6;${G};${z}t`)}}cancel(H,k){if(this.options.cancelEvents||k)return H.preventDefault(),H.stopPropagation(),!1}}i.Terminal=q},9924:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(s,l=1e3){this._renderCallback=s,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(s,l,_){this._rowCount=_,s=s!==void 0?s:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let f=n-this._lastRefreshMs,g=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let s=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,l)}}},1680:function(h,i,s){var l=this&&this.__decorate||function(c,o,u,v){var C,S=arguments.length,y=S<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(c,o,u,v);else for(var m=c.length-1;m>=0;m--)(C=c[m])&&(y=(S<3?C(y):S>3?C(o,u,y):C(o,u))||y);return S>3&&y&&Object.defineProperty(o,u,y),y},_=this&&this.__param||function(c,o){return function(u,v){o(u,v,c)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;let n=s(3656),f=s(4725),g=s(8460),b=s(844),p=s(2585),a=i.Viewport=class extends b.Disposable{constructor(c,o,u,v,C,S,y,m){super(),this._viewportElement=c,this._scrollArea=o,this._bufferService=u,this._optionsService=v,this._charSizeService=C,this._renderService=S,this._coreBrowserService=y,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 g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(x=>this._activeBuffer=x.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(x=>this._renderDimensions=x)),this._handleThemeChange(m.colors),this.register(m.onChangeColors(x=>this._handleThemeChange(x))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(c){this._viewportElement.style.backgroundColor=c.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(c){if(c)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 o=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==o&&(this._lastRecordedBufferHeight=o,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let c=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==c&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=c),this._refreshAnimationFrame=null}syncScrollArea(c=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(c);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(c)}_handleScroll(c){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 o=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:o,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let c=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(c*(this._smoothScrollState.target-this._smoothScrollState.origin)),c<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(c,o){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(o<0&&this._viewportElement.scrollTop!==0||o>0&&u<this._lastRecordedBufferHeight)||(c.cancelable&&c.preventDefault(),!1)}handleWheel(c){let o=this._getPixelsScrolled(c);return o!==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+o:this._smoothScrollState.target+=o,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=o,this._bubbleScroll(c,o))}scrollLines(c){if(c!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let o=c*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+o,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:c,suppressScrollEvent:!1})}_getPixelsScrolled(c){if(c.deltaY===0||c.shiftKey)return 0;let o=this._applyScrollModifier(c.deltaY,c);return c.deltaMode===WheelEvent.DOM_DELTA_LINE?o*=this._currentRowHeight:c.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._currentRowHeight*this._bufferService.rows),o}getBufferElements(c,o){let u,v="",C=[],S=o??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=c;m<S;m++){let x=y.get(m);if(!x)continue;let T=y.get(m+1)?.isWrapped;if(v+=x.translateToString(!T),!T||m===y.length-1){let P=document.createElement("div");P.textContent=v,C.push(P),v.length>0&&(u=P),v=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(c){if(c.deltaY===0||c.shiftKey)return 0;let o=this._applyScrollModifier(c.deltaY,c);return c.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=this._currentRowHeight+0,this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):c.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(c,o){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&o.altKey||u==="ctrl"&&o.ctrlKey||u==="shift"&&o.shiftKey?c*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:c*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(c){this._lastTouchY=c.touches[0].pageY}handleTouchMove(c){let o=this._lastTouchY-c.touches[0].pageY;return this._lastTouchY=c.touches[0].pageY,o!==0&&(this._viewportElement.scrollTop+=o,this._bubbleScroll(c,o))}};i.Viewport=a=l([_(2,p.IBufferService),_(3,p.IOptionsService),_(4,f.ICharSizeService),_(5,f.IRenderService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],a)},3107:function(h,i,s){var l=this&&this.__decorate||function(p,a,c,o){var u,v=arguments.length,C=v<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,c):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,a,c,o);else for(var S=p.length-1;S>=0;S--)(u=p[S])&&(C=(v<3?u(C):v>3?u(a,c,C):u(a,c))||C);return v>3&&C&&Object.defineProperty(a,c,C),C},_=this&&this.__param||function(p,a){return function(c,o){a(c,o,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;let n=s(4725),f=s(844),g=s(2585),b=i.BufferDecorationRenderer=class extends f.Disposable{constructor(p,a,c,o,u){super(),this._screenElement=p,this._bufferService=a,this._coreBrowserService=c,this._decorationService=o,this._renderService=u,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(v=>this._removeDecoration(v))),this.register((0,f.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let a=this._coreBrowserService.mainDocument.createElement("div");a.classList.add("xterm-decoration"),a.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),a.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,a.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",a.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",a.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let c=p.options.x??0;return c&&c>this._bufferService.cols&&(a.style.display="none"),this._refreshXPosition(p,a),a}_refreshStyle(p){let a=p.marker.line-this._bufferService.buffers.active.ydisp;if(a<0||a>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let c=this._decorationElements.get(p);c||(c=this._createElement(p),p.element=c,this._decorationElements.set(p,c),this._container.appendChild(c),p.onDispose(()=>{this._decorationElements.delete(p),c.remove()})),c.style.top=a*this._renderService.dimensions.css.cell.height+"px",c.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(c)}}_refreshXPosition(p,a=p.element){if(!a)return;let c=p.options.x??0;(p.options.anchor||"left")==="right"?a.style.right=c?c*this._renderService.dimensions.css.cell.width+"px":"":a.style.left=c?c*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};i.BufferDecorationRenderer=b=l([_(1,g.IBufferService),_(2,n.ICoreBrowserService),_(3,g.IDecorationService),_(4,n.IRenderService)],b)},5871:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.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(s){if(s.options.overviewRulerOptions){for(let l of this._zones)if(l.color===s.options.overviewRulerOptions.color&&l.position===s.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,s.marker.line))return;if(this._lineAdjacentToZone(l,s.marker.line,s.options.overviewRulerOptions.position))return void this._addLineToZone(l,s.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=s.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=s.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=s.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=s.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:s.options.overviewRulerOptions.color,position:s.options.overviewRulerOptions.position,startBufferLine:s.marker.line,endBufferLine:s.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(s){this._linePadding=s}_lineIntersectsZone(s,l){return l>=s.startBufferLine&&l<=s.endBufferLine}_lineAdjacentToZone(s,l,_){return l>=s.startBufferLine-this._linePadding[_||"full"]&&l<=s.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(s,l){s.startBufferLine=Math.min(s.startBufferLine,l),s.endBufferLine=Math.max(s.endBufferLine,l)}}},5744:function(h,i,s){var l=this&&this.__decorate||function(u,v,C,S){var y,m=arguments.length,x=m<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,C):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,S);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},_=this&&this.__param||function(u,v){return function(C,S){v(C,S,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;let n=s(5871),f=s(4725),g=s(844),b=s(2585),p={full:0,left:0,center:0,right:0},a={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},o=i.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,v,C,S,y,m,x){super(),this._viewportElement=u,this._screenElement=v,this._bufferService=C,this._decorationService=S,this._renderService=y,this._optionsService=m,this._coreBrowserService=x,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,g.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 u=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);a.full=this._canvas.width,a.left=u,a.center=v,a.right=u,this._refreshDrawHeightConstants(),c.full=0,c.left=0,c.center=a.left,c.right=a.left+a.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let u=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=v,p.center=v,p.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.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 v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;let u=this._colorZoneStore.zones;for(let v of u)v.position!=="full"&&this._renderColorZone(v);for(let v of u)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(c[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-p[u.position||"full"]/2),a[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,v){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};i.OverviewRulerRenderer=o=l([_(2,b.IBufferService),_(3,b.IDecorationService),_(4,f.IRenderService),_(5,b.IOptionsService),_(6,f.ICoreBrowserService)],o)},2950:function(h,i,s){var l=this&&this.__decorate||function(p,a,c,o){var u,v=arguments.length,C=v<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,c):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,a,c,o);else for(var S=p.length-1;S>=0;S--)(u=p[S])&&(C=(v<3?u(C):v>3?u(a,c,C):u(a,c))||C);return v>3&&C&&Object.defineProperty(a,c,C),C},_=this&&this.__param||function(p,a){return function(c,o){a(c,o,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;let n=s(4725),f=s(2585),g=s(2584),b=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,a,c,o,u,v){this._textarea=p,this._compositionView=a,this._bufferService=c,this._optionsService=o,this._coreService=u,this._renderService=v,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(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let a={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let c;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,c=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),c.length>0&&this._coreService.triggerDataEvent(c,!0)}},0)}else{this._isSendingComposition=!1;let a=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(a,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let a=this._textarea.value,c=a.replace(p,"");this._dataAlreadySent=c,a.length>p.length?this._coreService.triggerDataEvent(c,!0):a.length<p.length?this._coreService.triggerDataEvent(`${g.C0.DEL}`,!0):a.length===p.length&&a!==p&&this._coreService.triggerDataEvent(a,!0)}},0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let a=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),c=this._renderService.dimensions.css.cell.height,o=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=a*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=o+"px",this._compositionView.style.height=c+"px",this._compositionView.style.lineHeight=c+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let v=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=o+"px",this._textarea.style.width=Math.max(v.width,1)+"px",this._textarea.style.height=Math.max(v.height,1)+"px",this._textarea.style.lineHeight=v.height+"px"}p||setTimeout(()=>this.updateCompositionElements(!0),0)}}};i.CompositionHelper=b=l([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,f.ICoreService),_(5,n.IRenderService)],b)},9806:(h,i)=>{function s(l,_,n){let f=n.getBoundingClientRect(),g=l.getComputedStyle(n),b=parseInt(g.getPropertyValue("padding-left")),p=parseInt(g.getPropertyValue("padding-top"));return[_.clientX-f.left-b,_.clientY-f.top-p]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=s,i.getCoords=function(l,_,n,f,g,b,p,a,c){if(!b)return;let o=s(l,_,n);return o?(o[0]=Math.ceil((o[0]+(c?p/2:0))/p),o[1]=Math.ceil(o[1]/a),o[0]=Math.min(Math.max(o[0],1),f+(c?1:0)),o[1]=Math.min(Math.max(o[1],1),g),o):void 0}},9504:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;let l=s(2584);function _(a,c,o,u){let v=a-n(a,o),C=c-n(c,o),S=Math.abs(v-C)-function(y,m,x){let T=0,P=y-n(y,x),I=m-n(m,x);for(let R=0;R<Math.abs(P-I);R++){let W=f(y,m)==="A"?-1:1;x.buffer.lines.get(P+W*R)?.isWrapped&&T++}return T}(a,c,o);return p(S,b(f(a,c),u))}function n(a,c){let o=0,u=c.buffer.lines.get(a),v=u?.isWrapped;for(;v&&a>=0&&a<c.rows;)o++,u=c.buffer.lines.get(--a),v=u?.isWrapped;return o}function f(a,c){return a>c?"A":"B"}function g(a,c,o,u,v,C){let S=a,y=c,m="";for(;S!==o||y!==u;)S+=v?1:-1,v&&S>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,a,S),S=0,a=0,y++):!v&&S<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,a+1),S=C.cols-1,a=S,y--);return m+C.buffer.translateBufferLineToString(y,!1,a,S)}function b(a,c){let o=c?"O":"[";return l.C0.ESC+o+a}function p(a,c){a=Math.floor(a);let o="";for(let u=0;u<a;u++)o+=c;return o}i.moveToCellSequence=function(a,c,o,u){let v=o.buffer.x,C=o.buffer.y;if(!o.buffer.hasScrollback)return function(m,x,T,P,I,R){return _(x,P,I,R).length===0?"":p(g(m,x,m,x-n(x,I),!1,I).length,b("D",R))}(v,C,0,c,o,u)+_(C,c,o,u)+function(m,x,T,P,I,R){let W;W=_(x,P,I,R).length>0?P-n(P,I):x;let B=P,M=function(O,D,w,E,L,A){let F;return F=_(w,E,L,A).length>0?E-n(E,L):D,O<w&&F<=E||O>=w&&F<E?"C":"D"}(m,x,T,P,I,R);return p(g(m,W,T,B,M==="C",I).length,b(M,R))}(v,C,a,c,o,u);let S;if(C===c)return S=v>a?"D":"C",p(Math.abs(v-a),b(S,u));S=C>c?"D":"C";let y=Math.abs(C-c);return p(function(m,x){return x.cols-m}(C>c?a:v,o)+(y-1)*o.cols+1+((C>c?v:a)-1),b(S,u))}},1296:function(h,i,s){var l=this&&this.__decorate||function(R,W,B,M){var O,D=arguments.length,w=D<3?W:M===null?M=Object.getOwnPropertyDescriptor(W,B):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(R,W,B,M);else for(var E=R.length-1;E>=0;E--)(O=R[E])&&(w=(D<3?O(w):D>3?O(W,B,w):O(W,B))||w);return D>3&&w&&Object.defineProperty(W,B,w),w},_=this&&this.__param||function(R,W){return function(B,M){W(B,M,R)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;let n=s(3787),f=s(2550),g=s(2223),b=s(6171),p=s(6052),a=s(4725),c=s(8055),o=s(8460),u=s(844),v=s(2585),C="xterm-dom-renderer-owner-",S="xterm-rows",y="xterm-fg-",m="xterm-bg-",x="xterm-focus",T="xterm-selection",P=1,I=i.DomRenderer=class extends u.Disposable{constructor(R,W,B,M,O,D,w,E,L,A,F,$,q){super(),this._terminal=R,this._document=W,this._element=B,this._screenElement=M,this._viewportElement=O,this._helperContainer=D,this._linkifier2=w,this._charSizeService=L,this._optionsService=A,this._bufferService=F,this._coreBrowserService=$,this._themeService=q,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new o.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(S),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(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,b.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(J=>this._injectCss(J))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(J=>this._handleLinkHover(J))),this.register(this._linkifier2.onHideLinkUnderline(J=>this._handleLinkLeave(J))),this.register((0,u.toDisposable)(()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new f.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let R=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*R,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*R),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/R),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/R),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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let W=`${this._terminalSelector} .${S} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=W,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(R){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let W=`${this._terminalSelector} .${S} { color: ${R.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;W+=`${this._terminalSelector} .${S} .xterm-dim { color: ${c.color.multiplyOpacity(R.foreground,.5).css};}`,W+=`${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 B=`blink_underline_${this._terminalClass}`,M=`blink_bar_${this._terminalClass}`,O=`blink_block_${this._terminalClass}`;W+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,W+=`@keyframes ${M} { 50% { box-shadow: none; }}`,W+=`@keyframes ${O} { 0% { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css}; } 50% { background-color: inherit; color: ${R.cursor.css}; }}`,W+=`${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${M} 1s step-end infinite;}${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css};}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${R.cursor.css} !important; color: ${R.cursorAccent.css} !important;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${R.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${R.cursor.css} inset;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${R.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,W+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${R.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${R.selectionInactiveBackgroundOpaque.css};}`;for(let[D,w]of R.ansi.entries())W+=`${this._terminalSelector} .${y}${D} { color: ${w.css}; }${this._terminalSelector} .${y}${D}.xterm-dim { color: ${c.color.multiplyOpacity(w,.5).css}; }${this._terminalSelector} .${m}${D} { background-color: ${w.css}; }`;W+=`${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR} { color: ${c.color.opaque(R.background).css}; }${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${c.color.multiplyOpacity(c.color.opaque(R.background),.5).css}; }${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR} { background-color: ${R.foreground.css}; }`,this._themeStyleElement.textContent=W}_setDefaultSpacing(){let R=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${R}px`,this._rowFactory.defaultSpacing=R}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(R,W){for(let B=this._rowElements.length;B<=W;B++){let M=this._document.createElement("div");this._rowContainer.appendChild(M),this._rowElements.push(M)}for(;this._rowElements.length>W;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(R,W){this._refreshRowElements(R,W),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(x),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(x),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(R,W,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(R,W,B),this.renderRows(0,this._bufferService.rows-1),!R||!W)return;this._selectionRenderModel.update(this._terminal,R,W,B);let M=this._selectionRenderModel.viewportStartRow,O=this._selectionRenderModel.viewportEndRow,D=this._selectionRenderModel.viewportCappedStartRow,w=this._selectionRenderModel.viewportCappedEndRow;if(D>=this._bufferService.rows||w<0)return;let E=this._document.createDocumentFragment();if(B){let L=R[0]>W[0];E.appendChild(this._createSelectionElement(D,L?W[0]:R[0],L?R[0]:W[0],w-D+1))}else{let L=M===D?R[0]:0,A=D===O?W[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(D,L,A));let F=w-D-1;if(E.appendChild(this._createSelectionElement(D+1,0,this._bufferService.cols,F)),D!==w){let $=O===w?W[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(w,0,$))}}this._selectionContainer.appendChild(E)}_createSelectionElement(R,W,B,M=1){let O=this._document.createElement("div"),D=W*this.dimensions.css.cell.width,w=this.dimensions.css.cell.width*(B-W);return D+w>this.dimensions.css.canvas.width&&(w=this.dimensions.css.canvas.width-D),O.style.height=M*this.dimensions.css.cell.height+"px",O.style.top=R*this.dimensions.css.cell.height+"px",O.style.left=`${D}px`,O.style.width=`${w}px`,O}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 R of this._rowElements)R.replaceChildren()}renderRows(R,W){let B=this._bufferService.buffer,M=B.ybase+B.y,O=Math.min(B.x,this._bufferService.cols-1),D=this._optionsService.rawOptions.cursorBlink,w=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=R;L<=W;L++){let A=L+B.ydisp,F=this._rowElements[L],$=B.lines.get(A);if(!F||!$)break;F.replaceChildren(...this._rowFactory.createRow($,A,A===M,w,E,O,D,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!0)}_handleLinkLeave(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!1)}_setCellUnderline(R,W,B,M,O,D){B<0&&(R=0),M<0&&(W=0);let w=this._bufferService.rows-1;B=Math.max(Math.min(B,w),0),M=Math.max(Math.min(M,w),0),O=Math.min(O,this._bufferService.cols);let E=this._bufferService.buffer,L=E.ybase+E.y,A=Math.min(E.x,O-1),F=this._optionsService.rawOptions.cursorBlink,$=this._optionsService.rawOptions.cursorStyle,q=this._optionsService.rawOptions.cursorInactiveStyle;for(let J=B;J<=M;++J){let H=J+E.ydisp,k=this._rowElements[J],U=E.lines.get(H);if(!k||!U)break;k.replaceChildren(...this._rowFactory.createRow(U,H,H===L,$,q,A,F,this.dimensions.css.cell.width,this._widthCache,D?J===B?R:0:-1,D?(J===M?W:O)-1:-1))}}};i.DomRenderer=I=l([_(7,v.IInstantiationService),_(8,a.ICharSizeService),_(9,v.IOptionsService),_(10,v.IBufferService),_(11,a.ICoreBrowserService),_(12,a.IThemeService)],I)},3787:function(h,i,s){var l=this&&this.__decorate||function(S,y,m,x){var T,P=arguments.length,I=P<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(S,y,m,x);else for(var R=S.length-1;R>=0;R--)(T=S[R])&&(I=(P<3?T(I):P>3?T(y,m,I):T(y,m))||I);return P>3&&I&&Object.defineProperty(y,m,I),I},_=this&&this.__param||function(S,y){return function(m,x){y(m,x,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;let n=s(2223),f=s(643),g=s(511),b=s(2585),p=s(8055),a=s(4725),c=s(4269),o=s(6171),u=s(3734),v=i.DomRendererRowFactory=class{constructor(S,y,m,x,T,P,I){this._document=S,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=x,this._coreService=T,this._decorationService=P,this._themeService=I,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(S,y,m){this._selectionStart=S,this._selectionEnd=y,this._columnSelectMode=m}createRow(S,y,m,x,T,P,I,R,W,B,M){let O=[],D=this._characterJoinerService.getJoinedCharacters(y),w=this._themeService.colors,E,L=S.getNoBgTrimmedLength();m&&L<P+1&&(L=P+1);let A=0,F="",$=0,q=0,J=0,H=!1,k=0,U=!1,z=0,G=[],V=B!==-1&&M!==-1;for(let N=0;N<L;N++){S.loadCell(N,this._workCell);let j=this._workCell.getWidth();if(j===0)continue;let K=!1,Y=N,X=this._workCell;if(D.length>0&&N===D[0][0]){K=!0;let re=D.shift();X=new c.JoinedCellData(this._workCell,S.translateToString(!0,re[0],re[1]),re[1]-re[0]),Y=re[1]-1,j=X.getWidth()}let ie=this._isCellInSelection(N,y),ne=m&&N===P,Z=V&&N>=B&&N<=M,oe=!1;this._decorationService.forEachDecorationAtCell(N,y,void 0,re=>{oe=!0});let Me=X.getChars()||f.WHITESPACE_CELL_CHAR;if(Me===" "&&(X.isUnderline()||X.isOverline())&&(Me="\xA0"),z=j*R-W.get(Me,X.isBold(),X.isItalic()),E){if(A&&(ie&&U||!ie&&!U&&X.bg===$)&&(ie&&U&&w.selectionForeground||X.fg===q)&&X.extended.ext===J&&Z===H&&z===k&&!ne&&!K&&!oe){X.isInvisible()?F+=f.WHITESPACE_CELL_CHAR:F+=Me,A++;continue}A&&(E.textContent=F),E=this._document.createElement("span"),A=0,F=""}else E=this._document.createElement("span");if($=X.bg,q=X.fg,J=X.extended.ext,H=Z,k=z,U=ie,K&&P>=N&&P<=Y&&(P=N),!this._coreService.isCursorHidden&&ne&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)I&&G.push("xterm-cursor-blink"),G.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline")}}if(X.isBold()&&G.push("xterm-bold"),X.isItalic()&&G.push("xterm-italic"),X.isDim()&&G.push("xterm-dim"),F=X.isInvisible()?f.WHITESPACE_CELL_CHAR:X.getChars()||f.WHITESPACE_CELL_CHAR,X.isUnderline()&&(G.push(`xterm-underline-${X.extended.underlineStyle}`),F===" "&&(F="\xA0"),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let re=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&re<8&&(re+=8),E.style.textDecorationColor=w.ansi[re].css}X.isOverline()&&(G.push("xterm-overline"),F===" "&&(F="\xA0")),X.isStrikethrough()&&G.push("xterm-strikethrough"),Z&&(E.style.textDecoration="underline");let Ee=X.getFgColor(),Pt=X.getFgColorMode(),Te=X.getBgColor(),Ot=X.getBgColorMode(),Hi=!!X.isInverse();if(Hi){let re=Ee;Ee=Te,Te=re;let Zn=Pt;Pt=Ot,Ot=Zn}let Qe,ei,et,It=!1;switch(this._decorationService.forEachDecorationAtCell(N,y,void 0,re=>{re.options.layer!=="top"&&It||(re.backgroundColorRGB&&(Ot=50331648,Te=re.backgroundColorRGB.rgba>>8&16777215,Qe=re.backgroundColorRGB),re.foregroundColorRGB&&(Pt=50331648,Ee=re.foregroundColorRGB.rgba>>8&16777215,ei=re.foregroundColorRGB),It=re.options.layer==="top")}),!It&&ie&&(Qe=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,Te=Qe.rgba>>8&16777215,Ot=50331648,It=!0,w.selectionForeground&&(Pt=50331648,Ee=w.selectionForeground.rgba>>8&16777215,ei=w.selectionForeground)),It&&G.push("xterm-decoration-top"),Ot){case 16777216:case 33554432:et=w.ansi[Te],G.push(`xterm-bg-${Te}`);break;case 50331648:et=p.channels.toColor(Te>>16,Te>>8&255,255&Te),this._addStyle(E,`background-color:#${C((Te>>>0).toString(16),"0",6)}`);break;default:Hi?(et=w.foreground,G.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):et=w.background}switch(Qe||X.isDim()&&(Qe=p.color.multiplyOpacity(et,.5)),Pt){case 16777216:case 33554432:X.isBold()&&Ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ee+=8),this._applyMinimumContrast(E,et,w.ansi[Ee],X,Qe,void 0)||G.push(`xterm-fg-${Ee}`);break;case 50331648:let re=p.channels.toColor(Ee>>16&255,Ee>>8&255,255&Ee);this._applyMinimumContrast(E,et,re,X,Qe,ei)||this._addStyle(E,`color:#${C(Ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,et,w.foreground,X,Qe,ei)||Hi&&G.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}G.length&&(E.className=G.join(" "),G.length=0),ne||K||oe?E.textContent=F:A++,z!==this.defaultSpacing&&(E.style.letterSpacing=`${z}px`),O.push(E),N=Y}return E&&A&&(E.textContent=F),O}_applyMinimumContrast(S,y,m,x,T,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,o.treatGlyphAsBackgroundColor)(x.getCode()))return!1;let I=this._getContrastCache(x),R;if(T||P||(R=I.getColor(y.rgba,m.rgba)),R===void 0){let W=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);R=p.color.ensureContrastRatio(T||y,P||m,W),I.setColor((T||y).rgba,(P||m).rgba,R??null)}return!!R&&(this._addStyle(S,`color:${R.css}`),!0)}_getContrastCache(S){return S.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(S,y){S.setAttribute("style",`${S.getAttribute("style")||""}${y};`)}_isCellInSelection(S,y){let m=this._selectionStart,x=this._selectionEnd;return!(!m||!x)&&(this._columnSelectMode?m[0]<=x[0]?S>=m[0]&&y>=m[1]&&S<x[0]&&y<=x[1]:S<m[0]&&y>=m[1]&&S>=x[0]&&y<=x[1]:y>m[1]&&y<x[1]||m[1]===x[1]&&y===m[1]&&S>=m[0]&&S<x[0]||m[1]<x[1]&&y===x[1]&&S<x[0]||m[1]<x[1]&&y===m[1]&&S>=m[0])}};function C(S,y,m){for(;S.length<m;)S=y+S;return S}i.DomRendererRowFactory=v=l([_(1,a.ICharacterJoinerService),_(2,b.IOptionsService),_(3,a.ICoreBrowserService),_(4,b.ICoreService),_(5,b.IDecorationService),_(6,a.IThemeService)],v)},2550:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(s,l){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=s.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 _=s.createElement("span");_.classList.add("xterm-char-measure-element");let n=s.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let f=s.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontStyle="italic";let g=s.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold",g.style.fontStyle="italic",this._measureElements=[_,n,f,g],this._container.appendChild(_),this._container.appendChild(n),this._container.appendChild(f),this._container.appendChild(g),l.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(s,l,_,n){s===this._font&&l===this._fontSize&&_===this._weight&&n===this._weightBold||(this._font=s,this._fontSize=l,this._weight=_,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(s,l,_){let n=0;if(!l&&!_&&s.length===1&&(n=s.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let b=this._measure(s,0);return b>0&&(this._flat[n]=b),b}let f=s;l&&(f+="B"),_&&(f+="I");let g=this._holey.get(f);if(g===void 0){let b=0;l&&(b|=1),_&&(b|=2),g=this._measure(s,b),g>0&&this._holey.set(f,g)}return g}_measure(s,l){let _=this._measureElements[l];return _.textContent=s.repeat(32),_.offsetWidth/32}}},2223:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;let l=s(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(h,i)=>{function s(_){return 57508<=_&&_<=57558}function l(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},i.isPowerlineGlyph=s,i.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},i.isEmoji=l,i.allowRescaling=function(_,n,f,g){return n===1&&f>Math.ceil(1.5*g)&&_!==void 0&&_>255&&!l(_)&&!s(_)&&!function(b){return 57344<=b&&b<=63743}(_)},i.treatGlyphAsBackgroundColor=function(_){return s(_)||function(n){return 9472<=n&&n<=9631}(_)},i.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}}}},i.computeNextVariantOffset=function(_,n,f=0){return(_-(2*Math.round(n)-f))%(2*Math.round(n))}},6052:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class s{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(_,n,f,g=!1){if(this.selectionStart=n,this.selectionEnd=f,!n||!f||n[0]===f[0]&&n[1]===f[1])return void this.clear();let b=_.buffers.active.ydisp,p=n[1]-b,a=f[1]-b,c=Math.max(p,0),o=Math.min(a,_.rows-1);c>=_.rows||o<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=p,this.viewportEndRow=a,this.viewportCappedStartRow=c,this.viewportCappedEndRow=o,this.startCol=n[0],this.endCol=f[0])}isCellSelected(_,n,f){return!!this.hasSelection&&(f-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&f>=this.viewportCappedStartRow&&n<this.endCol&&f<=this.viewportCappedEndRow:n<this.startCol&&f>=this.viewportCappedStartRow&&n>=this.endCol&&f<=this.viewportCappedEndRow:f>this.viewportStartRow&&f<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&f===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportStartRow&&n>=this.startCol)}}i.createSelectionRenderModel=function(){return new s}},456:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(s){this._bufferService=s,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 s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?s%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)-1]:[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[s,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[Math.max(s,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let s=this.selectionStart,l=this.selectionEnd;return!(!s||!l)&&(s[1]>l[1]||s[1]===l[1]&&s[0]>l[0])}handleTrim(s){return this.selectionStart&&(this.selectionStart[1]-=s),this.selectionEnd&&(this.selectionEnd[1]-=s),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,i,s){var l=this&&this.__decorate||function(o,u,v,C){var S,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(o,u,v,C);else for(var x=o.length-1;x>=0;x--)(S=o[x])&&(m=(y<3?S(m):y>3?S(u,v,m):S(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},_=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;let n=s(2585),f=s(8460),g=s(844),b=i.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(o,u,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new f.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new c(this._optionsService))}catch{this._measureStrategy=this.register(new a(o,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){let o=this._measureStrategy.measure();o.width===this.width&&o.height===this.height||(this.width=o.width,this.height=o.height,this._onCharSizeChange.fire())}};i.CharSizeService=b=l([_(2,n.IOptionsService)],b);class p extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,v){u!==void 0&&u>0&&v!==void 0&&v>0&&(this._result.width=u,this._result.height=v)}}class a extends p{constructor(u,v,C){super(),this._document=u,this._parentElement=v,this._optionsService=C,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 c extends p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let v=this._ctx.measureText("W");if(!("width"in v&&"fontBoundingBoxAscent"in v&&"fontBoundingBoxDescent"in v))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(h,i,s){var l=this&&this.__decorate||function(c,o,u,v){var C,S=arguments.length,y=S<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(c,o,u,v);else for(var m=c.length-1;m>=0;m--)(C=c[m])&&(y=(S<3?C(y):S>3?C(o,u,y):C(o,u))||y);return S>3&&y&&Object.defineProperty(o,u,y),y},_=this&&this.__param||function(c,o){return function(u,v){o(u,v,c)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;let n=s(3734),f=s(643),g=s(511),b=s(2585);class p extends n.AttributeData{constructor(o,u,v){super(),this.content=0,this.combinedData="",this.fg=o.fg,this.bg=o.bg,this.combinedData=u,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(o){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=p;let a=i.CharacterJoinerService=class Ns{constructor(o){this._bufferService=o,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(o){let u={id:this._nextCharacterJoinerId++,handler:o};return this._characterJoiners.push(u),u.id}deregister(o){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===o)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(o){if(this._characterJoiners.length===0)return[];let u=this._bufferService.buffer.lines.get(o);if(!u||u.length===0)return[];let v=[],C=u.translateToString(!0),S=0,y=0,m=0,x=u.getFg(0),T=u.getBg(0);for(let P=0;P<u.getTrimmedLength();P++)if(u.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==T){if(P-S>1){let I=this._getJoinedRanges(C,m,y,u,S);for(let R=0;R<I.length;R++)v.push(I[R])}S=P,m=y,x=this._workCell.fg,T=this._workCell.bg}y+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-S>1){let P=this._getJoinedRanges(C,m,y,u,S);for(let I=0;I<P.length;I++)v.push(P[I])}return v}_getJoinedRanges(o,u,v,C,S){let y=o.substring(u,v),m=[];try{m=this._characterJoiners[0].handler(y)}catch(x){console.error(x)}for(let x=1;x<this._characterJoiners.length;x++)try{let T=this._characterJoiners[x].handler(y);for(let P=0;P<T.length;P++)Ns._mergeRanges(m,T[P])}catch(T){console.error(T)}return this._stringRangesToCellRanges(m,C,S),m}_stringRangesToCellRanges(o,u,v){let C=0,S=!1,y=0,m=o[C];if(m){for(let x=v;x<this._bufferService.cols;x++){let T=u.getWidth(x),P=u.getString(x).length||f.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!S&&m[0]<=y&&(m[0]=x,S=!0),m[1]<=y){if(m[1]=x,m=o[++C],!m)break;m[0]<=y?(m[0]=x,S=!0):S=!1}y+=P}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(o,u){let v=!1;for(let C=0;C<o.length;C++){let S=o[C];if(v){if(u[1]<=S[0])return o[C-1][1]=u[1],o;if(u[1]<=S[1])return o[C-1][1]=Math.max(u[1],S[1]),o.splice(C,1),o;o.splice(C,1),C--}else{if(u[1]<=S[0])return o.splice(C,0,u),o;if(u[1]<=S[1])return S[0]=Math.min(u[0],S[0]),o;u[0]<S[1]&&(S[0]=Math.min(u[0],S[0]),v=!0)}}return v?o[o.length-1][1]=u[1]:o.push(u),o}};i.CharacterJoinerService=a=l([_(0,b.IBufferService)],a)},5114:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;let l=s(844),_=s(8460),n=s(3656);class f extends l.Disposable{constructor(p,a,c){super(),this._textarea=p,this._window=a,this.mainDocument=c,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(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(o=>this._screenDprMonitor.setWindow(o))),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(p){this._window!==p&&(this._window=p,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}}i.CoreBrowserService=f;class g extends l.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new l.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,l.toDisposable)(()=>this.clearListener()))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){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:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;let l=s(844);class _ extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(f){return this.linkProviders.push(f),{dispose:()=>{let g=this.linkProviders.indexOf(f);g!==-1&&this.linkProviders.splice(g,1)}}}}i.LinkProviderService=_},8934:function(h,i,s){var l=this&&this.__decorate||function(b,p,a,c){var o,u=arguments.length,v=u<3?p:c===null?c=Object.getOwnPropertyDescriptor(p,a):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(b,p,a,c);else for(var C=b.length-1;C>=0;C--)(o=b[C])&&(v=(u<3?o(v):u>3?o(p,a,v):o(p,a))||v);return u>3&&v&&Object.defineProperty(p,a,v),v},_=this&&this.__param||function(b,p){return function(a,c){p(a,c,b)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;let n=s(4725),f=s(9806),g=i.MouseService=class{constructor(b,p){this._renderService=b,this._charSizeService=p}getCoords(b,p,a,c,o){return(0,f.getCoords)(window,b,p,a,c,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(b,p){let a=(0,f.getCoordsRelativeToElement)(window,b,p);if(this._charSizeService.hasValidSize)return a[0]=Math.min(Math.max(a[0],0),this._renderService.dimensions.css.canvas.width-1),a[1]=Math.min(Math.max(a[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(a[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(a[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(a[0]),y:Math.floor(a[1])}}};i.MouseService=g=l([_(0,n.IRenderService),_(1,n.ICharSizeService)],g)},3230:function(h,i,s){var l=this&&this.__decorate||function(o,u,v,C){var S,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(o,u,v,C);else for(var x=o.length-1;x>=0;x--)(S=o[x])&&(m=(y<3?S(m):y>3?S(u,v,m):S(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},_=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;let n=s(6193),f=s(4725),g=s(8460),b=s(844),p=s(7226),a=s(2585),c=i.RenderService=class extends b.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(o,u,v,C,S,y,m,x){super(),this._rowCount=o,this._charSizeService=C,this._renderer=this.register(new b.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new b.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 g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((T,P)=>this._renderRows(T,P),m),this.register(this._renderDebouncer),this.register(m.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(y.onResize(()=>this._fullRefresh())),this.register(y.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(v.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(S.onDecorationRegistered(()=>this._fullRefresh())),this.register(S.onDecorationRemoved(()=>this._fullRefresh())),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(y.cols,y.rows),this._fullRefresh()})),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(y.buffer.y,y.buffer.y,!0))),this.register(x.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange(T=>this._registerIntersectionObserver(T,u)))}_registerIntersectionObserver(o,u){if("IntersectionObserver"in o){let v=new o.IntersectionObserver(C=>this._handleIntersectionChange(C[C.length-1]),{threshold:0});v.observe(u),this._observerDisposable.value=(0,b.toDisposable)(()=>v.disconnect())}}_handleIntersectionChange(o){this._isPaused=o.isIntersecting===void 0?o.intersectionRatio===0:!o.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(o,u,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(o,u,this._rowCount))}_renderRows(o,u){this._renderer.value&&(o=Math.min(o,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(o,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:o,end:u}),this._onRender.fire({start:o,end:u}),this._isNextRenderRedrawOnly=!0)}resize(o,u){this._rowCount=u,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(o){this._renderer.value=o,this._renderer.value&&(this._renderer.value.onRequestRedraw(u=>this.refreshRows(u.start,u.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(o){return this._renderDebouncer.addRefreshCallback(o)}_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(o,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(o,u)):this._renderer.value.handleResize(o,u),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(o,u,v){this._selectionState.start=o,this._selectionState.end=u,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(o,u,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};i.RenderService=c=l([_(2,a.IOptionsService),_(3,f.ICharSizeService),_(4,a.IDecorationService),_(5,a.IBufferService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],c)},9312:function(h,i,s){var l=this&&this.__decorate||function(m,x,T,P){var I,R=arguments.length,W=R<3?x:P===null?P=Object.getOwnPropertyDescriptor(x,T):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(m,x,T,P);else for(var B=m.length-1;B>=0;B--)(I=m[B])&&(W=(R<3?I(W):R>3?I(x,T,W):I(x,T))||W);return R>3&&W&&Object.defineProperty(x,T,W),W},_=this&&this.__param||function(m,x){return function(T,P){x(T,P,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;let n=s(9806),f=s(9504),g=s(456),b=s(4725),p=s(8460),a=s(844),c=s(6114),o=s(4841),u=s(511),v=s(2585),C="\xA0",S=new RegExp(C,"g"),y=i.SelectionService=class extends a.Disposable{constructor(m,x,T,P,I,R,W,B,M){super(),this._element=m,this._screenElement=x,this._linkifier=T,this._bufferService=P,this._coreService=I,this._mouseService=R,this._optionsService=W,this._renderService=B,this._coreBrowserService=M,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=O=>this._handleMouseMove(O),this._mouseUpListener=O=>this._handleMouseUp(O),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(O=>this._handleTrim(O)),this.register(this._bufferService.buffers.onBufferActivate(O=>this._handleBufferActivate(O))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,a.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 m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!m||!x||m[0]===x[0]&&m[1]===x[1])}get selectionText(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;if(!m||!x)return"";let T=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(m[0]===x[0])return"";let I=m[0]<x[0]?m[0]:x[0],R=m[0]<x[0]?x[0]:m[0];for(let W=m[1];W<=x[1];W++){let B=T.translateBufferLineToString(W,!0,I,R);P.push(B)}}else{let I=m[1]===x[1]?x[0]:void 0;P.push(T.translateBufferLineToString(m[1],!0,m[0],I));for(let R=m[1]+1;R<=x[1]-1;R++){let W=T.lines.get(R),B=T.translateBufferLineToString(R,!0);W?.isWrapped?P[P.length-1]+=B:P.push(B)}if(m[1]!==x[1]){let R=T.lines.get(x[1]),W=T.translateBufferLineToString(x[1],!0,0,x[0]);R&&R.isWrapped?P[P.length-1]+=W:P.push(W)}}return P.map(I=>I.replace(S," ")).join(c.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(d){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s.isLinux&&d&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(d){let b=this._getMouseBufferCoords(d),L=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(L&&T&&b)&&this._areCoordsInSelection(b,L,T)}isCellInSelection(d,b){let L=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!L||!T)&&this._areCoordsInSelection([d,b],L,T)}_areCoordsInSelection(d,b,L){return d[1]>b[1]&&d[1]<L[1]||b[1]===L[1]&&d[1]===b[1]&&d[0]>=b[0]&&d[0]<L[0]||b[1]<L[1]&&d[1]===L[1]&&d[0]<L[0]||b[1]<L[1]&&d[1]===b[1]&&d[0]>=b[0]}_selectWordAtCursor(d,b){let L=this._linkifier.currentLink?.link?.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let T=this._getMouseBufferCoords(d);return!!T&&(this._selectWordAt(T,b),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(d,b){this._model.clearSelection(),d=Math.max(d,0),b=Math.min(b,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,d],this._model.selectionEnd=[this._bufferService.cols,b],this.refresh(),this._onSelectionChange.fire()}_handleTrim(d){this._model.handleTrim(d)&&this.refresh()}_getMouseBufferCoords(d){let b=this._mouseService.getCoords(d,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(b)return b[0]--,b[1]--,b[1]+=this._bufferService.buffer.ydisp,b}_getMouseEventScrollAmount(d){let b=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,d,this._screenElement)[1],L=this._renderService.dimensions.css.canvas.height;return b>=0&&b<=L?0:(b>L&&(b-=L),b=Math.min(Math.max(b,-50),50),b/=50,b/Math.abs(b)+Math.round(14*b))}shouldForceSelection(d){return s.isMac?d.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:d.shiftKey}handleMouseDown(d){if(this._mouseDownTimeStamp=d.timeStamp,(d.button!==2||!this.hasSelection)&&d.button===0){if(!this._enabled){if(!this.shouldForceSelection(d))return;d.stopPropagation()}d.preventDefault(),this._dragScrollAmount=0,this._enabled&&d.shiftKey?this._handleIncrementalClick(d):d.detail===1?this._handleSingleClick(d):d.detail===2?this._handleDoubleClick(d):d.detail===3&&this._handleTripleClick(d),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(d){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(d))}_handleSingleClick(d){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(d)?3:0,this._model.selectionStart=this._getMouseBufferCoords(d),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let b=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);b&&b.length!==this._model.selectionStart[0]&&b.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(d){this._selectWordAtCursor(d,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(d){let b=this._getMouseBufferCoords(d);b&&(this._activeSelectionMode=2,this._selectLineAt(b[1]))}shouldColumnSelect(d){return d.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(d){if(d.stopImmediatePropagation(),!this._model.selectionStart)return;let b=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(d),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(d),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){let T=L.lines.get(this._model.selectionEnd[1]);T&&T.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}b&&b[0]===this._model.selectionEnd[0]&&b[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let d=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(d.ydisp+this._bufferService.rows,d.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=d.ydisp),this.refresh()}}_handleMouseUp(d){let b=d.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&b<500&&d.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let L=this._mouseService.getCoords(d,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){let T=(0,_.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(T,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let d=this._model.finalSelectionStart,b=this._model.finalSelectionEnd,L=!(!d||!b||d[0]===b[0]&&d[1]===b[1]);L?d&&b&&(this._oldSelectionStart&&this._oldSelectionEnd&&d[0]===this._oldSelectionStart[0]&&d[1]===this._oldSelectionStart[1]&&b[0]===this._oldSelectionEnd[0]&&b[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(d,b,L)):this._oldHasSelection&&this._fireOnSelectionChange(d,b,L)}_fireOnSelectionChange(d,b,L){this._oldSelectionStart=d,this._oldSelectionEnd=b,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(d){this.clearSelection(),this._trimListener.dispose(),this._trimListener=d.activeBuffer.lines.onTrim(b=>this._handleTrim(b))}_convertViewportColToCharacterIndex(d,b){let L=b;for(let T=0;b>=T;T++){let B=d.loadCell(T,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:B>1&&b!==T&&(L+=B-1)}return L}setSelection(d,b,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[d,b],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(d){this._isClickInSelection(d)||(this._selectWordAtCursor(d,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(d,b,L=!0,T=!0){if(d[0]>=this._bufferService.cols)return;let B=this._bufferService.buffer,D=B.lines.get(d[1]);if(!D)return;let F=B.translateBufferLineToString(d[1],!1),I=this._convertViewportColToCharacterIndex(D,d[0]),O=I,H=d[0]-I,P=0,C=0,k=0,R=0;if(F.charAt(I)===" "){for(;I>0&&F.charAt(I-1)===" ";)I--;for(;O<F.length&&F.charAt(O+1)===" ";)O++}else{let z=d[0],q=d[0];D.getWidth(z)===0&&(P++,z--),D.getWidth(q)===2&&(C++,q++);let K=D.getString(q).length;for(K>1&&(R+=K-1,O+=K-1);z>0&&I>0&&!this._isCharWordSeparator(D.loadCell(z-1,this._workCell));){D.loadCell(z-1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===0?(P++,z--):M>1&&(k+=M-1,I-=M-1),I--,z--}for(;q<D.length&&O+1<F.length&&!this._isCharWordSeparator(D.loadCell(q+1,this._workCell));){D.loadCell(q+1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,q++):M>1&&(R+=M-1,O+=M-1),O++,q++}}O++;let A=I+H-P+k,N=Math.min(this._bufferService.cols,O-I+P+C-k-R);if(b||F.slice(I,O).trim()!==""){if(L&&A===0&&D.getCodePoint(0)!==32){let z=B.lines.get(d[1]-1);if(z&&D.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){let q=this._getWordAt([this._bufferService.cols-1,d[1]-1],!1,!0,!1);if(q){let K=this._bufferService.cols-q.start;A-=K,N+=K}}}if(T&&A+N===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){let z=B.lines.get(d[1]+1);if(z?.isWrapped&&z.getCodePoint(0)!==32){let q=this._getWordAt([0,d[1]+1],!1,!1,!0);q&&(N+=q.length)}}return{start:A,length:N}}}_selectWordAt(d,b){let L=this._getWordAt(d,b);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,d[1]--;this._model.selectionStart=[L.start,d[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(d){let b=this._getWordAt(d,!0);if(b){let L=d[1];for(;b.start<0;)b.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;b.start+b.length>this._bufferService.cols;)b.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?b.start:b.start+b.length,L]}}_isCharWordSeparator(d){return d.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars())>=0}_selectLineAt(d){let b=this._bufferService.buffer.getWrappedRangeForLine(d),L={start:{x:0,y:b.first},end:{x:this._bufferService.cols-1,y:b.last}};this._model.selectionStart=[0,b.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(L,this._bufferService.cols)}};r.SelectionService=m=h([f(3,c.IBufferService),f(4,c.ICoreService),f(5,S.IMouseService),f(6,c.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],m)},4725:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;let h=n(8343);r.ICharSizeService=(0,h.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),r.IMouseService=(0,h.createDecorator)("MouseService"),r.IRenderService=(0,h.createDecorator)("RenderService"),r.ISelectionService=(0,h.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,h.createDecorator)("ThemeService"),r.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(E,r,n){var h=this&&this.__decorate||function(m,d,b,L){var T,B=arguments.length,D=B<3?d:L===null?L=Object.getOwnPropertyDescriptor(d,b):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(m,d,b,L);else for(var F=m.length-1;F>=0;F--)(T=m[F])&&(D=(B<3?T(D):B>3?T(d,b,D):T(d,b))||D);return B>3&&D&&Object.defineProperty(d,b,D),D},f=this&&this.__param||function(m,d){return function(b,L){d(b,L,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let o=n(7239),_=n(8055),v=n(8460),S=n(844),u=n(2585),t=_.css.toColor("#ffffff"),s=_.css.toColor("#000000"),e=_.css.toColor("#ffffff"),i=_.css.toColor("#000000"),c={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let m=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],d=[0,95,135,175,215,255];for(let b=0;b<216;b++){let L=d[b/36%6|0],T=d[b/6%6|0],B=d[b%6];m.push({css:_.channels.toCss(L,T,B),rgba:_.channels.toRgba(L,T,B)})}for(let b=0;b<24;b++){let L=8+10*b;m.push({css:_.channels.toCss(L,L,L),rgba:_.channels.toRgba(L,L,L)})}return m})());let g=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:t,background:s,cursor:e,cursorAccent:i,selectionForeground:void 0,selectionBackgroundTransparent:c,selectionBackgroundOpaque:_.color.blend(s,c),selectionInactiveBackgroundTransparent:c,selectionInactiveBackgroundOpaque:_.color.blend(s,c),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(m={}){let d=this._colors;if(d.foreground=p(m.foreground,t),d.background=p(m.background,s),d.cursor=p(m.cursor,e),d.cursorAccent=p(m.cursorAccent,i),d.selectionBackgroundTransparent=p(m.selectionBackground,c),d.selectionBackgroundOpaque=_.color.blend(d.background,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundTransparent=p(m.selectionInactiveBackground,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundOpaque=_.color.blend(d.background,d.selectionInactiveBackgroundTransparent),d.selectionForeground=m.selectionForeground?p(m.selectionForeground,_.NULL_COLOR):void 0,d.selectionForeground===_.NULL_COLOR&&(d.selectionForeground=void 0),_.color.isOpaque(d.selectionBackgroundTransparent)&&(d.selectionBackgroundTransparent=_.color.opacity(d.selectionBackgroundTransparent,.3)),_.color.isOpaque(d.selectionInactiveBackgroundTransparent)&&(d.selectionInactiveBackgroundTransparent=_.color.opacity(d.selectionInactiveBackgroundTransparent,.3)),d.ansi=r.DEFAULT_ANSI_COLORS.slice(),d.ansi[0]=p(m.black,r.DEFAULT_ANSI_COLORS[0]),d.ansi[1]=p(m.red,r.DEFAULT_ANSI_COLORS[1]),d.ansi[2]=p(m.green,r.DEFAULT_ANSI_COLORS[2]),d.ansi[3]=p(m.yellow,r.DEFAULT_ANSI_COLORS[3]),d.ansi[4]=p(m.blue,r.DEFAULT_ANSI_COLORS[4]),d.ansi[5]=p(m.magenta,r.DEFAULT_ANSI_COLORS[5]),d.ansi[6]=p(m.cyan,r.DEFAULT_ANSI_COLORS[6]),d.ansi[7]=p(m.white,r.DEFAULT_ANSI_COLORS[7]),d.ansi[8]=p(m.brightBlack,r.DEFAULT_ANSI_COLORS[8]),d.ansi[9]=p(m.brightRed,r.DEFAULT_ANSI_COLORS[9]),d.ansi[10]=p(m.brightGreen,r.DEFAULT_ANSI_COLORS[10]),d.ansi[11]=p(m.brightYellow,r.DEFAULT_ANSI_COLORS[11]),d.ansi[12]=p(m.brightBlue,r.DEFAULT_ANSI_COLORS[12]),d.ansi[13]=p(m.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),d.ansi[14]=p(m.brightCyan,r.DEFAULT_ANSI_COLORS[14]),d.ansi[15]=p(m.brightWhite,r.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){let b=Math.min(d.ansi.length-16,m.extendedAnsi.length);for(let L=0;L<b;L++)d.ansi[L+16]=p(m.extendedAnsi[L],r.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(m){this._restoreColor(m),this._onChangeColors.fire(this.colors)}_restoreColor(m){if(m!==void 0)switch(m){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[m]=this._restoreColors.ansi[m]}else for(let d=0;d<this._restoreColors.ansi.length;++d)this._colors.ansi[d]=this._restoreColors.ansi[d]}modifyColors(m){m(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function p(m,d){if(m!==void 0)try{return _.css.toColor(m)}catch{}return d}r.ThemeService=g=h([f(0,u.IOptionsService)],g)},6349:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let h=n(8460),f=n(844);class o extends f.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;let S=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)S[u]=this._array[this._getCyclicIndex(u)];this._array=S,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let S=this._length;S<v;S++)this._array[S]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,S){this._array[this._getCyclicIndex(v)]=S}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,S,...u){if(S){for(let t=v;t<this._length-S;t++)this._array[this._getCyclicIndex(t)]=this._array[this._getCyclicIndex(t+S)];this._length-=S,this.onDeleteEmitter.fire({index:v,amount:S})}for(let t=this._length-1;t>=v;t--)this._array[this._getCyclicIndex(t+u.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<u.length;t++)this._array[this._getCyclicIndex(v+t)]=u[t];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){let t=this._length+u.length-this._maxLength;this._startIndex+=t,this._length=this._maxLength,this.onTrimEmitter.fire(t)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,S,u){if(!(S<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let s=S-1;s>=0;s--)this.set(v+s+u,this.get(v+s));let t=v+S+u-this._length;if(t>0)for(this._length+=t;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let t=0;t<S;t++)this.set(v+t+u,this.get(v+t))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=o},1439:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function n(h,f=5){if(typeof h!="object")return h;let o=Array.isArray(h)?[]:{};for(let _ in h)o[_]=f<=1?h[_]:h[_]&&n(h[_],f-1);return o}},8055:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let n=0,h=0,f=0,o=0;var _,v,S,u,t;function s(i){let c=i.toString(16);return c.length<2?"0"+c:c}function e(i,c){return i<c?(c+.05)/(i+.05):(i+.05)/(c+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},function(i){i.toCss=function(c,g,p,m){return m!==void 0?`#${s(c)}${s(g)}${s(p)}${s(m)}`:`#${s(c)}${s(g)}${s(p)}`},i.toRgba=function(c,g,p,m=255){return(c<<24|g<<16|p<<8|m)>>>0},i.toColor=function(c,g,p,m){return{css:i.toCss(c,g,p,m),rgba:i.toRgba(c,g,p,m)}}}(_||(r.channels=_={})),function(i){function c(g,p){return o=Math.round(255*p),[n,h,f]=t.toChannels(g.rgba),{css:_.toCss(n,h,f,o),rgba:_.toRgba(n,h,f,o)}}i.blend=function(g,p){if(o=(255&p.rgba)/255,o===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,d=p.rgba>>16&255,b=p.rgba>>8&255,L=g.rgba>>24&255,T=g.rgba>>16&255,B=g.rgba>>8&255;return n=L+Math.round((m-L)*o),h=T+Math.round((d-T)*o),f=B+Math.round((b-B)*o),{css:_.toCss(n,h,f),rgba:_.toRgba(n,h,f)}},i.isOpaque=function(g){return(255&g.rgba)==255},i.ensureContrastRatio=function(g,p,m){let d=t.ensureContrastRatio(g.rgba,p.rgba,m);if(d)return _.toColor(d>>24&255,d>>16&255,d>>8&255)},i.opaque=function(g){let p=(255|g.rgba)>>>0;return[n,h,f]=t.toChannels(p),{css:_.toCss(n,h,f),rgba:p}},i.opacity=c,i.multiplyOpacity=function(g,p){return o=255&g.rgba,c(g,o*p/255)},i.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(v||(r.color=v={})),function(i){let c,g;try{let p=document.createElement("canvas");p.width=1,p.height=1;let m=p.getContext("2d",{willReadFrequently:!0});m&&(c=m,c.globalCompositeOperation="copy",g=c.createLinearGradient(0,0,1,1))}catch{}i.toColor=function(p){if(p.match(/#[\da-f]{3,8}/i))switch(p.length){case 4:return n=parseInt(p.slice(1,2).repeat(2),16),h=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),_.toColor(n,h,f);case 5:return n=parseInt(p.slice(1,2).repeat(2),16),h=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),o=parseInt(p.slice(4,5).repeat(2),16),_.toColor(n,h,f,o);case 7:return{css:p,rgba:(parseInt(p.slice(1),16)<<8|255)>>>0};case 9:return{css:p,rgba:parseInt(p.slice(1),16)>>>0}}let m=p.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return n=parseInt(m[1]),h=parseInt(m[2]),f=parseInt(m[3]),o=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(n,h,f,o);if(!c||!g)throw new Error("css.toColor: Unsupported css format");if(c.fillStyle=g,c.fillStyle=p,typeof c.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(c.fillRect(0,0,1,1),[n,h,f,o]=c.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(n,h,f,o),css:p}}}(S||(r.css=S={})),function(i){function c(g,p,m){let d=g/255,b=p/255,L=m/255;return .2126*(d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4))+.7152*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}i.relativeLuminance=function(g){return c(g>>16&255,g>>8&255,255&g)},i.relativeLuminance2=c}(u||(r.rgb=u={})),function(i){function c(p,m,d){let b=p>>24&255,L=p>>16&255,T=p>>8&255,B=m>>24&255,D=m>>16&255,F=m>>8&255,I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));for(;I<d&&(B>0||D>0||F>0);)B-=Math.max(0,Math.ceil(.1*B)),D-=Math.max(0,Math.ceil(.1*D)),F-=Math.max(0,Math.ceil(.1*F)),I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));return(B<<24|D<<16|F<<8|255)>>>0}function g(p,m,d){let b=p>>24&255,L=p>>16&255,T=p>>8&255,B=m>>24&255,D=m>>16&255,F=m>>8&255,I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));for(;I<d&&(B<255||D<255||F<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),D=Math.min(255,D+Math.ceil(.1*(255-D))),F=Math.min(255,F+Math.ceil(.1*(255-F))),I=e(u.relativeLuminance2(B,D,F),u.relativeLuminance2(b,L,T));return(B<<24|D<<16|F<<8|255)>>>0}i.blend=function(p,m){if(o=(255&m)/255,o===1)return m;let d=m>>24&255,b=m>>16&255,L=m>>8&255,T=p>>24&255,B=p>>16&255,D=p>>8&255;return n=T+Math.round((d-T)*o),h=B+Math.round((b-B)*o),f=D+Math.round((L-D)*o),_.toRgba(n,h,f)},i.ensureContrastRatio=function(p,m,d){let b=u.relativeLuminance(p>>8),L=u.relativeLuminance(m>>8);if(e(b,L)<d){if(L<b){let D=c(p,m,d),F=e(b,u.relativeLuminance(D>>8));if(F<d){let I=g(p,m,d);return F>e(b,u.relativeLuminance(I>>8))?D:I}return D}let T=g(p,m,d),B=e(b,u.relativeLuminance(T>>8));if(B<d){let D=c(p,m,d);return B>e(b,u.relativeLuminance(D>>8))?T:D}return T}},i.reduceLuminance=c,i.increaseLuminance=g,i.toChannels=function(p){return[p>>24&255,p>>16&255,p>>8&255,255&p]}}(t||(r.rgba=t={})),r.toPaddedHex=s,r.contrastRatio=e},8969:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let h=n(844),f=n(2585),o=n(4348),_=n(7866),v=n(744),S=n(7302),u=n(6975),t=n(8460),s=n(1753),e=n(1480),i=n(7994),c=n(9282),g=n(5435),p=n(5981),m=n(2660),d=!1;class b extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new t.EventEmitter),this._onScroll.event(T=>{this._onScrollApi?.fire(T.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(T){for(let B in T)this.optionsService.options[B]=T[B]}constructor(T){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new t.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new t.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new t.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new t.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new t.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new S.OptionsService(T)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,t.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,t.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,t.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,t.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new p.WriteBuffer((B,D)=>this._inputHandler.parse(B,D))),this.register((0,t.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(T,B){this._writeBuffer.write(T,B)}writeSync(T,B){this._logService.logLevel<=f.LogLevelEnum.WARN&&!d&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d=!0),this._writeBuffer.writeSync(T,B)}input(T,B=!0){this.coreService.triggerDataEvent(T,B)}resize(T,B){isNaN(T)||isNaN(B)||(T=Math.max(T,v.MINIMUM_COLS),B=Math.max(B,v.MINIMUM_ROWS),this._bufferService.resize(T,B))}scroll(T,B=!1){this._bufferService.scroll(T,B)}scrollLines(T,B,D){this._bufferService.scrollLines(T,B,D)}scrollPages(T){this.scrollLines(T*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(T){let B=T-this._bufferService.buffer.ydisp;B!==0&&this.scrollLines(B)}registerEscHandler(T,B){return this._inputHandler.registerEscHandler(T,B)}registerDcsHandler(T,B){return this._inputHandler.registerDcsHandler(T,B)}registerCsiHandler(T,B){return this._inputHandler.registerCsiHandler(T,B)}registerOscHandler(T,B){return this._inputHandler.registerOscHandler(T,B)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let T=!1,B=this.optionsService.rawOptions.windowsPty;B&&B.buildNumber!==void 0&&B.buildNumber!==void 0?T=B.backend==="conpty"&&B.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(T=!0),T?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let T=[];T.push(this.onLineFeed(c.updateWindowsModeWrappedState.bind(null,this._bufferService))),T.push(this.registerCsiHandler({final:"H"},()=>((0,c.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(let B of T)B.dispose()})}}}r.CoreTerminal=b},8460:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===n)return void this._listeners.splice(h,1)}}})),this._event}fire(n,h){let f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,n,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(n,h){return n(f=>h.fire(f))},r.runAndSubscribe=function(n,h){return h(void 0),n(f=>h(f))}},5435:function(E,r,n){var h=this&&this.__decorate||function(P,C,k,R){var A,N=arguments.length,z=N<3?C:R===null?R=Object.getOwnPropertyDescriptor(C,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(P,C,k,R);else for(var q=P.length-1;q>=0;q--)(A=P[q])&&(z=(N<3?A(z):N>3?A(C,k,z):A(C,k))||z);return N>3&&z&&Object.defineProperty(C,k,z),z},f=this&&this.__param||function(P,C){return function(k,R){C(k,R,P)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let o=n(2584),_=n(7116),v=n(2015),S=n(844),u=n(482),t=n(8437),s=n(8460),e=n(643),i=n(511),c=n(3734),g=n(2585),p=n(1480),m=n(6242),d=n(6351),b=n(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function B(P,C){if(P>24)return C.setWinLines||!1;switch(P){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var D;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(r.WindowsOptionsReportType=D={}));let F=0;class I extends S.Disposable{getAttrData(){return this._curAttrData}constructor(C,k,R,A,N,z,q,K,M=new v.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=k,this._coreService=R,this._logService=A,this._optionsService=N,this._oscLinkService=z,this._coreMouseService=q,this._unicodeService=K,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new i.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new O(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(x=>this._activeBuffer=x.activeBuffer)),this._parser.setCsiHandlerFallback((x,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:W.toArray()})}),this._parser.setEscHandlerFallback(x=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(x)})}),this._parser.setExecuteHandlerFallback(x=>{this._logService.debug("Unknown EXECUTE code: ",{code:x})}),this._parser.setOscHandlerFallback((x,W,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:W,data:U})}),this._parser.setDcsHandlerFallback((x,W,U)=>{W==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:W,payload:U})}),this._parser.setPrintHandler((x,W,U)=>this.print(x,W,U)),this._parser.registerCsiHandler({final:"@"},x=>this.insertChars(x)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},x=>this.scrollLeft(x)),this._parser.registerCsiHandler({final:"A"},x=>this.cursorUp(x)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},x=>this.scrollRight(x)),this._parser.registerCsiHandler({final:"B"},x=>this.cursorDown(x)),this._parser.registerCsiHandler({final:"C"},x=>this.cursorForward(x)),this._parser.registerCsiHandler({final:"D"},x=>this.cursorBackward(x)),this._parser.registerCsiHandler({final:"E"},x=>this.cursorNextLine(x)),this._parser.registerCsiHandler({final:"F"},x=>this.cursorPrecedingLine(x)),this._parser.registerCsiHandler({final:"G"},x=>this.cursorCharAbsolute(x)),this._parser.registerCsiHandler({final:"H"},x=>this.cursorPosition(x)),this._parser.registerCsiHandler({final:"I"},x=>this.cursorForwardTab(x)),this._parser.registerCsiHandler({final:"J"},x=>this.eraseInDisplay(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},x=>this.eraseInDisplay(x,!0)),this._parser.registerCsiHandler({final:"K"},x=>this.eraseInLine(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},x=>this.eraseInLine(x,!0)),this._parser.registerCsiHandler({final:"L"},x=>this.insertLines(x)),this._parser.registerCsiHandler({final:"M"},x=>this.deleteLines(x)),this._parser.registerCsiHandler({final:"P"},x=>this.deleteChars(x)),this._parser.registerCsiHandler({final:"S"},x=>this.scrollUp(x)),this._parser.registerCsiHandler({final:"T"},x=>this.scrollDown(x)),this._parser.registerCsiHandler({final:"X"},x=>this.eraseChars(x)),this._parser.registerCsiHandler({final:"Z"},x=>this.cursorBackwardTab(x)),this._parser.registerCsiHandler({final:"`"},x=>this.charPosAbsolute(x)),this._parser.registerCsiHandler({final:"a"},x=>this.hPositionRelative(x)),this._parser.registerCsiHandler({final:"b"},x=>this.repeatPrecedingCharacter(x)),this._parser.registerCsiHandler({final:"c"},x=>this.sendDeviceAttributesPrimary(x)),this._parser.registerCsiHandler({prefix:">",final:"c"},x=>this.sendDeviceAttributesSecondary(x)),this._parser.registerCsiHandler({final:"d"},x=>this.linePosAbsolute(x)),this._parser.registerCsiHandler({final:"e"},x=>this.vPositionRelative(x)),this._parser.registerCsiHandler({final:"f"},x=>this.hVPosition(x)),this._parser.registerCsiHandler({final:"g"},x=>this.tabClear(x)),this._parser.registerCsiHandler({final:"h"},x=>this.setMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"h"},x=>this.setModePrivate(x)),this._parser.registerCsiHandler({final:"l"},x=>this.resetMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"l"},x=>this.resetModePrivate(x)),this._parser.registerCsiHandler({final:"m"},x=>this.charAttributes(x)),this._parser.registerCsiHandler({final:"n"},x=>this.deviceStatus(x)),this._parser.registerCsiHandler({prefix:"?",final:"n"},x=>this.deviceStatusPrivate(x)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},x=>this.softReset(x)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},x=>this.setCursorStyle(x)),this._parser.registerCsiHandler({final:"r"},x=>this.setScrollRegion(x)),this._parser.registerCsiHandler({final:"s"},x=>this.saveCursor(x)),this._parser.registerCsiHandler({final:"t"},x=>this.windowOptions(x)),this._parser.registerCsiHandler({final:"u"},x=>this.restoreCursor(x)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},x=>this.insertColumns(x)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},x=>this.deleteColumns(x)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},x=>this.selectProtected(x)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},x=>this.requestMode(x,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},x=>this.requestMode(x,!1)),this._parser.setExecuteHandler(o.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(o.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(o.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(o.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(o.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(o.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(o.C1.IND,()=>this.index()),this._parser.setExecuteHandler(o.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(o.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(x=>(this.setTitle(x),this.setIconName(x),!0))),this._parser.registerOscHandler(1,new m.OscHandler(x=>this.setIconName(x))),this._parser.registerOscHandler(2,new m.OscHandler(x=>this.setTitle(x))),this._parser.registerOscHandler(4,new m.OscHandler(x=>this.setOrReportIndexedColor(x))),this._parser.registerOscHandler(8,new m.OscHandler(x=>this.setHyperlink(x))),this._parser.registerOscHandler(10,new m.OscHandler(x=>this.setOrReportFgColor(x))),this._parser.registerOscHandler(11,new m.OscHandler(x=>this.setOrReportBgColor(x))),this._parser.registerOscHandler(12,new m.OscHandler(x=>this.setOrReportCursorColor(x))),this._parser.registerOscHandler(104,new m.OscHandler(x=>this.restoreIndexedColor(x))),this._parser.registerOscHandler(110,new m.OscHandler(x=>this.restoreFgColor(x))),this._parser.registerOscHandler(111,new m.OscHandler(x=>this.restoreBgColor(x))),this._parser.registerOscHandler(112,new m.OscHandler(x=>this.restoreCursorColor(x))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let x in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:x},()=>this.selectCharset("("+x)),this._parser.registerEscHandler({intermediates:")",final:x},()=>this.selectCharset(")"+x)),this._parser.registerEscHandler({intermediates:"*",final:x},()=>this.selectCharset("*"+x)),this._parser.registerEscHandler({intermediates:"+",final:x},()=>this.selectCharset("+"+x)),this._parser.registerEscHandler({intermediates:"-",final:x},()=>this.selectCharset("-"+x)),this._parser.registerEscHandler({intermediates:".",final:x},()=>this.selectCharset("."+x)),this._parser.registerEscHandler({intermediates:"/",final:x},()=>this.selectCharset("/"+x));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(x=>(this._logService.error("Parsing error: ",x),x)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new d.DcsHandler((x,W)=>this.requestStatusString(x,W)))}_preserveStack(C,k,R,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=k,this._parseStack.decodedLength=R,this._parseStack.position=A}_logSlowResolvingAsync(C){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([C,new Promise((k,R)=>setTimeout(()=>R("#SLOW_TIMEOUT"),5e3))]).catch(k=>{if(k!=="#SLOW_TIMEOUT")throw k;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,k){let R,A=this._activeBuffer.x,N=this._activeBuffer.y,z=0,q=this._parseStack.paused;if(q){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,k))return this._logSlowResolvingAsync(R),R;A=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>T&&(z=this._parseStack.position+T)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,x=>String.fromCharCode(x)).join("")}"`),typeof C=="string"?C.split("").map(x=>x.charCodeAt(0)):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(C.length,T))),q||this._dirtyRowTracker.clearRange(),C.length>T)for(let x=z;x<C.length;x+=T){let W=x+T<C.length?x+T:C.length,U=typeof C=="string"?this._stringDecoder.decode(C.substring(x,W),this._parseBuffer):this._utf8Decoder.decode(C.subarray(x,W),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,U))return this._preserveStack(A,N,U,x),this._logSlowResolvingAsync(R),R}else if(!q){let x=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,x))return this._preserveStack(A,N,x,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===A&&this._activeBuffer.y===N||this._onCursorMove.fire();let K=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M,this._bufferService.rows-1),Math.min(K,this._bufferService.rows-1))}print(C,k,R){let A,N,z=this._charsetService.charset,q=this._optionsService.rawOptions.screenReaderMode,K=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,x=this._coreService.modes.insertMode,W=this._curAttrData,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-k>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let $=this._parser.precedingJoinState;for(let j=k;j<R;++j){if(A=C[j],A<127&&z){let te=z[String.fromCharCode(A)];te&&(A=te.charCodeAt(0))}let G=this._unicodeService.charProperties(A,$);N=p.UnicodeService.extractWidth(G);let Z=p.UnicodeService.extractShouldJoin(G),Q=Z?p.UnicodeService.extractWidth($):0;if($=G,q&&this._onA11yChar.fire((0,u.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-Q>K){if(M){let te=U,V=this._activeBuffer.x-Q;for(this._activeBuffer.x=Q,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Q>0&&U instanceof t.BufferLine&&U.copyCellsFrom(te,V,0,Q,!1);V<K;)te.setCellFromCodepoint(V++,0,1,W)}else if(this._activeBuffer.x=K-1,N===2)continue}if(Z&&this._activeBuffer.x){let te=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-te,A,N);for(let V=N-Q;--V>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(x&&(U.insertCells(this._activeBuffer.x,N-Q,this._activeBuffer.getNullCell(W)),U.getWidth(K-1)===2&&U.setCellFromCodepoint(K-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,W)),U.setCellFromCodepoint(this._activeBuffer.x++,A,N,W),N>0)for(;--N;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=$,this._activeBuffer.x<K&&R-k>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,k){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,k):this._parser.registerCsiHandler(C,R=>!B(R.params[0],this._optionsService.rawOptions.windowOptions)||k(R))}registerDcsHandler(C,k){return this._parser.registerDcsHandler(C,new d.DcsHandler(k))}registerEscHandler(C,k){return this._parser.registerEscHandler(C,k)}registerOscHandler(C,k){return this._parser.registerOscHandler(C,new m.OscHandler(k))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,k){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+k):(this._activeBuffer.x=C,this._activeBuffer.y=k),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,k){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+k)}cursorUp(C){let k=this._activeBuffer.y-this._activeBuffer.scrollTop;return k>=0?this._moveCursor(0,-Math.min(k,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){let k=this._activeBuffer.scrollBottom-this._activeBuffer.y;return k>=0?this._moveCursor(0,Math.min(k,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){let k=C.params[0];return k===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:k===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=C.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=C.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){let k=C.params[0];return k===1&&(this._curAttrData.bg|=536870912),k!==2&&k!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,k,R,A=!1,N=!1){let z=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);z.replaceCells(k,R,this._activeBuffer.getNullCell(this._eraseAttrData()),N),A&&(z.isWrapped=!1)}_resetBufferLine(C,k=!1){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),k),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),R.isWrapped=!1)}eraseInDisplay(C,k=!1){let R;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,k);R<this._bufferService.rows;R++)this._resetBufferLine(R,k);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,k),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,k);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,k);this._dirtyRowTracker.markDirty(0);break;case 3:let A=this._activeBuffer.lines.length-this._bufferService.rows;A>0&&(this._activeBuffer.lines.trimStart(A),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-A,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-A,0),this._onScroll.fire(0))}return!0}eraseInLine(C,k=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,k);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,k);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,k)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let k=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let R=this._activeBuffer.ybase+this._activeBuffer.y,A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-A+1;for(;k--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let k=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let R=this._activeBuffer.ybase+this._activeBuffer.y,A;for(A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,A=this._bufferService.rows-1+this._activeBuffer.ybase-A;k--;)this._activeBuffer.lines.splice(R,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let k=C.params[0]||1;for(;k--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let k=C.params[0]||1;for(;k--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(t.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.deleteCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.insertCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.insertCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);A.deleteCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){let k=this._parser.precedingJoinState;if(!k)return!0;let R=C.params[0]||1,A=p.UnicodeService.extractWidth(k),N=this._activeBuffer.x-A,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),q=new Uint32Array(z.length*R),K=0;for(let x=0;x<z.length;){let W=z.codePointAt(x)||0;q[K++]=W,x+=W>65535?2:1}let M=K;for(let x=1;x<R;++x)q.copyWithin(M,0,K),M+=K;return this.print(q,0,M),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let k=0;k<C.length;k++)switch(C.params[k]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let k=0;k<C.length;k++)switch(C.params[k]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let k=0;k<C.length;k++)switch(C.params[k]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let k=0;k<C.length;k++)switch(C.params[k]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[k]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,k){let R=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:N}=this._coreMouseService,z=this._coreService,{buffers:q,cols:K}=this._bufferService,{active:M,alt:x}=q,W=this._optionsService.rawOptions,U=Z=>Z?1:2,$=C.params[0];return j=$,G=k?$===2?4:$===4?U(z.modes.insertMode):$===12?3:$===20?U(W.convertEol):0:$===1?U(R.applicationCursorKeys):$===3?W.windowOptions.setWinLines?K===80?2:K===132?1:0:0:$===6?U(R.origin):$===7?U(R.wraparound):$===8?3:$===9?U(A==="X10"):$===12?U(W.cursorBlink):$===25?U(!z.isCursorHidden):$===45?U(R.reverseWraparound):$===66?U(R.applicationKeypad):$===67?4:$===1e3?U(A==="VT200"):$===1002?U(A==="DRAG"):$===1003?U(A==="ANY"):$===1004?U(R.sendFocus):$===1005?4:$===1006?U(N==="SGR"):$===1015?4:$===1016?U(N==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?U(M===x):$===2004?U(R.bracketedPasteMode):0,z.triggerDataEvent(`${o.C0.ESC}[${k?"":"?"}${j};${G}$y`),!0;var j,G}_updateAttrColor(C,k,R,A,N){return k===2?(C|=50331648,C&=-16777216,C|=c.AttributeData.fromColorRGB([R,A,N])):k===5&&(C&=-50331904,C|=33554432|255&R),C}_extractColor(C,k,R){let A=[0,0,-1,0,0,0],N=0,z=0;do{if(A[z+N]=C.params[k+z],C.hasSubParams(k+z)){let q=C.getSubParams(k+z),K=0;do A[1]===5&&(N=1),A[z+K+1+N]=q[K];while(++K<q.length&&K+z+1+N<A.length);break}if(A[1]===5&&z+N>=2||A[1]===2&&z+N>=5)break;A[1]&&(N=1)}while(++z+k<C.length&&z+N<A.length);for(let q=2;q<A.length;++q)A[q]===-1&&(A[q]=0);switch(A[0]){case 38:R.fg=this._updateAttrColor(R.fg,A[1],A[3],A[4],A[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,A[1],A[3],A[4],A[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,A[1],A[3],A[4],A[5])}return z}_processUnderline(C,k){k.extended=k.extended.clone(),(!~C||C>5)&&(C=1),k.extended.underlineStyle=C,k.fg|=268435456,C===0&&(k.fg&=-268435457),k.updateExtended()}_processSGR0(C){C.fg=t.DEFAULT_ATTR_DATA.fg,C.bg=t.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;let k=C.length,R,A=this._curAttrData;for(let N=0;N<k;N++)R=C.params[N],R>=30&&R<=37?(A.fg&=-50331904,A.fg|=16777216|R-30):R>=40&&R<=47?(A.bg&=-50331904,A.bg|=16777216|R-40):R>=90&&R<=97?(A.fg&=-50331904,A.fg|=16777224|R-90):R>=100&&R<=107?(A.bg&=-50331904,A.bg|=16777224|R-100):R===0?this._processSGR0(A):R===1?A.fg|=134217728:R===3?A.bg|=67108864:R===4?(A.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,A)):R===5?A.fg|=536870912:R===7?A.fg|=67108864:R===8?A.fg|=1073741824:R===9?A.fg|=2147483648:R===2?A.bg|=134217728:R===21?this._processUnderline(2,A):R===22?(A.fg&=-134217729,A.bg&=-134217729):R===23?A.bg&=-67108865:R===24?(A.fg&=-268435457,this._processUnderline(0,A)):R===25?A.fg&=-536870913:R===27?A.fg&=-67108865:R===28?A.fg&=-1073741825:R===29?A.fg&=2147483647:R===39?(A.fg&=-67108864,A.fg|=16777215&t.DEFAULT_ATTR_DATA.fg):R===49?(A.bg&=-67108864,A.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?N+=this._extractColor(C,N,A):R===53?A.bg|=1073741824:R===55?A.bg&=-1073741825:R===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):R===100?(A.fg&=-67108864,A.fg|=16777215&t.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let k=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${k};${R}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){let k=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${k};${R}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){let k=C.params[0]||1;switch(k){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let R=k%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(C){let k=C.params[0]||1,R;return(C.length<2||(R=C.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>k&&(this._activeBuffer.scrollTop=k-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(C){if(!B(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;let k=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:k!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:k!==0&&k!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),k!==0&&k!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:k!==0&&k!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),k!==0&&k!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){let k=[],R=C.split(";");for(;R.length>1;){let A=R.shift(),N=R.shift();if(/^\d+$/.exec(A)){let z=parseInt(A);if(H(z))if(N==="?")k.push({type:0,index:z});else{let q=(0,b.parseColor)(N);q&&k.push({type:1,index:z,color:q})}}}return k.length&&this._onColor.fire(k),!0}setHyperlink(C){let k=C.split(";");return!(k.length<2)&&(k[1]?this._createHyperlink(k[0],k[1]):!k[0]&&this._finishHyperlink())}_createHyperlink(C,k){this._getCurrentLinkId()&&this._finishHyperlink();let R=C.split(":"),A,N=R.findIndex(z=>z.startsWith("id="));return N!==-1&&(A=R[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:k}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,k){let R=C.split(";");for(let A=0;A<R.length&&!(k>=this._specialColors.length);++A,++k)if(R[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[k]}]);else{let N=(0,b.parseColor)(R[A]);N&&this._onColor.fire([{type:1,index:this._specialColors[k],color:N}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;let k=[],R=C.split(";");for(let A=0;A<R.length;++A)if(/^\d+$/.exec(R[A])){let N=parseInt(R[A]);H(N)&&k.push({type:2,index:N})}return k.length&&this._onColor.fire(k),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(L[C[0]],_.CHARSETS[C[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){let C=new i.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let k=0;k<this._bufferService.rows;++k){let R=this._activeBuffer.ybase+this._activeBuffer.y+k,A=this._activeBuffer.lines.get(R);A&&(A.fill(C),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,k){let R=this._bufferService.buffer,A=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${N}${o.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,k){this._dirtyRowTracker.markRangeDirty(C,k)}}r.InputHandler=I;let O=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){P<this.start?this.start=P:P>this.end&&(this.end=P)}markRangeDirty(P,C){P>C&&(F=P,P=C,C=F),P<this.start&&(this.start=P),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(P){return 0<=P&&P<256}O=h([f(0,g.IBufferService)],O)},844:(E,r)=>{function n(h){for(let f of h)f.dispose();h.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){let f=this._disposables.indexOf(h);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){this._isDisposed||h===this._value||(this._value?.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(h){return{dispose:h}},r.disposeArray=n,r.getDisposeArrayDisposable=function(h){return{dispose:()=>n(h)}}},1505:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(f,o,_){this._data[f]||(this._data[f]={}),this._data[f][o]=_}get(f,o){return this._data[f]?this._data[f][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=n,r.FourKeyMap=class{constructor(){this._data=new n}set(h,f,o,_,v){this._data.get(h,f)||this._data.set(h,f,new n),this._data.get(h,f).set(o,_,v)}get(h,f,o,_){return this._data.get(h,f)?.get(o,_)}clear(){this._data.clear()}}},6114:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;let n=r.isNode?"node":navigator.userAgent,h=r.isNode?"node":navigator.platform;r.isFirefox=n.includes("Firefox"),r.isLegacyEdge=n.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(n),r.getSafariVersion=function(){if(!r.isSafari)return 0;let f=n.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),r.isIpad=h==="iPad",r.isIphone=h==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),r.isLinux=h.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(n)},6106:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let n=0;r.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(n=this._search(this._getKey(h)),this._array.splice(n,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;let f=this._getKey(h);if(f===void 0||(n=this._search(f),n===-1)||this._getKey(this._array[n])!==f)return!1;do if(this._array[n]===h)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===f);return!1}*getKeyIterator(h){if(this._array.length!==0&&(n=this._search(h),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===h))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===h)}forEachByKey(h,f){if(this._array.length!==0&&(n=this._search(h),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===h))do f(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===h)}values(){return[...this._array].values()}_search(h){let f=0,o=this._array.length-1;for(;o>=f;){let _=f+o>>1,v=this._getKey(this._array[_]);if(v>h)o=_-1;else{if(!(v<h)){for(;_>0&&this._getKey(this._array[_-1])===h;)_--;return _}f=_+1}}return f}}},7226:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let h=n(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let S=0,u=0,t=v.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),u=Math.max(S,u),s=v.timeRemaining(),1.5*u>s)return t-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(t-S))}ms`),void this._start();t=s}this.clear()}}class o extends f{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){let S=Date.now()+v;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let h=n(643);r.updateWindowsModeWrappedState=function(f){let o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=o?.get(f.cols-1),v=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);v&&_&&(v.isWrapped=_[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&_[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){let o=new n;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=n;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}get underlineVariantOffset(){let o=(3758096384&this._ext)>>29;return o<0?4294967288^o:o}set underlineVariantOffset(o){this._ext&=536870911,this._ext|=o<<29&3758096384}constructor(o=0,_=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let h=n(6349),f=n(7226),o=n(3734),_=n(8437),v=n(4634),S=n(511),u=n(643),t=n(4863),s=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,i,c){this._hasScrollback=e,this._optionsService=i,this._bufferService=c,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,i){return new _.BufferLine(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=_.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let c=this.getNullCell(_.DEFAULT_ATTR_DATA),g=0,p=this._getCorrectBufferLength(i);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)g+=+this.lines.get(d).resize(e,c);let m=0;if(this._rows<i)for(let d=this._rows;d<i;d++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(e,c)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(e,c)));else for(let d=this._rows;d>i;d--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(p<this.lines.maxLength){let d=this.lines.length-p;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=p}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let m=0;m<this.lines.length;m++)g+=+this.lines.get(m).resize(e,c);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),g>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let c=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(c.length>0){let g=(0,v.reflowLargerCreateNewLayout)(this.lines,c);(0,v.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(e,i,g.countRemoved)}}_reflowLargerAdjustViewport(e,i,c){let g=this.getNullCell(_.DEFAULT_ATTR_DATA),p=c;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new _.BufferLine(e,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-c,0)}_reflowSmaller(e,i){let c=this.getNullCell(_.DEFAULT_ATTR_DATA),g=[],p=0;for(let m=this.lines.length-1;m>=0;m--){let d=this.lines.get(m);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let b=[d];for(;d.isWrapped&&m>0;)d=this.lines.get(--m),b.unshift(d);let L=this.ybase+this.y;if(L>=m&&L<m+b.length)continue;let T=b[b.length-1].getTrimmedLength(),B=(0,v.reflowSmallerGetNewLineLengths)(b,this._cols,e),D=B.length-b.length,F;F=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);let I=[];for(let R=0;R<D;R++){let A=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);I.push(A)}I.length>0&&(g.push({start:m+b.length+p,newLines:I}),p+=I.length),b.push(...I);let O=B.length-1,H=B[O];H===0&&(O--,H=B[O]);let P=b.length-D-1,C=T;for(;P>=0;){let R=Math.min(C,H);if(b[O]===void 0)break;if(b[O].copyCellsFrom(b[P],C-R,H-R,R,!0),H-=R,H===0&&(O--,H=B[O]),C-=R,C===0){P--;let A=Math.max(P,0);C=(0,v.getWrappedLineTrimmedLength)(b,A,this._cols)}}for(let R=0;R<b.length;R++)B[R]<e&&b[R].setCell(B[R],c);let k=D-F;for(;k-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+i-1)}if(g.length>0){let m=[],d=[];for(let O=0;O<this.lines.length;O++)d.push(this.lines.get(O));let b=this.lines.length,L=b-1,T=0,B=g[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let D=0;for(let O=Math.min(this.lines.maxLength-1,b+p-1);O>=0;O--)if(B&&B.start>L+D){for(let H=B.newLines.length-1;H>=0;H--)this.lines.set(O--,B.newLines[H]);O++,m.push({index:L+1,amount:B.newLines.length}),D+=B.newLines.length,B=g[++T]}else this.lines.set(O,d[L--]);let F=0;for(let O=m.length-1;O>=0;O--)m[O].index+=F,this.lines.onInsertEmitter.fire(m[O]),F+=m[O].amount;let I=Math.max(0,b+p-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(e,i,c=0,g){let p=this.lines.get(e);return p?p.translateToString(i,c,g):""}getWrappedRangeForLine(e){let i=e,c=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;c+1<this.lines.length&&this.lines.get(c+1).isWrapped;)c++;return{first:i,last:c}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let i=new t.Marker(e);return this.markers.push(i),i.register(this.lines.onTrim(c=>{i.line-=c,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(c=>{i.line>=c.index&&(i.line+=c.amount)})),i.register(this.lines.onDelete(c=>{i.line>=c.index&&i.line<c.index+c.amount&&i.dispose(),i.line>c.index&&(i.line-=c.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let h=n(3734),f=n(511),o=n(643),_=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class S{constructor(t,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);let i=s||f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let c=0;c<t;++c)this.setCell(c,i);this.length=t}get(t){let s=this._data[3*t+0],e=2097151&s;return[this._data[3*t+1],2097152&s?this._combined[t]:e?(0,_.stringFromCodePoint)(e):"",s>>22,2097152&s?this._combined[t].charCodeAt(this._combined[t].length-1):e]}set(t,s){this._data[3*t+1]=s[o.CHAR_DATA_ATTR_INDEX],s[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[t]=s[1],this._data[3*t+0]=2097152|t|s[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*t+0]=s[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(t){return this._data[3*t+0]>>22}hasWidth(t){return 12582912&this._data[3*t+0]}getFg(t){return this._data[3*t+1]}getBg(t){return this._data[3*t+2]}hasContent(t){return 4194303&this._data[3*t+0]}getCodePoint(t){let s=this._data[3*t+0];return 2097152&s?this._combined[t].charCodeAt(this._combined[t].length-1):2097151&s}isCombined(t){return 2097152&this._data[3*t+0]}getString(t){let s=this._data[3*t+0];return 2097152&s?this._combined[t]:2097151&s?(0,_.stringFromCodePoint)(2097151&s):""}isProtected(t){return 536870912&this._data[3*t+2]}loadCell(t,s){return v=3*t,s.content=this._data[v+0],s.fg=this._data[v+1],s.bg=this._data[v+2],2097152&s.content&&(s.combinedData=this._combined[t]),268435456&s.bg&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){2097152&s.content&&(this._combined[t]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[t]=s.extended),this._data[3*t+0]=s.content,this._data[3*t+1]=s.fg,this._data[3*t+2]=s.bg}setCellFromCodepoint(t,s,e,i){268435456&i.bg&&(this._extendedAttrs[t]=i.extended),this._data[3*t+0]=s|e<<22,this._data[3*t+1]=i.fg,this._data[3*t+2]=i.bg}addCodepointToCell(t,s,e){let i=this._data[3*t+0];2097152&i?this._combined[t]+=(0,_.stringFromCodePoint)(s):2097151&i?(this._combined[t]=(0,_.stringFromCodePoint)(2097151&i)+(0,_.stringFromCodePoint)(s),i&=-2097152,i|=2097152):i=s|4194304,e&&(i&=-12582913,i|=e<<22),this._data[3*t+0]=i}insertCells(t,s,e){if((t%=this.length)&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length-t){let i=new f.CellData;for(let c=this.length-t-s-1;c>=0;--c)this.setCell(t+s+c,this.loadCell(t+c,i));for(let c=0;c<s;++c)this.setCell(t+c,e)}else for(let i=t;i<this.length;++i)this.setCell(i,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(t,s,e){if(t%=this.length,s<this.length-t){let i=new f.CellData;for(let c=0;c<this.length-t-s;++c)this.setCell(t+c,this.loadCell(t+s+c,i));for(let c=this.length-s;c<this.length;++c)this.setCell(c,e)}else for(let i=t;i<this.length;++i)this.setCell(i,e);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),this.getWidth(t)!==0||this.hasContent(t)||this.setCellFromCodepoint(t,0,1,e)}replaceCells(t,s,e,i=!1){if(i)for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,e);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,e),t++;else for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,e);t<s&&t<this.length;)this.setCell(t++,e)}resize(t,s){if(t===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*t;if(t>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let i=new Uint32Array(e);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,s)}else{this._data=this._data.subarray(0,e);let i=Object.keys(this._combined);for(let g=0;g<i.length;g++){let p=parseInt(i[g],10);p>=t&&delete this._combined[p]}let c=Object.keys(this._extendedAttrs);for(let g=0;g<c.length;g++){let p=parseInt(c[g],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,t);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,t)}}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new S(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0])return t+(this._data[3*t+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0]||50331648&this._data[3*t+2])return t+(this._data[3*t+0]>>22);return 0}copyCellsFrom(t,s,e,i,c){let g=t._data;if(c)for(let m=i-1;m>=0;m--){for(let d=0;d<3;d++)this._data[3*(e+m)+d]=g[3*(s+m)+d];268435456&g[3*(s+m)+2]&&(this._extendedAttrs[e+m]=t._extendedAttrs[s+m])}else for(let m=0;m<i;m++){for(let d=0;d<3;d++)this._data[3*(e+m)+d]=g[3*(s+m)+d];268435456&g[3*(s+m)+2]&&(this._extendedAttrs[e+m]=t._extendedAttrs[s+m])}let p=Object.keys(t._combined);for(let m=0;m<p.length;m++){let d=parseInt(p[m],10);d>=s&&(this._combined[d-s+e]=t._combined[d])}}translateToString(t,s,e,i){s=s??0,e=e??this.length,t&&(e=Math.min(e,this.getTrimmedLength())),i&&(i.length=0);let c="";for(;s<e;){let g=this._data[3*s+0],p=2097151&g,m=2097152&g?this._combined[s]:p?(0,_.stringFromCodePoint)(p):o.WHITESPACE_CELL_CHAR;if(c+=m,i)for(let d=0;d<m.length;++d)i.push(s);s+=g>>22||1}return i&&i.push(s),c}}r.BufferLine=S},4841:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(n,h){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return h*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(E,r)=>{function n(h,f,o){if(f===h.length-1)return h[f].getTrimmedLength();let _=!h[f].hasContent(o-1)&&h[f].getWidth(o-1)===1,v=h[f+1].getWidth(0)===2;return _&&v?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(h,f,o,_,v){let S=[];for(let u=0;u<h.length-1;u++){let t=u,s=h.get(++t);if(!s.isWrapped)continue;let e=[h.get(u)];for(;t<h.length&&s.isWrapped;)e.push(s),s=h.get(++t);if(_>=u&&_<t){u+=e.length-1;continue}let i=0,c=n(e,i,f),g=1,p=0;for(;g<e.length;){let d=n(e,g,f),b=d-p,L=o-c,T=Math.min(b,L);e[i].copyCellsFrom(e[g],p,c,T,!1),c+=T,c===o&&(i++,c=0),p+=T,p===d&&(g++,p=0),c===0&&i!==0&&e[i-1].getWidth(o-1)===2&&(e[i].copyCellsFrom(e[i-1],o-1,c++,1,!1),e[i-1].setCell(o-1,v))}e[i].replaceCells(c,o,v);let m=0;for(let d=e.length-1;d>0&&(d>i||e[d].getTrimmedLength()===0);d--)m++;m>0&&(S.push(u+e.length-m),S.push(m)),u+=e.length-1}return S},r.reflowLargerCreateNewLayout=function(h,f){let o=[],_=0,v=f[_],S=0;for(let u=0;u<h.length;u++)if(v===u){let t=f[++_];h.onDeleteEmitter.fire({index:u-S,amount:t}),u+=t-1,S+=t,v=f[++_]}else o.push(u);return{layout:o,countRemoved:S}},r.reflowLargerApplyNewLayout=function(h,f){let o=[];for(let _=0;_<f.length;_++)o.push(h.get(f[_]));for(let _=0;_<o.length;_++)h.set(_,o[_]);h.length=f.length},r.reflowSmallerGetNewLineLengths=function(h,f,o){let _=[],v=h.map((s,e)=>n(h,e,f)).reduce((s,e)=>s+e),S=0,u=0,t=0;for(;t<v;){if(v-t<o){_.push(v-t);break}S+=o;let s=n(h,u,f);S>s&&(S-=s,u++);let e=h[u].getWidth(S-1)===2;e&&S--;let i=e?o-1:o;_.push(i),t+=i}return _},r.getWrappedLineTrimmedLength=n},5295:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let h=n(8460),f=n(844),o=n(9092);class _ extends f.Disposable{constructor(S,u){super(),this._optionsService=S,this._bufferService=u,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(S,u){this._normal.resize(S,u),this._alt.resize(S,u),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}r.BufferSet=_},511:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let h=n(482),f=n(643),o=n(3734);class _ extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(S){let u=new _;return u.setFromCharData(S),u}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){let t=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=t&&t<=56319){let s=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(t-55296)+s-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},643:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let h=n(8460),f=n(844);class o{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}r.Marker=o,o._nextId=1},7116:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(E,r)=>{var n,h,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
8
|
-
`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="\x7F"}(n||(r.C0=n={})),function(o){o.PAD="\x80",o.HOP="\x81",o.BPH="\x82",o.NBH="\x83",o.IND="\x84",o.NEL="\x85",o.SSA="\x86",o.ESA="\x87",o.HTS="\x88",o.HTJ="\x89",o.VTS="\x8A",o.PLD="\x8B",o.PLU="\x8C",o.RI="\x8D",o.SS2="\x8E",o.SS3="\x8F",o.DCS="\x90",o.PU1="\x91",o.PU2="\x92",o.STS="\x93",o.CCH="\x94",o.MW="\x95",o.SPA="\x96",o.EPA="\x97",o.SOS="\x98",o.SGCI="\x99",o.SCI="\x9A",o.CSI="\x9B",o.ST="\x9C",o.OSC="\x9D",o.PM="\x9E",o.APC="\x9F"}(h||(r.C1=h={})),function(o){o.ST=`${n.ESC}\\`}(f||(r.C1_ESCAPED=f={}))},7399:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let h=n(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(o,_,v,S){let u={type:0,cancel:!1,key:void 0},t=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?u.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?u.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?u.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(u.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:u.key=o.ctrlKey?"\b":h.C0.DEL,o.altKey&&(u.key=h.C0.ESC+u.key);break;case 9:if(o.shiftKey){u.key=h.C0.ESC+"[Z";break}u.key=h.C0.HT,u.cancel=!0;break;case 13:u.key=o.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,u.cancel=!0;break;case 27:u.key=h.C0.ESC,o.altKey&&(u.key=h.C0.ESC+h.C0.ESC),u.cancel=!0;break;case 37:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"D",u.key===h.C0.ESC+"[1;3D"&&(u.key=h.C0.ESC+(v?"b":"[1;5D"))):u.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"C",u.key===h.C0.ESC+"[1;3C"&&(u.key=h.C0.ESC+(v?"f":"[1;5C"))):u.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"A",v||u.key!==h.C0.ESC+"[1;3A"||(u.key=h.C0.ESC+"[1;5A")):u.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(o.metaKey)break;t?(u.key=h.C0.ESC+"[1;"+(t+1)+"B",v||u.key!==h.C0.ESC+"[1;3B"||(u.key=h.C0.ESC+"[1;5B")):u.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(u.key=h.C0.ESC+"[2~");break;case 46:u.key=t?h.C0.ESC+"[3;"+(t+1)+"~":h.C0.ESC+"[3~";break;case 36:u.key=t?h.C0.ESC+"[1;"+(t+1)+"H":_?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:u.key=t?h.C0.ESC+"[1;"+(t+1)+"F":_?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:o.shiftKey?u.type=2:o.ctrlKey?u.key=h.C0.ESC+"[5;"+(t+1)+"~":u.key=h.C0.ESC+"[5~";break;case 34:o.shiftKey?u.type=3:o.ctrlKey?u.key=h.C0.ESC+"[6;"+(t+1)+"~":u.key=h.C0.ESC+"[6~";break;case 112:u.key=t?h.C0.ESC+"[1;"+(t+1)+"P":h.C0.ESC+"OP";break;case 113:u.key=t?h.C0.ESC+"[1;"+(t+1)+"Q":h.C0.ESC+"OQ";break;case 114:u.key=t?h.C0.ESC+"[1;"+(t+1)+"R":h.C0.ESC+"OR";break;case 115:u.key=t?h.C0.ESC+"[1;"+(t+1)+"S":h.C0.ESC+"OS";break;case 116:u.key=t?h.C0.ESC+"[15;"+(t+1)+"~":h.C0.ESC+"[15~";break;case 117:u.key=t?h.C0.ESC+"[17;"+(t+1)+"~":h.C0.ESC+"[17~";break;case 118:u.key=t?h.C0.ESC+"[18;"+(t+1)+"~":h.C0.ESC+"[18~";break;case 119:u.key=t?h.C0.ESC+"[19;"+(t+1)+"~":h.C0.ESC+"[19~";break;case 120:u.key=t?h.C0.ESC+"[20;"+(t+1)+"~":h.C0.ESC+"[20~";break;case 121:u.key=t?h.C0.ESC+"[21;"+(t+1)+"~":h.C0.ESC+"[21~";break;case 122:u.key=t?h.C0.ESC+"[23;"+(t+1)+"~":h.C0.ESC+"[23~";break;case 123:u.key=t?h.C0.ESC+"[24;"+(t+1)+"~":h.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(v&&!S||!o.altKey||o.metaKey)!v||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?u.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(u.key=h.C0.US),o.key==="@"&&(u.key=h.C0.NUL)):o.keyCode===65&&(u.type=1);else{let s=f[o.keyCode],e=s?.[o.shiftKey?1:0];if(e)u.key=h.C0.ESC+e;else if(o.keyCode>=65&&o.keyCode<=90){let i=o.ctrlKey?o.keyCode-64:o.keyCode+32,c=String.fromCharCode(i);o.shiftKey&&(c=c.toUpperCase()),u.key=h.C0.ESC+c}else if(o.keyCode===32)u.key=h.C0.ESC+(o.ctrlKey?h.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let i=o.code.slice(3,4);o.shiftKey||(i=i.toLowerCase()),u.key=h.C0.ESC+i,u.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?u.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?u.key=h.C0.NUL:o.keyCode>=51&&o.keyCode<=55?u.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?u.key=h.C0.DEL:o.keyCode===219?u.key=h.C0.ESC:o.keyCode===220?u.key=h.C0.FS:o.keyCode===221&&(u.key=h.C0.GS)}return u}},482:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},r.utf32ToString=function(n,h=0,f=n.length){let o="";for(let _=h;_<f;++_){let v=n[_];v>65535?(v-=65536,o+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):o+=String.fromCharCode(v)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,h){let f=n.length;if(!f)return 0;let o=0,_=0;if(this._interim){let v=n.charCodeAt(_++);56320<=v&&v<=57343?h[o++]=1024*(this._interim-55296)+v-56320+65536:(h[o++]=this._interim,h[o++]=v),this._interim=0}for(let v=_;v<f;++v){let S=n.charCodeAt(v);if(55296<=S&&S<=56319){if(++v>=f)return this._interim=S,o;let u=n.charCodeAt(v);56320<=u&&u<=57343?h[o++]=1024*(S-55296)+u-56320+65536:(h[o++]=S,h[o++]=u)}else S!==65279&&(h[o++]=S)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,h){let f=n.length;if(!f)return 0;let o,_,v,S,u=0,t=0,s=0;if(this.interim[0]){let c=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let p,m=0;for(;(p=63&this.interim[++m])&&m<4;)g<<=6,g|=p;let d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,b=d-m;for(;s<b;){if(s>=f)return 0;if(p=n[s++],(192&p)!=128){s--,c=!0;break}this.interim[m++]=p,g<<=6,g|=63&p}c||(d===2?g<128?s--:h[u++]=g:d===3?g<2048||g>=55296&&g<=57343||g===65279||(h[u++]=g):g<65536||g>1114111||(h[u++]=g)),this.interim.fill(0)}let e=f-4,i=s;for(;i<f;){for(;!(!(i<e)||128&(o=n[i])||128&(_=n[i+1])||128&(v=n[i+2])||128&(S=n[i+3]));)h[u++]=o,h[u++]=_,h[u++]=v,h[u++]=S,i+=4;if(o=n[i++],o<128)h[u++]=o;else if((224&o)==192){if(i>=f)return this.interim[0]=o,u;if(_=n[i++],(192&_)!=128){i--;continue}if(t=(31&o)<<6|63&_,t<128){i--;continue}h[u++]=t}else if((240&o)==224){if(i>=f)return this.interim[0]=o,u;if(_=n[i++],(192&_)!=128){i--;continue}if(i>=f)return this.interim[0]=o,this.interim[1]=_,u;if(v=n[i++],(192&v)!=128){i--;continue}if(t=(15&o)<<12|(63&_)<<6|63&v,t<2048||t>=55296&&t<=57343||t===65279)continue;h[u++]=t}else if((248&o)==240){if(i>=f)return this.interim[0]=o,u;if(_=n[i++],(192&_)!=128){i--;continue}if(i>=f)return this.interim[0]=o,this.interim[1]=_,u;if(v=n[i++],(192&v)!=128){i--;continue}if(i>=f)return this.interim[0]=o,this.interim[1]=_,this.interim[2]=v,u;if(S=n[i++],(192&S)!=128){i--;continue}if(t=(7&o)<<18|(63&_)<<12|(63&v)<<6|63&S,t<65536||t>1114111)continue;h[u++]=t}}return u}}},225:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let h=n(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],o=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],_;r.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;v<f.length;++v)_.fill(0,f[v][0],f[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?_[v]:function(S,u){let t,s=0,e=u.length-1;if(S<u[0][0]||S>u[e][1])return!1;for(;e>=s;)if(t=s+e>>1,S>u[t][1])s=t+1;else{if(!(S<u[t][0]))return!0;e=t-1}return!1}(v,o)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,S){let u=this.wcwidth(v),t=u===0&&S!==0;if(t){let s=h.UnicodeService.extractWidth(S);s===0?t=!1:s>u&&(u=s)}return h.UnicodeService.createPropertyValue(0,u,t)}}},5981:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let h=n(8460),f=n(844);class o extends f.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);let t=this._callbacks.shift();t&&t()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,S){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(S),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(S)}_innerWrite(v=0,S=!0){let u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let t=this._writeBuffer[this._bufferOffset],s=this._action(t,S);if(s){let i=c=>Date.now()-u>=12?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(u,c);return void s.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(i)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=t.length,Date.now()-u>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=o},5941:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function f(o,_){let v=o.toString(16),S=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}r.parseColor=function(o){if(!o)return;let _=o.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let v=n.exec(_);if(v){let S=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/S*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/S*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/S*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),h.exec(_)&&[3,6,9,12].includes(_.length))){let v=_.length/3,S=[0,0,0];for(let u=0;u<3;++u){let t=parseInt(_.slice(v*u,v*u+v),16);S[u]=v===1?t<<4:v===2?t:v===3?t>>4:t>>8}return S}},r.toRgbString=function(o,_=16){let[v,S,u]=o;return`rgb:${f(v,_)}/${f(S,_)}/${f(u,_)}`}},5770:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let h=n(482),f=n(8742),o=n(5770),_=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(S,u){this._handlers[S]===void 0&&(this._handlers[S]=[]);let t=this._handlers[S];return t.push(u),{dispose:()=>{let s=t.indexOf(u);s!==-1&&t.splice(s,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(S,u){if(this.reset(),this._ident=S,this._active=this._handlers[S]||_,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(S,u,t){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(S,u,t);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(S,u,t))}unhook(S,u=!0){if(this._active.length){let t=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,t=u,e=this._stack.fallThrough,this._stack.paused=!1),!e&&t===!1){for(;s>=0&&(t=this._active[s].unhook(S),t!==!0);s--)if(t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,t;s--}for(;s>=0;s--)if(t=this._active[s].unhook(!1),t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,t}else this._handlerFb(this._ident,"UNHOOK",S);this._active=_,this._ident=0}};let v=new f.Params;v.addParam(0),r.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=v,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():v,this._data="",this._hitLimit=!1}put(S,u,t){this._hitLimit||(this._data+=(0,h.utf32ToString)(S,u,t),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let u=!1;if(this._hitLimit)u=!1;else if(S&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then(t=>(this._params=v,this._data="",this._hitLimit=!1,t));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let h=n(844),f=n(8742),o=n(6242),_=n(6351);class v{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,i,c){this.table[e<<8|s]=i<<4|c}addMany(s,e,i,c){for(let g=0;g<s.length;g++)this.table[e<<8|s[g]]=i<<4|c}}r.TransitionTable=v;let S=160;r.VT500_TRANSITION_TABLE=function(){let t=new v(4095),s=Array.apply(null,Array(256)).map((m,d)=>d),e=(m,d)=>s.slice(m,d),i=e(32,127),c=e(0,24);c.push(25),c.push.apply(c,e(28,32));let g=e(0,14),p;for(p in t.setDefault(1,0),t.addMany(i,0,2,0),g)t.addMany([24,26,153,154],p,3,0),t.addMany(e(128,144),p,3,0),t.addMany(e(144,152),p,3,0),t.add(156,p,0,0),t.add(27,p,11,1),t.add(157,p,4,8),t.addMany([152,158,159],p,0,7),t.add(155,p,11,3),t.add(144,p,11,9);return t.addMany(c,0,3,0),t.addMany(c,1,3,1),t.add(127,1,0,1),t.addMany(c,8,0,8),t.addMany(c,3,3,3),t.add(127,3,0,3),t.addMany(c,4,3,4),t.add(127,4,0,4),t.addMany(c,6,3,6),t.addMany(c,5,3,5),t.add(127,5,0,5),t.addMany(c,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(i,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(e(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(i,7,0,7),t.addMany(c,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(e(64,127),3,7,0),t.addMany(e(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(e(48,60),4,8,4),t.addMany(e(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(e(32,64),6,0,6),t.add(127,6,0,6),t.addMany(e(64,127),6,0,0),t.addMany(e(32,48),3,9,5),t.addMany(e(32,48),5,9,5),t.addMany(e(48,64),5,0,6),t.addMany(e(64,127),5,7,0),t.addMany(e(32,48),4,9,5),t.addMany(e(32,48),1,9,2),t.addMany(e(32,48),2,9,2),t.addMany(e(48,127),2,10,0),t.addMany(e(48,80),1,10,0),t.addMany(e(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(e(96,127),1,10,0),t.add(80,1,11,9),t.addMany(c,9,0,9),t.add(127,9,0,9),t.addMany(e(28,32),9,0,9),t.addMany(e(32,48),9,9,12),t.addMany(e(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(c,11,0,11),t.addMany(e(32,128),11,0,11),t.addMany(e(28,32),11,0,11),t.addMany(c,10,0,10),t.add(127,10,0,10),t.addMany(e(28,32),10,0,10),t.addMany(e(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(e(32,48),10,9,12),t.addMany(c,12,0,12),t.add(127,12,0,12),t.addMany(e(28,32),12,0,12),t.addMany(e(32,48),12,9,12),t.addMany(e(48,64),12,0,11),t.addMany(e(64,127),12,12,13),t.addMany(e(64,127),10,12,13),t.addMany(e(64,127),9,12,13),t.addMany(c,13,13,13),t.addMany(i,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(S,0,2,0),t.add(S,8,5,8),t.add(S,6,0,6),t.add(S,11,0,11),t.add(S,13,13,13),t}();class u extends h.Disposable{constructor(s=r.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,c)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(s,e=[64,126]){let i=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=s.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<s.intermediates.length;++g){let p=s.intermediates.charCodeAt(g);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=p}}if(s.final.length!==1)throw new Error("final must be a single byte");let c=s.final.charCodeAt(0);if(e[0]>c||c>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return i<<=8,i|=c,i}identToString(s){let e=[];for(;s;)e.push(String.fromCharCode(255&s)),s>>=8;return e.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,e){let i=this._identifier(s,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let c=this._escHandlers[i];return c.push(e),{dispose:()=>{let g=c.indexOf(e);g!==-1&&c.splice(g,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,e){this._executeHandlers[s.charCodeAt(0)]=e}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,e){let i=this._identifier(s);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let c=this._csiHandlers[i];return c.push(e),{dispose:()=>{let g=c.indexOf(e);g!==-1&&c.splice(g,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,e){return this._dcsParser.registerHandler(this._identifier(s),e)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,e){return this._oscParser.registerHandler(s,e)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(s,e,i,c,g){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=i,this._parseStack.transition=c,this._parseStack.chunkPos=g}parse(s,e,i){let c,g=0,p=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,b=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&b>-1){for(;b>=0&&(c=d[b](this._params),c!==!0);b--)if(c instanceof Promise)return this._parseStack.handlerPos=b,c}this._parseStack.handlers=[];break;case 4:if(i===!1&&b>-1){for(;b>=0&&(c=d[b](),c!==!0);b--)if(c instanceof Promise)return this._parseStack.handlerPos=b,c}this._parseStack.handlers=[];break;case 6:if(g=s[this._parseStack.chunkPos],c=this._dcsParser.unhook(g!==24&&g!==26,i),c)return c;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=s[this._parseStack.chunkPos],c=this._oscParser.end(g!==24&&g!==26,i),c)return c;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,m=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let d=m;d<e;++d){switch(g=s[d],p=this._transitions.table[this.currentState<<8|(g<160?g:S)],p>>4){case 2:for(let D=d+1;;++D){if(D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-1;break}if(++D>=e||(g=s[D])<32||g>126&&g<S){this._printHandler(s,d,D),d=D-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let b=this._csiHandlers[this._collect<<8|g],L=b?b.length-1:-1;for(;L>=0&&(c=b[L](this._params),c!==!0);L--)if(c instanceof Promise)return this._preserveStack(3,b,L,p,d),c;L<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++d<e&&(g=s[d])>47&&g<60);d--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:let T=this._escHandlers[this._collect<<8|g],B=T?T.length-1:-1;for(;B>=0&&(c=T[B](),c!==!0);B--)if(c instanceof Promise)return this._preserveStack(4,T,B,p,d),c;B<0&&this._escHandlerFb(this._collect<<8|g),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|g,this._params);break;case 13:for(let D=d+1;;++D)if(D>=e||(g=s[D])===24||g===26||g===27||g>127&&g<S){this._dcsParser.put(s,d,D),d=D-1;break}break;case 14:if(c=this._dcsParser.unhook(g!==24&&g!==26),c)return this._preserveStack(6,[],0,p,d),c;g===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let D=d+1;;D++)if(D>=e||(g=s[D])<32||g>127&&g<S){this._oscParser.put(s,d,D),d=D-1;break}break;case 6:if(c=this._oscParser.end(g!==24&&g!==26),c)return this._preserveStack(5,[],0,p,d),c;g===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&p}}}r.EscapeSequenceParser=u},6242:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let h=n(5770),f=n(482),o=[];r.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);let S=this._handlers[_];return S.push(v),{dispose:()=>{let u=S.indexOf(v);u!==-1&&S.splice(u,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,S){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(_,v,S);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,v,S))}start(){this.reset(),this._state=1}put(_,v,S){if(this._state!==3){if(this._state===1)for(;v<S;){let u=_[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&S-v>0&&this._put(_,v,S)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,u=this._active.length-1,t=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,S=v,t=this._stack.fallThrough,this._stack.paused=!1),!t&&S===!1){for(;u>=0&&(S=this._active[u].end(_),S!==!0);u--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,S;u--}for(;u>=0;u--)if(S=this._active[u].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",_);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,S){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,v,S),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then(S=>(this._data="",this._hitLimit=!1,S));return this._data="",this._hitLimit=!1,v}}},8742:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let n=2147483647;class h{static fromArray(o){let _=new h;if(!o.length)return _;for(let v=Array.isArray(o[0])?1:0;v<o.length;++v){let S=o[v];if(Array.isArray(S))for(let u=0;u<S.length;++u)_.addSubParam(S[u]);else _.addParam(S)}return _}constructor(o=32,_=32){if(this.maxLength=o,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new h(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){let o=[];for(let _=0;_<this.length;++_){o.push(this.params[_]);let v=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-v>0&&o.push(Array.prototype.slice.call(this._subParams,v,S))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>n?n:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>n?n:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){let _=this._subParamsIdx[o]>>8,v=255&this._subParamsIdx[o];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){let o={};for(let _=0;_<this.length;++_){let v=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-v>0&&(o[_]=this._subParams.slice(v,S))}return o}addDigit(o){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let v=this._digitIsSub?this._subParams:this.params,S=v[_-1];v[_-1]=~S?Math.min(10*S+o,n):o}}r.Params=h},5741:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,h){let f={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(f),h.dispose=()=>this._wrappedAddonDispose(f),h.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let h=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===n){h=f;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(h,1)}}},8771:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let h=n(3785),f=n(511);r.BufferApiView=class{constructor(o,_){this._buffer=o,this.type=_}init(o){return this._buffer=o,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(o){let _=this._buffer.lines.get(o);if(_)return new h.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let h=n(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,o){if(!(f<0||f>=this._line.length))return o?(this._line.loadCell(f,o),o):this._line.loadCell(f,new h.CellData)}translateToString(f,o,_){return this._line.translateToString(f,o,_)}}},8285:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let h=n(8771),f=n(8460),o=n(844);class _ extends o.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=_},7975:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,h){return this._core.registerCsiHandler(n,f=>h(f.toArray()))}addCsiHandler(n,h){return this.registerCsiHandler(n,h)}registerDcsHandler(n,h){return this._core.registerDcsHandler(n,(f,o)=>h(f,o.toArray()))}addDcsHandler(n,h){return this.registerDcsHandler(n,h)}registerEscHandler(n,h){return this._core.registerEscHandler(n,h)}addEscHandler(n,h){return this.registerEscHandler(n,h)}registerOscHandler(n,h){return this._core.registerOscHandler(n,h)}addOscHandler(n,h){return this.registerOscHandler(n,h)}}},7090:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(E,r,n){var h=this&&this.__decorate||function(t,s,e,i){var c,g=arguments.length,p=g<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,e,i);else for(var m=t.length-1;m>=0;m--)(c=t[m])&&(p=(g<3?c(p):g>3?c(s,e,p):c(s,e))||p);return g>3&&p&&Object.defineProperty(s,e,p),p},f=this&&this.__param||function(t,s){return function(e,i){s(e,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let o=n(8460),_=n(844),v=n(5295),S=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let u=r.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(t){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(t.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(t,this))}resize(t,s){this.cols=t,this.rows=s,this.buffers.resize(t,s),this._onResize.fire({cols:t,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,s=!1){let e=this.buffer,i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===t.fg&&i.getBg(0)===t.bg||(i=e.getBlankLine(t,s),this._cachedBlankLine=i),i.isWrapped=s;let c=e.ybase+e.scrollTop,g=e.ybase+e.scrollBottom;if(e.scrollTop===0){let p=e.lines.isFull;g===e.lines.length-1?p?e.lines.recycle().copyFrom(i):e.lines.push(i.clone()):e.lines.splice(g+1,0,i.clone()),p?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let p=g-c+1;e.lines.shiftElements(c+1,p-1,-1),e.lines.set(g,i.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(t,s,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let c=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),c!==i.ydisp&&(s||this._onScroll.fire(i.ydisp))}};r.BufferService=u=h([f(0,S.IOptionsService)],u)},7994:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,h){this._charsets[n]=h,this.glevel===n&&(this.charset=h)}}},1753:function(E,r,n){var h=this&&this.__decorate||function(i,c,g,p){var m,d=arguments.length,b=d<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,c,g,p);else for(var L=i.length-1;L>=0;L--)(m=i[L])&&(b=(d<3?m(b):d>3?m(c,g,b):m(c,g))||b);return d>3&&b&&Object.defineProperty(c,g,b),b},f=this&&this.__param||function(i,c){return function(g,p){c(g,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let o=n(2585),_=n(8460),v=n(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button!==4&&i.action===1&&(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>i.action!==32||i.button!==3},ANY:{events:31,restrict:i=>!0}};function u(i,c){let g=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(g|=64,g|=i.action):(g|=3&i.button,4&i.button&&(g|=64),8&i.button&&(g|=128),i.action===32?g|=32:i.action!==0||c||(g|=3)),g}let t=String.fromCharCode,s={DEFAULT:i=>{let c=[u(i,!1)+32,i.col+32,i.row+32];return c[0]>255||c[1]>255||c[2]>255?"":`\x1B[M${t(c[0])}${t(c[1])}${t(c[2])}`},SGR:i=>{let c=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${u(i,!0)};${i.col};${i.row}${c}`},SGR_PIXELS:i=>{let c=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${u(i,!0)};${i.x};${i.y}${c}`}},e=r.CoreMouseService=class extends v.Disposable{constructor(i,c){super(),this._bufferService=i,this._coreService=c,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let g of Object.keys(S))this.addProtocol(g,S[g]);for(let g of Object.keys(s))this.addEncoding(g,s[g]);this.reset()}addProtocol(i,c){this._protocols[i]=c}addEncoding(i,c){this._encodings[i]=c}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;let c=this._encodings[this._activeEncoding](i);return c&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(c):this._coreService.triggerDataEvent(c,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(1&i),up:!!(2&i),drag:!!(4&i),move:!!(8&i),wheel:!!(16&i)}}_equalEvents(i,c,g){if(g){if(i.x!==c.x||i.y!==c.y)return!1}else if(i.col!==c.col||i.row!==c.row)return!1;return i.button===c.button&&i.action===c.action&&i.ctrl===c.ctrl&&i.alt===c.alt&&i.shift===c.shift}};r.CoreMouseService=e=h([f(0,o.IBufferService),f(1,o.ICoreService)],e)},6975:function(E,r,n){var h=this&&this.__decorate||function(e,i,c,g){var p,m=arguments.length,d=m<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(e,i,c,g);else for(var b=e.length-1;b>=0;b--)(p=e[b])&&(d=(m<3?p(d):m>3?p(i,c,d):p(i,c))||d);return m>3&&d&&Object.defineProperty(i,c,d),d},f=this&&this.__param||function(e,i){return function(c,g){i(c,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let o=n(1439),_=n(8460),v=n(844),S=n(2585),u=Object.freeze({insertMode:!1}),t=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=r.CoreService=class extends v.Disposable{constructor(e,i,c){super(),this._bufferService=e,this._logService=i,this._optionsService=c,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(u),this.decPrivateModes=(0,o.clone)(t)}reset(){this.modes=(0,o.clone)(u),this.decPrivateModes=(0,o.clone)(t)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let c=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&c.ybase!==c.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(g=>g.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};r.CoreService=s=h([f(0,S.IBufferService),f(1,S.ILogService),f(2,S.IOptionsService)],s)},9074:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let h=n(8055),f=n(8460),o=n(844),_=n(6106),v=0,S=0;class u extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;let i=new t(e);if(i){let c=i.marker.onDispose(()=>i.dispose());i.onDispose(()=>{i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),c.dispose())}),this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,c){let g=0,p=0;for(let m of this._decorations.getKeyIterator(i))g=m.options.x??0,p=g+(m.options.width??1),e>=g&&e<p&&(!c||(m.options.layer??"bottom")===c)&&(yield m)}forEachDecorationAtCell(e,i,c,g){this._decorations.forEachByKey(i,p=>{v=p.options.x??0,S=v+(p.options.width??1),e>=v&&e<S&&(!c||(p.options.layer??"bottom")===c)&&g(p)})}}r.DecorationService=u;class t extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let h=n(2585),f=n(8343);class o{constructor(...v){this._entries=new Map;for(let[S,u]of v)this.set(S,u)}set(v,S){let u=this._entries.get(v);return this._entries.set(v,S),u}forEach(v){for(let[S,u]of this._entries.entries())v(S,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(h.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){let S=(0,f.getServiceDependencies)(_).sort((s,e)=>s.index-e.index),u=[];for(let s of S){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${s.id}.`);u.push(e)}let t=S.length>0?S[0].index:v.length;if(v.length!==t)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${t+1} conflicts with ${v.length} static arguments`);return new _(...v,...u)}}},7866:function(E,r,n){var h=this&&this.__decorate||function(t,s,e,i){var c,g=arguments.length,p=g<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,e,i);else for(var m=t.length-1;m>=0;m--)(c=t[m])&&(p=(g<3?c(p):g>3?c(s,e,p):c(s,e))||p);return g>3&&p&&Object.defineProperty(s,e,p),p},f=this&&this.__param||function(t,s){return function(e,i){s(e,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let o=n(844),_=n(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},S,u=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(t){super(),this._optionsService=t,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),S=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let s=0;s<t.length;s++)typeof t[s]=="function"&&(t[s]=t[s]())}_log(t,s,e){this._evalLazyOptionalParams(e),t.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(t,...s){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,s)}debug(t,...s){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,s)}info(t,...s){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,s)}warn(t,...s){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,s)}error(t,...s){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,s)}};r.LogService=u=h([f(0,_.IOptionsService)],u),r.setTraceLogger=function(t){S=t},r.traceCall=function(t,s,e){if(typeof e.value!="function")throw new Error("not supported");let i=e.value;e.value=function(...c){if(S.logLevel!==_.LogLevelEnum.TRACE)return i.apply(this,c);S.trace(`GlyphRenderer#${i.name}(${c.map(p=>JSON.stringify(p)).join(", ")})`);let g=i.apply(this,c);return S.trace(`GlyphRenderer#${i.name} return`,g),g}}},7302:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let h=n(8460),f=n(844),o=n(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends f.Disposable{constructor(u){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let t={...r.DEFAULT_OPTIONS};for(let s in u)if(s in t)try{let e=u[s];t[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this.register((0,f.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(u,t){return this.onOptionChange(s=>{s===u&&t(this.rawOptions[u])})}onMultipleOptionChange(u,t){return this.onOptionChange(s=>{u.indexOf(s)!==-1&&t()})}_setupOptions(){let u=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,e)=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);e=this._sanitizeAndValidateOption(s,e),this.rawOptions[s]!==e&&(this.rawOptions[s]=e,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let e={get:u.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(u,t){switch(u){case"cursorStyle":if(t||(t=r.DEFAULT_OPTIONS[u]),!function(s){return s==="block"||s==="underline"||s==="bar"}(t))throw new Error(`"${t}" is not a valid value for ${u}`);break;case"wordSeparator":t||(t=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=_.includes(t)?t:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${u} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${u} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}return t}}r.OptionsService=v},2660:function(E,r,n){var h=this&&this.__decorate||function(v,S,u,t){var s,e=arguments.length,i=e<3?S:t===null?t=Object.getOwnPropertyDescriptor(S,u):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(v,S,u,t);else for(var c=v.length-1;c>=0;c--)(s=v[c])&&(i=(e<3?s(i):e>3?s(S,u,i):s(S,u))||i);return e>3&&i&&Object.defineProperty(S,u,i),i},f=this&&this.__param||function(v,S){return function(u,t){S(u,t,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let o=n(2585),_=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){let S=this._bufferService.buffer;if(v.id===void 0){let c=S.addMarker(S.ybase+S.y),g={data:v,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(g,c)),this._dataByLinkId.set(g.id,g),g.id}let u=v,t=this._getEntryIdKey(u),s=this._entriesWithId.get(t);if(s)return this.addLineToLink(s.id,S.ybase+S.y),s.id;let e=S.addMarker(S.ybase+S.y),i={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[e]};return e.onDispose(()=>this._removeMarkerFromLink(i,e)),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(v,S){let u=this._dataByLinkId.get(v);if(u&&u.lines.every(t=>t.line!==S)){let t=this._bufferService.buffer.addMarker(S);u.lines.push(t),t.onDispose(()=>this._removeMarkerFromLink(u,t))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,S){let u=v.lines.indexOf(S);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=_=h([f(0,o.IBufferService)],_)},8343:(E,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let n="di$target",h="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[h]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);let o=function(_,v,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,t,s){t[n]===t?t[h].push({id:u,index:s}):(t[h]=[{id:u,index:s}],t[n]=t)})(o,_,S)};return o.toString=()=>f,r.serviceRegistry.set(f,o),o}},2585:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;let h=n(8343);var f;r.IBufferService=(0,h.createDecorator)("BufferService"),r.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),r.ICoreService=(0,h.createDecorator)("CoreService"),r.ICharsetService=(0,h.createDecorator)("CharsetService"),r.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"}(f||(r.LogLevelEnum=f={})),r.ILogService=(0,h.createDecorator)("LogService"),r.IOptionsService=(0,h.createDecorator)("OptionsService"),r.IOscLinkService=(0,h.createDecorator)("OscLinkService"),r.IUnicodeService=(0,h.createDecorator)("UnicodeService"),r.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(E,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let h=n(8460),f=n(225);class o{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,S,u=!1){return(16777215&v)<<3|(3&S)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let v=new f.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let S=0,u=0,t=v.length;for(let s=0;s<t;++s){let e=v.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=t)return S+this.wcwidth(e);let g=v.charCodeAt(s);56320<=g&&g<=57343?e=1024*(e-55296)+g-56320+65536:S+=this.wcwidth(g)}let i=this.charProperties(e,u),c=o.extractWidth(i);o.extractShouldJoin(i)&&(c-=o.extractWidth(u)),S+=c,u=i}return S}charProperties(v,S){return this._activeProvider.charProperties(v,S)}}r.UnicodeService=o}},l={};function w(E){var r=l[E];if(r!==void 0)return r.exports;var n=l[E]={exports:{}};return a[E].call(n.exports,n,n.exports,w),n.exports}var y={};return(()=>{var E=y;Object.defineProperty(E,"__esModule",{value:!0}),E.Terminal=void 0;let r=w(9042),n=w(3236),h=w(844),f=w(5741),o=w(8285),_=w(7975),v=w(7090),S=["cols","rows"];class u extends h.Disposable{constructor(s){super(),this._core=this.register(new n.Terminal(s)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let e=c=>this._core.options[c],i=(c,g)=>{this._checkReadonlyOptions(c),this._core.options[c]=g};for(let c in this._core.options){let g={get:e.bind(this,c),set:i.bind(this,c)};Object.defineProperty(this._publicOptions,c,g)}}_checkReadonlyOptions(s){if(S.includes(s))throw new Error(`Option "${s}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let s=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(let e in s)this._publicOptions[e]=s[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,e=!0){this._core.input(s,e)}resize(s,e){this._verifyIntegers(s,e),this._core.resize(s,e)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,e,i){this._verifyIntegers(s,e,i),this._core.select(s,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,e){this._verifyIntegers(s,e),this._core.selectLines(s,e)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,e){this._core.write(s,e)}writeln(s,e){this._core.write(s),this._core.write(`\r
|
|
9
|
-
`,
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(m){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),c.isLinux&&m&&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(m){let x=this._getMouseBufferCoords(m),T=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(T&&P&&x)&&this._areCoordsInSelection(x,T,P)}isCellInSelection(m,x){let T=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!T||!P)&&this._areCoordsInSelection([m,x],T,P)}_areCoordsInSelection(m,x,T){return m[1]>x[1]&&m[1]<T[1]||x[1]===T[1]&&m[1]===x[1]&&m[0]>=x[0]&&m[0]<T[0]||x[1]<T[1]&&m[1]===T[1]&&m[0]<T[0]||x[1]<T[1]&&m[1]===x[1]&&m[0]>=x[0]}_selectWordAtCursor(m,x){let T=this._linkifier.currentLink?.link?.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,o.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let P=this._getMouseBufferCoords(m);return!!P&&(this._selectWordAt(P,x),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,x){this._model.clearSelection(),m=Math.max(m,0),x=Math.min(x,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,x],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let x=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(x)return x[0]--,x[1]--,x[1]+=this._bufferService.buffer.ydisp,x}_getMouseEventScrollAmount(m){let x=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],T=this._renderService.dimensions.css.canvas.height;return x>=0&&x<=T?0:(x>T&&(x-=T),x=Math.min(Math.max(x,-50),50),x/=50,x/Math.abs(x)+Math.round(14*x))}shouldForceSelection(m){return c.isMac?m.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:m.shiftKey}handleMouseDown(m){if(this._mouseDownTimeStamp=m.timeStamp,(m.button!==2||!this.hasSelection)&&m.button===0){if(!this._enabled){if(!this.shouldForceSelection(m))return;m.stopPropagation()}m.preventDefault(),this._dragScrollAmount=0,this._enabled&&m.shiftKey?this._handleIncrementalClick(m):m.detail===1?this._handleSingleClick(m):m.detail===2?this._handleDoubleClick(m):m.detail===3&&this._handleTripleClick(m),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(m){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(m))}_handleSingleClick(m){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(m)?3:0,this._model.selectionStart=this._getMouseBufferCoords(m),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let x=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);x&&x.length!==this._model.selectionStart[0]&&x.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let x=this._getMouseBufferCoords(m);x&&(this._activeSelectionMode=2,this._selectLineAt(x[1]))}shouldColumnSelect(m){return m.altKey&&!(c.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let x=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(m),!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(m),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){let P=T.lines.get(this._model.selectionEnd[1]);P&&P.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}x&&x[0]===this._model.selectionEnd[0]&&x[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 m=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(m.ydisp+this._bufferService.rows,m.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=m.ydisp),this.refresh()}}_handleMouseUp(m){let x=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&x<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let T=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){let P=(0,f.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,T=!(!m||!x||m[0]===x[0]&&m[1]===x[1]);T?m&&x&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&x[0]===this._oldSelectionEnd[0]&&x[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,x,T)):this._oldHasSelection&&this._fireOnSelectionChange(m,x,T)}_fireOnSelectionChange(m,x,T){this._oldSelectionStart=m,this._oldSelectionEnd=x,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim(x=>this._handleTrim(x))}_convertViewportColToCharacterIndex(m,x){let T=x;for(let P=0;x>=P;P++){let I=m.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:I>1&&x!==P&&(T+=I-1)}return T}setSelection(m,x,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,x],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,x,T=!0,P=!0){if(m[0]>=this._bufferService.cols)return;let I=this._bufferService.buffer,R=I.lines.get(m[1]);if(!R)return;let W=I.translateBufferLineToString(m[1],!1),B=this._convertViewportColToCharacterIndex(R,m[0]),M=B,O=m[0]-B,D=0,w=0,E=0,L=0;if(W.charAt(B)===" "){for(;B>0&&W.charAt(B-1)===" ";)B--;for(;M<W.length&&W.charAt(M+1)===" ";)M++}else{let $=m[0],q=m[0];R.getWidth($)===0&&(D++,$--),R.getWidth(q)===2&&(w++,q++);let J=R.getString(q).length;for(J>1&&(L+=J-1,M+=J-1);$>0&&B>0&&!this._isCharWordSeparator(R.loadCell($-1,this._workCell));){R.loadCell($-1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===0?(D++,$--):H>1&&(E+=H-1,B-=H-1),B--,$--}for(;q<R.length&&M+1<W.length&&!this._isCharWordSeparator(R.loadCell(q+1,this._workCell));){R.loadCell(q+1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===2?(w++,q++):H>1&&(L+=H-1,M+=H-1),M++,q++}}M++;let A=B+O-D+E,F=Math.min(this._bufferService.cols,M-B+D+w-E-L);if(x||W.slice(B,M).trim()!==""){if(T&&A===0&&R.getCodePoint(0)!==32){let $=I.lines.get(m[1]-1);if($&&R.isWrapped&&$.getCodePoint(this._bufferService.cols-1)!==32){let q=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(q){let J=this._bufferService.cols-q.start;A-=J,F+=J}}}if(P&&A+F===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){let $=I.lines.get(m[1]+1);if($?.isWrapped&&$.getCodePoint(0)!==32){let q=this._getWordAt([0,m[1]+1],!1,!1,!0);q&&(F+=q.length)}}return{start:A,length:F}}}_selectWordAt(m,x){let T=this._getWordAt(m,x);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[T.start,m[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(m){let x=this._getWordAt(m,!0);if(x){let T=m[1];for(;x.start<0;)x.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;x.start+x.length>this._bufferService.cols;)x.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?x.start:x.start+x.length,T]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let x=this._bufferService.buffer.getWrappedRangeForLine(m),T={start:{x:0,y:x.first},end:{x:this._bufferService.cols-1,y:x.last}};this._model.selectionStart=[0,x.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,o.getRangeLength)(T,this._bufferService.cols)}};i.SelectionService=y=l([_(3,v.IBufferService),_(4,v.ICoreService),_(5,b.IMouseService),_(6,v.IOptionsService),_(7,b.IRenderService),_(8,b.ICoreBrowserService)],y)},4725:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;let l=s(8343);i.ICharSizeService=(0,l.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),i.IMouseService=(0,l.createDecorator)("MouseService"),i.IRenderService=(0,l.createDecorator)("RenderService"),i.ISelectionService=(0,l.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,l.createDecorator)("ThemeService"),i.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(h,i,s){var l=this&&this.__decorate||function(y,m,x,T){var P,I=arguments.length,R=I<3?m:T===null?T=Object.getOwnPropertyDescriptor(m,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,m,x,T);else for(var W=y.length-1;W>=0;W--)(P=y[W])&&(R=(I<3?P(R):I>3?P(m,x,R):P(m,x))||R);return I>3&&R&&Object.defineProperty(m,x,R),R},_=this&&this.__param||function(y,m){return function(x,T){m(x,T,y)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;let n=s(7239),f=s(8055),g=s(8460),b=s(844),p=s(2585),a=f.css.toColor("#ffffff"),c=f.css.toColor("#000000"),o=f.css.toColor("#ffffff"),u=f.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let y=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],m=[0,95,135,175,215,255];for(let x=0;x<216;x++){let T=m[x/36%6|0],P=m[x/6%6|0],I=m[x%6];y.push({css:f.channels.toCss(T,P,I),rgba:f.channels.toRgba(T,P,I)})}for(let x=0;x<24;x++){let T=8+10*x;y.push({css:f.channels.toCss(T,T,T),rgba:f.channels.toRgba(T,T,T)})}return y})());let C=i.ThemeService=class extends b.Disposable{get colors(){return this._colors}constructor(y){super(),this._optionsService=y,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:a,background:c,cursor:o,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:f.color.blend(c,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:f.color.blend(c,v),ansi:i.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(y={}){let m=this._colors;if(m.foreground=S(y.foreground,a),m.background=S(y.background,c),m.cursor=S(y.cursor,o),m.cursorAccent=S(y.cursorAccent,u),m.selectionBackgroundTransparent=S(y.selectionBackground,v),m.selectionBackgroundOpaque=f.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=S(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=f.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?S(y.selectionForeground,f.NULL_COLOR):void 0,m.selectionForeground===f.NULL_COLOR&&(m.selectionForeground=void 0),f.color.isOpaque(m.selectionBackgroundTransparent)&&(m.selectionBackgroundTransparent=f.color.opacity(m.selectionBackgroundTransparent,.3)),f.color.isOpaque(m.selectionInactiveBackgroundTransparent)&&(m.selectionInactiveBackgroundTransparent=f.color.opacity(m.selectionInactiveBackgroundTransparent,.3)),m.ansi=i.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=S(y.black,i.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=S(y.red,i.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=S(y.green,i.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=S(y.yellow,i.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=S(y.blue,i.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=S(y.magenta,i.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=S(y.cyan,i.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=S(y.white,i.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=S(y.brightBlack,i.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=S(y.brightRed,i.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=S(y.brightGreen,i.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=S(y.brightYellow,i.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=S(y.brightBlue,i.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=S(y.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=S(y.brightCyan,i.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=S(y.brightWhite,i.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let x=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let T=0;T<x;T++)m.ansi[T+16]=S(y.extendedAnsi[T],i.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(y){this._restoreColor(y),this._onChangeColors.fire(this.colors)}_restoreColor(y){if(y!==void 0)switch(y){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[y]=this._restoreColors.ansi[y]}else for(let m=0;m<this._restoreColors.ansi.length;++m)this._colors.ansi[m]=this._restoreColors.ansi[m]}modifyColors(y){y(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 S(y,m){if(y!==void 0)try{return f.css.toColor(y)}catch{}return m}i.ThemeService=C=l([_(0,p.IOptionsService)],C)},6349:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;let l=s(8460),_=s(844);class n extends _.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.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(g){if(this._maxLength===g)return;let b=new Array(g);for(let p=0;p<Math.min(g,this.length);p++)b[p]=this._array[this._getCyclicIndex(p)];this._array=b,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let b=this._length;b<g;b++)this._array[b]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,b){this._array[this._getCyclicIndex(g)]=b}push(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(g,b,...p){if(b){for(let a=g;a<this._length-b;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+b)];this._length-=b,this.onDeleteEmitter.fire({index:g,amount:b})}for(let a=this._length-1;a>=g;a--)this._array[this._getCyclicIndex(a+p.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<p.length;a++)this._array[this._getCyclicIndex(g+a)]=p[a];if(p.length&&this.onInsertEmitter.fire({index:g,amount:p.length}),this._length+p.length>this._maxLength){let a=this._length+p.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=p.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,b,p){if(!(b<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let c=b-1;c>=0;c--)this.set(g+c+p,this.get(g+c));let a=g+b+p-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<b;a++)this.set(g+a+p,this.get(g+a))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}i.CircularList=n},1439:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function s(l,_=5){if(typeof l!="object")return l;let n=Array.isArray(l)?[]:{};for(let f in l)n[f]=_<=1?l[f]:l[f]&&s(l[f],_-1);return n}},8055:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let s=0,l=0,_=0,n=0;var f,g,b,p,a;function c(u){let v=u.toString(16);return v.length<2?"0"+v:v}function o(u,v){return u<v?(v+.05)/(u+.05):(u+.05)/(v+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},function(u){u.toCss=function(v,C,S,y){return y!==void 0?`#${c(v)}${c(C)}${c(S)}${c(y)}`:`#${c(v)}${c(C)}${c(S)}`},u.toRgba=function(v,C,S,y=255){return(v<<24|C<<16|S<<8|y)>>>0},u.toColor=function(v,C,S,y){return{css:u.toCss(v,C,S,y),rgba:u.toRgba(v,C,S,y)}}}(f||(i.channels=f={})),function(u){function v(C,S){return n=Math.round(255*S),[s,l,_]=a.toChannels(C.rgba),{css:f.toCss(s,l,_,n),rgba:f.toRgba(s,l,_,n)}}u.blend=function(C,S){if(n=(255&S.rgba)/255,n===1)return{css:S.css,rgba:S.rgba};let y=S.rgba>>24&255,m=S.rgba>>16&255,x=S.rgba>>8&255,T=C.rgba>>24&255,P=C.rgba>>16&255,I=C.rgba>>8&255;return s=T+Math.round((y-T)*n),l=P+Math.round((m-P)*n),_=I+Math.round((x-I)*n),{css:f.toCss(s,l,_),rgba:f.toRgba(s,l,_)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,S,y){let m=a.ensureContrastRatio(C.rgba,S.rgba,y);if(m)return f.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let S=(255|C.rgba)>>>0;return[s,l,_]=a.toChannels(S),{css:f.toCss(s,l,_),rgba:S}},u.opacity=v,u.multiplyOpacity=function(C,S){return n=255&C.rgba,v(C,n*S/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}}(g||(i.color=g={})),function(u){let v,C;try{let S=document.createElement("canvas");S.width=1,S.height=1;let y=S.getContext("2d",{willReadFrequently:!0});y&&(v=y,v.globalCompositeOperation="copy",C=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return s=parseInt(S.slice(1,2).repeat(2),16),l=parseInt(S.slice(2,3).repeat(2),16),_=parseInt(S.slice(3,4).repeat(2),16),f.toColor(s,l,_);case 5:return s=parseInt(S.slice(1,2).repeat(2),16),l=parseInt(S.slice(2,3).repeat(2),16),_=parseInt(S.slice(3,4).repeat(2),16),n=parseInt(S.slice(4,5).repeat(2),16),f.toColor(s,l,_,n);case 7:return{css:S,rgba:(parseInt(S.slice(1),16)<<8|255)>>>0};case 9:return{css:S,rgba:parseInt(S.slice(1),16)>>>0}}let y=S.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(y)return s=parseInt(y[1]),l=parseInt(y[2]),_=parseInt(y[3]),n=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),f.toColor(s,l,_,n);if(!v||!C)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=C,v.fillStyle=S,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[s,l,_,n]=v.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(s,l,_,n),css:S}}}(b||(i.css=b={})),function(u){function v(C,S,y){let m=C/255,x=S/255,T=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}u.relativeLuminance=function(C){return v(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=v}(p||(i.rgb=p={})),function(u){function v(S,y,m){let x=S>>24&255,T=S>>16&255,P=S>>8&255,I=y>>24&255,R=y>>16&255,W=y>>8&255,B=o(p.relativeLuminance2(I,R,W),p.relativeLuminance2(x,T,P));for(;B<m&&(I>0||R>0||W>0);)I-=Math.max(0,Math.ceil(.1*I)),R-=Math.max(0,Math.ceil(.1*R)),W-=Math.max(0,Math.ceil(.1*W)),B=o(p.relativeLuminance2(I,R,W),p.relativeLuminance2(x,T,P));return(I<<24|R<<16|W<<8|255)>>>0}function C(S,y,m){let x=S>>24&255,T=S>>16&255,P=S>>8&255,I=y>>24&255,R=y>>16&255,W=y>>8&255,B=o(p.relativeLuminance2(I,R,W),p.relativeLuminance2(x,T,P));for(;B<m&&(I<255||R<255||W<255);)I=Math.min(255,I+Math.ceil(.1*(255-I))),R=Math.min(255,R+Math.ceil(.1*(255-R))),W=Math.min(255,W+Math.ceil(.1*(255-W))),B=o(p.relativeLuminance2(I,R,W),p.relativeLuminance2(x,T,P));return(I<<24|R<<16|W<<8|255)>>>0}u.blend=function(S,y){if(n=(255&y)/255,n===1)return y;let m=y>>24&255,x=y>>16&255,T=y>>8&255,P=S>>24&255,I=S>>16&255,R=S>>8&255;return s=P+Math.round((m-P)*n),l=I+Math.round((x-I)*n),_=R+Math.round((T-R)*n),f.toRgba(s,l,_)},u.ensureContrastRatio=function(S,y,m){let x=p.relativeLuminance(S>>8),T=p.relativeLuminance(y>>8);if(o(x,T)<m){if(T<x){let R=v(S,y,m),W=o(x,p.relativeLuminance(R>>8));if(W<m){let B=C(S,y,m);return W>o(x,p.relativeLuminance(B>>8))?R:B}return R}let P=C(S,y,m),I=o(x,p.relativeLuminance(P>>8));if(I<m){let R=v(S,y,m);return I>o(x,p.relativeLuminance(R>>8))?P:R}return P}},u.reduceLuminance=v,u.increaseLuminance=C,u.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}}(a||(i.rgba=a={})),i.toPaddedHex=c,i.contrastRatio=o},8969:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;let l=s(844),_=s(2585),n=s(4348),f=s(7866),g=s(744),b=s(7302),p=s(6975),a=s(8460),c=s(1753),o=s(1480),u=s(7994),v=s(9282),C=s(5435),S=s(5981),y=s(2660),m=!1;class x extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event(P=>{this._onScrollApi?.fire(P.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(P){for(let I in P)this.optionsService.options[I]=P[I]}constructor(P){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new a.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new a.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new b.OptionsService(P)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(c.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(o.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(y.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,a.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,a.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,a.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,a.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(I=>{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(I=>{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 S.WriteBuffer((I,R)=>this._inputHandler.parse(I,R))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,I){this._writeBuffer.write(P,I)}writeSync(P,I){this._logService.logLevel<=_.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(P,I)}input(P,I=!0){this.coreService.triggerDataEvent(P,I)}resize(P,I){isNaN(P)||isNaN(I)||(P=Math.max(P,g.MINIMUM_COLS),I=Math.max(I,g.MINIMUM_ROWS),this._bufferService.resize(P,I))}scroll(P,I=!1){this._bufferService.scroll(P,I)}scrollLines(P,I,R){this._bufferService.scrollLines(P,I,R)}scrollPages(P){this.scrollLines(P*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(P){let I=P-this._bufferService.buffer.ydisp;I!==0&&this.scrollLines(I)}registerEscHandler(P,I){return this._inputHandler.registerEscHandler(P,I)}registerDcsHandler(P,I){return this._inputHandler.registerDcsHandler(P,I)}registerCsiHandler(P,I){return this._inputHandler.registerCsiHandler(P,I)}registerOscHandler(P,I){return this._inputHandler.registerOscHandler(P,I)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1,I=this.optionsService.rawOptions.windowsPty;I&&I.buildNumber!==void 0&&I.buildNumber!==void 0?P=I.backend==="conpty"&&I.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(P=!0),P?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let P=[];P.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),P.push(this.registerCsiHandler({final:"H"},()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(let I of P)I.dispose()})}}}i.CoreTerminal=x},8460:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=s=>(this._listeners.push(s),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===s)return void this._listeners.splice(l,1)}}})),this._event}fire(s,l){let _=[];for(let n=0;n<this._listeners.length;n++)_.push(this._listeners[n]);for(let n=0;n<_.length;n++)_[n].call(void 0,s,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(s,l){return s(_=>l.fire(_))},i.runAndSubscribe=function(s,l){return l(void 0),s(_=>l(_))}},5435:function(h,i,s){var l=this&&this.__decorate||function(D,w,E,L){var A,F=arguments.length,$=F<3?w:L===null?L=Object.getOwnPropertyDescriptor(w,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(D,w,E,L);else for(var q=D.length-1;q>=0;q--)(A=D[q])&&($=(F<3?A($):F>3?A(w,E,$):A(w,E))||$);return F>3&&$&&Object.defineProperty(w,E,$),$},_=this&&this.__param||function(D,w){return function(E,L){w(E,L,D)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;let n=s(2584),f=s(7116),g=s(2015),b=s(844),p=s(482),a=s(8437),c=s(8460),o=s(643),u=s(511),v=s(3734),C=s(2585),S=s(1480),y=s(6242),m=s(6351),x=s(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function I(D,w){if(D>24)return w.setWinLines||!1;switch(D){case 1:return!!w.restoreWin;case 2:return!!w.minimizeWin;case 3:return!!w.setWinPosition;case 4:return!!w.setWinSizePixels;case 5:return!!w.raiseWin;case 6:return!!w.lowerWin;case 7:return!!w.refreshWin;case 8:return!!w.setWinSizeChars;case 9:return!!w.maximizeWin;case 10:return!!w.fullscreenWin;case 11:return!!w.getWinState;case 13:return!!w.getWinPosition;case 14:return!!w.getWinSizePixels;case 15:return!!w.getScreenSizePixels;case 16:return!!w.getCellSizePixels;case 18:return!!w.getWinSizeChars;case 19:return!!w.getScreenSizeChars;case 20:return!!w.getIconTitle;case 21:return!!w.getWinTitle;case 22:return!!w.pushTitle;case 23:return!!w.popTitle;case 24:return!!w.setWinLines}return!1}var R;(function(D){D[D.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",D[D.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(i.WindowsOptionsReportType=R={}));let W=0;class B extends b.Disposable{getAttrData(){return this._curAttrData}constructor(w,E,L,A,F,$,q,J,H=new g.EscapeSequenceParser){super(),this._bufferService=w,this._charsetService=E,this._coreService=L,this._logService=A,this._optionsService=F,this._oscLinkService=$,this._coreMouseService=q,this._unicodeService=J,this._parser=H,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new c.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new c.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new c.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new c.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new c.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new c.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new c.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new c.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new c.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new c.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new c.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 M(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._parser.setCsiHandlerFallback((k,U)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:U.toArray()})}),this._parser.setEscHandlerFallback(k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})}),this._parser.setExecuteHandlerFallback(k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})}),this._parser.setOscHandlerFallback((k,U,z)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:U,data:z})}),this._parser.setDcsHandlerFallback((k,U,z)=>{U==="HOOK"&&(z=z.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:U,payload:z})}),this._parser.setPrintHandler((k,U,z)=>this.print(k,U,z)),this._parser.registerCsiHandler({final:"@"},k=>this.insertChars(k)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},k=>this.scrollLeft(k)),this._parser.registerCsiHandler({final:"A"},k=>this.cursorUp(k)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},k=>this.scrollRight(k)),this._parser.registerCsiHandler({final:"B"},k=>this.cursorDown(k)),this._parser.registerCsiHandler({final:"C"},k=>this.cursorForward(k)),this._parser.registerCsiHandler({final:"D"},k=>this.cursorBackward(k)),this._parser.registerCsiHandler({final:"E"},k=>this.cursorNextLine(k)),this._parser.registerCsiHandler({final:"F"},k=>this.cursorPrecedingLine(k)),this._parser.registerCsiHandler({final:"G"},k=>this.cursorCharAbsolute(k)),this._parser.registerCsiHandler({final:"H"},k=>this.cursorPosition(k)),this._parser.registerCsiHandler({final:"I"},k=>this.cursorForwardTab(k)),this._parser.registerCsiHandler({final:"J"},k=>this.eraseInDisplay(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},k=>this.eraseInDisplay(k,!0)),this._parser.registerCsiHandler({final:"K"},k=>this.eraseInLine(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},k=>this.eraseInLine(k,!0)),this._parser.registerCsiHandler({final:"L"},k=>this.insertLines(k)),this._parser.registerCsiHandler({final:"M"},k=>this.deleteLines(k)),this._parser.registerCsiHandler({final:"P"},k=>this.deleteChars(k)),this._parser.registerCsiHandler({final:"S"},k=>this.scrollUp(k)),this._parser.registerCsiHandler({final:"T"},k=>this.scrollDown(k)),this._parser.registerCsiHandler({final:"X"},k=>this.eraseChars(k)),this._parser.registerCsiHandler({final:"Z"},k=>this.cursorBackwardTab(k)),this._parser.registerCsiHandler({final:"`"},k=>this.charPosAbsolute(k)),this._parser.registerCsiHandler({final:"a"},k=>this.hPositionRelative(k)),this._parser.registerCsiHandler({final:"b"},k=>this.repeatPrecedingCharacter(k)),this._parser.registerCsiHandler({final:"c"},k=>this.sendDeviceAttributesPrimary(k)),this._parser.registerCsiHandler({prefix:">",final:"c"},k=>this.sendDeviceAttributesSecondary(k)),this._parser.registerCsiHandler({final:"d"},k=>this.linePosAbsolute(k)),this._parser.registerCsiHandler({final:"e"},k=>this.vPositionRelative(k)),this._parser.registerCsiHandler({final:"f"},k=>this.hVPosition(k)),this._parser.registerCsiHandler({final:"g"},k=>this.tabClear(k)),this._parser.registerCsiHandler({final:"h"},k=>this.setMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"h"},k=>this.setModePrivate(k)),this._parser.registerCsiHandler({final:"l"},k=>this.resetMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"l"},k=>this.resetModePrivate(k)),this._parser.registerCsiHandler({final:"m"},k=>this.charAttributes(k)),this._parser.registerCsiHandler({final:"n"},k=>this.deviceStatus(k)),this._parser.registerCsiHandler({prefix:"?",final:"n"},k=>this.deviceStatusPrivate(k)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},k=>this.softReset(k)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},k=>this.setCursorStyle(k)),this._parser.registerCsiHandler({final:"r"},k=>this.setScrollRegion(k)),this._parser.registerCsiHandler({final:"s"},k=>this.saveCursor(k)),this._parser.registerCsiHandler({final:"t"},k=>this.windowOptions(k)),this._parser.registerCsiHandler({final:"u"},k=>this.restoreCursor(k)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},k=>this.insertColumns(k)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},k=>this.deleteColumns(k)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},k=>this.selectProtected(k)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},k=>this.requestMode(k,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},k=>this.requestMode(k,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new y.OscHandler(k=>(this.setTitle(k),this.setIconName(k),!0))),this._parser.registerOscHandler(1,new y.OscHandler(k=>this.setIconName(k))),this._parser.registerOscHandler(2,new y.OscHandler(k=>this.setTitle(k))),this._parser.registerOscHandler(4,new y.OscHandler(k=>this.setOrReportIndexedColor(k))),this._parser.registerOscHandler(8,new y.OscHandler(k=>this.setHyperlink(k))),this._parser.registerOscHandler(10,new y.OscHandler(k=>this.setOrReportFgColor(k))),this._parser.registerOscHandler(11,new y.OscHandler(k=>this.setOrReportBgColor(k))),this._parser.registerOscHandler(12,new y.OscHandler(k=>this.setOrReportCursorColor(k))),this._parser.registerOscHandler(104,new y.OscHandler(k=>this.restoreIndexedColor(k))),this._parser.registerOscHandler(110,new y.OscHandler(k=>this.restoreFgColor(k))),this._parser.registerOscHandler(111,new y.OscHandler(k=>this.restoreBgColor(k))),this._parser.registerOscHandler(112,new y.OscHandler(k=>this.restoreCursorColor(k))),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 k in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},()=>this.selectCharset("("+k)),this._parser.registerEscHandler({intermediates:")",final:k},()=>this.selectCharset(")"+k)),this._parser.registerEscHandler({intermediates:"*",final:k},()=>this.selectCharset("*"+k)),this._parser.registerEscHandler({intermediates:"+",final:k},()=>this.selectCharset("+"+k)),this._parser.registerEscHandler({intermediates:"-",final:k},()=>this.selectCharset("-"+k)),this._parser.registerEscHandler({intermediates:".",final:k},()=>this.selectCharset("."+k)),this._parser.registerEscHandler({intermediates:"/",final:k},()=>this.selectCharset("/"+k));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(k=>(this._logService.error("Parsing error: ",k),k)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler((k,U)=>this.requestStatusString(k,U)))}_preserveStack(w,E,L,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=w,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=L,this._parseStack.position=A}_logSlowResolvingAsync(w){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([w,new Promise((E,L)=>setTimeout(()=>L("#SLOW_TIMEOUT"),5e3))]).catch(E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(w,E){let L,A=this._activeBuffer.x,F=this._activeBuffer.y,$=0,q=this._parseStack.paused;if(q){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(L),L;A=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,w.length>P&&($=this._parseStack.position+P)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof w=="string"?` "${w}"`:` "${Array.prototype.map.call(w,k=>String.fromCharCode(k)).join("")}"`),typeof w=="string"?w.split("").map(k=>k.charCodeAt(0)):w),this._parseBuffer.length<w.length&&this._parseBuffer.length<P&&(this._parseBuffer=new Uint32Array(Math.min(w.length,P))),q||this._dirtyRowTracker.clearRange(),w.length>P)for(let k=$;k<w.length;k+=P){let U=k+P<w.length?k+P:w.length,z=typeof w=="string"?this._stringDecoder.decode(w.substring(k,U),this._parseBuffer):this._utf8Decoder.decode(w.subarray(k,U),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,z))return this._preserveStack(A,F,z,k),this._logSlowResolvingAsync(L),L}else if(!q){let k=typeof w=="string"?this._stringDecoder.decode(w,this._parseBuffer):this._utf8Decoder.decode(w,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,k))return this._preserveStack(A,F,k,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===A&&this._activeBuffer.y===F||this._onCursorMove.fire();let J=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),H=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);H<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(H,this._bufferService.rows-1),Math.min(J,this._bufferService.rows-1))}print(w,E,L){let A,F,$=this._charsetService.charset,q=this._optionsService.rawOptions.screenReaderMode,J=this._bufferService.cols,H=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,U=this._curAttrData,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-E>0&&z.getWidth(this._activeBuffer.x-1)===2&&z.setCellFromCodepoint(this._activeBuffer.x-1,0,1,U);let G=this._parser.precedingJoinState;for(let V=E;V<L;++V){if(A=w[V],A<127&&$){let Y=$[String.fromCharCode(A)];Y&&(A=Y.charCodeAt(0))}let N=this._unicodeService.charProperties(A,G);F=S.UnicodeService.extractWidth(N);let j=S.UnicodeService.extractShouldJoin(N),K=j?S.UnicodeService.extractWidth(G):0;if(G=N,q&&this._onA11yChar.fire((0,p.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-K>J){if(H){let Y=z,X=this._activeBuffer.x-K;for(this._activeBuffer.x=K,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),z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),K>0&&z instanceof a.BufferLine&&z.copyCellsFrom(Y,X,0,K,!1);X<J;)Y.setCellFromCodepoint(X++,0,1,U)}else if(this._activeBuffer.x=J-1,F===2)continue}if(j&&this._activeBuffer.x){let Y=z.getWidth(this._activeBuffer.x-1)?1:2;z.addCodepointToCell(this._activeBuffer.x-Y,A,F);for(let X=F-K;--X>=0;)z.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}else if(k&&(z.insertCells(this._activeBuffer.x,F-K,this._activeBuffer.getNullCell(U)),z.getWidth(J-1)===2&&z.setCellFromCodepoint(J-1,o.NULL_CELL_CODE,o.NULL_CELL_WIDTH,U)),z.setCellFromCodepoint(this._activeBuffer.x++,A,F,U),F>0)for(;--F;)z.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}this._parser.precedingJoinState=G,this._activeBuffer.x<J&&L-E>0&&z.getWidth(this._activeBuffer.x)===0&&!z.hasContent(this._activeBuffer.x)&&z.setCellFromCodepoint(this._activeBuffer.x,0,1,U),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(w,E){return w.final!=="t"||w.prefix||w.intermediates?this._parser.registerCsiHandler(w,E):this._parser.registerCsiHandler(w,L=>!I(L.params[0],this._optionsService.rawOptions.windowOptions)||E(L))}registerDcsHandler(w,E){return this._parser.registerDcsHandler(w,new m.DcsHandler(E))}registerEscHandler(w,E){return this._parser.registerEscHandler(w,E)}registerOscHandler(w,E){return this._parser.registerOscHandler(w,new y.OscHandler(E))}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 w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);w.hasWidth(this._activeBuffer.x)&&!w.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-w),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(w=this._bufferService.cols-1){this._activeBuffer.x=Math.min(w,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(w,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=w,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=w,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(w,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+w,this._activeBuffer.y+E)}cursorUp(w){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,w.params[0]||1)):this._moveCursor(0,-(w.params[0]||1)),!0}cursorDown(w){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,w.params[0]||1)):this._moveCursor(0,w.params[0]||1),!0}cursorForward(w){return this._moveCursor(w.params[0]||1,0),!0}cursorBackward(w){return this._moveCursor(-(w.params[0]||1),0),!0}cursorNextLine(w){return this.cursorDown(w),this._activeBuffer.x=0,!0}cursorPrecedingLine(w){return this.cursorUp(w),this._activeBuffer.x=0,!0}cursorCharAbsolute(w){return this._setCursor((w.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(w){return this._setCursor(w.length>=2?(w.params[1]||1)-1:0,(w.params[0]||1)-1),!0}charPosAbsolute(w){return this._setCursor((w.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(w){return this._moveCursor(w.params[0]||1,0),!0}linePosAbsolute(w){return this._setCursor(this._activeBuffer.x,(w.params[0]||1)-1),!0}vPositionRelative(w){return this._moveCursor(0,w.params[0]||1),!0}hVPosition(w){return this.cursorPosition(w),!0}tabClear(w){let E=w.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(w){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=w.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(w){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=w.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(w){let E=w.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(w,E,L,A=!1,F=!1){let $=this._activeBuffer.lines.get(this._activeBuffer.ybase+w);$.replaceCells(E,L,this._activeBuffer.getNullCell(this._eraseAttrData()),F),A&&($.isWrapped=!1)}_resetBufferLine(w,E=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+w);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+w),L.isWrapped=!1)}eraseInDisplay(w,E=!1){let L;switch(this._restrictCursor(this._bufferService.cols),w.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);L<this._bufferService.rows;L++)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,E);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(w,E=!1){switch(this._restrictCursor(this._bufferService.cols),w.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(w){this._restrictCursor();let E=w.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-A+1;for(;E--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(w){this._restrictCursor();let E=w.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,A;for(A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,A=this._bufferService.rows-1+this._activeBuffer.ybase-A;E--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(w){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.insertCells(this._activeBuffer.x,w.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(w){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,w.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(w){let E=w.params[0]||1;for(;E--;)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(w){let E=w.params[0]||1;for(;E--;)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(a.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(w){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=w.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(w){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=w.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(w){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=w.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(w){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=w.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);A.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(w){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(w.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(w){let E=this._parser.precedingJoinState;if(!E)return!0;let L=w.params[0]||1,A=S.UnicodeService.extractWidth(E),F=this._activeBuffer.x-A,$=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),q=new Uint32Array($.length*L),J=0;for(let k=0;k<$.length;){let U=$.codePointAt(k)||0;q[J++]=U,k+=U>65535?2:1}let H=J;for(let k=1;k<L;++k)q.copyWithin(H,0,J),H+=J;return this.print(q,0,H),!0}sendDeviceAttributesPrimary(w){return w.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(w){return w.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(w.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(w){return(this._optionsService.rawOptions.termName+"").indexOf(w)===0}setMode(w){for(let E=0;E<w.length;E++)switch(w.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(w){for(let E=0;E<w.length;E++)switch(w.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),this._charsetService.setgCharset(1,f.DEFAULT_CHARSET),this._charsetService.setgCharset(2,f.DEFAULT_CHARSET),this._charsetService.setgCharset(3,f.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(w){for(let E=0;E<w.length;E++)switch(w.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(w){for(let E=0;E<w.length;E++)switch(w.params[E]){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(),w.params[E]===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(w,E){let L=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:F}=this._coreMouseService,$=this._coreService,{buffers:q,cols:J}=this._bufferService,{active:H,alt:k}=q,U=this._optionsService.rawOptions,z=j=>j?1:2,G=w.params[0];return V=G,N=E?G===2?4:G===4?z($.modes.insertMode):G===12?3:G===20?z(U.convertEol):0:G===1?z(L.applicationCursorKeys):G===3?U.windowOptions.setWinLines?J===80?2:J===132?1:0:0:G===6?z(L.origin):G===7?z(L.wraparound):G===8?3:G===9?z(A==="X10"):G===12?z(U.cursorBlink):G===25?z(!$.isCursorHidden):G===45?z(L.reverseWraparound):G===66?z(L.applicationKeypad):G===67?4:G===1e3?z(A==="VT200"):G===1002?z(A==="DRAG"):G===1003?z(A==="ANY"):G===1004?z(L.sendFocus):G===1005?4:G===1006?z(F==="SGR"):G===1015?4:G===1016?z(F==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?z(H===k):G===2004?z(L.bracketedPasteMode):0,$.triggerDataEvent(`${n.C0.ESC}[${E?"":"?"}${V};${N}$y`),!0;var V,N}_updateAttrColor(w,E,L,A,F){return E===2?(w|=50331648,w&=-16777216,w|=v.AttributeData.fromColorRGB([L,A,F])):E===5&&(w&=-50331904,w|=33554432|255&L),w}_extractColor(w,E,L){let A=[0,0,-1,0,0,0],F=0,$=0;do{if(A[$+F]=w.params[E+$],w.hasSubParams(E+$)){let q=w.getSubParams(E+$),J=0;do A[1]===5&&(F=1),A[$+J+1+F]=q[J];while(++J<q.length&&J+$+1+F<A.length);break}if(A[1]===5&&$+F>=2||A[1]===2&&$+F>=5)break;A[1]&&(F=1)}while(++$+E<w.length&&$+F<A.length);for(let q=2;q<A.length;++q)A[q]===-1&&(A[q]=0);switch(A[0]){case 38:L.fg=this._updateAttrColor(L.fg,A[1],A[3],A[4],A[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,A[1],A[3],A[4],A[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,A[1],A[3],A[4],A[5])}return $}_processUnderline(w,E){E.extended=E.extended.clone(),(!~w||w>5)&&(w=1),E.extended.underlineStyle=w,E.fg|=268435456,w===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(w){w.fg=a.DEFAULT_ATTR_DATA.fg,w.bg=a.DEFAULT_ATTR_DATA.bg,w.extended=w.extended.clone(),w.extended.underlineStyle=0,w.extended.underlineColor&=-67108864,w.updateExtended()}charAttributes(w){if(w.length===1&&w.params[0]===0)return this._processSGR0(this._curAttrData),!0;let E=w.length,L,A=this._curAttrData;for(let F=0;F<E;F++)L=w.params[F],L>=30&&L<=37?(A.fg&=-50331904,A.fg|=16777216|L-30):L>=40&&L<=47?(A.bg&=-50331904,A.bg|=16777216|L-40):L>=90&&L<=97?(A.fg&=-50331904,A.fg|=16777224|L-90):L>=100&&L<=107?(A.bg&=-50331904,A.bg|=16777224|L-100):L===0?this._processSGR0(A):L===1?A.fg|=134217728:L===3?A.bg|=67108864:L===4?(A.fg|=268435456,this._processUnderline(w.hasSubParams(F)?w.getSubParams(F)[0]:1,A)):L===5?A.fg|=536870912:L===7?A.fg|=67108864:L===8?A.fg|=1073741824:L===9?A.fg|=2147483648:L===2?A.bg|=134217728:L===21?this._processUnderline(2,A):L===22?(A.fg&=-134217729,A.bg&=-134217729):L===23?A.bg&=-67108865:L===24?(A.fg&=-268435457,this._processUnderline(0,A)):L===25?A.fg&=-536870913:L===27?A.fg&=-67108865:L===28?A.fg&=-1073741825:L===29?A.fg&=2147483647:L===39?(A.fg&=-67108864,A.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):L===49?(A.bg&=-67108864,A.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?F+=this._extractColor(w,F,A):L===53?A.bg|=1073741824:L===55?A.bg&=-1073741825:L===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):L===100?(A.fg&=-67108864,A.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(w){switch(w.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${E};${L}R`)}return!0}deviceStatusPrivate(w){if(w.params[0]===6){let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${E};${L}R`)}return!0}softReset(w){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=a.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(w){let E=w.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let L=E%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(w){let E=w.params[0]||1,L;return(w.length<2||(L=w.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(w){if(!I(w.params[0],this._optionsService.rawOptions.windowOptions))return!0;let E=w.length>1?w.params[1]:0;switch(w.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(R.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(R.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(w){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(w){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(w){return this._windowTitle=w,this._onTitleChange.fire(w),!0}setIconName(w){return this._iconName=w,!0}setOrReportIndexedColor(w){let E=[],L=w.split(";");for(;L.length>1;){let A=L.shift(),F=L.shift();if(/^\d+$/.exec(A)){let $=parseInt(A);if(O($))if(F==="?")E.push({type:0,index:$});else{let q=(0,x.parseColor)(F);q&&E.push({type:1,index:$,color:q})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(w){let E=w.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(w,E){this._getCurrentLinkId()&&this._finishHyperlink();let L=w.split(":"),A,F=L.findIndex($=>$.startsWith("id="));return F!==-1&&(A=L[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(w,E){let L=w.split(";");for(let A=0;A<L.length&&!(E>=this._specialColors.length);++A,++E)if(L[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let F=(0,x.parseColor)(L[A]);F&&this._onColor.fire([{type:1,index:this._specialColors[E],color:F}])}return!0}setOrReportFgColor(w){return this._setOrReportSpecialColor(w,0)}setOrReportBgColor(w){return this._setOrReportSpecialColor(w,1)}setOrReportCursorColor(w){return this._setOrReportSpecialColor(w,2)}restoreIndexedColor(w){if(!w)return this._onColor.fire([{type:2}]),!0;let E=[],L=w.split(";");for(let A=0;A<L.length;++A)if(/^\d+$/.exec(L[A])){let F=parseInt(L[A]);O(F)&&E.push({type:2,index:F})}return E.length&&this._onColor.fire(E),!0}restoreFgColor(w){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(w){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(w){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),!0}selectCharset(w){return w.length!==2?(this.selectDefaultCharset(),!0):(w[0]==="/"||this._charsetService.setgCharset(T[w[0]],f.CHARSETS[w[1]]||f.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let w=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,w,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=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(w){return this._charsetService.setgLevel(w),!0}screenAlignmentPattern(){let w=new u.CellData;w.content=4194373,w.fg=this._curAttrData.fg,w.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){let L=this._activeBuffer.ybase+this._activeBuffer.y+E,A=this._activeBuffer.lines.get(L);A&&(A.fill(w),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(w,E){let L=this._bufferService.buffer,A=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${F}${n.C0.ESC}\\`),!0))(w==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:w==='"p'?'P1$r61;1"p':w==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:w==="m"?"P1$r0m":w===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(w,E){this._dirtyRowTracker.markRangeDirty(w,E)}}i.InputHandler=B;let M=class{constructor(D){this._bufferService=D,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(D){D<this.start?this.start=D:D>this.end&&(this.end=D)}markRangeDirty(D,w){D>w&&(W=D,D=w,w=W),D<this.start&&(this.start=D),w>this.end&&(this.end=w)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function O(D){return 0<=D&&D<256}M=l([_(0,C.IBufferService)],M)},844:(h,i)=>{function s(l){for(let _ of l)_.dispose();l.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){let _=this._disposables.indexOf(l);_!==-1&&this._disposables.splice(_,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){this._isDisposed||l===this._value||(this._value?.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},i.toDisposable=function(l){return{dispose:l}},i.disposeArray=s,i.getDisposeArrayDisposable=function(l){return{dispose:()=>s(l)}}},1505:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class s{constructor(){this._data={}}set(_,n,f){this._data[_]||(this._data[_]={}),this._data[_][n]=f}get(_,n){return this._data[_]?this._data[_][n]:void 0}clear(){this._data={}}}i.TwoKeyMap=s,i.FourKeyMap=class{constructor(){this._data=new s}set(l,_,n,f,g){this._data.get(l,_)||this._data.set(l,_,new s),this._data.get(l,_).set(n,f,g)}get(l,_,n,f){return this._data.get(l,_)?.get(n,f)}clear(){this._data.clear()}}},6114:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;let s=i.isNode?"node":navigator.userAgent,l=i.isNode?"node":navigator.platform;i.isFirefox=s.includes("Firefox"),i.isLegacyEdge=s.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(s),i.getSafariVersion=function(){if(!i.isSafari)return 0;let _=s.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),i.isIpad=l==="iPad",i.isIphone=l==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),i.isLinux=l.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(s)},6106:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let s=0;i.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(s=this._search(this._getKey(l)),this._array.splice(s,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;let _=this._getKey(l);if(_===void 0||(s=this._search(_),s===-1)||this._getKey(this._array[s])!==_)return!1;do if(this._array[s]===l)return this._array.splice(s,1),!0;while(++s<this._array.length&&this._getKey(this._array[s])===_);return!1}*getKeyIterator(l){if(this._array.length!==0&&(s=this._search(l),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===l))do yield this._array[s];while(++s<this._array.length&&this._getKey(this._array[s])===l)}forEachByKey(l,_){if(this._array.length!==0&&(s=this._search(l),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===l))do _(this._array[s]);while(++s<this._array.length&&this._getKey(this._array[s])===l)}values(){return[...this._array].values()}_search(l){let _=0,n=this._array.length-1;for(;n>=_;){let f=_+n>>1,g=this._getKey(this._array[f]);if(g>l)n=f-1;else{if(!(g<l)){for(;f>0&&this._getKey(this._array[f-1])===l;)f--;return f}_=f+1}}return _}}},7226:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;let l=s(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),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(g){this._idleCallback=void 0;let b=0,p=0,a=g.timeRemaining(),c=0;for(;this._i<this._tasks.length;){if(b=Date.now(),this._tasks[this._i]()||this._i++,b=Math.max(1,Date.now()-b),p=Math.max(b,p),c=g.timeRemaining(),1.5*p>c)return a-b<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-b))}ms`),void this._start();a=c}this.clear()}}class n extends _{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){let b=Date.now()+g;return{timeRemaining:()=>Math.max(0,b-Date.now())}}}i.PriorityTaskQueue=n,i.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:n,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;let l=s(643);i.updateWindowsModeWrappedState=function(_){let n=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),f=n?.get(_.cols-1),g=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);g&&f&&(g.isWrapped=f[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&f[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class s{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){let n=new s;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=s;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){let n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,f=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=f}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=l},9092:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;let l=s(6349),_=s(7226),n=s(3734),f=s(8437),g=s(4634),b=s(511),p=s(643),a=s(4863),c=s(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(o,u,v){this._hasScrollback=o,this._optionsService=u,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=c.DEFAULT_CHARSET,this.markers=[],this._nullCell=b.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=b.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.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 l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(o){return o?(this._nullCell.fg=o.fg,this._nullCell.bg=o.bg,this._nullCell.extended=o.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(o){return o?(this._whitespaceCell.fg=o.fg,this._whitespaceCell.bg=o.bg,this._whitespaceCell.extended=o.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(o,u){return new f.BufferLine(this._bufferService.cols,this.getNullCell(o),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let o=this.ybase+this.y-this.ydisp;return o>=0&&o<this._rows}_getCorrectBufferLength(o){if(!this._hasScrollback)return o;let u=o+this._optionsService.rawOptions.scrollback;return u>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:u}fillViewportRows(o){if(this.lines.length===0){o===void 0&&(o=f.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(o))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(o,u){let v=this.getNullCell(f.DEFAULT_ATTR_DATA),C=0,S=this._getCorrectBufferLength(u);if(S>this.lines.maxLength&&(this.lines.maxLength=S),this.lines.length>0){if(this._cols<o)for(let m=0;m<this.lines.length;m++)C+=+this.lines.get(m).resize(o,v);let y=0;if(this._rows<u)for(let m=this._rows;m<u;m++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new f.BufferLine(o,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+y+1?(this.ybase--,y++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(o,v)));else for(let m=this._rows;m>u;m--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(S<this.lines.maxLength){let m=this.lines.length-S;m>0&&(this.lines.trimStart(m),this.ybase=Math.max(this.ybase-m,0),this.ydisp=Math.max(this.ydisp-m,0),this.savedY=Math.max(this.savedY-m,0)),this.lines.maxLength=S}this.x=Math.min(this.x,o-1),this.y=Math.min(this.y,u-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,o-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(o,u),this._cols>o))for(let y=0;y<this.lines.length;y++)C+=+this.lines.get(y).resize(o,v);this._cols=o,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let o=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,o=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return o}get _isReflowEnabled(){let o=this._optionsService.rawOptions.windowsPty;return o&&o.buildNumber?this._hasScrollback&&o.backend==="conpty"&&o.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(o,u){this._cols!==o&&(o>this._cols?this._reflowLarger(o,u):this._reflowSmaller(o,u))}_reflowLarger(o,u){let v=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,o,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(v.length>0){let C=(0,g.reflowLargerCreateNewLayout)(this.lines,v);(0,g.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(o,u,C.countRemoved)}}_reflowLargerAdjustViewport(o,u,v){let C=this.getNullCell(f.DEFAULT_ATTR_DATA),S=v;for(;S-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new f.BufferLine(o,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(o,u){let v=this.getNullCell(f.DEFAULT_ATTR_DATA),C=[],S=0;for(let y=this.lines.length-1;y>=0;y--){let m=this.lines.get(y);if(!m||!m.isWrapped&&m.getTrimmedLength()<=o)continue;let x=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),x.unshift(m);let T=this.ybase+this.y;if(T>=y&&T<y+x.length)continue;let P=x[x.length-1].getTrimmedLength(),I=(0,g.reflowSmallerGetNewLineLengths)(x,this._cols,o),R=I.length-x.length,W;W=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+R):Math.max(0,this.lines.length-this.lines.maxLength+R);let B=[];for(let L=0;L<R;L++){let A=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);B.push(A)}B.length>0&&(C.push({start:y+x.length+S,newLines:B}),S+=B.length),x.push(...B);let M=I.length-1,O=I[M];O===0&&(M--,O=I[M]);let D=x.length-R-1,w=P;for(;D>=0;){let L=Math.min(w,O);if(x[M]===void 0)break;if(x[M].copyCellsFrom(x[D],w-L,O-L,L,!0),O-=L,O===0&&(M--,O=I[M]),w-=L,w===0){D--;let A=Math.max(D,0);w=(0,g.getWrappedLineTrimmedLength)(x,A,this._cols)}}for(let L=0;L<x.length;L++)I[L]<o&&x[L].setCell(I[L],v);let E=R-W;for(;E-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+S)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+R,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let M=0;M<this.lines.length;M++)m.push(this.lines.get(M));let x=this.lines.length,T=x-1,P=0,I=C[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+S);let R=0;for(let M=Math.min(this.lines.maxLength-1,x+S-1);M>=0;M--)if(I&&I.start>T+R){for(let O=I.newLines.length-1;O>=0;O--)this.lines.set(M--,I.newLines[O]);M++,y.push({index:T+1,amount:I.newLines.length}),R+=I.newLines.length,I=C[++P]}else this.lines.set(M,m[T--]);let W=0;for(let M=y.length-1;M>=0;M--)y[M].index+=W,this.lines.onInsertEmitter.fire(y[M]),W+=y[M].amount;let B=Math.max(0,x+S-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(o,u,v=0,C){let S=this.lines.get(o);return S?S.translateToString(u,v,C):""}getWrappedRangeForLine(o){let u=o,v=o;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:u,last:v}}setupTabStops(o){for(o!=null?this.tabs[o]||(o=this.prevStop(o)):(this.tabs={},o=0);o<this._cols;o+=this._optionsService.rawOptions.tabStopWidth)this.tabs[o]=!0}prevStop(o){for(o==null&&(o=this.x);!this.tabs[--o]&&o>0;);return o>=this._cols?this._cols-1:o<0?0:o}nextStop(o){for(o==null&&(o=this.x);!this.tabs[++o]&&o<this._cols;);return o>=this._cols?this._cols-1:o<0?0:o}clearMarkers(o){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===o&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let o=0;o<this.markers.length;o++)this.markers[o].dispose(),this.markers.splice(o--,1);this._isClearing=!1}addMarker(o){let u=new a.Marker(o);return this.markers.push(u),u.register(this.lines.onTrim(v=>{u.line-=v,u.line<0&&u.dispose()})),u.register(this.lines.onInsert(v=>{u.line>=v.index&&(u.line+=v.amount)})),u.register(this.lines.onDelete(v=>{u.line>=v.index&&u.line<v.index+v.amount&&u.dispose(),u.line>v.index&&(u.line-=v.amount)})),u.register(u.onDispose(()=>this._removeMarker(u))),u}_removeMarker(o){this._isClearing||this.markers.splice(this.markers.indexOf(o),1)}}},8437:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;let l=s(3734),_=s(511),n=s(643),f=s(482);i.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let g=0;class b{constructor(a,c,o=!1){this.isWrapped=o,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);let u=c||_.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let v=0;v<a;++v)this.setCell(v,u);this.length=a}get(a){let c=this._data[3*a+0],o=2097151&c;return[this._data[3*a+1],2097152&c?this._combined[a]:o?(0,f.stringFromCodePoint)(o):"",c>>22,2097152&c?this._combined[a].charCodeAt(this._combined[a].length-1):o]}set(a,c){this._data[3*a+1]=c[n.CHAR_DATA_ATTR_INDEX],c[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=c[1],this._data[3*a+0]=2097152|a|c[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=c[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|c[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(a){return this._data[3*a+0]>>22}hasWidth(a){return 12582912&this._data[3*a+0]}getFg(a){return this._data[3*a+1]}getBg(a){return this._data[3*a+2]}hasContent(a){return 4194303&this._data[3*a+0]}getCodePoint(a){let c=this._data[3*a+0];return 2097152&c?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&c}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){let c=this._data[3*a+0];return 2097152&c?this._combined[a]:2097151&c?(0,f.stringFromCodePoint)(2097151&c):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,c){return g=3*a,c.content=this._data[g+0],c.fg=this._data[g+1],c.bg=this._data[g+2],2097152&c.content&&(c.combinedData=this._combined[a]),268435456&c.bg&&(c.extended=this._extendedAttrs[a]),c}setCell(a,c){2097152&c.content&&(this._combined[a]=c.combinedData),268435456&c.bg&&(this._extendedAttrs[a]=c.extended),this._data[3*a+0]=c.content,this._data[3*a+1]=c.fg,this._data[3*a+2]=c.bg}setCellFromCodepoint(a,c,o,u){268435456&u.bg&&(this._extendedAttrs[a]=u.extended),this._data[3*a+0]=c|o<<22,this._data[3*a+1]=u.fg,this._data[3*a+2]=u.bg}addCodepointToCell(a,c,o){let u=this._data[3*a+0];2097152&u?this._combined[a]+=(0,f.stringFromCodePoint)(c):2097151&u?(this._combined[a]=(0,f.stringFromCodePoint)(2097151&u)+(0,f.stringFromCodePoint)(c),u&=-2097152,u|=2097152):u=c|4194304,o&&(u&=-12582913,u|=o<<22),this._data[3*a+0]=u}insertCells(a,c,o){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,o),c<this.length-a){let u=new _.CellData;for(let v=this.length-a-c-1;v>=0;--v)this.setCell(a+c+v,this.loadCell(a+v,u));for(let v=0;v<c;++v)this.setCell(a+v,o)}else for(let u=a;u<this.length;++u)this.setCell(u,o);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,o)}deleteCells(a,c,o){if(a%=this.length,c<this.length-a){let u=new _.CellData;for(let v=0;v<this.length-a-c;++v)this.setCell(a+v,this.loadCell(a+c+v,u));for(let v=this.length-c;v<this.length;++v)this.setCell(v,o)}else for(let u=a;u<this.length;++u)this.setCell(u,o);a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,o),this.getWidth(a)!==0||this.hasContent(a)||this.setCellFromCodepoint(a,0,1,o)}replaceCells(a,c,o,u=!1){if(u)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodepoint(a-1,0,1,o),c<this.length&&this.getWidth(c-1)===2&&!this.isProtected(c)&&this.setCellFromCodepoint(c,0,1,o);a<c&&a<this.length;)this.isProtected(a)||this.setCell(a,o),a++;else for(a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,o),c<this.length&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c,0,1,o);a<c&&a<this.length;)this.setCell(a++,o)}resize(a,c){if(a===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let o=3*a;if(a>this.length){if(this._data.buffer.byteLength>=4*o)this._data=new Uint32Array(this._data.buffer,0,o);else{let u=new Uint32Array(o);u.set(this._data),this._data=u}for(let u=this.length;u<a;++u)this.setCell(u,c)}else{this._data=this._data.subarray(0,o);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let S=parseInt(u[C],10);S>=a&&delete this._combined[S]}let v=Object.keys(this._extendedAttrs);for(let C=0;C<v.length;C++){let S=parseInt(v[C],10);S>=a&&delete this._extendedAttrs[S]}}return this.length=a,4*o*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let a=new Uint32Array(this._data.length);return a.set(this._data),this._data=a,1}return 0}fill(a,c=!1){if(c)for(let o=0;o<this.length;++o)this.isProtected(o)||this.setCell(o,a);else{this._combined={},this._extendedAttrs={};for(let o=0;o<this.length;++o)this.setCell(o,a)}}copyFrom(a){this.length!==a.length?this._data=new Uint32Array(a._data):this._data.set(a._data),this.length=a.length,this._combined={};for(let c in a._combined)this._combined[c]=a._combined[c];this._extendedAttrs={};for(let c in a._extendedAttrs)this._extendedAttrs[c]=a._extendedAttrs[c];this.isWrapped=a.isWrapped}clone(){let a=new b(0);a._data=new Uint32Array(this._data),a.length=this.length;for(let c in this._combined)a._combined[c]=this._combined[c];for(let c in this._extendedAttrs)a._extendedAttrs[c]=this._extendedAttrs[c];return a.isWrapped=this.isWrapped,a}getTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0])return a+(this._data[3*a+0]>>22);return 0}getNoBgTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0]||50331648&this._data[3*a+2])return a+(this._data[3*a+0]>>22);return 0}copyCellsFrom(a,c,o,u,v){let C=a._data;if(v)for(let y=u-1;y>=0;y--){for(let m=0;m<3;m++)this._data[3*(o+y)+m]=C[3*(c+y)+m];268435456&C[3*(c+y)+2]&&(this._extendedAttrs[o+y]=a._extendedAttrs[c+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(o+y)+m]=C[3*(c+y)+m];268435456&C[3*(c+y)+2]&&(this._extendedAttrs[o+y]=a._extendedAttrs[c+y])}let S=Object.keys(a._combined);for(let y=0;y<S.length;y++){let m=parseInt(S[y],10);m>=c&&(this._combined[m-c+o]=a._combined[m])}}translateToString(a,c,o,u){c=c??0,o=o??this.length,a&&(o=Math.min(o,this.getTrimmedLength())),u&&(u.length=0);let v="";for(;c<o;){let C=this._data[3*c+0],S=2097151&C,y=2097152&C?this._combined[c]:S?(0,f.stringFromCodePoint)(S):n.WHITESPACE_CELL_CHAR;if(v+=y,u)for(let m=0;m<y.length;++m)u.push(c);c+=C>>22||1}return u&&u.push(c),v}}i.BufferLine=b},4841:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(s,l){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return l*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}},4634:(h,i)=>{function s(l,_,n){if(_===l.length-1)return l[_].getTrimmedLength();let f=!l[_].hasContent(n-1)&&l[_].getWidth(n-1)===1,g=l[_+1].getWidth(0)===2;return f&&g?n-1:n}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(l,_,n,f,g){let b=[];for(let p=0;p<l.length-1;p++){let a=p,c=l.get(++a);if(!c.isWrapped)continue;let o=[l.get(p)];for(;a<l.length&&c.isWrapped;)o.push(c),c=l.get(++a);if(f>=p&&f<a){p+=o.length-1;continue}let u=0,v=s(o,u,_),C=1,S=0;for(;C<o.length;){let m=s(o,C,_),x=m-S,T=n-v,P=Math.min(x,T);o[u].copyCellsFrom(o[C],S,v,P,!1),v+=P,v===n&&(u++,v=0),S+=P,S===m&&(C++,S=0),v===0&&u!==0&&o[u-1].getWidth(n-1)===2&&(o[u].copyCellsFrom(o[u-1],n-1,v++,1,!1),o[u-1].setCell(n-1,g))}o[u].replaceCells(v,n,g);let y=0;for(let m=o.length-1;m>0&&(m>u||o[m].getTrimmedLength()===0);m--)y++;y>0&&(b.push(p+o.length-y),b.push(y)),p+=o.length-1}return b},i.reflowLargerCreateNewLayout=function(l,_){let n=[],f=0,g=_[f],b=0;for(let p=0;p<l.length;p++)if(g===p){let a=_[++f];l.onDeleteEmitter.fire({index:p-b,amount:a}),p+=a-1,b+=a,g=_[++f]}else n.push(p);return{layout:n,countRemoved:b}},i.reflowLargerApplyNewLayout=function(l,_){let n=[];for(let f=0;f<_.length;f++)n.push(l.get(_[f]));for(let f=0;f<n.length;f++)l.set(f,n[f]);l.length=_.length},i.reflowSmallerGetNewLineLengths=function(l,_,n){let f=[],g=l.map((c,o)=>s(l,o,_)).reduce((c,o)=>c+o),b=0,p=0,a=0;for(;a<g;){if(g-a<n){f.push(g-a);break}b+=n;let c=s(l,p,_);b>c&&(b-=c,p++);let o=l[p].getWidth(b-1)===2;o&&b--;let u=o?n-1:n;f.push(u),a+=u}return f},i.getWrappedLineTrimmedLength=s},5295:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;let l=s(8460),_=s(844),n=s(9092);class f extends _.Disposable{constructor(b,p){super(),this._optionsService=b,this._bufferService=p,this._onBufferActivate=this.register(new l.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(b){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(b),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(b,p){this._normal.resize(b,p),this._alt.resize(b,p),this.setupTabStops(b)}setupTabStops(b){this._normal.setupTabStops(b),this._alt.setupTabStops(b)}}i.BufferSet=f},511:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;let l=s(482),_=s(643),n=s(3734);class f extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(b){let p=new f;return p.setFromCharData(b),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(b){this.fg=b[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(b[_.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(b[_.CHAR_DATA_CHAR_INDEX].length===2){let a=b[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){let c=b[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=c&&c<=57343?this.content=1024*(a-55296)+c-56320+65536|b[_.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=b[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[_.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=b[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|b[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=f},643:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;let l=s(8460),_=s(844);class n{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new l.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(g){return this._disposables.push(g),g}}i.Marker=n,n._nextId=1},7116:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.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"},i.CHARSETS.A={"#":"\xA3"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},i.CHARSETS.C=i.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},i.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},i.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},i.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},i.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},i.CHARSETS.E=i.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},i.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},i.CHARSETS.H=i.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},i.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(h,i)=>{var s,l,_;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
|
|
8
|
+
`,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL="\x7F"}(s||(i.C0=s={})),function(n){n.PAD="\x80",n.HOP="\x81",n.BPH="\x82",n.NBH="\x83",n.IND="\x84",n.NEL="\x85",n.SSA="\x86",n.ESA="\x87",n.HTS="\x88",n.HTJ="\x89",n.VTS="\x8A",n.PLD="\x8B",n.PLU="\x8C",n.RI="\x8D",n.SS2="\x8E",n.SS3="\x8F",n.DCS="\x90",n.PU1="\x91",n.PU2="\x92",n.STS="\x93",n.CCH="\x94",n.MW="\x95",n.SPA="\x96",n.EPA="\x97",n.SOS="\x98",n.SGCI="\x99",n.SCI="\x9A",n.CSI="\x9B",n.ST="\x9C",n.OSC="\x9D",n.PM="\x9E",n.APC="\x9F"}(l||(i.C1=l={})),function(n){n.ST=`${s.ESC}\\`}(_||(i.C1_ESCAPED=_={}))},7399:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;let l=s(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:["'",'"']};i.evaluateKeyboardEvent=function(n,f,g,b){let p={type:0,cancel:!1,key:void 0},a=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?p.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?p.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?p.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(p.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:p.key=n.ctrlKey?"\b":l.C0.DEL,n.altKey&&(p.key=l.C0.ESC+p.key);break;case 9:if(n.shiftKey){p.key=l.C0.ESC+"[Z";break}p.key=l.C0.HT,p.cancel=!0;break;case 13:p.key=n.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,p.cancel=!0;break;case 27:p.key=l.C0.ESC,n.altKey&&(p.key=l.C0.ESC+l.C0.ESC),p.cancel=!0;break;case 37:if(n.metaKey)break;a?(p.key=l.C0.ESC+"[1;"+(a+1)+"D",p.key===l.C0.ESC+"[1;3D"&&(p.key=l.C0.ESC+(g?"b":"[1;5D"))):p.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(n.metaKey)break;a?(p.key=l.C0.ESC+"[1;"+(a+1)+"C",p.key===l.C0.ESC+"[1;3C"&&(p.key=l.C0.ESC+(g?"f":"[1;5C"))):p.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(n.metaKey)break;a?(p.key=l.C0.ESC+"[1;"+(a+1)+"A",g||p.key!==l.C0.ESC+"[1;3A"||(p.key=l.C0.ESC+"[1;5A")):p.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(n.metaKey)break;a?(p.key=l.C0.ESC+"[1;"+(a+1)+"B",g||p.key!==l.C0.ESC+"[1;3B"||(p.key=l.C0.ESC+"[1;5B")):p.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(p.key=l.C0.ESC+"[2~");break;case 46:p.key=a?l.C0.ESC+"[3;"+(a+1)+"~":l.C0.ESC+"[3~";break;case 36:p.key=a?l.C0.ESC+"[1;"+(a+1)+"H":f?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:p.key=a?l.C0.ESC+"[1;"+(a+1)+"F":f?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:n.shiftKey?p.type=2:n.ctrlKey?p.key=l.C0.ESC+"[5;"+(a+1)+"~":p.key=l.C0.ESC+"[5~";break;case 34:n.shiftKey?p.type=3:n.ctrlKey?p.key=l.C0.ESC+"[6;"+(a+1)+"~":p.key=l.C0.ESC+"[6~";break;case 112:p.key=a?l.C0.ESC+"[1;"+(a+1)+"P":l.C0.ESC+"OP";break;case 113:p.key=a?l.C0.ESC+"[1;"+(a+1)+"Q":l.C0.ESC+"OQ";break;case 114:p.key=a?l.C0.ESC+"[1;"+(a+1)+"R":l.C0.ESC+"OR";break;case 115:p.key=a?l.C0.ESC+"[1;"+(a+1)+"S":l.C0.ESC+"OS";break;case 116:p.key=a?l.C0.ESC+"[15;"+(a+1)+"~":l.C0.ESC+"[15~";break;case 117:p.key=a?l.C0.ESC+"[17;"+(a+1)+"~":l.C0.ESC+"[17~";break;case 118:p.key=a?l.C0.ESC+"[18;"+(a+1)+"~":l.C0.ESC+"[18~";break;case 119:p.key=a?l.C0.ESC+"[19;"+(a+1)+"~":l.C0.ESC+"[19~";break;case 120:p.key=a?l.C0.ESC+"[20;"+(a+1)+"~":l.C0.ESC+"[20~";break;case 121:p.key=a?l.C0.ESC+"[21;"+(a+1)+"~":l.C0.ESC+"[21~";break;case 122:p.key=a?l.C0.ESC+"[23;"+(a+1)+"~":l.C0.ESC+"[23~";break;case 123:p.key=a?l.C0.ESC+"[24;"+(a+1)+"~":l.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(g&&!b||!n.altKey||n.metaKey)!g||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?p.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(p.key=l.C0.US),n.key==="@"&&(p.key=l.C0.NUL)):n.keyCode===65&&(p.type=1);else{let c=_[n.keyCode],o=c?.[n.shiftKey?1:0];if(o)p.key=l.C0.ESC+o;else if(n.keyCode>=65&&n.keyCode<=90){let u=n.ctrlKey?n.keyCode-64:n.keyCode+32,v=String.fromCharCode(u);n.shiftKey&&(v=v.toUpperCase()),p.key=l.C0.ESC+v}else if(n.keyCode===32)p.key=l.C0.ESC+(n.ctrlKey?l.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let u=n.code.slice(3,4);n.shiftKey||(u=u.toLowerCase()),p.key=l.C0.ESC+u,p.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?p.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?p.key=l.C0.NUL:n.keyCode>=51&&n.keyCode<=55?p.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?p.key=l.C0.DEL:n.keyCode===219?p.key=l.C0.ESC:n.keyCode===220?p.key=l.C0.FS:n.keyCode===221&&(p.key=l.C0.GS)}return p}},482:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(s){return s>65535?(s-=65536,String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)},i.utf32ToString=function(s,l=0,_=s.length){let n="";for(let f=l;f<_;++f){let g=s[f];g>65535?(g-=65536,n+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):n+=String.fromCharCode(g)}return n},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(s,l){let _=s.length;if(!_)return 0;let n=0,f=0;if(this._interim){let g=s.charCodeAt(f++);56320<=g&&g<=57343?l[n++]=1024*(this._interim-55296)+g-56320+65536:(l[n++]=this._interim,l[n++]=g),this._interim=0}for(let g=f;g<_;++g){let b=s.charCodeAt(g);if(55296<=b&&b<=56319){if(++g>=_)return this._interim=b,n;let p=s.charCodeAt(g);56320<=p&&p<=57343?l[n++]=1024*(b-55296)+p-56320+65536:(l[n++]=b,l[n++]=p)}else b!==65279&&(l[n++]=b)}return n}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(s,l){let _=s.length;if(!_)return 0;let n,f,g,b,p=0,a=0,c=0;if(this.interim[0]){let v=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let S,y=0;for(;(S=63&this.interim[++y])&&y<4;)C<<=6,C|=S;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=m-y;for(;c<x;){if(c>=_)return 0;if(S=s[c++],(192&S)!=128){c--,v=!0;break}this.interim[y++]=S,C<<=6,C|=63&S}v||(m===2?C<128?c--:l[p++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(l[p++]=C):C<65536||C>1114111||(l[p++]=C)),this.interim.fill(0)}let o=_-4,u=c;for(;u<_;){for(;!(!(u<o)||128&(n=s[u])||128&(f=s[u+1])||128&(g=s[u+2])||128&(b=s[u+3]));)l[p++]=n,l[p++]=f,l[p++]=g,l[p++]=b,u+=4;if(n=s[u++],n<128)l[p++]=n;else if((224&n)==192){if(u>=_)return this.interim[0]=n,p;if(f=s[u++],(192&f)!=128){u--;continue}if(a=(31&n)<<6|63&f,a<128){u--;continue}l[p++]=a}else if((240&n)==224){if(u>=_)return this.interim[0]=n,p;if(f=s[u++],(192&f)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,p;if(g=s[u++],(192&g)!=128){u--;continue}if(a=(15&n)<<12|(63&f)<<6|63&g,a<2048||a>=55296&&a<=57343||a===65279)continue;l[p++]=a}else if((248&n)==240){if(u>=_)return this.interim[0]=n,p;if(f=s[u++],(192&f)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,p;if(g=s[u++],(192&g)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,this.interim[2]=g,p;if(b=s[u++],(192&b)!=128){u--;continue}if(a=(7&n)<<18|(63&f)<<12|(63&g)<<6|63&b,a<65536||a>1114111)continue;l[p++]=a}}return p}}},225:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;let l=s(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]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],f;i.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let g=0;g<_.length;++g)f.fill(0,_[g][0],_[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?f[g]:function(b,p){let a,c=0,o=p.length-1;if(b<p[0][0]||b>p[o][1])return!1;for(;o>=c;)if(a=c+o>>1,b>p[a][1])c=a+1;else{if(!(b<p[a][0]))return!0;o=a-1}return!1}(g,n)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,b){let p=this.wcwidth(g),a=p===0&&b!==0;if(a){let c=l.UnicodeService.extractWidth(b);c===0?a=!1:c>p&&(p=c)}return l.UnicodeService.createPropertyValue(0,p,a)}}},5981:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;let l=s(8460),_=s(844);class n extends _.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,b){if(b!==void 0&&this._syncCalls>b)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,b){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+=g.length,this._writeBuffer.push(g),this._callbacks.push(b),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(b)}_innerWrite(g=0,b=!0){let p=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let a=this._writeBuffer[this._bufferOffset],c=this._action(a,b);if(c){let u=v=>Date.now()-p>=12?setTimeout(()=>this._innerWrite(0,v)):this._innerWrite(p,v);return void c.catch(v=>(queueMicrotask(()=>{throw v}),Promise.resolve(!1))).then(u)}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=a.length,Date.now()-p>=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()}}i.WriteBuffer=n},5941:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.toRgbString=i.parseColor=void 0;let s=/^([\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})$/,l=/^[\da-f]+$/;function _(n,f){let g=n.toString(16),b=g.length<2?"0"+g:g;switch(f){case 4:return g[0];case 8:return b;case 12:return(b+b).slice(0,3);default:return b+b}}i.parseColor=function(n){if(!n)return;let f=n.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);let g=s.exec(f);if(g){let b=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/b*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/b*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/b*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),l.exec(f)&&[3,6,9,12].includes(f.length))){let g=f.length/3,b=[0,0,0];for(let p=0;p<3;++p){let a=parseInt(f.slice(g*p,g*p+g),16);b[p]=g===1?a<<4:g===2?a:g===3?a>>4:a>>8}return b}},i.toRgbString=function(n,f=16){let[g,b,p]=n;return`rgb:${_(g,f)}/${_(b,f)}/${_(p,f)}`}},5770:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;let l=s(482),_=s(8742),n=s(5770),f=[];i.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(b,p){this._handlers[b]===void 0&&(this._handlers[b]=[]);let a=this._handlers[b];return a.push(p),{dispose:()=>{let c=a.indexOf(p);c!==-1&&a.splice(c,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}reset(){if(this._active.length)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(b,p){if(this.reset(),this._ident=b,this._active=this._handlers[b]||f,this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(b,p,a){if(this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].put(b,p,a);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(b,p,a))}unhook(b,p=!0){if(this._active.length){let a=!1,c=this._active.length-1,o=!1;if(this._stack.paused&&(c=this._stack.loopPosition-1,a=p,o=this._stack.fallThrough,this._stack.paused=!1),!o&&a===!1){for(;c>=0&&(a=this._active[c].unhook(b),a!==!0);c--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!1,a;c--}for(;c>=0;c--)if(a=this._active[c].unhook(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",b);this._active=f,this._ident=0}};let g=new _.Params;g.addParam(0),i.DcsHandler=class{constructor(b){this._handler=b,this._data="",this._params=g,this._hitLimit=!1}hook(b){this._params=b.length>1||b.params[0]?b.clone():g,this._data="",this._hitLimit=!1}put(b,p,a){this._hitLimit||(this._data+=(0,l.utf32ToString)(b,p,a),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(b){let p=!1;if(this._hitLimit)p=!1;else if(b&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then(a=>(this._params=g,this._data="",this._hitLimit=!1,a));return this._params=g,this._data="",this._hitLimit=!1,p}}},2015:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;let l=s(844),_=s(8742),n=s(6242),f=s(6351);class g{constructor(c){this.table=new Uint8Array(c)}setDefault(c,o){this.table.fill(c<<4|o)}add(c,o,u,v){this.table[o<<8|c]=u<<4|v}addMany(c,o,u,v){for(let C=0;C<c.length;C++)this.table[o<<8|c[C]]=u<<4|v}}i.TransitionTable=g;let b=160;i.VT500_TRANSITION_TABLE=function(){let a=new g(4095),c=Array.apply(null,Array(256)).map((y,m)=>m),o=(y,m)=>c.slice(y,m),u=o(32,127),v=o(0,24);v.push(25),v.push.apply(v,o(28,32));let C=o(0,14),S;for(S in a.setDefault(1,0),a.addMany(u,0,2,0),C)a.addMany([24,26,153,154],S,3,0),a.addMany(o(128,144),S,3,0),a.addMany(o(144,152),S,3,0),a.add(156,S,0,0),a.add(27,S,11,1),a.add(157,S,4,8),a.addMany([152,158,159],S,0,7),a.add(155,S,11,3),a.add(144,S,11,9);return a.addMany(v,0,3,0),a.addMany(v,1,3,1),a.add(127,1,0,1),a.addMany(v,8,0,8),a.addMany(v,3,3,3),a.add(127,3,0,3),a.addMany(v,4,3,4),a.add(127,4,0,4),a.addMany(v,6,3,6),a.addMany(v,5,3,5),a.add(127,5,0,5),a.addMany(v,2,3,2),a.add(127,2,0,2),a.add(93,1,4,8),a.addMany(u,8,5,8),a.add(127,8,5,8),a.addMany([156,27,24,26,7],8,6,0),a.addMany(o(28,32),8,0,8),a.addMany([88,94,95],1,0,7),a.addMany(u,7,0,7),a.addMany(v,7,0,7),a.add(156,7,0,0),a.add(127,7,0,7),a.add(91,1,11,3),a.addMany(o(64,127),3,7,0),a.addMany(o(48,60),3,8,4),a.addMany([60,61,62,63],3,9,4),a.addMany(o(48,60),4,8,4),a.addMany(o(64,127),4,7,0),a.addMany([60,61,62,63],4,0,6),a.addMany(o(32,64),6,0,6),a.add(127,6,0,6),a.addMany(o(64,127),6,0,0),a.addMany(o(32,48),3,9,5),a.addMany(o(32,48),5,9,5),a.addMany(o(48,64),5,0,6),a.addMany(o(64,127),5,7,0),a.addMany(o(32,48),4,9,5),a.addMany(o(32,48),1,9,2),a.addMany(o(32,48),2,9,2),a.addMany(o(48,127),2,10,0),a.addMany(o(48,80),1,10,0),a.addMany(o(81,88),1,10,0),a.addMany([89,90,92],1,10,0),a.addMany(o(96,127),1,10,0),a.add(80,1,11,9),a.addMany(v,9,0,9),a.add(127,9,0,9),a.addMany(o(28,32),9,0,9),a.addMany(o(32,48),9,9,12),a.addMany(o(48,60),9,8,10),a.addMany([60,61,62,63],9,9,10),a.addMany(v,11,0,11),a.addMany(o(32,128),11,0,11),a.addMany(o(28,32),11,0,11),a.addMany(v,10,0,10),a.add(127,10,0,10),a.addMany(o(28,32),10,0,10),a.addMany(o(48,60),10,8,10),a.addMany([60,61,62,63],10,0,11),a.addMany(o(32,48),10,9,12),a.addMany(v,12,0,12),a.add(127,12,0,12),a.addMany(o(28,32),12,0,12),a.addMany(o(32,48),12,9,12),a.addMany(o(48,64),12,0,11),a.addMany(o(64,127),12,12,13),a.addMany(o(64,127),10,12,13),a.addMany(o(64,127),9,12,13),a.addMany(v,13,13,13),a.addMany(u,13,13,13),a.add(127,13,0,13),a.addMany([27,156,24,26],13,14,0),a.add(b,0,2,0),a.add(b,8,5,8),a.add(b,6,0,6),a.add(b,11,0,11),a.add(b,13,13,13),a}();class p extends l.Disposable{constructor(c=i.VT500_TRANSITION_TABLE){super(),this._transitions=c,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=(o,u,v)=>{},this._executeHandlerFb=o=>{},this._csiHandlerFb=(o,u)=>{},this._escHandlerFb=o=>{},this._errorHandlerFb=o=>o,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,l.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(c,o=[64,126]){let u=0;if(c.prefix){if(c.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=c.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(c.intermediates){if(c.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<c.intermediates.length;++C){let S=c.intermediates.charCodeAt(C);if(32>S||S>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=S}}if(c.final.length!==1)throw new Error("final must be a single byte");let v=c.final.charCodeAt(0);if(o[0]>v||v>o[1])throw new Error(`final must be in range ${o[0]} .. ${o[1]}`);return u<<=8,u|=v,u}identToString(c){let o=[];for(;c;)o.push(String.fromCharCode(255&c)),c>>=8;return o.reverse().join("")}setPrintHandler(c){this._printHandler=c}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(c,o){let u=this._identifier(c,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let v=this._escHandlers[u];return v.push(o),{dispose:()=>{let C=v.indexOf(o);C!==-1&&v.splice(C,1)}}}clearEscHandler(c){this._escHandlers[this._identifier(c,[48,126])]&&delete this._escHandlers[this._identifier(c,[48,126])]}setEscHandlerFallback(c){this._escHandlerFb=c}setExecuteHandler(c,o){this._executeHandlers[c.charCodeAt(0)]=o}clearExecuteHandler(c){this._executeHandlers[c.charCodeAt(0)]&&delete this._executeHandlers[c.charCodeAt(0)]}setExecuteHandlerFallback(c){this._executeHandlerFb=c}registerCsiHandler(c,o){let u=this._identifier(c);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let v=this._csiHandlers[u];return v.push(o),{dispose:()=>{let C=v.indexOf(o);C!==-1&&v.splice(C,1)}}}clearCsiHandler(c){this._csiHandlers[this._identifier(c)]&&delete this._csiHandlers[this._identifier(c)]}setCsiHandlerFallback(c){this._csiHandlerFb=c}registerDcsHandler(c,o){return this._dcsParser.registerHandler(this._identifier(c),o)}clearDcsHandler(c){this._dcsParser.clearHandler(this._identifier(c))}setDcsHandlerFallback(c){this._dcsParser.setHandlerFallback(c)}registerOscHandler(c,o){return this._oscParser.registerHandler(c,o)}clearOscHandler(c){this._oscParser.clearHandler(c)}setOscHandlerFallback(c){this._oscParser.setHandlerFallback(c)}setErrorHandler(c){this._errorHandler=c}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(c,o,u,v,C){this._parseStack.state=c,this._parseStack.handlers=o,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=C}parse(c,o,u){let v,C=0,S=0,y=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,y=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let m=this._parseStack.handlers,x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](this._params),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 6:if(C=c[this._parseStack.chunkPos],v=this._dcsParser.unhook(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=c[this._parseStack.chunkPos],v=this._oscParser.end(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,y=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let m=y;m<o;++m){switch(C=c[m],S=this._transitions.table[this.currentState<<8|(C<160?C:b)],S>>4){case 2:for(let R=m+1;;++R){if(R>=o||(C=c[R])<32||C>126&&C<b){this._printHandler(c,m,R),m=R-1;break}if(++R>=o||(C=c[R])<32||C>126&&C<b){this._printHandler(c,m,R),m=R-1;break}if(++R>=o||(C=c[R])<32||C>126&&C<b){this._printHandler(c,m,R),m=R-1;break}if(++R>=o||(C=c[R])<32||C>126&&C<b){this._printHandler(c,m,R),m=R-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:m,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let x=this._csiHandlers[this._collect<<8|C],T=x?x.length-1:-1;for(;T>=0&&(v=x[T](this._params),v!==!0);T--)if(v instanceof Promise)return this._preserveStack(3,x,T,S,m),v;T<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++m<o&&(C=c[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let P=this._escHandlers[this._collect<<8|C],I=P?P.length-1:-1;for(;I>=0&&(v=P[I](),v!==!0);I--)if(v instanceof Promise)return this._preserveStack(4,P,I,S,m),v;I<0&&this._escHandlerFb(this._collect<<8|C),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|C,this._params);break;case 13:for(let R=m+1;;++R)if(R>=o||(C=c[R])===24||C===26||C===27||C>127&&C<b){this._dcsParser.put(c,m,R),m=R-1;break}break;case 14:if(v=this._dcsParser.unhook(C!==24&&C!==26),v)return this._preserveStack(6,[],0,S,m),v;C===27&&(S|=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 R=m+1;;R++)if(R>=o||(C=c[R])<32||C>127&&C<b){this._oscParser.put(c,m,R),m=R-1;break}break;case 6:if(v=this._oscParser.end(C!==24&&C!==26),v)return this._preserveStack(5,[],0,S,m),v;C===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}i.EscapeSequenceParser=p},6242:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;let l=s(5770),_=s(482),n=[];i.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(f,g){this._handlers[f]===void 0&&(this._handlers[f]=[]);let b=this._handlers[f];return b.push(g),{dispose:()=>{let p=b.indexOf(g);p!==-1&&b.splice(p,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,g,b){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(f,g,b);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(f,g,b))}start(){this.reset(),this._state=1}put(f,g,b){if(this._state!==3){if(this._state===1)for(;g<b;){let p=f[g++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&b-g>0&&this._put(f,g,b)}}end(f,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let b=!1,p=this._active.length-1,a=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,b=g,a=this._stack.fallThrough,this._stack.paused=!1),!a&&b===!1){for(;p>=0&&(b=this._active[p].end(f),b!==!0);p--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,b;p--}for(;p>=0;p--)if(b=this._active[p].end(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,b}else this._handlerFb(this._id,"END",f);this._active=n,this._id=-1,this._state=0}}},i.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,g,b){this._hitLimit||(this._data+=(0,_.utf32ToString)(f,g,b),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let g=!1;if(this._hitLimit)g=!1;else if(f&&(g=this._handler(this._data),g instanceof Promise))return g.then(b=>(this._data="",this._hitLimit=!1,b));return this._data="",this._hitLimit=!1,g}}},8742:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;let s=2147483647;class l{static fromArray(n){let f=new l;if(!n.length)return f;for(let g=Array.isArray(n[0])?1:0;g<n.length;++g){let b=n[g];if(Array.isArray(b))for(let p=0;p<b.length;++p)f.addSubParam(b[p]);else f.addParam(b)}return f}constructor(n=32,f=32){if(this.maxLength=n,this.maxSubParamsLength=f,f>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let n=new l(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){let n=[];for(let f=0;f<this.length;++f){n.push(this.params[f]);let g=this._subParamsIdx[f]>>8,b=255&this._subParamsIdx[f];b-g>0&&n.push(Array.prototype.slice.call(this._subParams,g,b))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>s?s:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>s?s:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let f=this._subParamsIdx[n]>>8,g=255&this._subParamsIdx[n];return g-f>0?this._subParams.subarray(f,g):null}getSubParamsAll(){let n={};for(let f=0;f<this.length;++f){let g=this._subParamsIdx[f]>>8,b=255&this._subParamsIdx[f];b-g>0&&(n[f]=this._subParams.slice(g,b))}return n}addDigit(n){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let g=this._digitIsSub?this._subParams:this.params,b=g[f-1];g[f-1]=~b?Math.min(10*b+n,s):n}}i.Params=l},5741:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AddonManager=void 0,i.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let s=this._addons.length-1;s>=0;s--)this._addons[s].instance.dispose()}loadAddon(s,l){let _={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(_),l.dispose=()=>this._wrappedAddonDispose(_),l.activate(s)}_wrappedAddonDispose(s){if(s.isDisposed)return;let l=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===s){l=_;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");s.isDisposed=!0,s.dispose.apply(s.instance),this._addons.splice(l,1)}}},8771:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;let l=s(3785),_=s(511);i.BufferApiView=class{constructor(n,f){this._buffer=n,this.type=f}init(n){return this._buffer=n,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(n){let f=this._buffer.lines.get(n);if(f)return new l.BufferLineApiView(f)}getNullCell(){return new _.CellData}}},3785:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;let l=s(511);i.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,n){if(!(_<0||_>=this._line.length))return n?(this._line.loadCell(_,n),n):this._line.loadCell(_,new l.CellData)}translateToString(_,n,f){return this._line.translateToString(_,n,f)}}},8285:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;let l=s(8771),_=s(8460),n=s(844);class f extends n.Disposable{constructor(b){super(),this._core=b,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.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)}}i.BufferNamespaceApi=f},7975:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ParserApi=void 0,i.ParserApi=class{constructor(s){this._core=s}registerCsiHandler(s,l){return this._core.registerCsiHandler(s,_=>l(_.toArray()))}addCsiHandler(s,l){return this.registerCsiHandler(s,l)}registerDcsHandler(s,l){return this._core.registerDcsHandler(s,(_,n)=>l(_,n.toArray()))}addDcsHandler(s,l){return this.registerDcsHandler(s,l)}registerEscHandler(s,l){return this._core.registerEscHandler(s,l)}addEscHandler(s,l){return this.registerEscHandler(s,l)}registerOscHandler(s,l){return this._core.registerOscHandler(s,l)}addOscHandler(s,l){return this.registerOscHandler(s,l)}}},7090:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.UnicodeApi=class{constructor(s){this._core=s}register(s){this._core.unicodeService.register(s)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(s){this._core.unicodeService.activeVersion=s}}},744:function(h,i,s){var l=this&&this.__decorate||function(a,c,o,u){var v,C=arguments.length,S=C<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(a,c,o,u);else for(var y=a.length-1;y>=0;y--)(v=a[y])&&(S=(C<3?v(S):C>3?v(c,o,S):v(c,o))||S);return C>3&&S&&Object.defineProperty(c,o,S),S},_=this&&this.__param||function(a,c){return function(o,u){c(o,u,a)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;let n=s(8460),f=s(844),g=s(5295),b=s(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let p=i.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(a){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(a.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(a.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(a,this))}resize(a,c){this.cols=a,this.rows=c,this.buffers.resize(a,c),this._onResize.fire({cols:a,rows:c})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(a,c=!1){let o=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===a.fg&&u.getBg(0)===a.bg||(u=o.getBlankLine(a,c),this._cachedBlankLine=u),u.isWrapped=c;let v=o.ybase+o.scrollTop,C=o.ybase+o.scrollBottom;if(o.scrollTop===0){let S=o.lines.isFull;C===o.lines.length-1?S?o.lines.recycle().copyFrom(u):o.lines.push(u.clone()):o.lines.splice(C+1,0,u.clone()),S?this.isUserScrolling&&(o.ydisp=Math.max(o.ydisp-1,0)):(o.ybase++,this.isUserScrolling||o.ydisp++)}else{let S=C-v+1;o.lines.shiftElements(v+1,S-1,-1),o.lines.set(C,u.clone())}this.isUserScrolling||(o.ydisp=o.ybase),this._onScroll.fire(o.ydisp)}scrollLines(a,c,o){let u=this.buffer;if(a<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else a+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+a,u.ybase),0),v!==u.ydisp&&(c||this._onScroll.fire(u.ydisp))}};i.BufferService=p=l([_(0,b.IOptionsService)],p)},7994:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CharsetService=void 0,i.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(s){this.glevel=s,this.charset=this._charsets[s]}setgCharset(s,l){this._charsets[s]=l,this.glevel===s&&(this.charset=l)}}},1753:function(h,i,s){var l=this&&this.__decorate||function(u,v,C,S){var y,m=arguments.length,x=m<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,C):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,S);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},_=this&&this.__param||function(u,v){return function(C,S){v(C,S,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;let n=s(2585),f=s(8460),g=s(844),b={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,v){let C=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(C|=64,C|=u.action):(C|=3&u.button,4&u.button&&(C|=64),8&u.button&&(C|=128),u.action===32?C|=32:u.action!==0||v||(C|=3)),C}let a=String.fromCharCode,c={DEFAULT:u=>{let v=[p(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${a(v[0])}${a(v[1])}${a(v[2])}`},SGR:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${v}`}},o=i.CoreMouseService=class extends g.Disposable{constructor(u,v){super(),this._bufferService=u,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(b))this.addProtocol(C,b[C]);for(let C of Object.keys(c))this.addEncoding(C,c[C]);this.reset()}addProtocol(u,v){this._protocols[u]=v}addEncoding(u,v){this._encodings[u]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;let v=this._encodings[this._activeEncoding](u);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,v,C){if(C){if(u.x!==v.x||u.y!==v.y)return!1}else if(u.col!==v.col||u.row!==v.row)return!1;return u.button===v.button&&u.action===v.action&&u.ctrl===v.ctrl&&u.alt===v.alt&&u.shift===v.shift}};i.CoreMouseService=o=l([_(0,n.IBufferService),_(1,n.ICoreService)],o)},6975:function(h,i,s){var l=this&&this.__decorate||function(o,u,v,C){var S,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(o,u,v,C);else for(var x=o.length-1;x>=0;x--)(S=o[x])&&(m=(y<3?S(m):y>3?S(u,v,m):S(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},_=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;let n=s(1439),f=s(8460),g=s(844),b=s(2585),p=Object.freeze({insertMode:!1}),a=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),c=i.CoreService=class extends g.Disposable{constructor(o,u,v){super(),this._bufferService=o,this._logService=u,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(a)}reset(){this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(a)}triggerDataEvent(o,u=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${o}"`,()=>o.split("").map(C=>C.charCodeAt(0))),this._onData.fire(o)}triggerBinaryEvent(o){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${o}"`,()=>o.split("").map(u=>u.charCodeAt(0))),this._onBinary.fire(o))}};i.CoreService=c=l([_(0,b.IBufferService),_(1,b.ILogService),_(2,b.IOptionsService)],c)},9074:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;let l=s(8055),_=s(8460),n=s(844),f=s(6106),g=0,b=0;class p extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList(o=>o?.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,n.toDisposable)(()=>this.reset()))}registerDecoration(o){if(o.marker.isDisposed)return;let u=new a(o);if(u){let v=u.marker.onDispose(()=>u.dispose());u.onDispose(()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),v.dispose())}),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(let o of this._decorations.values())o.dispose();this._decorations.clear()}*getDecorationsAtCell(o,u,v){let C=0,S=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,S=C+(y.options.width??1),o>=C&&o<S&&(!v||(y.options.layer??"bottom")===v)&&(yield y)}forEachDecorationAtCell(o,u,v,C){this._decorations.forEachByKey(u,S=>{g=S.options.x??0,b=g+(S.options.width??1),o>=g&&o<b&&(!v||(S.options.layer??"bottom")===v)&&C(S)})}}i.DecorationService=p;class a extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=l.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=l.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(o){super(),this.options=o,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=o.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;let l=s(2585),_=s(8343);class n{constructor(...g){this._entries=new Map;for(let[b,p]of g)this.set(b,p)}set(g,b){let p=this._entries.get(g);return this._entries.set(g,b),p}forEach(g){for(let[b,p]of this._entries.entries())g(b,p)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}i.ServiceCollection=n,i.InstantiationService=class{constructor(){this._services=new n,this._services.set(l.IInstantiationService,this)}setService(f,g){this._services.set(f,g)}getService(f){return this._services.get(f)}createInstance(f,...g){let b=(0,_.getServiceDependencies)(f).sort((c,o)=>c.index-o.index),p=[];for(let c of b){let o=this._services.get(c.id);if(!o)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${c.id}.`);p.push(o)}let a=b.length>0?b[0].index:g.length;if(g.length!==a)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${a+1} conflicts with ${g.length} static arguments`);return new f(...g,...p)}}},7866:function(h,i,s){var l=this&&this.__decorate||function(a,c,o,u){var v,C=arguments.length,S=C<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(a,c,o,u);else for(var y=a.length-1;y>=0;y--)(v=a[y])&&(S=(C<3?v(S):C>3?v(c,o,S):v(c,o))||S);return C>3&&S&&Object.defineProperty(c,o,S),S},_=this&&this.__param||function(a,c){return function(o,u){c(o,u,a)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;let n=s(844),f=s(2585),g={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF},b,p=i.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),b=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let c=0;c<a.length;c++)typeof a[c]=="function"&&(a[c]=a[c]())}_log(a,c,o){this._evalLazyOptionalParams(o),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+c,...o)}trace(a,...c){this._logLevel<=f.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,a,c)}debug(a,...c){this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,a,c)}info(a,...c){this._logLevel<=f.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,a,c)}warn(a,...c){this._logLevel<=f.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,a,c)}error(a,...c){this._logLevel<=f.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,a,c)}};i.LogService=p=l([_(0,f.IOptionsService)],p),i.setTraceLogger=function(a){b=a},i.traceCall=function(a,c,o){if(typeof o.value!="function")throw new Error("not supported");let u=o.value;o.value=function(...v){if(b.logLevel!==f.LogLevelEnum.TRACE)return u.apply(this,v);b.trace(`GlyphRenderer#${u.name}(${v.map(S=>JSON.stringify(S)).join(", ")})`);let C=u.apply(this,v);return b.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;let l=s(8460),_=s(844),n=s(6114);i.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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let f=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends _.Disposable{constructor(p){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;let a={...i.DEFAULT_OPTIONS};for(let c in p)if(c in a)try{let o=p[c];a[c]=this._sanitizeAndValidateOption(c,o)}catch(o){console.error(o)}this.rawOptions=a,this.options={...a},this._setupOptions(),this.register((0,_.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(p,a){return this.onOptionChange(c=>{c===p&&a(this.rawOptions[p])})}onMultipleOptionChange(p,a){return this.onOptionChange(c=>{p.indexOf(c)!==-1&&a()})}_setupOptions(){let p=c=>{if(!(c in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${c}"`);return this.rawOptions[c]},a=(c,o)=>{if(!(c in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${c}"`);o=this._sanitizeAndValidateOption(c,o),this.rawOptions[c]!==o&&(this.rawOptions[c]=o,this._onOptionChange.fire(c))};for(let c in this.rawOptions){let o={get:p.bind(this,c),set:a.bind(this,c)};Object.defineProperty(this.options,c,o)}}_sanitizeAndValidateOption(p,a){switch(p){case"cursorStyle":if(a||(a=i.DEFAULT_OPTIONS[p]),!function(c){return c==="block"||c==="underline"||c==="bar"}(a))throw new Error(`"${a}" is not a valid value for ${p}`);break;case"wordSeparator":a||(a=i.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof a=="number"&&1<=a&&a<=1e3)break;a=f.includes(a)?a:i.DEFAULT_OPTIONS[p];break;case"cursorWidth":a=Math.floor(a);case"lineHeight":case"tabStopWidth":if(a<1)throw new Error(`${p} cannot be less than 1, value: ${a}`);break;case"minimumContrastRatio":a=Math.max(1,Math.min(21,Math.round(10*a)/10));break;case"scrollback":if((a=Math.min(a,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${a}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(a<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${a}`);break;case"rows":case"cols":if(!a&&a!==0)throw new Error(`${p} must be numeric, value: ${a}`);break;case"windowsPty":a=a??{}}return a}}i.OptionsService=g},2660:function(h,i,s){var l=this&&this.__decorate||function(g,b,p,a){var c,o=arguments.length,u=o<3?b:a===null?a=Object.getOwnPropertyDescriptor(b,p):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(g,b,p,a);else for(var v=g.length-1;v>=0;v--)(c=g[v])&&(u=(o<3?c(u):o>3?c(b,p,u):c(b,p))||u);return o>3&&u&&Object.defineProperty(b,p,u),u},_=this&&this.__param||function(g,b){return function(p,a){b(p,a,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;let n=s(2585),f=i.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){let b=this._bufferService.buffer;if(g.id===void 0){let v=b.addMarker(b.ybase+b.y),C={data:g,id:this._nextId++,lines:[v]};return v.onDispose(()=>this._removeMarkerFromLink(C,v)),this._dataByLinkId.set(C.id,C),C.id}let p=g,a=this._getEntryIdKey(p),c=this._entriesWithId.get(a);if(c)return this.addLineToLink(c.id,b.ybase+b.y),c.id;let o=b.addMarker(b.ybase+b.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(u,o)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(g,b){let p=this._dataByLinkId.get(g);if(p&&p.lines.every(a=>a.line!==b)){let a=this._bufferService.buffer.addMarker(b);p.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(p,a))}}getLinkData(g){return this._dataByLinkId.get(g)?.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,b){let p=g.lines.indexOf(b);p!==-1&&(g.lines.splice(p,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};i.OscLinkService=f=l([_(0,n.IBufferService)],f)},8343:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;let s="di$target",l="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(_){return _[l]||[]},i.createDecorator=function(_){if(i.serviceRegistry.has(_))return i.serviceRegistry.get(_);let n=function(f,g,b){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,a,c){a[s]===a?a[l].push({id:p,index:c}):(a[l]=[{id:p,index:c}],a[s]=a)})(n,f,b)};return n.toString=()=>_,i.serviceRegistry.set(_,n),n}},2585:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;let l=s(8343);var _;i.IBufferService=(0,l.createDecorator)("BufferService"),i.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),i.ICoreService=(0,l.createDecorator)("CoreService"),i.ICharsetService=(0,l.createDecorator)("CharsetService"),i.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(_||(i.LogLevelEnum=_={})),i.ILogService=(0,l.createDecorator)("LogService"),i.IOptionsService=(0,l.createDecorator)("OptionsService"),i.IOscLinkService=(0,l.createDecorator)("OscLinkService"),i.IUnicodeService=(0,l.createDecorator)("UnicodeService"),i.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(h,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;let l=s(8460),_=s(225);class n{static extractShouldJoin(g){return(1&g)!=0}static extractWidth(g){return g>>1&3}static extractCharKind(g){return g>>3}static createPropertyValue(g,b,p=!1){return(16777215&g)<<3|(3&b)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;let g=new _.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(g){if(!this._providers[g])throw new Error(`unknown Unicode version "${g}"`);this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)}register(g){this._providers[g.version]=g}wcwidth(g){return this._activeProvider.wcwidth(g)}getStringCellWidth(g){let b=0,p=0,a=g.length;for(let c=0;c<a;++c){let o=g.charCodeAt(c);if(55296<=o&&o<=56319){if(++c>=a)return b+this.wcwidth(o);let C=g.charCodeAt(c);56320<=C&&C<=57343?o=1024*(o-55296)+C-56320+65536:b+=this.wcwidth(C)}let u=this.charProperties(o,p),v=n.extractWidth(u);n.extractShouldJoin(u)&&(v-=n.extractWidth(p)),b+=v,p=u}return b}charProperties(g,b){return this._activeProvider.charProperties(g,b)}}i.UnicodeService=n}},t={};function r(h){var i=t[h];if(i!==void 0)return i.exports;var s=t[h]={exports:{}};return e[h].call(s.exports,s,s.exports,r),s.exports}var d={};return(()=>{var h=d;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;let i=r(9042),s=r(3236),l=r(844),_=r(5741),n=r(8285),f=r(7975),g=r(7090),b=["cols","rows"];class p extends l.Disposable{constructor(c){super(),this._core=this.register(new s.Terminal(c)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};let o=v=>this._core.options[v],u=(v,C)=>{this._checkReadonlyOptions(v),this._core.options[v]=C};for(let v in this._core.options){let C={get:o.bind(this,v),set:u.bind(this,v)};Object.defineProperty(this._publicOptions,v,C)}}_checkReadonlyOptions(c){if(b.includes(c))throw new Error(`Option "${c}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let c=this._core.coreService.decPrivateModes,o="none";switch(this._core.coreMouseService.activeProtocol){case"X10":o="x10";break;case"VT200":o="vt200";break;case"DRAG":o="drag";break;case"ANY":o="any"}return{applicationCursorKeysMode:c.applicationCursorKeys,applicationKeypadMode:c.applicationKeypad,bracketedPasteMode:c.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:o,originMode:c.origin,reverseWraparoundMode:c.reverseWraparound,sendFocusMode:c.sendFocus,wraparoundMode:c.wraparound}}get options(){return this._publicOptions}set options(c){for(let o in c)this._publicOptions[o]=c[o]}blur(){this._core.blur()}focus(){this._core.focus()}input(c,o=!0){this._core.input(c,o)}resize(c,o){this._verifyIntegers(c,o),this._core.resize(c,o)}open(c){this._core.open(c)}attachCustomKeyEventHandler(c){this._core.attachCustomKeyEventHandler(c)}attachCustomWheelEventHandler(c){this._core.attachCustomWheelEventHandler(c)}registerLinkProvider(c){return this._core.registerLinkProvider(c)}registerCharacterJoiner(c){return this._checkProposedApi(),this._core.registerCharacterJoiner(c)}deregisterCharacterJoiner(c){this._checkProposedApi(),this._core.deregisterCharacterJoiner(c)}registerMarker(c=0){return this._verifyIntegers(c),this._core.registerMarker(c)}registerDecoration(c){return this._checkProposedApi(),this._verifyPositiveIntegers(c.x??0,c.width??0,c.height??0),this._core.registerDecoration(c)}hasSelection(){return this._core.hasSelection()}select(c,o,u){this._verifyIntegers(c,o,u),this._core.select(c,o,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(c,o){this._verifyIntegers(c,o),this._core.selectLines(c,o)}dispose(){super.dispose()}scrollLines(c){this._verifyIntegers(c),this._core.scrollLines(c)}scrollPages(c){this._verifyIntegers(c),this._core.scrollPages(c)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(c){this._verifyIntegers(c),this._core.scrollToLine(c)}clear(){this._core.clear()}write(c,o){this._core.write(c,o)}writeln(c,o){this._core.write(c),this._core.write(`\r
|
|
9
|
+
`,o)}paste(c){this._core.paste(c)}refresh(c,o){this._verifyIntegers(c,o),this._core.refresh(c,o)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(c){this._addonManager.loadAddon(this,c)}static get strings(){return i}_verifyIntegers(...c){for(let o of c)if(o===1/0||isNaN(o)||o%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...c){for(let o of c)if(o&&(o===1/0||isNaN(o)||o%1!=0||o<0))throw new Error("This API only accepts positive integers")}}h.Terminal=p})(),d})())});var $s=Hs((ii,Ni)=>{(function(e,t){typeof ii=="object"&&typeof Ni=="object"?Ni.exports=t():typeof define=="function"&&define.amd?define([],t):typeof ii=="object"?ii.FitAddon=t():e.FitAddon=t()})(self,()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(r){this._terminal=r}dispose(){}fit(){let r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;let d=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(d._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let r=this._terminal._core,d=r._renderService.dimensions;if(d.css.cell.width===0||d.css.cell.height===0)return;let h=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),n=s-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),f=l-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(f/d.css.cell.width)),rows:Math.max(1,Math.floor(n/d.css.cell.height))}}}})(),e})())});var Nn=Fs(Ws(),1),Wn=Fs($s(),1);var no=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Us.isErrorNoTelemetry(e)?new Us(e.message+`
|
|
10
10
|
|
|
11
|
-
`+
|
|
11
|
+
`+e.stack):new Error(e.message+`
|
|
12
12
|
|
|
13
|
-
`+
|
|
14
|
-
`).map(
|
|
15
|
-
`),
|
|
16
|
-
`)).size}/${
|
|
17
|
-
`)),
|
|
13
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},oo=new no;function Wi(e){ao(e)||oo.onUnexpectedError(e)}var zi="Canceled";function ao(e){return e instanceof lo?!0:e instanceof Error&&e.name===zi&&e.message===zi}var lo=class extends Error{constructor(){super(zi),this.name=this.message}},Us=class ji extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ji)return t;let r=new ji;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function ho(e,t,r=0,d=e.length){let h=r,i=d;for(;h<i;){let s=Math.floor((h+i)/2);t(e[s])?h=s+1:i=s}return h-1}var co=class Js{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Js.assertInvariants){if(this._prevFindLastPredicate){for(let d of this._array)if(this._prevFindLastPredicate(d)&&!t(d))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=ho(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};co.assertInvariants=!1;var Zs;(e=>{function t(i){return i<0}e.isLessThan=t;function r(i){return i<=0}e.isLessThanOrEqual=r;function d(i){return i>0}e.isGreaterThan=d;function h(i){return i===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zs||(Zs={}));function uo(e,t){return(r,d)=>t(e(r),e(d))}var _o=(e,t)=>e-t,zs=class qi{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new qi(r=>this.iterate(d=>t(d)?r(d):!0))}map(t){return new qi(r=>this.iterate(d=>r(t(d))))}some(t){let r=!1;return this.iterate(d=>(r=t(d),!r)),r}findFirst(t){let r;return this.iterate(d=>t(d)?(r=d,!1):!0),r}findLast(t){let r;return this.iterate(d=>(t(d)&&(r=d),!0)),r}findLastMaxBy(t){let r,d=!0;return this.iterate(h=>((d||Zs.isGreaterThan(t(h,r)))&&(d=!1,r=h),!0)),r}};zs.empty=new zs(e=>{});function fo(e,t){let r=Object.create(null);for(let d of e){let h=t(d),i=r[h];i||(i=r[h]=[]),i.push(d)}return r}var js,qs,Wc=class{constructor(e,t){this.toKey=t,this._map=new Map,this[js]="SetWithKey";for(let r of e)this.add(r)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(r=>e.call(t,r,r,this))}[(qs=Symbol.iterator,js=Symbol.toStringTag,qs)](){return this.values()}},po=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function go(e,t){let r=this,d=!1,h;return function(){if(d)return h;if(d=!0,t)try{h=e.apply(r,arguments)}finally{t()}else h=e.apply(r,arguments);return h}}var Qs;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function d(){return r}e.empty=d;function*h(S){yield S}e.single=h;function i(S){return t(S)?S:h(S)}e.wrap=i;function s(S){return S||r}e.from=s;function*l(S){for(let y=S.length-1;y>=0;y--)yield S[y]}e.reverse=l;function _(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=_;function n(S){return S[Symbol.iterator]().next().value}e.first=n;function f(S,y){let m=0;for(let x of S)if(y(x,m++))return!0;return!1}e.some=f;function g(S,y){for(let m of S)if(y(m))return m}e.find=g;function*b(S,y){for(let m of S)y(m)&&(yield m)}e.filter=b;function*p(S,y){let m=0;for(let x of S)yield y(x,m++)}e.map=p;function*a(S,y){let m=0;for(let x of S)yield*y(x,m++)}e.flatMap=a;function*c(...S){for(let y of S)yield*y}e.concat=c;function o(S,y,m){let x=m;for(let T of S)x=y(x,T);return x}e.reduce=o;function*u(S,y,m=S.length){for(y<0&&(y+=S.length),m<0?m+=S.length:m>S.length&&(m=S.length);y<m;y++)yield S[y]}e.slice=u;function v(S,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,S];let x=S[Symbol.iterator]();for(let T=0;T<y;T++){let P=x.next();if(P.done)return[m,e.empty()];m.push(P.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(S){let y=[];for await(let m of S)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Qs||(Qs={}));var vo=!1,mt=null,mo=class er{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:er.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let d=this.getDisposableData(t);d.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let d=r.get(t);if(d)return d;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,h),h}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let d;if(r)d=r;else{let _=new Map,n=[...this.livingDisposables.values()].filter(g=>g.source!==null&&!this.getRootParent(g,_).isSingleton);if(n.length===0)return;let f=new Set(n.map(g=>g.value));if(d=n.filter(g=>!(g.parent&&f.has(g.parent))),d.length===0)throw new Error("There are cyclic diposable chains!")}if(!d)return;function h(_){function n(g,b){for(;g.length>0&&b.some(p=>typeof p=="string"?p===g[0]:g[0].match(p));)g.shift()}let f=_.source.split(`
|
|
14
|
+
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return n(f,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),f.reverse()}let i=new po;for(let _ of d){let n=h(_);for(let f=0;f<=n.length;f++)i.add(n.slice(0,f).join(`
|
|
15
|
+
`),_)}d.sort(uo(_=>_.idx,_o));let s="",l=0;for(let _ of d.slice(0,t)){l++;let n=h(_),f=[];for(let g=0;g<n.length;g++){let b=n[g];b=`(shared with ${i.get(n.slice(0,g+1).join(`
|
|
16
|
+
`)).size}/${d.length} leaks) at ${b}`;let p=i.get(n.slice(0,g).join(`
|
|
17
|
+
`)),a=fo([...p].map(c=>h(c)[g]),c=>c);delete a[n[g]];for(let[c,o]of Object.entries(a))f.unshift(` - stacktraces of ${o.length} other leaks continue with ${c}`);f.unshift(b)}s+=`
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
==================== Leaking disposable ${
|
|
21
|
-
${
|
|
20
|
+
==================== Leaking disposable ${l}/${d.length}: ${_.value.constructor.name} ====================
|
|
21
|
+
${f.join(`
|
|
22
22
|
`)}
|
|
23
23
|
============================================================
|
|
24
24
|
|
|
25
|
-
`}return
|
|
25
|
+
`}return d.length>t&&(s+=`
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
... and ${
|
|
28
|
+
... and ${d.length-t} more leaking disposables
|
|
29
29
|
|
|
30
|
-
`),{leaks:
|
|
30
|
+
`),{leaks:d,details:s}}};mo.idx=0;function So(e){mt=e}if(vo){let e="__is_disposable_tracked__";So(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==Pe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Pe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function hi(e){return mt?.trackDisposable(e),e}function ci(e){mt?.markAsDisposed(e)}function Ft(e,t){mt?.setParent(e,t)}function wo(e,t){if(mt)for(let r of e)mt.setParent(r,t)}function Ht(e){if(Qs.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(d){t.push(d)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function tr(...e){let t=St(()=>Ht(e));return wo(e,t),t}function St(e){let t=hi({dispose:go(()=>{ci(t),e()})});return t}var ir=class sr{constructor(){this._toDispose=new Set,this._isDisposed=!1,hi(this)}dispose(){this._isDisposed||(ci(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ht(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return Ft(t,this),this._isDisposed?sr.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),Ft(t,null))}};ir.DISABLE_DISPOSED_WARNING=!1;var Zi=ir,Pe=class{constructor(){this._store=new Zi,hi(this),Ft(this._store,this)}dispose(){ci(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Pe.None=Object.freeze({dispose(){}});var li=class{constructor(){this._isDisposed=!1,hi(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ft(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ci(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ft(e,null),e}},Ks=class Ki{constructor(t){this.element=t,this.next=Ki.Undefined,this.prev=Ki.Undefined}};Ks.Undefined=new Ks(void 0);var bo=globalThis.performance&&typeof globalThis.performance.now=="function",Co=class rr{static create(t){return new rr(t)}constructor(t){this._now=bo&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},yo=!1,Gs=!1,xo=!1,Qi;(e=>{e.None=()=>Pe.None;function t(B){if(xo){let{onDidAddListener:M}=B,O=Yi.create(),D=0;B.onDidAddListener=()=>{++D===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),M?.()}}}function r(B,M){return b(B,()=>{},0,void 0,!0,void 0,M)}e.defer=r;function d(B){return(M,O=null,D)=>{let w=!1,E;return E=B(L=>{if(!w)return E?E.dispose():w=!0,M.call(O,L)},null,D),w&&E.dispose(),E}}e.once=d;function h(B,M,O){return f((D,w=null,E)=>B(L=>D.call(w,M(L)),null,E),O)}e.map=h;function i(B,M,O){return f((D,w=null,E)=>B(L=>{M(L),D.call(w,L)},null,E),O)}e.forEach=i;function s(B,M,O){return f((D,w=null,E)=>B(L=>M(L)&&D.call(w,L),null,E),O)}e.filter=s;function l(B){return B}e.signal=l;function _(...B){return(M,O=null,D)=>{let w=tr(...B.map(E=>E(L=>M.call(O,L))));return g(w,D)}}e.any=_;function n(B,M,O,D){let w=O;return h(B,E=>(w=M(w,E),w),D)}e.reduce=n;function f(B,M){let O,D={onWillAddFirstListener(){O=B(w.fire,w)},onDidRemoveLastListener(){O?.dispose()}};M||t(D);let w=new Be(D);return M?.add(w),w.event}function g(B,M){return M instanceof Array?M.push(B):M&&M.add(B),B}function b(B,M,O=100,D=!1,w=!1,E,L){let A,F,$,q=0,J,H={leakWarningThreshold:E,onWillAddFirstListener(){A=B(U=>{q++,F=M(F,U),D&&!$&&(k.fire(F),F=void 0),J=()=>{let z=F;F=void 0,$=void 0,(!D||q>1)&&k.fire(z),q=0},typeof O=="number"?(clearTimeout($),$=setTimeout(J,O)):$===void 0&&($=0,queueMicrotask(J))})},onWillRemoveListener(){w&&q>0&&J?.()},onDidRemoveLastListener(){J=void 0,A.dispose()}};L||t(H);let k=new Be(H);return L?.add(k),k.event}e.debounce=b;function p(B,M=0,O){return e.debounce(B,(D,w)=>D?(D.push(w),D):[w],M,void 0,!0,void 0,O)}e.accumulate=p;function a(B,M=(D,w)=>D===w,O){let D=!0,w;return s(B,E=>{let L=D||!M(E,w);return D=!1,w=E,L},O)}e.latch=a;function c(B,M,O){return[e.filter(B,M,O),e.filter(B,D=>!M(D),O)]}e.split=c;function o(B,M=!1,O=[],D){let w=O.slice(),E=B(F=>{w?w.push(F):A.fire(F)});D&&D.add(E);let L=()=>{w?.forEach(F=>A.fire(F)),w=null},A=new Be({onWillAddFirstListener(){E||(E=B(F=>A.fire(F)),D&&D.add(E))},onDidAddFirstListener(){w&&(M?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return D&&D.add(A),A.event}e.buffer=o;function u(B,M){return(O,D,w)=>{let E=M(new C);return B(function(L){let A=E.evaluate(L);A!==v&&O.call(D,A)},void 0,w)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(O=>(M(O),O)),this}filter(M){return this.steps.push(O=>M(O)?O:v),this}reduce(M,O){let D=O;return this.steps.push(w=>(D=M(D,w),D)),this}latch(M=(O,D)=>O===D){let O=!0,D;return this.steps.push(w=>{let E=O||!M(w,D);return O=!1,D=w,E?w:v}),this}evaluate(M){for(let O of this.steps)if(M=O(M),M===v)break;return M}}function S(B,M,O=D=>D){let D=(...A)=>L.fire(O(...A)),w=()=>B.on(M,D),E=()=>B.removeListener(M,D),L=new Be({onWillAddFirstListener:w,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=S;function y(B,M,O=D=>D){let D=(...A)=>L.fire(O(...A)),w=()=>B.addEventListener(M,D),E=()=>B.removeEventListener(M,D),L=new Be({onWillAddFirstListener:w,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(M=>d(B)(M))}e.toPromise=m;function x(B){let M=new Be;return B.then(O=>{M.fire(O)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=x;function T(B,M){return B(O=>M.fire(O))}e.forward=T;function P(B,M,O){return M(O),B(D=>M(D))}e.runAndSubscribe=P;class I{constructor(M,O){this._observable=M,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};O||t(D),this.emitter=new Be(D),O&&O.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,O){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,M){return new I(B,M).emitter.event}e.fromObservable=R;function W(B){return(M,O,D)=>{let w=0,E=!1,L={beginUpdate(){w++},endUpdate(){w--,w===0&&(B.reportChanges(),E&&(E=!1,M.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let A={dispose(){B.removeObserver(L)}};return D instanceof Zi?D.add(A):Array.isArray(D)&&D.push(A),A}}e.fromObservableLight=W})(Qi||(Qi={}));var Gi=class Vi{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Vi._idPool++}`,Vi.all.add(this)}start(t){this._stopWatch=new Co,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Gi.all=new Set,Gi._idPool=0;var Eo=Gi,Vs=-1,nr=class or{constructor(t,r,d=(or._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=d,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let d=this.threshold;if(d<=0||r<d)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=d*.5;let[i,s]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${s}):`;console.warn(l),console.warn(i);let _=new ko(l,i);this._errorHandler(_)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[d,h]of this._stacks)(!t||r<h)&&(t=[d,h],r=h);return t}};nr._idPool=1;var Lo=nr,Yi=class ar{constructor(t){this.value=t}static create(){let t=new Error;return new ar(t.stack??"")}print(){console.warn(this.value.split(`
|
|
31
31
|
`).slice(2).join(`
|
|
32
|
-
`))}},
|
|
33
|
-
`)),
|
|
32
|
+
`))}},ko=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Ro=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Ao=0,ri=class{constructor(e){this.value=e,this.id=Ao++}},Mo=2,Do=(e,t)=>{if(e instanceof ri)t(e);else for(let r=0;r<e.length;r++){let d=e[r];d&&t(d)}},ni;if(yo){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
33
|
+
`)),e.length=0)},3e3),ni=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Be=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Vs>0||this._options?.leakWarningThreshold?new Lo(e?.onListenerError??Wi,this._options?.leakWarningThreshold??Vs):void 0,this._perfMon=this._options?._profName?new Eo(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Gs){let e=this._listeners;queueMicrotask(()=>{Do(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new Ro(`${l}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(this._options?.onListenerError||Wi)(n),Pe.None}if(this._disposed)return Pe.None;t&&(e=e.bind(t));let d=new ri(e),h,i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(d.stack=Yi.create(),h=this._leakageMon.check(d.stack,this._size+1)),Gs&&(d.stack=i??Yi.create()),this._listeners?this._listeners instanceof ri?(this._deliveryQueue??(this._deliveryQueue=new To),this._listeners=[this._listeners,d]):this._listeners.push(d):(this._options?.onWillAddFirstListener?.(this),this._listeners=d,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=St(()=>{ni?.unregister(s),h?.(),this._removeListener(d)});if(r instanceof Zi?r.add(s):Array.isArray(r)&&r.push(s),ni){let l=new Error().stack.split(`
|
|
34
34
|
`).slice(2,3).join(`
|
|
35
|
-
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(h);Ze.register(n,f?.[2]??h,n)}return n}),this._event}_removeListener(a){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let l=this._listeners,w=l.indexOf(a);if(w===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,l[w]=void 0;let y=this._deliveryQueue.current===this;if(this._size*ds<=l.length){let E=0;for(let r=0;r<l.length;r++)l[r]?l[E++]=l[r]:y&&(this._deliveryQueue.end--,E<this._deliveryQueue.i&&this._deliveryQueue.i--);l.length=E}}_deliver(a,l){if(!a)return;let w=this._options?.onListenerError||bt;if(!w){a.value(l);return}try{a.value(l)}catch(y){w(y)}}_deliverQueue(a){let l=a.current._listeners;for(;a.i<a.end;)this._deliver(l[a.i++],a.value);a.reset()}fire(a){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ye)this._deliver(this._listeners,a);else{let l=this._deliveryQueue;l.enqueue(this,a,this._listeners.length),this._deliverQueue(l)}this._perfMon?.stop()}hasListeners(){return this._size>0}},_s=class{constructor(){this.i=-1,this.end=0}enqueue(a,l,w){this.i=0,this.end=w,this.current=a,this.value=l}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ci=Object.freeze(function(a,l){let w=setTimeout(a.bind(l),0);return{dispose(){clearTimeout(w)}}}),fs;(a=>{function l(w){return w===a.None||w===a.Cancelled||w instanceof ps?!0:!w||typeof w!="object"?!1:typeof w.isCancellationRequested=="boolean"&&typeof w.onCancellationRequested=="function"}a.isCancellationToken=l,a.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Mt.None}),a.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ci})})(fs||(fs={}));var ps=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ci:(this._emitter||(this._emitter=new le),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ee="en",Tt=!1,At=!1,Qe=!1,vs=!1,gs=!1,di=!1,ms=!1,Ss=!1,bs=!1,Cs=!1,Je,et=Ee,Yt=Ee,ws,ue,_e=globalThis,re;typeof _e.vscode<"u"&&typeof _e.vscode.process<"u"?re=_e.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(re=process);var ui=typeof re?.versions?.electron=="string",ys=ui&&re?.type==="renderer";if(typeof re=="object"){Tt=re.platform==="win32",At=re.platform==="darwin",Qe=re.platform==="linux",vs=Qe&&!!re.env.SNAP&&!!re.env.SNAP_REVISION,ms=ui,bs=!!re.env.CI||!!re.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Je=Ee,et=Ee;let a=re.env.VSCODE_NLS_CONFIG;if(a)try{let l=JSON.parse(a);Je=l.userLocale,Yt=l.osLocale,et=l.resolvedLanguage||Ee,ws=l.languagePack?.translationsConfigFile}catch{}gs=!0}else typeof navigator=="object"&&!ys?(ue=navigator.userAgent,Tt=ue.indexOf("Windows")>=0,At=ue.indexOf("Macintosh")>=0,Ss=(ue.indexOf("Macintosh")>=0||ue.indexOf("iPad")>=0||ue.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Qe=ue.indexOf("Linux")>=0,Cs=ue?.indexOf("Mobi")>=0,di=!0,et=globalThis._VSCODE_NLS_LANGUAGE||Ee,Je=navigator.language.toLowerCase(),Yt=Je):console.error("Unable to resolve platform.");var Ct=0;At?Ct=1:Tt?Ct=3:Qe&&(Ct=2);var Es=di&&typeof _e.importScripts=="function",on=Es?_e.origin:void 0,ce=ue,ge=et,xs;(a=>{function l(){return ge}a.value=l;function w(){return ge.length===2?ge==="en":ge.length>=3?ge[0]==="e"&&ge[1]==="n"&&ge[2]==="-":!1}a.isDefaultVariant=w;function y(){return ge==="en"}a.isDefault=y})(xs||(xs={}));var ks=typeof _e.postMessage=="function"&&!_e.importScripts,Ls=(()=>{if(ks){let a=[];_e.addEventListener("message",w=>{if(w.data&&w.data.vscodeScheduleAsyncWork)for(let y=0,E=a.length;y<E;y++){let r=a[y];if(r.id===w.data.vscodeScheduleAsyncWork){a.splice(y,1),r.callback();return}}});let l=0;return w=>{let y=++l;a.push({id:y,callback:w}),_e.postMessage({vscodeScheduleAsyncWork:y},"*")}}return a=>setTimeout(a)})(),Ds=!!(ce&&ce.indexOf("Chrome")>=0),an=!!(ce&&ce.indexOf("Firefox")>=0),ln=!!(!Ds&&ce&&ce.indexOf("Safari")>=0),hn=!!(ce&&ce.indexOf("Edg/")>=0),cn=!!(ce&&ce.indexOf("Android")>=0),dn=Symbol("MicrotaskDelay");function _i(a,l=0,w){let y=setTimeout(()=>{a(),w&&E.dispose()},l),E=ke(()=>{clearTimeout(y),w?.deleteAndLeak(E)});return w?.add(E),E}var Rs,wt;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?wt=(a,l)=>{Ls(()=>{if(w)return;let y=Date.now()+15;l(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,y-Date.now())}}))});let w=!1;return{dispose(){w||(w=!0)}}}:wt=(a,l,w)=>{let y=a.requestIdleCallback(l,typeof w=="number"?{timeout:w}:void 0),E=!1;return{dispose(){E||(E=!0,a.cancelIdleCallback(y))}}},Rs=a=>wt(globalThis,a)})();var Ts;(a=>{async function l(y){let E,r=await Promise.all(y.map(n=>n.then(h=>h,h=>{E||(E=h)})));if(typeof E<"u")throw E;return r}a.settled=l;function w(y){return new Promise(async(E,r)=>{try{await y(E,r)}catch(n){r(n)}})}a.withAsyncBody=w})(Ts||(Ts={}));var Zt=class oe{static fromArray(l){return new oe(w=>{w.emitMany(l)})}static fromPromise(l){return new oe(async w=>{w.emitMany(await l)})}static fromPromises(l){return new oe(async w=>{await Promise.all(l.map(async y=>w.emitOne(await y)))})}static merge(l){return new oe(async w=>{await Promise.all(l.map(async y=>{for await(let E of y)w.emitOne(E)}))})}constructor(l,w){this._state=0,this._results=[],this._error=null,this._onReturn=w,this._onStateChanged=new le,queueMicrotask(async()=>{let y={emitOne:E=>this.emitOne(E),emitMany:E=>this.emitMany(E),reject:E=>this.reject(E)};try{await Promise.resolve(l(y)),this.resolve()}catch(E){this.reject(E)}finally{y.emitOne=void 0,y.emitMany=void 0,y.reject=void 0}})}[Symbol.asyncIterator](){let l=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(l<this._results.length)return{done:!1,value:this._results[l++]};if(this._state===1)return{done:!0,value:void 0};await Mt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(l,w){return new oe(async y=>{for await(let E of l)y.emitOne(w(E))})}map(l){return oe.map(this,l)}static filter(l,w){return new oe(async y=>{for await(let E of l)w(E)&&y.emitOne(E)})}filter(l){return oe.filter(this,l)}static coalesce(l){return oe.filter(l,w=>!!w)}coalesce(){return oe.coalesce(this)}static async toPromise(l){let w=[];for await(let y of l)w.push(y);return w}toPromise(){return oe.toPromise(this)}emitOne(l){this._state===0&&(this._results.push(l),this._onStateChanged.fire())}emitMany(l){this._state===0&&(this._results=this._results.concat(l),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(l){this._state===0&&(this._state=2,this._error=l,this._onStateChanged.fire())}};Zt.EMPTY=Zt.fromArray([]);var As=class extends he{constructor(a){super(),this._terminal=a,this._linesCacheTimeout=this._register(new tt),this._linesCacheDisposables=this._register(new tt),this._register(ke(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=si(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=_i(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(a){return this._linesCache?.[a]}setLineInCache(a,l){this._linesCache&&(this._linesCache[a]=l)}translateBufferLineToStringWithWrap(a,l){let w=[],y=[0],E=this._terminal.buffer.active.getLine(a);for(;E;){let r=this._terminal.buffer.active.getLine(a+1),n=r?r.isWrapped:!1,h=E.translateToString(!n&&l);if(n&&r){let f=E.getCell(E.length-1);f&&f.getCode()===0&&f.getWidth()===1&&r.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(w.push(h),n)y.push(y[y.length-1]+h.length);else break;a++,E=r}return[w.join(""),y]}},Bs=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(a){this._cachedSearchTerm=a}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(a){this._lastSearchOptions=a}isValidSearchTerm(a){return!!(a&&a.length>0)}didOptionsChange(a){return this._lastSearchOptions?a?this._lastSearchOptions.caseSensitive!==a.caseSensitive||this._lastSearchOptions.regex!==a.regex||this._lastSearchOptions.wholeWord!==a.wholeWord:!1:!0}shouldUpdateHighlighting(a,l){return l?.decorations?this._cachedSearchTerm===void 0||a!==this._cachedSearchTerm||this.didOptionsChange(l):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Ms=class{constructor(a,l){this._terminal=a,this._lineCache=l}find(a,l,w,y){if(!a||a.length===0){this._terminal.clearSelection();return}if(w>this._terminal.cols)throw new Error(`Invalid col: ${w} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let E={startRow:l,startCol:w},r=this._findInLine(a,E,y);if(!r)for(let n=l+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(E.startRow=n,E.startCol=0,r=this._findInLine(a,E,y),!r);n++);return r}findNextWithSelection(a,l,w){if(!a||a.length===0){this._terminal.clearSelection();return}let y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let E=0,r=0;y&&(w===a?(E=y.end.x,r=y.end.y):(E=y.start.x,r=y.start.y)),this._lineCache.initLinesCache();let n={startRow:r,startCol:E},h=this._findInLine(a,n,l);if(!h)for(let f=r+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=f,n.startCol=0,h=this._findInLine(a,n,l),!h);f++);if(!h&&r!==0)for(let f=0;f<r&&(n.startRow=f,n.startCol=0,h=this._findInLine(a,n,l),!h);f++);return!h&&y&&(n.startRow=y.start.y,n.startCol=0,h=this._findInLine(a,n,l)),h}findPreviousWithSelection(a,l,w){if(!a||a.length===0){this._terminal.clearSelection();return}let y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let E=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let h={startRow:E,startCol:r},f;if(y&&(h.startRow=E=y.start.y,h.startCol=r=y.start.x,w!==a&&(f=this._findInLine(a,h,l,!1),f||(h.startRow=E=y.end.y,h.startCol=r=y.end.x))),f||(f=this._findInLine(a,h,l,n)),!f){h.startCol=Math.max(h.startCol,this._terminal.cols);for(let o=E-1;o>=0&&(h.startRow=o,f=this._findInLine(a,h,l,n),!f);o--);}if(!f&&E!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let o=this._terminal.buffer.active.baseY+this._terminal.rows-1;o>=E&&(h.startRow=o,f=this._findInLine(a,h,l,n),!f);o--);return f}_isWholeWord(a,l,w){return(a===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(l[a-1]))&&(a+w.length===l.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(l[a+w.length]))}_findInLine(a,l,w={},y=!1){let E=l.startRow,r=l.startCol;if(this._terminal.buffer.active.getLine(E)?.isWrapped){if(y){l.startCol+=this._terminal.cols;return}return l.startRow--,l.startCol+=this._terminal.cols,this._findInLine(a,l,w)}let n=this._lineCache.getLineFromCache(E);n||(n=this._lineCache.translateBufferLineToStringWithWrap(E,!0),this._lineCache.setLineInCache(E,n));let[h,f]=n,o=this._bufferColsToStringOffset(E,r),_=a,v=h;w.regex||(_=w.caseSensitive?a:a.toLowerCase(),v=w.caseSensitive?h:h.toLowerCase());let S=-1;if(w.regex){let u=RegExp(_,w.caseSensitive?"g":"gi"),t;if(y)for(;t=u.exec(v.slice(0,o));)S=u.lastIndex-t[0].length,a=t[0],u.lastIndex-=a.length-1;else t=u.exec(v.slice(o)),t&&t[0].length>0&&(S=o+(u.lastIndex-t[0].length),a=t[0])}else y?o-_.length>=0&&(S=v.lastIndexOf(_,o-_.length)):S=v.indexOf(_,o);if(S>=0){if(w.wholeWord&&!this._isWholeWord(S,v,a))return;let u=0;for(;u<f.length-1&&S>=f[u+1];)u++;let t=u;for(;t<f.length-1&&S+a.length>=f[t+1];)t++;let s=S-f[u],e=S+a.length-f[t],i=this._stringLengthToBufferSize(E+u,s),c=this._stringLengthToBufferSize(E+t,e)-i+this._terminal.cols*(t-u);return{term:a,col:i,row:E+u,size:c}}}_stringLengthToBufferSize(a,l){let w=this._terminal.buffer.active.getLine(a);if(!w)return 0;for(let y=0;y<l;y++){let E=w.getCell(y);if(!E)break;let r=E.getChars();r.length>1&&(l-=r.length-1);let n=w.getCell(y+1);n&&n.getWidth()===0&&l++}return l}_bufferColsToStringOffset(a,l){let w=a,y=0,E=this._terminal.buffer.active.getLine(w);for(;l>0&&E;){for(let r=0;r<l&&r<this._terminal.cols;r++){let n=E.getCell(r);if(!n)break;n.getWidth()&&(y+=n.getCode()===0?1:n.getChars().length)}if(w++,E=this._terminal.buffer.active.getLine(w),E&&!E.isWrapped)break;l-=this._terminal.cols}return y}},Os=class extends he{constructor(a){super(),this._terminal=a,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(ke(()=>this.clearHighlightDecorations()))}createHighlightDecorations(a,l){this.clearHighlightDecorations();for(let w of a){let y=this._createResultDecorations(w,l,!1);if(y)for(let E of y)this._storeDecoration(E,w)}}createActiveDecoration(a,l){let w=this._createResultDecorations(a,l,!0);if(w)return{decorations:w,match:a,dispose(){We(w)}}}clearHighlightDecorations(){We(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(a,l){this._highlightedLines.add(a.marker.line),this._highlightDecorations.push({decoration:a,match:l,dispose(){a.dispose()}})}_applyStyles(a,l,w){a.classList.contains("xterm-find-result-decoration")||(a.classList.add("xterm-find-result-decoration"),l&&(a.style.outline=`1px solid ${l}`)),w&&a.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(a,l,w){let y=[],E=a.col,r=a.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+a.row;for(;r>0;){let f=Math.min(this._terminal.cols-E,r);y.push([n,E,f]),E=0,r-=f,n++}let h=[];for(let f of y){let o=this._terminal.registerMarker(f[0]),_=this._terminal.registerDecoration({marker:o,x:f[1],width:f[2],backgroundColor:w?l.activeMatchBackground:l.matchBackground,overviewRulerOptions:this._highlightedLines.has(o.line)?void 0:{color:w?l.activeMatchColorOverviewRuler:l.matchOverviewRuler,position:"center"}});if(_){let v=[];v.push(o),v.push(_.onRender(S=>this._applyStyles(S,w?l.activeMatchBorder:l.matchBorder,!1))),v.push(_.onDispose(()=>We(v))),h.push(_)}}return h.length===0?void 0:h}},Is=class extends he{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new le)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(a){this._selectedDecoration=a}updateResults(a,l){this._searchResults=a.slice(0,l)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(a){for(let l=0;l<this._searchResults.length;l++){let w=this._searchResults[l];if(w.row===a.row&&w.col===a.col&&w.size===a.size)return l}return-1}fireResultsChanged(a){if(!a)return;let l=-1;this._selectedDecoration&&(l=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:l,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},fi=class extends he{constructor(a){super(),this._highlightTimeout=this._register(new tt),this._lineCache=this._register(new tt),this._state=new Bs,this._resultTracker=this._register(new Is),this._highlightLimit=a?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(a){this._terminal=a,this._lineCache.value=new As(a),this._engine=new Ms(a,this._lineCache.value),this._decorationManager=new Os(a),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(ke(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=_i(()=>{let a=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(a,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(a){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),a||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(a,l,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=l,this._state.shouldUpdateHighlighting(a,l)&&this._highlightAllMatches(a,l);let y=this._findNextAndSelect(a,l,w);return this._fireResults(l),this._state.cachedSearchTerm=a,y}_highlightAllMatches(a,l){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(a)){this.clearDecorations();return}this.clearDecorations(!0);let w=[],y,E=this._engine.find(a,0,0,l);for(;E&&(y?.row!==E.row||y?.col!==E.col)&&!(w.length>=this._highlightLimit);)y=E,w.push(y),E=this._engine.find(a,y.col+y.term.length>=this._terminal.cols?y.row+1:y.row,y.col+y.term.length>=this._terminal.cols?0:y.col+1,l);this._resultTracker.updateResults(w,this._highlightLimit),l.decorations&&this._decorationManager.createHighlightDecorations(w,l.decorations)}_findNextAndSelect(a,l,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(a))return this._terminal.clearSelection(),this.clearDecorations(),!1;let y=this._engine.findNextWithSelection(a,l,this._state.cachedSearchTerm);return this._selectResult(y,l?.decorations,w?.noScroll)}findPrevious(a,l,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=l,this._state.shouldUpdateHighlighting(a,l)&&this._highlightAllMatches(a,l);let y=this._findPreviousAndSelect(a,l,w);return this._fireResults(l),this._state.cachedSearchTerm=a,y}_fireResults(a){this._resultTracker.fireResultsChanged(!!a?.decorations)}_findPreviousAndSelect(a,l,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(a))return this._terminal.clearSelection(),this.clearDecorations(),!1;let y=this._engine.findPreviousWithSelection(a,l,this._state.cachedSearchTerm);return this._selectResult(y,l?.decorations,w?.noScroll)}_selectResult(a,l,w){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!a)return this._terminal.clearSelection(),!1;if(this._terminal.select(a.col,a.row,a.size),l){let y=this._decorationManager.createActiveDecoration(a,l);y&&(this._resultTracker.selectedDecoration=y)}if(!w&&(a.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||a.row<this._terminal.buffer.active.viewportY)){let y=a.row-this._terminal.buffer.active.viewportY;y-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(y)}return!0}};var Ps=class{constructor(a,l,w,y={}){this._terminal=a,this._regex=l,this._handler=w,this._options=y}provideLinks(a,l){let w=Fs.computeLink(a,this._regex,this._terminal,this._handler);l(this._addCallbacks(w))}_addCallbacks(a){return a.map(l=>(l.leave=this._options.leave,l.hover=(w,y)=>{if(this._options.hover){let{range:E}=l;this._options.hover(w,y,E)}},l))}};function Hs(a){try{let l=new URL(a),w=l.password&&l.username?`${l.protocol}//${l.username}:${l.password}@${l.host}`:l.username?`${l.protocol}//${l.username}@${l.host}`:`${l.protocol}//${l.host}`;return a.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}var Fs=class rt{static computeLink(l,w,y,E){let r=new RegExp(w.source,(w.flags||"")+"g"),[n,h]=rt._getWindowedLineStrings(l-1,y),f=n.join(""),o,_=[];for(;o=r.exec(f);){let v=o[0];if(!Hs(v))continue;let[S,u]=rt._mapStrIdx(y,h,0,o.index),[t,s]=rt._mapStrIdx(y,S,u,v.length);if(S===-1||u===-1||t===-1||s===-1)continue;let e={start:{x:u+1,y:S+1},end:{x:s,y:t+1}};_.push({range:e,text:v,activate:E})}return _}static _getWindowedLineStrings(l,w){let y,E=l,r=l,n=0,h="",f=[];if(y=w.buffer.active.getLine(l)){let o=y.translateToString(!0);if(y.isWrapped&&o[0]!==" "){for(n=0;(y=w.buffer.active.getLine(--E))&&n<2048&&(h=y.translateToString(!0),n+=h.length,f.push(h),!(!y.isWrapped||h.indexOf(" ")!==-1)););f.reverse()}for(f.push(o),n=0;(y=w.buffer.active.getLine(++r))&&y.isWrapped&&n<2048&&(h=y.translateToString(!0),n+=h.length,f.push(h),h.indexOf(" ")===-1););}return[f,E]}static _mapStrIdx(l,w,y,E){let r=l.buffer.active,n=r.getNullCell(),h=y;for(;E;){let f=r.getLine(w);if(!f)return[-1,-1];for(let o=h;o<f.length;++o){f.getCell(o,n);let _=n.getChars();if(n.getWidth()&&(E-=_.length||1,o===f.length-1&&_==="")){let v=r.getLine(w+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(E+=1))}if(E<0)return[w,o]}w++,h=0}return[w,h]}},Ns=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Ws(a,l){let w=window.open();if(w){try{w.opener=null}catch{}w.location.href=l}else console.warn("Opening link blocked as opener could not be cleared")}var pi=class{constructor(a=Ws,l={}){this._handler=a,this._options=l}activate(a){this._terminal=a;let l=this._options,w=l.urlRegex||Ns;this._linkProvider=this._terminal.registerLinkProvider(new Ps(this._terminal,w,this._handler,l))}dispose(){this._linkProvider?.dispose()}};var vi=`/**
|
|
35
|
+
`).trim(),_=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);ni.register(s,_?.[2]??l,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let d=this._deliveryQueue.current===this;if(this._size*Mo<=t.length){let h=0;for(let i=0;i<t.length;i++)t[i]?t[h++]=t[i]:d&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||Wi;if(!r){e.value(t);return}try{e.value(t)}catch(d){r(d)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ri)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},To=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},lr=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Bo;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Po?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Qi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:lr})})(Bo||(Bo={}));var Po=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?lr:(this._emitter||(this._emitter=new Be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},vt="en",Xi=!1,Ji=!1,oi=!1,Oo=!1,Io=!1,hr=!1,Ho=!1,Fo=!1,No=!1,Wo=!1,si,ai=vt,Ys=vt,$o,$e,Ue=globalThis,Ce;typeof Ue.vscode<"u"&&typeof Ue.vscode.process<"u"?Ce=Ue.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ce=process);var cr=typeof Ce?.versions?.electron=="string",Uo=cr&&Ce?.type==="renderer";if(typeof Ce=="object"){Xi=Ce.platform==="win32",Ji=Ce.platform==="darwin",oi=Ce.platform==="linux",Oo=oi&&!!Ce.env.SNAP&&!!Ce.env.SNAP_REVISION,Ho=cr,No=!!Ce.env.CI||!!Ce.env.BUILD_ARTIFACTSTAGINGDIRECTORY,si=vt,ai=vt;let e=Ce.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);si=t.userLocale,Ys=t.osLocale,ai=t.resolvedLanguage||vt,$o=t.languagePack?.translationsConfigFile}catch{}Io=!0}else typeof navigator=="object"&&!Uo?($e=navigator.userAgent,Xi=$e.indexOf("Windows")>=0,Ji=$e.indexOf("Macintosh")>=0,Fo=($e.indexOf("Macintosh")>=0||$e.indexOf("iPad")>=0||$e.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,oi=$e.indexOf("Linux")>=0,Wo=$e?.indexOf("Mobi")>=0,hr=!0,ai=globalThis._VSCODE_NLS_LANGUAGE||vt,si=navigator.language.toLowerCase(),Ys=si):console.error("Unable to resolve platform.");var $i=0;Ji?$i=1:Xi?$i=3:oi&&($i=2);var zo=hr&&typeof Ue.importScripts=="function",$c=zo?Ue.origin:void 0,Oe=$e,tt=ai,jo;(e=>{function t(){return tt}e.value=t;function r(){return tt.length===2?tt==="en":tt.length>=3?tt[0]==="e"&&tt[1]==="n"&&tt[2]==="-":!1}e.isDefaultVariant=r;function d(){return tt==="en"}e.isDefault=d})(jo||(jo={}));var qo=typeof Ue.postMessage=="function"&&!Ue.importScripts,Ko=(()=>{if(qo){let e=[];Ue.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let d=0,h=e.length;d<h;d++){let i=e[d];if(i.id===r.data.vscodeScheduleAsyncWork){e.splice(d,1),i.callback();return}}});let t=0;return r=>{let d=++t;e.push({id:d,callback:r}),Ue.postMessage({vscodeScheduleAsyncWork:d},"*")}}return e=>setTimeout(e)})(),Go=!!(Oe&&Oe.indexOf("Chrome")>=0),Uc=!!(Oe&&Oe.indexOf("Firefox")>=0),zc=!!(!Go&&Oe&&Oe.indexOf("Safari")>=0),jc=!!(Oe&&Oe.indexOf("Edg/")>=0),qc=!!(Oe&&Oe.indexOf("Android")>=0),Kc=Symbol("MicrotaskDelay");function dr(e,t=0,r){let d=setTimeout(()=>{e(),r&&h.dispose()},t),h=St(()=>{clearTimeout(d),r?.deleteAndLeak(h)});return r?.add(h),h}var Vo,Ui;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Ui=(e,t)=>{Ko(()=>{if(r)return;let d=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,d-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:Ui=(e,t,r)=>{let d=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(d))}}},Vo=e=>Ui(globalThis,e)})();var Yo;(e=>{async function t(d){let h,i=await Promise.all(d.map(s=>s.then(l=>l,l=>{h||(h=l)})));if(typeof h<"u")throw h;return i}e.settled=t;function r(d){return new Promise(async(h,i)=>{try{await d(h,i)}catch(s){i(s)}})}e.withAsyncBody=r})(Yo||(Yo={}));var Xs=class Le{static fromArray(t){return new Le(r=>{r.emitMany(t)})}static fromPromise(t){return new Le(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Le(async r=>{await Promise.all(t.map(async d=>r.emitOne(await d)))})}static merge(t){return new Le(async r=>{await Promise.all(t.map(async d=>{for await(let h of d)r.emitOne(h)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Be,queueMicrotask(async()=>{let d={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(d)),this.resolve()}catch(h){this.reject(h)}finally{d.emitOne=void 0,d.emitMany=void 0,d.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Qi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new Le(async d=>{for await(let h of t)d.emitOne(r(h))})}map(t){return Le.map(this,t)}static filter(t,r){return new Le(async d=>{for await(let h of t)r(h)&&d.emitOne(h)})}filter(t){return Le.filter(this,t)}static coalesce(t){return Le.filter(t,r=>!!r)}coalesce(){return Le.coalesce(this)}static async toPromise(t){let r=[];for await(let d of t)r.push(d);return r}toPromise(){return Le.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Xs.EMPTY=Xs.fromArray([]);var Xo=class extends Pe{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new li),this._linesCacheDisposables=this._register(new li),this._register(St(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=tr(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=dr(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],d=[0],h=this._terminal.buffer.active.getLine(e);for(;h;){let i=this._terminal.buffer.active.getLine(e+1),s=i?i.isWrapped:!1,l=h.translateToString(!s&&t);if(s&&i){let _=h.getCell(h.length-1);_&&_.getCode()===0&&_.getWidth()===1&&i.getCell(0)?.getWidth()===2&&(l=l.slice(0,-1))}if(r.push(l),s)d.push(d[d.length-1]+l.length);else break;e++,h=i}return[r.join(""),d]}},Jo=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Zo=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,r,d){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let h={startRow:t,startCol:r},i=this._findInLine(e,h,d);if(!i)for(let s=t+1;s<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=s,h.startCol=0,i=this._findInLine(e,h,d),!i);s++);return i}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let d=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,i=0;d&&(r===e?(h=d.end.x,i=d.end.y):(h=d.start.x,i=d.start.y)),this._lineCache.initLinesCache();let s={startRow:i,startCol:h},l=this._findInLine(e,s,t);if(!l)for(let _=i+1;_<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=_,s.startCol=0,l=this._findInLine(e,s,t),!l);_++);if(!l&&i!==0)for(let _=0;_<i&&(s.startRow=_,s.startCol=0,l=this._findInLine(e,s,t),!l);_++);return!l&&d&&(s.startRow=d.start.y,s.startCol=0,l=this._findInLine(e,s,t)),l}findPreviousWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let d=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols,s=!0;this._lineCache.initLinesCache();let l={startRow:h,startCol:i},_;if(d&&(l.startRow=h=d.start.y,l.startCol=i=d.start.x,r!==e&&(_=this._findInLine(e,l,t,!1),_||(l.startRow=h=d.end.y,l.startCol=i=d.end.x))),_||(_=this._findInLine(e,l,t,s)),!_){l.startCol=Math.max(l.startCol,this._terminal.cols);for(let n=h-1;n>=0&&(l.startRow=n,_=this._findInLine(e,l,t,s),!_);n--);}if(!_&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=h&&(l.startRow=n,_=this._findInLine(e,l,t,s),!_);n--);return _}_isWholeWord(e,t,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+r.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+r.length]))}_findInLine(e,t,r={},d=!1){let h=t.startRow,i=t.startCol;if(this._terminal.buffer.active.getLine(h)?.isWrapped){if(d){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,r)}let s=this._lineCache.getLineFromCache(h);s||(s=this._lineCache.translateBufferLineToStringWithWrap(h,!0),this._lineCache.setLineInCache(h,s));let[l,_]=s,n=this._bufferColsToStringOffset(h,i),f=e,g=l;r.regex||(f=r.caseSensitive?e:e.toLowerCase(),g=r.caseSensitive?l:l.toLowerCase());let b=-1;if(r.regex){let p=RegExp(f,r.caseSensitive?"g":"gi"),a;if(d)for(;a=p.exec(g.slice(0,n));)b=p.lastIndex-a[0].length,e=a[0],p.lastIndex-=e.length-1;else a=p.exec(g.slice(n)),a&&a[0].length>0&&(b=n+(p.lastIndex-a[0].length),e=a[0])}else d?n-f.length>=0&&(b=g.lastIndexOf(f,n-f.length)):b=g.indexOf(f,n);if(b>=0){if(r.wholeWord&&!this._isWholeWord(b,g,e))return;let p=0;for(;p<_.length-1&&b>=_[p+1];)p++;let a=p;for(;a<_.length-1&&b+e.length>=_[a+1];)a++;let c=b-_[p],o=b+e.length-_[a],u=this._stringLengthToBufferSize(h+p,c),v=this._stringLengthToBufferSize(h+a,o)-u+this._terminal.cols*(a-p);return{term:e,col:u,row:h+p,size:v}}}_stringLengthToBufferSize(e,t){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let d=0;d<t;d++){let h=r.getCell(d);if(!h)break;let i=h.getChars();i.length>1&&(t-=i.length-1);let s=r.getCell(d+1);s&&s.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,d=0,h=this._terminal.buffer.active.getLine(r);for(;t>0&&h;){for(let i=0;i<t&&i<this._terminal.cols;i++){let s=h.getCell(i);if(!s)break;s.getWidth()&&(d+=s.getCode()===0?1:s.getChars().length)}if(r++,h=this._terminal.buffer.active.getLine(r),h&&!h.isWrapped)break;t-=this._terminal.cols}return d}},Qo=class extends Pe{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(St(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let d=this._createResultDecorations(r,t,!1);if(d)for(let h of d)this._storeDecoration(h,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){Ht(r)}}}clearHighlightDecorations(){Ht(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,r){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),r&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,r){let d=[],h=e.col,i=e.size,s=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;i>0;){let _=Math.min(this._terminal.cols-h,i);d.push([s,h,_]),h=0,i-=_,s++}let l=[];for(let _ of d){let n=this._terminal.registerMarker(_[0]),f=this._terminal.registerDecoration({marker:n,x:_[1],width:_[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(n.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(f){let g=[];g.push(n),g.push(f.onRender(b=>this._applyStyles(b,r?t.activeMatchBorder:t.matchBorder,!1))),g.push(f.onDispose(()=>Ht(g))),l.push(f)}}return l.length===0?void 0:l}},ea=class extends Pe{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Be)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let r=this._searchResults[t];if(r.row===e.row&&r.col===e.col&&r.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},ur=class extends Pe{constructor(e){super(),this._highlightTimeout=this._register(new li),this._lineCache=this._register(new li),this._state=new Jo,this._resultTracker=this._register(new ea),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Xo(e),this._engine=new Zo(e,this._lineCache.value),this._decorationManager=new Qo(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(St(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=dr(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let d=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,d}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let r=[],d,h=this._engine.find(e,0,0,t);for(;h&&(d?.row!==h.row||d?.col!==h.col)&&!(r.length>=this._highlightLimit);)d=h,r.push(d),h=this._engine.find(e,d.col+d.term.length>=this._terminal.cols?d.row+1:d.row,d.col+d.term.length>=this._terminal.cols?0:d.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let d=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(d,t?.decorations,r?.noScroll)}findPrevious(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let d=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,d}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let d=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(d,t?.decorations,r?.noScroll)}_selectResult(e,t,r){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let d=this._decorationManager.createActiveDecoration(e,t);d&&(this._resultTracker.selectedDecoration=d)}if(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let d=e.row-this._terminal.buffer.active.viewportY;d-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(d)}return!0}};var ta=class{constructor(e,t,r,d={}){this._terminal=e,this._regex=t,this._handler=r,this._options=d}provideLinks(e,t){let r=sa.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,d)=>{if(this._options.hover){let{range:h}=t;this._options.hover(r,d,h)}},t))}};function ia(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var sa=class di{static computeLink(t,r,d,h){let i=new RegExp(r.source,(r.flags||"")+"g"),[s,l]=di._getWindowedLineStrings(t-1,d),_=s.join(""),n,f=[];for(;n=i.exec(_);){let g=n[0];if(!ia(g))continue;let[b,p]=di._mapStrIdx(d,l,0,n.index),[a,c]=di._mapStrIdx(d,b,p,g.length);if(b===-1||p===-1||a===-1||c===-1)continue;let o={start:{x:p+1,y:b+1},end:{x:c,y:a+1}};f.push({range:o,text:g,activate:h})}return f}static _getWindowedLineStrings(t,r){let d,h=t,i=t,s=0,l="",_=[];if(d=r.buffer.active.getLine(t)){let n=d.translateToString(!0);if(d.isWrapped&&n[0]!==" "){for(s=0;(d=r.buffer.active.getLine(--h))&&s<2048&&(l=d.translateToString(!0),s+=l.length,_.push(l),!(!d.isWrapped||l.indexOf(" ")!==-1)););_.reverse()}for(_.push(n),s=0;(d=r.buffer.active.getLine(++i))&&d.isWrapped&&s<2048&&(l=d.translateToString(!0),s+=l.length,_.push(l),l.indexOf(" ")===-1););}return[_,h]}static _mapStrIdx(t,r,d,h){let i=t.buffer.active,s=i.getNullCell(),l=d;for(;h;){let _=i.getLine(r);if(!_)return[-1,-1];for(let n=l;n<_.length;++n){_.getCell(n,s);let f=s.getChars();if(s.getWidth()&&(h-=f.length||1,n===_.length-1&&f==="")){let g=i.getLine(r+1);g&&g.isWrapped&&(g.getCell(0,s),s.getWidth()===2&&(h+=1))}if(h<0)return[r,n]}r++,l=0}return[r,l]}},ra=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function na(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var _r=class{constructor(e=na,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||ra;this._linkProvider=this._terminal.registerLinkProvider(new ta(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var oa=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,la=(e,t,r,d)=>{for(var h=d>1?void 0:d?aa(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(h=(d?s(t,r,h):s(h))||h);return d&&h&&oa(t,r,h),h},ha=(e,t)=>(r,d)=>t(r,d,e),ca=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?fr.isErrorNoTelemetry(e)?new fr(e.message+`
|
|
36
|
+
|
|
37
|
+
`+e.stack):new Error(e.message+`
|
|
38
|
+
|
|
39
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},da=new ca;function gi(e){ua(e)||da.onUnexpectedError(e)}var fs="Canceled";function ua(e){return e instanceof _a?!0:e instanceof Error&&e.name===fs&&e.message===fs}var _a=class extends Error{constructor(){super(fs),this.name=this.message}},fr=class ps extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ps)return t;let r=new ps;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function fa(e,t,r=0,d=e.length){let h=r,i=d;for(;h<i;){let s=Math.floor((h+i)/2);t(e[s])?h=s+1:i=s}return h-1}var pa=class Jr{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Jr.assertInvariants){if(this._prevFindLastPredicate){for(let d of this._array)if(this._prevFindLastPredicate(d)&&!t(d))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=fa(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};pa.assertInvariants=!1;var Zr;(e=>{function t(i){return i<0}e.isLessThan=t;function r(i){return i<=0}e.isLessThanOrEqual=r;function d(i){return i>0}e.isGreaterThan=d;function h(i){return i===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zr||(Zr={}));function ga(e,t){return(r,d)=>t(e(r),e(d))}var va=(e,t)=>e-t,pr=class gs{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new gs(r=>this.iterate(d=>t(d)?r(d):!0))}map(t){return new gs(r=>this.iterate(d=>r(t(d))))}some(t){let r=!1;return this.iterate(d=>(r=t(d),!r)),r}findFirst(t){let r;return this.iterate(d=>t(d)?(r=d,!1):!0),r}findLast(t){let r;return this.iterate(d=>(t(d)&&(r=d),!0)),r}findLastMaxBy(t){let r,d=!0;return this.iterate(h=>((d||Zr.isGreaterThan(t(h,r)))&&(d=!1,r=h),!0)),r}};pr.empty=new pr(e=>{});function ma(e,t){let r=Object.create(null);for(let d of e){let h=t(d),i=r[h];i||(i=r[h]=[]),i.push(d)}return r}var gr,vr,gd=class{constructor(e,t){this.toKey=t,this._map=new Map,this[gr]="SetWithKey";for(let r of e)this.add(r)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(r=>e.call(t,r,r,this))}[(vr=Symbol.iterator,gr=Symbol.toStringTag,vr)](){return this.values()}},Sa=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function wa(e,t){let r=this,d=!1,h;return function(){if(d)return h;if(d=!0,t)try{h=e.apply(r,arguments)}finally{t()}else h=e.apply(r,arguments);return h}}var Qr;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function d(){return r}e.empty=d;function*h(S){yield S}e.single=h;function i(S){return t(S)?S:h(S)}e.wrap=i;function s(S){return S||r}e.from=s;function*l(S){for(let y=S.length-1;y>=0;y--)yield S[y]}e.reverse=l;function _(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=_;function n(S){return S[Symbol.iterator]().next().value}e.first=n;function f(S,y){let m=0;for(let x of S)if(y(x,m++))return!0;return!1}e.some=f;function g(S,y){for(let m of S)if(y(m))return m}e.find=g;function*b(S,y){for(let m of S)y(m)&&(yield m)}e.filter=b;function*p(S,y){let m=0;for(let x of S)yield y(x,m++)}e.map=p;function*a(S,y){let m=0;for(let x of S)yield*y(x,m++)}e.flatMap=a;function*c(...S){for(let y of S)yield*y}e.concat=c;function o(S,y,m){let x=m;for(let T of S)x=y(x,T);return x}e.reduce=o;function*u(S,y,m=S.length){for(y<0&&(y+=S.length),m<0?m+=S.length:m>S.length&&(m=S.length);y<m;y++)yield S[y]}e.slice=u;function v(S,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,S];let x=S[Symbol.iterator]();for(let T=0;T<y;T++){let P=x.next();if(P.done)return[m,e.empty()];m.push(P.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(S){let y=[];for await(let m of S)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Qr||(Qr={}));var ba=!1,Et=null,Ca=class en{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:en.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let d=this.getDisposableData(t);d.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let d=r.get(t);if(d)return d;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,h),h}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let d;if(r)d=r;else{let _=new Map,n=[...this.livingDisposables.values()].filter(g=>g.source!==null&&!this.getRootParent(g,_).isSingleton);if(n.length===0)return;let f=new Set(n.map(g=>g.value));if(d=n.filter(g=>!(g.parent&&f.has(g.parent))),d.length===0)throw new Error("There are cyclic diposable chains!")}if(!d)return;function h(_){function n(g,b){for(;g.length>0&&b.some(p=>typeof p=="string"?p===g[0]:g[0].match(p));)g.shift()}let f=_.source.split(`
|
|
40
|
+
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return n(f,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),f.reverse()}let i=new Sa;for(let _ of d){let n=h(_);for(let f=0;f<=n.length;f++)i.add(n.slice(0,f).join(`
|
|
41
|
+
`),_)}d.sort(ga(_=>_.idx,va));let s="",l=0;for(let _ of d.slice(0,t)){l++;let n=h(_),f=[];for(let g=0;g<n.length;g++){let b=n[g];b=`(shared with ${i.get(n.slice(0,g+1).join(`
|
|
42
|
+
`)).size}/${d.length} leaks) at ${b}`;let p=i.get(n.slice(0,g).join(`
|
|
43
|
+
`)),a=ma([...p].map(c=>h(c)[g]),c=>c);delete a[n[g]];for(let[c,o]of Object.entries(a))f.unshift(` - stacktraces of ${o.length} other leaks continue with ${c}`);f.unshift(b)}s+=`
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
==================== Leaking disposable ${l}/${d.length}: ${_.value.constructor.name} ====================
|
|
47
|
+
${f.join(`
|
|
48
|
+
`)}
|
|
49
|
+
============================================================
|
|
50
|
+
|
|
51
|
+
`}return d.length>t&&(s+=`
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
... and ${d.length-t} more leaking disposables
|
|
55
|
+
|
|
56
|
+
`),{leaks:d,details:s}}};Ca.idx=0;function ya(e){Et=e}if(ba){let e="__is_disposable_tracked__";ya(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==xe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==xe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Li(e){return Et?.trackDisposable(e),e}function ki(e){Et?.markAsDisposed(e)}function qt(e,t){Et?.setParent(e,t)}function xa(e,t){if(Et)for(let r of e)Et.setParent(r,t)}function tn(e){if(Qr.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(d){t.push(d)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function sn(...e){let t=pe(()=>tn(e));return xa(e,t),t}function pe(e){let t=Li({dispose:wa(()=>{ki(t),e()})});return t}var rn=class nn{constructor(){this._toDispose=new Set,this._isDisposed=!1,Li(this)}dispose(){this._isDisposed||(ki(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{tn(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return qt(t,this),this._isDisposed?nn.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),qt(t,null))}};rn.DISABLE_DISPOSED_WARNING=!1;var xt=rn,xe=class{constructor(){this._store=new xt,Li(this),qt(this._store,this)}dispose(){ki(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};xe.None=Object.freeze({dispose(){}});var Nt=class{constructor(){this._isDisposed=!1,Li(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&qt(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ki(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&qt(e,null),e}},Es=typeof process<"u"&&"title"in process,Gt=Es?"node":navigator.userAgent,Ls=Es?"node":navigator.platform,Ea=Gt.includes("Firefox"),La=Gt.includes("Edge"),on=/^((?!chrome|android).)*safari/i.test(Gt);function ka(){if(!on)return 0;let e=Gt.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var vd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ls),md=["Windows","Win16","Win32","WinCE"].includes(Ls),Sd=Ls.indexOf("Linux")>=0,wd=/\bCrOS\b/.test(Gt),Ra="",de=0,ue=0,_e=0,le=0,ke={css:"#00000000",rgba:0},Se;(e=>{function t(h,i,s,l){return l!==void 0?`#${lt(h)}${lt(i)}${lt(s)}${lt(l)}`:`#${lt(h)}${lt(i)}${lt(s)}`}e.toCss=t;function r(h,i,s,l=255){return(h<<24|i<<16|s<<8|l)>>>0}e.toRgba=r;function d(h,i,s,l){return{css:e.toCss(h,i,s,l),rgba:e.toRgba(h,i,s,l)}}e.toColor=d})(Se||(Se={}));var jt;(e=>{function t(_,n){if(le=(n.rgba&255)/255,le===1)return{css:n.css,rgba:n.rgba};let f=n.rgba>>24&255,g=n.rgba>>16&255,b=n.rgba>>8&255,p=_.rgba>>24&255,a=_.rgba>>16&255,c=_.rgba>>8&255;de=p+Math.round((f-p)*le),ue=a+Math.round((g-a)*le),_e=c+Math.round((b-c)*le);let o=Se.toCss(de,ue,_e),u=Se.toRgba(de,ue,_e);return{css:o,rgba:u}}e.blend=t;function r(_){return(_.rgba&255)===255}e.isOpaque=r;function d(_,n,f){let g=ht.ensureContrastRatio(_.rgba,n.rgba,f);if(g)return Se.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=d;function h(_){let n=(_.rgba|255)>>>0;return[de,ue,_e]=ht.toChannels(n),{css:Se.toCss(de,ue,_e),rgba:n}}e.opaque=h;function i(_,n){return le=Math.round(n*255),[de,ue,_e]=ht.toChannels(_.rgba),{css:Se.toCss(de,ue,_e,le),rgba:Se.toRgba(de,ue,_e,le)}}e.opacity=i;function s(_,n){return le=_.rgba&255,i(_,le*n/255)}e.multiplyOpacity=s;function l(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=l})(jt||(jt={}));var Aa;(e=>{let t,r;try{let h=document.createElement("canvas");h.width=1,h.height=1;let i=h.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function d(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return de=parseInt(h.slice(1,2).repeat(2),16),ue=parseInt(h.slice(2,3).repeat(2),16),_e=parseInt(h.slice(3,4).repeat(2),16),Se.toColor(de,ue,_e);case 5:return de=parseInt(h.slice(1,2).repeat(2),16),ue=parseInt(h.slice(2,3).repeat(2),16),_e=parseInt(h.slice(3,4).repeat(2),16),le=parseInt(h.slice(4,5).repeat(2),16),Se.toColor(de,ue,_e,le);case 7:return{css:h,rgba:(parseInt(h.slice(1),16)<<8|255)>>>0};case 9:return{css:h,rgba:parseInt(h.slice(1),16)>>>0}}let i=h.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(i)return de=parseInt(i[1]),ue=parseInt(i[2]),_e=parseInt(i[3]),le=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),Se.toColor(de,ue,_e,le);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=h,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[de,ue,_e,le]=t.getImageData(0,0,1,1).data,le!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Se.toRgba(de,ue,_e,le),css:h}}e.toColor=d})(Aa||(Aa={}));var me;(e=>{function t(d){return r(d>>16&255,d>>8&255,d&255)}e.relativeLuminance=t;function r(d,h,i){let s=d/255,l=h/255,_=i/255,n=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),f=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return n*.2126+f*.7152+g*.0722}e.relativeLuminance2=r})(me||(me={}));var ht;(e=>{function t(s,l){if(le=(l&255)/255,le===1)return l;let _=l>>24&255,n=l>>16&255,f=l>>8&255,g=s>>24&255,b=s>>16&255,p=s>>8&255;return de=g+Math.round((_-g)*le),ue=b+Math.round((n-b)*le),_e=p+Math.round((f-p)*le),Se.toRgba(de,ue,_e)}e.blend=t;function r(s,l,_){let n=me.relativeLuminance(s>>8),f=me.relativeLuminance(l>>8);if(ze(n,f)<_){if(f<n){let p=d(s,l,_),a=ze(n,me.relativeLuminance(p>>8));if(a<_){let c=h(s,l,_),o=ze(n,me.relativeLuminance(c>>8));return a>o?p:c}return p}let g=h(s,l,_),b=ze(n,me.relativeLuminance(g>>8));if(b<_){let p=d(s,l,_),a=ze(n,me.relativeLuminance(p>>8));return b>a?g:p}return g}}e.ensureContrastRatio=r;function d(s,l,_){let n=s>>24&255,f=s>>16&255,g=s>>8&255,b=l>>24&255,p=l>>16&255,a=l>>8&255,c=ze(me.relativeLuminance2(b,p,a),me.relativeLuminance2(n,f,g));for(;c<_&&(b>0||p>0||a>0);)b-=Math.max(0,Math.ceil(b*.1)),p-=Math.max(0,Math.ceil(p*.1)),a-=Math.max(0,Math.ceil(a*.1)),c=ze(me.relativeLuminance2(b,p,a),me.relativeLuminance2(n,f,g));return(b<<24|p<<16|a<<8|255)>>>0}e.reduceLuminance=d;function h(s,l,_){let n=s>>24&255,f=s>>16&255,g=s>>8&255,b=l>>24&255,p=l>>16&255,a=l>>8&255,c=ze(me.relativeLuminance2(b,p,a),me.relativeLuminance2(n,f,g));for(;c<_&&(b<255||p<255||a<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),a=Math.min(255,a+Math.ceil((255-a)*.1)),c=ze(me.relativeLuminance2(b,p,a),me.relativeLuminance2(n,f,g));return(b<<24|p<<16|a<<8|255)>>>0}e.increaseLuminance=h;function i(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]}e.toChannels=i})(ht||(ht={}));function lt(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ze(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function he(e){if(!e)throw new Error("value must not be falsy");return e}function ks(e){return 57508<=e&&e<=57558}function Ma(e){return 57520<=e&&e<=57527}function Da(e){return 57344<=e&&e<=63743}function Ta(e){return 9472<=e&&e<=9631}function Ba(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Pa(e,t,r,d){return t===1&&r>Math.ceil(d*1.5)&&e!==void 0&&e>255&&!Ba(e)&&!ks(e)&&!Da(e)}function an(e){return ks(e)||Ta(e)}function Oa(){return{css:{canvas:ui(),cell:ui()},device:{canvas:ui(),cell:ui(),char:{width:0,height:0,left:0,top:0}}}}function ui(){return{width:0,height:0}}function Ia(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var fe=0,ce=0,Ie=!1,je=!1,_i=!1,we,es=0,Ha=class{constructor(e,t,r,d,h,i){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=d,this._coreBrowserService=h,this._themeService=i,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,d){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,ce=0,fe=0,je=!1,Ie=!1,_i=!1,we=this._themeService.colors,es=0,e.getCode()!==0&&e.extended.underlineStyle===4){let h=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));es=t*d%(Math.round(h)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",h=>{h.backgroundColorRGB&&(ce=h.backgroundColorRGB.rgba>>8&16777215,je=!0),h.foregroundColorRGB&&(fe=h.foregroundColorRGB.rgba>>8&16777215,Ie=!0)}),_i=this._selectionRenderModel.isCellSelected(this._terminal,t,r),_i){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ce=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ce=(this.result.fg&16777215)<<8|255;break;case 0:default:ce=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ce=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ce=(this.result.bg&16777215)<<8|255;break}ce=ht.blend(ce,(this._coreBrowserService.isFocused?we.selectionBackgroundOpaque:we.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ce=(this._coreBrowserService.isFocused?we.selectionBackgroundOpaque:we.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(je=!0,we.selectionForeground&&(fe=we.selectionForeground.rgba>>8&16777215,Ie=!0),an(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))fe=(this._coreBrowserService.isFocused?we.selectionBackgroundOpaque:we.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:fe=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:fe=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:fe=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:fe=(this.result.fg&16777215)<<8|255;break;case 0:default:fe=this._themeService.colors.foreground.rgba}fe=ht.blend(fe,(this._coreBrowserService.isFocused?we.selectionBackgroundOpaque:we.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ie=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",h=>{h.backgroundColorRGB&&(ce=h.backgroundColorRGB.rgba>>8&16777215,je=!0),h.foregroundColorRGB&&(fe=h.foregroundColorRGB.rgba>>8&16777215,Ie=!0)}),je&&(_i?ce=e.bg&-16777216&-134217729|ce|50331648:ce=e.bg&-16777216|ce|50331648),Ie&&(fe=e.fg&-16777216&-67108865|fe|50331648),this.result.fg&67108864&&(je&&!Ie&&(this.result.bg&50331648?fe=this.result.fg&-134217728|this.result.bg&67108863:fe=this.result.fg&-134217728|we.background.rgba>>8&16777215&16777215|50331648,Ie=!0),!je&&Ie&&(this.result.fg&50331648?ce=this.result.bg&-67108864|this.result.fg&67108863:ce=this.result.bg&-67108864|we.foreground.rgba>>8&16777215&16777215|50331648,je=!0)),we=void 0,this.result.bg=je?ce:this.result.bg,this.result.fg=Ie?fe:this.result.fg,this.result.ext&=536870911,this.result.ext|=es<<29&3758096384}},Fa=.5,ln=Ea||La?"bottom":"ideographic",Na={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:8,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Wa={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]},$a={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2551":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2552":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u2553":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"\u2554":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2555":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"\u2556":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"\u2557":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"\u2558":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"\u2559":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u255A":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"\u255B":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"\u255C":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"\u255D":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"\u255E":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u255F":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"\u2560":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2561":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"\u2562":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2563":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"\u2564":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"\u2565":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"\u2566":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2567":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2568":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u2569":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u256A":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u256B":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u256C":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"\u256E":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"\u256F":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"\u2570":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Kt={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Kt["\uE0BB"]=Kt["\uE0BD"];Kt["\uE0BF"]=Kt["\uE0B9"];function Ua(e,t,r,d,h,i,s,l){let _=Na[t];if(_)return za(e,_,r,d,h,i),!0;let n=Wa[t];if(n)return ja(e,n,r,d,h,i),!0;let f=$a[t];if(f)return qa(e,f,r,d,h,i,l),!0;let g=Kt[t];return g?(Ka(e,g,r,d,h,i,s,l),!0):!1}function za(e,t,r,d,h,i){for(let s=0;s<t.length;s++){let l=t[s],_=h/8,n=i/8;e.fillRect(r+l.x*_,d+l.y*n,l.w*_,l.h*n)}}var mr=new Map;function ja(e,t,r,d,h,i){let s=mr.get(t);s||(s=new Map,mr.set(t,s));let l=e.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let _=s.get(l);if(!_){let n=t[0].length,f=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=n,g.height=f;let b=he(g.getContext("2d")),p=new ImageData(n,f),a,c,o,u;if(l.startsWith("#"))a=parseInt(l.slice(1,3),16),c=parseInt(l.slice(3,5),16),o=parseInt(l.slice(5,7),16),u=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[a,c,o,u]=l.substring(5,l.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let v=0;v<f;v++)for(let C=0;C<n;C++)p.data[(v*n+C)*4]=a,p.data[(v*n+C)*4+1]=c,p.data[(v*n+C)*4+2]=o,p.data[(v*n+C)*4+3]=t[v][C]*(u*255);b.putImageData(p,0,0),_=he(e.createPattern(g,null)),s.set(l,_)}e.fillStyle=_,e.fillRect(r,d,h,i)}function qa(e,t,r,d,h,i,s){e.strokeStyle=e.fillStyle;for(let[l,_]of Object.entries(t)){e.beginPath(),e.lineWidth=s*Number.parseInt(l);let n;if(typeof _=="function"){let f=.15/i*h;n=_(.15,f)}else n=_;for(let f of n.split(" ")){let g=f[0],b=hn[g];if(!b){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=f.substring(1).split(",");!p[0]||!p[1]||b(e,cn(p,h,i,r,d,!0,s))}e.stroke(),e.closePath()}}function Ka(e,t,r,d,h,i,s,l){let _=new Path2D;_.rect(r,d,h,i),e.clip(_),e.beginPath();let n=s/12;e.lineWidth=l*n;for(let f of t.d.split(" ")){let g=f[0],b=hn[g];if(!b){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=f.substring(1).split(",");!p[0]||!p[1]||b(e,cn(p,h,i,r,d,!1,l,(t.leftPadding??0)*(n/2),(t.rightPadding??0)*(n/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Sr(e,t,r=0){return Math.max(Math.min(e,t),r)}var hn={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function cn(e,t,r,d,h,i,s,l=0,_=0){let n=e.map(f=>parseFloat(f)||parseInt(f));if(n.length<2)throw new Error("Too few arguments for instruction");for(let f=0;f<n.length;f+=2)n[f]*=t-l*s-_*s,i&&n[f]!==0&&(n[f]=Sr(Math.round(n[f]+.5)-.5,t,0)),n[f]+=d+l*s;for(let f=1;f<n.length;f+=2)n[f]*=r,i&&n[f]!==0&&(n[f]=Sr(Math.round(n[f]+.5)-.5,r,0)),n[f]+=h;return n}var wr=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},br=class{constructor(){this._data=new wr}set(e,t,r,d,h){this._data.get(e,t)||this._data.set(e,t,new wr),this._data.get(e,t).set(r,d,h)}get(e,t,r,d){return this._data.get(e,t)?.get(r,d)}clear(){this._data.clear()}},dn=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,r=0,d=e.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),h=e.timeRemaining(),r*1.5>h){d-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(d-t))}ms`),this._start();return}d=h}this.clear()}},Ga=class extends dn{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Va=class extends dn{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ya=!Es&&"requestIdleCallback"in window?Va:Ga,Ct=class un{constructor(){this.fg=0,this.bg=0,this.extended=new _n}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new un;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},_n=class fn{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new fn(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Cr=class vs{constructor(t){this.element=t,this.next=vs.Undefined,this.prev=vs.Undefined}};Cr.Undefined=new Cr(void 0);var Xa=globalThis.performance&&typeof globalThis.performance.now=="function",Ja=class pn{static create(t){return new pn(t)}constructor(t){this._now=Xa&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Za=!1,yr=!1,Qa=!1,Ve;(e=>{e.None=()=>xe.None;function t(B){if(Qa){let{onDidAddListener:M}=B,O=ws.create(),D=0;B.onDidAddListener=()=>{++D===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),M?.()}}}function r(B,M){return b(B,()=>{},0,void 0,!0,void 0,M)}e.defer=r;function d(B){return(M,O=null,D)=>{let w=!1,E;return E=B(L=>{if(!w)return E?E.dispose():w=!0,M.call(O,L)},null,D),w&&E.dispose(),E}}e.once=d;function h(B,M,O){return f((D,w=null,E)=>B(L=>D.call(w,M(L)),null,E),O)}e.map=h;function i(B,M,O){return f((D,w=null,E)=>B(L=>{M(L),D.call(w,L)},null,E),O)}e.forEach=i;function s(B,M,O){return f((D,w=null,E)=>B(L=>M(L)&&D.call(w,L),null,E),O)}e.filter=s;function l(B){return B}e.signal=l;function _(...B){return(M,O=null,D)=>{let w=sn(...B.map(E=>E(L=>M.call(O,L))));return g(w,D)}}e.any=_;function n(B,M,O,D){let w=O;return h(B,E=>(w=M(w,E),w),D)}e.reduce=n;function f(B,M){let O,D={onWillAddFirstListener(){O=B(w.fire,w)},onDidRemoveLastListener(){O?.dispose()}};M||t(D);let w=new te(D);return M?.add(w),w.event}function g(B,M){return M instanceof Array?M.push(B):M&&M.add(B),B}function b(B,M,O=100,D=!1,w=!1,E,L){let A,F,$,q=0,J,H={leakWarningThreshold:E,onWillAddFirstListener(){A=B(U=>{q++,F=M(F,U),D&&!$&&(k.fire(F),F=void 0),J=()=>{let z=F;F=void 0,$=void 0,(!D||q>1)&&k.fire(z),q=0},typeof O=="number"?(clearTimeout($),$=setTimeout(J,O)):$===void 0&&($=0,queueMicrotask(J))})},onWillRemoveListener(){w&&q>0&&J?.()},onDidRemoveLastListener(){J=void 0,A.dispose()}};L||t(H);let k=new te(H);return L?.add(k),k.event}e.debounce=b;function p(B,M=0,O){return e.debounce(B,(D,w)=>D?(D.push(w),D):[w],M,void 0,!0,void 0,O)}e.accumulate=p;function a(B,M=(D,w)=>D===w,O){let D=!0,w;return s(B,E=>{let L=D||!M(E,w);return D=!1,w=E,L},O)}e.latch=a;function c(B,M,O){return[e.filter(B,M,O),e.filter(B,D=>!M(D),O)]}e.split=c;function o(B,M=!1,O=[],D){let w=O.slice(),E=B(F=>{w?w.push(F):A.fire(F)});D&&D.add(E);let L=()=>{w?.forEach(F=>A.fire(F)),w=null},A=new te({onWillAddFirstListener(){E||(E=B(F=>A.fire(F)),D&&D.add(E))},onDidAddFirstListener(){w&&(M?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return D&&D.add(A),A.event}e.buffer=o;function u(B,M){return(O,D,w)=>{let E=M(new C);return B(function(L){let A=E.evaluate(L);A!==v&&O.call(D,A)},void 0,w)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(O=>(M(O),O)),this}filter(M){return this.steps.push(O=>M(O)?O:v),this}reduce(M,O){let D=O;return this.steps.push(w=>(D=M(D,w),D)),this}latch(M=(O,D)=>O===D){let O=!0,D;return this.steps.push(w=>{let E=O||!M(w,D);return O=!1,D=w,E?w:v}),this}evaluate(M){for(let O of this.steps)if(M=O(M),M===v)break;return M}}function S(B,M,O=D=>D){let D=(...A)=>L.fire(O(...A)),w=()=>B.on(M,D),E=()=>B.removeListener(M,D),L=new te({onWillAddFirstListener:w,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=S;function y(B,M,O=D=>D){let D=(...A)=>L.fire(O(...A)),w=()=>B.addEventListener(M,D),E=()=>B.removeEventListener(M,D),L=new te({onWillAddFirstListener:w,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(M=>d(B)(M))}e.toPromise=m;function x(B){let M=new te;return B.then(O=>{M.fire(O)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=x;function T(B,M){return B(O=>M.fire(O))}e.forward=T;function P(B,M,O){return M(O),B(D=>M(D))}e.runAndSubscribe=P;class I{constructor(M,O){this._observable=M,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};O||t(D),this.emitter=new te(D),O&&O.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,O){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,M){return new I(B,M).emitter.event}e.fromObservable=R;function W(B){return(M,O,D)=>{let w=0,E=!1,L={beginUpdate(){w++},endUpdate(){w--,w===0&&(B.reportChanges(),E&&(E=!1,M.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let A={dispose(){B.removeObserver(L)}};return D instanceof xt?D.add(A):Array.isArray(D)&&D.push(A),A}}e.fromObservableLight=W})(Ve||(Ve={}));var ms=class Ss{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ss._idPool++}`,Ss.all.add(this)}start(t){this._stopWatch=new Ja,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};ms.all=new Set,ms._idPool=0;var el=ms,xr=-1,gn=class vn{constructor(t,r,d=(vn._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=d,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let d=this.threshold;if(d<=0||r<d)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=d*.5;let[i,s]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${s}):`;console.warn(l),console.warn(i);let _=new il(l,i);this._errorHandler(_)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[d,h]of this._stacks)(!t||r<h)&&(t=[d,h],r=h);return t}};gn._idPool=1;var tl=gn,ws=class mn{constructor(t){this.value=t}static create(){let t=new Error;return new mn(t.stack??"")}print(){console.warn(this.value.split(`
|
|
57
|
+
`).slice(2).join(`
|
|
58
|
+
`))}},il=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},sl=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},rl=0,vi=class{constructor(e){this.value=e,this.id=rl++}},nl=2,ol=(e,t)=>{if(e instanceof vi)t(e);else for(let r=0;r<e.length;r++){let d=e[r];d&&t(d)}},mi;if(Za){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
59
|
+
`)),e.length=0)},3e3),mi=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var te=class{constructor(e){this._size=0,this._options=e,this._leakageMon=xr>0||this._options?.leakWarningThreshold?new tl(e?.onListenerError??gi,this._options?.leakWarningThreshold??xr):void 0,this._perfMon=this._options?._profName?new el(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(yr){let e=this._listeners;queueMicrotask(()=>{ol(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new sl(`${l}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(this._options?.onListenerError||gi)(n),xe.None}if(this._disposed)return xe.None;t&&(e=e.bind(t));let d=new vi(e),h,i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(d.stack=ws.create(),h=this._leakageMon.check(d.stack,this._size+1)),yr&&(d.stack=i??ws.create()),this._listeners?this._listeners instanceof vi?(this._deliveryQueue??(this._deliveryQueue=new al),this._listeners=[this._listeners,d]):this._listeners.push(d):(this._options?.onWillAddFirstListener?.(this),this._listeners=d,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=pe(()=>{mi?.unregister(s),h?.(),this._removeListener(d)});if(r instanceof xt?r.add(s):Array.isArray(r)&&r.push(s),mi){let l=new Error().stack.split(`
|
|
60
|
+
`).slice(2,3).join(`
|
|
61
|
+
`).trim(),_=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);mi.register(s,_?.[2]??l,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let d=this._deliveryQueue.current===this;if(this._size*nl<=t.length){let h=0;for(let i=0;i<t.length;i++)t[i]?t[h++]=t[i]:d&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||gi;if(!r){e.value(t);return}try{e.value(t)}catch(d){r(d)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof vi)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},al=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Er={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Wt=2,$t,rt=class bt{constructor(t,r,d){this._document=t,this._config=r,this._unicodeService=d,this._didWarmUp=!1,this._cacheMap=new br,this._cacheMapCombined=new br,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ct,this._textureSize=512,this._onAddTextureAtlasCanvas=new te,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new te,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Sn(t,this._config.deviceCellWidth*4+Wt*2,this._config.deviceCellHeight+Wt*2),this._tmpCtx=he(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Ya;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let d=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,d)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(bt.maxAtlasPages&&this._pages.length>=Math.max(4,bt.maxAtlasPages)){let r=this._pages.filter(n=>n.canvas.width*2<=(bt.maxTextureSize||4096)).sort((n,f)=>f.canvas.width!==n.canvas.width?f.canvas.width-n.canvas.width:f.percentageUsed-n.percentageUsed),d=-1,h=0;for(let n=0;n<r.length;n++)if(r[n].canvas.width!==h)d=n,h=r[n].canvas.width;else if(n-d===3)break;let i=r.slice(d,d+4),s=i.map(n=>n.glyphs[0].texturePage).sort((n,f)=>n>f?1:-1),l=this.pages.length-i.length,_=this._mergePages(i,l);_.version++;for(let n=s.length-1;n>=0;n--)this._deletePage(s[n]);this.pages.push(_),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(_.canvas)}let t=new ts(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let d=t[0].canvas.width*2,h=new ts(this._document,d,t);for(let[i,s]of t.entries()){let l=i*s.canvas.width%d,_=Math.floor(i/2)*s.canvas.height;h.ctx.drawImage(s.canvas,l,_);for(let f of s.glyphs)f.texturePage=r,f.sizeClipSpace.x=f.size.x/d,f.sizeClipSpace.y=f.size.y/d,f.texturePosition.x+=l,f.texturePosition.y+=_,f.texturePositionClipSpace.x=f.texturePosition.x/d,f.texturePositionClipSpace.y=f.texturePosition.y/d;this._onRemoveTextureAtlasCanvas.fire(s.canvas);let n=this._activePages.indexOf(s);n!==-1&&this._activePages.splice(n,1)}return h}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let d=this._pages[r];for(let h of d.glyphs)h.texturePage--;d.version++}}getRasterizedGlyphCombinedChar(t,r,d,h,i,s){return this._getFromCacheMap(this._cacheMapCombined,t,r,d,h,i,s)}getRasterizedGlyph(t,r,d,h,i,s){return this._getFromCacheMap(this._cacheMap,t,r,d,h,i,s)}_getFromCacheMap(t,r,d,h,i,s,l){return $t=t.get(r,d,h,i),$t||($t=this._drawToCache(r,d,h,i,s,l),t.set(r,d,h,i,$t)),$t}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,d,h){if(this._config.allowTransparency)return ke;let i;switch(t){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(r);break;case 50331648:let s=Ct.toColorRGB(r);i=Se.toColor(s[0],s[1],s[2]);break;case 0:default:d?i=jt.opaque(this._config.colors.foreground):i=this._config.colors.background;break}return this._config.allowTransparency||(i=jt.opaque(i)),i}_getForegroundColor(t,r,d,h,i,s,l,_,n,f){let g=this._getMinimumContrastColor(t,r,d,h,i,s,l,n,_,f);if(g)return g;let b;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&n&&s<8&&(s+=8),b=this._getColorFromAnsiIndex(s);break;case 50331648:let p=Ct.toColorRGB(s);b=Se.toColor(p[0],p[1],p[2]);break;case 0:default:l?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=jt.opaque(b)),_&&(b=jt.multiplyOpacity(b,Fa)),b}_resolveBackgroundRgba(t,r,d){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return d?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,d,h){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&h&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return d?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,d,h,i,s,l,_,n,f){if(this._config.minimumContrastRatio===1||f)return;let g=this._getContrastCache(n),b=g.getColor(t,h);if(b!==void 0)return b||void 0;let p=this._resolveBackgroundRgba(r,d,l),a=this._resolveForegroundRgba(i,s,l,_),c=ht.ensureContrastRatio(p,a,this._config.minimumContrastRatio/(n?2:1));if(!c){g.setColor(t,h,null);return}let o=Se.toColor(c>>24&255,c>>16&255,c>>8&255);return g.setColor(t,h,o),o}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,d,h,i,s){let l=typeof t=="number"?String.fromCharCode(t):t;s&&this._tmpCanvas.parentElement!==s&&(this._tmpCanvas.style.display="none",s.append(this._tmpCanvas));let _=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+Wt*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<_&&(this._tmpCanvas.width=_);let n=Math.min(this._config.deviceCellHeight+Wt*4,this._textureSize);if(this._tmpCanvas.height<n&&(this._tmpCanvas.height=n),this._tmpCtx.save(),this._workAttributeData.fg=d,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=h,!!this._workAttributeData.isInvisible())return Er;let f=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),a=!!this._workAttributeData.isUnderline(),c=!!this._workAttributeData.isStrikethrough(),o=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),S=this._workAttributeData.getBgColorMode();if(g){let A=u;u=C,C=A;let F=v;v=S,S=F}let y=this._getBackgroundColor(S,C,g,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let m=f?this._config.fontWeightBold:this._config.fontWeight,x=p?"italic":"";this._tmpCtx.font=`${x} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ln;let T=l.length===1&&ks(l.charCodeAt(0)),P=l.length===1&&Ma(l.charCodeAt(0)),I=this._getForegroundColor(r,S,C,d,v,u,g,b,f,an(l.charCodeAt(0)));this._tmpCtx.fillStyle=I.css;let R=P?0:Wt*2,W=!1;this._config.customGlyphs!==!1&&(W=Ua(this._tmpCtx,l,R,R,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!T,M;if(typeof t=="number"?M=this._unicodeService.wcwidth(t):M=this._unicodeService.getStringCellWidth(t),a){this._tmpCtx.save();let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),F=A%2===1?.5:0;if(this._tmpCtx.lineWidth=A,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${Ct.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let U=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&U<8&&(U+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(U).css}this._tmpCtx.beginPath();let $=R,q=Math.ceil(R+this._config.deviceCharHeight)-F-(i?A*2:0),J=q+A,H=q+A*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let U=0;U<M;U++){this._tmpCtx.save();let z=$+U*this._config.deviceCellWidth,G=$+(U+1)*this._config.deviceCellWidth,V=z+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(z,q),this._tmpCtx.lineTo(G,q),this._tmpCtx.moveTo(z,H),this._tmpCtx.lineTo(G,H);break;case 3:let N=A<=1?H:Math.ceil(R+this._config.deviceCharHeight-A/2)-F,j=A<=1?q:Math.ceil(R+this._config.deviceCharHeight+A/2)-F,K=new Path2D;K.rect(z,q,this._config.deviceCellWidth,H-q),this._tmpCtx.clip(K),this._tmpCtx.moveTo(z-this._config.deviceCellWidth/2,J),this._tmpCtx.bezierCurveTo(z-this._config.deviceCellWidth/2,j,z,j,z,J),this._tmpCtx.bezierCurveTo(z,N,V,N,V,J),this._tmpCtx.bezierCurveTo(V,j,G,j,G,J),this._tmpCtx.bezierCurveTo(G,N,G+this._config.deviceCellWidth/2,N,G+this._config.deviceCellWidth/2,J);break;case 4:let Y=k===0?0:k>=A?A*2-k:A-k;k>=A||Y===0?(this._tmpCtx.setLineDash([Math.round(A),Math.round(A)]),this._tmpCtx.moveTo(z+Y,q),this._tmpCtx.lineTo(G,q)):(this._tmpCtx.setLineDash([Math.round(A),Math.round(A)]),this._tmpCtx.moveTo(z,q),this._tmpCtx.lineTo(z+Y,q),this._tmpCtx.moveTo(z+Y+A,q),this._tmpCtx.lineTo(G,q)),k=Ia(G-z,A,k);break;case 5:let X=.6,ie=.3,ne=G-z,Z=Math.floor(X*ne),oe=Math.floor(ie*ne),Me=ne-Z-oe;this._tmpCtx.setLineDash([Z,oe,Me]),this._tmpCtx.moveTo(z,q),this._tmpCtx.lineTo(G,q);break;case 1:default:this._tmpCtx.moveTo(z,q),this._tmpCtx.lineTo(G,q);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!W&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let U=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in U&&U.actualBoundingBoxDescent>0){this._tmpCtx.save();let z=new Path2D;z.rect($,q-Math.ceil(A/2),this._config.deviceCellWidth*M,H-q+Math.ceil(A/2)),this._tmpCtx.clip(z),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(l,R,R+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(o){let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),F=A%2===1?.5:0;this._tmpCtx.lineWidth=A,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+F),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*M,R+F),this._tmpCtx.stroke()}if(W||this._tmpCtx.fillText(l,R,R+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let A=is(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,I,B);if(A)for(let F=1;F<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,R,R+this._config.deviceCharHeight-F),A=is(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,I,B),!!A);F++);}if(c){let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),F=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=A,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+Math.floor(this._config.deviceCharHeight/2)-F),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*M,R+Math.floor(this._config.deviceCharHeight/2)-F),this._tmpCtx.stroke()}this._tmpCtx.restore();let O=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),D;if(this._config.allowTransparency?D=ll(O):D=is(O,y,I,B),D)return Er;let w=this._findGlyphBoundingBox(O,this._workBoundingBox,_,P,W,R),E,L;for(;;){if(this._activePages.length===0){let A=this._createNewPage();E=A,L=A.currentRow,L.height=w.size.y;break}E=this._activePages[this._activePages.length-1],L=E.currentRow;for(let A of this._activePages)w.size.y<=A.currentRow.height&&(E=A,L=A.currentRow);for(let A=this._activePages.length-1;A>=0;A--)for(let F of this._activePages[A].fixedRows)F.height<=L.height&&w.size.y<=F.height&&(E=this._activePages[A],L=F);if(w.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ts(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+w.size.x>=E.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+w.size.y>=E.canvas.height||L.height>w.size.y+2){let A=!1;if(E.currentRow.y+E.currentRow.height+w.size.y>=E.canvas.height){let F;for(let $ of this._activePages)if($.currentRow.y+$.currentRow.height+w.size.y<$.canvas.height){F=$;break}if(F)E=F;else if(bt.maxAtlasPages&&this._pages.length>=bt.maxAtlasPages&&L.y+w.size.y<=E.canvas.height&&L.height>=w.size.y&&L.x+w.size.x<=E.canvas.width)A=!0;else{let $=this._createNewPage();E=$,L=$.currentRow,L.height=w.size.y,A=!0}}A||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),L={x:0,y:E.currentRow.y+E.currentRow.height,height:w.size.y},E.fixedRows.push(L),E.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+w.size.x<=E.canvas.width)break;L===E.currentRow?(L.x=0,L.y+=L.height,L.height=0):E.fixedRows.splice(E.fixedRows.indexOf(L),1)}return w.texturePage=this._pages.indexOf(E),w.texturePosition.x=L.x,w.texturePosition.y=L.y,w.texturePositionClipSpace.x=L.x/E.canvas.width,w.texturePositionClipSpace.y=L.y/E.canvas.height,w.sizeClipSpace.x/=E.canvas.width,w.sizeClipSpace.y/=E.canvas.height,L.height=Math.max(L.height,w.size.y),L.x+=w.size.x,E.ctx.putImageData(O,w.texturePosition.x-this._workBoundingBox.left,w.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,w.size.x,w.size.y),E.addGlyph(w),E.version++,w}_findGlyphBoundingBox(t,r,d,h,i,s){r.top=0;let l=h?this._config.deviceCellHeight:this._tmpCanvas.height,_=h?this._config.deviceCellWidth:d,n=!1;for(let f=0;f<l;f++){for(let g=0;g<_;g++){let b=f*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){r.top=f,n=!0;break}}if(n)break}r.left=0,n=!1;for(let f=0;f<s+_;f++){for(let g=0;g<l;g++){let b=g*this._tmpCanvas.width*4+f*4+3;if(t.data[b]!==0){r.left=f,n=!0;break}}if(n)break}r.right=_,n=!1;for(let f=s+_-1;f>=s;f--){for(let g=0;g<l;g++){let b=g*this._tmpCanvas.width*4+f*4+3;if(t.data[b]!==0){r.right=f,n=!0;break}}if(n)break}r.bottom=l,n=!1;for(let f=l-1;f>=0;f--){for(let g=0;g<_;g++){let b=f*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){r.bottom=f,n=!0;break}}if(n)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+s+(h||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+s+(h||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},ts=class{constructor(e,t,r){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],r)for(let d of r)this._glyphs.push(...d.glyphs),this._usedPixels+=d._usedPixels;this.canvas=Sn(e,t,t),this.ctx=he(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function is(e,t,r,d){let h=t.rgba>>>24,i=t.rgba>>>16&255,s=t.rgba>>>8&255,l=r.rgba>>>24,_=r.rgba>>>16&255,n=r.rgba>>>8&255,f=Math.floor((Math.abs(h-l)+Math.abs(i-_)+Math.abs(s-n))/12),g=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===h&&e.data[b+1]===i&&e.data[b+2]===s||d&&Math.abs(e.data[b]-h)+Math.abs(e.data[b+1]-i)+Math.abs(e.data[b+2]-s)<f?e.data[b+3]=0:g=!1;return g}function ll(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function Sn(e,t,r){let d=e.createElement("canvas");return d.width=t,d.height=r,d}function hl(e,t,r,d,h,i,s,l){let _={foreground:i.foreground,background:i.background,cursor:ke,cursorAccent:ke,selectionForeground:ke,selectionBackgroundTransparent:ke,selectionBackgroundOpaque:ke,selectionInactiveBackgroundTransparent:ke,selectionInactiveBackgroundOpaque:ke,overviewRulerBorder:ke,scrollbarSliderBackground:ke,scrollbarSliderHoverBackground:ke,scrollbarSliderActiveBackground:ke,ansi:i.ansi.slice(),contrastCache:i.contrastCache,halfContrastCache:i.halfContrastCache};return{customGlyphs:h.customGlyphs,devicePixelRatio:s,deviceMaxTextureSize:l,letterSpacing:h.letterSpacing,lineHeight:h.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:d,fontFamily:h.fontFamily,fontSize:h.fontSize,fontWeight:h.fontWeight,fontWeightBold:h.fontWeightBold,allowTransparency:h.allowTransparency,drawBoldTextInBrightColors:h.drawBoldTextInBrightColors,minimumContrastRatio:h.minimumContrastRatio,colors:_}}function Lr(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function cl(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Ae=[];function wn(e,t,r,d,h,i,s,l,_){let n=hl(d,h,i,s,t,r,l,_);for(let b=0;b<Ae.length;b++){let p=Ae[b],a=p.ownedBy.indexOf(e);if(a>=0){if(Lr(p.config,n))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),Ae.splice(b,1)):p.ownedBy.splice(a,1);break}}for(let b=0;b<Ae.length;b++){let p=Ae[b];if(Lr(p.config,n))return p.ownedBy.push(e),p.atlas}let f=e._core,g={atlas:new rt(document,n,f.unicodeService),config:n,ownedBy:[e]};return Ae.push(g),g.atlas}function kr(e){for(let t=0;t<Ae.length;t++){let r=Ae[t].ownedBy.indexOf(e);if(r!==-1){Ae[t].ownedBy.length===1?(Ae[t].atlas.dispose(),Ae.splice(t,1)):Ae[t].ownedBy.splice(r,1);break}}}var fi=600,dl=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=fi){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=fi-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=fi-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},fi)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Rr(e,t,r){let d=new t.ResizeObserver(h=>{let i=h.find(_=>_.target===e);if(!i)return;if(!("devicePixelContentBoxSize"in i)){d?.disconnect(),d=void 0;return}let s=i.devicePixelContentBoxSize[0].inlineSize,l=i.devicePixelContentBoxSize[0].blockSize;s>0&&l>0&&r(s,l)});try{d.observe(e,{box:["device-pixel-content-box"]})}catch{d.disconnect(),d=void 0}return pe(()=>d?.disconnect())}function ul(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Ar=class bn extends Ct{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _n,this.combinedData=""}static fromCharData(t){let r=new bn;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ul(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let d=t[1].charCodeAt(0);if(55296<=d&&d<=56319){let h=t[1].charCodeAt(1);56320<=h&&h<=57343?this.content=(d-55296)*1024+h-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Cn=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function yn(e,t,r){let d=he(e.createProgram());if(e.attachShader(d,he(Mr(e,e.VERTEX_SHADER,t))),e.attachShader(d,he(Mr(e,e.FRAGMENT_SHADER,r))),e.linkProgram(d),e.getProgramParameter(d,e.LINK_STATUS))return d;console.error(e.getProgramInfoLog(d)),e.deleteProgram(d)}function Mr(e,t,r){let d=he(e.createShader(t));if(e.shaderSource(d,r),e.compileShader(d),e.getShaderParameter(d,e.COMPILE_STATUS))return d;console.error(e.getShaderInfoLog(d)),e.deleteShader(d)}function _l(e,t){let r=Math.min(e.length*2,t),d=new Float32Array(r);for(let h=0;h<e.length;h++)d[h]=e[h];return d}var fl=class{constructor(e){this.texture=e,this.version=-1}},pl=`#version 300 es
|
|
62
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
63
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
64
|
+
layout (location = 2) in vec2 a_offset;
|
|
65
|
+
layout (location = 3) in vec2 a_size;
|
|
66
|
+
layout (location = 4) in float a_texpage;
|
|
67
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
68
|
+
layout (location = 6) in vec2 a_texsize;
|
|
69
|
+
|
|
70
|
+
uniform mat4 u_projection;
|
|
71
|
+
uniform vec2 u_resolution;
|
|
72
|
+
|
|
73
|
+
out vec2 v_texcoord;
|
|
74
|
+
flat out int v_texpage;
|
|
75
|
+
|
|
76
|
+
void main() {
|
|
77
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
78
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
79
|
+
v_texpage = int(a_texpage);
|
|
80
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
81
|
+
}`;function gl(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
|
|
82
|
+
precision lowp float;
|
|
83
|
+
|
|
84
|
+
in vec2 v_texcoord;
|
|
85
|
+
flat in int v_texpage;
|
|
86
|
+
|
|
87
|
+
uniform sampler2D u_texture[${e}];
|
|
88
|
+
|
|
89
|
+
out vec4 outColor;
|
|
90
|
+
|
|
91
|
+
void main() {
|
|
92
|
+
if (v_texpage == 0) {
|
|
93
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
94
|
+
} ${t}
|
|
95
|
+
}`}var nt=11,wt=nt*Float32Array.BYTES_PER_ELEMENT,vl=2,ae=0,se,ss=0,Ut=0,ml=class extends xe{constructor(e,t,r,d){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._optionsService=d,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let h=this._gl;rt.maxAtlasPages===void 0&&(rt.maxAtlasPages=Math.min(32,he(h.getParameter(h.MAX_TEXTURE_IMAGE_UNITS))),rt.maxTextureSize=he(h.getParameter(h.MAX_TEXTURE_SIZE))),this._program=he(yn(h,pl,gl(rt.maxAtlasPages))),this._register(pe(()=>h.deleteProgram(this._program))),this._projectionLocation=he(h.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=he(h.getUniformLocation(this._program,"u_resolution")),this._textureLocation=he(h.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let i=new Float32Array([0,0,1,0,0,1,1,1]),s=h.createBuffer();this._register(pe(()=>h.deleteBuffer(s))),h.bindBuffer(h.ARRAY_BUFFER,s),h.bufferData(h.ARRAY_BUFFER,i,h.STATIC_DRAW),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),_=h.createBuffer();this._register(pe(()=>h.deleteBuffer(_))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_),h.bufferData(h.ELEMENT_ARRAY_BUFFER,l,h.STATIC_DRAW),this._attributesBuffer=he(h.createBuffer()),this._register(pe(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,2,h.FLOAT,!1,wt,0),h.vertexAttribDivisor(2,1),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,h.FLOAT,!1,wt,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(3,1),h.enableVertexAttribArray(4),h.vertexAttribPointer(4,1,h.FLOAT,!1,wt,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(4,1),h.enableVertexAttribArray(5),h.vertexAttribPointer(5,2,h.FLOAT,!1,wt,5*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(5,1),h.enableVertexAttribArray(6),h.vertexAttribPointer(6,2,h.FLOAT,!1,wt,7*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(6,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,wt,9*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.useProgram(this._program);let n=new Int32Array(rt.maxAtlasPages);for(let f=0;f<rt.maxAtlasPages;f++)n[f]=f;h.uniform1iv(this._textureLocation,n),h.uniformMatrix4fv(this._projectionLocation,!1,Cn),this._atlasTextures=[];for(let f=0;f<rt.maxAtlasPages;f++){let g=new fl(he(h.createTexture()));this._register(pe(()=>h.deleteTexture(g.texture))),h.activeTexture(h.TEXTURE0+f),h.bindTexture(h.TEXTURE_2D,g.texture),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,1,1,0,h.RGBA,h.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[f]=g}h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,r,d,h,i,s,l,_){this._updateCell(this._vertices.attributes,e,t,r,d,h,i,s,l,_)}_updateCell(e,t,r,d,h,i,s,l,_,n){if(ae=(r*this._terminal.cols+t)*nt,d===0||d===void 0){e.fill(0,ae,ae+nt-1-vl);return}this._atlas&&(l&&l.length>1?se=this._atlas.getRasterizedGlyphCombinedChar(l,h,i,s,!1,this._terminal.element):se=this._atlas.getRasterizedGlyph(d,h,i,s,!1,this._terminal.element),ss=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),h!==n&&se.offset.x>ss?(Ut=se.offset.x-ss,e[ae]=-(se.offset.x-Ut)+this._dimensions.device.char.left,e[ae+1]=-se.offset.y+this._dimensions.device.char.top,e[ae+2]=(se.size.x-Ut)/this._dimensions.device.canvas.width,e[ae+3]=se.size.y/this._dimensions.device.canvas.height,e[ae+4]=se.texturePage,e[ae+5]=se.texturePositionClipSpace.x+Ut/this._atlas.pages[se.texturePage].canvas.width,e[ae+6]=se.texturePositionClipSpace.y,e[ae+7]=se.sizeClipSpace.x-Ut/this._atlas.pages[se.texturePage].canvas.width,e[ae+8]=se.sizeClipSpace.y):(e[ae]=-se.offset.x+this._dimensions.device.char.left,e[ae+1]=-se.offset.y+this._dimensions.device.char.top,e[ae+2]=se.size.x/this._dimensions.device.canvas.width,e[ae+3]=se.size.y/this._dimensions.device.canvas.height,e[ae+4]=se.texturePage,e[ae+5]=se.texturePositionClipSpace.x,e[ae+6]=se.texturePositionClipSpace.y,e[ae+7]=se.sizeClipSpace.x,e[ae+8]=se.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Pa(d,_,se.size.x,this._dimensions.device.cell.width)&&(e[ae+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*nt;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let r=0;for(;r<this._vertices.attributesBuffers.length;r++)this._vertices.count!==t?this._vertices.attributesBuffers[r]=new Float32Array(t):this._vertices.attributesBuffers[r].fill(0);this._vertices.count=t,r=0;for(let d=0;d<e.rows;d++)for(let h=0;h<e.cols;h++)this._vertices.attributes[r+9]=h/e.cols,this._vertices.attributes[r+10]=d/e.rows,r+=nt}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let r=this._vertices.attributesBuffers[this._activeBuffer],d=0;for(let h=0;h<e.lineLengths.length;h++){let i=h*this._terminal.cols*nt,s=this._vertices.attributes.subarray(i,i+e.lineLengths[h]*nt);r.set(s,d),d+=s.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,r.subarray(0,d),t.STREAM_DRAW);for(let h=0;h<this._atlas.pages.length;h++)this._atlas.pages[h].version!==this._atlasTextures[h].version&&this._bindAtlasPageTexture(t,this._atlas,h);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,d/nt)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,r){e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[r].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[r].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[r].version=t.pages[r].version}setDimensions(e){this._dimensions=e}},Sl=class{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(e,t,r,d=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let h=e.buffers.active.ydisp,i=t[1]-h,s=r[1]-h,l=Math.max(i,0),_=Math.min(s,e.rows-1);if(l>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=i,this.viewportEndRow=s,this.viewportCappedStartRow=l,this.viewportCappedEndRow=_,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function wl(){return new Sl}var Ei=4,Si=1,wi=2,rs=3,bl=2147483648,Cl=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=wl()}resize(e,t){let r=e*t*Ei;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},yl=`#version 300 es
|
|
96
|
+
layout (location = 0) in vec2 a_position;
|
|
97
|
+
layout (location = 1) in vec2 a_size;
|
|
98
|
+
layout (location = 2) in vec4 a_color;
|
|
99
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
100
|
+
|
|
101
|
+
uniform mat4 u_projection;
|
|
102
|
+
|
|
103
|
+
out vec4 v_color;
|
|
104
|
+
|
|
105
|
+
void main() {
|
|
106
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
107
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
108
|
+
v_color = a_color;
|
|
109
|
+
}`,xl=`#version 300 es
|
|
110
|
+
precision lowp float;
|
|
111
|
+
|
|
112
|
+
in vec4 v_color;
|
|
113
|
+
|
|
114
|
+
out vec4 outColor;
|
|
115
|
+
|
|
116
|
+
void main() {
|
|
117
|
+
outColor = v_color;
|
|
118
|
+
}`,Ge=8,ns=Ge*Float32Array.BYTES_PER_ELEMENT,El=20*Ge,Dr=class{constructor(){this.attributes=new Float32Array(El),this.count=0}},qe=0,Tr=0,Br=0,Pr=0,Or=0,Ir=0,Hr=0,Ll=class extends xe{constructor(e,t,r,d){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=d,this._vertices=new Dr,this._verticesCursor=new Dr;let h=this._gl;this._program=he(yn(h,yl,xl)),this._register(pe(()=>h.deleteProgram(this._program))),this._projectionLocation=he(h.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let i=new Float32Array([0,0,1,0,0,1,1,1]),s=h.createBuffer();this._register(pe(()=>h.deleteBuffer(s))),h.bindBuffer(h.ARRAY_BUFFER,s),h.bufferData(h.ARRAY_BUFFER,i,h.STATIC_DRAW),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),_=h.createBuffer();this._register(pe(()=>h.deleteBuffer(_))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_),h.bufferData(h.ELEMENT_ARRAY_BUFFER,l,h.STATIC_DRAW),this._attributesBuffer=he(h.createBuffer()),this._register(pe(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,ns,0),h.vertexAttribDivisor(0,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,ns,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,ns,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(2,1),this._updateCachedColors(d.colors),this._register(this._themeService.onChangeColors(n=>{this._updateCachedColors(n),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,Cn),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,d=1,h,i,s,l,_,n,f,g,b,p,a;for(h=0;h<t.rows;h++){for(s=-1,l=0,_=0,n=!1,i=0;i<t.cols;i++)f=(h*t.cols+i)*Ei,g=e.cells[f+Si],b=e.cells[f+wi],p=!!(b&67108864),(g!==l||b!==_&&(n||p))&&((l!==0||n&&_!==0)&&(a=d++*Ge,this._updateRectangle(r,a,_,l,s,i,h)),s=i,l=g,_=b,n=p);(l!==0||n&&_!==0)&&(a=d++*Ge,this._updateRectangle(r,a,_,l,s,t.cols,h))}r.count=d}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let d,h=0;(r.style==="bar"||r.style==="outline")&&(d=h++*Ge,this._addRectangleFloat(t.attributes,d,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(d=h++*Ge,this._addRectangleFloat(t.attributes,d,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(d=h++*Ge,this._addRectangleFloat(t.attributes,d,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),d=h++*Ge,this._addRectangleFloat(t.attributes,d,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=h}_updateRectangle(e,t,r,d,h,i,s){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:qe=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:qe=(r&16777215)<<8;break;case 0:default:qe=this._themeService.colors.foreground.rgba}else switch(d&50331648){case 16777216:case 33554432:qe=this._themeService.colors.ansi[d&255].rgba;break;case 50331648:qe=(d&16777215)<<8;break;case 0:default:qe=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=_l(e.attributes,this._terminal.rows*this._terminal.cols*Ge)),Tr=h*this._dimensions.device.cell.width,Br=s*this._dimensions.device.cell.height,Pr=(qe>>24&255)/255,Or=(qe>>16&255)/255,Ir=(qe>>8&255)/255,Hr=1,this._addRectangle(e.attributes,t,Tr,Br,(i-h)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Pr,Or,Ir,Hr)}_addRectangle(e,t,r,d,h,i,s,l,_,n){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=d/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=i/this._dimensions.device.canvas.height,e[t+4]=s,e[t+5]=l,e[t+6]=_,e[t+7]=n}_addRectangleFloat(e,t,r,d,h,i,s){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=d/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=i/this._dimensions.device.canvas.height,e[t+4]=s[0],e[t+5]=s[1],e[t+6]=s[2],e[t+7]=s[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},kl=class extends xe{constructor(e,t,r,d,h,i,s,l){super(),this._container=t,this._alpha=h,this._coreBrowserService=i,this._optionsService=s,this._themeService=l,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=d.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(_=>{this._refreshCharAtlas(e,_),this.reset(e)})),this._register(pe(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=he(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,d=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=wn(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,r,d){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,d*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,d*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,d){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ln,this._clipCell(r,d,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,d*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let d=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${d} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Rl=class extends kl{constructor(e,t,r,d,h,i,s){super(r,e,"link",t,!0,h,i,s),this._register(d.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(d.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&cl(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},De=typeof window=="object"?window:globalThis,bs=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new te,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new te,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let d=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(d,t),this._onDidChangeZoomLevel.fire(d)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let d=this.getWindowId(r);this.mapWindowIdToFullScreen.set(d,t),this._onDidChangeFullscreen.fire(d)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};bs.INSTANCE=new bs;var xn=bs;function Al(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}var Cd=xn.INSTANCE.onDidChangeZoomLevel,yd=xn.INSTANCE.onDidChangeFullscreen,Lt=typeof navigator=="object"?navigator.userAgent:"",xd=Lt.indexOf("Firefox")>=0,os=Lt.indexOf("AppleWebKit")>=0,Ml=Lt.indexOf("Chrome")>=0,Dl=!Ml&&Lt.indexOf("Safari")>=0,Ed=Lt.indexOf("Electron/")>=0,Ld=Lt.indexOf("Android")>=0,bi=!1;if(typeof De.matchMedia=="function"){let e=De.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=De.matchMedia("(display-mode: fullscreen)");bi=e.matches,Al(De,e,({matches:r})=>{bi&&t.matches||(bi=r)})}function Tl(){return bi}var yt="en",Cs=!1,ys=!1,Ci=!1,Bl=!1,En=!1,Ln=!1,Pl=!1,Ol=!1,Il=!1,Hl=!1,pi,yi=yt,Fr=yt,Fl,Ke,Xe=globalThis,ye;typeof Xe.vscode<"u"&&typeof Xe.vscode.process<"u"?ye=Xe.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ye=process);var kn=typeof ye?.versions?.electron=="string",Nl=kn&&ye?.type==="renderer";if(typeof ye=="object"){Cs=ye.platform==="win32",ys=ye.platform==="darwin",Ci=ye.platform==="linux",Bl=Ci&&!!ye.env.SNAP&&!!ye.env.SNAP_REVISION,Pl=kn,Il=!!ye.env.CI||!!ye.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pi=yt,yi=yt;let e=ye.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);pi=t.userLocale,Fr=t.osLocale,yi=t.resolvedLanguage||yt,Fl=t.languagePack?.translationsConfigFile}catch{}En=!0}else typeof navigator=="object"&&!Nl?(Ke=navigator.userAgent,Cs=Ke.indexOf("Windows")>=0,ys=Ke.indexOf("Macintosh")>=0,Ol=(Ke.indexOf("Macintosh")>=0||Ke.indexOf("iPad")>=0||Ke.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ci=Ke.indexOf("Linux")>=0,Hl=Ke?.indexOf("Mobi")>=0,Ln=!0,yi=globalThis._VSCODE_NLS_LANGUAGE||yt,pi=navigator.language.toLowerCase(),Fr=pi):console.error("Unable to resolve platform.");var as=0;ys?as=1:Cs?as=3:Ci&&(as=2);var ls=En,Wl=Ln&&typeof Xe.importScripts=="function",kd=Wl?Xe.origin:void 0,He=Ke,it=yi,$l;(e=>{function t(){return it}e.value=t;function r(){return it.length===2?it==="en":it.length>=3?it[0]==="e"&&it[1]==="n"&&it[2]==="-":!1}e.isDefaultVariant=r;function d(){return it==="en"}e.isDefault=d})($l||($l={}));var Ul=typeof Xe.postMessage=="function"&&!Xe.importScripts,zl=(()=>{if(Ul){let e=[];Xe.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let d=0,h=e.length;d<h;d++){let i=e[d];if(i.id===r.data.vscodeScheduleAsyncWork){e.splice(d,1),i.callback();return}}});let t=0;return r=>{let d=++t;e.push({id:d,callback:r}),Xe.postMessage({vscodeScheduleAsyncWork:d},"*")}}return e=>setTimeout(e)})(),jl=!!(He&&He.indexOf("Chrome")>=0),Rd=!!(He&&He.indexOf("Firefox")>=0),Ad=!!(!jl&&He&&He.indexOf("Safari")>=0),Md=!!(He&&He.indexOf("Edg/")>=0),Dd=!!(He&&He.indexOf("Android")>=0),st=typeof navigator=="object"?navigator:{},Td={clipboard:{writeText:ls||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(st&&st.clipboard&&st.clipboard.writeText),readText:ls||!!(st&&st.clipboard&&st.clipboard.readText)},keyboard:ls||Tl()?0:st.keyboard||Dl?1:2,touch:"ontouchstart"in De||st.maxTouchPoints>0,pointerEvents:De.PointerEvent&&("ontouchstart"in De||navigator.maxTouchPoints>0)},Rs=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},hs=new Rs,Nr=new Rs,Wr=new Rs,Bd=new Array(230),ql;(e=>{function t(l){return hs.keyCodeToStr(l)}e.toString=t;function r(l){return hs.strToKeyCode(l)}e.fromString=r;function d(l){return Nr.keyCodeToStr(l)}e.toUserSettingsUS=d;function h(l){return Wr.keyCodeToStr(l)}e.toUserSettingsGeneral=h;function i(l){return Nr.strToKeyCode(l)||Wr.strToKeyCode(l)}e.fromUserSettings=i;function s(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return hs.keyCodeToStr(l)}e.toElectronAccelerator=s})(ql||(ql={}));var Rn=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Kl;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Gl?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ve.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Rn})})(Kl||(Kl={}));var Gl=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Rn:(this._emitter||(this._emitter=new te),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Pd=Symbol("MicrotaskDelay"),Vl,cs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?cs=(e,t)=>{zl(()=>{if(r)return;let d=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,d-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:cs=(e,t,r)=>{let d=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(d))}}},Vl=e=>cs(globalThis,e)})();var Yl;(e=>{async function t(d){let h,i=await Promise.all(d.map(s=>s.then(l=>l,l=>{h||(h=l)})));if(typeof h<"u")throw h;return i}e.settled=t;function r(d){return new Promise(async(h,i)=>{try{await d(h,i)}catch(s){i(s)}})}e.withAsyncBody=r})(Yl||(Yl={}));var $r=class Re{static fromArray(t){return new Re(r=>{r.emitMany(t)})}static fromPromise(t){return new Re(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Re(async r=>{await Promise.all(t.map(async d=>r.emitOne(await d)))})}static merge(t){return new Re(async r=>{await Promise.all(t.map(async d=>{for await(let h of d)r.emitOne(h)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new te,queueMicrotask(async()=>{let d={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(d)),this.resolve()}catch(h){this.reject(h)}finally{d.emitOne=void 0,d.emitMany=void 0,d.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ve.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new Re(async d=>{for await(let h of t)d.emitOne(r(h))})}map(t){return Re.map(this,t)}static filter(t,r){return new Re(async d=>{for await(let h of t)r(h)&&d.emitOne(h)})}filter(t){return Re.filter(this,t)}static coalesce(t){return Re.filter(t,r=>!!r)}coalesce(){return Re.coalesce(this)}static async toPromise(t){let r=[];for await(let d of t)r.push(d);return r}toPromise(){return Re.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};$r.EMPTY=$r.fromArray([]);function Xl(e){return 55296<=e&&e<=56319}function Ur(e){return 56320<=e&&e<=57343}function Jl(e,t){return(e-55296<<10)+(t-56320)+65536}function Zl(e){return As(e,0)}function As(e,t){switch(typeof e){case"object":return e===null?Ye(349,t):Array.isArray(e)?eh(e,t):th(e,t);case"string":return An(e,t);case"boolean":return Ql(e,t);case"number":return Ye(e,t);case"undefined":return Ye(937,t);default:return Ye(617,t)}}function Ye(e,t){return(t<<5)-t+e|0}function Ql(e,t){return Ye(e?433:863,t)}function An(e,t){t=Ye(149417,t);for(let r=0,d=e.length;r<d;r++)t=Ye(e.charCodeAt(r),t);return t}function eh(e,t){return t=Ye(104579,t),e.reduce((r,d)=>As(d,r),t)}function th(e,t){return t=Ye(181387,t),Object.keys(e).sort().reduce((r,d)=>(r=An(d,r),As(e[d],r)),t)}function ds(e,t,r=32){let d=r-t,h=~((1<<d)-1);return(e<<t|(h&e)>>>d)>>>0}function zr(e,t=0,r=e.byteLength,d=0){for(let h=0;h<r;h++)e[t+h]=d}function ih(e,t,r="0"){for(;e.length<t;)e=r+e;return e}function zt(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""):ih((e>>>0).toString(16),t/4)}var sh=class Mn{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let r=t.length;if(r===0)return;let d=this._buff,h=this._buffLen,i=this._leftoverHighSurrogate,s,l;for(i!==0?(s=i,l=-1,i=0):(s=t.charCodeAt(0),l=0);;){let _=s;if(Xl(s))if(l+1<r){let n=t.charCodeAt(l+1);Ur(n)?(l++,_=Jl(s,n)):_=65533}else{i=s;break}else Ur(s)&&(_=65533);if(h=this._push(d,h,_),l++,l<r)s=t.charCodeAt(l);else break}this._buffLen=h,this._leftoverHighSurrogate=i}_push(t,r,d){return d<128?t[r++]=d:d<2048?(t[r++]=192|(d&1984)>>>6,t[r++]=128|(d&63)>>>0):d<65536?(t[r++]=224|(d&61440)>>>12,t[r++]=128|(d&4032)>>>6,t[r++]=128|(d&63)>>>0):(t[r++]=240|(d&1835008)>>>18,t[r++]=128|(d&258048)>>>12,t[r++]=128|(d&4032)>>>6,t[r++]=128|(d&63)>>>0),r>=64&&(this._step(),r-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),r}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),zt(this._h0)+zt(this._h1)+zt(this._h2)+zt(this._h3)+zt(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,zr(this._buff,this._buffLen),this._buffLen>56&&(this._step(),zr(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=Mn._bigBlock32,r=this._buffDV;for(let g=0;g<64;g+=4)t.setUint32(g,r.getUint32(g,!1),!1);for(let g=64;g<320;g+=4)t.setUint32(g,ds(t.getUint32(g-12,!1)^t.getUint32(g-32,!1)^t.getUint32(g-56,!1)^t.getUint32(g-64,!1),1),!1);let d=this._h0,h=this._h1,i=this._h2,s=this._h3,l=this._h4,_,n,f;for(let g=0;g<80;g++)g<20?(_=h&i|~h&s,n=1518500249):g<40?(_=h^i^s,n=1859775393):g<60?(_=h&i|h&s|i&s,n=2400959708):(_=h^i^s,n=3395469782),f=ds(d,5)+_+l+n+t.getUint32(g*4,!1)&4294967295,l=s,s=i,i=ds(h,30),h=d,d=f;this._h0=this._h0+d&4294967295,this._h1=this._h1+h&4294967295,this._h2=this._h2+i&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+l&4294967295}};sh._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Od,getWindow:rh,getDocument:Id,getWindows:Hd,getWindowsCount:Fd,getWindowId:jr,getWindowById:Nd,hasWindow:Wd,onDidRegisterWindow:$d,onWillUnregisterWindow:Ud,onDidUnregisterWindow:zd}=function(){let e=new Map,t={window:De,disposables:new xt};e.set(De.vscodeWindowId,t);let r=new te,d=new te,h=new te;function i(s,l){return(typeof s=="number"?e.get(s):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:h.event,onDidUnregisterWindow:d.event,registerWindow(s){if(e.has(s.vscodeWindowId))return xe.None;let l=new xt,_={window:s,disposables:l.add(new xt)};return e.set(s.vscodeWindowId,_),l.add(pe(()=>{e.delete(s.vscodeWindowId),d.fire(s)})),l.add(xs(s,ah.BEFORE_UNLOAD,()=>{h.fire(s)})),r.fire(_),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(s){return s.vscodeWindowId},hasWindow(s){return e.has(s)},getWindowById:i,getWindow(s){let l=s;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let _=s;return _?.view?_.view.window:De},getDocument(s){return rh(s).document}}}(),nh=class{constructor(e,t,r,d){this._node=e,this._type=t,this._handler=r,this._options=d||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function xs(e,t,r,d){return new nh(e,t,r,d)}var oh,qr,us=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){gi(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,d=new Map,h=i=>{r.set(i,!1);let s=e.get(i)??[];for(t.set(i,s),e.set(i,[]),d.set(i,!0);s.length>0;)s.sort(us.sort),s.shift().execute();d.set(i,!1)};qr=(i,s,l=0)=>{let _=jr(i),n=new us(s,l),f=e.get(_);return f||(f=[],e.set(_,f)),f.push(n),r.get(_)||(r.set(_,!0),i.requestAnimationFrame(()=>h(_))),n},oh=(i,s,l)=>{let _=jr(i);if(d.get(_)){let n=new us(s,l),f=t.get(_);return f||(f=[],t.set(_,f)),f.push(n),n}else return qr(i,s,l)}})();var Kr=class xi{constructor(t,r){this.width=t,this.height=r}with(t=this.width,r=this.height){return t!==this.width||r!==this.height?new xi(t,r):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof xi?t:new xi(t.width,t.height)}static equals(t,r){return t===r?!0:!t||!r?!1:t.width===r.width&&t.height===r.height}};Kr.None=new Kr(0,0);var jd=new class{constructor(){this.mutationObservers=new Map}observe(e,t,r){let d=this.mutationObservers.get(e);d||(d=new Map,this.mutationObservers.set(e,d));let h=Zl(r),i=d.get(h);if(i)i.users+=1;else{let s=new te,l=new MutationObserver(n=>s.fire(n));l.observe(e,r);let _=i={users:1,observer:l,onDidMutate:s.event};t.add(pe(()=>{_.users-=1,_.users===0&&(s.dispose(),l.disconnect(),d?.delete(h),d?.size===0&&this.mutationObservers.delete(e))})),d.set(h,i)}return i.onDidMutate}},ah={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:os?"webkitAnimationStart":"animationstart",ANIMATION_END:os?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:os?"webkitAnimationIteration":"animationiteration"},lh=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Dn(e,t,r,...d){let h=lh.exec(t);if(!h)throw new Error("Bad use of emmet");let i=h[1]||"div",s;return e!=="http://www.w3.org/1999/xhtml"?s=document.createElementNS(e,i):s=document.createElement(i),h[3]&&(s.id=h[3]),h[4]&&(s.className=h[4].replace(/\./g," ").trim()),r&&Object.entries(r).forEach(([l,_])=>{typeof _>"u"||(/^on\w+$/.test(l)?s[l]=_:l==="selected"?_&&s.setAttribute(l,"true"):s.setAttribute(l,_))}),s.append(...d),s}function hh(e,t,...r){return Dn("http://www.w3.org/1999/xhtml",e,t,...r)}hh.SVG=function(e,t,...r){return Dn("http://www.w3.org/2000/svg",e,t,...r)};var ch=class extends xe{constructor(e,t,r,d,h,i,s,l,_){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=d,this._coreService=h,this._decorationService=i,this._optionsService=s,this._themeService=l,this._cursorBlinkStateManager=new Nt,this._charAtlasDisposable=this._register(new Nt),this._observerDisposable=this._register(new Nt),this._model=new Cl,this._workCell=new Ar,this._workCell2=new Ar,this._rectangleRenderer=this._register(new Nt),this._glyphRenderer=this._register(new Nt),this._onChangeTextureAtlas=this._register(new te),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new te),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new te),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new te),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new te),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let n={antialias:!1,depth:!1,preserveDrawingBuffer:_};if(this._gl=this._canvas.getContext("webgl2",n),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Ha(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Rl(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,s,this._themeService)],this.dimensions=Oa(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(s.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(xs(this._canvas,"webglcontextlost",f=>{console.log("webglcontextlost event received"),f.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(f)},3e3)})),this._register(xs(this._canvas,"webglcontextrestored",f=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,kr(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Rr(this._canvas,this._coreBrowserService.window,(f,g)=>this._setCanvasDevicePixelDimensions(f,g)),this._register(this._coreBrowserService.onWindowChange(f=>{this._observerDisposable.value=Rr(this._canvas,f,(g,b)=>this._setCanvasDevicePixelDimensions(g,b))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(pe(()=>{for(let f of this._renderLayers)f.dispose();this._canvas.parentElement?.removeChild(this._canvas),kr(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let r of this._renderLayers)r.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,r){for(let d of this._renderLayers)d.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Ll(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new ml(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=wn(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=sn(Ve.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ve.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let r of this._renderLayers)r.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new dl(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,d=this._workCell,h,i,s,l,_,n,f=0,g=!0,b,p,a,c,o,u,v,C,S;e=Gr(e,r.rows-1,0),t=Gr(t,r.rows-1,0);let y=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=m-r.buffer.ydisp,T=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),P=-1,I=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let R=!1;for(i=e;i<=t;i++)for(s=i+r.buffer.ydisp,l=r.buffer.lines.get(s),this._model.lineLengths[i]=0,a=m===s,f=0,_=this._characterJoinerService.getJoinedCharacters(s),C=0;C<r.cols;C++){if(h=this._cellColorResolver.result.bg,l.loadCell(C,d),C===0&&(h=this._cellColorResolver.result.bg),n=!1,g=C>=f,b=C,_.length>0&&C===_[0][0]&&g){p=_.shift();let W=this._model.selection.isCellSelected(this._terminal,p[0],s);for(v=p[0]+1;v<p[1];v++)g&&(g=W===this._model.selection.isCellSelected(this._terminal,v,s));g&&(g=!a||T<p[0]||T>=p[1]),g?(n=!0,d=new dh(d,l.translateToString(!0,p[0],p[1]),p[1]-p[0]),b=p[1]-1):f=p[1]}if(c=d.getChars(),o=d.getCode(),v=(i*r.cols+C)*Ei,this._cellColorResolver.resolve(d,C,s,this.dimensions.device.cell.width),I&&s===m&&(C===T&&(this._model.cursor={x:T,y:x,width:d.getWidth(),style:this._coreBrowserService.isFocused?y:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},P=T+d.getWidth()-1),C>=T&&C<=P&&(this._coreBrowserService.isFocused&&y==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),o!==0&&(this._model.lineLengths[i]=C+1),!(this._model.cells[v]===o&&this._model.cells[v+Si]===this._cellColorResolver.result.bg&&this._model.cells[v+wi]===this._cellColorResolver.result.fg&&this._model.cells[v+rs]===this._cellColorResolver.result.ext)&&(R=!0,c.length>1&&(o|=bl),this._model.cells[v]=o,this._model.cells[v+Si]=this._cellColorResolver.result.bg,this._model.cells[v+wi]=this._cellColorResolver.result.fg,this._model.cells[v+rs]=this._cellColorResolver.result.ext,u=d.getWidth(),this._glyphRenderer.value.updateCell(C,i,o,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,c,u,h),n)){for(d=this._workCell,C++;C<=b;C++)S=(i*r.cols+C)*Ei,this._glyphRenderer.value.updateCell(C,i,0,0,0,0,Ra,0,0),this._model.cells[S]=0,this._model.cells[S+Si]=this._cellColorResolver.result.bg,this._model.cells[S+wi]=this._cellColorResolver.result.fg,this._model.cells[S+rs]=this._cellColorResolver.result.ext;C--}}R&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},dh=class extends Ct{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Gr(e,t,r=0){return Math.max(Math.min(e,t),r)}var Vr="di$target",Yr="di$dependencies",_s=new Map;function Fe(e){if(_s.has(e))return _s.get(e);let t=function(r,d,h){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");uh(t,r,h)};return t._id=e,_s.set(e,t),t}function uh(e,t,r){t[Vr]===t?t[Yr].push({id:e,index:r}):(t[Yr]=[{id:e,index:r}],t[Vr]=t)}var qd=Fe("BufferService"),Kd=Fe("CoreMouseService"),Gd=Fe("CoreService"),Vd=Fe("CharsetService"),Yd=Fe("InstantiationService"),Xd=Fe("LogService"),_h=Fe("OptionsService"),Jd=Fe("OscLinkService"),Zd=Fe("UnicodeService"),Qd=Fe("DecorationService"),fh={trace:0,debug:1,info:2,warn:3,error:4,off:5},ph="xterm.js: ",Xr=class extends xe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Tn=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=fh[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":ph)+t,...r)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Xr=la([ha(0,_h)],Xr);var Tn;function gh(e){Tn=e}var Bn=class extends xe{constructor(e){if(on&&ka()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new te),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new te),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new te),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new te),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,d=t.optionsService,h=t,i=h._renderService,s=h._characterJoinerService,l=h._charSizeService,_=h._coreBrowserService,n=h._decorationService,f=h._logService,g=h._themeService;gh(f),this._renderer=this._register(new ch(e,s,l,_,r,n,d,g,this._preserveDrawingBuffer)),this._register(Ve.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ve.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ve.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ve.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),i.setRenderer(this._renderer),this._register(pe(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Pn=`/**
|
|
36
119
|
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
37
120
|
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
38
121
|
* https://github.com/chjj/term.js
|
|
@@ -250,9 +333,9 @@ ${_.join(`
|
|
|
250
333
|
z-index: 2;
|
|
251
334
|
position: relative;
|
|
252
335
|
}
|
|
253
|
-
`;var zs=[".tt_sidebarEntry{width:100%;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:8px;align-items:center;gap:8px;padding:0 12px;font-size:13px;display:flex}",".tt_sidebarEntry:hover{background:var(--dsw-specific-sidebar-nav-item-hover);color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_sidebarEntryIcon{flex:none;justify-content:center;align-items:center;display:inline-flex}",".tt_sidebarEntryLabel{text-overflow:ellipsis;overflow:hidden}","[data-sidebar-collapsed] .tt_sidebarEntry{justify-content:center;width:100%;padding:0}","[data-sidebar-collapsed] .tt_sidebarEntryLabel{display:none}",".tt_modalBackdrop{z-index:1300;background:var(--dsw-alias-bg-mask-1);justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0;padding-top:5vh}",".tt_modal{background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);width:min(1180px,96vw);height:min(84vh,920px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);border-radius:14px;flex-direction:column;gap:0;display:flex;overflow:hidden}",".tt_header{flex:none;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);display:flex}",".tt_title{flex:1;margin:0;font-size:14px;font-weight:600;white-space:nowrap;align-items:center;gap:8px;display:flex}",".tt_status{font-size:11px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;display:flex;white-space:nowrap}",".tt_statusDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_statusDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_statusDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_toolBtn{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;height:28px;padding:0 10px;cursor:pointer;font-size:12px;flex:none;white-space:nowrap}",".tt_toolBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_searchInput{width:120px;height:28px;background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;font:inherit;font-size:12px;padding:0 8px;flex:none}",".tt_searchInput:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_min{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:16px;line-height:1;flex:none}",".tt_close{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:18px;line-height:1;flex:none}",".tt_min:hover,.tt_close:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_modalBackdrop[data-minimized]{display:none}",".tt_sidebarEntryBadge{display:none;align-items:center;gap:5px;margin-left:auto;padding-left:8px;flex:none}",".tt_sidebarEntry[data-minimized]{color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-minimized] .tt_sidebarEntryBadge{display:inline-flex}","[data-sidebar-collapsed] .tt_sidebarEntryBadge{margin-left:0;padding-left:0}","[data-sidebar-collapsed] .tt_sidebarBadgeCount{display:none}",".tt_sidebarBadgeDot{width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_sidebarBadgeDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_sidebarBadgeDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}","@keyframes ttPulse{from{box-shadow:0 0 0 5px rgba(63,185,80,.35)}to{box-shadow:0 0 0 0 rgba(63,185,80,0)}}",".tt_sidebarBadgeDot[data-active],.tt_dockDot[data-active]{animation:ttPulse .9s ease-out}",".tt_dockCompact .tt_dockStatus{display:none}",".tt_dock{position:fixed;right:18px;bottom:18px;z-index:1300;display:inline-flex;align-items:center;gap:10px;height:38px;padding:0 8px 0 16px;border-radius:999px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);font-size:13px;cursor:pointer;user-select:none}",".tt_dock:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_dockTitle{display:flex;align-items:center;gap:8px;font-weight:600;white-space:nowrap}",".tt_dockCount{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400}",".tt_dockStatus{max-width:220px;color:var(--dsw-alias-label-tertiary);font-size:12px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}",".tt_dockDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_dockDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_dockDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_dockClose{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:50%;width:26px;height:26px;cursor:pointer;font-size:14px;line-height:1;flex:none;display:inline-flex;align-items:center;justify-content:center}",".tt_dockClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabbar{flex:none;display:flex;align-items:center;gap:6px;padding:6px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);overflow-x:auto}",".tt_tab{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 8px 0 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;cursor:pointer;flex:none;white-space:nowrap}",".tt_tab:hover{color:var(--dsw-alias-label-primary)}",".tt_tab[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_tabClose{appearance:none;background:0 0;border:none;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:0 2px}",".tt_tabClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabAdd{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:1px dashed var(--dsw-alias-border-l2);border-radius:8px;background:0 0;color:var(--dsw-alias-label-secondary);font-size:16px;cursor:pointer;flex:none}",".tt_tabAdd:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-secondary)}",".tt_body{flex:1;min-height:0;position:relative;background:#0d1117;overflow:hidden}",".tt_term{position:absolute;inset:0;padding:8px 10px}",".tt_term .xterm{height:100%}",".tt_overlay{position:absolute;inset:0;align-items:center;justify-content:center;background:rgba(0,0,0,.55);color:#e6edf3;font-size:13px;cursor:pointer;display:flex;z-index:5}",".tt_overlay:empty{display:none}",".tt_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}",".tt_card:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}",".tt_cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}",".tt_cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}",".tt_cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}",".tt_cardDescription{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}",".tt_cardChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}",".tt_cardChevronOpen{transform:rotate(180deg)}",".tt_cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}",".tt_cardField{flex-direction:column;gap:6px;padding:12px 0;display:flex}",".tt_cardField+.tt_cardField{border-top:1px solid var(--dsw-alias-border-l2)}",".tt_cardLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}",".tt_cardInput{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5;box-sizing:border-box}",".tt_cardInput:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_cardCheckbox{width:16px;height:16px;accent-color:var(--dsw-alias-state-business-primary)}",".tt_cardRow{align-items:center;gap:8px;display:flex;flex-direction:row}",".tt_cardHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5;margin-top:2px}",".tt_cardSave{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border:1px solid transparent}",".tt_cardSave:disabled{opacity:.4;cursor:default}",".tt_cardMessage{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",".tt_cardMessageOk{color:var(--dsw-alias-state-success-primary)}",".tt_cardMessageError{color:var(--dsw-alias-state-error-primary)}",".tt_addMenu{position:fixed;z-index:1400;min-width:220px;max-width:320px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:var(--dsw-shadow-lv3);padding:6px;display:flex;flex-direction:column;gap:2px}",".tt_addMenuItem{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-primary);text-align:left;font:inherit;font-size:13px;padding:7px 10px;border-radius:8px;cursor:pointer;display:flex;flex-direction:column;gap:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".tt_addMenuItem:hover{background:var(--dsw-alias-interactive-bg-hover)}",".tt_addMenuSub{font-size:11px;color:var(--dsw-alias-label-tertiary)}",".tt_addMenuSep{height:1px;background:var(--dsw-alias-border-l1);margin:4px 2px}",".tt_addMenuTitle{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:4px 10px 2px}",".tt_sshBackdrop{position:fixed;inset:0;z-index:1400;background:var(--dsw-alias-bg-mask-1);display:flex;align-items:center;justify-content:center}",".tt_sshCard{width:min(430px,92vw);max-height:86vh;overflow-y:auto;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:14px;box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);padding:18px;display:flex;flex-direction:column;gap:10px}",".tt_sshTitle{margin:0;font-size:15px;font-weight:600}",".tt_sshRow{display:flex;flex-direction:column;gap:5px}",".tt_sshGrid{display:grid;grid-template-columns:1fr 110px;gap:10px}",".tt_sshActions{display:flex;gap:10px;justify-content:flex-end;margin-top:4px}",".tt_sshError{color:var(--dsw-alias-state-error-primary);font-size:12px;min-height:16px;line-height:1.4}",".tt_sshHostRow{display:flex;align-items:center;gap:8px;padding:6px 0;border-top:1px solid var(--dsw-alias-border-l1)}",".tt_sshHostMeta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}",".tt_sshHostName{font-size:13px;font-weight:500;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",".tt_sshHostTarget{font-size:12px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"].join(`
|
|
254
|
-
`),
|
|
255
|
-
`+vi,document.head.appendChild(nt))}var Ht='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',Ei=null,ie=null,X=null,Me=null,be=null,Le=null,Re=null,se=null,Te=null,It=!1,je=null,fe=!1,ee=null,at=null,Oe=null,Ce=null,lt=null,J=new Map,we=null,xi=0,ot=!1,de=null,Ae=null,Ie=[];function Se(a,l){if(Me===null)return;Me.textContent=a,be.dataset.state=l,Oe!==null&&(Oe.textContent=a),Ce!==null&&(Ce.dataset.state=l);let w=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");w!==null&&(w.dataset.state=l)}function ye(a){ie!==null&&ie.readyState===WebSocket.OPEN&&ie.send(JSON.stringify(a))}function De(){return we!==null?J.get(we):void 0}function qs(){try{let a=Ei?.list?.getSnapshot?.(),l=a?.byId?.[a?.current]?.cwd;return typeof l=="string"&&l!==""?l:void 0}catch{return}}function dt(a){if(a===void 0||a.fit===void 0)return;let l=a.fit.proposeDimensions();l!==void 0&&ye({t:"resize",sid:a.sid,cols:l.cols,rows:l.rows})}function ze(a,l){a.overlayEl===null||a.overlayEl===void 0||(a.overlayEl.textContent=l)}function ki(a){let l=new bi.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"SF Mono", Menlo, Consolas, "Courier New", monospace',scrollback:5e3,convertEol:!1,allowProposedApi:!0}),w=new Ci.FitAddon,y=new fi;l.loadAddon(w),l.loadAddon(y),l.loadAddon(new pi);let E=document.createElement("div");E.className="tt_term";let r=document.createElement("div");r.className="tt_overlay",r.addEventListener("click",()=>{r.textContent="",Ks(a.sid)}),E.appendChild(r),l.open(E);try{w.fit()}catch{}l.onData(n=>{ye({t:"input",sid:a.sid,d:n})}),l.attachCustomKeyEventHandler(n=>(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="f"?(n.preventDefault(),Ai(),!1):!0),a.term=l,a.fit=w,a.search=y,a.termEl=E,a.overlayEl=r}function ht(a,l){let w=wi(),y={sid:w,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:a??{t:"spawn",cwd:qs()},label:l};return ki(y),J.set(w,y),xi+=1,qe(),ut(w),Li(y),y}function Li(a){let l=a.fit!==null?a.fit.proposeDimensions():void 0;ye({...a.spawnSpec,sid:a.sid,cols:l!==void 0?l.cols:80,rows:l!==void 0?l.rows:24})}function Ks(a){let l=J.get(a);if(l===void 0)return;let w=l.spawnSpec,y=l.label;if(l.exited||ye({t:"kill",sid:a}),l.term!==null)try{l.term.dispose()}catch{}l.termEl!==null&&l.termEl.remove(),J.delete(a);let E={sid:wi(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:w,label:y};ki(E),J.set(E.sid,E),qe(),ut(E.sid),Li(E)}function Vs(a){let l=J.get(a);if(l!==void 0){if(l.exited||ye({t:"kill",sid:a}),J.delete(a),l.term!==null)try{l.term.dispose()}catch{}if(l.termEl!==null&&l.termEl.remove(),we===a){we=null;let w=[...J.keys()].pop()??null;w!==null&&ut(w)}qe(),J.size===0&&_t()}}function ut(a){let l=J.get(a);if(l!==void 0){we=a;for(let[w,y]of J)y.termEl!==null&&(y.termEl.style.display=w===a?"":"none");Re!==null&&l.termEl!==null&&l.termEl.parentElement!==Re&&Re.appendChild(l.termEl),qe();try{l.fit.fit()}catch{}l.spawned&&!l.exited&&dt(l),ze(l,l.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"")}}function qe(){if(Le===null)return;Le.textContent="";for(let[l,w]of J){let y=document.createElement("button");y.className="tt_tab",l===we&&(y.dataset.active="");let E=document.createElement("span");E.textContent=w.label||"\u7EC8\u7AEF "+Gs(l);let r=document.createElement("span");r.className="tt_tabClose",r.title="\u5173\u95ED",r.textContent="\u2715",y.title=E.textContent,y.appendChild(E),y.appendChild(r),y.addEventListener("click",n=>{if(n.target.closest(".tt_tabClose")!==null){n.stopPropagation(),Vs(l);return}ut(l)}),Le.appendChild(y)}let a=document.createElement("button");a.className="tt_tabAdd",a.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",a.textContent="+",a.addEventListener("click",()=>{Js(a)}),Le.appendChild(a)}function Gs(a){let l=1;for(let w of J.keys()){if(w===a)return String(l);l+=1}return String(l)}function ct(a){a!==null&&typeof a=="object"&&Array.isArray(a.sshHosts)&&(Ie=a.sshHosts)}function Di(a){let l=Number(a?.port),w=Number.isInteger(l)&&l!==22?":"+l:"",y=a?.auth==="key"?"key":a?.auth==="password"?"password":"agent";return String(a?.username??"")+"@"+String(a?.host??"")+w+" \xB7 "+y}async function Xs(){try{let l=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(l.ok&&typeof l.config=="object"&&l.config!==null){let w=Ie;ct(l.config),de!==null&&Ie!==w&&Ti(de)}}catch{}}function Ri(a){de!==null&&(a.target instanceof Element&&(de.contains(a.target)||a.target.closest(".tt_tabAdd")!==null)||me())}function Js(a){if(de!==null){me();return}Xs();let l=document.createElement("div");l.className="tt_addMenu",de=l,Ti(l),document.body.appendChild(l);let w=a.getBoundingClientRect();l.style.left=Math.max(8,Math.min(w.left,window.innerWidth-340))+"px",l.style.top=w.bottom+4+"px",document.addEventListener("mousedown",Ri,!0)}function me(){de!==null&&(document.removeEventListener("mousedown",Ri,!0),de.remove(),de=null)}function Ot(a,l,w,y){let E=document.createElement("button");E.type="button",E.className="tt_addMenuItem";let r=document.createElement("span");if(r.textContent=l,E.appendChild(r),w!==""){let n=document.createElement("span");n.className="tt_addMenuSub",n.textContent=w,E.appendChild(n)}E.addEventListener("click",y),a.appendChild(E)}function Ti(a){a.textContent="",Ot(a,"\u672C\u5730\u7EC8\u7AEF","\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",()=>{me(),ht()});let l=document.createElement("div");l.className="tt_addMenuSep",a.appendChild(l);let w=document.createElement("div");w.className="tt_addMenuTitle",w.textContent="SSH \u8FDE\u63A5\u7C3F",a.appendChild(w);for(let E of Ie)E===null||typeof E!="object"||typeof E.name!="string"||E.name===""||Ot(a,E.name,Di(E),()=>{me(),ht({t:"ssh",name:E.name},E.name)});if(Ie.length===0){let E=document.createElement("div");E.className="tt_addMenuTitle",E.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",a.appendChild(E)}let y=document.createElement("div");y.className="tt_addMenuSep",a.appendChild(y),Ot(a,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{me(),Ys()})}function Ys(){if(Ae!==null)return;let a=document.createElement("div");a.className="tt_sshBackdrop";let l=document.createElement("div");l.className="tt_sshCard";let w=document.createElement("div");w.className="tt_sshTitle",w.textContent="SSH \u8FDE\u63A5",l.appendChild(w);let y={},E=(c,g,p)=>{let m=document.createElement("label");m.className="tt_sshRow";let d=document.createElement("span");d.className="tt_cardLabel",d.textContent=g,m.appendChild(d);let b;if(p?.select!==void 0){b=document.createElement("select");for(let L of p.select){let T=document.createElement("option");T.value=L.value,T.textContent=L.label,b.appendChild(T)}}else b=document.createElement("input"),b.type=p?.type??"text",b.placeholder=p?.placeholder??"";return b.className="tt_cardInput",b.autocomplete="off",b.spellcheck=!1,m.appendChild(b),y[c]=b,m},r=document.createElement("div");r.className="tt_sshGrid",r.appendChild(E("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),r.appendChild(E("port","\u7AEF\u53E3",{placeholder:"22"})),l.appendChild(r),l.appendChild(E("username","\u7528\u6237\u540D",{placeholder:"root"})),l.appendChild(E("auth","\u8BA4\u8BC1\u65B9\u5F0F",{select:[{value:"agent",label:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"},{value:"key",label:"key \u2014 \u79C1\u94A5\u6587\u4EF6"},{value:"password",label:"password \u2014 \u5BC6\u7801"}]}));let n=E("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),h=E("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),f=E("password","\u5BC6\u7801",{type:"password"});l.appendChild(n),l.appendChild(h),l.appendChild(f);let o=document.createElement("label");o.className="tt_cardRow";let _=document.createElement("input");_.type="checkbox",_.className="tt_cardCheckbox";let v=document.createElement("span");v.className="tt_cardLabel",v.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",o.appendChild(_),o.appendChild(v),l.appendChild(o);let S=E("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});S.style.display="none",l.appendChild(S),_.addEventListener("change",()=>{S.style.display=_.checked?"":"none",_.checked&&y.name.value.trim()===""&&y.host.value.trim()!==""&&(y.name.value=y.host.value.trim()),_.checked&&y.name.focus()});let u=document.createElement("div");u.className="tt_sshError",l.appendChild(u);let t=document.createElement("div");t.className="tt_sshActions";let s=document.createElement("button");s.type="button",s.className="tt_toolBtn",s.textContent="\u53D6\u6D88";let e=document.createElement("button");e.type="button",e.className="tt_cardSave",e.textContent="\u8FDE\u63A5",t.appendChild(s),t.appendChild(e),l.appendChild(t);let i=()=>{n.style.display=y.auth.value==="key"?"":"none",h.style.display=y.auth.value==="key"?"":"none",f.style.display=y.auth.value==="password"?"":"none"};y.auth.addEventListener("change",i),i(),s.addEventListener("click",()=>Be()),a.addEventListener("mousedown",c=>{c.target===a&&Be()}),e.addEventListener("click",()=>{u.textContent="";let c=y.host.value.trim(),g=y.username.value.trim(),p=Number(y.port.value);if((!Number.isInteger(p)||p<1||p>65535)&&(p=22),c===""||g===""){u.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let m=y.auth.value,d={t:"ssh",host:c,port:p,username:g,auth:m};if(m==="key"){let B=y.keyPath.value.trim();B!==""&&(d.keyPath=B);let D=y.passphrase.value;D!==""&&(d.passphrase=D)}if(m==="password"){let B=y.password.value;B!==""&&(d.password=B)}let b=p!==22?g+"@"+c+":"+p:g+"@"+c,L=B=>{Be(),X!==null&&ht(d,B!==""?B:b)};if(!_.checked){L("");return}let T=y.name.value.trim()||c;e.disabled=!0,Zs({name:T,host:c,port:p,username:g,auth:m,keyPath:d.keyPath??"",passphrase:d.passphrase??"",password:d.password??""}).then(B=>{if(e.disabled=!1,B!==void 0){u.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+B;return}L(T)})}),a.appendChild(l),document.body.appendChild(a),Ae=a,y.host.focus()}function Be(){Ae!==null&&(Ae.remove(),Ae=null)}async function Zs(a){let l=[...Ie.filter(w=>w?.name!==a.name),a];try{let w=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:l})}),y=await w.json().catch(()=>({}));if(!w.ok||!y.ok)return String(y.error||"HTTP "+w.status);ct(y.config);return}catch(w){return String(w&&w.message?w.message:w)}}function Ai(){if(se===null)return;let a=se.style.display==="none"||se.style.display==="";se.style.display=a?"":"none",a&&se.focus()}var Qs={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function er(a){let l=De();if(l===void 0||l.search===void 0)return;let w=se.value;if(w==="")return;let y={decorations:Qs};a?l.search.findPrevious(w,y):l.search.findNext(w,y)}function gi(){if(ie!==null){try{ie.close()}catch{}ie=null}It=!1,ot=!0,Se("\u8FDE\u63A5\u4E2D\u2026","");try{ie=new WebSocket($s())}catch(a){ot=!1,Se("\u8FDE\u63A5\u5931\u8D25\uFF1A"+a.message,"error"),mi("\u70B9\u51FB\u91CD\u8BD5");return}ie.onopen=()=>{ot=!1,Se("\u5DF2\u8FDE\u63A5","connected"),J.size===0&&ht()},ie.onmessage=a=>{let l;try{l=JSON.parse(a.data)}catch{return}let w=l.sid;if(l.t==="ready"){let y=typeof l.target=="string"?l.target:"";Se(l.kind==="ssh"?"SSH "+(y!==""?y+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+l.pid,"connected");let E=J.get(w);E!==void 0&&(E.exited=!1,E.spawned=!0,l.kind==="ssh"&&y!==""&&!E.label&&(E.label=y,qe()),ze(E,""),dt(E),$e())}else if(l.t==="data"){let y=J.get(w);y!==void 0&&y.term!==null&&(y.term.write(String(l.d??"")),sr())}else if(l.t==="exit"){let y=J.get(w);if(y!==void 0){y.exited=!0;let E=l.code!==null&&l.code!==void 0?"code="+l.code:"",r=l.signal!==null&&l.signal!==void 0?"signal="+l.signal:"";Se("\u5DF2\u9000\u51FA "+[E,r].filter(Boolean).join(" "),""),ze(y,"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00"),$e()}}else if(l.t==="error")if(Se("\u9519\u8BEF\uFF1A"+String(l.m??""),"error"),typeof w=="string"){let y=J.get(w);y!==void 0&&ze(y,"\u9519\u8BEF\uFF1A"+String(l.m??"")+" \u2014 \u70B9\u51FB\u91CD\u8BD5")}else mi("\u70B9\u51FB\u91CD\u8BD5")},ie.onclose=()=>{if(ot=!1,!It){Se("\u8FDE\u63A5\u65AD\u5F00","error");for(let a of J.values())a.exited=!0,ze(a,"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u70B9\u51FB\u91CD\u65B0\u8FDE\u63A5")}},ie.onerror=()=>{}}function mi(a){Te!==null&&(Te.textContent=a)}function tr(){if(X!==null){fe&&Bi();return}yi(),X=document.createElement("div"),X.className="tt_modalBackdrop",X.innerHTML='<div class="tt_modal"><div class="tt_header"><div class="tt_title">'+Ht+'<span>\u7EC8\u7AEF</span></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><button class="tt_toolBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">\u641C\u7D22</button><button class="tt_toolBtn" data-act="clear" title="\u6E05\u5C4F">\u6E05\u5C4F</button><button class="tt_toolBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">\u590D\u5236</button><button class="tt_toolBtn" data-act="paste" title="\u7C98\u8D34">\u7C98\u8D34</button><button class="tt_min" title="\u6700\u5C0F\u5316\u5230\u60AC\u6D6E\u6761\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09">\u2014</button><button class="tt_close" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button></div><div class="tt_tabbar"></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(X),Me=X.querySelector(".tt_statusText"),be=X.querySelector(".tt_statusDot"),Le=X.querySelector(".tt_tabbar"),Re=X.querySelector(".tt_body"),Te=X.querySelector(".tt_body > .tt_overlay"),se=X.querySelector(".tt_searchInput"),Te.addEventListener("click",()=>{Te.textContent="",gi()}),X.querySelector("[data-act=search]").addEventListener("click",()=>{Ai(),se.style.display!=="none"&&se.focus()}),se.addEventListener("keydown",a=>{a.key==="Enter"?(a.preventDefault(),er(a.shiftKey)):a.key==="Escape"&&(a.stopPropagation(),se.style.display="none")}),X.querySelector("[data-act=clear]").addEventListener("click",()=>{let a=De();a!==void 0&&a.term!==null&&a.term.clear()}),X.querySelector("[data-act=copy]").addEventListener("click",()=>{let a=De();if(a===void 0||a.term===null)return;let l=a.term.getSelection();l!==""&&navigator.clipboard.writeText(l).catch(()=>{})}),X.querySelector("[data-act=paste]").addEventListener("click",()=>{let a=De();a!==void 0&&navigator.clipboard.readText().then(l=>{ye({t:"input",sid:a.sid,d:l})}).catch(()=>{})}),X.querySelector(".tt_min").addEventListener("click",()=>{Pt()}),X.querySelector(".tt_close").addEventListener("click",()=>{_t()}),X.addEventListener("mousedown",a=>{a.target===X&&Pt()}),document.addEventListener("keydown",Mi),je=new ResizeObserver(()=>{if(fe)return;let a=De();if(a!==void 0&&a.fit!==void 0){try{a.fit.fit()}catch{return}a.exited||dt(a)}}),je.observe(Re),gi()}function ir(){ee=document.createElement("div"),ee.className="tt_dock",ee.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",ee.innerHTML='<span class="tt_dockTitle">'+Ht+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button>',at=ee.querySelector(".tt_dockCount"),Oe=ee.querySelector(".tt_dockStatus"),Ce=ee.querySelector(".tt_dockDot");let a=[...J.values()].filter(l=>!l.exited).length;at.textContent=J.size>0?"\xB7 "+a+"/"+J.size:"",Me!==null&&(Oe.textContent=Me.textContent),be!==null&&(Ce.dataset.state=be.dataset.state??""),ee.addEventListener("click",l=>{if(l.target.closest(".tt_dockClose")!==null){l.stopPropagation(),_t();return}Bi()}),document.body.appendChild(ee)}function Pt(){X===null||fe||(me(),Be(),fe=!0,se!==null&&(se.style.display="none"),X.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?$e():(ir(),ee.classList.add("tt_dockCompact")))}function $e(){let a=document.querySelector("[data-dsh-tty-entry]");if(a===null)return;let l=a.querySelector(".tt_sidebarEntryBadge");if(!fe){l!==null&&l.remove(),delete a.dataset.minimized,a.removeAttribute("title");return}l===null&&(l=document.createElement("span"),l.className="tt_sidebarEntryBadge",l.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',a.appendChild(l)),a.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let w=[...J.values()].filter(E=>!E.exited).length;l.querySelector(".tt_sidebarBadgeCount").textContent=w+"/"+J.size;let y=l.querySelector(".tt_sidebarBadgeDot");y!==null&&be!==null&&(y.dataset.state=be.dataset.state??"")}function sr(){if(!fe)return;let a=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Ce;a!==null&&(a.dataset.active="",clearTimeout(lt),lt=setTimeout(()=>{delete a.dataset.active},900))}function Bi(){if(X===null||!fe)return;fe=!1,delete X.dataset.minimized,clearTimeout(lt),ee!==null&&(ee.remove(),ee=null),at=null,Oe=null,Ce=null,$e();let a=De();if(a!==void 0&&a.fit!==void 0){try{a.fit.fit()}catch{}a.spawned&&!a.exited&&dt(a)}a!==void 0&&a.term!==null&&a.term.focus()}function _t(){if(X!==null){if(It=!0,fe=!1,me(),Be(),clearTimeout(lt),ee!==null&&(ee.remove(),ee=null),at=null,Oe=null,Ce=null,$e(),ie!==null){for(let a of J.values())a.exited||ye({t:"kill",sid:a.sid});try{ie.close()}catch{}ie=null}je!==null&&(je.disconnect(),je=null);for(let a of J.values())if(a.term!==null)try{a.term.dispose()}catch{}J.clear(),we=null,document.removeEventListener("keydown",Mi),X.remove(),X=null,Me=null,be=null,Le=null,Re=null,Te=null,se=null,xi=0}}function Mi(a){if(a.key==="Escape"&&X!==null){if(a.preventDefault(),Ae!==null){Be();return}if(de!==null){me();return}Pt()}}function rr(){let a=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(a!==null)return a.querySelector('[class*="logoRow"]')?.parentElement??a.firstElementChild}function nr(a){let l=a.querySelector('button[class*="newSession"]');if(l!==null)return l;for(let w of a.children)if(w.tagName==="BUTTON")return w}function or(){let a=document.createElement("div");return a.dataset.dshTtyEntry="",a.className="tt_sidebarEntry",a.setAttribute("role","button"),a.setAttribute("aria-label","\u7EC8\u7AEF"),a.innerHTML='<span class="tt_sidebarEntryIcon">'+Ht+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',a.addEventListener("click",l=>{l.preventDefault(),tr()}),a}function Si(a,l){let w=nr(a);if(w===void 0)return!1;if(l.parentElement!==a){let y=w.closest('[class*="logoRow"]'),E=y!==null&&y.parentElement===a?y:w,r=Array.from(a.children).filter(n=>n instanceof HTMLElement&&n.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(r.length>0){let n=r[r.length-1];a.insertBefore(l,n.nextSibling)}else a.insertBefore(l,E.nextElementSibling)}return!0}function ar(){if(yi(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let a=or(),l,w=!1,y=()=>{if(l!==void 0&&!l.isConnected&&(r.disconnect(),l=void 0,w=!1),w){if(document.body.contains(a))return;r.disconnect(),l=void 0,w=!1}l??(l=rr()),l!==void 0&&(w=Si(l,a),w&&r.observe(l,{childList:!0,subtree:!0}))},E=new MutationObserver(()=>{y()});E.observe(document.body,{childList:!0,subtree:!0});let r=new MutationObserver(()=>{if(l===void 0||!l.isConnected){w=!1,y();return}l.contains(a)||(w=Si(l,a))});return y(),()=>{E.disconnect(),r.disconnect(),a.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:a=>{let l={},w=a("react"),{jsx:y,jsxs:E}=a("react/jsx-runtime"),r="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function n(){let[h,f]=w.useState(!1),[o,_]=w.useState(null),[v,S]=w.useState(!1),[u,t]=w.useState(!1),[s,e]=w.useState({kind:"",text:""}),i=async()=>{try{let L=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();L.ok&&typeof L.config=="object"&&L.config!==null?(_(L.config),ct(L.config)):e({kind:"error",text:String(L.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(b){e({kind:"error",text:String(b&&b.message?b.message:b)})}};w.useEffect(()=>{h&&!v&&(S(!0),i())},[h]);let c=(b,L)=>_(T=>({...T||{},[b]:L})),g=b=>_(L=>({...L||{},sshHosts:(Array.isArray(L?.sshHosts)?L.sshHosts:[]).filter(T=>T?.name!==b)})),p=async()=>{t(!0),e({kind:"",text:""});let b={};for(let L of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd"]){let T=(o||{})[L];T!==void 0&&T!==""&&(b[L]=T)}b.sshHosts=Array.isArray(o?.sshHosts)?o.sshHosts:[];try{let L=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)}),T=await L.json();!L.ok||!T.ok?e({kind:"error",text:String(T.error||"\u4FDD\u5B58\u5931\u8D25")}):(e({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),T.config&&(_(T.config),ct(T.config)))}catch(L){e({kind:"error",text:String(L&&L.message?L.message:L)})}t(!1)},m=(b,L,T,B)=>E("label",{className:"tt_cardField",children:[y("span",{className:"tt_cardLabel",children:b}),y("input",{className:"tt_cardInput",value:o[L]??"",placeholder:T??"",onChange:D=>c(L,D.target.value)}),B?y("span",{className:"tt_cardHint",children:B}):null]}),d=(b,L)=>E("label",{className:"tt_cardField tt_cardRow",children:[y("input",{type:"checkbox",className:"tt_cardCheckbox",checked:o[L]===!0,onChange:T=>c(L,T.target.checked)}),y("span",{className:"tt_cardLabel",children:b})]});return E("li",{className:h?"tt_card tt_cardOpen":"tt_card",children:[E("button",{type:"button",className:"tt_cardHeader","aria-expanded":h,onClick:()=>f(b=>!b),children:[E("span",{className:"tt_cardHeadText",children:[y("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),y("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\u3001SSH \u8FDE\u63A5\u7C3F\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),y("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:h?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:y("path",{d:r,fill:"currentColor"})})]}),h?E("div",{className:"tt_cardBody",children:[o===null?y("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):E("div",{children:[d("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),d("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),m("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),m("Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","shell","","\u7559\u7A7A\u4F7F\u7528 $SHELL"),m("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),m("COLORTERM","colorTerm","truecolor",""),m("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),E("div",{className:"tt_cardField",children:[y("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(o.sshHosts)&&o.sshHosts.length>0?[y("div",{children:o.sshHosts.map(b=>E("div",{className:"tt_sshHostRow",children:[y("div",{className:"tt_sshHostMeta",children:[y("span",{className:"tt_sshHostName",children:b?.name??""}),y("span",{className:"tt_sshHostTarget",children:Di(b??{})})]}),y("button",{type:"button",className:"tt_toolBtn",onClick:()=>g(b?.name),children:"\u5220\u9664"})]},String(b?.name??"")))})]:[y("span",{className:"tt_cardHint",children:"\u6682\u65E0\u6761\u76EE \u2014 \u7EC8\u7AEF\u9762\u677F\u300C+\u300D\u2192 SSH \u8FDE\u63A5\u2026 \u52FE\u9009\u300C\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\u300D\u5373\u53EF\u6DFB\u52A0"})],y("span",{className:"tt_cardHint",children:"\u968F\u300C\u4FDD\u5B58\u300D\u4E00\u5E76\u5199\u5165\u914D\u7F6E\uFF1B\u5BC6\u7801/\u53E3\u4EE4\u652F\u6301 env:VAR \u5F15\u7528\uFF0C\u907F\u514D\u660E\u6587\u5165\u5E93"})]}),E("div",{className:"tt_cardField tt_cardRow",children:[y("button",{className:"tt_cardSave",disabled:u,onClick:()=>void p(),children:u?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),y("span",{className:"tt_cardMessage"+(s.kind==="ok"?" tt_cardMessageOk":s.kind==="error"?" tt_cardMessageError":""),children:s.text})]})]})]}):null]})}return l.inject=["slots","sessions"],l.apply=h=>(Ei=h.sessions,ar(),h.slots.inject("settings.plugin.item",()=>h.slots.register({name:"settings.plugin.item",key:"tty",order:110},n)),()=>{_t()}),l}});})();
|
|
336
|
+
`;var mh=[".tt_sidebarEntry{width:100%;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:8px;align-items:center;gap:8px;padding:0 12px;font-size:13px;display:flex}",".tt_sidebarEntry:hover{background:var(--dsw-specific-sidebar-nav-item-hover);color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_sidebarEntryIcon{flex:none;justify-content:center;align-items:center;display:inline-flex}",".tt_sidebarEntryLabel{text-overflow:ellipsis;overflow:hidden}","[data-sidebar-collapsed] .tt_sidebarEntry{justify-content:center;width:100%;padding:0}","[data-sidebar-collapsed] .tt_sidebarEntryLabel{display:none}",".tt_modalBackdrop{z-index:1300;background:var(--dsw-alias-bg-mask-1);justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0;padding-top:5vh}",".tt_modal{background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);width:min(1180px,96vw);height:min(84vh,920px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);border-radius:14px;flex-direction:column;gap:0;display:flex;overflow:hidden}",".tt_header{flex:none;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);display:flex}",".tt_title{flex:1;margin:0;font-size:14px;font-weight:600;white-space:nowrap;align-items:center;gap:8px;display:flex}",".tt_status{font-size:11px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;display:flex;white-space:nowrap}",".tt_statusDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_statusDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_statusDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_toolBtn{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;height:28px;padding:0 10px;cursor:pointer;font-size:12px;flex:none;white-space:nowrap}",".tt_toolBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_searchInput{width:120px;height:28px;background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;font:inherit;font-size:12px;padding:0 8px;flex:none}",".tt_searchInput:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_min{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:16px;line-height:1;flex:none}",".tt_close{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:18px;line-height:1;flex:none}",".tt_min:hover,.tt_close:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_modalBackdrop[data-minimized]{display:none}",".tt_sidebarEntryBadge{display:none;align-items:center;gap:5px;margin-left:auto;padding-left:8px;flex:none}",".tt_sidebarEntry[data-minimized]{color:var(--dsw-alias-label-primary)}",".tt_sidebarEntry[data-minimized] .tt_sidebarEntryBadge{display:inline-flex}","[data-sidebar-collapsed] .tt_sidebarEntryBadge{margin-left:0;padding-left:0}","[data-sidebar-collapsed] .tt_sidebarBadgeCount{display:none}",".tt_sidebarBadgeDot{width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_sidebarBadgeDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_sidebarBadgeDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}","@keyframes ttPulse{from{box-shadow:0 0 0 5px rgba(63,185,80,.35)}to{box-shadow:0 0 0 0 rgba(63,185,80,0)}}",".tt_sidebarBadgeDot[data-active],.tt_dockDot[data-active]{animation:ttPulse .9s ease-out}",".tt_dockCompact .tt_dockStatus{display:none}",".tt_dock{position:fixed;right:18px;bottom:18px;z-index:1300;display:inline-flex;align-items:center;gap:10px;height:38px;padding:0 8px 0 16px;border-radius:999px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);font-size:13px;cursor:pointer;user-select:none}",".tt_dock:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_dockTitle{display:flex;align-items:center;gap:8px;font-weight:600;white-space:nowrap}",".tt_dockCount{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400}",".tt_dockStatus{max-width:220px;color:var(--dsw-alias-label-tertiary);font-size:12px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}",".tt_dockDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_dockDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_dockDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_dockClose{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:50%;width:26px;height:26px;cursor:pointer;font-size:14px;line-height:1;flex:none;display:inline-flex;align-items:center;justify-content:center}",".tt_dockClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabbar{flex:none;display:flex;align-items:center;gap:6px;padding:6px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);overflow-x:auto}",".tt_tab{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 8px 0 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;cursor:pointer;flex:none;white-space:nowrap}",".tt_tab:hover{color:var(--dsw-alias-label-primary)}",".tt_tab[data-active]{background:var(--dsw-specific-sidebar-nav-item-active);color:var(--dsw-alias-label-primary);font-weight:600}",".tt_tabClose{appearance:none;background:0 0;border:none;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:0 2px}",".tt_tabRename{width:96px;height:20px;font-size:12px;border:1px solid var(--dsw-alias-state-business-primary);border-radius:4px;background:var(--dsw-alias-bg-layer-3);color:inherit;padding:0 4px;box-sizing:border-box;font-family:inherit}",".tt_tabClose:hover{color:var(--dsw-alias-state-error-primary)}",".tt_tabAdd{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:1px dashed var(--dsw-alias-border-l2);border-radius:8px;background:0 0;color:var(--dsw-alias-label-secondary);font-size:16px;cursor:pointer;flex:none}",".tt_tabAdd:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-secondary)}",".tt_body{flex:1;min-height:0;position:relative;background:#0d1117;overflow:hidden}",".tt_term{position:absolute;inset:0;padding:8px 10px}",".tt_term .xterm{height:100%}",".tt_overlay{position:absolute;inset:0;align-items:center;justify-content:center;background:rgba(0,0,0,.55);color:#e6edf3;font-size:13px;cursor:pointer;display:flex;z-index:5}",".tt_overlay:empty{display:none}",".tt_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}",".tt_card:hover{border-color:var(--dsw-alias-label-dimmed)}",".tt_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}",".tt_cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}",".tt_cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}",".tt_cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}",".tt_cardDescription{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}",".tt_cardChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}",".tt_cardChevronOpen{transform:rotate(180deg)}",".tt_cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}",".tt_cardField{flex-direction:column;gap:6px;padding:12px 0;display:flex}",".tt_cardField+.tt_cardField{border-top:1px solid var(--dsw-alias-border-l2)}",".tt_cardLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}",".tt_cardInput{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5;box-sizing:border-box}",".tt_cardInput:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_cardCheckbox{width:16px;height:16px;accent-color:var(--dsw-alias-state-business-primary)}",".tt_cardRow{align-items:center;gap:8px;display:flex;flex-direction:row}",".tt_cardHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5;margin-top:2px}",".tt_cardSave{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border:1px solid transparent}",".tt_cardSave:disabled{opacity:.4;cursor:default}",".tt_cardMessage{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",".tt_cardMessageOk{color:var(--dsw-alias-state-success-primary)}",".tt_cardMessageError{color:var(--dsw-alias-state-error-primary)}",".tt_addMenu{position:fixed;z-index:1400;min-width:220px;max-width:320px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:var(--dsw-shadow-lv3);padding:6px;display:flex;flex-direction:column;gap:2px}",".tt_addMenuItem{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-primary);text-align:left;font:inherit;font-size:13px;padding:7px 10px;border-radius:8px;cursor:pointer;display:flex;flex-direction:column;gap:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".tt_addMenuItem:hover{background:var(--dsw-alias-interactive-bg-hover)}",".tt_addMenuSub{font-size:11px;color:var(--dsw-alias-label-tertiary)}",".tt_addMenuRow{display:flex;align-items:center;gap:4px}",".tt_addMenuRow .tt_addMenuItem{flex:1;min-width:0}",".tt_addMenuEdit{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:14px;line-height:1;flex:none;padding:6px 8px;border-radius:8px}",".tt_addMenuEdit:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_addMenuSep{height:1px;background:var(--dsw-alias-border-l1);margin:4px 2px}",".tt_addMenuTitle{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:4px 10px 2px}",".tt_sshBackdrop{position:fixed;inset:0;z-index:1400;background:var(--dsw-alias-bg-mask-1);display:flex;align-items:center;justify-content:center}",".tt_sshCard{width:min(430px,92vw);max-height:86vh;overflow-y:auto;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:14px;box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);padding:18px;display:flex;flex-direction:column;gap:10px}",".tt_sshTitle{margin:0;font-size:15px;font-weight:600}",".tt_sshRow{display:flex;flex-direction:column;gap:5px}",".tt_sshGrid{display:grid;grid-template-columns:1fr 110px;gap:10px}",".tt_sshActions{display:flex;gap:10px;justify-content:flex-end;margin-top:4px}",".tt_sshError{color:var(--dsw-alias-state-error-primary);font-size:12px;min-height:16px;line-height:1.4}",".tt_sshHostRow{display:flex;align-items:center;gap:8px;padding:6px 0;border-top:1px solid var(--dsw-alias-border-l1)}",".tt_sshHostMeta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}",".tt_sshHostName{font-size:13px;font-weight:500;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",".tt_sshHostTarget{font-size:12px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",".tt_sshEdit{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-3);display:flex;flex-direction:column;gap:8px;padding:10px;margin:4px 0 8px}",".tt_tunnelGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}",".tt_tunnelGridLocal{display:grid;grid-template-columns:100px minmax(0,1fr) 100px;gap:10px}",".tt_tunnelGrid .tt_cardInput,.tt_tunnelGridLocal .tt_cardInput{min-width:0;width:auto}",".tt_hostList{max-height:200px;overflow-y:auto;display:flex;flex-direction:column}",".tt_tunnelDot{width:8px;height:8px;border-radius:50%;flex:none;background:var(--dsw-alias-label-tertiary)}",".tt_tunnelDot[data-state=active]{background:var(--dsw-alias-state-success-primary)}",".tt_tunnelDot[data-state=connecting]{background:var(--dsw-alias-state-business-primary)}",".tt_tunnelDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",".tt_envList{max-height:132px;overflow-y:auto;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3);display:flex;flex-direction:column;gap:2px;padding:4px}",'.tt_envItem{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-primary);text-align:left;font:12px "SF Mono",Menlo,Consolas,monospace;padding:5px 8px;border-radius:6px;cursor:pointer}',".tt_envItem:hover{background:var(--dsw-alias-interactive-bg-hover)}",".tt_envMore{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:4px 8px}"].join(`
|
|
337
|
+
`),Sh="/api/dsh-tty/ws";function wh(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+Sh}function $n(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var Ri;function Un(){document.getElementById("dsh-tty-style")||(Ri=document.createElement("style"),Ri.id="dsh-tty-style",Ri.textContent=mh+`
|
|
338
|
+
`+Pn,document.head.appendChild(Ri))}var Bs='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',zn=null,ge=null,ee=null,Tt=null,_t=null,kt=null,At=null,be=null,Mt=null,Mi=!1,Yt=null,Ze=!1,ve=null,Di=null,Bt=null,ft=null,Ti=null,ut=null,Xt=1e3,Bi="dsh-tty:tabs",Q=new Map,pt=null,Ps=0,Ai=!1,Ne=null,Dt=null,ot=[];function ct(e,t){if(Tt===null)return;Tt.textContent=e,_t.dataset.state=t,Bt!==null&&(Bt.textContent=e),ft!==null&&(ft.dataset.state=t);let r=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");r!==null&&(r.dataset.state=t)}function We(e){ge!==null&&ge.readyState===WebSocket.OPEN&&ge.send(JSON.stringify(e))}function Rt(){return pt!==null?Q.get(pt):void 0}function bh(){try{let e=zn?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function gt(){try{let e=[...Q.values()].filter(t=>!t.exited).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||ee===null?sessionStorage.removeItem(Bi):sessionStorage.setItem(Bi,JSON.stringify(e))}catch{}}function Ch(){try{let e=sessionStorage.getItem(Bi);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):[]}catch{return[]}}function yh(e,t){return new Promise(r=>{let d=i=>{let s;try{s=JSON.parse(i.data)}catch{return}s.t===e&&(clearTimeout(h),ge.removeEventListener("message",d),r(s))},h=setTimeout(()=>{ge.removeEventListener("message",d),r(null)},t);ge.addEventListener("message",d)})}function Oi(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&We({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function Vt(e,t){e.overlayEl===null||e.overlayEl===void 0||(e.overlayEl.textContent=t)}function Os(e){let t=new Nn.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"SF Mono", Menlo, Consolas, "Courier New", monospace',scrollback:5e3,convertEol:!1,allowProposedApi:!0}),r=new Wn.FitAddon,d=new ur;t.loadAddon(r),t.loadAddon(d),t.loadAddon(new _r);let h=document.createElement("div");h.className="tt_term";let i=document.createElement("div");i.className="tt_overlay",i.addEventListener("click",()=>{i.textContent="",Eh(e.sid)}),h.appendChild(i),t.open(h);try{r.fit()}catch{}try{let s=new Bn;s.onContextLoss(()=>{try{s.dispose()}catch{}}),t.loadAddon(s)}catch{}t.onData(s=>{We({t:"input",sid:e.sid,d:s})}),t.attachCustomKeyEventHandler(s=>(s.ctrlKey||s.metaKey)&&s.key.toLowerCase()==="f"?(s.preventDefault(),Yn(),!1):!0),e.term=t,e.fit=r,e.search=d,e.termEl=h,e.overlayEl=i}function Pi(e,t){let r=$n(),d={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??{t:"spawn",cwd:bh()},label:t};return Os(d),Q.set(r,d),Ps+=1,at(),Qt(r),jn(d),gt(),d}function xh(e){let t={sid:e.sid,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};Os(t),Q.set(t.sid,t),Ps+=1,at(),Qt(t.sid),We({t:"attach",sid:t.sid})}function jn(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0;We({...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24})}function Eh(e){let t=Q.get(e);if(t===void 0)return;let r=t.spawnSpec,d=t.label;if(t.exited||We({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),Q.delete(e);let h={sid:$n(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:r,label:d};Os(h),Q.set(h.sid,h),at(),Qt(h.sid),jn(h),gt()}function Lh(e){let t=Q.get(e);if(t!==void 0){if(t.exited||We({t:"kill",sid:e}),Q.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),pt===e){pt=null;let r=[...Q.keys()].pop()??null;r!==null&&Qt(r)}at(),Q.size===0?Ii():gt()}}function Qt(e){let t=Q.get(e);if(t!==void 0){pt=e;for(let[r,d]of Q)d.termEl!==null&&(d.termEl.style.display=r===e?"":"none");At!==null&&t.termEl!==null&&t.termEl.parentElement!==At&&At.appendChild(t.termEl),at();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&Oi(t),Vt(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"")}}function at(){if(kt===null)return;kt.textContent="";for(let[t,r]of Q){let d=document.createElement("button");d.className="tt_tab",t===pt&&(d.dataset.active="");let h=document.createElement("span");h.textContent=r.label||"\u7EC8\u7AEF "+qn(t),h.addEventListener("dblclick",s=>{s.stopPropagation(),kh(t,d)});let i=document.createElement("span");i.className="tt_tabClose",i.title="\u5173\u95ED",i.textContent="\u2715",d.title=h.textContent,d.appendChild(h),d.appendChild(i),d.addEventListener("click",s=>{if(s.target.closest(".tt_tabClose")!==null){s.stopPropagation(),Lh(t);return}Qt(t)}),kt.appendChild(d)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.textContent="+",e.addEventListener("click",()=>{Mh(e)}),kt.appendChild(e)}function qn(e){let t=1;for(let r of Q.keys()){if(r===e)return String(t);t+=1}return String(t)}function kh(e,t){let r=Q.get(e);if(r===void 0||t.querySelector(".tt_tabRename")!==null)return;let d=t.querySelector("span:not(.tt_tabClose)");if(d===null)return;let h=document.createElement("input");h.className="tt_tabRename",h.value=r.label||"\u7EC8\u7AEF "+qn(e),d.replaceWith(h),h.focus(),h.select();let i=!1,s=()=>{if(i)return;i=!0;let _=h.value.trim();r.label=_!==""?_:void 0,at(),gt()},l=()=>{i||(i=!0,at())};h.addEventListener("keydown",_=>{_.stopPropagation(),_.key==="Enter"?s():_.key==="Escape"&&l()}),h.addEventListener("blur",s),h.addEventListener("click",_=>_.stopPropagation())}var Kn=[];function Jt(e){e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(ot=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(Kn=e.tunnels)}function Rh(e){return Kn.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function Ms(e){let t=Number(e?.port),r=Number.isInteger(t)&&t!==22?":"+t:"",d=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",h=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+r+" \xB7 "+d+h}async function Ah(){try{let t=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(t.ok&&typeof t.config=="object"&&t.config!==null){let r=ot;Jt(t.config),Ne!==null&&ot!==r&&Vn(Ne)}}catch{}}function Gn(e){Ne!==null&&(e.target instanceof Element&&(Ne.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||Je())}function Mh(e){if(Ne!==null){Je();return}Ah();let t=document.createElement("div");t.className="tt_addMenu",Ne=t,Vn(t),document.body.appendChild(t);let r=e.getBoundingClientRect();t.style.left=Math.max(8,Math.min(r.left,window.innerWidth-340))+"px",t.style.top=r.bottom+4+"px",document.addEventListener("mousedown",Gn,!0)}function Je(){Ne!==null&&(document.removeEventListener("mousedown",Gn,!0),Ne.remove(),Ne=null)}function On(e,t,r,d){let h=document.createElement("button");h.type="button",h.className="tt_addMenuItem";let i=document.createElement("span");if(i.textContent=t,h.appendChild(i),r!==""){let s=document.createElement("span");s.className="tt_addMenuSub",s.textContent=r,h.appendChild(s)}h.addEventListener("click",d),e.appendChild(h)}function Vn(e){e.textContent="",On(e,"\u672C\u5730\u7EC8\u7AEF","\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",()=>{Je(),Pi()});let t=document.createElement("div");t.className="tt_addMenuSep",e.appendChild(t);let r=document.createElement("div");r.className="tt_addMenuTitle",r.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(r);for(let h of ot){if(h===null||typeof h!="object"||typeof h.name!="string"||h.name==="")continue;let i=document.createElement("div");i.className="tt_addMenuRow";let s=document.createElement("button");s.type="button",s.className="tt_addMenuItem";let l=document.createElement("span");l.textContent=h.name;let _=document.createElement("span");_.className="tt_addMenuSub";let n=Rh(h.name);_.textContent=Ms(h)+(n>0?" \xB7 \u21C4"+String(n):""),s.appendChild(l),s.appendChild(_),s.addEventListener("click",()=>{Je(),Pi({t:"ssh",name:h.name},h.name)});let f=document.createElement("button");f.type="button",f.className="tt_addMenuEdit",f.title="\u7F16\u8F91\u8FDE\u63A5",f.textContent="\u270E",f.addEventListener("click",()=>{Je(),In(h)}),i.appendChild(s),i.appendChild(f),e.appendChild(i)}if(ot.length===0){let h=document.createElement("div");h.className="tt_addMenuTitle",h.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(h)}let d=document.createElement("div");d.className="tt_addMenuSep",e.appendChild(d),On(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{Je(),In()})}function In(e){if(Dt!==null)return;let t=e!==null&&typeof e=="object"?e:null,r=t!==null,d=document.createElement("div");d.className="tt_sshBackdrop";let h=document.createElement("div");h.className="tt_sshCard";let i=document.createElement("div");i.className="tt_sshTitle",i.textContent=r?"\u7F16\u8F91\u8FDE\u63A5 \u2014 "+String(t.name??""):"SSH \u8FDE\u63A5",h.appendChild(i);let s={},l=(M,O,D)=>{let w=document.createElement("label");w.className="tt_sshRow";let E=document.createElement("span");E.className="tt_cardLabel",E.textContent=O,w.appendChild(E);let L;if(D?.select!==void 0){L=document.createElement("select");for(let A of D.select){let F=document.createElement("option");F.value=A.value,F.textContent=A.label,L.appendChild(F)}}else L=document.createElement("input"),L.type=D?.type??"text",L.placeholder=D?.placeholder??"";return L.className="tt_cardInput",L.autocomplete="off",L.spellcheck=!1,w.appendChild(L),s[M]=L,w},_=document.createElement("div");_.className="tt_sshGrid",_.appendChild(l("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),_.appendChild(l("port","\u7AEF\u53E3",{placeholder:"22"})),h.appendChild(_),h.appendChild(l("username","\u7528\u6237\u540D",{placeholder:"root"})),h.appendChild(l("auth","\u8BA4\u8BC1\u65B9\u5F0F",{select:[{value:"agent",label:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"},{value:"key",label:"key \u2014 \u79C1\u94A5\u6587\u4EF6"},{value:"password",label:"password \u2014 \u5BC6\u7801"}]}));let n=l("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),f=l("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),g=l("password","\u5BC6\u7801",{type:"password"}),b=M=>{let O=document.createElement("div");O.className="tt_sshRow";let D=document.createElement("input");D.type="text",D.className="tt_cardInput",D.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",D.autocomplete="off",D.spellcheck=!1;let w=document.createElement("div");w.className="tt_envList";let E=[],L=()=>{if(w.textContent="",E.length===0){let $=document.createElement("span");$.className="tt_cardHint",$.textContent="env \u63D2\u4EF6\u8FD8\u6CA1\u6709\u6258\u7BA1\u53D8\u91CF \u2014 \u5728\u5176\u8BBE\u7F6E\u5361\u7247\u6DFB\u52A0\u540E\u8FD9\u91CC\u53EF\u9009\uFF0C\u4E5F\u53EF\u624B\u8F93 env:NAME",w.appendChild($);return}let A=D.value.trim().toUpperCase(),F=A===""?E:E.filter($=>$.toUpperCase().includes(A));for(let $ of F.slice(0,30)){let q=document.createElement("button");q.type="button",q.className="tt_envItem",q.textContent=$,q.addEventListener("click",()=>{M.value="env:"+$}),w.appendChild(q)}if(F.length>30){let $=document.createElement("span");$.className="tt_envMore",$.textContent="\u8FD8\u6709 "+(F.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",w.appendChild($)}else if(F.length===0){let $=document.createElement("span");$.className="tt_envMore",$.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",w.appendChild($)}};return D.addEventListener("input",L),O.appendChild(D),O.appendChild(w),{row:O,setNames(A){E=Array.isArray(A)?A:[],L()}}},p=b(s.passphrase),a=b(s.password),c=!1;(async()=>{if(!c){c=!0;try{let O=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();O.ok&&Array.isArray(O.names)&&(p.setNames(O.names),a.setNames(O.names))}catch{}}})(),h.appendChild(n),h.appendChild(f),h.appendChild(p.row),h.appendChild(g),h.appendChild(a.row);let u=document.createElement("label");u.className="tt_cardRow";let v=document.createElement("input");v.type="checkbox",v.className="tt_cardCheckbox";let C=document.createElement("span");C.className="tt_cardLabel",C.textContent="agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09",u.appendChild(v),u.appendChild(C),h.appendChild(u);let S=document.createElement("label");S.className="tt_cardRow";let y=document.createElement("input");y.type="checkbox",y.className="tt_cardCheckbox";let m=document.createElement("span");m.className="tt_cardLabel",m.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",S.appendChild(y),S.appendChild(m),h.appendChild(S);let x=l("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});x.style.display="none",h.appendChild(x),y.addEventListener("change",()=>{x.style.display=y.checked?"":"none",y.checked&&s.name.value.trim()===""&&s.host.value.trim()!==""&&(s.name.value=s.host.value.trim()),y.checked&&s.name.focus()}),r&&(S.style.display="none",s.name.value=String(t.name??""),x.style.display="",s.host.value=String(t.host??""),s.port.value=String(t.port??22),s.username.value=String(t.username??""),s.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",s.keyPath.value=String(t.keyPath??""),s.passphrase.value=String(t.passphrase??""),s.password.value=String(t.password??""));let T=document.createElement("div");T.className="tt_sshError",h.appendChild(T);let P=document.createElement("div");P.className="tt_sshActions";let I=document.createElement("button");I.type="button",I.className="tt_toolBtn",I.textContent="\u53D6\u6D88";let R=document.createElement("button");R.type="button",R.className="tt_cardSave",R.textContent="\u8FDE\u63A5",P.appendChild(I);let W=null;r&&(W=document.createElement("button"),W.type="button",W.className="tt_toolBtn",W.textContent="\u4FDD\u5B58\u4FEE\u6539",W.addEventListener("click",()=>{T.textContent="";let M=s.host.value.trim(),O=s.username.value.trim();if(M===""||O===""){T.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let D=Number(s.port.value);(!Number.isInteger(D)||D<1||D>65535)&&(D=22);let w=s.auth.value,L={name:s.name.value.trim()||M,host:M,port:D,username:O,auth:w,keyPath:w==="key"?s.keyPath.value.trim():"",passphrase:s.passphrase.value,password:s.password.value,agentForward:v.checked};if(w==="key"&&L.keyPath===""){T.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}W!==null&&(W.disabled=!0),Th(String(t.name??""),L).then(A=>{if(W!==null&&(W.disabled=!1),A!==void 0){T.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+A;return}dt()})}),P.appendChild(W)),P.appendChild(R),h.appendChild(P);let B=()=>{n.style.display=s.auth.value==="key"?"":"none",f.style.display=s.auth.value==="key"?"":"none",p.row.style.display=s.auth.value==="key"?"":"none",g.style.display=s.auth.value==="password"?"":"none",a.row.style.display=s.auth.value==="password"?"":"none"};s.auth.addEventListener("change",B),B(),I.addEventListener("click",()=>dt()),d.addEventListener("mousedown",M=>{M.target===d&&dt()}),R.addEventListener("click",()=>{T.textContent="";let M=s.host.value.trim(),O=s.username.value.trim(),D=Number(s.port.value);if((!Number.isInteger(D)||D<1||D>65535)&&(D=22),M===""||O===""){T.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let w=s.auth.value,E={t:"ssh",host:M,port:D,username:O,auth:w};if(w==="key"){let $=s.keyPath.value.trim();$!==""&&(E.keyPath=$);let q=s.passphrase.value;q!==""&&(E.passphrase=q)}if(w==="password"){let $=s.password.value;$!==""&&(E.password=$)}v.checked&&(E.agentForward=!0);let L=D!==22?O+"@"+M+":"+D:O+"@"+M,A=$=>{dt(),ee!==null&&Pi(E,$!==""?$:L)};if(!y.checked){A("");return}let F=s.name.value.trim()||M;R.disabled=!0,Dh({name:F,host:M,port:D,username:O,auth:w,keyPath:E.keyPath??"",passphrase:E.passphrase??"",password:E.password??"",agentForward:v.checked}).then($=>{if(R.disabled=!1,$!==void 0){T.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+$;return}A(F)})}),d.appendChild(h),document.body.appendChild(d),Dt=d,s.host.focus()}function dt(){Dt!==null&&(Dt.remove(),Dt=null)}async function Dh(e){let t=[...ot.filter(r=>r?.name!==e.name),e];try{let r=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),d=await r.json().catch(()=>({}));if(!r.ok||!d.ok)return String(d.error||"HTTP "+r.status);Jt(d.config);return}catch(r){return String(r&&r.message?r.message:r)}}async function Th(e,t){if(t.name!==e&&ot.some(d=>d?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let r=ot.map(d=>d?.name===e?t:d);try{let d=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:r})}),h=await d.json().catch(()=>({}));if(!d.ok||!h.ok)return String(h.error||"HTTP "+d.status);Jt(h.config);return}catch(d){return String(d&&d.message?d.message:d)}}function Yn(){if(be===null)return;let e=be.style.display==="none"||be.style.display==="";be.style.display=e?"":"none",e&&be.focus()}var Bh={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function Ph(e){let t=Rt();if(t===void 0||t.search===void 0)return;let r=be.value;if(r==="")return;let d={decorations:Bh};e?t.search.findPrevious(r,d):t.search.findNext(r,d)}function Hn(){Mi||ee===null||ut!==null||(ut=setTimeout(()=>{ut=null,Ds()},Xt),Xt=Math.min(Xt*2,5e3))}async function Oh(){let e=Ch();if(Q.size===0){if(e.length>0){We({t:"sessions"});let t=await yh("sessions",4e3),r=new Map;if(t!==null&&Array.isArray(t.list))for(let d of t.list)d!==null&&typeof d=="object"&&d.attachable===!0&&r.set(d.sid,d);for(let d of e)r.has(d.sid)&&xh(d);gt()}Q.size===0&&Pi();return}for(let t of[...Q.values()])t.exited||We({t:"attach",sid:t.sid})}function Ds(){if(ge!==null){try{ge.close()}catch{}ge=null}Mi=!1,clearTimeout(ut),ut=null,Ai=!0,ct("\u8FDE\u63A5\u4E2D\u2026","");try{ge=new WebSocket(wh())}catch(e){Ai=!1,ct("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),Hn();return}ge.onopen=()=>{Ai=!1,Xt=1e3,ct("\u5DF2\u8FDE\u63A5","connected"),Oh()},ge.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=t.sid;if(t.t==="ready"){let d=typeof t.target=="string"?t.target:"";ct(t.kind==="ssh"?"SSH "+(d!==""?d+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let h=Q.get(r);h!==void 0&&(h.exited=!1,h.spawned=!0,t.kind==="ssh"&&d!==""&&!h.label&&(h.label=d,at()),Vt(h,""),Oi(h),Zt(),gt())}else if(t.t==="data"){let d=Q.get(r);d!==void 0&&d.term!==null&&(d.term.write(String(t.d??"")),Nh())}else if(t.t==="exit"){let d=Q.get(r);if(d!==void 0){d.exited=!0;let h=t.code!==null&&t.code!==void 0?"code="+t.code:"",i=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";ct("\u5DF2\u9000\u51FA "+[h,i].filter(Boolean).join(" "),""),Vt(d,"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00"),Zt(),gt()}}else if(t.t==="error")if(ct("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof r=="string"){let d=Q.get(r);d!==void 0&&Vt(d,"\u9519\u8BEF\uFF1A"+String(t.m??"")+" \u2014 \u70B9\u51FB\u91CD\u8BD5")}else Ih("\u70B9\u51FB\u91CD\u8BD5")},ge.onclose=()=>{if(Ai=!1,!Mi){ct("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of Q.values())e.exited||Vt(e,"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026");Hn()}},ge.onerror=()=>{}}function Ih(e){Mt!==null&&(Mt.textContent=e)}function Hh(){if(ee!==null){Ze&&Xn();return}Un(),ee=document.createElement("div"),ee.className="tt_modalBackdrop",ee.innerHTML='<div class="tt_modal"><div class="tt_header"><div class="tt_title">'+Bs+'<span>\u7EC8\u7AEF</span></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><button class="tt_toolBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">\u641C\u7D22</button><button class="tt_toolBtn" data-act="clear" title="\u6E05\u5C4F">\u6E05\u5C4F</button><button class="tt_toolBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">\u590D\u5236</button><button class="tt_toolBtn" data-act="paste" title="\u7C98\u8D34">\u7C98\u8D34</button><button class="tt_min" title="\u6700\u5C0F\u5316\u5230\u60AC\u6D6E\u6761\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09">\u2014</button><button class="tt_close" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button></div><div class="tt_tabbar"></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(ee),Tt=ee.querySelector(".tt_statusText"),_t=ee.querySelector(".tt_statusDot"),kt=ee.querySelector(".tt_tabbar"),At=ee.querySelector(".tt_body"),Mt=ee.querySelector(".tt_body > .tt_overlay"),be=ee.querySelector(".tt_searchInput"),Mt.addEventListener("click",()=>{Mt.textContent="",Ds()}),ee.querySelector("[data-act=search]").addEventListener("click",()=>{Yn(),be.style.display!=="none"&&be.focus()}),be.addEventListener("keydown",e=>{e.key==="Enter"?(e.preventDefault(),Ph(e.shiftKey)):e.key==="Escape"&&(e.stopPropagation(),be.style.display="none")}),ee.querySelector("[data-act=clear]").addEventListener("click",()=>{let e=Rt();e!==void 0&&e.term!==null&&e.term.clear()}),ee.querySelector("[data-act=copy]").addEventListener("click",()=>{let e=Rt();if(e===void 0||e.term===null)return;let t=e.term.getSelection();t!==""&&navigator.clipboard.writeText(t).catch(()=>{})}),ee.querySelector("[data-act=paste]").addEventListener("click",()=>{let e=Rt();e!==void 0&&navigator.clipboard.readText().then(t=>{We({t:"input",sid:e.sid,d:t})}).catch(()=>{})}),ee.querySelector(".tt_min").addEventListener("click",()=>{Ts()}),ee.querySelector(".tt_close").addEventListener("click",()=>{Ii()}),ee.addEventListener("mousedown",e=>{e.target===ee&&Ts()}),document.addEventListener("keydown",Jn),Yt=new ResizeObserver(()=>{if(Ze)return;let e=Rt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{return}e.exited||Oi(e)}}),Yt.observe(At),Ds()}function Fh(){ve=document.createElement("div"),ve.className="tt_dock",ve.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",ve.innerHTML='<span class="tt_dockTitle">'+Bs+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u7EC8\u7AEF\uFF08\u7ED3\u675F\u6240\u6709\u4F1A\u8BDD\uFF09">\u2715</button>',Di=ve.querySelector(".tt_dockCount"),Bt=ve.querySelector(".tt_dockStatus"),ft=ve.querySelector(".tt_dockDot");let e=[...Q.values()].filter(t=>!t.exited).length;Di.textContent=Q.size>0?"\xB7 "+e+"/"+Q.size:"",Tt!==null&&(Bt.textContent=Tt.textContent),_t!==null&&(ft.dataset.state=_t.dataset.state??""),ve.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),Ii();return}Xn()}),document.body.appendChild(ve)}function Ts(){ee===null||Ze||(Je(),dt(),Ze=!0,be!==null&&(be.style.display="none"),ee.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?Zt():(Fh(),ve.classList.add("tt_dockCompact")))}function Zt(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Ze){t!==null&&t.remove(),delete e.dataset.minimized,e.removeAttribute("title");return}t===null&&(t=document.createElement("span"),t.className="tt_sidebarEntryBadge",t.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',e.appendChild(t)),e.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let r=[...Q.values()].filter(h=>!h.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=r+"/"+Q.size;let d=t.querySelector(".tt_sidebarBadgeDot");d!==null&&_t!==null&&(d.dataset.state=_t.dataset.state??"")}function Nh(){if(!Ze)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??ft;e!==null&&(e.dataset.active="",clearTimeout(Ti),Ti=setTimeout(()=>{delete e.dataset.active},900))}function Xn(){if(ee===null||!Ze)return;Ze=!1,delete ee.dataset.minimized,clearTimeout(Ti),ve!==null&&(ve.remove(),ve=null),Di=null,Bt=null,ft=null,Zt();let e=Rt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&Oi(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Ii(){if(ee!==null){if(Mi=!0,Ze=!1,Je(),dt(),clearTimeout(Ti),clearTimeout(ut),ut=null,Xt=1e3,ve!==null&&(ve.remove(),ve=null),Di=null,Bt=null,ft=null,Zt(),ge!==null){for(let e of Q.values())e.exited||We({t:"kill",sid:e.sid});try{ge.close()}catch{}ge=null}Yt!==null&&(Yt.disconnect(),Yt=null);for(let e of Q.values())if(e.term!==null)try{e.term.dispose()}catch{}Q.clear(),pt=null,document.removeEventListener("keydown",Jn),ee.remove(),ee=null,Tt=null,_t=null,kt=null,At=null,Mt=null,be=null,Ps=0;try{sessionStorage.removeItem(Bi)}catch{}}}function Jn(e){if(e.key==="Escape"&&ee!==null){if(e.preventDefault(),Dt!==null){dt();return}if(Ne!==null){Je();return}Ts()}}function Wh(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function $h(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let r of e.children)if(r.tagName==="BUTTON")return r}function Uh(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label","\u7EC8\u7AEF"),e.innerHTML='<span class="tt_sidebarEntryIcon">'+Bs+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),Hh()}),e}function Fn(e,t){let r=$h(e);if(r===void 0)return!1;if(t.parentElement!==e){let d=r.closest('[class*="logoRow"]'),h=d!==null&&d.parentElement===e?d:r,i=Array.from(e.children).filter(s=>s instanceof HTMLElement&&s.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(i.length>0){let s=i[i.length-1];e.insertBefore(t,s.nextSibling)}else e.insertBefore(t,h.nextElementSibling)}return!0}function zh(){if(Un(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=Uh(),t,r=!1,d=()=>{if(t!==void 0&&!t.isConnected&&(i.disconnect(),t=void 0,r=!1),r){if(document.body.contains(e))return;i.disconnect(),t=void 0,r=!1}t??(t=Wh()),t!==void 0&&(r=Fn(t,e),r&&i.observe(t,{childList:!0,subtree:!0}))},h=new MutationObserver(()=>{d()});h.observe(document.body,{childList:!0,subtree:!0});let i=new MutationObserver(()=>{if(t===void 0||!t.isConnected){r=!1,d();return}t.contains(e)||(r=Fn(t,e))});return d(),()=>{h.disconnect(),i.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},r=e("react"),{jsx:d,jsxs:h}=e("react/jsx-runtime"),i="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function s(){let[l,_]=r.useState(!1),[n,f]=r.useState(null),[g,b]=r.useState(!1),[p,a]=r.useState(!1),[c,o]=r.useState({kind:"",text:""}),u=async()=>{try{let j=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();j.ok&&typeof j.config=="object"&&j.config!==null?(f(j.config),Jt(j.config)):o({kind:"error",text:String(j.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(N){o({kind:"error",text:String(N&&N.message?N.message:N)})}};r.useEffect(()=>{l&&!g&&(b(!0),u())},[l]);let v=(N,j)=>f(K=>({...K||{},[N]:j})),[C,S]=r.useState(null),[y,m]=r.useState(null),[x,T]=r.useState(""),[P,I]=r.useState([]),[R,W]=r.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});r.useEffect(()=>{if(!l)return;let N=!0,j=async()=>{try{let X=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();N&&X.ok&&Array.isArray(X.tunnels)&&I(X.tunnels)}catch{}};j();let K=setInterval(j,2e3);return()=>{N=!1,clearInterval(K)}},[l]);let B=N=>j=>W(K=>({...K||{},[N]:j.target.value})),M=N=>N?.direction==="remote"?`\u8FDC\u7A0B:${N.remoteHost||"127.0.0.1"}:${String(N.remotePort??0)} \u2192 \u672C\u673A:${String(N.localTargetPort??0)}`:`\u672C\u673A:${String(N?.localPort??0)} \u2192 ${N?.remoteHost??"?"}:${String(N?.remotePort??0)}`,O=(n?.sshHosts??[]).find(N=>N?.name===R?.bookName),D=async N=>{try{let j=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:N})}),K=await j.json().catch(()=>({}));return!j.ok||!K.ok?(o({kind:"error",text:String(K.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(j){return o({kind:"error",text:String(j&&j.message?j.message:j)}),!1}},w=()=>{o({kind:"",text:""});let N=R||{},j=N.bookName||(Array.isArray(n?.sshHosts)?n.sshHosts[0]?.name:"")||"";if(j===""){o({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let K=oe=>{let Me=Number(oe);return Number.isInteger(Me)&&Me>=1&&Me<=65535?Me:0},Y;if(N.direction==="remote"){if(Y={name:"",bookName:j,direction:"remote",remotePort:K(N.remotePort),localTargetHost:"",localTargetPort:K(N.localTargetPort),enabled:!0},Y.remotePort<1||Y.localTargetPort<1){o({kind:"error",text:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09"});return}Y.name=`${j}-R${String(Y.remotePort)}`}else{if(Y={name:"",bookName:j,direction:"local",localPort:K(N.localPort),remoteHost:N.remoteHost.trim(),remotePort:K(N.remotePort),enabled:!0},Y.localPort<1||Y.remoteHost===""||Y.remotePort<1){o({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}Y.name=`${j}-L${String(Y.localPort)}`}let X=new Set((Array.isArray(n?.tunnels)?n.tunnels:[]).map(oe=>oe?.name)),ie=Y.name,ne=2;for(;X.has(ie);)ie=`${Y.name}-${String(ne)}`,ne+=1;Y.name=ie;let Z=[...Array.isArray(n?.tunnels)?n.tunnels:[],Y];f(oe=>({...oe||{},tunnels:Z})),W(oe=>({...oe||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),D(Z).then(oe=>{oe&&o({kind:"ok",text:`\u96A7\u9053\u300C${ie}\u300D\u5DF2\u751F\u6548`})})},E=N=>{let j=(Array.isArray(n?.tunnels)?n.tunnels:[]).filter(K=>K?.name!==N);f(K=>({...K||{},tunnels:j})),D(j)},L=(N,j)=>{let K=(Array.isArray(n?.tunnels)?n.tunnels:[]).map(Y=>Y?.name===N?{...Y,enabled:j}:Y);f(Y=>({...Y||{},tunnels:K})),D(K)},A=N=>{S(N?.name??null),T(""),m({name:N?.name??"",host:N?.host??"",port:String(N?.port??22),username:N?.username??"",auth:N?.auth==="key"||N?.auth==="password"?N.auth:"agent",keyPath:N?.keyPath??"",passphrase:N?.passphrase??"",password:N?.password??"",agentForward:N?.agentForward===!0})},F=()=>{S(null),m(null),T("")},$=()=>{if(y===null)return;let N=y.name.trim(),j=y.host.trim(),K=y.username.trim();if(N===""||j===""||K===""){T("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let Y=Number(y.port);if((!Number.isInteger(Y)||Y<1||Y>65535)&&(Y=22),(n?.sshHosts??[]).some(X=>X?.name===N&&N!==C)){T("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+N);return}if(y.auth==="key"&&y.keyPath.trim()===""){T("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}f(X=>({...X||{},sshHosts:(Array.isArray(X?.sshHosts)?X.sshHosts:[]).map(ie=>ie?.name===C?{name:N,host:j,port:Y,username:K,auth:y.auth,keyPath:y.keyPath.trim(),passphrase:y.passphrase,password:y.password,agentForward:y.agentForward}:ie)})),S(null),m(null),T(""),o({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+N+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},q=N=>{C===N&&F(),f(j=>({...j||{},sshHosts:(Array.isArray(j?.sshHosts)?j.sshHosts:[]).filter(K=>K?.name!==N)}))},J=async N=>{let j=(Array.isArray(n?.hostKeys)?n.hostKeys:[]).filter(K=>!(K?.host===N?.host&&Number(K?.port)===Number(N?.port)));f(K=>({...K||{},hostKeys:j}));try{let K=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:j})}),Y=await K.json().catch(()=>({}));!K.ok||!Y.ok?o({kind:"error",text:String(Y.error||"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25")}):o({kind:"ok",text:"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09"})}catch(K){o({kind:"error",text:String(K&&K.message?K.message:K)})}},H=async()=>{o({kind:"",text:""});try{let j=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!j.ok){o({kind:"error",text:String(j.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let K=Array.isArray(j.entries)?j.entries:[],Y=[...Array.isArray(n?.sshHosts)?n.sshHosts:[]],X=new Set(Y.map(Z=>Z?.name)),ie=0,ne=0;for(let Z of K)if(!(Z===null||typeof Z!="object"||typeof Z.name!="string")){if(X.has(Z.name)){ne+=1;continue}X.add(Z.name),Y.push({name:Z.name,host:String(Z.host??Z.name),port:Number(Z.port)||22,username:String(Z.username??""),auth:Z.auth==="key"?"key":"agent",keyPath:String(Z.keyPath??""),passphrase:"",password:"",agentForward:!1}),ie+=1}f(Z=>({...Z||{},sshHosts:Y})),o(ie===0?{kind:"ok",text:ne>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${ne} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09`:"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"}:{kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ie} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${ne} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch(N){o({kind:"error",text:String(N&&N.message?N.message:N)})}},k=async()=>{o({kind:"",text:""});try{let j=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!j.ok){o({kind:"error",text:String(j.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let K=Array.isArray(j.entries)?j.entries:[],Y=[...Array.isArray(n?.hostKeys)?n.hostKeys:[]],X=new Set(Y.map(Z=>String(Z?.host??"")+":"+String(Z?.port??22))),ie=0,ne=0;for(let Z of K){if(Z===null||typeof Z!="object"||typeof Z.host!="string"||typeof Z.fingerprint!="string")continue;let oe=Z.host+":"+String(Z.port??22);if(X.has(oe)){ne+=1;continue}X.add(oe),Y.push({host:Z.host,port:Number(Z.port)||22,fingerprint:Z.fingerprint}),ie+=1}if(ie===0){o({kind:"ok",text:ne>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${ne} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}f(Z=>({...Z||{},hostKeys:Y}));try{let Z=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:Y})}),oe=await Z.json().catch(()=>({}));if(!Z.ok||!oe.ok){o({kind:"error",text:String(oe.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}o({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ie} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${ne} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(Z){o({kind:"error",text:String(Z&&Z.message?Z.message:Z)})}}catch(N){o({kind:"error",text:String(N&&N.message?N.message:N)})}},U=async()=>{a(!0),o({kind:"",text:""});let N={};for(let j of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration"]){let K=(n||{})[j];K!==void 0&&K!==""&&(N[j]=K)}N.sshHosts=Array.isArray(n?.sshHosts)?n.sshHosts:[],N.tunnels=Array.isArray(n?.tunnels)?n.tunnels:[];try{let j=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(N)}),K=await j.json();!j.ok||!K.ok?o({kind:"error",text:String(K.error||"\u4FDD\u5B58\u5931\u8D25")}):(o({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),K.config&&(f(K.config),Jt(K.config)))}catch(j){o({kind:"error",text:String(j&&j.message?j.message:j)})}a(!1)},z=()=>{if(y===null)return null;let N=(j,K,Y,X)=>h("label",{className:"tt_sshRow",children:[d("span",{className:"tt_cardLabel",children:j}),d("input",{className:"tt_cardInput",type:X??"text",value:y[K]??"",placeholder:Y??"",autoComplete:"off",spellCheck:!1,onChange:ie=>m(ne=>({...ne||{},[K]:ie.target.value}))})]});return h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_sshGrid",children:[N("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),N("\u7AEF\u53E3","port","22")]}),N("\u4E3B\u673A","host","example.com \u6216 IP"),N("\u7528\u6237\u540D","username","root"),h("label",{className:"tt_sshRow",children:[d("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),h("select",{className:"tt_cardInput",value:y.auth,onChange:j=>m(K=>({...K||{},auth:j.target.value})),children:[d("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),d("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),d("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...y.auth==="key"?[N("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),N("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...y.auth==="password"?[N("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],h("label",{className:"tt_cardRow",children:[d("input",{type:"checkbox",className:"tt_cardCheckbox",checked:y.agentForward===!0,onChange:j=>m(K=>({...K||{},agentForward:j.target.checked}))}),d("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),x!==""?d("span",{className:"tt_cardMessage tt_cardMessageError",children:x}):null,h("div",{className:"tt_cardRow",children:[d("button",{type:"button",className:"tt_cardSave",onClick:$,children:"\u5E94\u7528"}),d("button",{type:"button",className:"tt_toolBtn",onClick:F,children:"\u53D6\u6D88"})]})]})},G=(N,j,K,Y)=>h("label",{className:"tt_cardField",children:[d("span",{className:"tt_cardLabel",children:N}),d("input",{className:"tt_cardInput",value:n[j]??"",placeholder:K??"",onChange:X=>v(j,X.target.value)}),Y?d("span",{className:"tt_cardHint",children:Y}):null]}),V=(N,j)=>h("label",{className:"tt_cardField tt_cardRow",children:[d("input",{type:"checkbox",className:"tt_cardCheckbox",checked:n[j]===!0,onChange:K=>v(j,K.target.checked)}),d("span",{className:"tt_cardLabel",children:N})]});return h("li",{className:l?"tt_card tt_cardOpen":"tt_card",children:[h("button",{type:"button",className:"tt_cardHeader","aria-expanded":l,onClick:()=>_(N=>!N),children:[h("span",{className:"tt_cardHeadText",children:[d("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),d("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\u3001SSH \u8FDE\u63A5\u7C3F\u4E0E\u4E3B\u673A\u6307\u7EB9\u9489\u624E\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),d("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:l?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:d("path",{d:i,fill:"currentColor"})})]}),l?h("div",{className:"tt_cardBody",children:[n===null?d("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):h("div",{children:[V("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),V("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),V("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),G("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),G("Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","shell","","\u7559\u7A7A\u4F7F\u7528 $SHELL"),G("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),G("COLORTERM","colorTerm","truecolor",""),G("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),G("\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","reconnectGraceSec","120","\u5237\u65B0\u9875\u9762/\u7F51\u7EDC\u6296\u52A8\u540E\u4F1A\u8BDD\u4FDD\u6D3B\u7B49\u5F85\u91CD\u8FDE\uFF0C\u8D85\u65F6\u540E\u7ED3\u675F\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),h("div",{className:"tt_cardField",children:[d("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(n.sshHosts)&&n.sshHosts.length>0?[d("div",{className:"tt_hostList",children:n.sshHosts.map(N=>h("div",{children:[h("div",{className:"tt_sshHostRow",children:[d("div",{className:"tt_sshHostMeta",children:[d("span",{className:"tt_sshHostName",children:N?.name??""}),d("span",{className:"tt_sshHostTarget",children:Ms(N??{})})]}),d("button",{type:"button",className:"tt_toolBtn",onClick:()=>A(N),children:"\u7F16\u8F91"}),d("button",{type:"button",className:"tt_toolBtn",onClick:()=>q(N?.name),children:"\u5220\u9664"})]}),C===N?.name?z():null]},String(N?.name??"")))})]:[d("span",{className:"tt_cardHint",children:"\u6682\u65E0\u6761\u76EE \u2014 \u7EC8\u7AEF\u9762\u677F\u300C+\u300D\u2192 SSH \u8FDE\u63A5\u2026 \u52FE\u9009\u300C\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\u300D\u5373\u53EF\u6DFB\u52A0"})],h("div",{className:"tt_cardRow",children:[d("button",{type:"button",className:"tt_toolBtn",onClick:()=>void H(),children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),d("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),d("span",{className:"tt_cardHint",children:"\u968F\u300C\u4FDD\u5B58\u300D\u4E00\u5E76\u5199\u5165\u914D\u7F6E\uFF1B\u5BC6\u7801/\u53E3\u4EE4\u652F\u6301 env:VAR \u5F15\u7528\uFF0C\u907F\u514D\u660E\u6587\u5165\u5E93"})]}),h("div",{className:"tt_cardField",children:[h("div",{className:"tt_cardField",children:[d("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(n.tunnels)&&n.tunnels.length>0?[d("div",{children:n.tunnels.map(N=>{let j=P.find(Y=>Y.name===N?.name),K=j?.state??"stopped";return h("div",{className:"tt_sshHostRow",children:[d("span",{className:"tt_tunnelDot","data-state":K,title:K}),d("div",{className:"tt_sshHostMeta",children:[d("span",{className:"tt_sshHostName",children:(N?.name??"")+" \xB7 "+M(N??{})}),d("span",{className:"tt_sshHostTarget",children:(N?.bookName??"")+(j?.error?" \xB7 "+j.error:"")+(j?.lastForwardError?" \xB7 "+j.lastForwardError:"")})]}),d("input",{type:"checkbox",className:"tt_cardCheckbox",checked:N?.enabled!==!1,title:"\u542F\u7528",onChange:Y=>L(N?.name,Y.target.checked)}),d("button",{type:"button",className:"tt_toolBtn",onClick:()=>E(N?.name),children:"\u5220\u9664"})]},String(N?.name??""))})})]:[d("span",{className:"tt_cardHint",children:"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3"})],h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_cardRow",children:[h("select",{className:"tt_cardInput",value:R.direction,onChange:B("direction"),children:[d("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),d("option",{value:"remote",children:"\u8FDC\u7A0B\u8F6C\u53D1\uFF08-R\uFF09\uFF1A\u8FDC\u7A0B\u7AEF\u53E3 \u2192 \u672C\u673A\u670D\u52A1"})]}),h("select",{className:"tt_cardInput",value:R.bookName,onChange:B("bookName"),children:[d("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(n?.sshHosts)?n.sshHosts.map(N=>d("option",{value:N?.name??"",children:N?.name??""})):[]]})]}),d("span",{className:"tt_cardHint",children:O!==void 0?"\u7ECF "+Ms(O)+" \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE":"\u9009\u62E9\u8FD9\u6761\u96A7\u9053\u8981\u8D70\u54EA\u53F0 SSH \u8FDE\u63A5\uFF08\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8FDE\u63A5\u7C3F\uFF09"}),R.direction==="local"?h("div",{className:"tt_tunnelGridLocal",children:[d("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:R.localPort,autoComplete:"off",onChange:B("localPort")}),d("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:R.remoteHost,autoComplete:"off",onChange:B("remoteHost")}),d("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:R.remotePort,autoComplete:"off",onChange:B("remotePort")})]}):h("div",{className:"tt_tunnelGrid",children:[d("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:R.remotePort,autoComplete:"off",onChange:B("remotePort")}),d("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:R.localTargetPort,autoComplete:"off",onChange:B("localTargetPort")})]}),d("div",{className:"tt_cardRow",children:[d("button",{type:"button",className:"tt_cardSave",onClick:w,children:"\u6DFB\u52A0\u96A7\u9053"}),d("span",{className:"tt_cardHint",children:"\u6DFB\u52A0\u540E\u7ACB\u5373\u751F\u6548\uFF1B\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\uFF1B\u672C\u5730\u7AEF\u53E3\u5EFA\u8BAE 1024 \u4EE5\u4E0A\uFF1B\u8FDC\u7A0B\u4E3B\u673A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF08127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09"})]})]})]}),h("div",{className:"tt_cardField",children:[d("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),d("button",{type:"button",className:"tt_toolBtn",onClick:()=>void k(),children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(n.hostKeys)&&n.hostKeys.length>0?[d("div",{className:"tt_hostList",children:n.hostKeys.map(N=>h("div",{className:"tt_sshHostRow",children:[d("div",{className:"tt_sshHostMeta",children:[d("span",{className:"tt_sshHostName",children:String(N?.host??"")+":"+String(N?.port??22)}),d("span",{className:"tt_sshHostTarget",children:"sha256:"+String(N?.fingerprint??"")})]}),d("button",{type:"button",className:"tt_toolBtn",onClick:()=>void J(N),children:"\u5220\u9664"})]},String(N?.host??"")+":"+String(N?.port??22)))})]:[d("span",{className:"tt_cardHint",children:"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9"})],d("span",{className:"tt_cardHint",children:"\u4E3B\u673A\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF1B\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE"})]}),h("div",{className:"tt_cardField tt_cardRow",children:[d("button",{className:"tt_cardSave",disabled:p,onClick:()=>void U(),children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),d("span",{className:"tt_cardMessage"+(c.kind==="ok"?" tt_cardMessageOk":c.kind==="error"?" tt_cardMessageError":""),children:c.text})]})]})]}):null]})}return t.inject=["slots","sessions"],t.apply=l=>(zn=l.sessions,zh(),l.slots.inject("settings.plugin.item",()=>l.slots.register({name:"settings.plugin.item",key:"tty",order:110},s)),()=>{Ii()}),t}});})();
|
|
256
339
|
/*! Bundled license information:
|
|
257
340
|
|
|
258
341
|
@xterm/addon-search/lib/addon-search.mjs:
|
|
@@ -282,4 +365,18 @@ ${_.join(`
|
|
|
282
365
|
* http://bellard.org/jslinux/
|
|
283
366
|
* Copyright (c) 2011 Fabrice Bellard
|
|
284
367
|
*)
|
|
368
|
+
|
|
369
|
+
@xterm/addon-webgl/lib/addon-webgl.mjs:
|
|
370
|
+
(**
|
|
371
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
372
|
+
* @license MIT
|
|
373
|
+
*
|
|
374
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
375
|
+
* @license MIT
|
|
376
|
+
*
|
|
377
|
+
* Originally forked from (with the author's permission):
|
|
378
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
379
|
+
* http://bellard.org/jslinux/
|
|
380
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
381
|
+
*)
|
|
285
382
|
*/
|