@hyzyn/dsh-tty 0.10.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -1,64 +1,64 @@
1
- "use strict";(()=>{var $o=Object.create;var fr=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var zo=Object.getOwnPropertyNames;var jo=Object.getPrototypeOf,qo=Object.prototype.hasOwnProperty;var pr=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(s){throw t=0,s}};var Ko=(e,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let h of zo(t))!qo.call(e,h)&&h!==s&&fr(e,h,{get:()=>t[h],enumerable:!(c=Uo(t,h))||c.enumerable});return e};var gr=(e,t,s)=>(s=e!=null?$o(jo(e)):{},Ko(t||!e||!e.__esModule?fr(s,"default",{value:e,enumerable:!0}):s,e));var mr=pr((_i,ns)=>{(function(e,t){if(typeof _i=="object"&&typeof ns=="object")ns.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var s=t();for(var c in s)(typeof _i=="object"?_i:e)[c]=s[c]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(h,i,r){var l=this&&this.__decorate||function(o,u,v,C){var w,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--)(w=o[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(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=r(9042),f=r(9924),p=r(844),S=r(4725),g=r(2585),a=r(3656),d=i.AccessibilityManager=class extends p.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 w=0;w<this._terminal.rows;w++)this._rowElements[w]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[w]);if(this._topBoundaryFocusListener=w=>this._handleBoundaryFocus(w,0),this._bottomBoundaryFocusListener=w=>this._handleBoundaryFocus(w,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((w=>this._handleResize(w.rows)))),this.register(this._terminal.onRender((w=>this._refreshRows(w.start,w.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((w=>this._handleChar(w)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
- `)))),this.register(this._terminal.onA11yTab((w=>this._handleTab(w)))),this.register(this._terminal.onKey((w=>this._handleKey(w.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,p.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 w=o;w<=u;w++){let y=v.lines.get(v.ydisp+w),m=[],x=y?.translateToString(!0,void 0,void 0,m)||"",D=(v.ydisp+w+1).toString(),I=this._rowElements[w];I&&(x.length===0?(I.innerText="\xA0",this._rowColumns.set(I,[0,1])):(I.textContent=x,this._rowColumns.set(I,m)),I.setAttribute("aria-posinset",D),I.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 w,y;if(u===0?(w=v,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(w=this._rowElements.shift(),y=v,this._rowContainer.removeChild(w)),w.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 w=({node:x,offset:D})=>{let I=x instanceof Text?x.parentNode:x,H=parseInt(I?.getAttribute("aria-posinset"),10)-1;if(isNaN(H))return console.warn("row is invalid. Race condition?"),null;let M=this._rowColumns.get(I);if(!M)return console.warn("columns is null. Race condition?"),null;let N=D<M.length?M[D]:M.slice(-1)[0]+1;return N>=this._terminal.cols&&(++H,N=0),{row:H,column:N}},y=w(u),m=w(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=d=l([_(1,g.IInstantiationService),_(2,S.ICoreBrowserService),_(3,S.IRenderService)],d)},3614:(h,i)=>{function r(f){return f.replace(/\r?\n/g,"\r")}function l(f,p){return p?"\x1B[200~"+f+"\x1B[201~":f}function _(f,p,S,g){f=l(f=r(f),S.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(f,!0),p.value=""}function n(f,p,S){let g=S.getBoundingClientRect(),a=f.clientX-g.left-10,d=f.clientY-g.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${a}px`,p.style.top=`${d}px`,p.style.zIndex="1000",p.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=r,i.bracketTextForPaste=l,i.copyHandler=function(f,p){f.clipboardData&&f.clipboardData.setData("text/plain",p.selectionText),f.preventDefault()},i.handlePasteEvent=function(f,p,S,g){f.stopPropagation(),f.clipboardData&&_(f.clipboardData.getData("text/plain"),p,S,g)},i.paste=_,i.moveTextAreaUnderMouseCursor=n,i.rightClickHandler=function(f,p,S,g,a){n(f,p,S),a&&g.rightClickSelect(f),p.value=g.selectionText,p.select()}},7239:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;let l=r(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(r,l,_,n){r.addEventListener(l,_,n);let f=!1;return{dispose:()=>{f||(f=!0,r.removeEventListener(l,_,n))}}}},3551:function(h,i,r){var l=this&&this.__decorate||function(d,o,u,v){var C,w=arguments.length,y=w<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,o,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(o,u,y):C(o,u))||y);return w>3&&y&&Object.defineProperty(o,u,y),y},_=this&&this.__param||function(d,o){return function(u,v){o(u,v,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;let n=r(3656),f=r(8460),p=r(844),S=r(2585),g=r(4725),a=i.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(d,o,u,v,C){super(),this._element=d,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,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.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(d){this._lastMouseEvent=d;let o=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!o)return;this._isMouseOut=!1;let u=d.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(d){if(this._activeLine!==d.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(d,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,d)||(this._clearCurrentLink(),this._askForLink(d,!0))}_askForLink(d,o){this._activeProviderReplies&&o||(this._activeProviderReplies?.forEach((v=>{v?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[v,C]of this._linkProviderService.linkProviders.entries())o?this._activeProviderReplies?.get(v)&&(u=this._checkLinkProviderResult(v,d,u)):C.provideLinks(d.y,(w=>{if(this._isMouseOut)return;let y=w?.map((m=>({link:m})));this._activeProviderReplies?.set(v,y),u=this._checkLinkProviderResult(v,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,o){let u=new Set;for(let v=0;v<o.size;v++){let C=o.get(v);if(C)for(let w=0;w<C.length;w++){let y=C[w],m=y.link.range.start.y<d?0:y.link.range.start.x,x=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let D=m;D<=x;D++){if(u.has(D)){C.splice(w--,1);break}u.add(D)}}}}_checkLinkProviderResult(d,o,u){if(!this._activeProviderReplies)return u;let v=this._activeProviderReplies.get(d),C=!1;for(let w=0;w<d;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(C=!0);if(!C&&v){let w=v.find((y=>this._linkAtPosition(y.link,o)));w&&(u=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let w=0;w<this._activeProviderReplies.size;w++){let y=this._activeProviderReplies.get(w)?.find((m=>this._linkAtPosition(m.link,o)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let o=this._positionFromMouseEvent(d,this._element,this._mouseService);o&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,o)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,o){this._currentLink&&this._lastMouseEvent&&(!d||!o||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=o)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._linkAtPosition(d.link,o)&&(this._currentLink=d,this._currentLink.state={decorations:{underline:d.link.decorations===void 0||d.link.decorations.underline,pointerCursor:d.link.decorations===void 0||d.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,d.link,this._lastMouseEvent),d.link.decorations={},Object.defineProperties(d.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(d.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 w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}}))))}_linkHover(d,o,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),o.hover&&o.hover(u,o.text)}_fireUnderlineEvent(d,o){let u=d.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(d,o,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),o.leave&&o.leave(u,o.text)}_linkAtPosition(d,o){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,v=d.range.end.y*this._bufferService.cols+d.range.end.x,C=o.y*this._bufferService.cols+o.x;return u<=C&&C<=v}_positionFromMouseEvent(d,o,u){let v=u.getCoords(d,o,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,o,u,v,C){return{x1:d,y1:o,x2:u,y2:v,cols:this._bufferService.cols,fg:C}}};i.Linkifier=a=l([_(1,g.IMouseService),_(2,g.IRenderService),_(3,S.IBufferService),_(4,g.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,r){var l=this&&this.__decorate||function(g,a,d,o){var u,v=arguments.length,C=v<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,d):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,a,d,o);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(C=(v<3?u(C):v>3?u(a,d,C):u(a,d))||C);return v>3&&C&&Object.defineProperty(a,d,C),C},_=this&&this.__param||function(g,a){return function(d,o){a(d,o,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;let n=r(511),f=r(2585),p=i.OscLinkProvider=class{constructor(g,a,d){this._bufferService=g,this._optionsService=a,this._oscLinkService=d}provideLinks(g,a){let d=this._bufferService.buffer.lines.get(g-1);if(!d)return void a(void 0);let o=[],u=this._optionsService.rawOptions.linkHandler,v=new n.CellData,C=d.getTrimmedLength(),w=-1,y=-1,m=!1;for(let x=0;x<C;x++)if(y!==-1||d.hasContent(x)){if(d.loadCell(x,v),v.hasExtendedAttrs()&&v.extended.urlId){if(y===-1){y=x,w=v.extended.urlId;continue}m=v.extended.urlId!==w}else y!==-1&&(m=!0);if(m||y!==-1&&x===C-1){let D=this._oscLinkService.getLinkData(w)?.uri;if(D){let I={start:{x:y+1,y:g},end:{x:x+(m||x!==C-1?0:1),y:g}},H=!1;if(!u?.allowNonHttpProtocols)try{let M=new URL(D);["http:","https:"].includes(M.protocol)||(H=!0)}catch{H=!0}H||o.push({text:D,range:I,activate:(M,N)=>u?u.activate(M,N,I):S(0,N),hover:(M,N)=>u?.hover?.(M,N,I),leave:(M,N)=>u?.leave?.(M,N,I)})}m=!1,v.hasExtendedAttrs()&&v.extended.urlId?(y=x,w=v.extended.urlId):(y=-1,w=-1)}}a(o)}};function S(g,a){if(confirm(`Do you want to navigate to ${a}?
1
+ "use strict";(()=>{var Vo=Object.create;var gr=Object.defineProperty;var Yo=Object.getOwnPropertyDescriptor;var Xo=Object.getOwnPropertyNames;var Jo=Object.getPrototypeOf,Zo=Object.prototype.hasOwnProperty;var vr=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Qo=(e,t,i,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Xo(t))!Zo.call(e,c)&&c!==i&&gr(e,c,{get:()=>t[c],enumerable:!(a=Yo(t,c))||a.enumerable});return e};var mr=(e,t,i)=>(i=e!=null?Vo(Jo(e)):{},Qo(t||!e||!e.__esModule?gr(i,"default",{value:e,enumerable:!0}):i,e));var br=vr((pi,os)=>{(function(e,t){if(typeof pi=="object"&&typeof os=="object")os.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var i=t();for(var a in i)(typeof pi=="object"?pi:e)[a]=i[a]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(c,s,r){var h=this&&this.__decorate||function(o,u,v,C){var w,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 E=o.length-1;E>=0;E--)(w=o[E])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let n=r(9042),_=r(9924),p=r(844),b=r(4725),g=r(2585),l=r(3656),d=s.AccessibilityManager=class extends p.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 w=0;w<this._terminal.rows;w++)this._rowElements[w]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[w]);if(this._topBoundaryFocusListener=w=>this._handleBoundaryFocus(w,0),this._bottomBoundaryFocusListener=w=>this._handleBoundaryFocus(w,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((w=>this._handleResize(w.rows)))),this.register(this._terminal.onRender((w=>this._refreshRows(w.start,w.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((w=>this._handleChar(w)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
+ `)))),this.register(this._terminal.onA11yTab((w=>this._handleTab(w)))),this.register(this._terminal.onKey((w=>this._handleKey(w.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,l.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,p.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 w=o;w<=u;w++){let y=v.lines.get(v.ydisp+w),m=[],E=y?.translateToString(!0,void 0,void 0,m)||"",P=(v.ydisp+w+1).toString(),I=this._rowElements[w];I&&(E.length===0?(I.innerText="\xA0",this._rowColumns.set(I,[0,1])):(I.textContent=E,this._rowColumns.set(I,m)),I.setAttribute("aria-posinset",P),I.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 w,y;if(u===0?(w=v,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(w=this._rowElements.shift(),y=v,this._rowContainer.removeChild(w)),w.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 w=({node:E,offset:P})=>{let I=E instanceof Text?E.parentNode:E,N=parseInt(I?.getAttribute("aria-posinset"),10)-1;if(isNaN(N))return console.warn("row is invalid. Race condition?"),null;let R=this._rowColumns.get(I);if(!R)return console.warn("columns is null. Race condition?"),null;let U=P<R.length?R[P]:R.slice(-1)[0]+1;return U>=this._terminal.cols&&(++N,U=0),{row:N,column:U}},y=w(u),m=w(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`}};s.AccessibilityManager=d=h([f(1,g.IInstantiationService),f(2,b.ICoreBrowserService),f(3,b.IRenderService)],d)},3614:(c,s)=>{function r(_){return _.replace(/\r?\n/g,"\r")}function h(_,p){return p?"\x1B[200~"+_+"\x1B[201~":_}function f(_,p,b,g){_=h(_=r(_),b.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),b.triggerDataEvent(_,!0),p.value=""}function n(_,p,b){let g=b.getBoundingClientRect(),l=_.clientX-g.left-10,d=_.clientY-g.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${l}px`,p.style.top=`${d}px`,p.style.zIndex="1000",p.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=r,s.bracketTextForPaste=h,s.copyHandler=function(_,p){_.clipboardData&&_.clipboardData.setData("text/plain",p.selectionText),_.preventDefault()},s.handlePasteEvent=function(_,p,b,g){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),p,b,g)},s.paste=f,s.moveTextAreaUnderMouseCursor=n,s.rightClickHandler=function(_,p,b,g,l){n(_,p,b),l&&g.rightClickSelect(_),p.value=g.selectionText,p.select()}},7239:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let h=r(1505);s.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(f,n,_){this._css.set(f,n,_)}getCss(f,n){return this._css.get(f,n)}setColor(f,n,_){this._color.set(f,n,_)}getColor(f,n){return this._color.get(f,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(r,h,f,n){r.addEventListener(h,f,n);let _=!1;return{dispose:()=>{_||(_=!0,r.removeEventListener(h,f,n))}}}},3551:function(c,s,r){var h=this&&this.__decorate||function(d,o,u,v){var C,w=arguments.length,y=w<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,o,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(o,u,y):C(o,u))||y);return w>3&&y&&Object.defineProperty(o,u,y),y},f=this&&this.__param||function(d,o){return function(u,v){o(u,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let n=r(3656),_=r(8460),p=r(844),b=r(2585),g=r(4725),l=s.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(d,o,u,v,C){super(),this._element=d,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 _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.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(d){this._lastMouseEvent=d;let o=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!o)return;this._isMouseOut=!1;let u=d.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(d){if(this._activeLine!==d.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(d,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,d)||(this._clearCurrentLink(),this._askForLink(d,!0))}_askForLink(d,o){this._activeProviderReplies&&o||(this._activeProviderReplies?.forEach((v=>{v?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[v,C]of this._linkProviderService.linkProviders.entries())o?this._activeProviderReplies?.get(v)&&(u=this._checkLinkProviderResult(v,d,u)):C.provideLinks(d.y,(w=>{if(this._isMouseOut)return;let y=w?.map((m=>({link:m})));this._activeProviderReplies?.set(v,y),u=this._checkLinkProviderResult(v,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,o){let u=new Set;for(let v=0;v<o.size;v++){let C=o.get(v);if(C)for(let w=0;w<C.length;w++){let y=C[w],m=y.link.range.start.y<d?0:y.link.range.start.x,E=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let P=m;P<=E;P++){if(u.has(P)){C.splice(w--,1);break}u.add(P)}}}}_checkLinkProviderResult(d,o,u){if(!this._activeProviderReplies)return u;let v=this._activeProviderReplies.get(d),C=!1;for(let w=0;w<d;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(C=!0);if(!C&&v){let w=v.find((y=>this._linkAtPosition(y.link,o)));w&&(u=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let w=0;w<this._activeProviderReplies.size;w++){let y=this._activeProviderReplies.get(w)?.find((m=>this._linkAtPosition(m.link,o)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let o=this._positionFromMouseEvent(d,this._element,this._mouseService);o&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,o)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,o){this._currentLink&&this._lastMouseEvent&&(!d||!o||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=o)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._linkAtPosition(d.link,o)&&(this._currentLink=d,this._currentLink.state={decorations:{underline:d.link.decorations===void 0||d.link.decorations.underline,pointerCursor:d.link.decorations===void 0||d.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,d.link,this._lastMouseEvent),d.link.decorations={},Object.defineProperties(d.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(d.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 w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}}))))}_linkHover(d,o,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),o.hover&&o.hover(u,o.text)}_fireUnderlineEvent(d,o){let u=d.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(d,o,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),o.leave&&o.leave(u,o.text)}_linkAtPosition(d,o){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,v=d.range.end.y*this._bufferService.cols+d.range.end.x,C=o.y*this._bufferService.cols+o.x;return u<=C&&C<=v}_positionFromMouseEvent(d,o,u){let v=u.getCoords(d,o,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,o,u,v,C){return{x1:d,y1:o,x2:u,y2:v,cols:this._bufferService.cols,fg:C}}};s.Linkifier=l=h([f(1,g.IMouseService),f(2,g.IRenderService),f(3,b.IBufferService),f(4,g.ILinkProviderService)],l)},9042:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,s,r){var h=this&&this.__decorate||function(g,l,d,o){var u,v=arguments.length,C=v<3?l:o===null?o=Object.getOwnPropertyDescriptor(l,d):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,l,d,o);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(C=(v<3?u(C):v>3?u(l,d,C):u(l,d))||C);return v>3&&C&&Object.defineProperty(l,d,C),C},f=this&&this.__param||function(g,l){return function(d,o){l(d,o,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let n=r(511),_=r(2585),p=s.OscLinkProvider=class{constructor(g,l,d){this._bufferService=g,this._optionsService=l,this._oscLinkService=d}provideLinks(g,l){let d=this._bufferService.buffer.lines.get(g-1);if(!d)return void l(void 0);let o=[],u=this._optionsService.rawOptions.linkHandler,v=new n.CellData,C=d.getTrimmedLength(),w=-1,y=-1,m=!1;for(let E=0;E<C;E++)if(y!==-1||d.hasContent(E)){if(d.loadCell(E,v),v.hasExtendedAttrs()&&v.extended.urlId){if(y===-1){y=E,w=v.extended.urlId;continue}m=v.extended.urlId!==w}else y!==-1&&(m=!0);if(m||y!==-1&&E===C-1){let P=this._oscLinkService.getLinkData(w)?.uri;if(P){let I={start:{x:y+1,y:g},end:{x:E+(m||E!==C-1?0:1),y:g}},N=!1;if(!u?.allowNonHttpProtocols)try{let R=new URL(P);["http:","https:"].includes(R.protocol)||(N=!0)}catch{N=!0}N||o.push({text:P,range:I,activate:(R,U)=>u?u.activate(R,U,I):b(0,U),hover:(R,U)=>u?.hover?.(R,U,I),leave:(R,U)=>u?.leave?.(R,U,I)})}m=!1,v.hasExtendedAttrs()&&v.extended.urlId?(y=E,w=v.extended.urlId):(y=-1,w=-1)}}l(o)}};function b(g,l){if(confirm(`Do you want to navigate to ${l}?
4
4
 
5
- WARNING: This link could potentially be dangerous`)){let d=window.open();if(d){try{d.opener=null}catch{}d.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=p=l([_(0,f.IBufferService),_(1,f.IOptionsService),_(2,f.IOscLinkService)],p)},6193:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(r,l){this._renderCallback=r,this._coreBrowserService=l,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(r){return this._refreshCallbacks.push(r),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(r,l,_){this._rowCount=_,r=r!==void 0?r:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,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 r=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let r of this._refreshCallbacks)r(0);this._refreshCallbacks=[]}}},3236:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;let l=r(3614),_=r(3656),n=r(3551),f=r(9042),p=r(3730),S=r(1680),g=r(3107),a=r(5744),d=r(2950),o=r(1296),u=r(428),v=r(4269),C=r(5114),w=r(8934),y=r(3230),m=r(9312),x=r(4725),D=r(6731),I=r(8055),H=r(8969),M=r(8460),N=r(844),B=r(6114),R=r(8437),O=r(2584),T=r(7399),b=r(5941),E=r(9074),k=r(2585),A=r(5435),W=r(4567),K=r(779);class $ extends H.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(P={}){super(P),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new N.MutableDisposable),this._onCursorMove=this.register(new M.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new M.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new M.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new M.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new M.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new M.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new M.EventEmitter),this._onBlur=this.register(new M.EventEmitter),this._onA11yCharEmitter=this.register(new M.EventEmitter),this._onA11yTabEmitter=this.register(new M.EventEmitter),this._onWillOpen=this.register(new M.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(x.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((L,U)=>this.refresh(L,U)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((L=>this._reportWindowsOptions(L)))),this.register(this._inputHandler.onColor((L=>this._handleColorEvent(L)))),this.register((0,M.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,M.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,M.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,M.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((L=>this._afterResize(L.cols,L.rows)))),this.register((0,N.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(P){if(this._themeService)for(let L of P){let U,F="";switch(L.index){case 256:U="foreground",F="10";break;case 257:U="background",F="11";break;case 258:U="cursor",F="12";break;default:U="ansi",F="4;"+L.index}switch(L.type){case 0:let q=I.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[L.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${O.C0.ESC}]${F};${(0,b.toRgbString)(q)}${O.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors((G=>G.ansi[L.index]=I.channels.toColor(...L.color)));else{let G=U;this._themeService.modifyColors((Q=>Q[G]=I.channels.toColor(...L.color)))}break;case 2:this._themeService.restoreColor(L.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){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 P=this.buffer.ybase+this.buffer.y,L=this.buffer.lines.get(P);if(!L)return;let U=Math.min(this.buffer.x,this.cols-1),F=this._renderService.dimensions.css.cell.height,q=L.getWidth(U),G=this._renderService.dimensions.css.cell.width*q,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,ee=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ee+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=G+"px",this.textarea.style.height=F+"px",this.textarea.style.lineHeight=F+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(L=>{this.hasSelection()&&(0,l.copyHandler)(L,this._selectionService)})));let P=L=>(0,l.handlePasteEvent)(L,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,_.addDisposableDomListener)(this.element,"paste",P)),B.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(L=>{L.button===2&&(0,l.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(L=>{(0,l.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(L=>{L.button===1&&(0,l.moveTextAreaUnderMouseCursor)(L,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(P=>this._keyUp(P)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(P=>this._keyDown(P)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(P=>this._keyPress(P)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(P=>this._compositionHelper.compositionupdate(P)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(P=>this._inputEvent(P)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(P){if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),P.appendChild(this.element);let L=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),L.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),L.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,P.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(D.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(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(L);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((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(g.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(W.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 P=this,L=this.element;function U(G){let Q=P._mouseService.getMouseReportCoords(G,P.screenElement);if(!Q)return!1;let ee,te;switch(G.overrideType||G.type){case"mousemove":te=32,G.buttons===void 0?(ee=3,G.button!==void 0&&(ee=G.button<3?G.button:3)):ee=1&G.buttons?0:4&G.buttons?1:2&G.buttons?2:3;break;case"mouseup":te=0,ee=G.button<3?G.button:3;break;case"mousedown":te=1,ee=G.button<3?G.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(G)===!1||P.viewport.getLinesScrolled(G)===0)return!1;te=G.deltaY<0?0:1,ee=4;break;default:return!1}return!(te===void 0||ee===void 0||ee>4)&&P.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:ee,action:te,ctrl:G.ctrlKey,alt:G.altKey,shift:G.shiftKey})}let F={mouseup:null,wheel:null,mousedrag:null,mousemove:null},q={mouseup:G=>(U(G),G.buttons||(this._document.removeEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.removeEventListener("mousemove",F.mousedrag)),this.cancel(G)),wheel:G=>(U(G),this.cancel(G,!0)),mousedrag:G=>{G.buttons&&U(G)},mousemove:G=>{G.buttons||U(G)}};this.register(this.coreMouseService.onProtocolChange((G=>{G?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(G)),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&G?F.mousemove||(L.addEventListener("mousemove",q.mousemove),F.mousemove=q.mousemove):(L.removeEventListener("mousemove",F.mousemove),F.mousemove=null),16&G?F.wheel||(L.addEventListener("wheel",q.wheel,{passive:!1}),F.wheel=q.wheel):(L.removeEventListener("wheel",F.wheel),F.wheel=null),2&G?F.mouseup||(F.mouseup=q.mouseup):(this._document.removeEventListener("mouseup",F.mouseup),F.mouseup=null),4&G?F.mousedrag||(F.mousedrag=q.mousedrag):(this._document.removeEventListener("mousemove",F.mousedrag),F.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(L,"mousedown",(G=>{if(G.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(G))return U(G),F.mouseup&&this._document.addEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.addEventListener("mousemove",F.mousedrag),this.cancel(G)}))),this.register((0,_.addDisposableDomListener)(L,"wheel",(G=>{if(!F.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(G)===!1)return!1;if(!this.buffer.hasScrollback){let Q=this.viewport.getLinesScrolled(G);if(Q===0)return;let ee=O.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(G.deltaY<0?"A":"B"),te="";for(let re=0;re<Math.abs(Q);re++)te+=ee;return this.coreService.triggerDataEvent(te,!0),this.cancel(G,!0)}return this.viewport.handleWheel(G)?this.cancel(G):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(L,"touchstart",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(G),this.cancel(G)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(L,"touchmove",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(G)?void 0:this.cancel(G)}),{passive:!1}))}refresh(P,L){this._renderService?.refreshRows(P,L)}updateCursorStyle(P){this._selectionService?.shouldColumnSelect(P)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(P,L,U=0){U===1?(super.scrollLines(P,L,U),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(P)}paste(P){(0,l.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let L=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),L}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,L,U){this._selectionService.setSelection(P,L,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(P,L){this._selectionService?.selectLines(P,L)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;let L=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!L&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;L||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let U=(0,T.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),U.type===3||U.type===2){let F=this.rows-1;return this.scrollLines(U.type===2?-F:F),this.cancel(P,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(U.cancel&&this.cancel(P,!0),!U.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==O.C0.ETX&&U.key!==O.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,L){let U=P.isMac&&!this.options.macOptionIsMeta&&L.altKey&&!L.ctrlKey&&!L.metaKey||P.isWindows&&L.altKey&&L.ctrlKey&&!L.metaKey||P.isWindows&&L.getModifierState("AltGraph");return L.type==="keypress"?U:U&&(!L.keyCode||L.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||((function(L){return L.keyCode===16||L.keyCode===17||L.keyCode===18})(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let L;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)L=P.charCode;else if(P.which===null||P.which===void 0)L=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;L=P.which}return!(!L||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(L=String.fromCharCode(L),this._onKey.fire({key:L,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(L,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let L=P.data;return this.coreService.triggerDataEvent(L,!0),this.cancel(P),!0}return!1}resize(P,L){P!==this.cols||L!==this.rows?super.resize(P,L):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,L){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let P=1;P<this.rows;P++)this.buffer.lines.push(this.buffer.getBlankLine(R.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let P=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(O.C0.ESC+"[I"):this.coreService.triggerDataEvent(O.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case A.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let L=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};${L}t`);break;case A.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let F=this._renderService.dimensions.css.cell.width.toFixed(0),q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[6;${q};${F}t`)}}cancel(P,L){if(this.options.cancelEvents||L)return P.preventDefault(),P.stopPropagation(),!1}}i.Terminal=$},9924:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(r,l=1e3){this._renderCallback=r,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(r,l,_){this._rowCount=_,r=r!==void 0?r:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,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,p=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let r=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,l)}}},1680:function(h,i,r){var l=this&&this.__decorate||function(d,o,u,v){var C,w=arguments.length,y=w<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,o,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(o,u,y):C(o,u))||y);return w>3&&y&&Object.defineProperty(o,u,y),y},_=this&&this.__param||function(d,o){return function(u,v){o(u,v,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;let n=r(3656),f=r(4725),p=r(8460),S=r(844),g=r(2585),a=i.Viewport=class extends S.Disposable{constructor(d,o,u,v,C,w,y,m){super(),this._viewportElement=d,this._scrollArea=o,this._bufferService=u,this._optionsService=v,this._charSizeService=C,this._renderService=w,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 p.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(d){this._viewportElement.style.backgroundColor=d.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(d){if(d)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 d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){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 d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<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(d,o){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(o<0&&this._viewportElement.scrollTop!==0||o>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let o=this._getPixelsScrolled(d);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(d,o))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let o=d*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:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let o=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?o*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._currentRowHeight*this._bufferService.rows),o}getBufferElements(d,o){let u,v="",C=[],w=o??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<w;m++){let x=y.get(m);if(!x)continue;let D=y.get(m+1)?.isWrapped;if(v+=x.translateToString(!D),!D||m===y.length-1){let I=document.createElement("div");I.textContent=v,C.push(I),v.length>0&&(u=I),v=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let o=this._applyScrollModifier(d.deltaY,d);return d.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):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(d,o){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&o.altKey||u==="ctrl"&&o.ctrlKey||u==="shift"&&o.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){let o=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,o!==0&&(this._viewportElement.scrollTop+=o,this._bubbleScroll(d,o))}};i.Viewport=a=l([_(2,g.IBufferService),_(3,g.IOptionsService),_(4,f.ICharSizeService),_(5,f.IRenderService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],a)},3107:function(h,i,r){var l=this&&this.__decorate||function(g,a,d,o){var u,v=arguments.length,C=v<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,d):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,a,d,o);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(C=(v<3?u(C):v>3?u(a,d,C):u(a,d))||C);return v>3&&C&&Object.defineProperty(a,d,C),C},_=this&&this.__param||function(g,a){return function(d,o){a(d,o,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;let n=r(4725),f=r(844),p=r(2585),S=i.BufferDecorationRenderer=class extends f.Disposable{constructor(g,a,d,o,u){super(),this._screenElement=g,this._bufferService=a,this._coreBrowserService=d,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 g of this._decorationService.decorations)this._renderDecoration(g);this._dimensionsChanged=!1}_renderDecoration(g){this._refreshStyle(g),this._dimensionsChanged&&this._refreshXPosition(g)}_createElement(g){let a=this._coreBrowserService.mainDocument.createElement("div");a.classList.add("xterm-decoration"),a.classList.toggle("xterm-decoration-top-layer",g?.options?.layer==="top"),a.style.width=`${Math.round((g.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,a.style.height=(g.options.height||1)*this._renderService.dimensions.css.cell.height+"px",a.style.top=(g.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 d=g.options.x??0;return d&&d>this._bufferService.cols&&(a.style.display="none"),this._refreshXPosition(g,a),a}_refreshStyle(g){let a=g.marker.line-this._bufferService.buffers.active.ydisp;if(a<0||a>=this._bufferService.rows)g.element&&(g.element.style.display="none",g.onRenderEmitter.fire(g.element));else{let d=this._decorationElements.get(g);d||(d=this._createElement(g),g.element=d,this._decorationElements.set(g,d),this._container.appendChild(d),g.onDispose((()=>{this._decorationElements.delete(g),d.remove()}))),d.style.top=a*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",g.onRenderEmitter.fire(d)}}_refreshXPosition(g,a=g.element){if(!a)return;let d=g.options.x??0;(g.options.anchor||"left")==="right"?a.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":a.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(g){this._decorationElements.get(g)?.remove(),this._decorationElements.delete(g),g.dispose()}};i.BufferDecorationRenderer=S=l([_(1,p.IBufferService),_(2,n.ICoreBrowserService),_(3,p.IDecorationService),_(4,n.IRenderService)],S)},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(r){if(r.options.overviewRulerOptions){for(let l of this._zones)if(l.color===r.options.overviewRulerOptions.color&&l.position===r.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,r.marker.line))return;if(this._lineAdjacentToZone(l,r.marker.line,r.options.overviewRulerOptions.position))return void this._addLineToZone(l,r.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=r.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=r.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=r.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=r.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:r.options.overviewRulerOptions.color,position:r.options.overviewRulerOptions.position,startBufferLine:r.marker.line,endBufferLine:r.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(r){this._linePadding=r}_lineIntersectsZone(r,l){return l>=r.startBufferLine&&l<=r.endBufferLine}_lineAdjacentToZone(r,l,_){return l>=r.startBufferLine-this._linePadding[_||"full"]&&l<=r.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(r,l){r.startBufferLine=Math.min(r.startBufferLine,l),r.endBufferLine=Math.max(r.endBufferLine,l)}}},5744:function(h,i,r){var l=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var D=u.length-1;D>=0;D--)(y=u[D])&&(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,w){v(C,w,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;let n=r(5871),f=r(4725),p=r(844),S=r(2585),g={full:0,left:0,center:0,right:0},a={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},o=i.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,v,C,w,y,m,x){super(),this._viewportElement=u,this._screenElement=v,this._bufferService=C,this._decorationService=w,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 D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.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(),d.full=0,d.left=0,d.center=a.left,d.right=a.left+a.center}_refreshDrawHeightConstants(){g.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);g.left=v,g.center=v,g.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.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(d[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-g[u.position||"full"]/2),a[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+g[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,S.IBufferService),_(3,S.IDecorationService),_(4,f.IRenderService),_(5,S.IOptionsService),_(6,f.ICoreBrowserService)],o)},2950:function(h,i,r){var l=this&&this.__decorate||function(g,a,d,o){var u,v=arguments.length,C=v<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,d):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,a,d,o);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(C=(v<3?u(C):v>3?u(a,d,C):u(a,d))||C);return v>3&&C&&Object.defineProperty(a,d,C),C},_=this&&this.__param||function(g,a){return function(d,o){a(d,o,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;let n=r(4725),f=r(2585),p=r(2584),S=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,a,d,o,u,v){this._textarea=g,this._compositionView=a,this._bufferService=d,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(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){let a={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),d.length>0&&this._coreService.triggerDataEvent(d,!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 g=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let a=this._textarea.value,d=a.replace(g,"");this._dataAlreadySent=d,a.length>g.length?this._coreService.triggerDataEvent(d,!0):a.length<g.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):a.length===g.length&&a!==g&&this._coreService.triggerDataEvent(a,!0)}}),0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let a=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=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=d+"px",this._compositionView.style.lineHeight=d+"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"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};i.CompositionHelper=S=l([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,f.ICoreService),_(5,n.IRenderService)],S)},9806:(h,i)=>{function r(l,_,n){let f=n.getBoundingClientRect(),p=l.getComputedStyle(n),S=parseInt(p.getPropertyValue("padding-left")),g=parseInt(p.getPropertyValue("padding-top"));return[_.clientX-f.left-S,_.clientY-f.top-g]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=r,i.getCoords=function(l,_,n,f,p,S,g,a,d){if(!S)return;let o=r(l,_,n);return o?(o[0]=Math.ceil((o[0]+(d?g/2:0))/g),o[1]=Math.ceil(o[1]/a),o[0]=Math.min(Math.max(o[0],1),f+(d?1:0)),o[1]=Math.min(Math.max(o[1],1),p),o):void 0}},9504:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;let l=r(2584);function _(a,d,o,u){let v=a-n(a,o),C=d-n(d,o),w=Math.abs(v-C)-(function(y,m,x){let D=0,I=y-n(y,x),H=m-n(m,x);for(let M=0;M<Math.abs(I-H);M++){let N=f(y,m)==="A"?-1:1;x.buffer.lines.get(I+N*M)?.isWrapped&&D++}return D})(a,d,o);return g(w,S(f(a,d),u))}function n(a,d){let o=0,u=d.buffer.lines.get(a),v=u?.isWrapped;for(;v&&a>=0&&a<d.rows;)o++,u=d.buffer.lines.get(--a),v=u?.isWrapped;return o}function f(a,d){return a>d?"A":"B"}function p(a,d,o,u,v,C){let w=a,y=d,m="";for(;w!==o||y!==u;)w+=v?1:-1,v&&w>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,a,w),w=0,a=0,y++):!v&&w<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,a+1),w=C.cols-1,a=w,y--);return m+C.buffer.translateBufferLineToString(y,!1,a,w)}function S(a,d){let o=d?"O":"[";return l.C0.ESC+o+a}function g(a,d){a=Math.floor(a);let o="";for(let u=0;u<a;u++)o+=d;return o}i.moveToCellSequence=function(a,d,o,u){let v=o.buffer.x,C=o.buffer.y;if(!o.buffer.hasScrollback)return(function(m,x,D,I,H,M){return _(x,I,H,M).length===0?"":g(p(m,x,m,x-n(x,H),!1,H).length,S("D",M))})(v,C,0,d,o,u)+_(C,d,o,u)+(function(m,x,D,I,H,M){let N;N=_(x,I,H,M).length>0?I-n(I,H):x;let B=I,R=(function(O,T,b,E,k,A){let W;return W=_(b,E,k,A).length>0?E-n(E,k):T,O<b&&W<=E||O>=b&&W<E?"C":"D"})(m,x,D,I,H,M);return g(p(m,N,D,B,R==="C",H).length,S(R,M))})(v,C,a,d,o,u);let w;if(C===d)return w=v>a?"D":"C",g(Math.abs(v-a),S(w,u));w=C>d?"D":"C";let y=Math.abs(C-d);return g((function(m,x){return x.cols-m})(C>d?a:v,o)+(y-1)*o.cols+1+((C>d?v:a)-1),S(w,u))}},1296:function(h,i,r){var l=this&&this.__decorate||function(M,N,B,R){var O,T=arguments.length,b=T<3?N:R===null?R=Object.getOwnPropertyDescriptor(N,B):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(M,N,B,R);else for(var E=M.length-1;E>=0;E--)(O=M[E])&&(b=(T<3?O(b):T>3?O(N,B,b):O(N,B))||b);return T>3&&b&&Object.defineProperty(N,B,b),b},_=this&&this.__param||function(M,N){return function(B,R){N(B,R,M)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;let n=r(3787),f=r(2550),p=r(2223),S=r(6171),g=r(6052),a=r(4725),d=r(8055),o=r(8460),u=r(844),v=r(2585),C="xterm-dom-renderer-owner-",w="xterm-rows",y="xterm-fg-",m="xterm-bg-",x="xterm-focus",D="xterm-selection",I=1,H=i.DomRenderer=class extends u.Disposable{constructor(M,N,B,R,O,T,b,E,k,A,W,K,$){super(),this._terminal=M,this._document=N,this._element=B,this._screenElement=R,this._viewportElement=O,this._helperContainer=T,this._linkifier2=b,this._charSizeService=k,this._optionsService=A,this._bufferService=W,this._coreBrowserService=K,this._themeService=$,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,g.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new o.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(w),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(D),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((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 M=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*M,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*M),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/M),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/M),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 N=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=N,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(M){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let N=`${this._terminalSelector} .${w} { color: ${M.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;N+=`${this._terminalSelector} .${w} .xterm-dim { color: ${d.color.multiplyOpacity(M.foreground,.5).css};}`,N+=`${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}`,R=`blink_bar_${this._terminalClass}`,O=`blink_block_${this._terminalClass}`;N+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,N+=`@keyframes ${R} { 50% { box-shadow: none; }}`,N+=`@keyframes ${O} { 0% { background-color: ${M.cursor.css}; color: ${M.cursorAccent.css}; } 50% { background-color: inherit; color: ${M.cursor.css}; }}`,N+=`${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${R} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${M.cursor.css}; color: ${M.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${M.cursor.css} !important; color: ${M.cursorAccent.css} !important;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${M.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${M.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${M.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,N+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${M.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${M.selectionInactiveBackgroundOpaque.css};}`;for(let[T,b]of M.ansi.entries())N+=`${this._terminalSelector} .${y}${T} { color: ${b.css}; }${this._terminalSelector} .${y}${T}.xterm-dim { color: ${d.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${m}${T} { background-color: ${b.css}; }`;N+=`${this._terminalSelector} .${y}${p.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(M.background).css}; }${this._terminalSelector} .${y}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(M.background),.5).css}; }${this._terminalSelector} .${m}${p.INVERTED_DEFAULT_COLOR} { background-color: ${M.foreground.css}; }`,this._themeStyleElement.textContent=N}_setDefaultSpacing(){let M=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${M}px`,this._rowFactory.defaultSpacing=M}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(M,N){for(let B=this._rowElements.length;B<=N;B++){let R=this._document.createElement("div");this._rowContainer.appendChild(R),this._rowElements.push(R)}for(;this._rowElements.length>N;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(M,N){this._refreshRowElements(M,N),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(M,N,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(M,N,B),this.renderRows(0,this._bufferService.rows-1),!M||!N)return;this._selectionRenderModel.update(this._terminal,M,N,B);let R=this._selectionRenderModel.viewportStartRow,O=this._selectionRenderModel.viewportEndRow,T=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(T>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(B){let k=M[0]>N[0];E.appendChild(this._createSelectionElement(T,k?N[0]:M[0],k?M[0]:N[0],b-T+1))}else{let k=R===T?M[0]:0,A=T===O?N[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(T,k,A));let W=b-T-1;if(E.appendChild(this._createSelectionElement(T+1,0,this._bufferService.cols,W)),T!==b){let K=O===b?N[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(M,N,B,R=1){let O=this._document.createElement("div"),T=N*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(B-N);return T+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-T),O.style.height=R*this.dimensions.css.cell.height+"px",O.style.top=M*this.dimensions.css.cell.height+"px",O.style.left=`${T}px`,O.style.width=`${b}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 M of this._rowElements)M.replaceChildren()}renderRows(M,N){let B=this._bufferService.buffer,R=B.ybase+B.y,O=Math.min(B.x,this._bufferService.cols-1),T=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=M;k<=N;k++){let A=k+B.ydisp,W=this._rowElements[k],K=B.lines.get(A);if(!W||!K)break;W.replaceChildren(...this._rowFactory.createRow(K,A,A===R,b,E,O,T,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!0)}_handleLinkLeave(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!1)}_setCellUnderline(M,N,B,R,O,T){B<0&&(M=0),R<0&&(N=0);let b=this._bufferService.rows-1;B=Math.max(Math.min(B,b),0),R=Math.max(Math.min(R,b),0),O=Math.min(O,this._bufferService.cols);let E=this._bufferService.buffer,k=E.ybase+E.y,A=Math.min(E.x,O-1),W=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=B;j<=R;++j){let P=j+E.ydisp,L=this._rowElements[j],U=E.lines.get(P);if(!L||!U)break;L.replaceChildren(...this._rowFactory.createRow(U,P,P===k,K,$,A,W,this.dimensions.css.cell.width,this._widthCache,T?j===B?M:0:-1,T?(j===R?N:O)-1:-1))}}};i.DomRenderer=H=l([_(7,v.IInstantiationService),_(8,a.ICharSizeService),_(9,v.IOptionsService),_(10,v.IBufferService),_(11,a.ICoreBrowserService),_(12,a.IThemeService)],H)},3787:function(h,i,r){var l=this&&this.__decorate||function(w,y,m,x){var D,I=arguments.length,H=I<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(w,y,m,x);else for(var M=w.length-1;M>=0;M--)(D=w[M])&&(H=(I<3?D(H):I>3?D(y,m,H):D(y,m))||H);return I>3&&H&&Object.defineProperty(y,m,H),H},_=this&&this.__param||function(w,y){return function(m,x){y(m,x,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;let n=r(2223),f=r(643),p=r(511),S=r(2585),g=r(8055),a=r(4725),d=r(4269),o=r(6171),u=r(3734),v=i.DomRendererRowFactory=class{constructor(w,y,m,x,D,I,H){this._document=w,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=x,this._coreService=D,this._decorationService=I,this._themeService=H,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,y,m){this._selectionStart=w,this._selectionEnd=y,this._columnSelectMode=m}createRow(w,y,m,x,D,I,H,M,N,B,R){let O=[],T=this._characterJoinerService.getJoinedCharacters(y),b=this._themeService.colors,E,k=w.getNoBgTrimmedLength();m&&k<I+1&&(k=I+1);let A=0,W="",K=0,$=0,j=0,P=!1,L=0,U=!1,F=0,q=[],G=B!==-1&&R!==-1;for(let Q=0;Q<k;Q++){w.loadCell(Q,this._workCell);let ee=this._workCell.getWidth();if(ee===0)continue;let te=!1,re=Q,X=this._workCell;if(T.length>0&&Q===T[0][0]){te=!0;let he=T.shift();X=new d.JoinedCellData(this._workCell,w.translateToString(!0,he[0],he[1]),he[1]-he[0]),re=he[1]-1,ee=X.getWidth()}let z=this._isCellInSelection(Q,y),V=m&&Q===I,Y=G&&Q>=B&&Q<=R,J=!1;this._decorationService.forEachDecorationAtCell(Q,y,void 0,(he=>{J=!0}));let oe=X.getChars()||f.WHITESPACE_CELL_CHAR;if(oe===" "&&(X.isUnderline()||X.isOverline())&&(oe="\xA0"),F=ee*M-N.get(oe,X.isBold(),X.isItalic()),E){if(A&&(z&&U||!z&&!U&&X.bg===K)&&(z&&U&&b.selectionForeground||X.fg===$)&&X.extended.ext===j&&Y===P&&F===L&&!V&&!te&&!J){X.isInvisible()?W+=f.WHITESPACE_CELL_CHAR:W+=oe,A++;continue}A&&(E.textContent=W),E=this._document.createElement("span"),A=0,W=""}else E=this._document.createElement("span");if(K=X.bg,$=X.fg,j=X.extended.ext,P=Y,L=F,U=z,te&&I>=Q&&I<=re&&(I=Q),!this._coreService.isCursorHidden&&V&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)H&&q.push("xterm-cursor-blink"),q.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline")}}if(X.isBold()&&q.push("xterm-bold"),X.isItalic()&&q.push("xterm-italic"),X.isDim()&&q.push("xterm-dim"),W=X.isInvisible()?f.WHITESPACE_CELL_CHAR:X.getChars()||f.WHITESPACE_CELL_CHAR,X.isUnderline()&&(q.push(`xterm-underline-${X.extended.underlineStyle}`),W===" "&&(W="\xA0"),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let he=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&he<8&&(he+=8),E.style.textDecorationColor=b.ansi[he].css}X.isOverline()&&(q.push("xterm-overline"),W===" "&&(W="\xA0")),X.isStrikethrough()&&q.push("xterm-strikethrough"),Y&&(E.style.textDecoration="underline");let ne=X.getFgColor(),_e=X.getFgColorMode(),Z=X.getBgColor(),ue=X.getBgColorMode(),it=!!X.isInverse();if(it){let he=ne;ne=Z,Z=he;let Wo=_e;_e=ue,ue=Wo}let st,ui,rt,Kt=!1;switch(this._decorationService.forEachDecorationAtCell(Q,y,void 0,(he=>{he.options.layer!=="top"&&Kt||(he.backgroundColorRGB&&(ue=50331648,Z=he.backgroundColorRGB.rgba>>8&16777215,st=he.backgroundColorRGB),he.foregroundColorRGB&&(_e=50331648,ne=he.foregroundColorRGB.rgba>>8&16777215,ui=he.foregroundColorRGB),Kt=he.options.layer==="top")})),!Kt&&z&&(st=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,Z=st.rgba>>8&16777215,ue=50331648,Kt=!0,b.selectionForeground&&(_e=50331648,ne=b.selectionForeground.rgba>>8&16777215,ui=b.selectionForeground)),Kt&&q.push("xterm-decoration-top"),ue){case 16777216:case 33554432:rt=b.ansi[Z],q.push(`xterm-bg-${Z}`);break;case 50331648:rt=g.channels.toColor(Z>>16,Z>>8&255,255&Z),this._addStyle(E,`background-color:#${C((Z>>>0).toString(16),"0",6)}`);break;default:it?(rt=b.foreground,q.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):rt=b.background}switch(st||X.isDim()&&(st=g.color.multiplyOpacity(rt,.5)),_e){case 16777216:case 33554432:X.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(E,rt,b.ansi[ne],X,st,void 0)||q.push(`xterm-fg-${ne}`);break;case 50331648:let he=g.channels.toColor(ne>>16&255,ne>>8&255,255&ne);this._applyMinimumContrast(E,rt,he,X,st,ui)||this._addStyle(E,`color:#${C(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,rt,b.foreground,X,st,ui)||it&&q.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}q.length&&(E.className=q.join(" "),q.length=0),V||te||J?E.textContent=W:A++,F!==this.defaultSpacing&&(E.style.letterSpacing=`${F}px`),O.push(E),Q=re}return E&&A&&(E.textContent=W),O}_applyMinimumContrast(w,y,m,x,D,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,o.treatGlyphAsBackgroundColor)(x.getCode()))return!1;let H=this._getContrastCache(x),M;if(D||I||(M=H.getColor(y.rgba,m.rgba)),M===void 0){let N=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);M=g.color.ensureContrastRatio(D||y,I||m,N),H.setColor((D||y).rgba,(I||m).rgba,M??null)}return!!M&&(this._addStyle(w,`color:${M.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,y){w.setAttribute("style",`${w.getAttribute("style")||""}${y};`)}_isCellInSelection(w,y){let m=this._selectionStart,x=this._selectionEnd;return!(!m||!x)&&(this._columnSelectMode?m[0]<=x[0]?w>=m[0]&&y>=m[1]&&w<x[0]&&y<=x[1]:w<m[0]&&y>=m[1]&&w>=x[0]&&y<=x[1]:y>m[1]&&y<x[1]||m[1]===x[1]&&y===m[1]&&w>=m[0]&&w<x[0]||m[1]<x[1]&&y===x[1]&&w<x[0]||m[1]<x[1]&&y===m[1]&&w>=m[0])}};function C(w,y,m){for(;w.length<m;)w=y+w;return w}i.DomRendererRowFactory=v=l([_(1,a.ICharacterJoinerService),_(2,S.IOptionsService),_(3,a.ICoreBrowserService),_(4,S.ICoreService),_(5,S.IDecorationService),_(6,a.IThemeService)],v)},2550:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(r,l){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=r.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 _=r.createElement("span");_.classList.add("xterm-char-measure-element");let n=r.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let f=r.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontStyle="italic";let p=r.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[_,n,f,p],this._container.appendChild(_),this._container.appendChild(n),this._container.appendChild(f),this._container.appendChild(p),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(r,l,_,n){r===this._font&&l===this._fontSize&&_===this._weight&&n===this._weightBold||(this._font=r,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(r,l,_){let n=0;if(!l&&!_&&r.length===1&&(n=r.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let S=this._measure(r,0);return S>0&&(this._flat[n]=S),S}let f=r;l&&(f+="B"),_&&(f+="I");let p=this._holey.get(f);if(p===void 0){let S=0;l&&(S|=1),_&&(S|=2),p=this._measure(r,S),p>0&&this._holey.set(f,p)}return p}_measure(r,l){let _=this._measureElements[l];return _.textContent=r.repeat(32),_.offsetWidth/32}}},2223:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;let l=r(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(h,i)=>{function r(_){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=r,i.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},i.isEmoji=l,i.allowRescaling=function(_,n,f,p){return n===1&&f>Math.ceil(1.5*p)&&_!==void 0&&_>255&&!l(_)&&!r(_)&&!(function(S){return 57344<=S&&S<=63743})(_)},i.treatGlyphAsBackgroundColor=function(_){return r(_)||(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 r{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,p=!1){if(this.selectionStart=n,this.selectionEnd=f,!n||!f||n[0]===f[0]&&n[1]===f[1])return void this.clear();let S=_.buffers.active.ydisp,g=n[1]-S,a=f[1]-S,d=Math.max(g,0),o=Math.min(a,_.rows-1);d>=_.rows||o<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=g,this.viewportEndRow=a,this.viewportCappedStartRow=d,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 r}},456:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(r){this._bufferService=r,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 r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?r%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)-1]:[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[r,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[Math.max(r,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let r=this.selectionStart,l=this.selectionEnd;return!(!r||!l)&&(r[1]>l[1]||r[1]===l[1]&&r[0]>l[0])}handleTrim(r){return this.selectionStart&&(this.selectionStart[1]-=r),this.selectionEnd&&(this.selectionEnd[1]-=r),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,i,r){var l=this&&this.__decorate||function(o,u,v,C){var w,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--)(w=o[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(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=r(2585),f=r(8460),p=r(844),S=i.CharSizeService=class extends p.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 d(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=S=l([_(2,n.IOptionsService)],S);class g extends p.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 g{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 d extends g{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,r){var l=this&&this.__decorate||function(d,o,u,v){var C,w=arguments.length,y=w<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,o,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(o,u,y):C(o,u))||y);return w>3&&y&&Object.defineProperty(o,u,y),y},_=this&&this.__param||function(d,o){return function(u,v){o(u,v,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;let n=r(3734),f=r(643),p=r(511),S=r(2585);class g 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=g;let a=i.CharacterJoinerService=class vr{constructor(o){this._bufferService=o,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.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),w=0,y=0,m=0,x=u.getFg(0),D=u.getBg(0);for(let I=0;I<u.getTrimmedLength();I++)if(u.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==D){if(I-w>1){let H=this._getJoinedRanges(C,m,y,u,w);for(let M=0;M<H.length;M++)v.push(H[M])}w=I,m=y,x=this._workCell.fg,D=this._workCell.bg}y+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){let I=this._getJoinedRanges(C,m,y,u,w);for(let H=0;H<I.length;H++)v.push(I[H])}return v}_getJoinedRanges(o,u,v,C,w){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 D=this._characterJoiners[x].handler(y);for(let I=0;I<D.length;I++)vr._mergeRanges(m,D[I])}catch(D){console.error(D)}return this._stringRangesToCellRanges(m,C,w),m}_stringRangesToCellRanges(o,u,v){let C=0,w=!1,y=0,m=o[C];if(m){for(let x=v;x<this._bufferService.cols;x++){let D=u.getWidth(x),I=u.getString(x).length||f.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!w&&m[0]<=y&&(m[0]=x,w=!0),m[1]<=y){if(m[1]=x,m=o[++C],!m)break;m[0]<=y?(m[0]=x,w=!0):w=!1}y+=I}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(o,u){let v=!1;for(let C=0;C<o.length;C++){let w=o[C];if(v){if(u[1]<=w[0])return o[C-1][1]=u[1],o;if(u[1]<=w[1])return o[C-1][1]=Math.max(u[1],w[1]),o.splice(C,1),o;o.splice(C,1),C--}else{if(u[1]<=w[0])return o.splice(C,0,u),o;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),o;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),v=!0)}}return v?o[o.length-1][1]=u[1]:o.push(u),o}};i.CharacterJoinerService=a=l([_(0,S.IBufferService)],a)},5114:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;let l=r(844),_=r(8460),n=r(3656);class f extends l.Disposable{constructor(g,a,d){super(),this._textarea=g,this._window=a,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(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(g){this._window!==g&&(this._window=g,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 p extends l.Disposable{constructor(g){super(),this._parentWindow=g,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(g){this._parentWindow=g,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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;let l=r(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 p=this.linkProviders.indexOf(f);p!==-1&&this.linkProviders.splice(p,1)}}}}i.LinkProviderService=_},8934:function(h,i,r){var l=this&&this.__decorate||function(S,g,a,d){var o,u=arguments.length,v=u<3?g:d===null?d=Object.getOwnPropertyDescriptor(g,a):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(S,g,a,d);else for(var C=S.length-1;C>=0;C--)(o=S[C])&&(v=(u<3?o(v):u>3?o(g,a,v):o(g,a))||v);return u>3&&v&&Object.defineProperty(g,a,v),v},_=this&&this.__param||function(S,g){return function(a,d){g(a,d,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;let n=r(4725),f=r(9806),p=i.MouseService=class{constructor(S,g){this._renderService=S,this._charSizeService=g}getCoords(S,g,a,d,o){return(0,f.getCoords)(window,S,g,a,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(S,g){let a=(0,f.getCoordsRelativeToElement)(window,S,g);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=p=l([_(0,n.IRenderService),_(1,n.ICharSizeService)],p)},3230:function(h,i,r){var l=this&&this.__decorate||function(o,u,v,C){var w,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--)(w=o[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(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=r(6193),f=r(4725),p=r(8460),S=r(844),g=r(7226),a=r(2585),d=i.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(o,u,v,C,w,y,m,x){super(),this._rowCount=o,this._charSizeService=C,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new g.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 p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((D,I)=>this._renderRows(D,I)),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(w.onDecorationRegistered((()=>this._fullRefresh()))),this.register(w.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((D=>this._registerIntersectionObserver(D,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,S.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=d=l([_(2,a.IOptionsService),_(3,f.ICharSizeService),_(4,a.IDecorationService),_(5,a.IBufferService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],d)},9312:function(h,i,r){var l=this&&this.__decorate||function(m,x,D,I){var H,M=arguments.length,N=M<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,D):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(m,x,D,I);else for(var B=m.length-1;B>=0;B--)(H=m[B])&&(N=(M<3?H(N):M>3?H(x,D,N):H(x,D))||N);return M>3&&N&&Object.defineProperty(x,D,N),N},_=this&&this.__param||function(m,x){return function(D,I){x(D,I,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;let n=r(9806),f=r(9504),p=r(456),S=r(4725),g=r(8460),a=r(844),d=r(6114),o=r(4841),u=r(511),v=r(2585),C="\xA0",w=new RegExp(C,"g"),y=i.SelectionService=class extends a.Disposable{constructor(m,x,D,I,H,M,N,B,R){super(),this._element=m,this._screenElement=x,this._linkifier=D,this._bufferService=I,this._coreService=H,this._mouseService=M,this._optionsService=N,this._renderService=B,this._coreBrowserService=R,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 g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.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 p.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 D=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(m[0]===x[0])return"";let H=m[0]<x[0]?m[0]:x[0],M=m[0]<x[0]?x[0]:m[0];for(let N=m[1];N<=x[1];N++){let B=D.translateBufferLineToString(N,!0,H,M);I.push(B)}}else{let H=m[1]===x[1]?x[0]:void 0;I.push(D.translateBufferLineToString(m[1],!0,m[0],H));for(let M=m[1]+1;M<=x[1]-1;M++){let N=D.lines.get(M),B=D.translateBufferLineToString(M,!0);N?.isWrapped?I[I.length-1]+=B:I.push(B)}if(m[1]!==x[1]){let M=D.lines.get(x[1]),N=D.translateBufferLineToString(x[1],!0,0,x[0]);M&&M.isWrapped?I[I.length-1]+=N:I.push(N)}}return I.map((H=>H.replace(w," "))).join(d.isWindows?`\r
5
+ WARNING: This link could potentially be dangerous`)){let d=window.open();if(d){try{d.opener=null}catch{}d.location.href=l}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=p=h([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],p)},6193:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(r,h){this._renderCallback=r,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(r){return this._refreshCallbacks.push(r),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(r,h,f){this._rowCount=f,r=r!==void 0?r:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,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 r=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let r of this._refreshCallbacks)r(0);this._refreshCallbacks=[]}}},3236:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let h=r(3614),f=r(3656),n=r(3551),_=r(9042),p=r(3730),b=r(1680),g=r(3107),l=r(5744),d=r(2950),o=r(1296),u=r(428),v=r(4269),C=r(5114),w=r(8934),y=r(3230),m=r(9312),E=r(4725),P=r(6731),I=r(8055),N=r(8969),R=r(8460),U=r(844),D=r(6114),A=r(8437),T=r(2584),B=r(7399),S=r(5941),L=r(9074),k=r(2585),M=r(5435),F=r(4567),K=r(779);class G extends N.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(O={}){super(O),this.browser=D,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new U.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(L.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((x,H)=>this.refresh(x,H)))),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,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((x=>this._afterResize(x.cols,x.rows)))),this.register((0,U.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(O){if(this._themeService)for(let x of O){let H,j="";switch(x.index){case 256:H="foreground",j="10";break;case 257:H="background",j="11";break;case 258:H="cursor",j="12";break;default:H="ansi",j="4;"+x.index}switch(x.type){case 0:let $=I.color.toColorRGB(H==="ansi"?this._themeService.colors.ansi[x.index]:this._themeService.colors[H]);this.coreService.triggerDataEvent(`${T.C0.ESC}]${j};${(0,S.toRgbString)($)}${T.C1_ESCAPED.ST}`);break;case 1:if(H==="ansi")this._themeService.modifyColors((q=>q.ansi[x.index]=I.channels.toColor(...x.color)));else{let q=H;this._themeService.modifyColors((Y=>Y[q]=I.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(O){O?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(O){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.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(T.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 O=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(O);if(!x)return;let H=Math.min(this.buffer.x,this.cols-1),j=this._renderService.dimensions.css.cell.height,$=x.getWidth(H),q=this._renderService.dimensions.css.cell.width*$,Y=this.buffer.y*this._renderService.dimensions.css.cell.height,te=H*this._renderService.dimensions.css.cell.width;this.textarea.style.left=te+"px",this.textarea.style.top=Y+"px",this.textarea.style.width=q+"px",this.textarea.style.height=j+"px",this.textarea.style.lineHeight=j+"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 O=x=>(0,h.handlePasteEvent)(x,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",O)),this.register((0,f.addDisposableDomListener)(this.element,"paste",O)),D.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)}))),D.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",(O=>this._keyUp(O)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(O=>this._keyDown(O)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(O=>this._keyPress(O)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(O=>this._compositionHelper.compositionupdate(O)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(O=>this._inputEvent(O)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(O){if(!O)throw new Error("Terminal requires a parent element.");if(O.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=O.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"),O.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",(H=>this.updateCursorStyle(H)))),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),D.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,O.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(H=>this._handleTextAreaFocus(H)))),this.register((0,f.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(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(P.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((H=>this._onRender.fire(H)))),this.onResize((H=>this._renderService.resize(H.cols,H.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.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(b.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((H=>this.scrollLines(H.amount,H.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(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((H=>this.scrollLines(H.amount,H.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(g.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(H=>this._selectionService.handleMouseDown(H)))),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",(H=>this._handleScreenReaderModeOptionChange(H)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(l.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 O=this,x=this.element;function H(q){let Y=O._mouseService.getMouseReportCoords(q,O.screenElement);if(!Y)return!1;let te,Q;switch(q.overrideType||q.type){case"mousemove":Q=32,q.buttons===void 0?(te=3,q.button!==void 0&&(te=q.button<3?q.button:3)):te=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":Q=0,te=q.button<3?q.button:3;break;case"mousedown":Q=1,te=q.button<3?q.button:3;break;case"wheel":if(O._customWheelEventHandler&&O._customWheelEventHandler(q)===!1||O.viewport.getLinesScrolled(q)===0)return!1;Q=q.deltaY<0?0:1,te=4;break;default:return!1}return!(Q===void 0||te===void 0||te>4)&&O.coreMouseService.triggerMouseEvent({col:Y.col,row:Y.row,x:Y.x,y:Y.y,button:te,action:Q,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}let j={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:q=>(H(q),q.buttons||(this._document.removeEventListener("mouseup",j.mouseup),j.mousedrag&&this._document.removeEventListener("mousemove",j.mousedrag)),this.cancel(q)),wheel:q=>(H(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&H(q)},mousemove:q=>{q.buttons||H(q)}};this.register(this.coreMouseService.onProtocolChange((q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),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&q?j.mousemove||(x.addEventListener("mousemove",$.mousemove),j.mousemove=$.mousemove):(x.removeEventListener("mousemove",j.mousemove),j.mousemove=null),16&q?j.wheel||(x.addEventListener("wheel",$.wheel,{passive:!1}),j.wheel=$.wheel):(x.removeEventListener("wheel",j.wheel),j.wheel=null),2&q?j.mouseup||(j.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",j.mouseup),j.mouseup=null),4&q?j.mousedrag||(j.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",j.mousedrag),j.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(x,"mousedown",(q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return H(q),j.mouseup&&this._document.addEventListener("mouseup",j.mouseup),j.mousedrag&&this._document.addEventListener("mousemove",j.mousedrag),this.cancel(q)}))),this.register((0,f.addDisposableDomListener)(x,"wheel",(q=>{if(!j.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){let Y=this.viewport.getLinesScrolled(q);if(Y===0)return;let te=T.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B"),Q="";for(let ie=0;ie<Math.abs(Y);ie++)Q+=te;return this.coreService.triggerDataEvent(Q,!0),this.cancel(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(x,"touchstart",(q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(x,"touchmove",(q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)}),{passive:!1}))}refresh(O,x){this._renderService?.refreshRows(O,x)}updateCursorStyle(O){this._selectionService?.shouldColumnSelect(O)?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(O,x,H=0){H===1?(super.scrollLines(O,x,H),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(O)}paste(O){(0,h.paste)(O,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(O){this._customKeyEventHandler=O}attachCustomWheelEventHandler(O){this._customWheelEventHandler=O}registerLinkProvider(O){return this._linkProviderService.registerLinkProvider(O)}registerCharacterJoiner(O){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let x=this._characterJoinerService.register(O);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(O){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(O)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(O){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+O)}registerDecoration(O){return this._decorationService.registerDecoration(O)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(O,x,H){this._selectionService.setSelection(O,x,H)}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(O,x){this._selectionService?.selectLines(O,x)}_keyDown(O){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1)return!1;let x=this.browser.isMac&&this.options.macOptionIsMeta&&O.altKey;if(!x&&!this._compositionHelper.keydown(O))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;x||O.key!=="Dead"&&O.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let H=(0,B.evaluateKeyboardEvent)(O,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(O),H.type===3||H.type===2){let j=this.rows-1;return this.scrollLines(H.type===2?-j:j),this.cancel(O,!0)}return H.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,O)||(H.cancel&&this.cancel(O,!0),!H.key||!!(O.key&&!O.ctrlKey&&!O.altKey&&!O.metaKey&&O.key.length===1&&O.key.charCodeAt(0)>=65&&O.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(H.key!==T.C0.ETX&&H.key!==T.C0.CR||(this.textarea.value=""),this._onKey.fire({key:H.key,domEvent:O}),this._showCursor(),this.coreService.triggerDataEvent(H.key,!0),!this.optionsService.rawOptions.screenReaderMode||O.altKey||O.ctrlKey?this.cancel(O,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(O,x){let H=O.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||O.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||O.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?H:H&&(!x.keyCode||x.keyCode>47)}_keyUp(O){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1||((function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18})(O)||this.focus(),this.updateCursorStyle(O),this._keyPressHandled=!1)}_keyPress(O){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1)return!1;if(this.cancel(O),O.charCode)x=O.charCode;else if(O.which===null||O.which===void 0)x=O.keyCode;else{if(O.which===0||O.charCode===0)return!1;x=O.which}return!(!x||(O.altKey||O.ctrlKey||O.metaKey)&&!this._isThirdLevelShift(this.browser,O)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:O}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(O){if(O.data&&O.inputType==="insertText"&&(!O.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let x=O.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(O),!0}return!1}resize(O,x){O!==this.cols||x!==this.rows?super.resize(O,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(O,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 O=1;O<this.rows;O++)this.buffer.lines.push(this.buffer.getBlankLine(A.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 O=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=O,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(T.C0.ESC+"[I"):this.coreService.triggerDataEvent(T.C0.ESC+"[O")}_reportWindowsOptions(O){if(this._renderService)switch(O){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let x=this._renderService.dimensions.css.canvas.width.toFixed(0),H=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[4;${H};${x}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let j=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[6;${$};${j}t`)}}cancel(O,x){if(this.options.cancelEvents||x)return O.preventDefault(),O.stopPropagation(),!1}}s.Terminal=G},9924:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(r,h=1e3){this._renderCallback=r,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(r,h,f){this._rowCount=f,r=r!==void 0?r:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=n-this._lastRefreshMs,p=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let r=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,h)}}},1680:function(c,s,r){var h=this&&this.__decorate||function(d,o,u,v){var C,w=arguments.length,y=w<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,o,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(o,u,y):C(o,u))||y);return w>3&&y&&Object.defineProperty(o,u,y),y},f=this&&this.__param||function(d,o){return function(u,v){o(u,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let n=r(3656),_=r(4725),p=r(8460),b=r(844),g=r(2585),l=s.Viewport=class extends b.Disposable{constructor(d,o,u,v,C,w,y,m){super(),this._viewportElement=d,this._scrollArea=o,this._bufferService=u,this._optionsService=v,this._charSizeService=C,this._renderService=w,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 p.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((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(m.colors),this.register(m.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(d){this._viewportElement.style.backgroundColor=d.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(d){if(d)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 d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){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 d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<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(d,o){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(o<0&&this._viewportElement.scrollTop!==0||o>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let o=this._getPixelsScrolled(d);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(d,o))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let o=d*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:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let o=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?o*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._currentRowHeight*this._bufferService.rows),o}getBufferElements(d,o){let u,v="",C=[],w=o??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<w;m++){let E=y.get(m);if(!E)continue;let P=y.get(m+1)?.isWrapped;if(v+=E.translateToString(!P),!P||m===y.length-1){let I=document.createElement("div");I.textContent=v,C.push(I),v.length>0&&(u=I),v=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let o=this._applyScrollModifier(d.deltaY,d);return d.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):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(d,o){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&o.altKey||u==="ctrl"&&o.ctrlKey||u==="shift"&&o.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){let o=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,o!==0&&(this._viewportElement.scrollTop+=o,this._bubbleScroll(d,o))}};s.Viewport=l=h([f(2,g.IBufferService),f(3,g.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],l)},3107:function(c,s,r){var h=this&&this.__decorate||function(g,l,d,o){var u,v=arguments.length,C=v<3?l:o===null?o=Object.getOwnPropertyDescriptor(l,d):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,l,d,o);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(C=(v<3?u(C):v>3?u(l,d,C):u(l,d))||C);return v>3&&C&&Object.defineProperty(l,d,C),C},f=this&&this.__param||function(g,l){return function(d,o){l(d,o,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let n=r(4725),_=r(844),p=r(2585),b=s.BufferDecorationRenderer=class extends _.Disposable{constructor(g,l,d,o,u){super(),this._screenElement=g,this._bufferService=l,this._coreBrowserService=d,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,_.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 g of this._decorationService.decorations)this._renderDecoration(g);this._dimensionsChanged=!1}_renderDecoration(g){this._refreshStyle(g),this._dimensionsChanged&&this._refreshXPosition(g)}_createElement(g){let l=this._coreBrowserService.mainDocument.createElement("div");l.classList.add("xterm-decoration"),l.classList.toggle("xterm-decoration-top-layer",g?.options?.layer==="top"),l.style.width=`${Math.round((g.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,l.style.height=(g.options.height||1)*this._renderService.dimensions.css.cell.height+"px",l.style.top=(g.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",l.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let d=g.options.x??0;return d&&d>this._bufferService.cols&&(l.style.display="none"),this._refreshXPosition(g,l),l}_refreshStyle(g){let l=g.marker.line-this._bufferService.buffers.active.ydisp;if(l<0||l>=this._bufferService.rows)g.element&&(g.element.style.display="none",g.onRenderEmitter.fire(g.element));else{let d=this._decorationElements.get(g);d||(d=this._createElement(g),g.element=d,this._decorationElements.set(g,d),this._container.appendChild(d),g.onDispose((()=>{this._decorationElements.delete(g),d.remove()}))),d.style.top=l*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",g.onRenderEmitter.fire(d)}}_refreshXPosition(g,l=g.element){if(!l)return;let d=g.options.x??0;(g.options.anchor||"left")==="right"?l.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":l.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(g){this._decorationElements.get(g)?.remove(),this._decorationElements.delete(g),g.dispose()}};s.BufferDecorationRenderer=b=h([f(1,p.IBufferService),f(2,n.ICoreBrowserService),f(3,p.IDecorationService),f(4,n.IRenderService)],b)},5871:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.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(r){if(r.options.overviewRulerOptions){for(let h of this._zones)if(h.color===r.options.overviewRulerOptions.color&&h.position===r.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,r.marker.line))return;if(this._lineAdjacentToZone(h,r.marker.line,r.options.overviewRulerOptions.position))return void this._addLineToZone(h,r.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=r.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=r.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=r.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=r.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:r.options.overviewRulerOptions.color,position:r.options.overviewRulerOptions.position,startBufferLine:r.marker.line,endBufferLine:r.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(r){this._linePadding=r}_lineIntersectsZone(r,h){return h>=r.startBufferLine&&h<=r.endBufferLine}_lineAdjacentToZone(r,h,f){return h>=r.startBufferLine-this._linePadding[f||"full"]&&h<=r.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(r,h){r.startBufferLine=Math.min(r.startBufferLine,h),r.endBufferLine=Math.max(r.endBufferLine,h)}}},5744:function(c,s,r){var h=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,E=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,C,w);else for(var P=u.length-1;P>=0;P--)(y=u[P])&&(E=(m<3?y(E):m>3?y(v,C,E):y(v,C))||E);return m>3&&E&&Object.defineProperty(v,C,E),E},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let n=r(5871),_=r(4725),p=r(844),b=r(2585),g={full:0,left:0,center:0,right:0},l={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},o=s.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,v,C,w,y,m,E){super(),this._viewportElement=u,this._screenElement=v,this._bufferService=C,this._decorationService=w,this._renderService=y,this._optionsService=m,this._coreBrowserService=E,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 P=this._canvas.getContext("2d");if(!P)throw new Error("Ctx cannot be null");this._ctx=P,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.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);l.full=this._canvas.width,l.left=u,l.center=v,l.right=u,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=l.left,d.right=l.left+l.center}_refreshDrawHeightConstants(){g.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);g.left=v,g.center=v,g.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.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(d[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-g[u.position||"full"]/2),l[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+g[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})))}};s.OverviewRulerRenderer=o=h([f(2,b.IBufferService),f(3,b.IDecorationService),f(4,_.IRenderService),f(5,b.IOptionsService),f(6,_.ICoreBrowserService)],o)},2950:function(c,s,r){var h=this&&this.__decorate||function(g,l,d,o){var u,v=arguments.length,C=v<3?l:o===null?o=Object.getOwnPropertyDescriptor(l,d):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,l,d,o);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(C=(v<3?u(C):v>3?u(l,d,C):u(l,d))||C);return v>3&&C&&Object.defineProperty(l,d,C),C},f=this&&this.__param||function(g,l){return function(d,o){l(d,o,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let n=r(4725),_=r(2585),p=r(2584),b=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,l,d,o,u,v){this._textarea=g,this._compositionView=l,this._bufferService=d,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(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){let l={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,l.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(l.start,l.end):this._textarea.value.substring(l.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;let l=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(l,!0)}}_handleAnyTextareaChanges(){let g=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let l=this._textarea.value,d=l.replace(g,"");this._dataAlreadySent=d,l.length>g.length?this._coreService.triggerDataEvent(d,!0):l.length<g.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):l.length===g.length&&l!==g&&this._coreService.triggerDataEvent(l,!0)}}),0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let l=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,o=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=l*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=o+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"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"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=b=h([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,n.IRenderService)],b)},9806:(c,s)=>{function r(h,f,n){let _=n.getBoundingClientRect(),p=h.getComputedStyle(n),b=parseInt(p.getPropertyValue("padding-left")),g=parseInt(p.getPropertyValue("padding-top"));return[f.clientX-_.left-b,f.clientY-_.top-g]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=r,s.getCoords=function(h,f,n,_,p,b,g,l,d){if(!b)return;let o=r(h,f,n);return o?(o[0]=Math.ceil((o[0]+(d?g/2:0))/g),o[1]=Math.ceil(o[1]/l),o[0]=Math.min(Math.max(o[0],1),_+(d?1:0)),o[1]=Math.min(Math.max(o[1],1),p),o):void 0}},9504:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let h=r(2584);function f(l,d,o,u){let v=l-n(l,o),C=d-n(d,o),w=Math.abs(v-C)-(function(y,m,E){let P=0,I=y-n(y,E),N=m-n(m,E);for(let R=0;R<Math.abs(I-N);R++){let U=_(y,m)==="A"?-1:1;E.buffer.lines.get(I+U*R)?.isWrapped&&P++}return P})(l,d,o);return g(w,b(_(l,d),u))}function n(l,d){let o=0,u=d.buffer.lines.get(l),v=u?.isWrapped;for(;v&&l>=0&&l<d.rows;)o++,u=d.buffer.lines.get(--l),v=u?.isWrapped;return o}function _(l,d){return l>d?"A":"B"}function p(l,d,o,u,v,C){let w=l,y=d,m="";for(;w!==o||y!==u;)w+=v?1:-1,v&&w>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,l,w),w=0,l=0,y++):!v&&w<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,l+1),w=C.cols-1,l=w,y--);return m+C.buffer.translateBufferLineToString(y,!1,l,w)}function b(l,d){let o=d?"O":"[";return h.C0.ESC+o+l}function g(l,d){l=Math.floor(l);let o="";for(let u=0;u<l;u++)o+=d;return o}s.moveToCellSequence=function(l,d,o,u){let v=o.buffer.x,C=o.buffer.y;if(!o.buffer.hasScrollback)return(function(m,E,P,I,N,R){return f(E,I,N,R).length===0?"":g(p(m,E,m,E-n(E,N),!1,N).length,b("D",R))})(v,C,0,d,o,u)+f(C,d,o,u)+(function(m,E,P,I,N,R){let U;U=f(E,I,N,R).length>0?I-n(I,N):E;let D=I,A=(function(T,B,S,L,k,M){let F;return F=f(S,L,k,M).length>0?L-n(L,k):B,T<S&&F<=L||T>=S&&F<L?"C":"D"})(m,E,P,I,N,R);return g(p(m,U,P,D,A==="C",N).length,b(A,R))})(v,C,l,d,o,u);let w;if(C===d)return w=v>l?"D":"C",g(Math.abs(v-l),b(w,u));w=C>d?"D":"C";let y=Math.abs(C-d);return g((function(m,E){return E.cols-m})(C>d?l:v,o)+(y-1)*o.cols+1+((C>d?v:l)-1),b(w,u))}},1296:function(c,s,r){var h=this&&this.__decorate||function(R,U,D,A){var T,B=arguments.length,S=B<3?U:A===null?A=Object.getOwnPropertyDescriptor(U,D):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(R,U,D,A);else for(var L=R.length-1;L>=0;L--)(T=R[L])&&(S=(B<3?T(S):B>3?T(U,D,S):T(U,D))||S);return B>3&&S&&Object.defineProperty(U,D,S),S},f=this&&this.__param||function(R,U){return function(D,A){U(D,A,R)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let n=r(3787),_=r(2550),p=r(2223),b=r(6171),g=r(6052),l=r(4725),d=r(8055),o=r(8460),u=r(844),v=r(2585),C="xterm-dom-renderer-owner-",w="xterm-rows",y="xterm-fg-",m="xterm-bg-",E="xterm-focus",P="xterm-selection",I=1,N=s.DomRenderer=class extends u.Disposable{constructor(R,U,D,A,T,B,S,L,k,M,F,K,G){super(),this._terminal=R,this._document=U,this._element=D,this._screenElement=A,this._viewportElement=T,this._helperContainer=B,this._linkifier2=S,this._charSizeService=k,this._optionsService=M,this._bufferService=F,this._coreBrowserService=K,this._themeService=G,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,g.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new o.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(w),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(P),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((W=>this._injectCss(W)))),this._injectCss(this._themeService.colors),this._rowFactory=L.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((W=>this._handleLinkHover(W)))),this.register(this._linkifier2.onHideLinkUnderline((W=>this._handleLinkLeave(W)))),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 _.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 D of this._rowElements)D.style.width=`${this.dimensions.css.canvas.width}px`,D.style.height=`${this.dimensions.css.cell.height}px`,D.style.lineHeight=`${this.dimensions.css.cell.height}px`,D.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let U=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=U,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 U=`${this._terminalSelector} .${w} { color: ${R.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;U+=`${this._terminalSelector} .${w} .xterm-dim { color: ${d.color.multiplyOpacity(R.foreground,.5).css};}`,U+=`${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 D=`blink_underline_${this._terminalClass}`,A=`blink_bar_${this._terminalClass}`,T=`blink_block_${this._terminalClass}`;U+=`@keyframes ${D} { 50% { border-bottom-style: hidden; }}`,U+=`@keyframes ${A} { 50% { box-shadow: none; }}`,U+=`@keyframes ${T} { 0% { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css}; } 50% { background-color: inherit; color: ${R.cursor.css}; }}`,U+=`${this._terminalSelector} .${w}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${D} 1s step-end infinite;}${this._terminalSelector} .${w}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${A} 1s step-end infinite;}${this._terminalSelector} .${w}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${T} 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${R.cursor.css} !important; color: ${R.cursorAccent.css} !important;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${R.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${R.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${R.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,U+=`${this._terminalSelector} .${P} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${P} div { position: absolute; background-color: ${R.selectionBackgroundOpaque.css};}${this._terminalSelector} .${P} div { position: absolute; background-color: ${R.selectionInactiveBackgroundOpaque.css};}`;for(let[B,S]of R.ansi.entries())U+=`${this._terminalSelector} .${y}${B} { color: ${S.css}; }${this._terminalSelector} .${y}${B}.xterm-dim { color: ${d.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${m}${B} { background-color: ${S.css}; }`;U+=`${this._terminalSelector} .${y}${p.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(R.background).css}; }${this._terminalSelector} .${y}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(R.background),.5).css}; }${this._terminalSelector} .${m}${p.INVERTED_DEFAULT_COLOR} { background-color: ${R.foreground.css}; }`,this._themeStyleElement.textContent=U}_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,U){for(let D=this._rowElements.length;D<=U;D++){let A=this._document.createElement("div");this._rowContainer.appendChild(A),this._rowElements.push(A)}for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(R,U){this._refreshRowElements(R,U),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(R,U,D){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(R,U,D),this.renderRows(0,this._bufferService.rows-1),!R||!U)return;this._selectionRenderModel.update(this._terminal,R,U,D);let A=this._selectionRenderModel.viewportStartRow,T=this._selectionRenderModel.viewportEndRow,B=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if(B>=this._bufferService.rows||S<0)return;let L=this._document.createDocumentFragment();if(D){let k=R[0]>U[0];L.appendChild(this._createSelectionElement(B,k?U[0]:R[0],k?R[0]:U[0],S-B+1))}else{let k=A===B?R[0]:0,M=B===T?U[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(B,k,M));let F=S-B-1;if(L.appendChild(this._createSelectionElement(B+1,0,this._bufferService.cols,F)),B!==S){let K=T===S?U[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(S,0,K))}}this._selectionContainer.appendChild(L)}_createSelectionElement(R,U,D,A=1){let T=this._document.createElement("div"),B=U*this.dimensions.css.cell.width,S=this.dimensions.css.cell.width*(D-U);return B+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-B),T.style.height=A*this.dimensions.css.cell.height+"px",T.style.top=R*this.dimensions.css.cell.height+"px",T.style.left=`${B}px`,T.style.width=`${S}px`,T}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,U){let D=this._bufferService.buffer,A=D.ybase+D.y,T=Math.min(D.x,this._bufferService.cols-1),B=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=R;k<=U;k++){let M=k+D.ydisp,F=this._rowElements[k],K=D.lines.get(M);if(!F||!K)break;F.replaceChildren(...this._rowFactory.createRow(K,M,M===A,S,L,T,B,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,U,D,A,T,B){D<0&&(R=0),A<0&&(U=0);let S=this._bufferService.rows-1;D=Math.max(Math.min(D,S),0),A=Math.max(Math.min(A,S),0),T=Math.min(T,this._bufferService.cols);let L=this._bufferService.buffer,k=L.ybase+L.y,M=Math.min(L.x,T-1),F=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,G=this._optionsService.rawOptions.cursorInactiveStyle;for(let W=D;W<=A;++W){let O=W+L.ydisp,x=this._rowElements[W],H=L.lines.get(O);if(!x||!H)break;x.replaceChildren(...this._rowFactory.createRow(H,O,O===k,K,G,M,F,this.dimensions.css.cell.width,this._widthCache,B?W===D?R:0:-1,B?(W===A?U:T)-1:-1))}}};s.DomRenderer=N=h([f(7,v.IInstantiationService),f(8,l.ICharSizeService),f(9,v.IOptionsService),f(10,v.IBufferService),f(11,l.ICoreBrowserService),f(12,l.IThemeService)],N)},3787:function(c,s,r){var h=this&&this.__decorate||function(w,y,m,E){var P,I=arguments.length,N=I<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,m):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(w,y,m,E);else for(var R=w.length-1;R>=0;R--)(P=w[R])&&(N=(I<3?P(N):I>3?P(y,m,N):P(y,m))||N);return I>3&&N&&Object.defineProperty(y,m,N),N},f=this&&this.__param||function(w,y){return function(m,E){y(m,E,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let n=r(2223),_=r(643),p=r(511),b=r(2585),g=r(8055),l=r(4725),d=r(4269),o=r(6171),u=r(3734),v=s.DomRendererRowFactory=class{constructor(w,y,m,E,P,I,N){this._document=w,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=E,this._coreService=P,this._decorationService=I,this._themeService=N,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,y,m){this._selectionStart=w,this._selectionEnd=y,this._columnSelectMode=m}createRow(w,y,m,E,P,I,N,R,U,D,A){let T=[],B=this._characterJoinerService.getJoinedCharacters(y),S=this._themeService.colors,L,k=w.getNoBgTrimmedLength();m&&k<I+1&&(k=I+1);let M=0,F="",K=0,G=0,W=0,O=!1,x=0,H=!1,j=0,$=[],q=D!==-1&&A!==-1;for(let Y=0;Y<k;Y++){w.loadCell(Y,this._workCell);let te=this._workCell.getWidth();if(te===0)continue;let Q=!1,ie=Y,Z=this._workCell;if(B.length>0&&Y===B[0][0]){Q=!0;let ce=B.shift();Z=new d.JoinedCellData(this._workCell,w.translateToString(!0,ce[0],ce[1]),ce[1]-ce[0]),ie=ce[1]-1,te=Z.getWidth()}let fe=this._isCellInSelection(Y,y),Te=m&&Y===I,Be=q&&Y>=D&&Y<=A,He=!1;this._decorationService.forEachDecorationAtCell(Y,y,void 0,(ce=>{He=!0}));let z=Z.getChars()||_.WHITESPACE_CELL_CHAR;if(z===" "&&(Z.isUnderline()||Z.isOverline())&&(z="\xA0"),j=te*R-U.get(z,Z.isBold(),Z.isItalic()),L){if(M&&(fe&&H||!fe&&!H&&Z.bg===K)&&(fe&&H&&S.selectionForeground||Z.fg===G)&&Z.extended.ext===W&&Be===O&&j===x&&!Te&&!Q&&!He){Z.isInvisible()?F+=_.WHITESPACE_CELL_CHAR:F+=z,M++;continue}M&&(L.textContent=F),L=this._document.createElement("span"),M=0,F=""}else L=this._document.createElement("span");if(K=Z.bg,G=Z.fg,W=Z.extended.ext,O=Be,x=j,H=fe,Q&&I>=Y&&I<=ie&&(I=Y),!this._coreService.isCursorHidden&&Te&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)N&&$.push("xterm-cursor-blink"),$.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(P)switch(P){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(Z.isBold()&&$.push("xterm-bold"),Z.isItalic()&&$.push("xterm-italic"),Z.isDim()&&$.push("xterm-dim"),F=Z.isInvisible()?_.WHITESPACE_CELL_CHAR:Z.getChars()||_.WHITESPACE_CELL_CHAR,Z.isUnderline()&&($.push(`xterm-underline-${Z.extended.underlineStyle}`),F===" "&&(F="\xA0"),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ce=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ce<8&&(ce+=8),L.style.textDecorationColor=S.ansi[ce].css}Z.isOverline()&&($.push("xterm-overline"),F===" "&&(F="\xA0")),Z.isStrikethrough()&&$.push("xterm-strikethrough"),Be&&(L.style.textDecoration="underline");let V=Z.getFgColor(),X=Z.getFgColorMode(),J=Z.getBgColor(),ne=Z.getBgColorMode(),de=!!Z.isInverse();if(de){let ce=V;V=J,J=ce;let Go=X;X=ne,ne=Go}let ae,ee,he,$e=!1;switch(this._decorationService.forEachDecorationAtCell(Y,y,void 0,(ce=>{ce.options.layer!=="top"&&$e||(ce.backgroundColorRGB&&(ne=50331648,J=ce.backgroundColorRGB.rgba>>8&16777215,ae=ce.backgroundColorRGB),ce.foregroundColorRGB&&(X=50331648,V=ce.foregroundColorRGB.rgba>>8&16777215,ee=ce.foregroundColorRGB),$e=ce.options.layer==="top")})),!$e&&fe&&(ae=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,J=ae.rgba>>8&16777215,ne=50331648,$e=!0,S.selectionForeground&&(X=50331648,V=S.selectionForeground.rgba>>8&16777215,ee=S.selectionForeground)),$e&&$.push("xterm-decoration-top"),ne){case 16777216:case 33554432:he=S.ansi[J],$.push(`xterm-bg-${J}`);break;case 50331648:he=g.channels.toColor(J>>16,J>>8&255,255&J),this._addStyle(L,`background-color:#${C((J>>>0).toString(16),"0",6)}`);break;default:de?(he=S.foreground,$.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):he=S.background}switch(ae||Z.isDim()&&(ae=g.color.multiplyOpacity(he,.5)),X){case 16777216:case 33554432:Z.isBold()&&V<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(V+=8),this._applyMinimumContrast(L,he,S.ansi[V],Z,ae,void 0)||$.push(`xterm-fg-${V}`);break;case 50331648:let ce=g.channels.toColor(V>>16&255,V>>8&255,255&V);this._applyMinimumContrast(L,he,ce,Z,ae,ee)||this._addStyle(L,`color:#${C(V.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,he,S.foreground,Z,ae,ee)||de&&$.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}$.length&&(L.className=$.join(" "),$.length=0),Te||Q||He?L.textContent=F:M++,j!==this.defaultSpacing&&(L.style.letterSpacing=`${j}px`),T.push(L),Y=ie}return L&&M&&(L.textContent=F),T}_applyMinimumContrast(w,y,m,E,P,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,o.treatGlyphAsBackgroundColor)(E.getCode()))return!1;let N=this._getContrastCache(E),R;if(P||I||(R=N.getColor(y.rgba,m.rgba)),R===void 0){let U=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);R=g.color.ensureContrastRatio(P||y,I||m,U),N.setColor((P||y).rgba,(I||m).rgba,R??null)}return!!R&&(this._addStyle(w,`color:${R.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,y){w.setAttribute("style",`${w.getAttribute("style")||""}${y};`)}_isCellInSelection(w,y){let m=this._selectionStart,E=this._selectionEnd;return!(!m||!E)&&(this._columnSelectMode?m[0]<=E[0]?w>=m[0]&&y>=m[1]&&w<E[0]&&y<=E[1]:w<m[0]&&y>=m[1]&&w>=E[0]&&y<=E[1]:y>m[1]&&y<E[1]||m[1]===E[1]&&y===m[1]&&w>=m[0]&&w<E[0]||m[1]<E[1]&&y===E[1]&&w<E[0]||m[1]<E[1]&&y===m[1]&&w>=m[0])}};function C(w,y,m){for(;w.length<m;)w=y+w;return w}s.DomRendererRowFactory=v=h([f(1,l.ICharacterJoinerService),f(2,b.IOptionsService),f(3,l.ICoreBrowserService),f(4,b.ICoreService),f(5,b.IDecorationService),f(6,l.IThemeService)],v)},2550:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(r,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=r.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=r.createElement("span");f.classList.add("xterm-char-measure-element");let n=r.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let _=r.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let p=r.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[f,n,_,p],this._container.appendChild(f),this._container.appendChild(n),this._container.appendChild(_),this._container.appendChild(p),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(r,h,f,n){r===this._font&&h===this._fontSize&&f===this._weight&&n===this._weightBold||(this._font=r,this._fontSize=h,this._weight=f,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(r,h,f){let n=0;if(!h&&!f&&r.length===1&&(n=r.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let b=this._measure(r,0);return b>0&&(this._flat[n]=b),b}let _=r;h&&(_+="B"),f&&(_+="I");let p=this._holey.get(_);if(p===void 0){let b=0;h&&(b|=1),f&&(b|=2),p=this._measure(r,b),p>0&&this._holey.set(_,p)}return p}_measure(r,h){let f=this._measureElements[h];return f.textContent=r.repeat(32),f.offsetWidth/32}}},2223:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let h=r(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(c,s)=>{function r(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(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},s.isPowerlineGlyph=r,s.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},s.isEmoji=h,s.allowRescaling=function(f,n,_,p){return n===1&&_>Math.ceil(1.5*p)&&f!==void 0&&f>255&&!h(f)&&!r(f)&&!(function(b){return 57344<=b&&b<=63743})(f)},s.treatGlyphAsBackgroundColor=function(f){return r(f)||(function(n){return 9472<=n&&n<=9631})(f)},s.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}}}},s.computeNextVariantOffset=function(f,n,_=0){return(f-(2*Math.round(n)-_))%(2*Math.round(n))}},6052:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class r{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,n,_,p=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();let b=f.buffers.active.ydisp,g=n[1]-b,l=_[1]-b,d=Math.max(g,0),o=Math.min(l,f.rows-1);d>=f.rows||o<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=g,this.viewportEndRow=l,this.viewportCappedStartRow=d,this.viewportCappedEndRow=o,this.startCol=n[0],this.endCol=_[0])}isCellSelected(f,n,_){return!!this.hasSelection&&(_-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}s.createSelectionRenderModel=function(){return new r}},456:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(r){this._bufferService=r,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 r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?r%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)-1]:[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[r,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[Math.max(r,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let r=this.selectionStart,h=this.selectionEnd;return!(!r||!h)&&(r[1]>h[1]||r[1]===h[1]&&r[0]>h[0])}handleTrim(r){return this.selectionStart&&(this.selectionStart[1]-=r),this.selectionEnd&&(this.selectionEnd[1]-=r),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,s,r){var h=this&&this.__decorate||function(o,u,v,C){var w,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 E=o.length-1;E>=0;E--)(w=o[E])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let n=r(2585),_=r(8460),p=r(844),b=s.CharSizeService=class extends p.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 _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new l(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())}};s.CharSizeService=b=h([f(2,n.IOptionsService)],b);class g extends p.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 l extends g{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 d extends g{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(c,s,r){var h=this&&this.__decorate||function(d,o,u,v){var C,w=arguments.length,y=w<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,o,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(o,u,y):C(o,u))||y);return w>3&&y&&Object.defineProperty(o,u,y),y},f=this&&this.__param||function(d,o){return function(u,v){o(u,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let n=r(3734),_=r(643),p=r(511),b=r(2585);class g 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()]}}s.JoinedCellData=g;let l=s.CharacterJoinerService=class wr{constructor(o){this._bufferService=o,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.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),w=0,y=0,m=0,E=u.getFg(0),P=u.getBg(0);for(let I=0;I<u.getTrimmedLength();I++)if(u.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==P){if(I-w>1){let N=this._getJoinedRanges(C,m,y,u,w);for(let R=0;R<N.length;R++)v.push(N[R])}w=I,m=y,E=this._workCell.fg,P=this._workCell.bg}y+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){let I=this._getJoinedRanges(C,m,y,u,w);for(let N=0;N<I.length;N++)v.push(I[N])}return v}_getJoinedRanges(o,u,v,C,w){let y=o.substring(u,v),m=[];try{m=this._characterJoiners[0].handler(y)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{let P=this._characterJoiners[E].handler(y);for(let I=0;I<P.length;I++)wr._mergeRanges(m,P[I])}catch(P){console.error(P)}return this._stringRangesToCellRanges(m,C,w),m}_stringRangesToCellRanges(o,u,v){let C=0,w=!1,y=0,m=o[C];if(m){for(let E=v;E<this._bufferService.cols;E++){let P=u.getWidth(E),I=u.getString(E).length||_.WHITESPACE_CELL_CHAR.length;if(P!==0){if(!w&&m[0]<=y&&(m[0]=E,w=!0),m[1]<=y){if(m[1]=E,m=o[++C],!m)break;m[0]<=y?(m[0]=E,w=!0):w=!1}y+=I}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(o,u){let v=!1;for(let C=0;C<o.length;C++){let w=o[C];if(v){if(u[1]<=w[0])return o[C-1][1]=u[1],o;if(u[1]<=w[1])return o[C-1][1]=Math.max(u[1],w[1]),o.splice(C,1),o;o.splice(C,1),C--}else{if(u[1]<=w[0])return o.splice(C,0,u),o;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),o;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),v=!0)}}return v?o[o.length-1][1]=u[1]:o.push(u),o}};s.CharacterJoinerService=l=h([f(0,b.IBufferService)],l)},5114:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let h=r(844),f=r(8460),n=r(3656);class _ extends h.Disposable{constructor(g,l,d){super(),this._textarea=g,this._window=l,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(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((o=>this._screenDprMonitor.setWindow(o)))),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(g){this._window!==g&&(this._window=g,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}}s.CoreBrowserService=_;class p extends h.Disposable{constructor(g){super(),this._parentWindow=g,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(g){this._parentWindow=g,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:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let h=r(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 p=this.linkProviders.indexOf(_);p!==-1&&this.linkProviders.splice(p,1)}}}}s.LinkProviderService=f},8934:function(c,s,r){var h=this&&this.__decorate||function(b,g,l,d){var o,u=arguments.length,v=u<3?g:d===null?d=Object.getOwnPropertyDescriptor(g,l):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(b,g,l,d);else for(var C=b.length-1;C>=0;C--)(o=b[C])&&(v=(u<3?o(v):u>3?o(g,l,v):o(g,l))||v);return u>3&&v&&Object.defineProperty(g,l,v),v},f=this&&this.__param||function(b,g){return function(l,d){g(l,d,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let n=r(4725),_=r(9806),p=s.MouseService=class{constructor(b,g){this._renderService=b,this._charSizeService=g}getCoords(b,g,l,d,o){return(0,_.getCoords)(window,b,g,l,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(b,g){let l=(0,_.getCoordsRelativeToElement)(window,b,g);if(this._charSizeService.hasValidSize)return l[0]=Math.min(Math.max(l[0],0),this._renderService.dimensions.css.canvas.width-1),l[1]=Math.min(Math.max(l[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(l[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(l[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(l[0]),y:Math.floor(l[1])}}};s.MouseService=p=h([f(0,n.IRenderService),f(1,n.ICharSizeService)],p)},3230:function(c,s,r){var h=this&&this.__decorate||function(o,u,v,C){var w,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 E=o.length-1;E>=0;E--)(w=o[E])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let n=r(6193),_=r(4725),p=r(8460),b=r(844),g=r(7226),l=r(2585),d=s.RenderService=class extends b.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(o,u,v,C,w,y,m,E){super(),this._rowCount=o,this._charSizeService=C,this._renderer=this.register(new b.MutableDisposable),this._pausedResizeTask=new g.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 p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((P,I)=>this._renderRows(P,I)),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(w.onDecorationRegistered((()=>this._fullRefresh()))),this.register(w.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(E.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange((P=>this._registerIntersectionObserver(P,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()}};s.RenderService=d=h([f(2,l.IOptionsService),f(3,_.ICharSizeService),f(4,l.IDecorationService),f(5,l.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],d)},9312:function(c,s,r){var h=this&&this.__decorate||function(m,E,P,I){var N,R=arguments.length,U=R<3?E:I===null?I=Object.getOwnPropertyDescriptor(E,P):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(m,E,P,I);else for(var D=m.length-1;D>=0;D--)(N=m[D])&&(U=(R<3?N(U):R>3?N(E,P,U):N(E,P))||U);return R>3&&U&&Object.defineProperty(E,P,U),U},f=this&&this.__param||function(m,E){return function(P,I){E(P,I,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let n=r(9806),_=r(9504),p=r(456),b=r(4725),g=r(8460),l=r(844),d=r(6114),o=r(4841),u=r(511),v=r(2585),C="\xA0",w=new RegExp(C,"g"),y=s.SelectionService=class extends l.Disposable{constructor(m,E,P,I,N,R,U,D,A){super(),this._element=m,this._screenElement=E,this._linkifier=P,this._bufferService=I,this._coreService=N,this._mouseService=R,this._optionsService=U,this._renderService=D,this._coreBrowserService=A,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 g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=T=>this._handleMouseMove(T),this._mouseUpListener=T=>this._handleMouseUp(T),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((T=>this._handleTrim(T))),this.register(this._bufferService.buffers.onBufferActivate((T=>this._handleBufferActivate(T)))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,l.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,E=this._model.finalSelectionEnd;return!(!m||!E||m[0]===E[0]&&m[1]===E[1])}get selectionText(){let m=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!m||!E)return"";let P=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(m[0]===E[0])return"";let N=m[0]<E[0]?m[0]:E[0],R=m[0]<E[0]?E[0]:m[0];for(let U=m[1];U<=E[1];U++){let D=P.translateBufferLineToString(U,!0,N,R);I.push(D)}}else{let N=m[1]===E[1]?E[0]:void 0;I.push(P.translateBufferLineToString(m[1],!0,m[0],N));for(let R=m[1]+1;R<=E[1]-1;R++){let U=P.lines.get(R),D=P.translateBufferLineToString(R,!0);U?.isWrapped?I[I.length-1]+=D:I.push(D)}if(m[1]!==E[1]){let R=P.lines.get(E[1]),U=P.translateBufferLineToString(E[1],!0,0,E[0]);R&&R.isWrapped?I[I.length-1]+=U:I.push(U)}}return I.map((N=>N.replace(w," "))).join(d.isWindows?`\r
6
6
  `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(m){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.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),D=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(D&&I&&x)&&this._areCoordsInSelection(x,D,I)}isCellInSelection(m,x){let D=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!D||!I)&&this._areCoordsInSelection([m,x],D,I)}_areCoordsInSelection(m,x,D){return m[1]>x[1]&&m[1]<D[1]||x[1]===D[1]&&m[1]===x[1]&&m[0]>=x[0]&&m[0]<D[0]||x[1]<D[1]&&m[1]===D[1]&&m[0]<D[0]||x[1]<D[1]&&m[1]===x[1]&&m[0]>=x[0]}_selectWordAtCursor(m,x){let D=this._linkifier.currentLink?.link?.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,o.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let I=this._getMouseBufferCoords(m);return!!I&&(this._selectWordAt(I,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],D=this._renderService.dimensions.css.canvas.height;return x>=0&&x<=D?0:(x>D&&(x-=D),x=Math.min(Math.max(x,-50),50),x/=50,x/Math.abs(x)+Math.round(14*x))}shouldForceSelection(m){return d.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&&!(d.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 D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){let I=D.lines.get(this._model.selectionEnd[1]);I&&I.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 D=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){let I=(0,f.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,D=!(!m||!x||m[0]===x[0]&&m[1]===x[1]);D?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,D)):this._oldHasSelection&&this._fireOnSelectionChange(m,x,D)}_fireOnSelectionChange(m,x,D){this._oldSelectionStart=m,this._oldSelectionEnd=x,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((x=>this._handleTrim(x)))}_convertViewportColToCharacterIndex(m,x){let D=x;for(let I=0;x>=I;I++){let H=m.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:H>1&&x!==I&&(D+=H-1)}return D}setSelection(m,x,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,x],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,x,D=!0,I=!0){if(m[0]>=this._bufferService.cols)return;let H=this._bufferService.buffer,M=H.lines.get(m[1]);if(!M)return;let N=H.translateBufferLineToString(m[1],!1),B=this._convertViewportColToCharacterIndex(M,m[0]),R=B,O=m[0]-B,T=0,b=0,E=0,k=0;if(N.charAt(B)===" "){for(;B>0&&N.charAt(B-1)===" ";)B--;for(;R<N.length&&N.charAt(R+1)===" ";)R++}else{let K=m[0],$=m[0];M.getWidth(K)===0&&(T++,K--),M.getWidth($)===2&&(b++,$++);let j=M.getString($).length;for(j>1&&(k+=j-1,R+=j-1);K>0&&B>0&&!this._isCharWordSeparator(M.loadCell(K-1,this._workCell));){M.loadCell(K-1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===0?(T++,K--):P>1&&(E+=P-1,B-=P-1),B--,K--}for(;$<M.length&&R+1<N.length&&!this._isCharWordSeparator(M.loadCell($+1,this._workCell));){M.loadCell($+1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,$++):P>1&&(k+=P-1,R+=P-1),R++,$++}}R++;let A=B+O-T+E,W=Math.min(this._bufferService.cols,R-B+T+b-E-k);if(x||N.slice(B,R).trim()!==""){if(D&&A===0&&M.getCodePoint(0)!==32){let K=H.lines.get(m[1]-1);if(K&&M.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let $=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if($){let j=this._bufferService.cols-$.start;A-=j,W+=j}}}if(I&&A+W===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){let K=H.lines.get(m[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let $=this._getWordAt([0,m[1]+1],!1,!1,!0);$&&(W+=$.length)}}return{start:A,length:W}}}_selectWordAt(m,x){let D=this._getWordAt(m,x);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[D.start,m[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(m){let x=this._getWordAt(m,!0);if(x){let D=m[1];for(;x.start<0;)x.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;x.start+x.length>this._bufferService.cols;)x.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?x.start:x.start+x.length,D]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let x=this._bufferService.buffer.getWrappedRangeForLine(m),D={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)(D,this._bufferService.cols)}};i.SelectionService=y=l([_(3,v.IBufferService),_(4,v.ICoreService),_(5,S.IMouseService),_(6,v.IOptionsService),_(7,S.IRenderService),_(8,S.ICoreBrowserService)],y)},4725:(h,i,r)=>{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=r(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,r){var l=this&&this.__decorate||function(y,m,x,D){var I,H=arguments.length,M=H<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,x):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,m,x,D);else for(var N=y.length-1;N>=0;N--)(I=y[N])&&(M=(H<3?I(M):H>3?I(m,x,M):I(m,x))||M);return H>3&&M&&Object.defineProperty(m,x,M),M},_=this&&this.__param||function(y,m){return function(x,D){m(x,D,y)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;let n=r(7239),f=r(8055),p=r(8460),S=r(844),g=r(2585),a=f.css.toColor("#ffffff"),d=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 D=m[x/36%6|0],I=m[x/6%6|0],H=m[x%6];y.push({css:f.channels.toCss(D,I,H),rgba:f.channels.toRgba(D,I,H)})}for(let x=0;x<24;x++){let D=8+10*x;y.push({css:f.channels.toCss(D,D,D),rgba:f.channels.toRgba(D,D,D)})}return y})());let C=i.ThemeService=class extends S.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 p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:a,background:d,cursor:o,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:f.color.blend(d,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:f.color.blend(d,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=w(y.foreground,a),m.background=w(y.background,d),m.cursor=w(y.cursor,o),m.cursorAccent=w(y.cursorAccent,u),m.selectionBackgroundTransparent=w(y.selectionBackground,v),m.selectionBackgroundOpaque=f.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=w(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=f.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?w(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]=w(y.black,i.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=w(y.red,i.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=w(y.green,i.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=w(y.yellow,i.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=w(y.blue,i.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=w(y.magenta,i.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=w(y.cyan,i.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=w(y.white,i.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=w(y.brightBlack,i.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=w(y.brightRed,i.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=w(y.brightGreen,i.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=w(y.brightYellow,i.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=w(y.brightBlue,i.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=w(y.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=w(y.brightCyan,i.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=w(y.brightWhite,i.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let x=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let D=0;D<x;D++)m.ansi[D+16]=w(y.extendedAnsi[D],i.DEFAULT_ANSI_COLORS[D+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 w(y,m){if(y!==void 0)try{return f.css.toColor(y)}catch{}return m}i.ThemeService=C=l([_(0,g.IOptionsService)],C)},6349:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;let l=r(8460),_=r(844);class n extends _.Disposable{constructor(p){super(),this._maxLength=p,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(p){if(this._maxLength===p)return;let S=new Array(p);for(let g=0;g<Math.min(p,this.length);g++)S[g]=this._array[this._getCyclicIndex(g)];this._array=S,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let S=this._length;S<p;S++)this._array[S]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,S){this._array[this._getCyclicIndex(p)]=S}push(p){this._array[this._getCyclicIndex(this._length)]=p,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(p,S,...g){if(S){for(let a=p;a<this._length-S;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+S)];this._length-=S,this.onDeleteEmitter.fire({index:p,amount:S})}for(let a=this._length-1;a>=p;a--)this._array[this._getCyclicIndex(a+g.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<g.length;a++)this._array[this._getCyclicIndex(p+a)]=g[a];if(g.length&&this.onInsertEmitter.fire({index:p,amount:g.length}),this._length+g.length>this._maxLength){let a=this._length+g.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=g.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,S,g){if(!(S<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let d=S-1;d>=0;d--)this.set(p+d+g,this.get(p+d));let a=p+S+g-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<S;a++)this.set(p+a+g,this.get(p+a))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}i.CircularList=n},1439:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function r(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]&&r(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 r=0,l=0,_=0,n=0;var f,p,S,g,a;function d(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,w,y){return y!==void 0?`#${d(v)}${d(C)}${d(w)}${d(y)}`:`#${d(v)}${d(C)}${d(w)}`},u.toRgba=function(v,C,w,y=255){return(v<<24|C<<16|w<<8|y)>>>0},u.toColor=function(v,C,w,y){return{css:u.toCss(v,C,w,y),rgba:u.toRgba(v,C,w,y)}}})(f||(i.channels=f={})),(function(u){function v(C,w){return n=Math.round(255*w),[r,l,_]=a.toChannels(C.rgba),{css:f.toCss(r,l,_,n),rgba:f.toRgba(r,l,_,n)}}u.blend=function(C,w){if(n=(255&w.rgba)/255,n===1)return{css:w.css,rgba:w.rgba};let y=w.rgba>>24&255,m=w.rgba>>16&255,x=w.rgba>>8&255,D=C.rgba>>24&255,I=C.rgba>>16&255,H=C.rgba>>8&255;return r=D+Math.round((y-D)*n),l=I+Math.round((m-I)*n),_=H+Math.round((x-H)*n),{css:f.toCss(r,l,_),rgba:f.toRgba(r,l,_)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,w,y){let m=a.ensureContrastRatio(C.rgba,w.rgba,y);if(m)return f.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let w=(255|C.rgba)>>>0;return[r,l,_]=a.toChannels(w),{css:f.toCss(r,l,_),rgba:w}},u.opacity=v,u.multiplyOpacity=function(C,w){return n=255&C.rgba,v(C,n*w/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(p||(i.color=p={})),(function(u){let v,C;try{let w=document.createElement("canvas");w.width=1,w.height=1;let y=w.getContext("2d",{willReadFrequently:!0});y&&(v=y,v.globalCompositeOperation="copy",C=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(w){if(w.match(/#[\da-f]{3,8}/i))switch(w.length){case 4:return r=parseInt(w.slice(1,2).repeat(2),16),l=parseInt(w.slice(2,3).repeat(2),16),_=parseInt(w.slice(3,4).repeat(2),16),f.toColor(r,l,_);case 5:return r=parseInt(w.slice(1,2).repeat(2),16),l=parseInt(w.slice(2,3).repeat(2),16),_=parseInt(w.slice(3,4).repeat(2),16),n=parseInt(w.slice(4,5).repeat(2),16),f.toColor(r,l,_,n);case 7:return{css:w,rgba:(parseInt(w.slice(1),16)<<8|255)>>>0};case 9:return{css:w,rgba:parseInt(w.slice(1),16)>>>0}}let y=w.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 r=parseInt(y[1]),l=parseInt(y[2]),_=parseInt(y[3]),n=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),f.toColor(r,l,_,n);if(!v||!C)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=C,v.fillStyle=w,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[r,l,_,n]=v.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(r,l,_,n),css:w}}})(S||(i.css=S={})),(function(u){function v(C,w,y){let m=C/255,x=w/255,D=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*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}u.relativeLuminance=function(C){return v(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=v})(g||(i.rgb=g={})),(function(u){function v(w,y,m){let x=w>>24&255,D=w>>16&255,I=w>>8&255,H=y>>24&255,M=y>>16&255,N=y>>8&255,B=o(g.relativeLuminance2(H,M,N),g.relativeLuminance2(x,D,I));for(;B<m&&(H>0||M>0||N>0);)H-=Math.max(0,Math.ceil(.1*H)),M-=Math.max(0,Math.ceil(.1*M)),N-=Math.max(0,Math.ceil(.1*N)),B=o(g.relativeLuminance2(H,M,N),g.relativeLuminance2(x,D,I));return(H<<24|M<<16|N<<8|255)>>>0}function C(w,y,m){let x=w>>24&255,D=w>>16&255,I=w>>8&255,H=y>>24&255,M=y>>16&255,N=y>>8&255,B=o(g.relativeLuminance2(H,M,N),g.relativeLuminance2(x,D,I));for(;B<m&&(H<255||M<255||N<255);)H=Math.min(255,H+Math.ceil(.1*(255-H))),M=Math.min(255,M+Math.ceil(.1*(255-M))),N=Math.min(255,N+Math.ceil(.1*(255-N))),B=o(g.relativeLuminance2(H,M,N),g.relativeLuminance2(x,D,I));return(H<<24|M<<16|N<<8|255)>>>0}u.blend=function(w,y){if(n=(255&y)/255,n===1)return y;let m=y>>24&255,x=y>>16&255,D=y>>8&255,I=w>>24&255,H=w>>16&255,M=w>>8&255;return r=I+Math.round((m-I)*n),l=H+Math.round((x-H)*n),_=M+Math.round((D-M)*n),f.toRgba(r,l,_)},u.ensureContrastRatio=function(w,y,m){let x=g.relativeLuminance(w>>8),D=g.relativeLuminance(y>>8);if(o(x,D)<m){if(D<x){let M=v(w,y,m),N=o(x,g.relativeLuminance(M>>8));if(N<m){let B=C(w,y,m);return N>o(x,g.relativeLuminance(B>>8))?M:B}return M}let I=C(w,y,m),H=o(x,g.relativeLuminance(I>>8));if(H<m){let M=v(w,y,m);return H>o(x,g.relativeLuminance(M>>8))?I:M}return I}},u.reduceLuminance=v,u.increaseLuminance=C,u.toChannels=function(w){return[w>>24&255,w>>16&255,w>>8&255,255&w]}})(a||(i.rgba=a={})),i.toPaddedHex=d,i.contrastRatio=o},8969:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;let l=r(844),_=r(2585),n=r(4348),f=r(7866),p=r(744),S=r(7302),g=r(6975),a=r(8460),d=r(1753),o=r(1480),u=r(7994),v=r(9282),C=r(5435),w=r(5981),y=r(2660),m=!1;class x extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event((I=>{this._onScrollApi?.fire(I.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(I){for(let H in I)this.optionsService.options[H]=I[H]}constructor(I){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 S.OptionsService(I)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.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(g.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.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((H=>{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((H=>{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 w.WriteBuffer(((H,M)=>this._inputHandler.parse(H,M)))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,H){this._writeBuffer.write(I,H)}writeSync(I,H){this._logService.logLevel<=_.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(I,H)}input(I,H=!0){this.coreService.triggerDataEvent(I,H)}resize(I,H){isNaN(I)||isNaN(H)||(I=Math.max(I,p.MINIMUM_COLS),H=Math.max(H,p.MINIMUM_ROWS),this._bufferService.resize(I,H))}scroll(I,H=!1){this._bufferService.scroll(I,H)}scrollLines(I,H,M){this._bufferService.scrollLines(I,H,M)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){let H=I-this._bufferService.buffer.ydisp;H!==0&&this.scrollLines(H)}registerEscHandler(I,H){return this._inputHandler.registerEscHandler(I,H)}registerDcsHandler(I,H){return this._inputHandler.registerDcsHandler(I,H)}registerCsiHandler(I,H){return this._inputHandler.registerCsiHandler(I,H)}registerOscHandler(I,H){return this._inputHandler.registerOscHandler(I,H)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1,H=this.optionsService.rawOptions.windowsPty;H&&H.buildNumber!==void 0&&H.buildNumber!==void 0?I=H.backend==="conpty"&&H.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let I=[];I.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)((()=>{for(let H of I)H.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=r=>(this._listeners.push(r),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===r)return void this._listeners.splice(l,1)}}})),this._event}fire(r,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,r,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(r,l){return r((_=>l.fire(_)))},i.runAndSubscribe=function(r,l){return l(void 0),r((_=>l(_)))}},5435:function(h,i,r){var l=this&&this.__decorate||function(T,b,E,k){var A,W=arguments.length,K=W<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,E):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(T,b,E,k);else for(var $=T.length-1;$>=0;$--)(A=T[$])&&(K=(W<3?A(K):W>3?A(b,E,K):A(b,E))||K);return W>3&&K&&Object.defineProperty(b,E,K),K},_=this&&this.__param||function(T,b){return function(E,k){b(E,k,T)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;let n=r(2584),f=r(7116),p=r(2015),S=r(844),g=r(482),a=r(8437),d=r(8460),o=r(643),u=r(511),v=r(3734),C=r(2585),w=r(1480),y=r(6242),m=r(6351),x=r(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function H(T,b){if(T>24)return b.setWinLines||!1;switch(T){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.setWinLines}return!1}var M;(function(T){T[T.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",T[T.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(M||(i.WindowsOptionsReportType=M={}));let N=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,k,A,W,K,$,j,P=new p.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=k,this._logService=A,this._optionsService=W,this._oscLinkService=K,this._coreMouseService=$,this._unicodeService=j,this._parser=P,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.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 d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.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 R(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._parser.setCsiHandlerFallback(((L,U)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:U.toArray()})})),this._parser.setEscHandlerFallback((L=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(L)})})),this._parser.setExecuteHandlerFallback((L=>{this._logService.debug("Unknown EXECUTE code: ",{code:L})})),this._parser.setOscHandlerFallback(((L,U,F)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:U,data:F})})),this._parser.setDcsHandlerFallback(((L,U,F)=>{U==="HOOK"&&(F=F.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:U,payload:F})})),this._parser.setPrintHandler(((L,U,F)=>this.print(L,U,F))),this._parser.registerCsiHandler({final:"@"},(L=>this.insertChars(L))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(L=>this.scrollLeft(L))),this._parser.registerCsiHandler({final:"A"},(L=>this.cursorUp(L))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(L=>this.scrollRight(L))),this._parser.registerCsiHandler({final:"B"},(L=>this.cursorDown(L))),this._parser.registerCsiHandler({final:"C"},(L=>this.cursorForward(L))),this._parser.registerCsiHandler({final:"D"},(L=>this.cursorBackward(L))),this._parser.registerCsiHandler({final:"E"},(L=>this.cursorNextLine(L))),this._parser.registerCsiHandler({final:"F"},(L=>this.cursorPrecedingLine(L))),this._parser.registerCsiHandler({final:"G"},(L=>this.cursorCharAbsolute(L))),this._parser.registerCsiHandler({final:"H"},(L=>this.cursorPosition(L))),this._parser.registerCsiHandler({final:"I"},(L=>this.cursorForwardTab(L))),this._parser.registerCsiHandler({final:"J"},(L=>this.eraseInDisplay(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(L=>this.eraseInDisplay(L,!0))),this._parser.registerCsiHandler({final:"K"},(L=>this.eraseInLine(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(L=>this.eraseInLine(L,!0))),this._parser.registerCsiHandler({final:"L"},(L=>this.insertLines(L))),this._parser.registerCsiHandler({final:"M"},(L=>this.deleteLines(L))),this._parser.registerCsiHandler({final:"P"},(L=>this.deleteChars(L))),this._parser.registerCsiHandler({final:"S"},(L=>this.scrollUp(L))),this._parser.registerCsiHandler({final:"T"},(L=>this.scrollDown(L))),this._parser.registerCsiHandler({final:"X"},(L=>this.eraseChars(L))),this._parser.registerCsiHandler({final:"Z"},(L=>this.cursorBackwardTab(L))),this._parser.registerCsiHandler({final:"`"},(L=>this.charPosAbsolute(L))),this._parser.registerCsiHandler({final:"a"},(L=>this.hPositionRelative(L))),this._parser.registerCsiHandler({final:"b"},(L=>this.repeatPrecedingCharacter(L))),this._parser.registerCsiHandler({final:"c"},(L=>this.sendDeviceAttributesPrimary(L))),this._parser.registerCsiHandler({prefix:">",final:"c"},(L=>this.sendDeviceAttributesSecondary(L))),this._parser.registerCsiHandler({final:"d"},(L=>this.linePosAbsolute(L))),this._parser.registerCsiHandler({final:"e"},(L=>this.vPositionRelative(L))),this._parser.registerCsiHandler({final:"f"},(L=>this.hVPosition(L))),this._parser.registerCsiHandler({final:"g"},(L=>this.tabClear(L))),this._parser.registerCsiHandler({final:"h"},(L=>this.setMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(L=>this.setModePrivate(L))),this._parser.registerCsiHandler({final:"l"},(L=>this.resetMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(L=>this.resetModePrivate(L))),this._parser.registerCsiHandler({final:"m"},(L=>this.charAttributes(L))),this._parser.registerCsiHandler({final:"n"},(L=>this.deviceStatus(L))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(L=>this.deviceStatusPrivate(L))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(L=>this.softReset(L))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(L=>this.setCursorStyle(L))),this._parser.registerCsiHandler({final:"r"},(L=>this.setScrollRegion(L))),this._parser.registerCsiHandler({final:"s"},(L=>this.saveCursor(L))),this._parser.registerCsiHandler({final:"t"},(L=>this.windowOptions(L))),this._parser.registerCsiHandler({final:"u"},(L=>this.restoreCursor(L))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(L=>this.insertColumns(L))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(L=>this.deleteColumns(L))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(L=>this.selectProtected(L))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(L=>this.requestMode(L,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(L=>this.requestMode(L,!1))),this._parser.setExecuteHandler(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((L=>(this.setTitle(L),this.setIconName(L),!0)))),this._parser.registerOscHandler(1,new y.OscHandler((L=>this.setIconName(L)))),this._parser.registerOscHandler(2,new y.OscHandler((L=>this.setTitle(L)))),this._parser.registerOscHandler(4,new y.OscHandler((L=>this.setOrReportIndexedColor(L)))),this._parser.registerOscHandler(8,new y.OscHandler((L=>this.setHyperlink(L)))),this._parser.registerOscHandler(10,new y.OscHandler((L=>this.setOrReportFgColor(L)))),this._parser.registerOscHandler(11,new y.OscHandler((L=>this.setOrReportBgColor(L)))),this._parser.registerOscHandler(12,new y.OscHandler((L=>this.setOrReportCursorColor(L)))),this._parser.registerOscHandler(104,new y.OscHandler((L=>this.restoreIndexedColor(L)))),this._parser.registerOscHandler(110,new y.OscHandler((L=>this.restoreFgColor(L)))),this._parser.registerOscHandler(111,new y.OscHandler((L=>this.restoreBgColor(L)))),this._parser.registerOscHandler(112,new y.OscHandler((L=>this.restoreCursorColor(L)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let L in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:L},(()=>this.selectCharset("("+L))),this._parser.registerEscHandler({intermediates:")",final:L},(()=>this.selectCharset(")"+L))),this._parser.registerEscHandler({intermediates:"*",final:L},(()=>this.selectCharset("*"+L))),this._parser.registerEscHandler({intermediates:"+",final:L},(()=>this.selectCharset("+"+L))),this._parser.registerEscHandler({intermediates:"-",final:L},(()=>this.selectCharset("-"+L))),this._parser.registerEscHandler({intermediates:".",final:L},(()=>this.selectCharset("."+L))),this._parser.registerEscHandler({intermediates:"/",final:L},(()=>this.selectCharset("/"+L)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((L=>(this._logService.error("Parsing error: ",L),L))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler(((L,U)=>this.requestStatusString(L,U))))}_preserveStack(b,E,k,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=k,this._parseStack.position=A}_logSlowResolvingAsync(b){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,k)=>setTimeout((()=>k("#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(b,E){let k,A=this._activeBuffer.x,W=this._activeBuffer.y,K=0,$=this._parseStack.paused;if($){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(k),k;A=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>I&&(K=this._parseStack.position+I)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(L=>String.fromCharCode(L))).join("")}"`),typeof b=="string"?b.split("").map((L=>L.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(b.length,I))),$||this._dirtyRowTracker.clearRange(),b.length>I)for(let L=K;L<b.length;L+=I){let U=L+I<b.length?L+I:b.length,F=typeof b=="string"?this._stringDecoder.decode(b.substring(L,U),this._parseBuffer):this._utf8Decoder.decode(b.subarray(L,U),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,F))return this._preserveStack(A,W,F,L),this._logSlowResolvingAsync(k),k}else if(!$){let L=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,L))return this._preserveStack(A,W,L,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===A&&this._activeBuffer.y===W||this._onCursorMove.fire();let j=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),P=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);P<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(P,this._bufferService.rows-1),Math.min(j,this._bufferService.rows-1))}print(b,E,k){let A,W,K=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,j=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,U=this._curAttrData,F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-E>0&&F.getWidth(this._activeBuffer.x-1)===2&&F.setCellFromCodepoint(this._activeBuffer.x-1,0,1,U);let q=this._parser.precedingJoinState;for(let G=E;G<k;++G){if(A=b[G],A<127&&K){let re=K[String.fromCharCode(A)];re&&(A=re.charCodeAt(0))}let Q=this._unicodeService.charProperties(A,q);W=w.UnicodeService.extractWidth(Q);let ee=w.UnicodeService.extractShouldJoin(Q),te=ee?w.UnicodeService.extractWidth(q):0;if(q=Q,$&&this._onA11yChar.fire((0,g.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-te>j){if(P){let re=F,X=this._activeBuffer.x-te;for(this._activeBuffer.x=te,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),te>0&&F instanceof a.BufferLine&&F.copyCellsFrom(re,X,0,te,!1);X<j;)re.setCellFromCodepoint(X++,0,1,U)}else if(this._activeBuffer.x=j-1,W===2)continue}if(ee&&this._activeBuffer.x){let re=F.getWidth(this._activeBuffer.x-1)?1:2;F.addCodepointToCell(this._activeBuffer.x-re,A,W);for(let X=W-te;--X>=0;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}else if(L&&(F.insertCells(this._activeBuffer.x,W-te,this._activeBuffer.getNullCell(U)),F.getWidth(j-1)===2&&F.setCellFromCodepoint(j-1,o.NULL_CELL_CODE,o.NULL_CELL_WIDTH,U)),F.setCellFromCodepoint(this._activeBuffer.x++,A,W,U),W>0)for(;--W;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}this._parser.precedingJoinState=q,this._activeBuffer.x<j&&k-E>0&&F.getWidth(this._activeBuffer.x)===0&&!F.hasContent(this._activeBuffer.x)&&F.setCellFromCodepoint(this._activeBuffer.x,0,1,U),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,E){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,E):this._parser.registerCsiHandler(b,(k=>!H(k.params[0],this._optionsService.rawOptions.windowOptions)||E(k)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new m.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,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 b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=b,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+E)}cursorUp(b){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let E=b.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let E=b.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,E,k,A=!1,W=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,k,this._activeBuffer.getNullCell(this._eraseAttrData()),W),A&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),k.isWrapped=!1)}eraseInDisplay(b,E=!1){let k;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);k<this._bufferService.rows;k++)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,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(b,E=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,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(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-A+1;for(;E--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A;for(A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,A=this._bufferService.rows-1+this._activeBuffer.ybase-A;E--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let E=b.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(b){let E=b.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(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let E=this._parser.precedingJoinState;if(!E)return!0;let k=b.params[0]||1,A=w.UnicodeService.extractWidth(E),W=this._activeBuffer.x-A,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),$=new Uint32Array(K.length*k),j=0;for(let L=0;L<K.length;){let U=K.codePointAt(L)||0;$[j++]=U,L+=U>65535?2:1}let P=j;for(let L=1;L<k;++L)$.copyWithin(P,0,j),P+=j;return this.print($,0,P),!0}sendDeviceAttributesPrimary(b){return b.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(b){return b.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(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let E=0;E<b.length;E++)switch(b.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(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let E=0;E<b.length;E++)switch(b.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(),b.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(b,E){let k=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:W}=this._coreMouseService,K=this._coreService,{buffers:$,cols:j}=this._bufferService,{active:P,alt:L}=$,U=this._optionsService.rawOptions,F=ee=>ee?1:2,q=b.params[0];return G=q,Q=E?q===2?4:q===4?F(K.modes.insertMode):q===12?3:q===20?F(U.convertEol):0:q===1?F(k.applicationCursorKeys):q===3?U.windowOptions.setWinLines?j===80?2:j===132?1:0:0:q===6?F(k.origin):q===7?F(k.wraparound):q===8?3:q===9?F(A==="X10"):q===12?F(U.cursorBlink):q===25?F(!K.isCursorHidden):q===45?F(k.reverseWraparound):q===66?F(k.applicationKeypad):q===67?4:q===1e3?F(A==="VT200"):q===1002?F(A==="DRAG"):q===1003?F(A==="ANY"):q===1004?F(k.sendFocus):q===1005?4:q===1006?F(W==="SGR"):q===1015?4:q===1016?F(W==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?F(P===L):q===2004?F(k.bracketedPasteMode):0,K.triggerDataEvent(`${n.C0.ESC}[${E?"":"?"}${G};${Q}$y`),!0;var G,Q}_updateAttrColor(b,E,k,A,W){return E===2?(b|=50331648,b&=-16777216,b|=v.AttributeData.fromColorRGB([k,A,W])):E===5&&(b&=-50331904,b|=33554432|255&k),b}_extractColor(b,E,k){let A=[0,0,-1,0,0,0],W=0,K=0;do{if(A[K+W]=b.params[E+K],b.hasSubParams(E+K)){let $=b.getSubParams(E+K),j=0;do A[1]===5&&(W=1),A[K+j+1+W]=$[j];while(++j<$.length&&j+K+1+W<A.length);break}if(A[1]===5&&K+W>=2||A[1]===2&&K+W>=5)break;A[1]&&(W=1)}while(++K+E<b.length&&K+W<A.length);for(let $=2;$<A.length;++$)A[$]===-1&&(A[$]=0);switch(A[0]){case 38:k.fg=this._updateAttrColor(k.fg,A[1],A[3],A[4],A[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,A[1],A[3],A[4],A[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,A[1],A[3],A[4],A[5])}return K}_processUnderline(b,E){E.extended=E.extended.clone(),(!~b||b>5)&&(b=1),E.extended.underlineStyle=b,E.fg|=268435456,b===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(b){b.fg=a.DEFAULT_ATTR_DATA.fg,b.bg=a.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let E=b.length,k,A=this._curAttrData;for(let W=0;W<E;W++)k=b.params[W],k>=30&&k<=37?(A.fg&=-50331904,A.fg|=16777216|k-30):k>=40&&k<=47?(A.bg&=-50331904,A.bg|=16777216|k-40):k>=90&&k<=97?(A.fg&=-50331904,A.fg|=16777224|k-90):k>=100&&k<=107?(A.bg&=-50331904,A.bg|=16777224|k-100):k===0?this._processSGR0(A):k===1?A.fg|=134217728:k===3?A.bg|=67108864:k===4?(A.fg|=268435456,this._processUnderline(b.hasSubParams(W)?b.getSubParams(W)[0]:1,A)):k===5?A.fg|=536870912:k===7?A.fg|=67108864:k===8?A.fg|=1073741824:k===9?A.fg|=2147483648:k===2?A.bg|=134217728:k===21?this._processUnderline(2,A):k===22?(A.fg&=-134217729,A.bg&=-134217729):k===23?A.bg&=-67108865:k===24?(A.fg&=-268435457,this._processUnderline(0,A)):k===25?A.fg&=-536870913:k===27?A.fg&=-67108865:k===28?A.fg&=-1073741825:k===29?A.fg&=2147483647:k===39?(A.fg&=-67108864,A.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):k===49?(A.bg&=-67108864,A.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?W+=this._extractColor(b,W,A):k===53?A.bg|=1073741824:k===55?A.bg&=-1073741825:k===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):k===100?(A.fg&=-67108864,A.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${E};${k}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${E};${k}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(b){let E=b.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 k=E%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(b){let E=b.params[0]||1,k;return(b.length<2||(k=b.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(b){if(!H(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let E=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(M.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(M.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(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let E=[],k=b.split(";");for(;k.length>1;){let A=k.shift(),W=k.shift();if(/^\d+$/.exec(A)){let K=parseInt(A);if(O(K))if(W==="?")E.push({type:0,index:K});else{let $=(0,x.parseColor)(W);$&&E.push({type:1,index:K,color:$})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(b){let E=b.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(b,E){this._getCurrentLinkId()&&this._finishHyperlink();let k=b.split(":"),A,W=k.findIndex((K=>K.startsWith("id=")));return W!==-1&&(A=k[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,E){let k=b.split(";");for(let A=0;A<k.length&&!(E>=this._specialColors.length);++A,++E)if(k[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let W=(0,x.parseColor)(k[A]);W&&this._onColor.fire([{type:1,index:this._specialColors[E],color:W}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let E=[],k=b.split(";");for(let A=0;A<k.length;++A)if(/^\d+$/.exec(k[A])){let W=parseInt(k[A]);O(W)&&E.push({type:2,index:W})}return E.length&&this._onColor.fire(E),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(D[b[0]],f.CHARSETS[b[1]]||f.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new u.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){let k=this._activeBuffer.ybase+this._activeBuffer.y+E,A=this._activeBuffer.lines.get(k);A&&(A.fill(b),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let k=this._bufferService.buffer,A=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${W}${n.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}i.InputHandler=B;let R=class{constructor(T){this._bufferService=T,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(T){T<this.start?this.start=T:T>this.end&&(this.end=T)}markRangeDirty(T,b){T>b&&(N=T,T=b,b=N),T<this.start&&(this.start=T),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function O(T){return 0<=T&&T<256}R=l([_(0,C.IBufferService)],R)},844:(h,i)=>{function r(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=r,i.getDisposeArrayDisposable=function(l){return{dispose:()=>r(l)}}},1505:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class r{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=r,i.FourKeyMap=class{constructor(){this._data=new r}set(l,_,n,f,p){this._data.get(l,_)||this._data.set(l,_,new r),this._data.get(l,_).set(n,f,p)}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 r=i.isNode?"node":navigator.userAgent,l=i.isNode?"node":navigator.platform;i.isFirefox=r.includes("Firefox"),i.isLegacyEdge=r.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(r),i.getSafariVersion=function(){if(!i.isSafari)return 0;let _=r.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(r)},6106:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let r=0;i.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(r=this._search(this._getKey(l)),this._array.splice(r,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;let _=this._getKey(l);if(_===void 0||(r=this._search(_),r===-1)||this._getKey(this._array[r])!==_)return!1;do if(this._array[r]===l)return this._array.splice(r,1),!0;while(++r<this._array.length&&this._getKey(this._array[r])===_);return!1}*getKeyIterator(l){if(this._array.length!==0&&(r=this._search(l),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===l))do yield this._array[r];while(++r<this._array.length&&this._getKey(this._array[r])===l)}forEachByKey(l,_){if(this._array.length!==0&&(r=this._search(l),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===l))do _(this._array[r]);while(++r<this._array.length&&this._getKey(this._array[r])===l)}values(){return[...this._array].values()}_search(l){let _=0,n=this._array.length-1;for(;n>=_;){let f=_+n>>1,p=this._getKey(this._array[f]);if(p>l)n=f-1;else{if(!(p<l)){for(;f>0&&this._getKey(this._array[f-1])===l;)f--;return f}_=f+1}}return _}}},7226:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;let l=r(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),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(p){this._idleCallback=void 0;let S=0,g=0,a=p.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),g=Math.max(S,g),d=p.timeRemaining(),1.5*g>d)return a-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-S))}ms`),void this._start();a=d}this.clear()}}class n extends _{_requestCallback(p){return setTimeout((()=>p(this._createDeadline(16))))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){let S=Date.now()+p;return{timeRemaining:()=>Math.max(0,S-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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;let l=r(643);i.updateWindowsModeWrappedState=function(_){let n=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),f=n?.get(_.cols-1),p=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);p&&f&&(p.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 r{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 r;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=r;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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;let l=r(6349),_=r(7226),n=r(3734),f=r(8437),p=r(4634),S=r(511),g=r(643),a=r(4863),d=r(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=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.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,w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),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(w<this.lines.maxLength){let m=this.lines.length-w;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=w}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,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,o,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(v.length>0){let C=(0,p.reflowLargerCreateNewLayout)(this.lines,v);(0,p.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(o,u,C.countRemoved)}}_reflowLargerAdjustViewport(o,u,v){let C=this.getNullCell(f.DEFAULT_ATTR_DATA),w=v;for(;w-- >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=[],w=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 D=this.ybase+this.y;if(D>=y&&D<y+x.length)continue;let I=x[x.length-1].getTrimmedLength(),H=(0,p.reflowSmallerGetNewLineLengths)(x,this._cols,o),M=H.length-x.length,N;N=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+M):Math.max(0,this.lines.length-this.lines.maxLength+M);let B=[];for(let k=0;k<M;k++){let A=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);B.push(A)}B.length>0&&(C.push({start:y+x.length+w,newLines:B}),w+=B.length),x.push(...B);let R=H.length-1,O=H[R];O===0&&(R--,O=H[R]);let T=x.length-M-1,b=I;for(;T>=0;){let k=Math.min(b,O);if(x[R]===void 0)break;if(x[R].copyCellsFrom(x[T],b-k,O-k,k,!0),O-=k,O===0&&(R--,O=H[R]),b-=k,b===0){T--;let A=Math.max(T,0);b=(0,p.getWrappedLineTrimmedLength)(x,A,this._cols)}}for(let k=0;k<x.length;k++)H[k]<o&&x[k].setCell(H[k],v);let E=M-N;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+w)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+M,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let R=0;R<this.lines.length;R++)m.push(this.lines.get(R));let x=this.lines.length,D=x-1,I=0,H=C[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let M=0;for(let R=Math.min(this.lines.maxLength-1,x+w-1);R>=0;R--)if(H&&H.start>D+M){for(let O=H.newLines.length-1;O>=0;O--)this.lines.set(R--,H.newLines[O]);R++,y.push({index:D+1,amount:H.newLines.length}),M+=H.newLines.length,H=C[++I]}else this.lines.set(R,m[D--]);let N=0;for(let R=y.length-1;R>=0;R--)y[R].index+=N,this.lines.onInsertEmitter.fire(y[R]),N+=y[R].amount;let B=Math.max(0,x+w-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(o,u,v=0,C){let w=this.lines.get(o);return w?w.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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;let l=r(3734),_=r(511),n=r(643),f=r(482);i.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let p=0;class S{constructor(a,d,o=!1){this.isWrapped=o,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);let u=d||_.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 d=this._data[3*a+0],o=2097151&d;return[this._data[3*a+1],2097152&d?this._combined[a]:o?(0,f.stringFromCodePoint)(o):"",d>>22,2097152&d?this._combined[a].charCodeAt(this._combined[a].length-1):o]}set(a,d){this._data[3*a+1]=d[n.CHAR_DATA_ATTR_INDEX],d[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=d[1],this._data[3*a+0]=2097152|a|d[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=d[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[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 d=this._data[3*a+0];return 2097152&d?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&d}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){let d=this._data[3*a+0];return 2097152&d?this._combined[a]:2097151&d?(0,f.stringFromCodePoint)(2097151&d):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,d){return p=3*a,d.content=this._data[p+0],d.fg=this._data[p+1],d.bg=this._data[p+2],2097152&d.content&&(d.combinedData=this._combined[a]),268435456&d.bg&&(d.extended=this._extendedAttrs[a]),d}setCell(a,d){2097152&d.content&&(this._combined[a]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[a]=d.extended),this._data[3*a+0]=d.content,this._data[3*a+1]=d.fg,this._data[3*a+2]=d.bg}setCellFromCodepoint(a,d,o,u){268435456&u.bg&&(this._extendedAttrs[a]=u.extended),this._data[3*a+0]=d|o<<22,this._data[3*a+1]=u.fg,this._data[3*a+2]=u.bg}addCodepointToCell(a,d,o){let u=this._data[3*a+0];2097152&u?this._combined[a]+=(0,f.stringFromCodePoint)(d):2097151&u?(this._combined[a]=(0,f.stringFromCodePoint)(2097151&u)+(0,f.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,o&&(u&=-12582913,u|=o<<22),this._data[3*a+0]=u}insertCells(a,d,o){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,o),d<this.length-a){let u=new _.CellData;for(let v=this.length-a-d-1;v>=0;--v)this.setCell(a+d+v,this.loadCell(a+v,u));for(let v=0;v<d;++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,d,o){if(a%=this.length,d<this.length-a){let u=new _.CellData;for(let v=0;v<this.length-a-d;++v)this.setCell(a+v,this.loadCell(a+d+v,u));for(let v=this.length-d;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,d,o,u=!1){if(u)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodepoint(a-1,0,1,o),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,o);a<d&&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),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,o);a<d&&a<this.length;)this.setCell(a++,o)}resize(a,d){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,d)}else{this._data=this._data.subarray(0,o);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let w=parseInt(u[C],10);w>=a&&delete this._combined[w]}let v=Object.keys(this._extendedAttrs);for(let C=0;C<v.length;C++){let w=parseInt(v[C],10);w>=a&&delete this._extendedAttrs[w]}}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,d=!1){if(d)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 d in a._combined)this._combined[d]=a._combined[d];this._extendedAttrs={};for(let d in a._extendedAttrs)this._extendedAttrs[d]=a._extendedAttrs[d];this.isWrapped=a.isWrapped}clone(){let a=new S(0);a._data=new Uint32Array(this._data),a.length=this.length;for(let d in this._combined)a._combined[d]=this._combined[d];for(let d in this._extendedAttrs)a._extendedAttrs[d]=this._extendedAttrs[d];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,d,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*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[o+y]=a._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(o+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[o+y]=a._extendedAttrs[d+y])}let w=Object.keys(a._combined);for(let y=0;y<w.length;y++){let m=parseInt(w[y],10);m>=d&&(this._combined[m-d+o]=a._combined[m])}}translateToString(a,d,o,u){d=d??0,o=o??this.length,a&&(o=Math.min(o,this.getTrimmedLength())),u&&(u.length=0);let v="";for(;d<o;){let C=this._data[3*d+0],w=2097151&C,y=2097152&C?this._combined[d]:w?(0,f.stringFromCodePoint)(w):n.WHITESPACE_CELL_CHAR;if(v+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),v}}i.BufferLine=S},4841:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(r,l){if(r.start.y>r.end.y)throw new Error(`Buffer range end (${r.end.x}, ${r.end.y}) cannot be before start (${r.start.x}, ${r.start.y})`);return l*(r.end.y-r.start.y)+(r.end.x-r.start.x+1)}},4634:(h,i)=>{function r(l,_,n){if(_===l.length-1)return l[_].getTrimmedLength();let f=!l[_].hasContent(n-1)&&l[_].getWidth(n-1)===1,p=l[_+1].getWidth(0)===2;return f&&p?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,p){let S=[];for(let g=0;g<l.length-1;g++){let a=g,d=l.get(++a);if(!d.isWrapped)continue;let o=[l.get(g)];for(;a<l.length&&d.isWrapped;)o.push(d),d=l.get(++a);if(f>=g&&f<a){g+=o.length-1;continue}let u=0,v=r(o,u,_),C=1,w=0;for(;C<o.length;){let m=r(o,C,_),x=m-w,D=n-v,I=Math.min(x,D);o[u].copyCellsFrom(o[C],w,v,I,!1),v+=I,v===n&&(u++,v=0),w+=I,w===m&&(C++,w=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,p))}o[u].replaceCells(v,n,p);let y=0;for(let m=o.length-1;m>0&&(m>u||o[m].getTrimmedLength()===0);m--)y++;y>0&&(S.push(g+o.length-y),S.push(y)),g+=o.length-1}return S},i.reflowLargerCreateNewLayout=function(l,_){let n=[],f=0,p=_[f],S=0;for(let g=0;g<l.length;g++)if(p===g){let a=_[++f];l.onDeleteEmitter.fire({index:g-S,amount:a}),g+=a-1,S+=a,p=_[++f]}else n.push(g);return{layout:n,countRemoved:S}},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=[],p=l.map(((d,o)=>r(l,o,_))).reduce(((d,o)=>d+o)),S=0,g=0,a=0;for(;a<p;){if(p-a<n){f.push(p-a);break}S+=n;let d=r(l,g,_);S>d&&(S-=d,g++);let o=l[g].getWidth(S-1)===2;o&&S--;let u=o?n-1:n;f.push(u),a+=u}return f},i.getWrappedLineTrimmedLength=r},5295:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;let l=r(8460),_=r(844),n=r(9092);class f extends _.Disposable{constructor(S,g){super(),this._optionsService=S,this._bufferService=g,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(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,g){this._normal.resize(S,g),this._alt.resize(S,g),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}i.BufferSet=f},511:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;let l=r(482),_=r(643),n=r(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(S){let g=new f;return g.setFromCharData(S),g}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(S){this.fg=S[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(S[_.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(S[_.CHAR_DATA_CHAR_INDEX].length===2){let a=S[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){let d=S[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(a-55296)+d-56320+65536|S[_.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=S[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[_.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=S[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;let l=r(8460),_=r(844);class n{get id(){return this._id}constructor(p){this.line=p,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(p){return this._disposables.push(p),p}}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 r,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"})(r||(i.C0=r={})),(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=`${r.ESC}\\`})(_||(i.C1_ESCAPED=_={}))},7399:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;let l=r(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,p,S){let g={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"?g.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?g.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?g.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(g.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:g.key=n.ctrlKey?"\b":l.C0.DEL,n.altKey&&(g.key=l.C0.ESC+g.key);break;case 9:if(n.shiftKey){g.key=l.C0.ESC+"[Z";break}g.key=l.C0.HT,g.cancel=!0;break;case 13:g.key=n.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,g.cancel=!0;break;case 27:g.key=l.C0.ESC,n.altKey&&(g.key=l.C0.ESC+l.C0.ESC),g.cancel=!0;break;case 37:if(n.metaKey)break;a?(g.key=l.C0.ESC+"[1;"+(a+1)+"D",g.key===l.C0.ESC+"[1;3D"&&(g.key=l.C0.ESC+(p?"b":"[1;5D"))):g.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(n.metaKey)break;a?(g.key=l.C0.ESC+"[1;"+(a+1)+"C",g.key===l.C0.ESC+"[1;3C"&&(g.key=l.C0.ESC+(p?"f":"[1;5C"))):g.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(n.metaKey)break;a?(g.key=l.C0.ESC+"[1;"+(a+1)+"A",p||g.key!==l.C0.ESC+"[1;3A"||(g.key=l.C0.ESC+"[1;5A")):g.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(n.metaKey)break;a?(g.key=l.C0.ESC+"[1;"+(a+1)+"B",p||g.key!==l.C0.ESC+"[1;3B"||(g.key=l.C0.ESC+"[1;5B")):g.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(g.key=l.C0.ESC+"[2~");break;case 46:g.key=a?l.C0.ESC+"[3;"+(a+1)+"~":l.C0.ESC+"[3~";break;case 36:g.key=a?l.C0.ESC+"[1;"+(a+1)+"H":f?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:g.key=a?l.C0.ESC+"[1;"+(a+1)+"F":f?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:n.shiftKey?g.type=2:n.ctrlKey?g.key=l.C0.ESC+"[5;"+(a+1)+"~":g.key=l.C0.ESC+"[5~";break;case 34:n.shiftKey?g.type=3:n.ctrlKey?g.key=l.C0.ESC+"[6;"+(a+1)+"~":g.key=l.C0.ESC+"[6~";break;case 112:g.key=a?l.C0.ESC+"[1;"+(a+1)+"P":l.C0.ESC+"OP";break;case 113:g.key=a?l.C0.ESC+"[1;"+(a+1)+"Q":l.C0.ESC+"OQ";break;case 114:g.key=a?l.C0.ESC+"[1;"+(a+1)+"R":l.C0.ESC+"OR";break;case 115:g.key=a?l.C0.ESC+"[1;"+(a+1)+"S":l.C0.ESC+"OS";break;case 116:g.key=a?l.C0.ESC+"[15;"+(a+1)+"~":l.C0.ESC+"[15~";break;case 117:g.key=a?l.C0.ESC+"[17;"+(a+1)+"~":l.C0.ESC+"[17~";break;case 118:g.key=a?l.C0.ESC+"[18;"+(a+1)+"~":l.C0.ESC+"[18~";break;case 119:g.key=a?l.C0.ESC+"[19;"+(a+1)+"~":l.C0.ESC+"[19~";break;case 120:g.key=a?l.C0.ESC+"[20;"+(a+1)+"~":l.C0.ESC+"[20~";break;case 121:g.key=a?l.C0.ESC+"[21;"+(a+1)+"~":l.C0.ESC+"[21~";break;case 122:g.key=a?l.C0.ESC+"[23;"+(a+1)+"~":l.C0.ESC+"[23~";break;case 123:g.key=a?l.C0.ESC+"[24;"+(a+1)+"~":l.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(p&&!S||!n.altKey||n.metaKey)!p||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?g.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(g.key=l.C0.US),n.key==="@"&&(g.key=l.C0.NUL)):n.keyCode===65&&(g.type=1);else{let d=_[n.keyCode],o=d?.[n.shiftKey?1:0];if(o)g.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()),g.key=l.C0.ESC+v}else if(n.keyCode===32)g.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()),g.key=l.C0.ESC+u,g.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?g.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?g.key=l.C0.NUL:n.keyCode>=51&&n.keyCode<=55?g.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?g.key=l.C0.DEL:n.keyCode===219?g.key=l.C0.ESC:n.keyCode===220?g.key=l.C0.FS:n.keyCode===221&&(g.key=l.C0.GS)}return g}},482:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(r){return r>65535?(r-=65536,String.fromCharCode(55296+(r>>10))+String.fromCharCode(r%1024+56320)):String.fromCharCode(r)},i.utf32ToString=function(r,l=0,_=r.length){let n="";for(let f=l;f<_;++f){let p=r[f];p>65535?(p-=65536,n+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):n+=String.fromCharCode(p)}return n},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(r,l){let _=r.length;if(!_)return 0;let n=0,f=0;if(this._interim){let p=r.charCodeAt(f++);56320<=p&&p<=57343?l[n++]=1024*(this._interim-55296)+p-56320+65536:(l[n++]=this._interim,l[n++]=p),this._interim=0}for(let p=f;p<_;++p){let S=r.charCodeAt(p);if(55296<=S&&S<=56319){if(++p>=_)return this._interim=S,n;let g=r.charCodeAt(p);56320<=g&&g<=57343?l[n++]=1024*(S-55296)+g-56320+65536:(l[n++]=S,l[n++]=g)}else S!==65279&&(l[n++]=S)}return n}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(r,l){let _=r.length;if(!_)return 0;let n,f,p,S,g=0,a=0,d=0;if(this.interim[0]){let v=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,y=0;for(;(w=63&this.interim[++y])&&y<4;)C<<=6,C|=w;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=m-y;for(;d<x;){if(d>=_)return 0;if(w=r[d++],(192&w)!=128){d--,v=!0;break}this.interim[y++]=w,C<<=6,C|=63&w}v||(m===2?C<128?d--:l[g++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(l[g++]=C):C<65536||C>1114111||(l[g++]=C)),this.interim.fill(0)}let o=_-4,u=d;for(;u<_;){for(;!(!(u<o)||128&(n=r[u])||128&(f=r[u+1])||128&(p=r[u+2])||128&(S=r[u+3]));)l[g++]=n,l[g++]=f,l[g++]=p,l[g++]=S,u+=4;if(n=r[u++],n<128)l[g++]=n;else if((224&n)==192){if(u>=_)return this.interim[0]=n,g;if(f=r[u++],(192&f)!=128){u--;continue}if(a=(31&n)<<6|63&f,a<128){u--;continue}l[g++]=a}else if((240&n)==224){if(u>=_)return this.interim[0]=n,g;if(f=r[u++],(192&f)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,g;if(p=r[u++],(192&p)!=128){u--;continue}if(a=(15&n)<<12|(63&f)<<6|63&p,a<2048||a>=55296&&a<=57343||a===65279)continue;l[g++]=a}else if((248&n)==240){if(u>=_)return this.interim[0]=n,g;if(f=r[u++],(192&f)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,g;if(p=r[u++],(192&p)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,this.interim[2]=p,g;if(S=r[u++],(192&S)!=128){u--;continue}if(a=(7&n)<<18|(63&f)<<12|(63&p)<<6|63&S,a<65536||a>1114111)continue;l[g++]=a}}return g}}},225:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;let l=r(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 p=0;p<_.length;++p)f.fill(0,_[p][0],_[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?f[p]:(function(S,g){let a,d=0,o=g.length-1;if(S<g[0][0]||S>g[o][1])return!1;for(;o>=d;)if(a=d+o>>1,S>g[a][1])d=a+1;else{if(!(S<g[a][0]))return!0;o=a-1}return!1})(p,n)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,S){let g=this.wcwidth(p),a=g===0&&S!==0;if(a){let d=l.UnicodeService.extractWidth(S);d===0?a=!1:d>g&&(g=d)}return l.UnicodeService.createPropertyValue(0,g,a)}}},5981:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;let l=r(8460),_=r(844);class n extends _.Disposable{constructor(p){super(),this._action=p,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(p,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let g;for(this._isSyncWriting=!0;g=this._writeBuffer.shift();){this._action(g);let a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,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+=p.length,this._writeBuffer.push(p),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(S)}_innerWrite(p=0,S=!0){let g=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let a=this._writeBuffer[this._bufferOffset],d=this._action(a,S);if(d){let u=v=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(g,v);return void d.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()-g>=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 r=/^([\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 p=n.toString(16),S=p.length<2?"0"+p:p;switch(f){case 4:return p[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}i.parseColor=function(n){if(!n)return;let f=n.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);let p=r.exec(f);if(p){let S=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/S*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/S*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/S*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),l.exec(f)&&[3,6,9,12].includes(f.length))){let p=f.length/3,S=[0,0,0];for(let g=0;g<3;++g){let a=parseInt(f.slice(p*g,p*g+p),16);S[g]=p===1?a<<4:p===2?a:p===3?a>>4:a>>8}return S}},i.toRgbString=function(n,f=16){let[p,S,g]=n;return`rgb:${_(p,f)}/${_(S,f)}/${_(g,f)}`}},5770:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;let l=r(482),_=r(8742),n=r(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(S,g){this._handlers[S]===void 0&&(this._handlers[S]=[]);let a=this._handlers[S];return a.push(g),{dispose:()=>{let d=a.indexOf(g);d!==-1&&a.splice(d,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(S,g){if(this.reset(),this._ident=S,this._active=this._handlers[S]||f,this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].hook(g);else this._handlerFb(this._ident,"HOOK",g)}put(S,g,a){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(S,g,a);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(S,g,a))}unhook(S,g=!0){if(this._active.length){let a=!1,d=this._active.length-1,o=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,a=g,o=this._stack.fallThrough,this._stack.paused=!1),!o&&a===!1){for(;d>=0&&(a=this._active[d].unhook(S),a!==!0);d--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,a;d--}for(;d>=0;d--)if(a=this._active[d].unhook(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",S);this._active=f,this._ident=0}};let p=new _.Params;p.addParam(0),i.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=p,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():p,this._data="",this._hitLimit=!1}put(S,g,a){this._hitLimit||(this._data+=(0,l.utf32ToString)(S,g,a),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let g=!1;if(this._hitLimit)g=!1;else if(S&&(g=this._handler(this._data,this._params),g instanceof Promise))return g.then((a=>(this._params=p,this._data="",this._hitLimit=!1,a)));return this._params=p,this._data="",this._hitLimit=!1,g}}},2015:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;let l=r(844),_=r(8742),n=r(6242),f=r(6351);class p{constructor(d){this.table=new Uint8Array(d)}setDefault(d,o){this.table.fill(d<<4|o)}add(d,o,u,v){this.table[o<<8|d]=u<<4|v}addMany(d,o,u,v){for(let C=0;C<d.length;C++)this.table[o<<8|d[C]]=u<<4|v}}i.TransitionTable=p;let S=160;i.VT500_TRANSITION_TABLE=(function(){let a=new p(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),o=(y,m)=>d.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),w;for(w in a.setDefault(1,0),a.addMany(u,0,2,0),C)a.addMany([24,26,153,154],w,3,0),a.addMany(o(128,144),w,3,0),a.addMany(o(144,152),w,3,0),a.add(156,w,0,0),a.add(27,w,11,1),a.add(157,w,4,8),a.addMany([152,158,159],w,0,7),a.add(155,w,11,3),a.add(144,w,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(S,0,2,0),a.add(S,8,5,8),a.add(S,6,0,6),a.add(S,11,0,11),a.add(S,13,13,13),a})();class g extends l.Disposable{constructor(d=i.VT500_TRANSITION_TABLE){super(),this._transitions=d,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(d,o=[64,126]){let u=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=d.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<d.intermediates.length;++C){let w=d.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");let v=d.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(d){let o=[];for(;d;)o.push(String.fromCharCode(255&d)),d>>=8;return o.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,o){let u=this._identifier(d,[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(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,o){this._executeHandlers[d.charCodeAt(0)]=o}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,o){let u=this._identifier(d);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(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,o){return this._dcsParser.registerHandler(this._identifier(d),o)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,o){return this._oscParser.registerHandler(d,o)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}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(d,o,u,v,C){this._parseStack.state=d,this._parseStack.handlers=o,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=C}parse(d,o,u){let v,C=0,w=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=d[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=d[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=d[m],w=this._transitions.table[this.currentState<<8|(C<160?C:S)],w>>4){case 2:for(let M=m+1;;++M){if(M>=o||(C=d[M])<32||C>126&&C<S){this._printHandler(d,m,M),m=M-1;break}if(++M>=o||(C=d[M])<32||C>126&&C<S){this._printHandler(d,m,M),m=M-1;break}if(++M>=o||(C=d[M])<32||C>126&&C<S){this._printHandler(d,m,M),m=M-1;break}if(++M>=o||(C=d[M])<32||C>126&&C<S){this._printHandler(d,m,M),m=M-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],D=x?x.length-1:-1;for(;D>=0&&(v=x[D](this._params),v!==!0);D--)if(v instanceof Promise)return this._preserveStack(3,x,D,w,m),v;D<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=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let I=this._escHandlers[this._collect<<8|C],H=I?I.length-1:-1;for(;H>=0&&(v=I[H](),v!==!0);H--)if(v instanceof Promise)return this._preserveStack(4,I,H,w,m),v;H<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 M=m+1;;++M)if(M>=o||(C=d[M])===24||C===26||C===27||C>127&&C<S){this._dcsParser.put(d,m,M),m=M-1;break}break;case 14:if(v=this._dcsParser.unhook(C!==24&&C!==26),v)return this._preserveStack(6,[],0,w,m),v;C===27&&(w|=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 M=m+1;;M++)if(M>=o||(C=d[M])<32||C>127&&C<S){this._oscParser.put(d,m,M),m=M-1;break}break;case 6:if(v=this._oscParser.end(C!==24&&C!==26),v)return this._preserveStack(5,[],0,w,m),v;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}i.EscapeSequenceParser=g},6242:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;let l=r(5770),_=r(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,p){this._handlers[f]===void 0&&(this._handlers[f]=[]);let S=this._handlers[f];return S.push(p),{dispose:()=>{let g=S.indexOf(p);g!==-1&&S.splice(g,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,p,S){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(f,p,S);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(f,p,S))}start(){this.reset(),this._state=1}put(f,p,S){if(this._state!==3){if(this._state===1)for(;p<S;){let g=f[p++];if(g===59){this._state=2,this._start();break}if(g<48||57<g)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+g-48}this._state===2&&S-p>0&&this._put(f,p,S)}}end(f,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,g=this._active.length-1,a=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,S=p,a=this._stack.fallThrough,this._stack.paused=!1),!a&&S===!1){for(;g>=0&&(S=this._active[g].end(f),S!==!0);g--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,S;g--}for(;g>=0;g--)if(S=this._active[g].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,S}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,p,S){this._hitLimit||(this._data+=(0,_.utf32ToString)(f,p,S),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let p=!1;if(this._hitLimit)p=!1;else if(f&&(p=this._handler(this._data),p instanceof Promise))return p.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,p}}},8742:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;let r=2147483647;class l{static fromArray(n){let f=new l;if(!n.length)return f;for(let p=Array.isArray(n[0])?1:0;p<n.length;++p){let S=n[p];if(Array.isArray(S))for(let g=0;g<S.length;++g)f.addSubParam(S[g]);else f.addParam(S)}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 p=this._subParamsIdx[f]>>8,S=255&this._subParamsIdx[f];S-p>0&&n.push(Array.prototype.slice.call(this._subParams,p,S))}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>r?r: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>r?r: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,p=255&this._subParamsIdx[n];return p-f>0?this._subParams.subarray(f,p):null}getSubParamsAll(){let n={};for(let f=0;f<this.length;++f){let p=this._subParamsIdx[f]>>8,S=255&this._subParamsIdx[f];S-p>0&&(n[f]=this._subParams.slice(p,S))}return n}addDigit(n){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let p=this._digitIsSub?this._subParams:this.params,S=p[f-1];p[f-1]=~S?Math.min(10*S+n,r):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 r=this._addons.length-1;r>=0;r--)this._addons[r].instance.dispose()}loadAddon(r,l){let _={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(_),l.dispose=()=>this._wrappedAddonDispose(_),l.activate(r)}_wrappedAddonDispose(r){if(r.isDisposed)return;let l=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===r){l=_;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");r.isDisposed=!0,r.dispose.apply(r.instance),this._addons.splice(l,1)}}},8771:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;let l=r(3785),_=r(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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;let l=r(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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;let l=r(8771),_=r(8460),n=r(844);class f extends n.Disposable{constructor(S){super(),this._core=S,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(r){this._core=r}registerCsiHandler(r,l){return this._core.registerCsiHandler(r,(_=>l(_.toArray())))}addCsiHandler(r,l){return this.registerCsiHandler(r,l)}registerDcsHandler(r,l){return this._core.registerDcsHandler(r,((_,n)=>l(_,n.toArray())))}addDcsHandler(r,l){return this.registerDcsHandler(r,l)}registerEscHandler(r,l){return this._core.registerEscHandler(r,l)}addEscHandler(r,l){return this.registerEscHandler(r,l)}registerOscHandler(r,l){return this._core.registerOscHandler(r,l)}addOscHandler(r,l){return this.registerOscHandler(r,l)}}},7090:(h,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.UnicodeApi=class{constructor(r){this._core=r}register(r){this._core.unicodeService.register(r)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(r){this._core.unicodeService.activeVersion=r}}},744:function(h,i,r){var l=this&&this.__decorate||function(a,d,o,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(a,d,o,u);else for(var y=a.length-1;y>=0;y--)(v=a[y])&&(w=(C<3?v(w):C>3?v(d,o,w):v(d,o))||w);return C>3&&w&&Object.defineProperty(d,o,w),w},_=this&&this.__param||function(a,d){return function(o,u){d(o,u,a)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;let n=r(8460),f=r(844),p=r(5295),S=r(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let g=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 p.BufferSet(a,this))}resize(a,d){this.cols=a,this.rows=d,this.buffers.resize(a,d),this._onResize.fire({cols:a,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(a,d=!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,d),this._cachedBlankLine=u),u.isWrapped=d;let v=o.ybase+o.scrollTop,C=o.ybase+o.scrollBottom;if(o.scrollTop===0){let w=o.lines.isFull;C===o.lines.length-1?w?o.lines.recycle().copyFrom(u):o.lines.push(u.clone()):o.lines.splice(C+1,0,u.clone()),w?this.isUserScrolling&&(o.ydisp=Math.max(o.ydisp-1,0)):(o.ybase++,this.isUserScrolling||o.ydisp++)}else{let w=C-v+1;o.lines.shiftElements(v+1,w-1,-1),o.lines.set(C,u.clone())}this.isUserScrolling||(o.ydisp=o.ybase),this._onScroll.fire(o.ydisp)}scrollLines(a,d,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&&(d||this._onScroll.fire(u.ydisp))}};i.BufferService=g=l([_(0,S.IOptionsService)],g)},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(r){this.glevel=r,this.charset=this._charsets[r]}setgCharset(r,l){this._charsets[r]=l,this.glevel===r&&(this.charset=l)}}},1753:function(h,i,r){var l=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var D=u.length-1;D>=0;D--)(y=u[D])&&(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,w){v(C,w,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;let n=r(2585),f=r(8460),p=r(844),S={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 g(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,d={DEFAULT:u=>{let v=[g(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[<${g(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.x};${u.y}${v}`}},o=i.CoreMouseService=class extends p.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(S))this.addProtocol(C,S[C]);for(let C of Object.keys(d))this.addEncoding(C,d[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,r){var l=this&&this.__decorate||function(o,u,v,C){var w,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--)(w=o[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(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=r(1439),f=r(8460),p=r(844),S=r(2585),g=Object.freeze({insertMode:!1}),a=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=i.CoreService=class extends p.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)(g),this.decPrivateModes=(0,n.clone)(a)}reset(){this.modes=(0,n.clone)(g),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=d=l([_(0,S.IBufferService),_(1,S.ILogService),_(2,S.IOptionsService)],d)},9074:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;let l=r(8055),_=r(8460),n=r(844),f=r(6106),p=0,S=0;class g 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,w=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,w=C+(y.options.width??1),o>=C&&o<w&&(!v||(y.options.layer??"bottom")===v)&&(yield y)}forEachDecorationAtCell(o,u,v,C){this._decorations.forEachByKey(u,(w=>{p=w.options.x??0,S=p+(w.options.width??1),o>=p&&o<S&&(!v||(w.options.layer??"bottom")===v)&&C(w)}))}}i.DecorationService=g;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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;let l=r(2585),_=r(8343);class n{constructor(...p){this._entries=new Map;for(let[S,g]of p)this.set(S,g)}set(p,S){let g=this._entries.get(p);return this._entries.set(p,S),g}forEach(p){for(let[S,g]of this._entries.entries())p(S,g)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}i.ServiceCollection=n,i.InstantiationService=class{constructor(){this._services=new n,this._services.set(l.IInstantiationService,this)}setService(f,p){this._services.set(f,p)}getService(f){return this._services.get(f)}createInstance(f,...p){let S=(0,_.getServiceDependencies)(f).sort(((d,o)=>d.index-o.index)),g=[];for(let d of S){let o=this._services.get(d.id);if(!o)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${d.id}.`);g.push(o)}let a=S.length>0?S[0].index:p.length;if(p.length!==a)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${a+1} conflicts with ${p.length} static arguments`);return new f(...p,...g)}}},7866:function(h,i,r){var l=this&&this.__decorate||function(a,d,o,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(a,d,o,u);else for(var y=a.length-1;y>=0;y--)(v=a[y])&&(w=(C<3?v(w):C>3?v(d,o,w):v(d,o))||w);return C>3&&w&&Object.defineProperty(d,o,w),w},_=this&&this.__param||function(a,d){return function(o,u){d(o,u,a)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;let n=r(844),f=r(2585),p={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF},S,g=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()))),S=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let d=0;d<a.length;d++)typeof a[d]=="function"&&(a[d]=a[d]())}_log(a,d,o){this._evalLazyOptionalParams(o),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...o)}trace(a,...d){this._logLevel<=f.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,a,d)}debug(a,...d){this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,a,d)}info(a,...d){this._logLevel<=f.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,a,d)}warn(a,...d){this._logLevel<=f.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,a,d)}error(a,...d){this._logLevel<=f.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,a,d)}};i.LogService=g=l([_(0,f.IOptionsService)],g),i.setTraceLogger=function(a){S=a},i.traceCall=function(a,d,o){if(typeof o.value!="function")throw new Error("not supported");let u=o.value;o.value=function(...v){if(S.logLevel!==f.LogLevelEnum.TRACE)return u.apply(this,v);S.trace(`GlyphRenderer#${u.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);let C=u.apply(this,v);return S.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(h,i,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;let l=r(8460),_=r(844),n=r(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 p extends _.Disposable{constructor(g){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;let a={...i.DEFAULT_OPTIONS};for(let d in g)if(d in a)try{let o=g[d];a[d]=this._sanitizeAndValidateOption(d,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(g,a){return this.onOptionChange((d=>{d===g&&a(this.rawOptions[g])}))}onMultipleOptionChange(g,a){return this.onOptionChange((d=>{g.indexOf(d)!==-1&&a()}))}_setupOptions(){let g=d=>{if(!(d in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},a=(d,o)=>{if(!(d in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);o=this._sanitizeAndValidateOption(d,o),this.rawOptions[d]!==o&&(this.rawOptions[d]=o,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let o={get:g.bind(this,d),set:a.bind(this,d)};Object.defineProperty(this.options,d,o)}}_sanitizeAndValidateOption(g,a){switch(g){case"cursorStyle":if(a||(a=i.DEFAULT_OPTIONS[g]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(a))throw new Error(`"${a}" is not a valid value for ${g}`);break;case"wordSeparator":a||(a=i.DEFAULT_OPTIONS[g]);break;case"fontWeight":case"fontWeightBold":if(typeof a=="number"&&1<=a&&a<=1e3)break;a=f.includes(a)?a:i.DEFAULT_OPTIONS[g];break;case"cursorWidth":a=Math.floor(a);case"lineHeight":case"tabStopWidth":if(a<1)throw new Error(`${g} 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(`${g} cannot be less than 0, value: ${a}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(a<=0)throw new Error(`${g} cannot be less than or equal to 0, value: ${a}`);break;case"rows":case"cols":if(!a&&a!==0)throw new Error(`${g} must be numeric, value: ${a}`);break;case"windowsPty":a=a??{}}return a}}i.OptionsService=p},2660:function(h,i,r){var l=this&&this.__decorate||function(p,S,g,a){var d,o=arguments.length,u=o<3?S:a===null?a=Object.getOwnPropertyDescriptor(S,g):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(p,S,g,a);else for(var v=p.length-1;v>=0;v--)(d=p[v])&&(u=(o<3?d(u):o>3?d(S,g,u):d(S,g))||u);return o>3&&u&&Object.defineProperty(S,g,u),u},_=this&&this.__param||function(p,S){return function(g,a){S(g,a,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;let n=r(2585),f=i.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){let S=this._bufferService.buffer;if(p.id===void 0){let v=S.addMarker(S.ybase+S.y),C={data:p,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(C,v))),this._dataByLinkId.set(C.id,C),C.id}let g=p,a=this._getEntryIdKey(g),d=this._entriesWithId.get(a);if(d)return this.addLineToLink(d.id,S.ybase+S.y),d.id;let o=S.addMarker(S.ybase+S.y),u={id:this._nextId++,key:this._getEntryIdKey(g),data:g,lines:[o]};return o.onDispose((()=>this._removeMarkerFromLink(u,o))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(p,S){let g=this._dataByLinkId.get(p);if(g&&g.lines.every((a=>a.line!==S))){let a=this._bufferService.buffer.addMarker(S);g.lines.push(a),a.onDispose((()=>this._removeMarkerFromLink(g,a)))}}getLinkData(p){return this._dataByLinkId.get(p)?.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,S){let g=p.lines.indexOf(S);g!==-1&&(p.lines.splice(g,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.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 r="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,p,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,a,d){a[r]===a?a[l].push({id:g,index:d}):(a[l]=[{id:g,index:d}],a[r]=a)})(n,f,S)};return n.toString=()=>_,i.serviceRegistry.set(_,n),n}},2585:(h,i,r)=>{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=r(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,r)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;let l=r(8460),_=r(225);class n{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,S,g=!1){return(16777215&p)<<3|(3&S)<<1|(g?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;let p=new _.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let S=0,g=0,a=p.length;for(let d=0;d<a;++d){let o=p.charCodeAt(d);if(55296<=o&&o<=56319){if(++d>=a)return S+this.wcwidth(o);let C=p.charCodeAt(d);56320<=C&&C<=57343?o=1024*(o-55296)+C-56320+65536:S+=this.wcwidth(C)}let u=this.charProperties(o,g),v=n.extractWidth(u);n.extractShouldJoin(u)&&(v-=n.extractWidth(g)),S+=v,g=u}return S}charProperties(p,S){return this._activeProvider.charProperties(p,S)}}i.UnicodeService=n}},t={};function s(h){var i=t[h];if(i!==void 0)return i.exports;var r=t[h]={exports:{}};return e[h].call(r.exports,r,r.exports,s),r.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;let i=s(9042),r=s(3236),l=s(844),_=s(5741),n=s(8285),f=s(7975),p=s(7090),S=["cols","rows"];class g extends l.Disposable{constructor(d){super(),this._core=this.register(new r.Terminal(d)),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(d){if(S.includes(d))throw new Error(`Option "${d}" 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 p.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 d=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:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:o,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let o in d)this._publicOptions[o]=d[o]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,o=!0){this._core.input(d,o)}resize(d,o){this._verifyIntegers(d,o),this._core.resize(d,o)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}attachCustomWheelEventHandler(d){this._core.attachCustomWheelEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){return this._checkProposedApi(),this._verifyPositiveIntegers(d.x??0,d.width??0,d.height??0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,o,u){this._verifyIntegers(d,o,u),this._core.select(d,o,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,o){this._verifyIntegers(d,o),this._core.selectLines(d,o)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,o){this._core.write(d,o)}writeln(d,o){this._core.write(d),this._core.write(`\r
9
- `,o)}paste(d){this._core.paste(d)}refresh(d,o){this._verifyIntegers(d,o),this._core.refresh(d,o)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return i}_verifyIntegers(...d){for(let o of d)if(o===1/0||isNaN(o)||o%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(let o of d)if(o&&(o===1/0||isNaN(o)||o%1!=0||o<0))throw new Error("This API only accepts positive integers")}}h.Terminal=g})(),c})()))});var wr=pr((fi,os)=>{(function(e,t){typeof fi=="object"&&typeof os=="object"?os.exports=t():typeof define=="function"&&define.amd?define([],t):typeof fi=="object"?fi.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(s){this._terminal=s}dispose(){}fit(){let s=this.proposeDimensions();if(!s||!this._terminal||isNaN(s.cols)||isNaN(s.rows))return;let c=this._terminal._core;this._terminal.rows===s.rows&&this._terminal.cols===s.cols||(c._renderService.clear(),this._terminal.resize(s.cols,s.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let s=this._terminal._core,c=s._renderService.dimensions;if(c.css.cell.width===0||c.css.cell.height===0)return;let h=this._terminal.options.scrollback===0?0:s.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),n=r-(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/c.css.cell.width)),rows:Math.max(1,Math.floor(n/c.css.cell.height))}}}})(),e})()))});var xo=gr(mr(),1),Eo=gr(wr(),1);var Go=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Sr.isErrorNoTelemetry(e)?new Sr(e.message+`
7
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(m){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.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 E=this._getMouseBufferCoords(m),P=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(P&&I&&E)&&this._areCoordsInSelection(E,P,I)}isCellInSelection(m,E){let P=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!P||!I)&&this._areCoordsInSelection([m,E],P,I)}_areCoordsInSelection(m,E,P){return m[1]>E[1]&&m[1]<P[1]||E[1]===P[1]&&m[1]===E[1]&&m[0]>=E[0]&&m[0]<P[0]||E[1]<P[1]&&m[1]===P[1]&&m[0]<P[0]||E[1]<P[1]&&m[1]===E[1]&&m[0]>=E[0]}_selectWordAtCursor(m,E){let P=this._linkifier.currentLink?.link?.range;if(P)return this._model.selectionStart=[P.start.x-1,P.start.y-1],this._model.selectionStartLength=(0,o.getRangeLength)(P,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let I=this._getMouseBufferCoords(m);return!!I&&(this._selectWordAt(I,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,E){this._model.clearSelection(),m=Math.max(m,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let E=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(m){let E=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],P=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=P?0:(E>P&&(E-=P),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(m){return d.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 E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let E=this._getMouseBufferCoords(m);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(m){return m.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let E=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 P=this._bufferService.buffer;if(this._model.selectionEnd[1]<P.lines.length){let I=P.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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 E=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let P=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(P&&P[0]!==void 0&&P[1]!==void 0){let I=(0,_.moveToCellSequence)(P[0]-1,P[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,P=!(!m||!E||m[0]===E[0]&&m[1]===E[1]);P?m&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,E,P)):this._oldHasSelection&&this._fireOnSelectionChange(m,E,P)}_fireOnSelectionChange(m,E,P){this._oldSelectionStart=m,this._oldSelectionEnd=E,this._oldHasSelection=P,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(m,E){let P=E;for(let I=0;E>=I;I++){let N=m.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?P--:N>1&&E!==I&&(P+=N-1)}return P}setSelection(m,E,P){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,E],this._model.selectionStartLength=P,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,E,P=!0,I=!0){if(m[0]>=this._bufferService.cols)return;let N=this._bufferService.buffer,R=N.lines.get(m[1]);if(!R)return;let U=N.translateBufferLineToString(m[1],!1),D=this._convertViewportColToCharacterIndex(R,m[0]),A=D,T=m[0]-D,B=0,S=0,L=0,k=0;if(U.charAt(D)===" "){for(;D>0&&U.charAt(D-1)===" ";)D--;for(;A<U.length&&U.charAt(A+1)===" ";)A++}else{let K=m[0],G=m[0];R.getWidth(K)===0&&(B++,K--),R.getWidth(G)===2&&(S++,G++);let W=R.getString(G).length;for(W>1&&(k+=W-1,A+=W-1);K>0&&D>0&&!this._isCharWordSeparator(R.loadCell(K-1,this._workCell));){R.loadCell(K-1,this._workCell);let O=this._workCell.getChars().length;this._workCell.getWidth()===0?(B++,K--):O>1&&(L+=O-1,D-=O-1),D--,K--}for(;G<R.length&&A+1<U.length&&!this._isCharWordSeparator(R.loadCell(G+1,this._workCell));){R.loadCell(G+1,this._workCell);let O=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,G++):O>1&&(k+=O-1,A+=O-1),A++,G++}}A++;let M=D+T-B+L,F=Math.min(this._bufferService.cols,A-D+B+S-L-k);if(E||U.slice(D,A).trim()!==""){if(P&&M===0&&R.getCodePoint(0)!==32){let K=N.lines.get(m[1]-1);if(K&&R.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let G=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(G){let W=this._bufferService.cols-G.start;M-=W,F+=W}}}if(I&&M+F===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){let K=N.lines.get(m[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let G=this._getWordAt([0,m[1]+1],!1,!1,!0);G&&(F+=G.length)}}return{start:M,length:F}}}_selectWordAt(m,E){let P=this._getWordAt(m,E);if(P){for(;P.start<0;)P.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[P.start,m[1]],this._model.selectionStartLength=P.length}}_selectToWordAt(m){let E=this._getWordAt(m,!0);if(E){let P=m[1];for(;E.start<0;)E.start+=this._bufferService.cols,P--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,P++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,P]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let E=this._bufferService.buffer.getWrappedRangeForLine(m),P={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,o.getRangeLength)(P,this._bufferService.cols)}};s.SelectionService=y=h([f(3,v.IBufferService),f(4,v.ICoreService),f(5,b.IMouseService),f(6,v.IOptionsService),f(7,b.IRenderService),f(8,b.ICoreBrowserService)],y)},4725:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;let h=r(8343);s.ICharSizeService=(0,h.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),s.IMouseService=(0,h.createDecorator)("MouseService"),s.IRenderService=(0,h.createDecorator)("RenderService"),s.ISelectionService=(0,h.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,h.createDecorator)("ThemeService"),s.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(c,s,r){var h=this&&this.__decorate||function(y,m,E,P){var I,N=arguments.length,R=N<3?m:P===null?P=Object.getOwnPropertyDescriptor(m,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,m,E,P);else for(var U=y.length-1;U>=0;U--)(I=y[U])&&(R=(N<3?I(R):N>3?I(m,E,R):I(m,E))||R);return N>3&&R&&Object.defineProperty(m,E,R),R},f=this&&this.__param||function(y,m){return function(E,P){m(E,P,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let n=r(7239),_=r(8055),p=r(8460),b=r(844),g=r(2585),l=_.css.toColor("#ffffff"),d=_.css.toColor("#000000"),o=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let y=[_.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")],m=[0,95,135,175,215,255];for(let E=0;E<216;E++){let P=m[E/36%6|0],I=m[E/6%6|0],N=m[E%6];y.push({css:_.channels.toCss(P,I,N),rgba:_.channels.toRgba(P,I,N)})}for(let E=0;E<24;E++){let P=8+10*E;y.push({css:_.channels.toCss(P,P,P),rgba:_.channels.toRgba(P,P,P)})}return y})());let C=s.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 p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:l,background:d,cursor:o,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:_.color.blend(d,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:_.color.blend(d,v),ansi:s.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=w(y.foreground,l),m.background=w(y.background,d),m.cursor=w(y.cursor,o),m.cursorAccent=w(y.cursorAccent,u),m.selectionBackgroundTransparent=w(y.selectionBackground,v),m.selectionBackgroundOpaque=_.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=w(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=_.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?w(y.selectionForeground,_.NULL_COLOR):void 0,m.selectionForeground===_.NULL_COLOR&&(m.selectionForeground=void 0),_.color.isOpaque(m.selectionBackgroundTransparent)&&(m.selectionBackgroundTransparent=_.color.opacity(m.selectionBackgroundTransparent,.3)),_.color.isOpaque(m.selectionInactiveBackgroundTransparent)&&(m.selectionInactiveBackgroundTransparent=_.color.opacity(m.selectionInactiveBackgroundTransparent,.3)),m.ansi=s.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=w(y.black,s.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=w(y.red,s.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=w(y.green,s.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=w(y.yellow,s.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=w(y.blue,s.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=w(y.magenta,s.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=w(y.cyan,s.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=w(y.white,s.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=w(y.brightBlack,s.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=w(y.brightRed,s.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=w(y.brightGreen,s.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=w(y.brightYellow,s.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=w(y.brightBlue,s.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=w(y.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=w(y.brightCyan,s.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=w(y.brightWhite,s.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let E=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let P=0;P<E;P++)m.ansi[P+16]=w(y.extendedAnsi[P],s.DEFAULT_ANSI_COLORS[P+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 w(y,m){if(y!==void 0)try{return _.css.toColor(y)}catch{}return m}s.ThemeService=C=h([f(0,g.IOptionsService)],C)},6349:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let h=r(8460),f=r(844);class n extends f.Disposable{constructor(p){super(),this._maxLength=p,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(p){if(this._maxLength===p)return;let b=new Array(p);for(let g=0;g<Math.min(p,this.length);g++)b[g]=this._array[this._getCyclicIndex(g)];this._array=b,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let b=this._length;b<p;b++)this._array[b]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,b){this._array[this._getCyclicIndex(p)]=b}push(p){this._array[this._getCyclicIndex(this._length)]=p,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(p,b,...g){if(b){for(let l=p;l<this._length-b;l++)this._array[this._getCyclicIndex(l)]=this._array[this._getCyclicIndex(l+b)];this._length-=b,this.onDeleteEmitter.fire({index:p,amount:b})}for(let l=this._length-1;l>=p;l--)this._array[this._getCyclicIndex(l+g.length)]=this._array[this._getCyclicIndex(l)];for(let l=0;l<g.length;l++)this._array[this._getCyclicIndex(p+l)]=g[l];if(g.length&&this.onInsertEmitter.fire({index:p,amount:g.length}),this._length+g.length>this._maxLength){let l=this._length+g.length-this._maxLength;this._startIndex+=l,this._length=this._maxLength,this.onTrimEmitter.fire(l)}else this._length+=g.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,b,g){if(!(b<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let d=b-1;d>=0;d--)this.set(p+d+g,this.get(p+d));let l=p+b+g-this._length;if(l>0)for(this._length+=l;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let l=0;l<b;l++)this.set(p+l+g,this.get(p+l))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}s.CircularList=n},1439:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function r(h,f=5){if(typeof h!="object")return h;let n=Array.isArray(h)?[]:{};for(let _ in h)n[_]=f<=1?h[_]:h[_]&&r(h[_],f-1);return n}},8055:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let r=0,h=0,f=0,n=0;var _,p,b,g,l;function d(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)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(v,C,w,y){return y!==void 0?`#${d(v)}${d(C)}${d(w)}${d(y)}`:`#${d(v)}${d(C)}${d(w)}`},u.toRgba=function(v,C,w,y=255){return(v<<24|C<<16|w<<8|y)>>>0},u.toColor=function(v,C,w,y){return{css:u.toCss(v,C,w,y),rgba:u.toRgba(v,C,w,y)}}})(_||(s.channels=_={})),(function(u){function v(C,w){return n=Math.round(255*w),[r,h,f]=l.toChannels(C.rgba),{css:_.toCss(r,h,f,n),rgba:_.toRgba(r,h,f,n)}}u.blend=function(C,w){if(n=(255&w.rgba)/255,n===1)return{css:w.css,rgba:w.rgba};let y=w.rgba>>24&255,m=w.rgba>>16&255,E=w.rgba>>8&255,P=C.rgba>>24&255,I=C.rgba>>16&255,N=C.rgba>>8&255;return r=P+Math.round((y-P)*n),h=I+Math.round((m-I)*n),f=N+Math.round((E-N)*n),{css:_.toCss(r,h,f),rgba:_.toRgba(r,h,f)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,w,y){let m=l.ensureContrastRatio(C.rgba,w.rgba,y);if(m)return _.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let w=(255|C.rgba)>>>0;return[r,h,f]=l.toChannels(w),{css:_.toCss(r,h,f),rgba:w}},u.opacity=v,u.multiplyOpacity=function(C,w){return n=255&C.rgba,v(C,n*w/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(p||(s.color=p={})),(function(u){let v,C;try{let w=document.createElement("canvas");w.width=1,w.height=1;let y=w.getContext("2d",{willReadFrequently:!0});y&&(v=y,v.globalCompositeOperation="copy",C=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(w){if(w.match(/#[\da-f]{3,8}/i))switch(w.length){case 4:return r=parseInt(w.slice(1,2).repeat(2),16),h=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),_.toColor(r,h,f);case 5:return r=parseInt(w.slice(1,2).repeat(2),16),h=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),n=parseInt(w.slice(4,5).repeat(2),16),_.toColor(r,h,f,n);case 7:return{css:w,rgba:(parseInt(w.slice(1),16)<<8|255)>>>0};case 9:return{css:w,rgba:parseInt(w.slice(1),16)>>>0}}let y=w.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 r=parseInt(y[1]),h=parseInt(y[2]),f=parseInt(y[3]),n=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),_.toColor(r,h,f,n);if(!v||!C)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=C,v.fillStyle=w,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[r,h,f,n]=v.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(r,h,f,n),css:w}}})(b||(s.css=b={})),(function(u){function v(C,w,y){let m=C/255,E=w/255,P=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(P<=.03928?P/12.92:Math.pow((P+.055)/1.055,2.4))}u.relativeLuminance=function(C){return v(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=v})(g||(s.rgb=g={})),(function(u){function v(w,y,m){let E=w>>24&255,P=w>>16&255,I=w>>8&255,N=y>>24&255,R=y>>16&255,U=y>>8&255,D=o(g.relativeLuminance2(N,R,U),g.relativeLuminance2(E,P,I));for(;D<m&&(N>0||R>0||U>0);)N-=Math.max(0,Math.ceil(.1*N)),R-=Math.max(0,Math.ceil(.1*R)),U-=Math.max(0,Math.ceil(.1*U)),D=o(g.relativeLuminance2(N,R,U),g.relativeLuminance2(E,P,I));return(N<<24|R<<16|U<<8|255)>>>0}function C(w,y,m){let E=w>>24&255,P=w>>16&255,I=w>>8&255,N=y>>24&255,R=y>>16&255,U=y>>8&255,D=o(g.relativeLuminance2(N,R,U),g.relativeLuminance2(E,P,I));for(;D<m&&(N<255||R<255||U<255);)N=Math.min(255,N+Math.ceil(.1*(255-N))),R=Math.min(255,R+Math.ceil(.1*(255-R))),U=Math.min(255,U+Math.ceil(.1*(255-U))),D=o(g.relativeLuminance2(N,R,U),g.relativeLuminance2(E,P,I));return(N<<24|R<<16|U<<8|255)>>>0}u.blend=function(w,y){if(n=(255&y)/255,n===1)return y;let m=y>>24&255,E=y>>16&255,P=y>>8&255,I=w>>24&255,N=w>>16&255,R=w>>8&255;return r=I+Math.round((m-I)*n),h=N+Math.round((E-N)*n),f=R+Math.round((P-R)*n),_.toRgba(r,h,f)},u.ensureContrastRatio=function(w,y,m){let E=g.relativeLuminance(w>>8),P=g.relativeLuminance(y>>8);if(o(E,P)<m){if(P<E){let R=v(w,y,m),U=o(E,g.relativeLuminance(R>>8));if(U<m){let D=C(w,y,m);return U>o(E,g.relativeLuminance(D>>8))?R:D}return R}let I=C(w,y,m),N=o(E,g.relativeLuminance(I>>8));if(N<m){let R=v(w,y,m);return N>o(E,g.relativeLuminance(R>>8))?I:R}return I}},u.reduceLuminance=v,u.increaseLuminance=C,u.toChannels=function(w){return[w>>24&255,w>>16&255,w>>8&255,255&w]}})(l||(s.rgba=l={})),s.toPaddedHex=d,s.contrastRatio=o},8969:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let h=r(844),f=r(2585),n=r(4348),_=r(7866),p=r(744),b=r(7302),g=r(6975),l=r(8460),d=r(1753),o=r(1480),u=r(7994),v=r(9282),C=r(5435),w=r(5981),y=r(2660),m=!1;class E extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new l.EventEmitter),this._onScroll.event((I=>{this._onScrollApi?.fire(I.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(I){for(let N in I)this.optionsService.options[N]=I[N]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new l.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new l.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new l.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new l.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new b.OptionsService(I)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.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(g.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(o.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(y.OscLinkService),this._instantiationService.setService(f.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,l.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,l.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,l.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,l.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((N=>{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((N=>{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 w.WriteBuffer(((N,R)=>this._inputHandler.parse(N,R)))),this.register((0,l.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,N){this._writeBuffer.write(I,N)}writeSync(I,N){this._logService.logLevel<=f.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(I,N)}input(I,N=!0){this.coreService.triggerDataEvent(I,N)}resize(I,N){isNaN(I)||isNaN(N)||(I=Math.max(I,p.MINIMUM_COLS),N=Math.max(N,p.MINIMUM_ROWS),this._bufferService.resize(I,N))}scroll(I,N=!1){this._bufferService.scroll(I,N)}scrollLines(I,N,R){this._bufferService.scrollLines(I,N,R)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){let N=I-this._bufferService.buffer.ydisp;N!==0&&this.scrollLines(N)}registerEscHandler(I,N){return this._inputHandler.registerEscHandler(I,N)}registerDcsHandler(I,N){return this._inputHandler.registerDcsHandler(I,N)}registerCsiHandler(I,N){return this._inputHandler.registerCsiHandler(I,N)}registerOscHandler(I,N){return this._inputHandler.registerOscHandler(I,N)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1,N=this.optionsService.rawOptions.windowsPty;N&&N.buildNumber!==void 0&&N.buildNumber!==void 0?I=N.backend==="conpty"&&N.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let I=[];I.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(let N of I)N.dispose()}))}}}s.CoreTerminal=E},8460:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=r=>(this._listeners.push(r),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===r)return void this._listeners.splice(h,1)}}})),this._event}fire(r,h){let f=[];for(let n=0;n<this._listeners.length;n++)f.push(this._listeners[n]);for(let n=0;n<f.length;n++)f[n].call(void 0,r,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(r,h){return r((f=>h.fire(f)))},s.runAndSubscribe=function(r,h){return h(void 0),r((f=>h(f)))}},5435:function(c,s,r){var h=this&&this.__decorate||function(B,S,L,k){var M,F=arguments.length,K=F<3?S:k===null?k=Object.getOwnPropertyDescriptor(S,L):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(B,S,L,k);else for(var G=B.length-1;G>=0;G--)(M=B[G])&&(K=(F<3?M(K):F>3?M(S,L,K):M(S,L))||K);return F>3&&K&&Object.defineProperty(S,L,K),K},f=this&&this.__param||function(B,S){return function(L,k){S(L,k,B)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let n=r(2584),_=r(7116),p=r(2015),b=r(844),g=r(482),l=r(8437),d=r(8460),o=r(643),u=r(511),v=r(3734),C=r(2585),w=r(1480),y=r(6242),m=r(6351),E=r(5941),P={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function N(B,S){if(B>24)return S.setWinLines||!1;switch(B){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var R;(function(B){B[B.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",B[B.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(s.WindowsOptionsReportType=R={}));let U=0;class D extends b.Disposable{getAttrData(){return this._curAttrData}constructor(S,L,k,M,F,K,G,W,O=new p.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=L,this._coreService=k,this._logService=M,this._optionsService=F,this._oscLinkService=K,this._coreMouseService=G,this._unicodeService=W,this._parser=O,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.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 A(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((x=>this._activeBuffer=x.activeBuffer))),this._parser.setCsiHandlerFallback(((x,H)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:H.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,H,j)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:H,data:j})})),this._parser.setDcsHandlerFallback(((x,H,j)=>{H==="HOOK"&&(j=j.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:H,payload:j})})),this._parser.setPrintHandler(((x,H,j)=>this.print(x,H,j))),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(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((x=>(this.setTitle(x),this.setIconName(x),!0)))),this._parser.registerOscHandler(1,new y.OscHandler((x=>this.setIconName(x)))),this._parser.registerOscHandler(2,new y.OscHandler((x=>this.setTitle(x)))),this._parser.registerOscHandler(4,new y.OscHandler((x=>this.setOrReportIndexedColor(x)))),this._parser.registerOscHandler(8,new y.OscHandler((x=>this.setHyperlink(x)))),this._parser.registerOscHandler(10,new y.OscHandler((x=>this.setOrReportFgColor(x)))),this._parser.registerOscHandler(11,new y.OscHandler((x=>this.setOrReportBgColor(x)))),this._parser.registerOscHandler(12,new y.OscHandler((x=>this.setOrReportCursorColor(x)))),this._parser.registerOscHandler(104,new y.OscHandler((x=>this.restoreIndexedColor(x)))),this._parser.registerOscHandler(110,new y.OscHandler((x=>this.restoreFgColor(x)))),this._parser.registerOscHandler(111,new y.OscHandler((x=>this.restoreBgColor(x)))),this._parser.registerOscHandler(112,new y.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 m.DcsHandler(((x,H)=>this.requestStatusString(x,H))))}_preserveStack(S,L,k,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=k,this._parseStack.position=M}_logSlowResolvingAsync(S){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([S,new Promise(((L,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,L){let k,M=this._activeBuffer.x,F=this._activeBuffer.y,K=0,G=this._parseStack.paused;if(G){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(k),k;M=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>I&&(K=this._parseStack.position+I)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof S=="string"?` "${S}"`:` "${Array.prototype.map.call(S,(x=>String.fromCharCode(x))).join("")}"`),typeof S=="string"?S.split("").map((x=>x.charCodeAt(0))):S),this._parseBuffer.length<S.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(S.length,I))),G||this._dirtyRowTracker.clearRange(),S.length>I)for(let x=K;x<S.length;x+=I){let H=x+I<S.length?x+I:S.length,j=typeof S=="string"?this._stringDecoder.decode(S.substring(x,H),this._parseBuffer):this._utf8Decoder.decode(S.subarray(x,H),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,j))return this._preserveStack(M,F,j,x),this._logSlowResolvingAsync(k),k}else if(!G){let x=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,x))return this._preserveStack(M,F,x,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===M&&this._activeBuffer.y===F||this._onCursorMove.fire();let W=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),O=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);O<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(O,this._bufferService.rows-1),Math.min(W,this._bufferService.rows-1))}print(S,L,k){let M,F,K=this._charsetService.charset,G=this._optionsService.rawOptions.screenReaderMode,W=this._bufferService.cols,O=this._coreService.decPrivateModes.wraparound,x=this._coreService.modes.insertMode,H=this._curAttrData,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-L>0&&j.getWidth(this._activeBuffer.x-1)===2&&j.setCellFromCodepoint(this._activeBuffer.x-1,0,1,H);let $=this._parser.precedingJoinState;for(let q=L;q<k;++q){if(M=S[q],M<127&&K){let ie=K[String.fromCharCode(M)];ie&&(M=ie.charCodeAt(0))}let Y=this._unicodeService.charProperties(M,$);F=w.UnicodeService.extractWidth(Y);let te=w.UnicodeService.extractShouldJoin(Y),Q=te?w.UnicodeService.extractWidth($):0;if($=Y,G&&this._onA11yChar.fire((0,g.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-Q>W){if(O){let ie=j,Z=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),j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Q>0&&j instanceof l.BufferLine&&j.copyCellsFrom(ie,Z,0,Q,!1);Z<W;)ie.setCellFromCodepoint(Z++,0,1,H)}else if(this._activeBuffer.x=W-1,F===2)continue}if(te&&this._activeBuffer.x){let ie=j.getWidth(this._activeBuffer.x-1)?1:2;j.addCodepointToCell(this._activeBuffer.x-ie,M,F);for(let Z=F-Q;--Z>=0;)j.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}else if(x&&(j.insertCells(this._activeBuffer.x,F-Q,this._activeBuffer.getNullCell(H)),j.getWidth(W-1)===2&&j.setCellFromCodepoint(W-1,o.NULL_CELL_CODE,o.NULL_CELL_WIDTH,H)),j.setCellFromCodepoint(this._activeBuffer.x++,M,F,H),F>0)for(;--F;)j.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}this._parser.precedingJoinState=$,this._activeBuffer.x<W&&k-L>0&&j.getWidth(this._activeBuffer.x)===0&&!j.hasContent(this._activeBuffer.x)&&j.setCellFromCodepoint(this._activeBuffer.x,0,1,H),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,L){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,L):this._parser.registerCsiHandler(S,(k=>!N(k.params[0],this._optionsService.rawOptions.windowOptions)||L(k)))}registerDcsHandler(S,L){return this._parser.registerDcsHandler(S,new m.DcsHandler(L))}registerEscHandler(S,L){return this._parser.registerEscHandler(S,L)}registerOscHandler(S,L){return this._parser.registerOscHandler(S,new y.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);S.hasWidth(this._activeBuffer.x)&&!S.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-S),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(S=this._bufferService.cols-1){this._activeBuffer.x=Math.min(S,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(S,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=S,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+L)}cursorUp(S){let L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){let L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,S.params[0]||1)):this._moveCursor(0,S.params[0]||1),!0}cursorForward(S){return this._moveCursor(S.params[0]||1,0),!0}cursorBackward(S){return this._moveCursor(-(S.params[0]||1),0),!0}cursorNextLine(S){return this.cursorDown(S),this._activeBuffer.x=0,!0}cursorPrecedingLine(S){return this.cursorUp(S),this._activeBuffer.x=0,!0}cursorCharAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(S){return this._setCursor(S.length>=2?(S.params[1]||1)-1:0,(S.params[0]||1)-1),!0}charPosAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(S){return this._moveCursor(S.params[0]||1,0),!0}linePosAbsolute(S){return this._setCursor(this._activeBuffer.x,(S.params[0]||1)-1),!0}vPositionRelative(S){return this._moveCursor(0,S.params[0]||1),!0}hVPosition(S){return this.cursorPosition(S),!0}tabClear(S){let L=S.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=S.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=S.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){let L=S.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,L,k,M=!1,F=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);K.replaceCells(L,k,this._activeBuffer.getNullCell(this._eraseAttrData()),F),M&&(K.isWrapped=!1)}_resetBufferLine(S,L=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),k.isWrapped=!1)}eraseInDisplay(S,L=!1){let k;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);k<this._bufferService.rows;k++)this._resetBufferLine(k,L);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,L);this._dirtyRowTracker.markDirty(0);break;case 3:let M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(S,L=!1){switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(S){this._restrictCursor();let L=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;L--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(S){this._restrictCursor();let L=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;L--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(S){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(S){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(S){let L=S.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(S){let L=S.params[0]||1;for(;L--;)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(l.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(S.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(S){let L=this._parser.precedingJoinState;if(!L)return!0;let k=S.params[0]||1,M=w.UnicodeService.extractWidth(L),F=this._activeBuffer.x-M,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),G=new Uint32Array(K.length*k),W=0;for(let x=0;x<K.length;){let H=K.codePointAt(x)||0;G[W++]=H,x+=H>65535?2:1}let O=W;for(let x=1;x<k;++x)G.copyWithin(O,0,W),O+=W;return this.print(G,0,O),!0}sendDeviceAttributesPrimary(S){return S.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(S){return S.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(S.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(S){return(this._optionsService.rawOptions.termName+"").indexOf(S)===0}setMode(S){for(let L=0;L<S.length;L++)switch(S.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(S){for(let L=0;L<S.length;L++)switch(S.params[L]){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(S){for(let L=0;L<S.length;L++)switch(S.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(S){for(let L=0;L<S.length;L++)switch(S.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),S.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(S,L){let k=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:F}=this._coreMouseService,K=this._coreService,{buffers:G,cols:W}=this._bufferService,{active:O,alt:x}=G,H=this._optionsService.rawOptions,j=te=>te?1:2,$=S.params[0];return q=$,Y=L?$===2?4:$===4?j(K.modes.insertMode):$===12?3:$===20?j(H.convertEol):0:$===1?j(k.applicationCursorKeys):$===3?H.windowOptions.setWinLines?W===80?2:W===132?1:0:0:$===6?j(k.origin):$===7?j(k.wraparound):$===8?3:$===9?j(M==="X10"):$===12?j(H.cursorBlink):$===25?j(!K.isCursorHidden):$===45?j(k.reverseWraparound):$===66?j(k.applicationKeypad):$===67?4:$===1e3?j(M==="VT200"):$===1002?j(M==="DRAG"):$===1003?j(M==="ANY"):$===1004?j(k.sendFocus):$===1005?4:$===1006?j(F==="SGR"):$===1015?4:$===1016?j(F==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?j(O===x):$===2004?j(k.bracketedPasteMode):0,K.triggerDataEvent(`${n.C0.ESC}[${L?"":"?"}${q};${Y}$y`),!0;var q,Y}_updateAttrColor(S,L,k,M,F){return L===2?(S|=50331648,S&=-16777216,S|=v.AttributeData.fromColorRGB([k,M,F])):L===5&&(S&=-50331904,S|=33554432|255&k),S}_extractColor(S,L,k){let M=[0,0,-1,0,0,0],F=0,K=0;do{if(M[K+F]=S.params[L+K],S.hasSubParams(L+K)){let G=S.getSubParams(L+K),W=0;do M[1]===5&&(F=1),M[K+W+1+F]=G[W];while(++W<G.length&&W+K+1+F<M.length);break}if(M[1]===5&&K+F>=2||M[1]===2&&K+F>=5)break;M[1]&&(F=1)}while(++K+L<S.length&&K+F<M.length);for(let G=2;G<M.length;++G)M[G]===-1&&(M[G]=0);switch(M[0]){case 38:k.fg=this._updateAttrColor(k.fg,M[1],M[3],M[4],M[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,M[1],M[3],M[4],M[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,M[1],M[3],M[4],M[5])}return K}_processUnderline(S,L){L.extended=L.extended.clone(),(!~S||S>5)&&(S=1),L.extended.underlineStyle=S,L.fg|=268435456,S===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(S){S.fg=l.DEFAULT_ATTR_DATA.fg,S.bg=l.DEFAULT_ATTR_DATA.bg,S.extended=S.extended.clone(),S.extended.underlineStyle=0,S.extended.underlineColor&=-67108864,S.updateExtended()}charAttributes(S){if(S.length===1&&S.params[0]===0)return this._processSGR0(this._curAttrData),!0;let L=S.length,k,M=this._curAttrData;for(let F=0;F<L;F++)k=S.params[F],k>=30&&k<=37?(M.fg&=-50331904,M.fg|=16777216|k-30):k>=40&&k<=47?(M.bg&=-50331904,M.bg|=16777216|k-40):k>=90&&k<=97?(M.fg&=-50331904,M.fg|=16777224|k-90):k>=100&&k<=107?(M.bg&=-50331904,M.bg|=16777224|k-100):k===0?this._processSGR0(M):k===1?M.fg|=134217728:k===3?M.bg|=67108864:k===4?(M.fg|=268435456,this._processUnderline(S.hasSubParams(F)?S.getSubParams(F)[0]:1,M)):k===5?M.fg|=536870912:k===7?M.fg|=67108864:k===8?M.fg|=1073741824:k===9?M.fg|=2147483648:k===2?M.bg|=134217728:k===21?this._processUnderline(2,M):k===22?(M.fg&=-134217729,M.bg&=-134217729):k===23?M.bg&=-67108865:k===24?(M.fg&=-268435457,this._processUnderline(0,M)):k===25?M.fg&=-536870913:k===27?M.fg&=-67108865:k===28?M.fg&=-1073741825:k===29?M.fg&=2147483647:k===39?(M.fg&=-67108864,M.fg|=16777215&l.DEFAULT_ATTR_DATA.fg):k===49?(M.bg&=-67108864,M.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?F+=this._extractColor(S,F,M):k===53?M.bg|=1073741824:k===55?M.bg&=-1073741825:k===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):k===100?(M.fg&=-67108864,M.fg|=16777215&l.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let L=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${L};${k}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){let L=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${L};${k}R`)}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(S){let L=S.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let k=L%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(S){let L=S.params[0]||1,k;return(S.length<2||(k=S.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(S){if(!N(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;let L=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:L!==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:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(S){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(S){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(S){return this._windowTitle=S,this._onTitleChange.fire(S),!0}setIconName(S){return this._iconName=S,!0}setOrReportIndexedColor(S){let L=[],k=S.split(";");for(;k.length>1;){let M=k.shift(),F=k.shift();if(/^\d+$/.exec(M)){let K=parseInt(M);if(T(K))if(F==="?")L.push({type:0,index:K});else{let G=(0,E.parseColor)(F);G&&L.push({type:1,index:K,color:G})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(S){let L=S.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(S,L){this._getCurrentLinkId()&&this._finishHyperlink();let k=S.split(":"),M,F=k.findIndex((K=>K.startsWith("id=")));return F!==-1&&(M=k[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(S,L){let k=S.split(";");for(let M=0;M<k.length&&!(L>=this._specialColors.length);++M,++L)if(k[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{let F=(0,E.parseColor)(k[M]);F&&this._onColor.fire([{type:1,index:this._specialColors[L],color:F}])}return!0}setOrReportFgColor(S){return this._setOrReportSpecialColor(S,0)}setOrReportBgColor(S){return this._setOrReportSpecialColor(S,1)}setOrReportCursorColor(S){return this._setOrReportSpecialColor(S,2)}restoreIndexedColor(S){if(!S)return this._onColor.fire([{type:2}]),!0;let L=[],k=S.split(";");for(let M=0;M<k.length;++M)if(/^\d+$/.exec(k[M])){let F=parseInt(k[M]);T(F)&&L.push({type:2,index:F})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(S){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(S){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(S){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(S){return S.length!==2?(this.selectDefaultCharset(),!0):(S[0]==="/"||this._charsetService.setgCharset(P[S[0]],_.CHARSETS[S[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 S=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,S,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(S){return this._charsetService.setgLevel(S),!0}screenAlignmentPattern(){let S=new u.CellData;S.content=4194373,S.fg=this._curAttrData.fg,S.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){let k=this._activeBuffer.ybase+this._activeBuffer.y+L,M=this._activeBuffer.lines.get(k);M&&(M.fill(S),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,L){let k=this._bufferService.buffer,M=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${F}${n.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:S==="m"?"P1$r0m":S===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(S,L){this._dirtyRowTracker.markRangeDirty(S,L)}}s.InputHandler=D;let A=class{constructor(B){this._bufferService=B,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(B){B<this.start?this.start=B:B>this.end&&(this.end=B)}markRangeDirty(B,S){B>S&&(U=B,B=S,S=U),B<this.start&&(this.start=B),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function T(B){return 0<=B&&B<256}A=h([f(0,C.IBufferService)],A)},844:(c,s)=>{function r(h){for(let f of h)f.dispose();h.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.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)}},s.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}},s.toDisposable=function(h){return{dispose:h}},s.disposeArray=r,s.getDisposeArrayDisposable=function(h){return{dispose:()=>r(h)}}},1505:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class r{constructor(){this._data={}}set(f,n,_){this._data[f]||(this._data[f]={}),this._data[f][n]=_}get(f,n){return this._data[f]?this._data[f][n]:void 0}clear(){this._data={}}}s.TwoKeyMap=r,s.FourKeyMap=class{constructor(){this._data=new r}set(h,f,n,_,p){this._data.get(h,f)||this._data.set(h,f,new r),this._data.get(h,f).set(n,_,p)}get(h,f,n,_){return this._data.get(h,f)?.get(n,_)}clear(){this._data.clear()}}},6114:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;let r=s.isNode?"node":navigator.userAgent,h=s.isNode?"node":navigator.platform;s.isFirefox=r.includes("Firefox"),s.isLegacyEdge=r.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(r),s.getSafariVersion=function(){if(!s.isSafari)return 0;let f=r.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),s.isIpad=h==="iPad",s.isIphone=h==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),s.isLinux=h.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(r)},6106:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let r=0;s.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(r=this._search(this._getKey(h)),this._array.splice(r,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;let f=this._getKey(h);if(f===void 0||(r=this._search(f),r===-1)||this._getKey(this._array[r])!==f)return!1;do if(this._array[r]===h)return this._array.splice(r,1),!0;while(++r<this._array.length&&this._getKey(this._array[r])===f);return!1}*getKeyIterator(h){if(this._array.length!==0&&(r=this._search(h),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===h))do yield this._array[r];while(++r<this._array.length&&this._getKey(this._array[r])===h)}forEachByKey(h,f){if(this._array.length!==0&&(r=this._search(h),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===h))do f(this._array[r]);while(++r<this._array.length&&this._getKey(this._array[r])===h)}values(){return[...this._array].values()}_search(h){let f=0,n=this._array.length-1;for(;n>=f;){let _=f+n>>1,p=this._getKey(this._array[_]);if(p>h)n=_-1;else{if(!(p<h)){for(;_>0&&this._getKey(this._array[_-1])===h;)_--;return _}f=_+1}}return f}}},7226:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let h=r(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),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(p){this._idleCallback=void 0;let b=0,g=0,l=p.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(b=Date.now(),this._tasks[this._i]()||this._i++,b=Math.max(1,Date.now()-b),g=Math.max(b,g),d=p.timeRemaining(),1.5*g>d)return l-b<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(l-b))}ms`),void this._start();l=d}this.clear()}}class n extends f{_requestCallback(p){return setTimeout((()=>p(this._createDeadline(16))))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){let b=Date.now()+p;return{timeRemaining:()=>Math.max(0,b-Date.now())}}}s.PriorityTaskQueue=n,s.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let h=r(643);s.updateWindowsModeWrappedState=function(f){let n=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=n?.get(f.cols-1),p=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);p&&_&&(p.isWrapped=_[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&_[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class r{constructor(){this.fg=0,this.bg=0,this.extended=new h}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 r;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}}s.AttributeData=r;class h{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,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=h},9092:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let h=r(6349),f=r(7226),n=r(3734),_=r(8437),p=r(4634),b=r(511),g=r(643),l=r(4863),d=r(7116);s.MAX_BUFFER_SIZE=4294967295,s.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=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=b.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=b.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.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(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 _.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>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:u}fillViewportRows(o){if(this.lines.length===0){o===void 0&&(o=_.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 h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(o,u){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),C=0,w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),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 _.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 _.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(w<this.lines.maxLength){let m=this.lines.length-w;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=w}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,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,o,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(v.length>0){let C=(0,p.reflowLargerCreateNewLayout)(this.lines,v);(0,p.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(o,u,C.countRemoved)}}_reflowLargerAdjustViewport(o,u,v){let C=this.getNullCell(_.DEFAULT_ATTR_DATA),w=v;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new _.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(_.DEFAULT_ATTR_DATA),C=[],w=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 E=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),E.unshift(m);let P=this.ybase+this.y;if(P>=y&&P<y+E.length)continue;let I=E[E.length-1].getTrimmedLength(),N=(0,p.reflowSmallerGetNewLineLengths)(E,this._cols,o),R=N.length-E.length,U;U=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 D=[];for(let k=0;k<R;k++){let M=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);D.push(M)}D.length>0&&(C.push({start:y+E.length+w,newLines:D}),w+=D.length),E.push(...D);let A=N.length-1,T=N[A];T===0&&(A--,T=N[A]);let B=E.length-R-1,S=I;for(;B>=0;){let k=Math.min(S,T);if(E[A]===void 0)break;if(E[A].copyCellsFrom(E[B],S-k,T-k,k,!0),T-=k,T===0&&(A--,T=N[A]),S-=k,S===0){B--;let M=Math.max(B,0);S=(0,p.getWrappedLineTrimmedLength)(E,M,this._cols)}}for(let k=0;k<E.length;k++)N[k]<o&&E[k].setCell(N[k],v);let L=R-U;for(;L-- >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+w)-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 A=0;A<this.lines.length;A++)m.push(this.lines.get(A));let E=this.lines.length,P=E-1,I=0,N=C[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let R=0;for(let A=Math.min(this.lines.maxLength-1,E+w-1);A>=0;A--)if(N&&N.start>P+R){for(let T=N.newLines.length-1;T>=0;T--)this.lines.set(A--,N.newLines[T]);A++,y.push({index:P+1,amount:N.newLines.length}),R+=N.newLines.length,N=C[++I]}else this.lines.set(A,m[P--]);let U=0;for(let A=y.length-1;A>=0;A--)y[A].index+=U,this.lines.onInsertEmitter.fire(y[A]),U+=y[A].amount;let D=Math.max(0,E+w-this.lines.maxLength);D>0&&this.lines.onTrimEmitter.fire(D)}}translateBufferLineToString(o,u,v=0,C){let w=this.lines.get(o);return w?w.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 l.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:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let h=r(3734),f=r(511),n=r(643),_=r(482);s.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let p=0;class b{constructor(l,d,o=!1){this.isWrapped=o,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*l);let u=d||f.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let v=0;v<l;++v)this.setCell(v,u);this.length=l}get(l){let d=this._data[3*l+0],o=2097151&d;return[this._data[3*l+1],2097152&d?this._combined[l]:o?(0,_.stringFromCodePoint)(o):"",d>>22,2097152&d?this._combined[l].charCodeAt(this._combined[l].length-1):o]}set(l,d){this._data[3*l+1]=d[n.CHAR_DATA_ATTR_INDEX],d[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[l]=d[1],this._data[3*l+0]=2097152|l|d[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*l+0]=d[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(l){return this._data[3*l+0]>>22}hasWidth(l){return 12582912&this._data[3*l+0]}getFg(l){return this._data[3*l+1]}getBg(l){return this._data[3*l+2]}hasContent(l){return 4194303&this._data[3*l+0]}getCodePoint(l){let d=this._data[3*l+0];return 2097152&d?this._combined[l].charCodeAt(this._combined[l].length-1):2097151&d}isCombined(l){return 2097152&this._data[3*l+0]}getString(l){let d=this._data[3*l+0];return 2097152&d?this._combined[l]:2097151&d?(0,_.stringFromCodePoint)(2097151&d):""}isProtected(l){return 536870912&this._data[3*l+2]}loadCell(l,d){return p=3*l,d.content=this._data[p+0],d.fg=this._data[p+1],d.bg=this._data[p+2],2097152&d.content&&(d.combinedData=this._combined[l]),268435456&d.bg&&(d.extended=this._extendedAttrs[l]),d}setCell(l,d){2097152&d.content&&(this._combined[l]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[l]=d.extended),this._data[3*l+0]=d.content,this._data[3*l+1]=d.fg,this._data[3*l+2]=d.bg}setCellFromCodepoint(l,d,o,u){268435456&u.bg&&(this._extendedAttrs[l]=u.extended),this._data[3*l+0]=d|o<<22,this._data[3*l+1]=u.fg,this._data[3*l+2]=u.bg}addCodepointToCell(l,d,o){let u=this._data[3*l+0];2097152&u?this._combined[l]+=(0,_.stringFromCodePoint)(d):2097151&u?(this._combined[l]=(0,_.stringFromCodePoint)(2097151&u)+(0,_.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,o&&(u&=-12582913,u|=o<<22),this._data[3*l+0]=u}insertCells(l,d,o){if((l%=this.length)&&this.getWidth(l-1)===2&&this.setCellFromCodepoint(l-1,0,1,o),d<this.length-l){let u=new f.CellData;for(let v=this.length-l-d-1;v>=0;--v)this.setCell(l+d+v,this.loadCell(l+v,u));for(let v=0;v<d;++v)this.setCell(l+v,o)}else for(let u=l;u<this.length;++u)this.setCell(u,o);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,o)}deleteCells(l,d,o){if(l%=this.length,d<this.length-l){let u=new f.CellData;for(let v=0;v<this.length-l-d;++v)this.setCell(l+v,this.loadCell(l+d+v,u));for(let v=this.length-d;v<this.length;++v)this.setCell(v,o)}else for(let u=l;u<this.length;++u)this.setCell(u,o);l&&this.getWidth(l-1)===2&&this.setCellFromCodepoint(l-1,0,1,o),this.getWidth(l)!==0||this.hasContent(l)||this.setCellFromCodepoint(l,0,1,o)}replaceCells(l,d,o,u=!1){if(u)for(l&&this.getWidth(l-1)===2&&!this.isProtected(l-1)&&this.setCellFromCodepoint(l-1,0,1,o),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,o);l<d&&l<this.length;)this.isProtected(l)||this.setCell(l,o),l++;else for(l&&this.getWidth(l-1)===2&&this.setCellFromCodepoint(l-1,0,1,o),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,o);l<d&&l<this.length;)this.setCell(l++,o)}resize(l,d){if(l===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let o=3*l;if(l>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<l;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,o);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let w=parseInt(u[C],10);w>=l&&delete this._combined[w]}let v=Object.keys(this._extendedAttrs);for(let C=0;C<v.length;C++){let w=parseInt(v[C],10);w>=l&&delete this._extendedAttrs[w]}}return this.length=l,4*o*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let l=new Uint32Array(this._data.length);return l.set(this._data),this._data=l,1}return 0}fill(l,d=!1){if(d)for(let o=0;o<this.length;++o)this.isProtected(o)||this.setCell(o,l);else{this._combined={},this._extendedAttrs={};for(let o=0;o<this.length;++o)this.setCell(o,l)}}copyFrom(l){this.length!==l.length?this._data=new Uint32Array(l._data):this._data.set(l._data),this.length=l.length,this._combined={};for(let d in l._combined)this._combined[d]=l._combined[d];this._extendedAttrs={};for(let d in l._extendedAttrs)this._extendedAttrs[d]=l._extendedAttrs[d];this.isWrapped=l.isWrapped}clone(){let l=new b(0);l._data=new Uint32Array(this._data),l.length=this.length;for(let d in this._combined)l._combined[d]=this._combined[d];for(let d in this._extendedAttrs)l._extendedAttrs[d]=this._extendedAttrs[d];return l.isWrapped=this.isWrapped,l}getTrimmedLength(){for(let l=this.length-1;l>=0;--l)if(4194303&this._data[3*l+0])return l+(this._data[3*l+0]>>22);return 0}getNoBgTrimmedLength(){for(let l=this.length-1;l>=0;--l)if(4194303&this._data[3*l+0]||50331648&this._data[3*l+2])return l+(this._data[3*l+0]>>22);return 0}copyCellsFrom(l,d,o,u,v){let C=l._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*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[o+y]=l._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(o+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[o+y]=l._extendedAttrs[d+y])}let w=Object.keys(l._combined);for(let y=0;y<w.length;y++){let m=parseInt(w[y],10);m>=d&&(this._combined[m-d+o]=l._combined[m])}}translateToString(l,d,o,u){d=d??0,o=o??this.length,l&&(o=Math.min(o,this.getTrimmedLength())),u&&(u.length=0);let v="";for(;d<o;){let C=this._data[3*d+0],w=2097151&C,y=2097152&C?this._combined[d]:w?(0,_.stringFromCodePoint)(w):n.WHITESPACE_CELL_CHAR;if(v+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),v}}s.BufferLine=b},4841:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(r,h){if(r.start.y>r.end.y)throw new Error(`Buffer range end (${r.end.x}, ${r.end.y}) cannot be before start (${r.start.x}, ${r.start.y})`);return h*(r.end.y-r.start.y)+(r.end.x-r.start.x+1)}},4634:(c,s)=>{function r(h,f,n){if(f===h.length-1)return h[f].getTrimmedLength();let _=!h[f].hasContent(n-1)&&h[f].getWidth(n-1)===1,p=h[f+1].getWidth(0)===2;return _&&p?n-1:n}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(h,f,n,_,p){let b=[];for(let g=0;g<h.length-1;g++){let l=g,d=h.get(++l);if(!d.isWrapped)continue;let o=[h.get(g)];for(;l<h.length&&d.isWrapped;)o.push(d),d=h.get(++l);if(_>=g&&_<l){g+=o.length-1;continue}let u=0,v=r(o,u,f),C=1,w=0;for(;C<o.length;){let m=r(o,C,f),E=m-w,P=n-v,I=Math.min(E,P);o[u].copyCellsFrom(o[C],w,v,I,!1),v+=I,v===n&&(u++,v=0),w+=I,w===m&&(C++,w=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,p))}o[u].replaceCells(v,n,p);let y=0;for(let m=o.length-1;m>0&&(m>u||o[m].getTrimmedLength()===0);m--)y++;y>0&&(b.push(g+o.length-y),b.push(y)),g+=o.length-1}return b},s.reflowLargerCreateNewLayout=function(h,f){let n=[],_=0,p=f[_],b=0;for(let g=0;g<h.length;g++)if(p===g){let l=f[++_];h.onDeleteEmitter.fire({index:g-b,amount:l}),g+=l-1,b+=l,p=f[++_]}else n.push(g);return{layout:n,countRemoved:b}},s.reflowLargerApplyNewLayout=function(h,f){let n=[];for(let _=0;_<f.length;_++)n.push(h.get(f[_]));for(let _=0;_<n.length;_++)h.set(_,n[_]);h.length=f.length},s.reflowSmallerGetNewLineLengths=function(h,f,n){let _=[],p=h.map(((d,o)=>r(h,o,f))).reduce(((d,o)=>d+o)),b=0,g=0,l=0;for(;l<p;){if(p-l<n){_.push(p-l);break}b+=n;let d=r(h,g,f);b>d&&(b-=d,g++);let o=h[g].getWidth(b-1)===2;o&&b--;let u=o?n-1:n;_.push(u),l+=u}return _},s.getWrappedLineTrimmedLength=r},5295:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let h=r(8460),f=r(844),n=r(9092);class _ extends f.Disposable{constructor(b,g){super(),this._optionsService=b,this._bufferService=g,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 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,g){this._normal.resize(b,g),this._alt.resize(b,g),this.setupTabStops(b)}setupTabStops(b){this._normal.setupTabStops(b),this._alt.setupTabStops(b)}}s.BufferSet=_},511:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let h=r(482),f=r(643),n=r(3734);class _ 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 g=new _;return g.setFromCharData(b),g}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(b){this.fg=b[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(b[f.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(b[f.CHAR_DATA_CHAR_INDEX].length===2){let l=b[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=l&&l<=56319){let d=b[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(l-55296)+d-56320+65536|b[f.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=b[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[f.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=b[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|b[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=_},643:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let h=r(8460),f=r(844);class n{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=n._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(p){return this._disposables.push(p),p}}s.Marker=n,n._nextId=1},7116:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.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"},s.CHARSETS.A={"#":"\xA3"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},s.CHARSETS.C=s.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},s.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},s.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},s.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},s.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},s.CHARSETS.E=s.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},s.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},s.CHARSETS.H=s.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},s.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(c,s)=>{var r,h,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.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"})(r||(s.C0=r={})),(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"})(h||(s.C1=h={})),(function(n){n.ST=`${r.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let h=r(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:["'",'"']};s.evaluateKeyboardEvent=function(n,_,p,b){let g={type:0,cancel:!1,key:void 0},l=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?g.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?g.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?g.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(g.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:g.key=n.ctrlKey?"\b":h.C0.DEL,n.altKey&&(g.key=h.C0.ESC+g.key);break;case 9:if(n.shiftKey){g.key=h.C0.ESC+"[Z";break}g.key=h.C0.HT,g.cancel=!0;break;case 13:g.key=n.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,g.cancel=!0;break;case 27:g.key=h.C0.ESC,n.altKey&&(g.key=h.C0.ESC+h.C0.ESC),g.cancel=!0;break;case 37:if(n.metaKey)break;l?(g.key=h.C0.ESC+"[1;"+(l+1)+"D",g.key===h.C0.ESC+"[1;3D"&&(g.key=h.C0.ESC+(p?"b":"[1;5D"))):g.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(n.metaKey)break;l?(g.key=h.C0.ESC+"[1;"+(l+1)+"C",g.key===h.C0.ESC+"[1;3C"&&(g.key=h.C0.ESC+(p?"f":"[1;5C"))):g.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(n.metaKey)break;l?(g.key=h.C0.ESC+"[1;"+(l+1)+"A",p||g.key!==h.C0.ESC+"[1;3A"||(g.key=h.C0.ESC+"[1;5A")):g.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(n.metaKey)break;l?(g.key=h.C0.ESC+"[1;"+(l+1)+"B",p||g.key!==h.C0.ESC+"[1;3B"||(g.key=h.C0.ESC+"[1;5B")):g.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(g.key=h.C0.ESC+"[2~");break;case 46:g.key=l?h.C0.ESC+"[3;"+(l+1)+"~":h.C0.ESC+"[3~";break;case 36:g.key=l?h.C0.ESC+"[1;"+(l+1)+"H":_?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:g.key=l?h.C0.ESC+"[1;"+(l+1)+"F":_?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:n.shiftKey?g.type=2:n.ctrlKey?g.key=h.C0.ESC+"[5;"+(l+1)+"~":g.key=h.C0.ESC+"[5~";break;case 34:n.shiftKey?g.type=3:n.ctrlKey?g.key=h.C0.ESC+"[6;"+(l+1)+"~":g.key=h.C0.ESC+"[6~";break;case 112:g.key=l?h.C0.ESC+"[1;"+(l+1)+"P":h.C0.ESC+"OP";break;case 113:g.key=l?h.C0.ESC+"[1;"+(l+1)+"Q":h.C0.ESC+"OQ";break;case 114:g.key=l?h.C0.ESC+"[1;"+(l+1)+"R":h.C0.ESC+"OR";break;case 115:g.key=l?h.C0.ESC+"[1;"+(l+1)+"S":h.C0.ESC+"OS";break;case 116:g.key=l?h.C0.ESC+"[15;"+(l+1)+"~":h.C0.ESC+"[15~";break;case 117:g.key=l?h.C0.ESC+"[17;"+(l+1)+"~":h.C0.ESC+"[17~";break;case 118:g.key=l?h.C0.ESC+"[18;"+(l+1)+"~":h.C0.ESC+"[18~";break;case 119:g.key=l?h.C0.ESC+"[19;"+(l+1)+"~":h.C0.ESC+"[19~";break;case 120:g.key=l?h.C0.ESC+"[20;"+(l+1)+"~":h.C0.ESC+"[20~";break;case 121:g.key=l?h.C0.ESC+"[21;"+(l+1)+"~":h.C0.ESC+"[21~";break;case 122:g.key=l?h.C0.ESC+"[23;"+(l+1)+"~":h.C0.ESC+"[23~";break;case 123:g.key=l?h.C0.ESC+"[24;"+(l+1)+"~":h.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(p&&!b||!n.altKey||n.metaKey)!p||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?g.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(g.key=h.C0.US),n.key==="@"&&(g.key=h.C0.NUL)):n.keyCode===65&&(g.type=1);else{let d=f[n.keyCode],o=d?.[n.shiftKey?1:0];if(o)g.key=h.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()),g.key=h.C0.ESC+v}else if(n.keyCode===32)g.key=h.C0.ESC+(n.ctrlKey?h.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let u=n.code.slice(3,4);n.shiftKey||(u=u.toLowerCase()),g.key=h.C0.ESC+u,g.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?g.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?g.key=h.C0.NUL:n.keyCode>=51&&n.keyCode<=55?g.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?g.key=h.C0.DEL:n.keyCode===219?g.key=h.C0.ESC:n.keyCode===220?g.key=h.C0.FS:n.keyCode===221&&(g.key=h.C0.GS)}return g}},482:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(r){return r>65535?(r-=65536,String.fromCharCode(55296+(r>>10))+String.fromCharCode(r%1024+56320)):String.fromCharCode(r)},s.utf32ToString=function(r,h=0,f=r.length){let n="";for(let _=h;_<f;++_){let p=r[_];p>65535?(p-=65536,n+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):n+=String.fromCharCode(p)}return n},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(r,h){let f=r.length;if(!f)return 0;let n=0,_=0;if(this._interim){let p=r.charCodeAt(_++);56320<=p&&p<=57343?h[n++]=1024*(this._interim-55296)+p-56320+65536:(h[n++]=this._interim,h[n++]=p),this._interim=0}for(let p=_;p<f;++p){let b=r.charCodeAt(p);if(55296<=b&&b<=56319){if(++p>=f)return this._interim=b,n;let g=r.charCodeAt(p);56320<=g&&g<=57343?h[n++]=1024*(b-55296)+g-56320+65536:(h[n++]=b,h[n++]=g)}else b!==65279&&(h[n++]=b)}return n}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(r,h){let f=r.length;if(!f)return 0;let n,_,p,b,g=0,l=0,d=0;if(this.interim[0]){let v=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,y=0;for(;(w=63&this.interim[++y])&&y<4;)C<<=6,C|=w;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=m-y;for(;d<E;){if(d>=f)return 0;if(w=r[d++],(192&w)!=128){d--,v=!0;break}this.interim[y++]=w,C<<=6,C|=63&w}v||(m===2?C<128?d--:h[g++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(h[g++]=C):C<65536||C>1114111||(h[g++]=C)),this.interim.fill(0)}let o=f-4,u=d;for(;u<f;){for(;!(!(u<o)||128&(n=r[u])||128&(_=r[u+1])||128&(p=r[u+2])||128&(b=r[u+3]));)h[g++]=n,h[g++]=_,h[g++]=p,h[g++]=b,u+=4;if(n=r[u++],n<128)h[g++]=n;else if((224&n)==192){if(u>=f)return this.interim[0]=n,g;if(_=r[u++],(192&_)!=128){u--;continue}if(l=(31&n)<<6|63&_,l<128){u--;continue}h[g++]=l}else if((240&n)==224){if(u>=f)return this.interim[0]=n,g;if(_=r[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,g;if(p=r[u++],(192&p)!=128){u--;continue}if(l=(15&n)<<12|(63&_)<<6|63&p,l<2048||l>=55296&&l<=57343||l===65279)continue;h[g++]=l}else if((248&n)==240){if(u>=f)return this.interim[0]=n,g;if(_=r[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,g;if(p=r[u++],(192&p)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=p,g;if(b=r[u++],(192&b)!=128){u--;continue}if(l=(7&n)<<18|(63&_)<<12|(63&p)<<6|63&b,l<65536||l>1114111)continue;h[g++]=l}}return g}}},225:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let h=r(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],_;s.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 p=0;p<f.length;++p)_.fill(0,f[p][0],f[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?_[p]:(function(b,g){let l,d=0,o=g.length-1;if(b<g[0][0]||b>g[o][1])return!1;for(;o>=d;)if(l=d+o>>1,b>g[l][1])d=l+1;else{if(!(b<g[l][0]))return!0;o=l-1}return!1})(p,n)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,b){let g=this.wcwidth(p),l=g===0&&b!==0;if(l){let d=h.UnicodeService.extractWidth(b);d===0?l=!1:d>g&&(g=d)}return h.UnicodeService.createPropertyValue(0,g,l)}}},5981:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let h=r(8460),f=r(844);class n extends f.Disposable{constructor(p){super(),this._action=p,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(p,b){if(b!==void 0&&this._syncCalls>b)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let g;for(this._isSyncWriting=!0;g=this._writeBuffer.shift();){this._action(g);let l=this._callbacks.shift();l&&l()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,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+=p.length,this._writeBuffer.push(p),this._callbacks.push(b),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(b)}_innerWrite(p=0,b=!0){let g=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let l=this._writeBuffer[this._bufferOffset],d=this._action(l,b);if(d){let u=v=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(g,v);return void d.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(u)}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=l.length,Date.now()-g>=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()}}s.WriteBuffer=n},5941:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let r=/^([\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(n,_){let p=n.toString(16),b=p.length<2?"0"+p:p;switch(_){case 4:return p[0];case 8:return b;case 12:return(b+b).slice(0,3);default:return b+b}}s.parseColor=function(n){if(!n)return;let _=n.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let p=r.exec(_);if(p){let b=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/b*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/b*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/b*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),h.exec(_)&&[3,6,9,12].includes(_.length))){let p=_.length/3,b=[0,0,0];for(let g=0;g<3;++g){let l=parseInt(_.slice(p*g,p*g+p),16);b[g]=p===1?l<<4:p===2?l:p===3?l>>4:l>>8}return b}},s.toRgbString=function(n,_=16){let[p,b,g]=n;return`rgb:${f(p,_)}/${f(b,_)}/${f(g,_)}`}},5770:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let h=r(482),f=r(8742),n=r(5770),_=[];s.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(b,g){this._handlers[b]===void 0&&(this._handlers[b]=[]);let l=this._handlers[b];return l.push(g),{dispose:()=>{let d=l.indexOf(g);d!==-1&&l.splice(d,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=_,this._ident=0}hook(b,g){if(this.reset(),this._ident=b,this._active=this._handlers[b]||_,this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].hook(g);else this._handlerFb(this._ident,"HOOK",g)}put(b,g,l){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(b,g,l);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(b,g,l))}unhook(b,g=!0){if(this._active.length){let l=!1,d=this._active.length-1,o=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,l=g,o=this._stack.fallThrough,this._stack.paused=!1),!o&&l===!1){for(;d>=0&&(l=this._active[d].unhook(b),l!==!0);d--)if(l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,l;d--}for(;d>=0;d--)if(l=this._active[d].unhook(!1),l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,l}else this._handlerFb(this._ident,"UNHOOK",b);this._active=_,this._ident=0}};let p=new f.Params;p.addParam(0),s.DcsHandler=class{constructor(b){this._handler=b,this._data="",this._params=p,this._hitLimit=!1}hook(b){this._params=b.length>1||b.params[0]?b.clone():p,this._data="",this._hitLimit=!1}put(b,g,l){this._hitLimit||(this._data+=(0,h.utf32ToString)(b,g,l),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(b){let g=!1;if(this._hitLimit)g=!1;else if(b&&(g=this._handler(this._data,this._params),g instanceof Promise))return g.then((l=>(this._params=p,this._data="",this._hitLimit=!1,l)));return this._params=p,this._data="",this._hitLimit=!1,g}}},2015:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let h=r(844),f=r(8742),n=r(6242),_=r(6351);class p{constructor(d){this.table=new Uint8Array(d)}setDefault(d,o){this.table.fill(d<<4|o)}add(d,o,u,v){this.table[o<<8|d]=u<<4|v}addMany(d,o,u,v){for(let C=0;C<d.length;C++)this.table[o<<8|d[C]]=u<<4|v}}s.TransitionTable=p;let b=160;s.VT500_TRANSITION_TABLE=(function(){let l=new p(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),o=(y,m)=>d.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),w;for(w in l.setDefault(1,0),l.addMany(u,0,2,0),C)l.addMany([24,26,153,154],w,3,0),l.addMany(o(128,144),w,3,0),l.addMany(o(144,152),w,3,0),l.add(156,w,0,0),l.add(27,w,11,1),l.add(157,w,4,8),l.addMany([152,158,159],w,0,7),l.add(155,w,11,3),l.add(144,w,11,9);return l.addMany(v,0,3,0),l.addMany(v,1,3,1),l.add(127,1,0,1),l.addMany(v,8,0,8),l.addMany(v,3,3,3),l.add(127,3,0,3),l.addMany(v,4,3,4),l.add(127,4,0,4),l.addMany(v,6,3,6),l.addMany(v,5,3,5),l.add(127,5,0,5),l.addMany(v,2,3,2),l.add(127,2,0,2),l.add(93,1,4,8),l.addMany(u,8,5,8),l.add(127,8,5,8),l.addMany([156,27,24,26,7],8,6,0),l.addMany(o(28,32),8,0,8),l.addMany([88,94,95],1,0,7),l.addMany(u,7,0,7),l.addMany(v,7,0,7),l.add(156,7,0,0),l.add(127,7,0,7),l.add(91,1,11,3),l.addMany(o(64,127),3,7,0),l.addMany(o(48,60),3,8,4),l.addMany([60,61,62,63],3,9,4),l.addMany(o(48,60),4,8,4),l.addMany(o(64,127),4,7,0),l.addMany([60,61,62,63],4,0,6),l.addMany(o(32,64),6,0,6),l.add(127,6,0,6),l.addMany(o(64,127),6,0,0),l.addMany(o(32,48),3,9,5),l.addMany(o(32,48),5,9,5),l.addMany(o(48,64),5,0,6),l.addMany(o(64,127),5,7,0),l.addMany(o(32,48),4,9,5),l.addMany(o(32,48),1,9,2),l.addMany(o(32,48),2,9,2),l.addMany(o(48,127),2,10,0),l.addMany(o(48,80),1,10,0),l.addMany(o(81,88),1,10,0),l.addMany([89,90,92],1,10,0),l.addMany(o(96,127),1,10,0),l.add(80,1,11,9),l.addMany(v,9,0,9),l.add(127,9,0,9),l.addMany(o(28,32),9,0,9),l.addMany(o(32,48),9,9,12),l.addMany(o(48,60),9,8,10),l.addMany([60,61,62,63],9,9,10),l.addMany(v,11,0,11),l.addMany(o(32,128),11,0,11),l.addMany(o(28,32),11,0,11),l.addMany(v,10,0,10),l.add(127,10,0,10),l.addMany(o(28,32),10,0,10),l.addMany(o(48,60),10,8,10),l.addMany([60,61,62,63],10,0,11),l.addMany(o(32,48),10,9,12),l.addMany(v,12,0,12),l.add(127,12,0,12),l.addMany(o(28,32),12,0,12),l.addMany(o(32,48),12,9,12),l.addMany(o(48,64),12,0,11),l.addMany(o(64,127),12,12,13),l.addMany(o(64,127),10,12,13),l.addMany(o(64,127),9,12,13),l.addMany(v,13,13,13),l.addMany(u,13,13,13),l.add(127,13,0,13),l.addMany([27,156,24,26],13,14,0),l.add(b,0,2,0),l.add(b,8,5,8),l.add(b,6,0,6),l.add(b,11,0,11),l.add(b,13,13,13),l})();class g extends h.Disposable{constructor(d=s.VT500_TRANSITION_TABLE){super(),this._transitions=d,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=(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,h.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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,o=[64,126]){let u=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=d.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<d.intermediates.length;++C){let w=d.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");let v=d.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(d){let o=[];for(;d;)o.push(String.fromCharCode(255&d)),d>>=8;return o.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,o){let u=this._identifier(d,[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(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,o){this._executeHandlers[d.charCodeAt(0)]=o}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,o){let u=this._identifier(d);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(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,o){return this._dcsParser.registerHandler(this._identifier(d),o)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,o){return this._oscParser.registerHandler(d,o)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}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(d,o,u,v,C){this._parseStack.state=d,this._parseStack.handlers=o,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=C}parse(d,o,u){let v,C=0,w=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,E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&E>-1){for(;E>=0&&(v=m[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&E>-1){for(;E>=0&&(v=m[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(C=d[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=d[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=d[m],w=this._transitions.table[this.currentState<<8|(C<160?C:b)],w>>4){case 2:for(let R=m+1;;++R){if(R>=o||(C=d[R])<32||C>126&&C<b){this._printHandler(d,m,R),m=R-1;break}if(++R>=o||(C=d[R])<32||C>126&&C<b){this._printHandler(d,m,R),m=R-1;break}if(++R>=o||(C=d[R])<32||C>126&&C<b){this._printHandler(d,m,R),m=R-1;break}if(++R>=o||(C=d[R])<32||C>126&&C<b){this._printHandler(d,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 E=this._csiHandlers[this._collect<<8|C],P=E?E.length-1:-1;for(;P>=0&&(v=E[P](this._params),v!==!0);P--)if(v instanceof Promise)return this._preserveStack(3,E,P,w,m),v;P<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=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let I=this._escHandlers[this._collect<<8|C],N=I?I.length-1:-1;for(;N>=0&&(v=I[N](),v!==!0);N--)if(v instanceof Promise)return this._preserveStack(4,I,N,w,m),v;N<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=d[R])===24||C===26||C===27||C>127&&C<b){this._dcsParser.put(d,m,R),m=R-1;break}break;case 14:if(v=this._dcsParser.unhook(C!==24&&C!==26),v)return this._preserveStack(6,[],0,w,m),v;C===27&&(w|=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=d[R])<32||C>127&&C<b){this._oscParser.put(d,m,R),m=R-1;break}break;case 6:if(v=this._oscParser.end(C!==24&&C!==26),v)return this._preserveStack(5,[],0,w,m),v;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}s.EscapeSequenceParser=g},6242:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let h=r(5770),f=r(482),n=[];s.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(_,p){this._handlers[_]===void 0&&(this._handlers[_]=[]);let b=this._handlers[_];return b.push(p),{dispose:()=>{let g=b.indexOf(p);g!==-1&&b.splice(g,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}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=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,p,b){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(_,p,b);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,p,b))}start(){this.reset(),this._state=1}put(_,p,b){if(this._state!==3){if(this._state===1)for(;p<b;){let g=_[p++];if(g===59){this._state=2,this._start();break}if(g<48||57<g)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+g-48}this._state===2&&b-p>0&&this._put(_,p,b)}}end(_,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let b=!1,g=this._active.length-1,l=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,b=p,l=this._stack.fallThrough,this._stack.paused=!1),!l&&b===!1){for(;g>=0&&(b=this._active[g].end(_),b!==!0);g--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,b;g--}for(;g>=0;g--)if(b=this._active[g].end(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,b}else this._handlerFb(this._id,"END",_);this._active=n,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,p,b){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,p,b),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let p=!1;if(this._hitLimit)p=!1;else if(_&&(p=this._handler(this._data),p instanceof Promise))return p.then((b=>(this._data="",this._hitLimit=!1,b)));return this._data="",this._hitLimit=!1,p}}},8742:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let r=2147483647;class h{static fromArray(n){let _=new h;if(!n.length)return _;for(let p=Array.isArray(n[0])?1:0;p<n.length;++p){let b=n[p];if(Array.isArray(b))for(let g=0;g<b.length;++g)_.addSubParam(b[g]);else _.addParam(b)}return _}constructor(n=32,_=32){if(this.maxLength=n,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let n=new h(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 _=0;_<this.length;++_){n.push(this.params[_]);let p=this._subParamsIdx[_]>>8,b=255&this._subParamsIdx[_];b-p>0&&n.push(Array.prototype.slice.call(this._subParams,p,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>r?r: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>r?r:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let _=this._subParamsIdx[n]>>8,p=255&this._subParamsIdx[n];return p-_>0?this._subParams.subarray(_,p):null}getSubParamsAll(){let n={};for(let _=0;_<this.length;++_){let p=this._subParamsIdx[_]>>8,b=255&this._subParamsIdx[_];b-p>0&&(n[_]=this._subParams.slice(p,b))}return n}addDigit(n){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let p=this._digitIsSub?this._subParams:this.params,b=p[_-1];p[_-1]=~b?Math.min(10*b+n,r):n}}s.Params=h},5741:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let r=this._addons.length-1;r>=0;r--)this._addons[r].instance.dispose()}loadAddon(r,h){let f={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(f),h.dispose=()=>this._wrappedAddonDispose(f),h.activate(r)}_wrappedAddonDispose(r){if(r.isDisposed)return;let h=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===r){h=f;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");r.isDisposed=!0,r.dispose.apply(r.instance),this._addons.splice(h,1)}}},8771:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let h=r(3785),f=r(511);s.BufferApiView=class{constructor(n,_){this._buffer=n,this.type=_}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 _=this._buffer.lines.get(n);if(_)return new h.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let h=r(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,n){if(!(f<0||f>=this._line.length))return n?(this._line.loadCell(f,n),n):this._line.loadCell(f,new h.CellData)}translateToString(f,n,_){return this._line.translateToString(f,n,_)}}},8285:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let h=r(8771),f=r(8460),n=r(844);class _ extends n.Disposable{constructor(b){super(),this._core=b,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)}}s.BufferNamespaceApi=_},7975:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(r){this._core=r}registerCsiHandler(r,h){return this._core.registerCsiHandler(r,(f=>h(f.toArray())))}addCsiHandler(r,h){return this.registerCsiHandler(r,h)}registerDcsHandler(r,h){return this._core.registerDcsHandler(r,((f,n)=>h(f,n.toArray())))}addDcsHandler(r,h){return this.registerDcsHandler(r,h)}registerEscHandler(r,h){return this._core.registerEscHandler(r,h)}addEscHandler(r,h){return this.registerEscHandler(r,h)}registerOscHandler(r,h){return this._core.registerOscHandler(r,h)}addOscHandler(r,h){return this.registerOscHandler(r,h)}}},7090:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(r){this._core=r}register(r){this._core.unicodeService.register(r)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(r){this._core.unicodeService.activeVersion=r}}},744:function(c,s,r){var h=this&&this.__decorate||function(l,d,o,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(l,d,o,u);else for(var y=l.length-1;y>=0;y--)(v=l[y])&&(w=(C<3?v(w):C>3?v(d,o,w):v(d,o))||w);return C>3&&w&&Object.defineProperty(d,o,w),w},f=this&&this.__param||function(l,d){return function(o,u){d(o,u,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let n=r(8460),_=r(844),p=r(5295),b=r(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let g=s.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(l){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(l.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(l.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(l,this))}resize(l,d){this.cols=l,this.rows=d,this.buffers.resize(l,d),this._onResize.fire({cols:l,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(l,d=!1){let o=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===l.fg&&u.getBg(0)===l.bg||(u=o.getBlankLine(l,d),this._cachedBlankLine=u),u.isWrapped=d;let v=o.ybase+o.scrollTop,C=o.ybase+o.scrollBottom;if(o.scrollTop===0){let w=o.lines.isFull;C===o.lines.length-1?w?o.lines.recycle().copyFrom(u):o.lines.push(u.clone()):o.lines.splice(C+1,0,u.clone()),w?this.isUserScrolling&&(o.ydisp=Math.max(o.ydisp-1,0)):(o.ybase++,this.isUserScrolling||o.ydisp++)}else{let w=C-v+1;o.lines.shiftElements(v+1,w-1,-1),o.lines.set(C,u.clone())}this.isUserScrolling||(o.ydisp=o.ybase),this._onScroll.fire(o.ydisp)}scrollLines(l,d,o){let u=this.buffer;if(l<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else l+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+l,u.ybase),0),v!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};s.BufferService=g=h([f(0,b.IOptionsService)],g)},7994:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(r){this.glevel=r,this.charset=this._charsets[r]}setgCharset(r,h){this._charsets[r]=h,this.glevel===r&&(this.charset=h)}}},1753:function(c,s,r){var h=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,E=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,C,w);else for(var P=u.length-1;P>=0;P--)(y=u[P])&&(E=(m<3?y(E):m>3?y(v,C,E):y(v,C))||E);return m>3&&E&&Object.defineProperty(v,C,E),E},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let n=r(2585),_=r(8460),p=r(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 g(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 l=String.fromCharCode,d={DEFAULT:u=>{let v=[g(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${l(v[0])}${l(v[1])}${l(v[2])}`},SGR:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.x};${u.y}${v}`}},o=s.CoreMouseService=class extends p.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 _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(b))this.addProtocol(C,b[C]);for(let C of Object.keys(d))this.addEncoding(C,d[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}};s.CoreMouseService=o=h([f(0,n.IBufferService),f(1,n.ICoreService)],o)},6975:function(c,s,r){var h=this&&this.__decorate||function(o,u,v,C){var w,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 E=o.length-1;E>=0;E--)(w=o[E])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(o,u){return function(v,C){u(v,C,o)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let n=r(1439),_=r(8460),p=r(844),b=r(2585),g=Object.freeze({insertMode:!1}),l=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=s.CoreService=class extends p.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 _.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,n.clone)(g),this.decPrivateModes=(0,n.clone)(l)}reset(){this.modes=(0,n.clone)(g),this.decPrivateModes=(0,n.clone)(l)}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))}};s.CoreService=d=h([f(0,b.IBufferService),f(1,b.ILogService),f(2,b.IOptionsService)],d)},9074:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let h=r(8055),f=r(8460),n=r(844),_=r(6106),p=0,b=0;class g extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((o=>o?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)((()=>this.reset())))}registerDecoration(o){if(o.marker.isDisposed)return;let u=new l(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,w=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,w=C+(y.options.width??1),o>=C&&o<w&&(!v||(y.options.layer??"bottom")===v)&&(yield y)}forEachDecorationAtCell(o,u,v,C){this._decorations.forEachByKey(u,(w=>{p=w.options.x??0,b=p+(w.options.width??1),o>=p&&o<b&&(!v||(w.options.layer??"bottom")===v)&&C(w)}))}}s.DecorationService=g;class l extends n.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(o){super(),this.options=o,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=o.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let h=r(2585),f=r(8343);class n{constructor(...p){this._entries=new Map;for(let[b,g]of p)this.set(b,g)}set(p,b){let g=this._entries.get(p);return this._entries.set(p,b),g}forEach(p){for(let[b,g]of this._entries.entries())p(b,g)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}s.ServiceCollection=n,s.InstantiationService=class{constructor(){this._services=new n,this._services.set(h.IInstantiationService,this)}setService(_,p){this._services.set(_,p)}getService(_){return this._services.get(_)}createInstance(_,...p){let b=(0,f.getServiceDependencies)(_).sort(((d,o)=>d.index-o.index)),g=[];for(let d of b){let o=this._services.get(d.id);if(!o)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${d.id}.`);g.push(o)}let l=b.length>0?b[0].index:p.length;if(p.length!==l)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${l+1} conflicts with ${p.length} static arguments`);return new _(...p,...g)}}},7866:function(c,s,r){var h=this&&this.__decorate||function(l,d,o,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(l,d,o,u);else for(var y=l.length-1;y>=0;y--)(v=l[y])&&(w=(C<3?v(w):C>3?v(d,o,w):v(d,o))||w);return C>3&&w&&Object.defineProperty(d,o,w),w},f=this&&this.__param||function(l,d){return function(o,u){d(o,u,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let n=r(844),_=r(2585),p={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},b,g=s.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(l){super(),this._optionsService=l,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),b=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(l){for(let d=0;d<l.length;d++)typeof l[d]=="function"&&(l[d]=l[d]())}_log(l,d,o){this._evalLazyOptionalParams(o),l.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...o)}trace(l,...d){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,l,d)}debug(l,...d){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,l,d)}info(l,...d){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,l,d)}warn(l,...d){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,l,d)}error(l,...d){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,l,d)}};s.LogService=g=h([f(0,_.IOptionsService)],g),s.setTraceLogger=function(l){b=l},s.traceCall=function(l,d,o){if(typeof o.value!="function")throw new Error("not supported");let u=o.value;o.value=function(...v){if(b.logLevel!==_.LogLevelEnum.TRACE)return u.apply(this,v);b.trace(`GlyphRenderer#${u.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);let C=u.apply(this,v);return b.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let h=r(8460),f=r(844),n=r(6114);s.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 _=["normal","bold","100","200","300","400","500","600","700","800","900"];class p extends f.Disposable{constructor(g){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let l={...s.DEFAULT_OPTIONS};for(let d in g)if(d in l)try{let o=g[d];l[d]=this._sanitizeAndValidateOption(d,o)}catch(o){console.error(o)}this.rawOptions=l,this.options={...l},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(g,l){return this.onOptionChange((d=>{d===g&&l(this.rawOptions[g])}))}onMultipleOptionChange(g,l){return this.onOptionChange((d=>{g.indexOf(d)!==-1&&l()}))}_setupOptions(){let g=d=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},l=(d,o)=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);o=this._sanitizeAndValidateOption(d,o),this.rawOptions[d]!==o&&(this.rawOptions[d]=o,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let o={get:g.bind(this,d),set:l.bind(this,d)};Object.defineProperty(this.options,d,o)}}_sanitizeAndValidateOption(g,l){switch(g){case"cursorStyle":if(l||(l=s.DEFAULT_OPTIONS[g]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(l))throw new Error(`"${l}" is not a valid value for ${g}`);break;case"wordSeparator":l||(l=s.DEFAULT_OPTIONS[g]);break;case"fontWeight":case"fontWeightBold":if(typeof l=="number"&&1<=l&&l<=1e3)break;l=_.includes(l)?l:s.DEFAULT_OPTIONS[g];break;case"cursorWidth":l=Math.floor(l);case"lineHeight":case"tabStopWidth":if(l<1)throw new Error(`${g} cannot be less than 1, value: ${l}`);break;case"minimumContrastRatio":l=Math.max(1,Math.min(21,Math.round(10*l)/10));break;case"scrollback":if((l=Math.min(l,4294967295))<0)throw new Error(`${g} cannot be less than 0, value: ${l}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(l<=0)throw new Error(`${g} cannot be less than or equal to 0, value: ${l}`);break;case"rows":case"cols":if(!l&&l!==0)throw new Error(`${g} must be numeric, value: ${l}`);break;case"windowsPty":l=l??{}}return l}}s.OptionsService=p},2660:function(c,s,r){var h=this&&this.__decorate||function(p,b,g,l){var d,o=arguments.length,u=o<3?b:l===null?l=Object.getOwnPropertyDescriptor(b,g):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(p,b,g,l);else for(var v=p.length-1;v>=0;v--)(d=p[v])&&(u=(o<3?d(u):o>3?d(b,g,u):d(b,g))||u);return o>3&&u&&Object.defineProperty(b,g,u),u},f=this&&this.__param||function(p,b){return function(g,l){b(g,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let n=r(2585),_=s.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){let b=this._bufferService.buffer;if(p.id===void 0){let v=b.addMarker(b.ybase+b.y),C={data:p,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(C,v))),this._dataByLinkId.set(C.id,C),C.id}let g=p,l=this._getEntryIdKey(g),d=this._entriesWithId.get(l);if(d)return this.addLineToLink(d.id,b.ybase+b.y),d.id;let o=b.addMarker(b.ybase+b.y),u={id:this._nextId++,key:this._getEntryIdKey(g),data:g,lines:[o]};return o.onDispose((()=>this._removeMarkerFromLink(u,o))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(p,b){let g=this._dataByLinkId.get(p);if(g&&g.lines.every((l=>l.line!==b))){let l=this._bufferService.buffer.addMarker(b);g.lines.push(l),l.onDispose((()=>this._removeMarkerFromLink(g,l)))}}getLinkData(p){return this._dataByLinkId.get(p)?.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,b){let g=p.lines.indexOf(b);g!==-1&&(p.lines.splice(g,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};s.OscLinkService=_=h([f(0,n.IBufferService)],_)},8343:(c,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let r="di$target",h="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(f){return f[h]||[]},s.createDecorator=function(f){if(s.serviceRegistry.has(f))return s.serviceRegistry.get(f);let n=function(_,p,b){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,l,d){l[r]===l?l[h].push({id:g,index:d}):(l[h]=[{id:g,index:d}],l[r]=l)})(n,_,b)};return n.toString=()=>f,s.serviceRegistry.set(f,n),n}},2585:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;let h=r(8343);var f;s.IBufferService=(0,h.createDecorator)("BufferService"),s.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),s.ICoreService=(0,h.createDecorator)("CoreService"),s.ICharsetService=(0,h.createDecorator)("CharsetService"),s.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"})(f||(s.LogLevelEnum=f={})),s.ILogService=(0,h.createDecorator)("LogService"),s.IOptionsService=(0,h.createDecorator)("OptionsService"),s.IOscLinkService=(0,h.createDecorator)("OscLinkService"),s.IUnicodeService=(0,h.createDecorator)("UnicodeService"),s.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(c,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let h=r(8460),f=r(225);class n{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,b,g=!1){return(16777215&p)<<3|(3&b)<<1|(g?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let p=new f.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let b=0,g=0,l=p.length;for(let d=0;d<l;++d){let o=p.charCodeAt(d);if(55296<=o&&o<=56319){if(++d>=l)return b+this.wcwidth(o);let C=p.charCodeAt(d);56320<=C&&C<=57343?o=1024*(o-55296)+C-56320+65536:b+=this.wcwidth(C)}let u=this.charProperties(o,g),v=n.extractWidth(u);n.extractShouldJoin(u)&&(v-=n.extractWidth(g)),b+=v,g=u}return b}charProperties(p,b){return this._activeProvider.charProperties(p,b)}}s.UnicodeService=n}},t={};function i(c){var s=t[c];if(s!==void 0)return s.exports;var r=t[c]={exports:{}};return e[c].call(r.exports,r,r.exports,i),r.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;let s=i(9042),r=i(3236),h=i(844),f=i(5741),n=i(8285),_=i(7975),p=i(7090),b=["cols","rows"];class g extends h.Disposable{constructor(d){super(),this._core=this.register(new r.Terminal(d)),this._addonManager=this.register(new f.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(d){if(b.includes(d))throw new Error(`Option "${d}" 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 p.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 d=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:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:o,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let o in d)this._publicOptions[o]=d[o]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,o=!0){this._core.input(d,o)}resize(d,o){this._verifyIntegers(d,o),this._core.resize(d,o)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}attachCustomWheelEventHandler(d){this._core.attachCustomWheelEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){return this._checkProposedApi(),this._verifyPositiveIntegers(d.x??0,d.width??0,d.height??0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,o,u){this._verifyIntegers(d,o,u),this._core.select(d,o,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,o){this._verifyIntegers(d,o),this._core.selectLines(d,o)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,o){this._core.write(d,o)}writeln(d,o){this._core.write(d),this._core.write(`\r
9
+ `,o)}paste(d){this._core.paste(d)}refresh(d,o){this._verifyIntegers(d,o),this._core.refresh(d,o)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return s}_verifyIntegers(...d){for(let o of d)if(o===1/0||isNaN(o)||o%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(let o of d)if(o&&(o===1/0||isNaN(o)||o%1!=0||o<0))throw new Error("This API only accepts positive integers")}}c.Terminal=g})(),a})()))});var Sr=vr((gi,as)=>{(function(e,t){typeof gi=="object"&&typeof as=="object"?as.exports=t():typeof define=="function"&&define.amd?define([],t):typeof gi=="object"?gi.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(i){this._terminal=i}dispose(){}fit(){let i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;let a=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(a._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let i=this._terminal._core,a=i._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;let c=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),h=Math.max(0,parseInt(s.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),n=r-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),_=h-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(_/a.css.cell.width)),rows:Math.max(1,Math.floor(n/a.css.cell.height))}}}})(),e})()))});var Lo=mr(br(),1),ko=mr(Sr(),1);var ea=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Cr.isErrorNoTelemetry(e)?new Cr(e.message+`
10
10
 
11
11
  `+e.stack):new Error(e.message+`
12
12
 
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)}},Vo=new Go;function as(e){Yo(e)||Vo.onUnexpectedError(e)}var cs="Canceled";function Yo(e){return e instanceof Xo?!0:e instanceof Error&&e.name===cs&&e.message===cs}var Xo=class extends Error{constructor(){super(cs),this.name=this.message}},Sr=class ds extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ds)return t;let s=new ds;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Jo(e,t,s=0,c=e.length){let h=s,i=c;for(;h<i;){let r=Math.floor((h+i)/2);t(e[r])?h=r+1:i=r}return h-1}var Zo=class Tr{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Tr.assertInvariants){if(this._prevFindLastPredicate){for(let c of this._array)if(this._prevFindLastPredicate(c)&&!t(c))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let s=Jo(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=s+1,s===-1?void 0:this._array[s]}};Zo.assertInvariants=!1;var us;(e=>{function t(i){return i<0}e.isLessThan=t;function s(i){return i<=0}e.isLessThanOrEqual=s;function c(i){return i>0}e.isGreaterThan=c;function h(i){return i===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(us||(us={}));function Qo(e,t){return(s,c)=>t(e(s),e(c))}var ea=(e,t)=>e-t,br=class _s{constructor(t){this.iterate=t}forEach(t){this.iterate(s=>(t(s),!0))}toArray(){let t=[];return this.iterate(s=>(t.push(s),!0)),t}filter(t){return new _s(s=>this.iterate(c=>t(c)?s(c):!0))}map(t){return new _s(s=>this.iterate(c=>s(t(c))))}some(t){let s=!1;return this.iterate(c=>(s=t(c),!s)),s}findFirst(t){let s;return this.iterate(c=>t(c)?(s=c,!1):!0),s}findLast(t){let s;return this.iterate(c=>(t(c)&&(s=c),!0)),s}findLastMaxBy(t){let s,c=!0;return this.iterate(h=>((c||us.isGreaterThan(t(h,s)))&&(c=!1,s=h),!0)),s}};br.empty=new br(e=>{});function ta(e,t){let s=Object.create(null);for(let c of e){let h=t(c),i=s[h];i||(i=s[h]=[]),i.push(c)}return s}var Cr,yr,Td=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Cr]="SetWithKey";for(let s of e)this.add(s)}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(s=>e.call(t,s,s,this))}[(yr=Symbol.iterator,Cr=Symbol.toStringTag,yr)](){return this.values()}},ia=class{constructor(){this.map=new Map}add(e,t){let s=this.map.get(e);s||(s=new Set,this.map.set(e,s)),s.add(t)}delete(e,t){let s=this.map.get(e);s&&(s.delete(t),s.size===0&&this.map.delete(e))}forEach(e,t){let s=this.map.get(e);s&&s.forEach(t)}get(e){return this.map.get(e)||new Set}};function sa(e,t){let s=this,c=!1,h;return function(){if(c)return h;if(c=!0,t)try{h=e.apply(s,arguments)}finally{t()}else h=e.apply(s,arguments);return h}}var fs;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function c(){return s}e.empty=c;function*h(w){yield w}e.single=h;function i(w){return t(w)?w:h(w)}e.wrap=i;function r(w){return w||s}e.from=r;function*l(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=l;function _(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=_;function n(w){return w[Symbol.iterator]().next().value}e.first=n;function f(w,y){let m=0;for(let x of w)if(y(x,m++))return!0;return!1}e.some=f;function p(w,y){for(let m of w)if(y(m))return m}e.find=p;function*S(w,y){for(let m of w)y(m)&&(yield m)}e.filter=S;function*g(w,y){let m=0;for(let x of w)yield y(x,m++)}e.map=g;function*a(w,y){let m=0;for(let x of w)yield*y(x,m++)}e.flatMap=a;function*d(...w){for(let y of w)yield*y}e.concat=d;function o(w,y,m){let x=m;for(let D of w)x=y(x,D);return x}e.reduce=o;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let x=w[Symbol.iterator]();for(let D=0;D<y;D++){let I=x.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(fs||(fs={}));var ra=!1,kt=null,na=class Br{constructor(){this.livingDisposables=new Map}getDisposableData(t){let s=this.livingDisposables.get(t);return s||(s={parent:null,source:null,isSingleton:!1,value:t,idx:Br.idx++},this.livingDisposables.set(t,s)),s}trackDisposable(t){let s=this.getDisposableData(t);s.source||(s.source=new Error().stack)}setParent(t,s){let c=this.getDisposableData(t);c.parent=s}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,s){let c=s.get(t);if(c)return c;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),s):t;return s.set(t,h),h}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,s])=>s.source!==null&&!this.getRootParent(s,t).isSingleton).flatMap(([s])=>s)}computeLeakingDisposables(t=10,s){let c;if(s)c=s;else{let _=new Map,n=[...this.livingDisposables.values()].filter(p=>p.source!==null&&!this.getRootParent(p,_).isSingleton);if(n.length===0)return;let f=new Set(n.map(p=>p.value));if(c=n.filter(p=>!(p.parent&&f.has(p.parent))),c.length===0)throw new Error("There are cyclic diposable chains!")}if(!c)return;function h(_){function n(p,S){for(;p.length>0&&S.some(g=>typeof g=="string"?g===p[0]:p[0].match(g));)p.shift()}let f=_.source.split(`
14
- `).map(p=>p.trim().replace("at ","")).filter(p=>p!=="");return n(f,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),f.reverse()}let i=new ia;for(let _ of c){let n=h(_);for(let f=0;f<=n.length;f++)i.add(n.slice(0,f).join(`
15
- `),_)}c.sort(Qo(_=>_.idx,ea));let r="",l=0;for(let _ of c.slice(0,t)){l++;let n=h(_),f=[];for(let p=0;p<n.length;p++){let S=n[p];S=`(shared with ${i.get(n.slice(0,p+1).join(`
16
- `)).size}/${c.length} leaks) at ${S}`;let g=i.get(n.slice(0,p).join(`
17
- `)),a=ta([...g].map(d=>h(d)[p]),d=>d);delete a[n[p]];for(let[d,o]of Object.entries(a))f.unshift(` - stacktraces of ${o.length} other leaks continue with ${d}`);f.unshift(S)}r+=`
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)}},ta=new ea;function ls(e){ia(e)||ta.onUnexpectedError(e)}var ds="Canceled";function ia(e){return e instanceof sa?!0:e instanceof Error&&e.name===ds&&e.message===ds}var sa=class extends Error{constructor(){super(ds),this.name=this.message}},Cr=class us extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof us)return t;let i=new us;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function ra(e,t,i=0,a=e.length){let c=i,s=a;for(;c<s;){let r=Math.floor((c+s)/2);t(e[r])?c=r+1:s=r}return c-1}var na=class Pr{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Pr.assertInvariants){if(this._prevFindLastPredicate){for(let a of this._array)if(this._prevFindLastPredicate(a)&&!t(a))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=ra(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};na.assertInvariants=!1;var _s;(e=>{function t(s){return s<0}e.isLessThan=t;function i(s){return s<=0}e.isLessThanOrEqual=i;function a(s){return s>0}e.isGreaterThan=a;function c(s){return s===0}e.isNeitherLessOrGreaterThan=c,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(_s||(_s={}));function oa(e,t){return(i,a)=>t(e(i),e(a))}var aa=(e,t)=>e-t,yr=class fs{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new fs(i=>this.iterate(a=>t(a)?i(a):!0))}map(t){return new fs(i=>this.iterate(a=>i(t(a))))}some(t){let i=!1;return this.iterate(a=>(i=t(a),!i)),i}findFirst(t){let i;return this.iterate(a=>t(a)?(i=a,!1):!0),i}findLast(t){let i;return this.iterate(a=>(t(a)&&(i=a),!0)),i}findLastMaxBy(t){let i,a=!0;return this.iterate(c=>((a||_s.isGreaterThan(t(c,i)))&&(a=!1,i=c),!0)),i}};yr.empty=new yr(e=>{});function la(e,t){let i=Object.create(null);for(let a of e){let c=t(a),s=i[c];s||(s=i[c]=[]),s.push(a)}return i}var xr,Er,Hd=class{constructor(e,t){this.toKey=t,this._map=new Map,this[xr]="SetWithKey";for(let i of e)this.add(i)}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(i=>e.call(t,i,i,this))}[(Er=Symbol.iterator,xr=Symbol.toStringTag,Er)](){return this.values()}},ha=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function ca(e,t){let i=this,a=!1,c;return function(){if(a)return c;if(a=!0,t)try{c=e.apply(i,arguments)}finally{t()}else c=e.apply(i,arguments);return c}}var ps;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function a(){return i}e.empty=a;function*c(w){yield w}e.single=c;function s(w){return t(w)?w:c(w)}e.wrap=s;function r(w){return w||i}e.from=r;function*h(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=h;function f(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=f;function n(w){return w[Symbol.iterator]().next().value}e.first=n;function _(w,y){let m=0;for(let E of w)if(y(E,m++))return!0;return!1}e.some=_;function p(w,y){for(let m of w)if(y(m))return m}e.find=p;function*b(w,y){for(let m of w)y(m)&&(yield m)}e.filter=b;function*g(w,y){let m=0;for(let E of w)yield y(E,m++)}e.map=g;function*l(w,y){let m=0;for(let E of w)yield*y(E,m++)}e.flatMap=l;function*d(...w){for(let y of w)yield*y}e.concat=d;function o(w,y,m){let E=m;for(let P of w)E=y(E,P);return E}e.reduce=o;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let E=w[Symbol.iterator]();for(let P=0;P<y;P++){let I=E.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return E}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(ps||(ps={}));var da=!1,Dt=null,ua=class Or{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:Or.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=new Error().stack)}setParent(t,i){let a=this.getDisposableData(t);a.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let a=i.get(t);if(a)return a;let c=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,c),c}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let a;if(i)a=i;else{let f=new Map,n=[...this.livingDisposables.values()].filter(p=>p.source!==null&&!this.getRootParent(p,f).isSingleton);if(n.length===0)return;let _=new Set(n.map(p=>p.value));if(a=n.filter(p=>!(p.parent&&_.has(p.parent))),a.length===0)throw new Error("There are cyclic diposable chains!")}if(!a)return;function c(f){function n(p,b){for(;p.length>0&&b.some(g=>typeof g=="string"?g===p[0]:p[0].match(g));)p.shift()}let _=f.source.split(`
14
+ `).map(p=>p.trim().replace("at ","")).filter(p=>p!=="");return n(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let s=new ha;for(let f of a){let n=c(f);for(let _=0;_<=n.length;_++)s.add(n.slice(0,_).join(`
15
+ `),f)}a.sort(oa(f=>f.idx,aa));let r="",h=0;for(let f of a.slice(0,t)){h++;let n=c(f),_=[];for(let p=0;p<n.length;p++){let b=n[p];b=`(shared with ${s.get(n.slice(0,p+1).join(`
16
+ `)).size}/${a.length} leaks) at ${b}`;let g=s.get(n.slice(0,p).join(`
17
+ `)),l=la([...g].map(d=>c(d)[p]),d=>d);delete l[n[p]];for(let[d,o]of Object.entries(l))_.unshift(` - stacktraces of ${o.length} other leaks continue with ${d}`);_.unshift(b)}r+=`
18
18
 
19
19
 
20
- ==================== Leaking disposable ${l}/${c.length}: ${_.value.constructor.name} ====================
21
- ${f.join(`
20
+ ==================== Leaking disposable ${h}/${a.length}: ${f.value.constructor.name} ====================
21
+ ${_.join(`
22
22
  `)}
23
23
  ============================================================
24
24
 
25
- `}return c.length>t&&(r+=`
25
+ `}return a.length>t&&(r+=`
26
26
 
27
27
 
28
- ... and ${c.length-t} more leaking disposables
28
+ ... and ${a.length-t} more leaking disposables
29
29
 
30
- `),{leaks:c,details:r}}};na.idx=0;function oa(e){kt=e}if(ra){let e="__is_disposable_tracked__";oa(new class{trackDisposable(t){let s=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(s)},3e3)}setParent(t,s){if(t&&t!==Ne.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Ne.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Ci(e){return kt?.trackDisposable(e),e}function yi(e){kt?.markAsDisposed(e)}function Vt(e,t){kt?.setParent(e,t)}function aa(e,t){if(kt)for(let s of e)kt.setParent(s,t)}function Gt(e){if(fs.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(c){t.push(c)}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 Pr(...e){let t=Rt(()=>Gt(e));return aa(e,t),t}function Rt(e){let t=Ci({dispose:sa(()=>{yi(t),e()})});return t}var Or=class Ir{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ci(this)}dispose(){this._isDisposed||(yi(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Gt(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 Vt(t,this),this._isDisposed?Ir.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),Vt(t,null))}};Or.DISABLE_DISPOSED_WARNING=!1;var bs=Or,Ne=class{constructor(){this._store=new bs,Ci(this),Vt(this._store,this)}dispose(){yi(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ne.None=Object.freeze({dispose(){}});var Si=class{constructor(){this._isDisposed=!1,Ci(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Vt(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,yi(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Vt(e,null),e}},xr=class ps{constructor(t){this.element=t,this.next=ps.Undefined,this.prev=ps.Undefined}};xr.Undefined=new xr(void 0);var la=globalThis.performance&&typeof globalThis.performance.now=="function",ha=class Hr{static create(t){return new Hr(t)}constructor(t){this._now=la&&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}},ca=!1,Er=!1,da=!1,bi;(e=>{e.None=()=>Ne.None;function t(B){if(da){let{onDidAddListener:R}=B,O=ms.create(),T=0;B.onDidAddListener=()=>{++T===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),R?.()}}}function s(B,R){return S(B,()=>{},0,void 0,!0,void 0,R)}e.defer=s;function c(B){return(R,O=null,T)=>{let b=!1,E;return E=B(k=>{if(!b)return E?E.dispose():b=!0,R.call(O,k)},null,T),b&&E.dispose(),E}}e.once=c;function h(B,R,O){return f((T,b=null,E)=>B(k=>T.call(b,R(k)),null,E),O)}e.map=h;function i(B,R,O){return f((T,b=null,E)=>B(k=>{R(k),T.call(b,k)},null,E),O)}e.forEach=i;function r(B,R,O){return f((T,b=null,E)=>B(k=>R(k)&&T.call(b,k),null,E),O)}e.filter=r;function l(B){return B}e.signal=l;function _(...B){return(R,O=null,T)=>{let b=Pr(...B.map(E=>E(k=>R.call(O,k))));return p(b,T)}}e.any=_;function n(B,R,O,T){let b=O;return h(B,E=>(b=R(b,E),b),T)}e.reduce=n;function f(B,R){let O,T={onWillAddFirstListener(){O=B(b.fire,b)},onDidRemoveLastListener(){O?.dispose()}};R||t(T);let b=new He(T);return R?.add(b),b.event}function p(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function S(B,R,O=100,T=!1,b=!1,E,k){let A,W,K,$=0,j,P={leakWarningThreshold:E,onWillAddFirstListener(){A=B(U=>{$++,W=R(W,U),T&&!K&&(L.fire(W),W=void 0),j=()=>{let F=W;W=void 0,K=void 0,(!T||$>1)&&L.fire(F),$=0},typeof O=="number"?(clearTimeout(K),K=setTimeout(j,O)):K===void 0&&(K=0,queueMicrotask(j))})},onWillRemoveListener(){b&&$>0&&j?.()},onDidRemoveLastListener(){j=void 0,A.dispose()}};k||t(P);let L=new He(P);return k?.add(L),L.event}e.debounce=S;function g(B,R=0,O){return e.debounce(B,(T,b)=>T?(T.push(b),T):[b],R,void 0,!0,void 0,O)}e.accumulate=g;function a(B,R=(T,b)=>T===b,O){let T=!0,b;return r(B,E=>{let k=T||!R(E,b);return T=!1,b=E,k},O)}e.latch=a;function d(B,R,O){return[e.filter(B,R,O),e.filter(B,T=>!R(T),O)]}e.split=d;function o(B,R=!1,O=[],T){let b=O.slice(),E=B(W=>{b?b.push(W):A.fire(W)});T&&T.add(E);let k=()=>{b?.forEach(W=>A.fire(W)),b=null},A=new He({onWillAddFirstListener(){E||(E=B(W=>A.fire(W)),T&&T.add(E))},onDidAddFirstListener(){b&&(R?setTimeout(k):k())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return T&&T.add(A),A.event}e.buffer=o;function u(B,R){return(O,T,b)=>{let E=R(new C);return B(function(k){let A=E.evaluate(k);A!==v&&O.call(T,A)},void 0,b)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(O=>(R(O),O)),this}filter(R){return this.steps.push(O=>R(O)?O:v),this}reduce(R,O){let T=O;return this.steps.push(b=>(T=R(T,b),T)),this}latch(R=(O,T)=>O===T){let O=!0,T;return this.steps.push(b=>{let E=O||!R(b,T);return O=!1,T=b,E?b:v}),this}evaluate(R){for(let O of this.steps)if(R=O(R),R===v)break;return R}}function w(B,R,O=T=>T){let T=(...A)=>k.fire(O(...A)),b=()=>B.on(R,T),E=()=>B.removeListener(R,T),k=new He({onWillAddFirstListener:b,onDidRemoveLastListener:E});return k.event}e.fromNodeEventEmitter=w;function y(B,R,O=T=>T){let T=(...A)=>k.fire(O(...A)),b=()=>B.addEventListener(R,T),E=()=>B.removeEventListener(R,T),k=new He({onWillAddFirstListener:b,onDidRemoveLastListener:E});return k.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(R=>c(B)(R))}e.toPromise=m;function x(B){let R=new He;return B.then(O=>{R.fire(O)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=x;function D(B,R){return B(O=>R.fire(O))}e.forward=D;function I(B,R,O){return R(O),B(T=>R(T))}e.runAndSubscribe=I;class H{constructor(R,O){this._observable=R,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};O||t(T),this.emitter=new He(T),O&&O.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,O){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function M(B,R){return new H(B,R).emitter.event}e.fromObservable=M;function N(B){return(R,O,T)=>{let b=0,E=!1,k={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,R.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(k),B.reportChanges();let A={dispose(){B.removeObserver(k)}};return T instanceof bs?T.add(A):Array.isArray(T)&&T.push(A),A}}e.fromObservableLight=N})(bi||(bi={}));var gs=class vs{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${vs._idPool++}`,vs.all.add(this)}start(t){this._stopWatch=new ha,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}}};gs.all=new Set,gs._idPool=0;var ua=gs,Lr=-1,Nr=class Fr{constructor(t,s,c=(Fr._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=c,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let c=this.threshold;if(c<=0||s<c)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=c*.5;let[i,r]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${r}):`;console.warn(l),console.warn(i);let _=new fa(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,s=0;for(let[c,h]of this._stacks)(!t||s<h)&&(t=[c,h],s=h);return t}};Nr._idPool=1;var _a=Nr,ms=class Wr{constructor(t){this.value=t}static create(){let t=new Error;return new Wr(t.stack??"")}print(){console.warn(this.value.split(`
30
+ `),{leaks:a,details:r}}};ua.idx=0;function _a(e){Dt=e}if(da){let e="__is_disposable_tracked__";_a(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==ze.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==ze.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function xi(e){return Dt?.trackDisposable(e),e}function Ei(e){Dt?.markAsDisposed(e)}function Jt(e,t){Dt?.setParent(e,t)}function fa(e,t){if(Dt)for(let i of e)Dt.setParent(i,t)}function Xt(e){if(ps.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(a){t.push(a)}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 Ir(...e){let t=Tt(()=>Xt(e));return fa(e,t),t}function Tt(e){let t=xi({dispose:ca(()=>{Ei(t),e()})});return t}var Nr=class Fr{constructor(){this._toDispose=new Set,this._isDisposed=!1,xi(this)}dispose(){this._isDisposed||(Ei(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Xt(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 Jt(t,this),this._isDisposed?Fr.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),Jt(t,null))}};Nr.DISABLE_DISPOSED_WARNING=!1;var Cs=Nr,ze=class{constructor(){this._store=new Cs,xi(this),Jt(this._store,this)}dispose(){Ei(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ze.None=Object.freeze({dispose(){}});var Ci=class{constructor(){this._isDisposed=!1,xi(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Jt(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Ei(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Jt(e,null),e}},Lr=class gs{constructor(t){this.element=t,this.next=gs.Undefined,this.prev=gs.Undefined}};Lr.Undefined=new Lr(void 0);var pa=globalThis.performance&&typeof globalThis.performance.now=="function",ga=class Hr{static create(t){return new Hr(t)}constructor(t){this._now=pa&&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}},va=!1,kr=!1,ma=!1,yi;(e=>{e.None=()=>ze.None;function t(D){if(ma){let{onDidAddListener:A}=D,T=ws.create(),B=0;D.onDidAddListener=()=>{++B===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),T.print()),A?.()}}}function i(D,A){return b(D,()=>{},0,void 0,!0,void 0,A)}e.defer=i;function a(D){return(A,T=null,B)=>{let S=!1,L;return L=D(k=>{if(!S)return L?L.dispose():S=!0,A.call(T,k)},null,B),S&&L.dispose(),L}}e.once=a;function c(D,A,T){return _((B,S=null,L)=>D(k=>B.call(S,A(k)),null,L),T)}e.map=c;function s(D,A,T){return _((B,S=null,L)=>D(k=>{A(k),B.call(S,k)},null,L),T)}e.forEach=s;function r(D,A,T){return _((B,S=null,L)=>D(k=>A(k)&&B.call(S,k),null,L),T)}e.filter=r;function h(D){return D}e.signal=h;function f(...D){return(A,T=null,B)=>{let S=Ir(...D.map(L=>L(k=>A.call(T,k))));return p(S,B)}}e.any=f;function n(D,A,T,B){let S=T;return c(D,L=>(S=A(S,L),S),B)}e.reduce=n;function _(D,A){let T,B={onWillAddFirstListener(){T=D(S.fire,S)},onDidRemoveLastListener(){T?.dispose()}};A||t(B);let S=new Ue(B);return A?.add(S),S.event}function p(D,A){return A instanceof Array?A.push(D):A&&A.add(D),D}function b(D,A,T=100,B=!1,S=!1,L,k){let M,F,K,G=0,W,O={leakWarningThreshold:L,onWillAddFirstListener(){M=D(H=>{G++,F=A(F,H),B&&!K&&(x.fire(F),F=void 0),W=()=>{let j=F;F=void 0,K=void 0,(!B||G>1)&&x.fire(j),G=0},typeof T=="number"?(clearTimeout(K),K=setTimeout(W,T)):K===void 0&&(K=0,queueMicrotask(W))})},onWillRemoveListener(){S&&G>0&&W?.()},onDidRemoveLastListener(){W=void 0,M.dispose()}};k||t(O);let x=new Ue(O);return k?.add(x),x.event}e.debounce=b;function g(D,A=0,T){return e.debounce(D,(B,S)=>B?(B.push(S),B):[S],A,void 0,!0,void 0,T)}e.accumulate=g;function l(D,A=(B,S)=>B===S,T){let B=!0,S;return r(D,L=>{let k=B||!A(L,S);return B=!1,S=L,k},T)}e.latch=l;function d(D,A,T){return[e.filter(D,A,T),e.filter(D,B=>!A(B),T)]}e.split=d;function o(D,A=!1,T=[],B){let S=T.slice(),L=D(F=>{S?S.push(F):M.fire(F)});B&&B.add(L);let k=()=>{S?.forEach(F=>M.fire(F)),S=null},M=new Ue({onWillAddFirstListener(){L||(L=D(F=>M.fire(F)),B&&B.add(L))},onDidAddFirstListener(){S&&(A?setTimeout(k):k())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return B&&B.add(M),M.event}e.buffer=o;function u(D,A){return(T,B,S)=>{let L=A(new C);return D(function(k){let M=L.evaluate(k);M!==v&&T.call(B,M)},void 0,S)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(T=>(A(T),T)),this}filter(A){return this.steps.push(T=>A(T)?T:v),this}reduce(A,T){let B=T;return this.steps.push(S=>(B=A(B,S),B)),this}latch(A=(T,B)=>T===B){let T=!0,B;return this.steps.push(S=>{let L=T||!A(S,B);return T=!1,B=S,L?S:v}),this}evaluate(A){for(let T of this.steps)if(A=T(A),A===v)break;return A}}function w(D,A,T=B=>B){let B=(...M)=>k.fire(T(...M)),S=()=>D.on(A,B),L=()=>D.removeListener(A,B),k=new Ue({onWillAddFirstListener:S,onDidRemoveLastListener:L});return k.event}e.fromNodeEventEmitter=w;function y(D,A,T=B=>B){let B=(...M)=>k.fire(T(...M)),S=()=>D.addEventListener(A,B),L=()=>D.removeEventListener(A,B),k=new Ue({onWillAddFirstListener:S,onDidRemoveLastListener:L});return k.event}e.fromDOMEventEmitter=y;function m(D){return new Promise(A=>a(D)(A))}e.toPromise=m;function E(D){let A=new Ue;return D.then(T=>{A.fire(T)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=E;function P(D,A){return D(T=>A.fire(T))}e.forward=P;function I(D,A,T){return A(T),D(B=>A(B))}e.runAndSubscribe=I;class N{constructor(A,T){this._observable=A,this._counter=0,this._hasChanged=!1;let B={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};T||t(B),this.emitter=new Ue(B),T&&T.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,T){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(D,A){return new N(D,A).emitter.event}e.fromObservable=R;function U(D){return(A,T,B)=>{let S=0,L=!1,k={beginUpdate(){S++},endUpdate(){S--,S===0&&(D.reportChanges(),L&&(L=!1,A.call(T)))},handlePossibleChange(){},handleChange(){L=!0}};D.addObserver(k),D.reportChanges();let M={dispose(){D.removeObserver(k)}};return B instanceof Cs?B.add(M):Array.isArray(B)&&B.push(M),M}}e.fromObservableLight=U})(yi||(yi={}));var vs=class ms{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ms._idPool++}`,ms.all.add(this)}start(t){this._stopWatch=new ga,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}}};vs.all=new Set,vs._idPool=0;var wa=vs,Rr=-1,Wr=class $r{constructor(t,i,a=($r._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let a=this.threshold;if(a<=0||i<a)return;this._stacks||(this._stacks=new Map);let c=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,c+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;let[s,r]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${r}):`;console.warn(h),console.warn(s);let f=new Sa(h,s);this._errorHandler(f)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[a,c]of this._stacks)(!t||i<c)&&(t=[a,c],i=c);return t}};Wr._idPool=1;var ba=Wr,ws=class Ur{constructor(t){this.value=t}static create(){let t=new Error;return new Ur(t.stack??"")}print(){console.warn(this.value.split(`
31
31
  `).slice(2).join(`
32
- `))}},fa=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},pa=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},ga=0,gi=class{constructor(e){this.value=e,this.id=ga++}},va=2,ma=(e,t)=>{if(e instanceof gi)t(e);else for(let s=0;s<e.length;s++){let c=e[s];c&&t(c)}},vi;if(ca){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),vi=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var He=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Lr>0||this._options?.leakWarningThreshold?new _a(e?.onListenerError??as,this._options?.leakWarningThreshold??Lr):void 0,this._perfMon=this._options?._profName?new ua(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(Er){let e=this._listeners;queueMicrotask(()=>{ma(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,s)=>{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 pa(`${l}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(this._options?.onListenerError||as)(n),Ne.None}if(this._disposed)return Ne.None;t&&(e=e.bind(t));let c=new gi(e),h,i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(c.stack=ms.create(),h=this._leakageMon.check(c.stack,this._size+1)),Er&&(c.stack=i??ms.create()),this._listeners?this._listeners instanceof gi?(this._deliveryQueue??(this._deliveryQueue=new wa),this._listeners=[this._listeners,c]):this._listeners.push(c):(this._options?.onWillAddFirstListener?.(this),this._listeners=c,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=Rt(()=>{vi?.unregister(r),h?.(),this._removeListener(c)});if(s instanceof bs?s.add(r):Array.isArray(s)&&s.push(r),vi){let l=new Error().stack.split(`
32
+ `))}},Sa=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Ca=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},ya=0,mi=class{constructor(e){this.value=e,this.id=ya++}},xa=2,Ea=(e,t)=>{if(e instanceof mi)t(e);else for(let i=0;i<e.length;i++){let a=e[i];a&&t(a)}},wi;if(va){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),wi=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Ue=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Rr>0||this._options?.leakWarningThreshold?new ba(e?.onListenerError??ls,this._options?.leakWarningThreshold??Rr):void 0,this._perfMon=this._options?._profName?new wa(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(kr){let e=this._listeners;queueMicrotask(()=>{Ea(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,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new Ca(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||ls)(n),ze.None}if(this._disposed)return ze.None;t&&(e=e.bind(t));let a=new mi(e),c,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=ws.create(),c=this._leakageMon.check(a.stack,this._size+1)),kr&&(a.stack=s??ws.create()),this._listeners?this._listeners instanceof mi?(this._deliveryQueue??(this._deliveryQueue=new La),this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=Tt(()=>{wi?.unregister(r),c?.(),this._removeListener(a)});if(i instanceof Cs?i.add(r):Array.isArray(i)&&i.push(r),wi){let h=new Error().stack.split(`
34
34
  `).slice(2,3).join(`
35
- `).trim(),_=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);vi.register(r,_?.[2]??l,r)}return r}),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,s=t.indexOf(e);if(s===-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[s]=void 0;let c=this._deliveryQueue.current===this;if(this._size*va<=t.length){let h=0;for(let i=0;i<t.length;i++)t[i]?t[h++]=t[i]:c&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||as;if(!s){e.value(t);return}try{e.value(t)}catch(c){s(c)}}_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 gi)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}},wa=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$r=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),kr;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof Sa?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:bi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$r})})(kr||(kr={}));var Sa=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?$r:(this._emitter||(this._emitter=new He),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Lt="en",ws=!1,Ss=!1,mi=!1,ba=!1,Ca=!1,Ur=!1,ya=!1,xa=!1,Ea=!1,La=!1,pi,wi=Lt,Rr=Lt,ka,Ke,Ge=globalThis,ke;typeof Ge.vscode<"u"&&typeof Ge.vscode.process<"u"?ke=Ge.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ke=process);var zr=typeof ke?.versions?.electron=="string",Ra=zr&&ke?.type==="renderer";if(typeof ke=="object"){ws=ke.platform==="win32",Ss=ke.platform==="darwin",mi=ke.platform==="linux",ba=mi&&!!ke.env.SNAP&&!!ke.env.SNAP_REVISION,ya=zr,Ea=!!ke.env.CI||!!ke.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pi=Lt,wi=Lt;let e=ke.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);pi=t.userLocale,Rr=t.osLocale,wi=t.resolvedLanguage||Lt,ka=t.languagePack?.translationsConfigFile}catch{}Ca=!0}else typeof navigator=="object"&&!Ra?(Ke=navigator.userAgent,ws=Ke.indexOf("Windows")>=0,Ss=Ke.indexOf("Macintosh")>=0,xa=(Ke.indexOf("Macintosh")>=0||Ke.indexOf("iPad")>=0||Ke.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,mi=Ke.indexOf("Linux")>=0,La=Ke?.indexOf("Mobi")>=0,Ur=!0,wi=globalThis._VSCODE_NLS_LANGUAGE||Lt,pi=navigator.language.toLowerCase(),Rr=pi):console.error("Unable to resolve platform.");var ls=0;Ss?ls=1:ws?ls=3:mi&&(ls=2);var Aa=Ur&&typeof Ge.importScripts=="function",Bd=Aa?Ge.origin:void 0,Fe=Ke,nt=wi,Ar;(e=>{function t(){return nt}e.value=t;function s(){return nt.length===2?nt==="en":nt.length>=3?nt[0]==="e"&&nt[1]==="n"&&nt[2]==="-":!1}e.isDefaultVariant=s;function c(){return nt==="en"}e.isDefault=c})(Ar||(Ar={}));var Ma=typeof Ge.postMessage=="function"&&!Ge.importScripts,Da=(()=>{if(Ma){let e=[];Ge.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let c=0,h=e.length;c<h;c++){let i=e[c];if(i.id===s.data.vscodeScheduleAsyncWork){e.splice(c,1),i.callback();return}}});let t=0;return s=>{let c=++t;e.push({id:c,callback:s}),Ge.postMessage({vscodeScheduleAsyncWork:c},"*")}}return e=>setTimeout(e)})(),Ta=!!(Fe&&Fe.indexOf("Chrome")>=0),Pd=!!(Fe&&Fe.indexOf("Firefox")>=0),Od=!!(!Ta&&Fe&&Fe.indexOf("Safari")>=0),Id=!!(Fe&&Fe.indexOf("Edg/")>=0),Hd=!!(Fe&&Fe.indexOf("Android")>=0);function jr(e,t=0,s){let c=setTimeout(()=>{e(),s&&h.dispose()},t),h=Rt(()=>{clearTimeout(c),s?.deleteAndLeak(h)});return s?.add(h),h}var Ba,hs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?hs=(e,t)=>{Da(()=>{if(s)return;let c=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,c-Date.now())}}))});let s=!1;return{dispose(){s||(s=!0)}}}:hs=(e,t,s)=>{let c=e.requestIdleCallback(t,typeof s=="number"?{timeout:s}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(c))}}},Ba=e=>hs(globalThis,e)})();var Mr;(e=>{async function t(c){let h,i=await Promise.all(c.map(r=>r.then(l=>l,l=>{h||(h=l)})));if(typeof h<"u")throw h;return i}e.settled=t;function s(c){return new Promise(async(h,i)=>{try{await c(h,i)}catch(r){i(r)}})}e.withAsyncBody=s})(Mr||(Mr={}));var Dr=class De{static fromArray(t){return new De(s=>{s.emitMany(t)})}static fromPromise(t){return new De(async s=>{s.emitMany(await t)})}static fromPromises(t){return new De(async s=>{await Promise.all(t.map(async c=>s.emitOne(await c)))})}static merge(t){return new De(async s=>{await Promise.all(t.map(async c=>{for await(let h of c)s.emitOne(h)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new He,queueMicrotask(async()=>{let c={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(c)),this.resolve()}catch(h){this.reject(h)}finally{c.emitOne=void 0,c.emitMany=void 0,c.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 bi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new De(async c=>{for await(let h of t)c.emitOne(s(h))})}map(t){return De.map(this,t)}static filter(t,s){return new De(async c=>{for await(let h of t)s(h)&&c.emitOne(h)})}filter(t){return De.filter(this,t)}static coalesce(t){return De.filter(t,s=>!!s)}coalesce(){return De.coalesce(this)}static async toPromise(t){let s=[];for await(let c of t)s.push(c);return s}toPromise(){return De.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())}};Dr.EMPTY=Dr.fromArray([]);var Pa=class extends Ne{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Si),this._linesCacheDisposables=this._register(new Si),this._register(Rt(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Pr(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=jr(()=>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 s=[],c=[0],h=this._terminal.buffer.active.getLine(e);for(;h;){let i=this._terminal.buffer.active.getLine(e+1),r=i?i.isWrapped:!1,l=h.translateToString(!r&&t);if(r&&i){let _=h.getCell(h.length-1);_&&_.getCode()===0&&_.getWidth()===1&&i.getCell(0)?.getWidth()===2&&(l=l.slice(0,-1))}if(s.push(l),r)c.push(c[c.length-1]+l.length);else break;e++,h=i}return[s.join(""),c]}},Oa=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}},Ia=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,s,c){if(!e||e.length===0){this._terminal.clearSelection();return}if(s>this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let h={startRow:t,startCol:s},i=this._findInLine(e,h,c);if(!i)for(let r=t+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=r,h.startCol=0,i=this._findInLine(e,h,c),!i);r++);return i}findNextWithSelection(e,t,s){if(!e||e.length===0){this._terminal.clearSelection();return}let c=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,i=0;c&&(s===e?(h=c.end.x,i=c.end.y):(h=c.start.x,i=c.start.y)),this._lineCache.initLinesCache();let r={startRow:i,startCol:h},l=this._findInLine(e,r,t);if(!l)for(let _=i+1;_<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=_,r.startCol=0,l=this._findInLine(e,r,t),!l);_++);if(!l&&i!==0)for(let _=0;_<i&&(r.startRow=_,r.startCol=0,l=this._findInLine(e,r,t),!l);_++);return!l&&c&&(r.startRow=c.start.y,r.startCol=0,l=this._findInLine(e,r,t)),l}findPreviousWithSelection(e,t,s){if(!e||e.length===0){this._terminal.clearSelection();return}let c=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols,r=!0;this._lineCache.initLinesCache();let l={startRow:h,startCol:i},_;if(c&&(l.startRow=h=c.start.y,l.startCol=i=c.start.x,s!==e&&(_=this._findInLine(e,l,t,!1),_||(l.startRow=h=c.end.y,l.startCol=i=c.end.x))),_||(_=this._findInLine(e,l,t,r)),!_){l.startCol=Math.max(l.startCol,this._terminal.cols);for(let n=h-1;n>=0&&(l.startRow=n,_=this._findInLine(e,l,t,r),!_);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,r),!_);n--);return _}_isWholeWord(e,t,s){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+s.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+s.length]))}_findInLine(e,t,s={},c=!1){let h=t.startRow,i=t.startCol;if(this._terminal.buffer.active.getLine(h)?.isWrapped){if(c){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,s)}let r=this._lineCache.getLineFromCache(h);r||(r=this._lineCache.translateBufferLineToStringWithWrap(h,!0),this._lineCache.setLineInCache(h,r));let[l,_]=r,n=this._bufferColsToStringOffset(h,i),f=e,p=l;s.regex||(f=s.caseSensitive?e:e.toLowerCase(),p=s.caseSensitive?l:l.toLowerCase());let S=-1;if(s.regex){let g=RegExp(f,s.caseSensitive?"g":"gi"),a;if(c)for(;a=g.exec(p.slice(0,n));)S=g.lastIndex-a[0].length,e=a[0],g.lastIndex-=e.length-1;else a=g.exec(p.slice(n)),a&&a[0].length>0&&(S=n+(g.lastIndex-a[0].length),e=a[0])}else c?n-f.length>=0&&(S=p.lastIndexOf(f,n-f.length)):S=p.indexOf(f,n);if(S>=0){if(s.wholeWord&&!this._isWholeWord(S,p,e))return;let g=0;for(;g<_.length-1&&S>=_[g+1];)g++;let a=g;for(;a<_.length-1&&S+e.length>=_[a+1];)a++;let d=S-_[g],o=S+e.length-_[a],u=this._stringLengthToBufferSize(h+g,d),v=this._stringLengthToBufferSize(h+a,o)-u+this._terminal.cols*(a-g);return{term:e,col:u,row:h+g,size:v}}}_stringLengthToBufferSize(e,t){let s=this._terminal.buffer.active.getLine(e);if(!s)return 0;for(let c=0;c<t;c++){let h=s.getCell(c);if(!h)break;let i=h.getChars();i.length>1&&(t-=i.length-1);let r=s.getCell(c+1);r&&r.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let s=e,c=0,h=this._terminal.buffer.active.getLine(s);for(;t>0&&h;){for(let i=0;i<t&&i<this._terminal.cols;i++){let r=h.getCell(i);if(!r)break;r.getWidth()&&(c+=r.getCode()===0?1:r.getChars().length)}if(s++,h=this._terminal.buffer.active.getLine(s),h&&!h.isWrapped)break;t-=this._terminal.cols}return c}},Ha=class extends Ne{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Rt(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let s of e){let c=this._createResultDecorations(s,t,!1);if(c)for(let h of c)this._storeDecoration(h,s)}}createActiveDecoration(e,t){let s=this._createResultDecorations(e,t,!0);if(s)return{decorations:s,match:e,dispose(){Gt(s)}}}clearHighlightDecorations(){Gt(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,s){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),s&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,s){let c=[],h=e.col,i=e.size,r=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;i>0;){let _=Math.min(this._terminal.cols-h,i);c.push([r,h,_]),h=0,i-=_,r++}let l=[];for(let _ of c){let n=this._terminal.registerMarker(_[0]),f=this._terminal.registerDecoration({marker:n,x:_[1],width:_[2],backgroundColor:s?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(n.line)?void 0:{color:s?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(f){let p=[];p.push(n),p.push(f.onRender(S=>this._applyStyles(S,s?t.activeMatchBorder:t.matchBorder,!1))),p.push(f.onDispose(()=>Gt(p))),l.push(f)}}return l.length===0?void 0:l}},Na=class extends Ne{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new He)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(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 s=this._searchResults[t];if(s.row===e.row&&s.col===e.col&&s.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()}},qr=class extends Ne{constructor(e){super(),this._highlightTimeout=this._register(new Si),this._lineCache=this._register(new Si),this._state=new Oa,this._resultTracker=this._register(new Na),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Pa(e),this._engine=new Ia(e,this._lineCache.value),this._decorationManager=new Ha(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Rt(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=jr(()=>{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,s){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 c=this._findNextAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,c}_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 s=[],c,h=this._engine.find(e,0,0,t);for(;h&&(c?.row!==h.row||c?.col!==h.col)&&!(s.length>=this._highlightLimit);)c=h,s.push(c),h=this._engine.find(e,c.col+c.term.length>=this._terminal.cols?c.row+1:c.row,c.col+c.term.length>=this._terminal.cols?0:c.col+1,t);this._resultTracker.updateResults(s,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(s,t.decorations)}_findNextAndSelect(e,t,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let c=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(c,t?.decorations,s?.noScroll)}findPrevious(e,t,s){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 c=this._findPreviousAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,c}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let c=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(c,t?.decorations,s?.noScroll)}_selectResult(e,t,s){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 c=this._decorationManager.createActiveDecoration(e,t);c&&(this._resultTracker.selectedDecoration=c)}if(!s&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let c=e.row-this._terminal.buffer.active.viewportY;c-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(c)}return!0}};var Fa=class{constructor(e,t,s,c={}){this._terminal=e,this._regex=t,this._handler=s,this._options=c}provideLinks(e,t){let s=$a.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(s))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(s,c)=>{if(this._options.hover){let{range:h}=t;this._options.hover(s,c,h)}},t))}};function Wa(e){try{let t=new URL(e),s=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(s.toLocaleLowerCase())}catch{return!1}}var $a=class xi{static computeLink(t,s,c,h){let i=new RegExp(s.source,(s.flags||"")+"g"),[r,l]=xi._getWindowedLineStrings(t-1,c),_=r.join(""),n,f=[];for(;n=i.exec(_);){let p=n[0];if(!Wa(p))continue;let[S,g]=xi._mapStrIdx(c,l,0,n.index),[a,d]=xi._mapStrIdx(c,S,g,p.length);if(S===-1||g===-1||a===-1||d===-1)continue;let o={start:{x:g+1,y:S+1},end:{x:d,y:a+1}};f.push({range:o,text:p,activate:h})}return f}static _getWindowedLineStrings(t,s){let c,h=t,i=t,r=0,l="",_=[];if(c=s.buffer.active.getLine(t)){let n=c.translateToString(!0);if(c.isWrapped&&n[0]!==" "){for(r=0;(c=s.buffer.active.getLine(--h))&&r<2048&&(l=c.translateToString(!0),r+=l.length,_.push(l),!(!c.isWrapped||l.indexOf(" ")!==-1)););_.reverse()}for(_.push(n),r=0;(c=s.buffer.active.getLine(++i))&&c.isWrapped&&r<2048&&(l=c.translateToString(!0),r+=l.length,_.push(l),l.indexOf(" ")===-1););}return[_,h]}static _mapStrIdx(t,s,c,h){let i=t.buffer.active,r=i.getNullCell(),l=c;for(;h;){let _=i.getLine(s);if(!_)return[-1,-1];for(let n=l;n<_.length;++n){_.getCell(n,r);let f=r.getChars();if(r.getWidth()&&(h-=f.length||1,n===_.length-1&&f==="")){let p=i.getLine(s+1);p&&p.isWrapped&&(p.getCell(0,r),r.getWidth()===2&&(h+=1))}if(h<0)return[s,n]}s++,l=0}return[s,l]}},Ua=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function za(e,t){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")}var Kr=class{constructor(e=za,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,s=t.urlRegex||Ua;this._linkProvider=this._terminal.registerLinkProvider(new Fa(this._terminal,s,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var ja=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,Ka=(e,t,s,c)=>{for(var h=c>1?void 0:c?qa(t,s):t,i=e.length-1,r;i>=0;i--)(r=e[i])&&(h=(c?r(t,s,h):r(h))||h);return c&&h&&ja(t,s,h),h},Ga=(e,t)=>(s,c)=>t(s,c,e),Va=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Gr.isErrorNoTelemetry(e)?new Gr(e.message+`
35
+ `).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(h);wi.register(r,f?.[2]??h,r)}return r}),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,i=t.indexOf(e);if(i===-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[i]=void 0;let a=this._deliveryQueue.current===this;if(this._size*xa<=t.length){let c=0;for(let s=0;s<t.length;s++)t[s]?t[c++]=t[s]:a&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||ls;if(!i){e.value(t);return}try{e.value(t)}catch(a){i(a)}}_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 mi)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}},La=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},zr=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Mr;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof ka?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:yi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:zr})})(Mr||(Mr={}));var ka=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?zr:(this._emitter||(this._emitter=new Ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},At="en",bs=!1,Ss=!1,bi=!1,Ra=!1,Ma=!1,jr=!1,Aa=!1,Da=!1,Ta=!1,Ba=!1,vi,Si=At,Ar=At,Pa,Ze,Qe=globalThis,Re;typeof Qe.vscode<"u"&&typeof Qe.vscode.process<"u"?Re=Qe.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Re=process);var qr=typeof Re?.versions?.electron=="string",Oa=qr&&Re?.type==="renderer";if(typeof Re=="object"){bs=Re.platform==="win32",Ss=Re.platform==="darwin",bi=Re.platform==="linux",Ra=bi&&!!Re.env.SNAP&&!!Re.env.SNAP_REVISION,Aa=qr,Ta=!!Re.env.CI||!!Re.env.BUILD_ARTIFACTSTAGINGDIRECTORY,vi=At,Si=At;let e=Re.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);vi=t.userLocale,Ar=t.osLocale,Si=t.resolvedLanguage||At,Pa=t.languagePack?.translationsConfigFile}catch{}Ma=!0}else typeof navigator=="object"&&!Oa?(Ze=navigator.userAgent,bs=Ze.indexOf("Windows")>=0,Ss=Ze.indexOf("Macintosh")>=0,Da=(Ze.indexOf("Macintosh")>=0||Ze.indexOf("iPad")>=0||Ze.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,bi=Ze.indexOf("Linux")>=0,Ba=Ze?.indexOf("Mobi")>=0,jr=!0,Si=globalThis._VSCODE_NLS_LANGUAGE||At,vi=navigator.language.toLowerCase(),Ar=vi):console.error("Unable to resolve platform.");var hs=0;Ss?hs=1:bs?hs=3:bi&&(hs=2);var Ia=jr&&typeof Qe.importScripts=="function",Wd=Ia?Qe.origin:void 0,je=Ze,lt=Si,Dr;(e=>{function t(){return lt}e.value=t;function i(){return lt.length===2?lt==="en":lt.length>=3?lt[0]==="e"&&lt[1]==="n"&&lt[2]==="-":!1}e.isDefaultVariant=i;function a(){return lt==="en"}e.isDefault=a})(Dr||(Dr={}));var Na=typeof Qe.postMessage=="function"&&!Qe.importScripts,Fa=(()=>{if(Na){let e=[];Qe.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let a=0,c=e.length;a<c;a++){let s=e[a];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(a,1),s.callback();return}}});let t=0;return i=>{let a=++t;e.push({id:a,callback:i}),Qe.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})(),Ha=!!(je&&je.indexOf("Chrome")>=0),$d=!!(je&&je.indexOf("Firefox")>=0),Ud=!!(!Ha&&je&&je.indexOf("Safari")>=0),zd=!!(je&&je.indexOf("Edg/")>=0),jd=!!(je&&je.indexOf("Android")>=0);function Kr(e,t=0,i){let a=setTimeout(()=>{e(),i&&c.dispose()},t),c=Tt(()=>{clearTimeout(a),i?.deleteAndLeak(c)});return i?.add(c),c}var Wa,cs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?cs=(e,t)=>{Fa(()=>{if(i)return;let a=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,a-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:cs=(e,t,i)=>{let a=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),c=!1;return{dispose(){c||(c=!0,e.cancelIdleCallback(a))}}},Wa=e=>cs(globalThis,e)})();var Tr;(e=>{async function t(a){let c,s=await Promise.all(a.map(r=>r.then(h=>h,h=>{c||(c=h)})));if(typeof c<"u")throw c;return s}e.settled=t;function i(a){return new Promise(async(c,s)=>{try{await a(c,s)}catch(r){s(r)}})}e.withAsyncBody=i})(Tr||(Tr={}));var Br=class Pe{static fromArray(t){return new Pe(i=>{i.emitMany(t)})}static fromPromise(t){return new Pe(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Pe(async i=>{await Promise.all(t.map(async a=>i.emitOne(await a)))})}static merge(t){return new Pe(async i=>{await Promise.all(t.map(async a=>{for await(let c of a)i.emitOne(c)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Ue,queueMicrotask(async()=>{let a={emitOne:c=>this.emitOne(c),emitMany:c=>this.emitMany(c),reject:c=>this.reject(c)};try{await Promise.resolve(t(a)),this.resolve()}catch(c){this.reject(c)}finally{a.emitOne=void 0,a.emitMany=void 0,a.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 yi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Pe(async a=>{for await(let c of t)a.emitOne(i(c))})}map(t){return Pe.map(this,t)}static filter(t,i){return new Pe(async a=>{for await(let c of t)i(c)&&a.emitOne(c)})}filter(t){return Pe.filter(this,t)}static coalesce(t){return Pe.filter(t,i=>!!i)}coalesce(){return Pe.coalesce(this)}static async toPromise(t){let i=[];for await(let a of t)i.push(a);return i}toPromise(){return Pe.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())}};Br.EMPTY=Br.fromArray([]);var $a=class extends ze{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Ci),this._linesCacheDisposables=this._register(new Ci),this._register(Tt(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ir(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Kr(()=>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 i=[],a=[0],c=this._terminal.buffer.active.getLine(e);for(;c;){let s=this._terminal.buffer.active.getLine(e+1),r=s?s.isWrapped:!1,h=c.translateToString(!r&&t);if(r&&s){let f=c.getCell(c.length-1);f&&f.getCode()===0&&f.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(i.push(h),r)a.push(a[a.length-1]+h.length);else break;e++,c=s}return[i.join(""),a]}},Ua=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}},za=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,a){if(!e||e.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let c={startRow:t,startCol:i},s=this._findInLine(e,c,a);if(!s)for(let r=t+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(c.startRow=r,c.startCol=0,s=this._findInLine(e,c,a),!s);r++);return s}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=0,s=0;a&&(i===e?(c=a.end.x,s=a.end.y):(c=a.start.x,s=a.start.y)),this._lineCache.initLinesCache();let r={startRow:s,startCol:c},h=this._findInLine(e,r,t);if(!h)for(let f=s+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=f,r.startCol=0,h=this._findInLine(e,r,t),!h);f++);if(!h&&s!==0)for(let f=0;f<s&&(r.startRow=f,r.startCol=0,h=this._findInLine(e,r,t),!h);f++);return!h&&a&&(r.startRow=a.start.y,r.startCol=0,h=this._findInLine(e,r,t)),h}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,r=!0;this._lineCache.initLinesCache();let h={startRow:c,startCol:s},f;if(a&&(h.startRow=c=a.start.y,h.startCol=s=a.start.x,i!==e&&(f=this._findInLine(e,h,t,!1),f||(h.startRow=c=a.end.y,h.startCol=s=a.end.x))),f||(f=this._findInLine(e,h,t,r)),!f){h.startCol=Math.max(h.startCol,this._terminal.cols);for(let n=c-1;n>=0&&(h.startRow=n,f=this._findInLine(e,h,t,r),!f);n--);}if(!f&&c!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=c&&(h.startRow=n,f=this._findInLine(e,h,t,r),!f);n--);return f}_isWholeWord(e,t,i){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},a=!1){let c=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(c)?.isWrapped){if(a){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let r=this._lineCache.getLineFromCache(c);r||(r=this._lineCache.translateBufferLineToStringWithWrap(c,!0),this._lineCache.setLineInCache(c,r));let[h,f]=r,n=this._bufferColsToStringOffset(c,s),_=e,p=h;i.regex||(_=i.caseSensitive?e:e.toLowerCase(),p=i.caseSensitive?h:h.toLowerCase());let b=-1;if(i.regex){let g=RegExp(_,i.caseSensitive?"g":"gi"),l;if(a)for(;l=g.exec(p.slice(0,n));)b=g.lastIndex-l[0].length,e=l[0],g.lastIndex-=e.length-1;else l=g.exec(p.slice(n)),l&&l[0].length>0&&(b=n+(g.lastIndex-l[0].length),e=l[0])}else a?n-_.length>=0&&(b=p.lastIndexOf(_,n-_.length)):b=p.indexOf(_,n);if(b>=0){if(i.wholeWord&&!this._isWholeWord(b,p,e))return;let g=0;for(;g<f.length-1&&b>=f[g+1];)g++;let l=g;for(;l<f.length-1&&b+e.length>=f[l+1];)l++;let d=b-f[g],o=b+e.length-f[l],u=this._stringLengthToBufferSize(c+g,d),v=this._stringLengthToBufferSize(c+l,o)-u+this._terminal.cols*(l-g);return{term:e,col:u,row:c+g,size:v}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let a=0;a<t;a++){let c=i.getCell(a);if(!c)break;let s=c.getChars();s.length>1&&(t-=s.length-1);let r=i.getCell(a+1);r&&r.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,a=0,c=this._terminal.buffer.active.getLine(i);for(;t>0&&c;){for(let s=0;s<t&&s<this._terminal.cols;s++){let r=c.getCell(s);if(!r)break;r.getWidth()&&(a+=r.getCode()===0?1:r.getChars().length)}if(i++,c=this._terminal.buffer.active.getLine(i),c&&!c.isWrapped)break;t-=this._terminal.cols}return a}},ja=class extends ze{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Tt(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let a=this._createResultDecorations(i,t,!1);if(a)for(let c of a)this._storeDecoration(c,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){Xt(i)}}}clearHighlightDecorations(){Xt(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,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let a=[],c=e.col,s=e.size,r=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let f=Math.min(this._terminal.cols-c,s);a.push([r,c,f]),c=0,s-=f,r++}let h=[];for(let f of a){let n=this._terminal.registerMarker(f[0]),_=this._terminal.registerDecoration({marker:n,x:f[1],width:f[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(n.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let p=[];p.push(n),p.push(_.onRender(b=>this._applyStyles(b,i?t.activeMatchBorder:t.matchBorder,!1))),p.push(_.onDispose(()=>Xt(p))),h.push(_)}}return h.length===0?void 0:h}},qa=class extends ze{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Ue)}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 i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.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()}},Gr=class extends ze{constructor(e){super(),this._highlightTimeout=this._register(new Ci),this._lineCache=this._register(new Ci),this._state=new Ua,this._resultTracker=this._register(new qa),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new $a(e),this._engine=new za(e,this._lineCache.value),this._decorationManager=new ja(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Tt(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Kr(()=>{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,i){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 a=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,a}_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 i=[],a,c=this._engine.find(e,0,0,t);for(;c&&(a?.row!==c.row||a?.col!==c.col)&&!(i.length>=this._highlightLimit);)a=c,i.push(a),c=this._engine.find(e,a.col+a.term.length>=this._terminal.cols?a.row+1:a.row,a.col+a.term.length>=this._terminal.cols?0:a.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let a=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(a,t?.decorations,i?.noScroll)}findPrevious(e,t,i){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 a=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,a}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let a=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(a,t?.decorations,i?.noScroll)}_selectResult(e,t,i){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 a=this._decorationManager.createActiveDecoration(e,t);a&&(this._resultTracker.selectedDecoration=a)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let a=e.row-this._terminal.buffer.active.viewportY;a-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(a)}return!0}};var Ka=class{constructor(e,t,i,a={}){this._terminal=e,this._regex=t,this._handler=i,this._options=a}provideLinks(e,t){let i=Va.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,a)=>{if(this._options.hover){let{range:c}=t;this._options.hover(i,a,c)}},t))}};function Ga(e){try{let t=new URL(e),i=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(i.toLocaleLowerCase())}catch{return!1}}var Va=class Li{static computeLink(t,i,a,c){let s=new RegExp(i.source,(i.flags||"")+"g"),[r,h]=Li._getWindowedLineStrings(t-1,a),f=r.join(""),n,_=[];for(;n=s.exec(f);){let p=n[0];if(!Ga(p))continue;let[b,g]=Li._mapStrIdx(a,h,0,n.index),[l,d]=Li._mapStrIdx(a,b,g,p.length);if(b===-1||g===-1||l===-1||d===-1)continue;let o={start:{x:g+1,y:b+1},end:{x:d,y:l+1}};_.push({range:o,text:p,activate:c})}return _}static _getWindowedLineStrings(t,i){let a,c=t,s=t,r=0,h="",f=[];if(a=i.buffer.active.getLine(t)){let n=a.translateToString(!0);if(a.isWrapped&&n[0]!==" "){for(r=0;(a=i.buffer.active.getLine(--c))&&r<2048&&(h=a.translateToString(!0),r+=h.length,f.push(h),!(!a.isWrapped||h.indexOf(" ")!==-1)););f.reverse()}for(f.push(n),r=0;(a=i.buffer.active.getLine(++s))&&a.isWrapped&&r<2048&&(h=a.translateToString(!0),r+=h.length,f.push(h),h.indexOf(" ")===-1););}return[f,c]}static _mapStrIdx(t,i,a,c){let s=t.buffer.active,r=s.getNullCell(),h=a;for(;c;){let f=s.getLine(i);if(!f)return[-1,-1];for(let n=h;n<f.length;++n){f.getCell(n,r);let _=r.getChars();if(r.getWidth()&&(c-=_.length||1,n===f.length-1&&_==="")){let p=s.getLine(i+1);p&&p.isWrapped&&(p.getCell(0,r),r.getWidth()===2&&(c+=1))}if(c<0)return[i,n]}i++,h=0}return[i,h]}},Ya=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Xa(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Vr=class{constructor(e=Xa,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||Ya;this._linkProvider=this._terminal.registerLinkProvider(new Ka(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var Ja=Object.defineProperty,Za=Object.getOwnPropertyDescriptor,Qa=(e,t,i,a)=>{for(var c=a>1?void 0:a?Za(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(c=(a?r(t,i,c):r(c))||c);return a&&c&&Ja(t,i,c),c},el=(e,t)=>(i,a)=>t(i,a,e),tl=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Yr.isErrorNoTelemetry(e)?new Yr(e.message+`
36
36
 
37
37
  `+e.stack):new Error(e.message+`
38
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)}},Ya=new Va;function Ai(e){Xa(e)||Ya.onUnexpectedError(e)}var Is="Canceled";function Xa(e){return e instanceof Ja?!0:e instanceof Error&&e.name===Is&&e.message===Is}var Ja=class extends Error{constructor(){super(Is),this.name=this.message}},Gr=class Hs extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Hs)return t;let s=new Hs;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Za(e,t,s=0,c=e.length){let h=s,i=c;for(;h<i;){let r=Math.floor((h+i)/2);t(e[r])?h=r+1:i=r}return h-1}var Qa=class In{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(In.assertInvariants){if(this._prevFindLastPredicate){for(let c of this._array)if(this._prevFindLastPredicate(c)&&!t(c))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let s=Za(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=s+1,s===-1?void 0:this._array[s]}};Qa.assertInvariants=!1;var Ns;(e=>{function t(i){return i<0}e.isLessThan=t;function s(i){return i<=0}e.isLessThanOrEqual=s;function c(i){return i>0}e.isGreaterThan=c;function h(i){return i===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ns||(Ns={}));function el(e,t){return(s,c)=>t(e(s),e(c))}var tl=(e,t)=>e-t,Vr=class Fs{constructor(t){this.iterate=t}forEach(t){this.iterate(s=>(t(s),!0))}toArray(){let t=[];return this.iterate(s=>(t.push(s),!0)),t}filter(t){return new Fs(s=>this.iterate(c=>t(c)?s(c):!0))}map(t){return new Fs(s=>this.iterate(c=>s(t(c))))}some(t){let s=!1;return this.iterate(c=>(s=t(c),!s)),s}findFirst(t){let s;return this.iterate(c=>t(c)?(s=c,!1):!0),s}findLast(t){let s;return this.iterate(c=>(t(c)&&(s=c),!0)),s}findLastMaxBy(t){let s,c=!0;return this.iterate(h=>((c||Ns.isGreaterThan(t(h,s)))&&(c=!1,s=h),!0)),s}};Vr.empty=new Vr(e=>{});function il(e,t){let s=Object.create(null);for(let c of e){let h=t(c),i=s[h];i||(i=s[h]=[]),i.push(c)}return s}var Yr,Xr,au=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Yr]="SetWithKey";for(let s of e)this.add(s)}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(s=>e.call(t,s,s,this))}[(Xr=Symbol.iterator,Yr=Symbol.toStringTag,Xr)](){return this.values()}},sl=class{constructor(){this.map=new Map}add(e,t){let s=this.map.get(e);s||(s=new Set,this.map.set(e,s)),s.add(t)}delete(e,t){let s=this.map.get(e);s&&(s.delete(t),s.size===0&&this.map.delete(e))}forEach(e,t){let s=this.map.get(e);s&&s.forEach(t)}get(e){return this.map.get(e)||new Set}};function rl(e,t){let s=this,c=!1,h;return function(){if(c)return h;if(c=!0,t)try{h=e.apply(s,arguments)}finally{t()}else h=e.apply(s,arguments);return h}}var Ws;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function c(){return s}e.empty=c;function*h(w){yield w}e.single=h;function i(w){return t(w)?w:h(w)}e.wrap=i;function r(w){return w||s}e.from=r;function*l(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=l;function _(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=_;function n(w){return w[Symbol.iterator]().next().value}e.first=n;function f(w,y){let m=0;for(let x of w)if(y(x,m++))return!0;return!1}e.some=f;function p(w,y){for(let m of w)if(y(m))return m}e.find=p;function*S(w,y){for(let m of w)y(m)&&(yield m)}e.filter=S;function*g(w,y){let m=0;for(let x of w)yield y(x,m++)}e.map=g;function*a(w,y){let m=0;for(let x of w)yield*y(x,m++)}e.flatMap=a;function*d(...w){for(let y of w)yield*y}e.concat=d;function o(w,y,m){let x=m;for(let D of w)x=y(x,D);return x}e.reduce=o;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let x=w[Symbol.iterator]();for(let D=0;D<y;D++){let I=x.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Ws||(Ws={}));var nl=!1,Ot=null,ol=class Hn{constructor(){this.livingDisposables=new Map}getDisposableData(t){let s=this.livingDisposables.get(t);return s||(s={parent:null,source:null,isSingleton:!1,value:t,idx:Hn.idx++},this.livingDisposables.set(t,s)),s}trackDisposable(t){let s=this.getDisposableData(t);s.source||(s.source=new Error().stack)}setParent(t,s){let c=this.getDisposableData(t);c.parent=s}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,s){let c=s.get(t);if(c)return c;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),s):t;return s.set(t,h),h}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,s])=>s.source!==null&&!this.getRootParent(s,t).isSingleton).flatMap(([s])=>s)}computeLeakingDisposables(t=10,s){let c;if(s)c=s;else{let _=new Map,n=[...this.livingDisposables.values()].filter(p=>p.source!==null&&!this.getRootParent(p,_).isSingleton);if(n.length===0)return;let f=new Set(n.map(p=>p.value));if(c=n.filter(p=>!(p.parent&&f.has(p.parent))),c.length===0)throw new Error("There are cyclic diposable chains!")}if(!c)return;function h(_){function n(p,S){for(;p.length>0&&S.some(g=>typeof g=="string"?g===p[0]:p[0].match(g));)p.shift()}let f=_.source.split(`
40
- `).map(p=>p.trim().replace("at ","")).filter(p=>p!=="");return n(f,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),f.reverse()}let i=new sl;for(let _ of c){let n=h(_);for(let f=0;f<=n.length;f++)i.add(n.slice(0,f).join(`
41
- `),_)}c.sort(el(_=>_.idx,tl));let r="",l=0;for(let _ of c.slice(0,t)){l++;let n=h(_),f=[];for(let p=0;p<n.length;p++){let S=n[p];S=`(shared with ${i.get(n.slice(0,p+1).join(`
42
- `)).size}/${c.length} leaks) at ${S}`;let g=i.get(n.slice(0,p).join(`
43
- `)),a=il([...g].map(d=>h(d)[p]),d=>d);delete a[n[p]];for(let[d,o]of Object.entries(a))f.unshift(` - stacktraces of ${o.length} other leaks continue with ${d}`);f.unshift(S)}r+=`
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)}},il=new tl;function Di(e){sl(e)||il.onUnexpectedError(e)}var Ns="Canceled";function sl(e){return e instanceof rl?!0:e instanceof Error&&e.name===Ns&&e.message===Ns}var rl=class extends Error{constructor(){super(Ns),this.name=this.message}},Yr=class Fs extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Fs)return t;let i=new Fs;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function nl(e,t,i=0,a=e.length){let c=i,s=a;for(;c<s;){let r=Math.floor((c+s)/2);t(e[r])?c=r+1:s=r}return c-1}var ol=class Fn{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Fn.assertInvariants){if(this._prevFindLastPredicate){for(let a of this._array)if(this._prevFindLastPredicate(a)&&!t(a))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=nl(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};ol.assertInvariants=!1;var Hs;(e=>{function t(s){return s<0}e.isLessThan=t;function i(s){return s<=0}e.isLessThanOrEqual=i;function a(s){return s>0}e.isGreaterThan=a;function c(s){return s===0}e.isNeitherLessOrGreaterThan=c,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Hs||(Hs={}));function al(e,t){return(i,a)=>t(e(i),e(a))}var ll=(e,t)=>e-t,Xr=class Ws{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new Ws(i=>this.iterate(a=>t(a)?i(a):!0))}map(t){return new Ws(i=>this.iterate(a=>i(t(a))))}some(t){let i=!1;return this.iterate(a=>(i=t(a),!i)),i}findFirst(t){let i;return this.iterate(a=>t(a)?(i=a,!1):!0),i}findLast(t){let i;return this.iterate(a=>(t(a)&&(i=a),!0)),i}findLastMaxBy(t){let i,a=!0;return this.iterate(c=>((a||Hs.isGreaterThan(t(c,i)))&&(a=!1,i=c),!0)),i}};Xr.empty=new Xr(e=>{});function hl(e,t){let i=Object.create(null);for(let a of e){let c=t(a),s=i[c];s||(s=i[c]=[]),s.push(a)}return i}var Jr,Zr,fu=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Jr]="SetWithKey";for(let i of e)this.add(i)}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(i=>e.call(t,i,i,this))}[(Zr=Symbol.iterator,Jr=Symbol.toStringTag,Zr)](){return this.values()}},cl=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function dl(e,t){let i=this,a=!1,c;return function(){if(a)return c;if(a=!0,t)try{c=e.apply(i,arguments)}finally{t()}else c=e.apply(i,arguments);return c}}var $s;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function a(){return i}e.empty=a;function*c(w){yield w}e.single=c;function s(w){return t(w)?w:c(w)}e.wrap=s;function r(w){return w||i}e.from=r;function*h(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=h;function f(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=f;function n(w){return w[Symbol.iterator]().next().value}e.first=n;function _(w,y){let m=0;for(let E of w)if(y(E,m++))return!0;return!1}e.some=_;function p(w,y){for(let m of w)if(y(m))return m}e.find=p;function*b(w,y){for(let m of w)y(m)&&(yield m)}e.filter=b;function*g(w,y){let m=0;for(let E of w)yield y(E,m++)}e.map=g;function*l(w,y){let m=0;for(let E of w)yield*y(E,m++)}e.flatMap=l;function*d(...w){for(let y of w)yield*y}e.concat=d;function o(w,y,m){let E=m;for(let P of w)E=y(E,P);return E}e.reduce=o;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let E=w[Symbol.iterator]();for(let P=0;P<y;P++){let I=E.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return E}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})($s||($s={}));var ul=!1,Ht=null,_l=class Hn{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:Hn.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=new Error().stack)}setParent(t,i){let a=this.getDisposableData(t);a.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let a=i.get(t);if(a)return a;let c=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,c),c}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let a;if(i)a=i;else{let f=new Map,n=[...this.livingDisposables.values()].filter(p=>p.source!==null&&!this.getRootParent(p,f).isSingleton);if(n.length===0)return;let _=new Set(n.map(p=>p.value));if(a=n.filter(p=>!(p.parent&&_.has(p.parent))),a.length===0)throw new Error("There are cyclic diposable chains!")}if(!a)return;function c(f){function n(p,b){for(;p.length>0&&b.some(g=>typeof g=="string"?g===p[0]:p[0].match(g));)p.shift()}let _=f.source.split(`
40
+ `).map(p=>p.trim().replace("at ","")).filter(p=>p!=="");return n(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let s=new cl;for(let f of a){let n=c(f);for(let _=0;_<=n.length;_++)s.add(n.slice(0,_).join(`
41
+ `),f)}a.sort(al(f=>f.idx,ll));let r="",h=0;for(let f of a.slice(0,t)){h++;let n=c(f),_=[];for(let p=0;p<n.length;p++){let b=n[p];b=`(shared with ${s.get(n.slice(0,p+1).join(`
42
+ `)).size}/${a.length} leaks) at ${b}`;let g=s.get(n.slice(0,p).join(`
43
+ `)),l=hl([...g].map(d=>c(d)[p]),d=>d);delete l[n[p]];for(let[d,o]of Object.entries(l))_.unshift(` - stacktraces of ${o.length} other leaks continue with ${d}`);_.unshift(b)}r+=`
44
44
 
45
45
 
46
- ==================== Leaking disposable ${l}/${c.length}: ${_.value.constructor.name} ====================
47
- ${f.join(`
46
+ ==================== Leaking disposable ${h}/${a.length}: ${f.value.constructor.name} ====================
47
+ ${_.join(`
48
48
  `)}
49
49
  ============================================================
50
50
 
51
- `}return c.length>t&&(r+=`
51
+ `}return a.length>t&&(r+=`
52
52
 
53
53
 
54
- ... and ${c.length-t} more leaking disposables
54
+ ... and ${a.length-t} more leaking disposables
55
55
 
56
- `),{leaks:c,details:r}}};ol.idx=0;function al(e){Ot=e}if(nl){let e="__is_disposable_tracked__";al(new class{trackDisposable(t){let s=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(s)},3e3)}setParent(t,s){if(t&&t!==Ae.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Ae.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Fi(e){return Ot?.trackDisposable(e),e}function Wi(e){Ot?.markAsDisposed(e)}function ei(e,t){Ot?.setParent(e,t)}function ll(e,t){if(Ot)for(let s of e)Ot.setParent(s,t)}function Nn(e){if(Ws.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(c){t.push(c)}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 Fn(...e){let t=Se(()=>Nn(e));return ll(e,t),t}function Se(e){let t=Fi({dispose:rl(()=>{Wi(t),e()})});return t}var Wn=class $n{constructor(){this._toDispose=new Set,this._isDisposed=!1,Fi(this)}dispose(){this._isDisposed||(Wi(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Nn(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 ei(t,this),this._isDisposed?$n.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),ei(t,null))}};Wn.DISABLE_DISPOSED_WARNING=!1;var Pt=Wn,Ae=class{constructor(){this._store=new Pt,Fi(this),ei(this._store,this)}dispose(){Wi(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ae.None=Object.freeze({dispose(){}});var Yt=class{constructor(){this._isDisposed=!1,Fi(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ei(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Wi(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ei(e,null),e}},Ys=typeof process<"u"&&"title"in process,ii=Ys?"node":navigator.userAgent,Xs=Ys?"node":navigator.platform,hl=ii.includes("Firefox"),cl=ii.includes("Edge"),Un=/^((?!chrome|android).)*safari/i.test(ii);function dl(){if(!Un)return 0;let e=ii.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var lu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Xs),hu=["Windows","Win16","Win32","WinCE"].includes(Xs),cu=Xs.indexOf("Linux")>=0,du=/\bCrOS\b/.test(ii),ul="",ge=0,ve=0,me=0,de=0,Te={css:"#00000000",rgba:0},ye;(e=>{function t(h,i,r,l){return l!==void 0?`#${gt(h)}${gt(i)}${gt(r)}${gt(l)}`:`#${gt(h)}${gt(i)}${gt(r)}`}e.toCss=t;function s(h,i,r,l=255){return(h<<24|i<<16|r<<8|l)>>>0}e.toRgba=s;function c(h,i,r,l){return{css:e.toCss(h,i,r,l),rgba:e.toRgba(h,i,r,l)}}e.toColor=c})(ye||(ye={}));var Dt;(e=>{function t(_,n){if(de=(n.rgba&255)/255,de===1)return{css:n.css,rgba:n.rgba};let f=n.rgba>>24&255,p=n.rgba>>16&255,S=n.rgba>>8&255,g=_.rgba>>24&255,a=_.rgba>>16&255,d=_.rgba>>8&255;ge=g+Math.round((f-g)*de),ve=a+Math.round((p-a)*de),me=d+Math.round((S-d)*de);let o=ye.toCss(ge,ve,me),u=ye.toRgba(ge,ve,me);return{css:o,rgba:u}}e.blend=t;function s(_){return(_.rgba&255)===255}e.isOpaque=s;function c(_,n,f){let p=ct.ensureContrastRatio(_.rgba,n.rgba,f);if(p)return ye.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=c;function h(_){let n=(_.rgba|255)>>>0;return[ge,ve,me]=ct.toChannels(n),{css:ye.toCss(ge,ve,me),rgba:n}}e.opaque=h;function i(_,n){return de=Math.round(n*255),[ge,ve,me]=ct.toChannels(_.rgba),{css:ye.toCss(ge,ve,me,de),rgba:ye.toRgba(ge,ve,me,de)}}e.opacity=i;function r(_,n){return de=_.rgba&255,i(_,de*n/255)}e.multiplyOpacity=r;function l(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=l})(Dt||(Dt={}));var Jr;(e=>{let t,s;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",s=t.createLinearGradient(0,0,1,1))}catch{}function c(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return ge=parseInt(h.slice(1,2).repeat(2),16),ve=parseInt(h.slice(2,3).repeat(2),16),me=parseInt(h.slice(3,4).repeat(2),16),ye.toColor(ge,ve,me);case 5:return ge=parseInt(h.slice(1,2).repeat(2),16),ve=parseInt(h.slice(2,3).repeat(2),16),me=parseInt(h.slice(3,4).repeat(2),16),de=parseInt(h.slice(4,5).repeat(2),16),ye.toColor(ge,ve,me,de);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 ge=parseInt(i[1]),ve=parseInt(i[2]),me=parseInt(i[3]),de=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),ye.toColor(ge,ve,me,de);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=h,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ge,ve,me,de]=t.getImageData(0,0,1,1).data,de!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ye.toRgba(ge,ve,me,de),css:h}}e.toColor=c})(Jr||(Jr={}));var Ce;(e=>{function t(c){return s(c>>16&255,c>>8&255,c&255)}e.relativeLuminance=t;function s(c,h,i){let r=c/255,l=h/255,_=i/255,n=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),f=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),p=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return n*.2126+f*.7152+p*.0722}e.relativeLuminance2=s})(Ce||(Ce={}));var ct;(e=>{function t(r,l){if(de=(l&255)/255,de===1)return l;let _=l>>24&255,n=l>>16&255,f=l>>8&255,p=r>>24&255,S=r>>16&255,g=r>>8&255;return ge=p+Math.round((_-p)*de),ve=S+Math.round((n-S)*de),me=g+Math.round((f-g)*de),ye.toRgba(ge,ve,me)}e.blend=t;function s(r,l,_){let n=Ce.relativeLuminance(r>>8),f=Ce.relativeLuminance(l>>8);if(Ve(n,f)<_){if(f<n){let g=c(r,l,_),a=Ve(n,Ce.relativeLuminance(g>>8));if(a<_){let d=h(r,l,_),o=Ve(n,Ce.relativeLuminance(d>>8));return a>o?g:d}return g}let p=h(r,l,_),S=Ve(n,Ce.relativeLuminance(p>>8));if(S<_){let g=c(r,l,_),a=Ve(n,Ce.relativeLuminance(g>>8));return S>a?p:g}return p}}e.ensureContrastRatio=s;function c(r,l,_){let n=r>>24&255,f=r>>16&255,p=r>>8&255,S=l>>24&255,g=l>>16&255,a=l>>8&255,d=Ve(Ce.relativeLuminance2(S,g,a),Ce.relativeLuminance2(n,f,p));for(;d<_&&(S>0||g>0||a>0);)S-=Math.max(0,Math.ceil(S*.1)),g-=Math.max(0,Math.ceil(g*.1)),a-=Math.max(0,Math.ceil(a*.1)),d=Ve(Ce.relativeLuminance2(S,g,a),Ce.relativeLuminance2(n,f,p));return(S<<24|g<<16|a<<8|255)>>>0}e.reduceLuminance=c;function h(r,l,_){let n=r>>24&255,f=r>>16&255,p=r>>8&255,S=l>>24&255,g=l>>16&255,a=l>>8&255,d=Ve(Ce.relativeLuminance2(S,g,a),Ce.relativeLuminance2(n,f,p));for(;d<_&&(S<255||g<255||a<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),a=Math.min(255,a+Math.ceil((255-a)*.1)),d=Ve(Ce.relativeLuminance2(S,g,a),Ce.relativeLuminance2(n,f,p));return(S<<24|g<<16|a<<8|255)>>>0}e.increaseLuminance=h;function i(r){return[r>>24&255,r>>16&255,r>>8&255,r&255]}e.toChannels=i})(ct||(ct={}));function gt(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ve(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function fe(e){if(!e)throw new Error("value must not be falsy");return e}function Js(e){return 57508<=e&&e<=57558}function _l(e){return 57520<=e&&e<=57527}function fl(e){return 57344<=e&&e<=63743}function pl(e){return 9472<=e&&e<=9631}function gl(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 vl(e,t,s,c){return t===1&&s>Math.ceil(c*1.5)&&e!==void 0&&e>255&&!gl(e)&&!Js(e)&&!fl(e)}function zn(e){return Js(e)||pl(e)}function ml(){return{css:{canvas:Ei(),cell:Ei()},device:{canvas:Ei(),cell:Ei(),char:{width:0,height:0,left:0,top:0}}}}function Ei(){return{width:0,height:0}}function wl(e,t,s=0){return(e-(Math.round(t)*2-s))%(Math.round(t)*2)}var we=0,pe=0,We=!1,Ye=!1,Li=!1,Ee,Cs=0,Sl=class{constructor(e,t,s,c,h,i){this._terminal=e,this._optionService=t,this._selectionRenderModel=s,this._decorationService=c,this._coreBrowserService=h,this._themeService=i,this.result={fg:0,bg:0,ext:0}}resolve(e,t,s,c){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,pe=0,we=0,Ye=!1,We=!1,Li=!1,Ee=this._themeService.colors,Cs=0,e.getCode()!==0&&e.extended.underlineStyle===4){let h=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Cs=t*c%(Math.round(h)*2)}if(this._decorationService.forEachDecorationAtCell(t,s,"bottom",h=>{h.backgroundColorRGB&&(pe=h.backgroundColorRGB.rgba>>8&16777215,Ye=!0),h.foregroundColorRGB&&(we=h.foregroundColorRGB.rgba>>8&16777215,We=!0)}),Li=this._selectionRenderModel.isCellSelected(this._terminal,t,s),Li){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:pe=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:pe=(this.result.fg&16777215)<<8|255;break;default:pe=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:pe=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:pe=(this.result.bg&16777215)<<8|255;break}pe=ct.blend(pe,(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else pe=(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Ye=!0,Ee.selectionForeground&&(we=Ee.selectionForeground.rgba>>8&16777215,We=!0),zn(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)we=(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:we=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:we=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:we=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:we=(this.result.fg&16777215)<<8|255;break;default:we=this._themeService.colors.foreground.rgba}we=ct.blend(we,(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}We=!0}}this._decorationService.forEachDecorationAtCell(t,s,"top",h=>{h.backgroundColorRGB&&(pe=h.backgroundColorRGB.rgba>>8&16777215,Ye=!0),h.foregroundColorRGB&&(we=h.foregroundColorRGB.rgba>>8&16777215,We=!0)}),Ye&&(Li?pe=e.bg&-16777216&-134217729|pe|50331648:pe=e.bg&-16777216|pe|50331648),We&&(we=e.fg&-16777216&-67108865|we|50331648),this.result.fg&67108864&&(Ye&&!We&&((this.result.bg&50331648)===0?we=this.result.fg&-134217728|Ee.background.rgba>>8&16777215&16777215|50331648:we=this.result.fg&-134217728|this.result.bg&67108863,We=!0),!Ye&&We&&((this.result.fg&50331648)===0?pe=this.result.bg&-67108864|Ee.foreground.rgba>>8&16777215&16777215|50331648:pe=this.result.bg&-67108864|this.result.fg&67108863,Ye=!0)),Ee=void 0,this.result.bg=Ye?pe:this.result.bg,this.result.fg=We?we:this.result.fg,this.result.ext&=536870911,this.result.ext|=Cs<<29&3758096384}},bl=.5,jn=hl||cl?"bottom":"ideographic",Cl={"\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}]},yl={"\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]]},xl={"\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`}},ti={"\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}};ti["\uE0BB"]=ti["\uE0BD"];ti["\uE0BF"]=ti["\uE0B9"];function El(e,t,s,c,h,i,r,l){let _=Cl[t];if(_)return Ll(e,_,s,c,h,i),!0;let n=yl[t];if(n)return kl(e,n,s,c,h,i),!0;let f=xl[t];if(f)return Rl(e,f,s,c,h,i,l),!0;let p=ti[t];return p?(Al(e,p,s,c,h,i,r,l),!0):!1}function Ll(e,t,s,c,h,i){for(let r=0;r<t.length;r++){let l=t[r],_=h/8,n=i/8;e.fillRect(s+l.x*_,c+l.y*n,l.w*_,l.h*n)}}var Zr=new Map;function kl(e,t,s,c,h,i){let r=Zr.get(t);r||(r=new Map,Zr.set(t,r));let l=e.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let _=r.get(l);if(!_){let n=t[0].length,f=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=n,p.height=f;let S=fe(p.getContext("2d")),g=new ImageData(n,f),a,d,o,u;if(l.startsWith("#"))a=parseInt(l.slice(1,3),16),d=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,d,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++)g.data[(v*n+C)*4]=a,g.data[(v*n+C)*4+1]=d,g.data[(v*n+C)*4+2]=o,g.data[(v*n+C)*4+3]=t[v][C]*(u*255);S.putImageData(g,0,0),_=fe(e.createPattern(p,null)),r.set(l,_)}e.fillStyle=_,e.fillRect(s,c,h,i)}function Rl(e,t,s,c,h,i,r){e.strokeStyle=e.fillStyle;for(let[l,_]of Object.entries(t)){e.beginPath(),e.lineWidth=r*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 p=f[0],S=qn[p];if(!S){console.error(`Could not find drawing instructions for "${p}"`);continue}let g=f.substring(1).split(",");!g[0]||!g[1]||S(e,Kn(g,h,i,s,c,!0,r))}e.stroke(),e.closePath()}}function Al(e,t,s,c,h,i,r,l){let _=new Path2D;_.rect(s,c,h,i),e.clip(_),e.beginPath();let n=r/12;e.lineWidth=l*n;for(let f of t.d.split(" ")){let p=f[0],S=qn[p];if(!S){console.error(`Could not find drawing instructions for "${p}"`);continue}let g=f.substring(1).split(",");!g[0]||!g[1]||S(e,Kn(g,h,i,s,c,!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 Qr(e,t,s=0){return Math.max(Math.min(e,t),s)}var qn={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 Kn(e,t,s,c,h,i,r,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*r-_*r,i&&n[f]!==0&&(n[f]=Qr(Math.round(n[f]+.5)-.5,t,0)),n[f]+=c+l*r;for(let f=1;f<n.length;f+=2)n[f]*=s,i&&n[f]!==0&&(n[f]=Qr(Math.round(n[f]+.5)-.5,s,0)),n[f]+=h;return n}var en=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},tn=class{constructor(){this._data=new en}set(e,t,s,c,h){this._data.get(e,t)||this._data.set(e,t,new en),this._data.get(e,t).set(s,c,h)}get(e,t,s,c){return this._data.get(e,t)?.get(s,c)}clear(){this._data.clear()}},Gn=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,s=0,c=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),s=Math.max(t,s),h=e.timeRemaining(),s*1.5>h){c-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-t))}ms`),this._start();return}c=h}this.clear()}},Ml=class extends Gn{_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())}}},Dl=class extends Gn{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Tl=!Ys&&"requestIdleCallback"in window?Dl:Ml,Tt=class Vn{constructor(){this.fg=0,this.bg=0,this.extended=new Yn}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 Vn;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}},Yn=class Xn{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}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 Xn(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},sn=class $s{constructor(t){this.element=t,this.next=$s.Undefined,this.prev=$s.Undefined}};sn.Undefined=new sn(void 0);var Bl=globalThis.performance&&typeof globalThis.performance.now=="function",Pl=class Jn{static create(t){return new Jn(t)}constructor(t){this._now=Bl&&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}},Ol=!1,rn=!1,Il=!1,$e;(e=>{e.None=()=>Ae.None;function t(B){if(Il){let{onDidAddListener:R}=B,O=js.create(),T=0;B.onDidAddListener=()=>{++T===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),R?.()}}}function s(B,R){return S(B,()=>{},0,void 0,!0,void 0,R)}e.defer=s;function c(B){return(R,O=null,T)=>{let b=!1,E;return E=B(k=>{if(!b)return E?E.dispose():b=!0,R.call(O,k)},null,T),b&&E.dispose(),E}}e.once=c;function h(B,R,O){return f((T,b=null,E)=>B(k=>T.call(b,R(k)),null,E),O)}e.map=h;function i(B,R,O){return f((T,b=null,E)=>B(k=>{R(k),T.call(b,k)},null,E),O)}e.forEach=i;function r(B,R,O){return f((T,b=null,E)=>B(k=>R(k)&&T.call(b,k),null,E),O)}e.filter=r;function l(B){return B}e.signal=l;function _(...B){return(R,O=null,T)=>{let b=Fn(...B.map(E=>E(k=>R.call(O,k))));return p(b,T)}}e.any=_;function n(B,R,O,T){let b=O;return h(B,E=>(b=R(b,E),b),T)}e.reduce=n;function f(B,R){let O,T={onWillAddFirstListener(){O=B(b.fire,b)},onDidRemoveLastListener(){O?.dispose()}};R||t(T);let b=new ae(T);return R?.add(b),b.event}function p(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function S(B,R,O=100,T=!1,b=!1,E,k){let A,W,K,$=0,j,P={leakWarningThreshold:E,onWillAddFirstListener(){A=B(U=>{$++,W=R(W,U),T&&!K&&(L.fire(W),W=void 0),j=()=>{let F=W;W=void 0,K=void 0,(!T||$>1)&&L.fire(F),$=0},typeof O=="number"?(clearTimeout(K),K=setTimeout(j,O)):K===void 0&&(K=0,queueMicrotask(j))})},onWillRemoveListener(){b&&$>0&&j?.()},onDidRemoveLastListener(){j=void 0,A.dispose()}};k||t(P);let L=new ae(P);return k?.add(L),L.event}e.debounce=S;function g(B,R=0,O){return e.debounce(B,(T,b)=>T?(T.push(b),T):[b],R,void 0,!0,void 0,O)}e.accumulate=g;function a(B,R=(T,b)=>T===b,O){let T=!0,b;return r(B,E=>{let k=T||!R(E,b);return T=!1,b=E,k},O)}e.latch=a;function d(B,R,O){return[e.filter(B,R,O),e.filter(B,T=>!R(T),O)]}e.split=d;function o(B,R=!1,O=[],T){let b=O.slice(),E=B(W=>{b?b.push(W):A.fire(W)});T&&T.add(E);let k=()=>{b?.forEach(W=>A.fire(W)),b=null},A=new ae({onWillAddFirstListener(){E||(E=B(W=>A.fire(W)),T&&T.add(E))},onDidAddFirstListener(){b&&(R?setTimeout(k):k())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return T&&T.add(A),A.event}e.buffer=o;function u(B,R){return(O,T,b)=>{let E=R(new C);return B(function(k){let A=E.evaluate(k);A!==v&&O.call(T,A)},void 0,b)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(O=>(R(O),O)),this}filter(R){return this.steps.push(O=>R(O)?O:v),this}reduce(R,O){let T=O;return this.steps.push(b=>(T=R(T,b),T)),this}latch(R=(O,T)=>O===T){let O=!0,T;return this.steps.push(b=>{let E=O||!R(b,T);return O=!1,T=b,E?b:v}),this}evaluate(R){for(let O of this.steps)if(R=O(R),R===v)break;return R}}function w(B,R,O=T=>T){let T=(...A)=>k.fire(O(...A)),b=()=>B.on(R,T),E=()=>B.removeListener(R,T),k=new ae({onWillAddFirstListener:b,onDidRemoveLastListener:E});return k.event}e.fromNodeEventEmitter=w;function y(B,R,O=T=>T){let T=(...A)=>k.fire(O(...A)),b=()=>B.addEventListener(R,T),E=()=>B.removeEventListener(R,T),k=new ae({onWillAddFirstListener:b,onDidRemoveLastListener:E});return k.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(R=>c(B)(R))}e.toPromise=m;function x(B){let R=new ae;return B.then(O=>{R.fire(O)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=x;function D(B,R){return B(O=>R.fire(O))}e.forward=D;function I(B,R,O){return R(O),B(T=>R(T))}e.runAndSubscribe=I;class H{constructor(R,O){this._observable=R,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};O||t(T),this.emitter=new ae(T),O&&O.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,O){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function M(B,R){return new H(B,R).emitter.event}e.fromObservable=M;function N(B){return(R,O,T)=>{let b=0,E=!1,k={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,R.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(k),B.reportChanges();let A={dispose(){B.removeObserver(k)}};return T instanceof Pt?T.add(A):Array.isArray(T)&&T.push(A),A}}e.fromObservableLight=N})($e||($e={}));var Us=class zs{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${zs._idPool++}`,zs.all.add(this)}start(t){this._stopWatch=new Pl,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}}};Us.all=new Set,Us._idPool=0;var Hl=Us,nn=-1,Zn=class Qn{constructor(t,s,c=(Qn._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=c,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let c=this.threshold;if(c<=0||s<c)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=c*.5;let[i,r]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${r}):`;console.warn(l),console.warn(i);let _=new Fl(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,s=0;for(let[c,h]of this._stacks)(!t||s<h)&&(t=[c,h],s=h);return t}};Zn._idPool=1;var Nl=Zn,js=class eo{constructor(t){this.value=t}static create(){let t=new Error;return new eo(t.stack??"")}print(){console.warn(this.value.split(`
56
+ `),{leaks:a,details:r}}};_l.idx=0;function fl(e){Ht=e}if(ul){let e="__is_disposable_tracked__";fl(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==Ae.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Ae.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function $i(e){return Ht?.trackDisposable(e),e}function Ui(e){Ht?.markAsDisposed(e)}function si(e,t){Ht?.setParent(e,t)}function pl(e,t){if(Ht)for(let i of e)Ht.setParent(i,t)}function Wn(e){if($s.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(a){t.push(a)}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 $n(...e){let t=Se(()=>Wn(e));return pl(e,t),t}function Se(e){let t=$i({dispose:dl(()=>{Ui(t),e()})});return t}var Un=class zn{constructor(){this._toDispose=new Set,this._isDisposed=!1,$i(this)}dispose(){this._isDisposed||(Ui(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Wn(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 si(t,this),this._isDisposed?zn.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),si(t,null))}};Un.DISABLE_DISPOSED_WARNING=!1;var Ft=Un,Ae=class{constructor(){this._store=new Ft,$i(this),si(this._store,this)}dispose(){Ui(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ae.None=Object.freeze({dispose(){}});var Zt=class{constructor(){this._isDisposed=!1,$i(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&si(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Ui(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&si(e,null),e}},Xs=typeof process<"u"&&"title"in process,ni=Xs?"node":navigator.userAgent,Js=Xs?"node":navigator.platform,gl=ni.includes("Firefox"),vl=ni.includes("Edge"),jn=/^((?!chrome|android).)*safari/i.test(ni);function ml(){if(!jn)return 0;let e=ni.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var pu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Js),gu=["Windows","Win16","Win32","WinCE"].includes(Js),vu=Js.indexOf("Linux")>=0,mu=/\bCrOS\b/.test(ni),wl="",ve=0,me=0,we=0,_e=0,Oe={css:"#00000000",rgba:0},xe;(e=>{function t(c,s,r,h){return h!==void 0?`#${bt(c)}${bt(s)}${bt(r)}${bt(h)}`:`#${bt(c)}${bt(s)}${bt(r)}`}e.toCss=t;function i(c,s,r,h=255){return(c<<24|s<<16|r<<8|h)>>>0}e.toRgba=i;function a(c,s,r,h){return{css:e.toCss(c,s,r,h),rgba:e.toRgba(c,s,r,h)}}e.toColor=a})(xe||(xe={}));var Ot;(e=>{function t(f,n){if(_e=(n.rgba&255)/255,_e===1)return{css:n.css,rgba:n.rgba};let _=n.rgba>>24&255,p=n.rgba>>16&255,b=n.rgba>>8&255,g=f.rgba>>24&255,l=f.rgba>>16&255,d=f.rgba>>8&255;ve=g+Math.round((_-g)*_e),me=l+Math.round((p-l)*_e),we=d+Math.round((b-d)*_e);let o=xe.toCss(ve,me,we),u=xe.toRgba(ve,me,we);return{css:o,rgba:u}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function a(f,n,_){let p=_t.ensureContrastRatio(f.rgba,n.rgba,_);if(p)return xe.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=a;function c(f){let n=(f.rgba|255)>>>0;return[ve,me,we]=_t.toChannels(n),{css:xe.toCss(ve,me,we),rgba:n}}e.opaque=c;function s(f,n){return _e=Math.round(n*255),[ve,me,we]=_t.toChannels(f.rgba),{css:xe.toCss(ve,me,we,_e),rgba:xe.toRgba(ve,me,we,_e)}}e.opacity=s;function r(f,n){return _e=f.rgba&255,s(f,_e*n/255)}e.multiplyOpacity=r;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=h})(Ot||(Ot={}));var Qr;(e=>{let t,i;try{let c=document.createElement("canvas");c.width=1,c.height=1;let s=c.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function a(c){if(c.match(/#[\da-f]{3,8}/i))switch(c.length){case 4:return ve=parseInt(c.slice(1,2).repeat(2),16),me=parseInt(c.slice(2,3).repeat(2),16),we=parseInt(c.slice(3,4).repeat(2),16),xe.toColor(ve,me,we);case 5:return ve=parseInt(c.slice(1,2).repeat(2),16),me=parseInt(c.slice(2,3).repeat(2),16),we=parseInt(c.slice(3,4).repeat(2),16),_e=parseInt(c.slice(4,5).repeat(2),16),xe.toColor(ve,me,we,_e);case 7:return{css:c,rgba:(parseInt(c.slice(1),16)<<8|255)>>>0};case 9:return{css:c,rgba:parseInt(c.slice(1),16)>>>0}}let s=c.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return ve=parseInt(s[1]),me=parseInt(s[2]),we=parseInt(s[3]),_e=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),xe.toColor(ve,me,we,_e);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=c,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ve,me,we,_e]=t.getImageData(0,0,1,1).data,_e!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:xe.toRgba(ve,me,we,_e),css:c}}e.toColor=a})(Qr||(Qr={}));var ye;(e=>{function t(a){return i(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function i(a,c,s){let r=a/255,h=c/255,f=s/255,n=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),_=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),p=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return n*.2126+_*.7152+p*.0722}e.relativeLuminance2=i})(ye||(ye={}));var _t;(e=>{function t(r,h){if(_e=(h&255)/255,_e===1)return h;let f=h>>24&255,n=h>>16&255,_=h>>8&255,p=r>>24&255,b=r>>16&255,g=r>>8&255;return ve=p+Math.round((f-p)*_e),me=b+Math.round((n-b)*_e),we=g+Math.round((_-g)*_e),xe.toRgba(ve,me,we)}e.blend=t;function i(r,h,f){let n=ye.relativeLuminance(r>>8),_=ye.relativeLuminance(h>>8);if(et(n,_)<f){if(_<n){let g=a(r,h,f),l=et(n,ye.relativeLuminance(g>>8));if(l<f){let d=c(r,h,f),o=et(n,ye.relativeLuminance(d>>8));return l>o?g:d}return g}let p=c(r,h,f),b=et(n,ye.relativeLuminance(p>>8));if(b<f){let g=a(r,h,f),l=et(n,ye.relativeLuminance(g>>8));return b>l?p:g}return p}}e.ensureContrastRatio=i;function a(r,h,f){let n=r>>24&255,_=r>>16&255,p=r>>8&255,b=h>>24&255,g=h>>16&255,l=h>>8&255,d=et(ye.relativeLuminance2(b,g,l),ye.relativeLuminance2(n,_,p));for(;d<f&&(b>0||g>0||l>0);)b-=Math.max(0,Math.ceil(b*.1)),g-=Math.max(0,Math.ceil(g*.1)),l-=Math.max(0,Math.ceil(l*.1)),d=et(ye.relativeLuminance2(b,g,l),ye.relativeLuminance2(n,_,p));return(b<<24|g<<16|l<<8|255)>>>0}e.reduceLuminance=a;function c(r,h,f){let n=r>>24&255,_=r>>16&255,p=r>>8&255,b=h>>24&255,g=h>>16&255,l=h>>8&255,d=et(ye.relativeLuminance2(b,g,l),ye.relativeLuminance2(n,_,p));for(;d<f&&(b<255||g<255||l<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),l=Math.min(255,l+Math.ceil((255-l)*.1)),d=et(ye.relativeLuminance2(b,g,l),ye.relativeLuminance2(n,_,p));return(b<<24|g<<16|l<<8|255)>>>0}e.increaseLuminance=c;function s(r){return[r>>24&255,r>>16&255,r>>8&255,r&255]}e.toChannels=s})(_t||(_t={}));function bt(e){let t=e.toString(16);return t.length<2?"0"+t:t}function et(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function pe(e){if(!e)throw new Error("value must not be falsy");return e}function Zs(e){return 57508<=e&&e<=57558}function bl(e){return 57520<=e&&e<=57527}function Sl(e){return 57344<=e&&e<=63743}function Cl(e){return 9472<=e&&e<=9631}function yl(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 xl(e,t,i,a){return t===1&&i>Math.ceil(a*1.5)&&e!==void 0&&e>255&&!yl(e)&&!Zs(e)&&!Sl(e)}function qn(e){return Zs(e)||Cl(e)}function El(){return{css:{canvas:ki(),cell:ki()},device:{canvas:ki(),cell:ki(),char:{width:0,height:0,left:0,top:0}}}}function ki(){return{width:0,height:0}}function Ll(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var be=0,ge=0,qe=!1,tt=!1,Ri=!1,Le,ys=0,kl=class{constructor(e,t,i,a,c,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=a,this._coreBrowserService=c,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,a){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,ge=0,be=0,tt=!1,qe=!1,Ri=!1,Le=this._themeService.colors,ys=0,e.getCode()!==0&&e.extended.underlineStyle===4){let c=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));ys=t*a%(Math.round(c)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",c=>{c.backgroundColorRGB&&(ge=c.backgroundColorRGB.rgba>>8&16777215,tt=!0),c.foregroundColorRGB&&(be=c.foregroundColorRGB.rgba>>8&16777215,qe=!0)}),Ri=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Ri){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ge=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ge=(this.result.fg&16777215)<<8|255;break;default:ge=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ge=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ge=(this.result.bg&16777215)<<8|255;break}ge=_t.blend(ge,(this._coreBrowserService.isFocused?Le.selectionBackgroundOpaque:Le.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ge=(this._coreBrowserService.isFocused?Le.selectionBackgroundOpaque:Le.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(tt=!0,Le.selectionForeground&&(be=Le.selectionForeground.rgba>>8&16777215,qe=!0),qn(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)be=(this._coreBrowserService.isFocused?Le.selectionBackgroundOpaque:Le.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:be=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:be=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:be=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:be=(this.result.fg&16777215)<<8|255;break;default:be=this._themeService.colors.foreground.rgba}be=_t.blend(be,(this._coreBrowserService.isFocused?Le.selectionBackgroundOpaque:Le.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}qe=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",c=>{c.backgroundColorRGB&&(ge=c.backgroundColorRGB.rgba>>8&16777215,tt=!0),c.foregroundColorRGB&&(be=c.foregroundColorRGB.rgba>>8&16777215,qe=!0)}),tt&&(Ri?ge=e.bg&-16777216&-134217729|ge|50331648:ge=e.bg&-16777216|ge|50331648),qe&&(be=e.fg&-16777216&-67108865|be|50331648),this.result.fg&67108864&&(tt&&!qe&&((this.result.bg&50331648)===0?be=this.result.fg&-134217728|Le.background.rgba>>8&16777215&16777215|50331648:be=this.result.fg&-134217728|this.result.bg&67108863,qe=!0),!tt&&qe&&((this.result.fg&50331648)===0?ge=this.result.bg&-67108864|Le.foreground.rgba>>8&16777215&16777215|50331648:ge=this.result.bg&-67108864|this.result.fg&67108863,tt=!0)),Le=void 0,this.result.bg=tt?ge:this.result.bg,this.result.fg=qe?be:this.result.fg,this.result.ext&=536870911,this.result.ext|=ys<<29&3758096384}},Rl=.5,Kn=gl||vl?"bottom":"ideographic",Ml={"\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}]},Al={"\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]]},Dl={"\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`}},ri={"\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}};ri["\uE0BB"]=ri["\uE0BD"];ri["\uE0BF"]=ri["\uE0B9"];function Tl(e,t,i,a,c,s,r,h){let f=Ml[t];if(f)return Bl(e,f,i,a,c,s),!0;let n=Al[t];if(n)return Pl(e,n,i,a,c,s),!0;let _=Dl[t];if(_)return Ol(e,_,i,a,c,s,h),!0;let p=ri[t];return p?(Il(e,p,i,a,c,s,r,h),!0):!1}function Bl(e,t,i,a,c,s){for(let r=0;r<t.length;r++){let h=t[r],f=c/8,n=s/8;e.fillRect(i+h.x*f,a+h.y*n,h.w*f,h.h*n)}}var en=new Map;function Pl(e,t,i,a,c,s){let r=en.get(t);r||(r=new Map,en.set(t,r));let h=e.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let f=r.get(h);if(!f){let n=t[0].length,_=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=n,p.height=_;let b=pe(p.getContext("2d")),g=new ImageData(n,_),l,d,o,u;if(h.startsWith("#"))l=parseInt(h.slice(1,3),16),d=parseInt(h.slice(3,5),16),o=parseInt(h.slice(5,7),16),u=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[l,d,o,u]=h.substring(5,h.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let v=0;v<_;v++)for(let C=0;C<n;C++)g.data[(v*n+C)*4]=l,g.data[(v*n+C)*4+1]=d,g.data[(v*n+C)*4+2]=o,g.data[(v*n+C)*4+3]=t[v][C]*(u*255);b.putImageData(g,0,0),f=pe(e.createPattern(p,null)),r.set(h,f)}e.fillStyle=f,e.fillRect(i,a,c,s)}function Ol(e,t,i,a,c,s,r){e.strokeStyle=e.fillStyle;for(let[h,f]of Object.entries(t)){e.beginPath(),e.lineWidth=r*Number.parseInt(h);let n;if(typeof f=="function"){let _=.15/s*c;n=f(.15,_)}else n=f;for(let _ of n.split(" ")){let p=_[0],b=Gn[p];if(!b){console.error(`Could not find drawing instructions for "${p}"`);continue}let g=_.substring(1).split(",");!g[0]||!g[1]||b(e,Vn(g,c,s,i,a,!0,r))}e.stroke(),e.closePath()}}function Il(e,t,i,a,c,s,r,h){let f=new Path2D;f.rect(i,a,c,s),e.clip(f),e.beginPath();let n=r/12;e.lineWidth=h*n;for(let _ of t.d.split(" ")){let p=_[0],b=Gn[p];if(!b){console.error(`Could not find drawing instructions for "${p}"`);continue}let g=_.substring(1).split(",");!g[0]||!g[1]||b(e,Vn(g,c,s,i,a,!1,h,(t.leftPadding??0)*(n/2),(t.rightPadding??0)*(n/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function tn(e,t,i=0){return Math.max(Math.min(e,t),i)}var Gn={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 Vn(e,t,i,a,c,s,r,h=0,f=0){let n=e.map(_=>parseFloat(_)||parseInt(_));if(n.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<n.length;_+=2)n[_]*=t-h*r-f*r,s&&n[_]!==0&&(n[_]=tn(Math.round(n[_]+.5)-.5,t,0)),n[_]+=a+h*r;for(let _=1;_<n.length;_+=2)n[_]*=i,s&&n[_]!==0&&(n[_]=tn(Math.round(n[_]+.5)-.5,i,0)),n[_]+=c;return n}var sn=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},rn=class{constructor(){this._data=new sn}set(e,t,i,a,c){this._data.get(e,t)||this._data.set(e,t,new sn),this._data.get(e,t).set(i,a,c)}get(e,t,i,a){return this._data.get(e,t)?.get(i,a)}clear(){this._data.clear()}},Yn=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,i=0,a=e.timeRemaining(),c=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),c=e.timeRemaining(),i*1.5>c){a-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-t))}ms`),this._start();return}a=c}this.clear()}},Nl=class extends Yn{_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())}}},Fl=class extends Yn{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Hl=!Xs&&"requestIdleCallback"in window?Fl:Nl,It=class Xn{constructor(){this.fg=0,this.bg=0,this.extended=new Jn}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 Xn;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}},Jn=class Zn{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}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 Zn(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},nn=class Us{constructor(t){this.element=t,this.next=Us.Undefined,this.prev=Us.Undefined}};nn.Undefined=new nn(void 0);var Wl=globalThis.performance&&typeof globalThis.performance.now=="function",$l=class Qn{static create(t){return new Qn(t)}constructor(t){this._now=Wl&&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}},Ul=!1,on=!1,zl=!1,Ke;(e=>{e.None=()=>Ae.None;function t(D){if(zl){let{onDidAddListener:A}=D,T=qs.create(),B=0;D.onDidAddListener=()=>{++B===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),T.print()),A?.()}}}function i(D,A){return b(D,()=>{},0,void 0,!0,void 0,A)}e.defer=i;function a(D){return(A,T=null,B)=>{let S=!1,L;return L=D(k=>{if(!S)return L?L.dispose():S=!0,A.call(T,k)},null,B),S&&L.dispose(),L}}e.once=a;function c(D,A,T){return _((B,S=null,L)=>D(k=>B.call(S,A(k)),null,L),T)}e.map=c;function s(D,A,T){return _((B,S=null,L)=>D(k=>{A(k),B.call(S,k)},null,L),T)}e.forEach=s;function r(D,A,T){return _((B,S=null,L)=>D(k=>A(k)&&B.call(S,k),null,L),T)}e.filter=r;function h(D){return D}e.signal=h;function f(...D){return(A,T=null,B)=>{let S=$n(...D.map(L=>L(k=>A.call(T,k))));return p(S,B)}}e.any=f;function n(D,A,T,B){let S=T;return c(D,L=>(S=A(S,L),S),B)}e.reduce=n;function _(D,A){let T,B={onWillAddFirstListener(){T=D(S.fire,S)},onDidRemoveLastListener(){T?.dispose()}};A||t(B);let S=new oe(B);return A?.add(S),S.event}function p(D,A){return A instanceof Array?A.push(D):A&&A.add(D),D}function b(D,A,T=100,B=!1,S=!1,L,k){let M,F,K,G=0,W,O={leakWarningThreshold:L,onWillAddFirstListener(){M=D(H=>{G++,F=A(F,H),B&&!K&&(x.fire(F),F=void 0),W=()=>{let j=F;F=void 0,K=void 0,(!B||G>1)&&x.fire(j),G=0},typeof T=="number"?(clearTimeout(K),K=setTimeout(W,T)):K===void 0&&(K=0,queueMicrotask(W))})},onWillRemoveListener(){S&&G>0&&W?.()},onDidRemoveLastListener(){W=void 0,M.dispose()}};k||t(O);let x=new oe(O);return k?.add(x),x.event}e.debounce=b;function g(D,A=0,T){return e.debounce(D,(B,S)=>B?(B.push(S),B):[S],A,void 0,!0,void 0,T)}e.accumulate=g;function l(D,A=(B,S)=>B===S,T){let B=!0,S;return r(D,L=>{let k=B||!A(L,S);return B=!1,S=L,k},T)}e.latch=l;function d(D,A,T){return[e.filter(D,A,T),e.filter(D,B=>!A(B),T)]}e.split=d;function o(D,A=!1,T=[],B){let S=T.slice(),L=D(F=>{S?S.push(F):M.fire(F)});B&&B.add(L);let k=()=>{S?.forEach(F=>M.fire(F)),S=null},M=new oe({onWillAddFirstListener(){L||(L=D(F=>M.fire(F)),B&&B.add(L))},onDidAddFirstListener(){S&&(A?setTimeout(k):k())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return B&&B.add(M),M.event}e.buffer=o;function u(D,A){return(T,B,S)=>{let L=A(new C);return D(function(k){let M=L.evaluate(k);M!==v&&T.call(B,M)},void 0,S)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(T=>(A(T),T)),this}filter(A){return this.steps.push(T=>A(T)?T:v),this}reduce(A,T){let B=T;return this.steps.push(S=>(B=A(B,S),B)),this}latch(A=(T,B)=>T===B){let T=!0,B;return this.steps.push(S=>{let L=T||!A(S,B);return T=!1,B=S,L?S:v}),this}evaluate(A){for(let T of this.steps)if(A=T(A),A===v)break;return A}}function w(D,A,T=B=>B){let B=(...M)=>k.fire(T(...M)),S=()=>D.on(A,B),L=()=>D.removeListener(A,B),k=new oe({onWillAddFirstListener:S,onDidRemoveLastListener:L});return k.event}e.fromNodeEventEmitter=w;function y(D,A,T=B=>B){let B=(...M)=>k.fire(T(...M)),S=()=>D.addEventListener(A,B),L=()=>D.removeEventListener(A,B),k=new oe({onWillAddFirstListener:S,onDidRemoveLastListener:L});return k.event}e.fromDOMEventEmitter=y;function m(D){return new Promise(A=>a(D)(A))}e.toPromise=m;function E(D){let A=new oe;return D.then(T=>{A.fire(T)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=E;function P(D,A){return D(T=>A.fire(T))}e.forward=P;function I(D,A,T){return A(T),D(B=>A(B))}e.runAndSubscribe=I;class N{constructor(A,T){this._observable=A,this._counter=0,this._hasChanged=!1;let B={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};T||t(B),this.emitter=new oe(B),T&&T.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,T){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(D,A){return new N(D,A).emitter.event}e.fromObservable=R;function U(D){return(A,T,B)=>{let S=0,L=!1,k={beginUpdate(){S++},endUpdate(){S--,S===0&&(D.reportChanges(),L&&(L=!1,A.call(T)))},handlePossibleChange(){},handleChange(){L=!0}};D.addObserver(k),D.reportChanges();let M={dispose(){D.removeObserver(k)}};return B instanceof Ft?B.add(M):Array.isArray(B)&&B.push(M),M}}e.fromObservableLight=U})(Ke||(Ke={}));var zs=class js{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${js._idPool++}`,js.all.add(this)}start(t){this._stopWatch=new $l,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}}};zs.all=new Set,zs._idPool=0;var jl=zs,an=-1,eo=class to{constructor(t,i,a=(to._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let a=this.threshold;if(a<=0||i<a)return;this._stacks||(this._stacks=new Map);let c=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,c+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;let[s,r]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${r}):`;console.warn(h),console.warn(s);let f=new Kl(h,s);this._errorHandler(f)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[a,c]of this._stacks)(!t||i<c)&&(t=[a,c],i=c);return t}};eo._idPool=1;var ql=eo,qs=class io{constructor(t){this.value=t}static create(){let t=new Error;return new io(t.stack??"")}print(){console.warn(this.value.split(`
57
57
  `).slice(2).join(`
58
- `))}},Fl=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Wl=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},$l=0,Mi=class{constructor(e){this.value=e,this.id=$l++}},Ul=2,zl=(e,t)=>{if(e instanceof Mi)t(e);else for(let s=0;s<e.length;s++){let c=e[s];c&&t(c)}},Di;if(Ol){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),Di=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var ae=class{constructor(e){this._size=0,this._options=e,this._leakageMon=nn>0||this._options?.leakWarningThreshold?new Nl(e?.onListenerError??Ai,this._options?.leakWarningThreshold??nn):void 0,this._perfMon=this._options?._profName?new Hl(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(rn){let e=this._listeners;queueMicrotask(()=>{zl(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,s)=>{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 Wl(`${l}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(this._options?.onListenerError||Ai)(n),Ae.None}if(this._disposed)return Ae.None;t&&(e=e.bind(t));let c=new Mi(e),h,i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(c.stack=js.create(),h=this._leakageMon.check(c.stack,this._size+1)),rn&&(c.stack=i??js.create()),this._listeners?this._listeners instanceof Mi?(this._deliveryQueue??(this._deliveryQueue=new jl),this._listeners=[this._listeners,c]):this._listeners.push(c):(this._options?.onWillAddFirstListener?.(this),this._listeners=c,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=Se(()=>{Di?.unregister(r),h?.(),this._removeListener(c)});if(s instanceof Pt?s.add(r):Array.isArray(s)&&s.push(r),Di){let l=new Error().stack.split(`
58
+ `))}},Kl=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Gl=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Vl=0,Ti=class{constructor(e){this.value=e,this.id=Vl++}},Yl=2,Xl=(e,t)=>{if(e instanceof Ti)t(e);else for(let i=0;i<e.length;i++){let a=e[i];a&&t(a)}},Bi;if(Ul){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),Bi=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var oe=class{constructor(e){this._size=0,this._options=e,this._leakageMon=an>0||this._options?.leakWarningThreshold?new ql(e?.onListenerError??Di,this._options?.leakWarningThreshold??an):void 0,this._perfMon=this._options?._profName?new jl(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(on){let e=this._listeners;queueMicrotask(()=>{Xl(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,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new Gl(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Di)(n),Ae.None}if(this._disposed)return Ae.None;t&&(e=e.bind(t));let a=new Ti(e),c,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=qs.create(),c=this._leakageMon.check(a.stack,this._size+1)),on&&(a.stack=s??qs.create()),this._listeners?this._listeners instanceof Ti?(this._deliveryQueue??(this._deliveryQueue=new Jl),this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=Se(()=>{Bi?.unregister(r),c?.(),this._removeListener(a)});if(i instanceof Ft?i.add(r):Array.isArray(i)&&i.push(r),Bi){let h=new Error().stack.split(`
60
60
  `).slice(2,3).join(`
61
- `).trim(),_=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);Di.register(r,_?.[2]??l,r)}return r}),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,s=t.indexOf(e);if(s===-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[s]=void 0;let c=this._deliveryQueue.current===this;if(this._size*Ul<=t.length){let h=0;for(let i=0;i<t.length;i++)t[i]?t[h++]=t[i]:c&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||Ai;if(!s){e.value(t);return}try{e.value(t)}catch(c){s(c)}}_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 Mi)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}},jl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},on={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}},Xt=2,Jt,lt=class Mt{constructor(t,s,c){this._document=t,this._config=s,this._unicodeService=c,this._didWarmUp=!1,this._cacheMap=new tn,this._cacheMapCombined=new tn,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Tt,this._textureSize=512,this._onAddTextureAtlasCanvas=new ae,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ae,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=to(t,this._config.deviceCellWidth*4+Xt*2,this._config.deviceCellHeight+Xt*2),this._tmpCtx=fe(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 Tl;for(let s=33;s<126;s++)t.enqueue(()=>{if(!this._cacheMap.get(s,0,0,0)){let c=this._drawToCache(s,0,0,0,!1,void 0);this._cacheMap.set(s,0,0,0,c)}})}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(Mt.maxAtlasPages&&this._pages.length>=Math.max(4,Mt.maxAtlasPages)){let s=this._pages.filter(n=>n.canvas.width*2<=(Mt.maxTextureSize||4096)).sort((n,f)=>f.canvas.width!==n.canvas.width?f.canvas.width-n.canvas.width:f.percentageUsed-n.percentageUsed),c=-1,h=0;for(let n=0;n<s.length;n++)if(s[n].canvas.width!==h)c=n,h=s[n].canvas.width;else if(n-c===3)break;let i=s.slice(c,c+4),r=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=r.length-1;n>=0;n--)this._deletePage(r[n]);this.pages.push(_),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(_.canvas)}let t=new ys(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,s){let c=t[0].canvas.width*2,h=new ys(this._document,c,t);for(let[i,r]of t.entries()){let l=i*r.canvas.width%c,_=Math.floor(i/2)*r.canvas.height;h.ctx.drawImage(r.canvas,l,_);for(let f of r.glyphs)f.texturePage=s,f.sizeClipSpace.x=f.size.x/c,f.sizeClipSpace.y=f.size.y/c,f.texturePosition.x+=l,f.texturePosition.y+=_,f.texturePositionClipSpace.x=f.texturePosition.x/c,f.texturePositionClipSpace.y=f.texturePosition.y/c;this._onRemoveTextureAtlasCanvas.fire(r.canvas);let n=this._activePages.indexOf(r);n!==-1&&this._activePages.splice(n,1)}return h}_deletePage(t){this._pages.splice(t,1);for(let s=t;s<this._pages.length;s++){let c=this._pages[s];for(let h of c.glyphs)h.texturePage--;c.version++}}getRasterizedGlyphCombinedChar(t,s,c,h,i,r){return this._getFromCacheMap(this._cacheMapCombined,t,s,c,h,i,r)}getRasterizedGlyph(t,s,c,h,i,r){return this._getFromCacheMap(this._cacheMap,t,s,c,h,i,r)}_getFromCacheMap(t,s,c,h,i,r,l){return Jt=t.get(s,c,h,i),Jt||(Jt=this._drawToCache(s,c,h,i,r,l),t.set(s,c,h,i,Jt)),Jt}_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,s,c,h){if(this._config.allowTransparency)return Te;let i;switch(t){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(s);break;case 50331648:let r=Tt.toColorRGB(s);i=ye.toColor(r[0],r[1],r[2]);break;default:c?i=Dt.opaque(this._config.colors.foreground):i=this._config.colors.background;break}return this._config.allowTransparency||(i=Dt.opaque(i)),i}_getForegroundColor(t,s,c,h,i,r,l,_,n,f){let p=this._getMinimumContrastColor(t,s,c,h,i,r,l,n,_,f);if(p)return p;let S;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&n&&r<8&&(r+=8),S=this._getColorFromAnsiIndex(r);break;case 50331648:let g=Tt.toColorRGB(r);S=ye.toColor(g[0],g[1],g[2]);break;default:l?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Dt.opaque(S)),_&&(S=Dt.multiplyOpacity(S,bl)),S}_resolveBackgroundRgba(t,s,c){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(s).rgba;case 50331648:return s<<8;default:return c?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,s,c,h){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&h&&s<8&&(s+=8),this._getColorFromAnsiIndex(s).rgba;case 50331648:return s<<8;default:return c?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,s,c,h,i,r,l,_,n,f){if(this._config.minimumContrastRatio===1||f)return;let p=this._getContrastCache(n),S=p.getColor(t,h);if(S!==void 0)return S||void 0;let g=this._resolveBackgroundRgba(s,c,l),a=this._resolveForegroundRgba(i,r,l,_),d=ct.ensureContrastRatio(g,a,this._config.minimumContrastRatio/(n?2:1));if(!d){p.setColor(t,h,null);return}let o=ye.toColor(d>>24&255,d>>16&255,d>>8&255);return p.setColor(t,h,o),o}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,s,c,h,i,r){let l=typeof t=="number"?String.fromCharCode(t):t;r&&this._tmpCanvas.parentElement!==r&&(this._tmpCanvas.style.display="none",r.append(this._tmpCanvas));let _=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+Xt*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<_&&(this._tmpCanvas.width=_);let n=Math.min(this._config.deviceCellHeight+Xt*4,this._textureSize);if(this._tmpCanvas.height<n&&(this._tmpCanvas.height=n),this._tmpCtx.save(),this._workAttributeData.fg=c,this._workAttributeData.bg=s,this._workAttributeData.extended.ext=h,!!this._workAttributeData.isInvisible())return on;let f=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),g=!!this._workAttributeData.isItalic(),a=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),o=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),w=this._workAttributeData.getBgColorMode();if(p){let A=u;u=C,C=A;let W=v;v=w,w=W}let y=this._getBackgroundColor(w,C,p,S);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=g?"italic":"";this._tmpCtx.font=`${x} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=jn;let D=l.length===1&&Js(l.charCodeAt(0)),I=l.length===1&&_l(l.charCodeAt(0)),H=this._getForegroundColor(s,w,C,c,v,u,p,S,f,zn(l.charCodeAt(0)));this._tmpCtx.fillStyle=H.css;let M=I?0:Xt*2,N=!1;this._config.customGlyphs!==!1&&(N=El(this._tmpCtx,l,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!D,R;if(typeof t=="number"?R=this._unicodeService.wcwidth(t):R=this._unicodeService.getStringCellWidth(t),a){this._tmpCtx.save();let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),W=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(${Tt.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 K=M,$=Math.ceil(M+this._config.deviceCharHeight)-W-(i?A*2:0),j=$+A,P=$+A*2,L=this._workAttributeData.getUnderlineVariantOffset();for(let U=0;U<R;U++){this._tmpCtx.save();let F=K+U*this._config.deviceCellWidth,q=K+(U+1)*this._config.deviceCellWidth,G=F+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(F,$),this._tmpCtx.lineTo(q,$),this._tmpCtx.moveTo(F,P),this._tmpCtx.lineTo(q,P);break;case 3:let Q=A<=1?P:Math.ceil(M+this._config.deviceCharHeight-A/2)-W,ee=A<=1?$:Math.ceil(M+this._config.deviceCharHeight+A/2)-W,te=new Path2D;te.rect(F,$,this._config.deviceCellWidth,P-$),this._tmpCtx.clip(te),this._tmpCtx.moveTo(F-this._config.deviceCellWidth/2,j),this._tmpCtx.bezierCurveTo(F-this._config.deviceCellWidth/2,ee,F,ee,F,j),this._tmpCtx.bezierCurveTo(F,Q,G,Q,G,j),this._tmpCtx.bezierCurveTo(G,ee,q,ee,q,j),this._tmpCtx.bezierCurveTo(q,Q,q+this._config.deviceCellWidth/2,Q,q+this._config.deviceCellWidth/2,j);break;case 4:let re=L===0?0:L>=A?A*2-L:A-L;L>=A||re===0?(this._tmpCtx.setLineDash([Math.round(A),Math.round(A)]),this._tmpCtx.moveTo(F+re,$),this._tmpCtx.lineTo(q,$)):(this._tmpCtx.setLineDash([Math.round(A),Math.round(A)]),this._tmpCtx.moveTo(F,$),this._tmpCtx.lineTo(F+re,$),this._tmpCtx.moveTo(F+re+A,$),this._tmpCtx.lineTo(q,$)),L=wl(q-F,A,L);break;case 5:let X=.6,z=.3,V=q-F,Y=Math.floor(X*V),J=Math.floor(z*V),oe=V-Y-J;this._tmpCtx.setLineDash([Y,J,oe]),this._tmpCtx.moveTo(F,$),this._tmpCtx.lineTo(q,$);break;default:this._tmpCtx.moveTo(F,$),this._tmpCtx.lineTo(q,$);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!N&&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 F=new Path2D;F.rect(K,$-Math.ceil(A/2),this._config.deviceCellWidth*R,P-$+Math.ceil(A/2)),this._tmpCtx.clip(F),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(l,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(o){let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),W=A%2===1?.5:0;this._tmpCtx.lineWidth=A,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+W),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*R,M+W),this._tmpCtx.stroke()}if(N||this._tmpCtx.fillText(l,M,M+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let A=xs(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),y,H,B);if(A)for(let W=1;W<=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,M,M+this._config.deviceCharHeight-W),A=xs(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),y,H,B),!!A);W++);}if(d){let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),W=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=A,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-W),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*R,M+Math.floor(this._config.deviceCharHeight/2)-W),this._tmpCtx.stroke()}this._tmpCtx.restore();let O=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),T;if(this._config.allowTransparency?T=ql(O):T=xs(O,y,H,B),T)return on;let b=this._findGlyphBoundingBox(O,this._workBoundingBox,_,I,N,M),E,k;for(;;){if(this._activePages.length===0){let A=this._createNewPage();E=A,k=A.currentRow,k.height=b.size.y;break}E=this._activePages[this._activePages.length-1],k=E.currentRow;for(let A of this._activePages)b.size.y<=A.currentRow.height&&(E=A,k=A.currentRow);for(let A=this._activePages.length-1;A>=0;A--)for(let W of this._activePages[A].fixedRows)W.height<=k.height&&b.size.y<=W.height&&(E=this._activePages[A],k=W);if(b.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ys(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,k=this._overflowSizePage.currentRow,k.x+b.size.x>=E.canvas.width&&(k.x=0,k.y+=k.height,k.height=0);break}if(k.y+b.size.y>=E.canvas.height||k.height>b.size.y+2){let A=!1;if(E.currentRow.y+E.currentRow.height+b.size.y>=E.canvas.height){let W;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+b.size.y<K.canvas.height){W=K;break}if(W)E=W;else if(Mt.maxAtlasPages&&this._pages.length>=Mt.maxAtlasPages&&k.y+b.size.y<=E.canvas.height&&k.height>=b.size.y&&k.x+b.size.x<=E.canvas.width)A=!0;else{let K=this._createNewPage();E=K,k=K.currentRow,k.height=b.size.y,A=!0}}A||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),k={x:0,y:E.currentRow.y+E.currentRow.height,height:b.size.y},E.fixedRows.push(k),E.currentRow={x:0,y:k.y+k.height,height:0})}if(k.x+b.size.x<=E.canvas.width)break;k===E.currentRow?(k.x=0,k.y+=k.height,k.height=0):E.fixedRows.splice(E.fixedRows.indexOf(k),1)}return b.texturePage=this._pages.indexOf(E),b.texturePosition.x=k.x,b.texturePosition.y=k.y,b.texturePositionClipSpace.x=k.x/E.canvas.width,b.texturePositionClipSpace.y=k.y/E.canvas.height,b.sizeClipSpace.x/=E.canvas.width,b.sizeClipSpace.y/=E.canvas.height,k.height=Math.max(k.height,b.size.y),k.x+=b.size.x,E.ctx.putImageData(O,b.texturePosition.x-this._workBoundingBox.left,b.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,b.size.x,b.size.y),E.addGlyph(b),E.version++,b}_findGlyphBoundingBox(t,s,c,h,i,r){s.top=0;let l=h?this._config.deviceCellHeight:this._tmpCanvas.height,_=h?this._config.deviceCellWidth:c,n=!1;for(let f=0;f<l;f++){for(let p=0;p<_;p++){let S=f*this._tmpCanvas.width*4+p*4+3;if(t.data[S]!==0){s.top=f,n=!0;break}}if(n)break}s.left=0,n=!1;for(let f=0;f<r+_;f++){for(let p=0;p<l;p++){let S=p*this._tmpCanvas.width*4+f*4+3;if(t.data[S]!==0){s.left=f,n=!0;break}}if(n)break}s.right=_,n=!1;for(let f=r+_-1;f>=r;f--){for(let p=0;p<l;p++){let S=p*this._tmpCanvas.width*4+f*4+3;if(t.data[S]!==0){s.right=f,n=!0;break}}if(n)break}s.bottom=l,n=!1;for(let f=l-1;f>=0;f--){for(let p=0;p<_;p++){let S=f*this._tmpCanvas.width*4+p*4+3;if(t.data[S]!==0){s.bottom=f,n=!0;break}}if(n)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:s.right-s.left+1,y:s.bottom-s.top+1},sizeClipSpace:{x:s.right-s.left+1,y:s.bottom-s.top+1},offset:{x:-s.left+r+(h||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-s.top+r+(h||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},ys=class{constructor(e,t,s){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],s)for(let c of s)this._glyphs.push(...c.glyphs),this._usedPixels+=c._usedPixels;this.canvas=to(e,t,t),this.ctx=fe(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 xs(e,t,s,c){let h=t.rgba>>>24,i=t.rgba>>>16&255,r=t.rgba>>>8&255,l=s.rgba>>>24,_=s.rgba>>>16&255,n=s.rgba>>>8&255,f=Math.floor((Math.abs(h-l)+Math.abs(i-_)+Math.abs(r-n))/12),p=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===h&&e.data[S+1]===i&&e.data[S+2]===r||c&&Math.abs(e.data[S]-h)+Math.abs(e.data[S+1]-i)+Math.abs(e.data[S+2]-r)<f?e.data[S+3]=0:p=!1;return p}function ql(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function to(e,t,s){let c=e.createElement("canvas");return c.width=t,c.height=s,c}function Kl(e,t,s,c,h,i,r,l){let _={foreground:i.foreground,background:i.background,cursor:Te,cursorAccent:Te,selectionForeground:Te,selectionBackgroundTransparent:Te,selectionBackgroundOpaque:Te,selectionInactiveBackgroundTransparent:Te,selectionInactiveBackgroundOpaque:Te,overviewRulerBorder:Te,scrollbarSliderBackground:Te,scrollbarSliderHoverBackground:Te,scrollbarSliderActiveBackground:Te,ansi:i.ansi.slice(),contrastCache:i.contrastCache,halfContrastCache:i.halfContrastCache};return{customGlyphs:h.customGlyphs,devicePixelRatio:r,deviceMaxTextureSize:l,letterSpacing:h.letterSpacing,lineHeight:h.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:s,deviceCharHeight:c,fontFamily:h.fontFamily,fontSize:h.fontSize,fontWeight:h.fontWeight,fontWeightBold:h.fontWeightBold,allowTransparency:h.allowTransparency,drawBoldTextInBrightColors:h.drawBoldTextInBrightColors,minimumContrastRatio:h.minimumContrastRatio,colors:_}}function an(e,t){for(let s=0;s<e.colors.ansi.length;s++)if(e.colors.ansi[s].rgba!==t.colors.ansi[s].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 Gl(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Pe=[];function io(e,t,s,c,h,i,r,l,_){let n=Kl(c,h,i,r,t,s,l,_);for(let S=0;S<Pe.length;S++){let g=Pe[S],a=g.ownedBy.indexOf(e);if(a>=0){if(an(g.config,n))return g.atlas;g.ownedBy.length===1?(g.atlas.dispose(),Pe.splice(S,1)):g.ownedBy.splice(a,1);break}}for(let S=0;S<Pe.length;S++){let g=Pe[S];if(an(g.config,n))return g.ownedBy.push(e),g.atlas}let f=e._core,p={atlas:new lt(document,n,f.unicodeService),config:n,ownedBy:[e]};return Pe.push(p),p.atlas}function ln(e){for(let t=0;t<Pe.length;t++){let s=Pe[t].ownedBy.indexOf(e);if(s!==-1){Pe[t].ownedBy.length===1?(Pe[t].atlas.dispose(),Pe.splice(t,1)):Pe[t].ownedBy.splice(s,1);break}}}var ki=600,Vl=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=ki){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=ki-(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=ki-(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})},ki)},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 hn(e,t,s){let c=new t.ResizeObserver(h=>{let i=h.find(_=>_.target===e);if(!i)return;if(!("devicePixelContentBoxSize"in i)){c?.disconnect(),c=void 0;return}let r=i.devicePixelContentBoxSize[0].inlineSize,l=i.devicePixelContentBoxSize[0].blockSize;r>0&&l>0&&s(r,l)});try{c.observe(e,{box:["device-pixel-content-box"]})}catch{c.disconnect(),c=void 0}return Se(()=>c?.disconnect())}function Yl(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var cn=class so extends Tt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Yn,this.combinedData=""}static fromCharData(t){let s=new so;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Yl(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 s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let c=t[1].charCodeAt(0);if(55296<=c&&c<=56319){let h=t[1].charCodeAt(1);56320<=h&&h<=57343?this.content=(c-55296)*1024+h-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ro=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function no(e,t,s){let c=fe(e.createProgram());if(e.attachShader(c,fe(dn(e,e.VERTEX_SHADER,t))),e.attachShader(c,fe(dn(e,e.FRAGMENT_SHADER,s))),e.linkProgram(c),e.getProgramParameter(c,e.LINK_STATUS))return c;console.error(e.getProgramInfoLog(c)),e.deleteProgram(c)}function dn(e,t,s){let c=fe(e.createShader(t));if(e.shaderSource(c,s),e.compileShader(c),e.getShaderParameter(c,e.COMPILE_STATUS))return c;console.error(e.getShaderInfoLog(c)),e.deleteShader(c)}function Xl(e,t){let s=Math.min(e.length*2,t),c=new Float32Array(s);for(let h=0;h<e.length;h++)c[h]=e[h];return c}var Jl=class{constructor(e){this.texture=e,this.version=-1}},Zl=`#version 300 es
61
+ `).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(h);Bi.register(r,f?.[2]??h,r)}return r}),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,i=t.indexOf(e);if(i===-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[i]=void 0;let a=this._deliveryQueue.current===this;if(this._size*Yl<=t.length){let c=0;for(let s=0;s<t.length;s++)t[s]?t[c++]=t[s]:a&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Di;if(!i){e.value(t);return}try{e.value(t)}catch(a){i(a)}}_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 Ti)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}},Jl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ln={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}},Qt=2,ei,dt=class Pt{constructor(t,i,a){this._document=t,this._config=i,this._unicodeService=a,this._didWarmUp=!1,this._cacheMap=new rn,this._cacheMapCombined=new rn,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new It,this._textureSize=512,this._onAddTextureAtlasCanvas=new oe,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new oe,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=so(t,this._config.deviceCellWidth*4+Qt*2,this._config.deviceCellHeight+Qt*2),this._tmpCtx=pe(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 Hl;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let a=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,a)}})}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(Pt.maxAtlasPages&&this._pages.length>=Math.max(4,Pt.maxAtlasPages)){let i=this._pages.filter(n=>n.canvas.width*2<=(Pt.maxTextureSize||4096)).sort((n,_)=>_.canvas.width!==n.canvas.width?_.canvas.width-n.canvas.width:_.percentageUsed-n.percentageUsed),a=-1,c=0;for(let n=0;n<i.length;n++)if(i[n].canvas.width!==c)a=n,c=i[n].canvas.width;else if(n-a===3)break;let s=i.slice(a,a+4),r=s.map(n=>n.glyphs[0].texturePage).sort((n,_)=>n>_?1:-1),h=this.pages.length-s.length,f=this._mergePages(s,h);f.version++;for(let n=r.length-1;n>=0;n--)this._deletePage(r[n]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new xs(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let a=t[0].canvas.width*2,c=new xs(this._document,a,t);for(let[s,r]of t.entries()){let h=s*r.canvas.width%a,f=Math.floor(s/2)*r.canvas.height;c.ctx.drawImage(r.canvas,h,f);for(let _ of r.glyphs)_.texturePage=i,_.sizeClipSpace.x=_.size.x/a,_.sizeClipSpace.y=_.size.y/a,_.texturePosition.x+=h,_.texturePosition.y+=f,_.texturePositionClipSpace.x=_.texturePosition.x/a,_.texturePositionClipSpace.y=_.texturePosition.y/a;this._onRemoveTextureAtlasCanvas.fire(r.canvas);let n=this._activePages.indexOf(r);n!==-1&&this._activePages.splice(n,1)}return c}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let a=this._pages[i];for(let c of a.glyphs)c.texturePage--;a.version++}}getRasterizedGlyphCombinedChar(t,i,a,c,s,r){return this._getFromCacheMap(this._cacheMapCombined,t,i,a,c,s,r)}getRasterizedGlyph(t,i,a,c,s,r){return this._getFromCacheMap(this._cacheMap,t,i,a,c,s,r)}_getFromCacheMap(t,i,a,c,s,r,h){return ei=t.get(i,a,c,s),ei||(ei=this._drawToCache(i,a,c,s,r,h),t.set(i,a,c,s,ei)),ei}_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,i,a,c){if(this._config.allowTransparency)return Oe;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(i);break;case 50331648:let r=It.toColorRGB(i);s=xe.toColor(r[0],r[1],r[2]);break;default:a?s=Ot.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=Ot.opaque(s)),s}_getForegroundColor(t,i,a,c,s,r,h,f,n,_){let p=this._getMinimumContrastColor(t,i,a,c,s,r,h,n,f,_);if(p)return p;let b;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&n&&r<8&&(r+=8),b=this._getColorFromAnsiIndex(r);break;case 50331648:let g=It.toColorRGB(r);b=xe.toColor(g[0],g[1],g[2]);break;default:h?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=Ot.opaque(b)),f&&(b=Ot.multiplyOpacity(b,Rl)),b}_resolveBackgroundRgba(t,i,a){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return a?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,a,c){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&c&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return a?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,a,c,s,r,h,f,n,_){if(this._config.minimumContrastRatio===1||_)return;let p=this._getContrastCache(n),b=p.getColor(t,c);if(b!==void 0)return b||void 0;let g=this._resolveBackgroundRgba(i,a,h),l=this._resolveForegroundRgba(s,r,h,f),d=_t.ensureContrastRatio(g,l,this._config.minimumContrastRatio/(n?2:1));if(!d){p.setColor(t,c,null);return}let o=xe.toColor(d>>24&255,d>>16&255,d>>8&255);return p.setColor(t,c,o),o}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,a,c,s,r){let h=typeof t=="number"?String.fromCharCode(t):t;r&&this._tmpCanvas.parentElement!==r&&(this._tmpCanvas.style.display="none",r.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+Qt*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let n=Math.min(this._config.deviceCellHeight+Qt*4,this._textureSize);if(this._tmpCanvas.height<n&&(this._tmpCanvas.height=n),this._tmpCtx.save(),this._workAttributeData.fg=a,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=c,!!this._workAttributeData.isInvisible())return ln;let _=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),g=!!this._workAttributeData.isItalic(),l=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),o=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),w=this._workAttributeData.getBgColorMode();if(p){let M=u;u=C,C=M;let F=v;v=w,w=F}let y=this._getBackgroundColor(w,C,p,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=_?this._config.fontWeightBold:this._config.fontWeight,E=g?"italic":"";this._tmpCtx.font=`${E} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Kn;let P=h.length===1&&Zs(h.charCodeAt(0)),I=h.length===1&&bl(h.charCodeAt(0)),N=this._getForegroundColor(i,w,C,a,v,u,p,b,_,qn(h.charCodeAt(0)));this._tmpCtx.fillStyle=N.css;let R=I?0:Qt*2,U=!1;this._config.customGlyphs!==!1&&(U=Tl(this._tmpCtx,h,R,R,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let D=!P,A;if(typeof t=="number"?A=this._unicodeService.wcwidth(t):A=this._unicodeService.getStringCellWidth(t),l){this._tmpCtx.save();let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),F=M%2===1?.5:0;if(this._tmpCtx.lineWidth=M,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())D=!1,this._tmpCtx.strokeStyle=`rgb(${It.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{D=!1;let H=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&H<8&&(H+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(H).css}this._tmpCtx.beginPath();let K=R,G=Math.ceil(R+this._config.deviceCharHeight)-F-(s?M*2:0),W=G+M,O=G+M*2,x=this._workAttributeData.getUnderlineVariantOffset();for(let H=0;H<A;H++){this._tmpCtx.save();let j=K+H*this._config.deviceCellWidth,$=K+(H+1)*this._config.deviceCellWidth,q=j+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(j,G),this._tmpCtx.lineTo($,G),this._tmpCtx.moveTo(j,O),this._tmpCtx.lineTo($,O);break;case 3:let Y=M<=1?O:Math.ceil(R+this._config.deviceCharHeight-M/2)-F,te=M<=1?G:Math.ceil(R+this._config.deviceCharHeight+M/2)-F,Q=new Path2D;Q.rect(j,G,this._config.deviceCellWidth,O-G),this._tmpCtx.clip(Q),this._tmpCtx.moveTo(j-this._config.deviceCellWidth/2,W),this._tmpCtx.bezierCurveTo(j-this._config.deviceCellWidth/2,te,j,te,j,W),this._tmpCtx.bezierCurveTo(j,Y,q,Y,q,W),this._tmpCtx.bezierCurveTo(q,te,$,te,$,W),this._tmpCtx.bezierCurveTo($,Y,$+this._config.deviceCellWidth/2,Y,$+this._config.deviceCellWidth/2,W);break;case 4:let ie=x===0?0:x>=M?M*2-x:M-x;x>=M||ie===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(j+ie,G),this._tmpCtx.lineTo($,G)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(j,G),this._tmpCtx.lineTo(j+ie,G),this._tmpCtx.moveTo(j+ie+M,G),this._tmpCtx.lineTo($,G)),x=Ll($-j,M,x);break;case 5:let Z=.6,fe=.3,Te=$-j,Be=Math.floor(Z*Te),He=Math.floor(fe*Te),z=Te-Be-He;this._tmpCtx.setLineDash([Be,He,z]),this._tmpCtx.moveTo(j,G),this._tmpCtx.lineTo($,G);break;default:this._tmpCtx.moveTo(j,G),this._tmpCtx.lineTo($,G);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!U&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let H=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in H&&H.actualBoundingBoxDescent>0){this._tmpCtx.save();let j=new Path2D;j.rect(K,G-Math.ceil(M/2),this._config.deviceCellWidth*A,O-G+Math.ceil(M/2)),this._tmpCtx.clip(j),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(h,R,R+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(o){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),F=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+F),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*A,R+F),this._tmpCtx.stroke()}if(U||this._tmpCtx.fillText(h,R,R+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let M=Es(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,N,D);if(M)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(h,R,R+this._config.deviceCharHeight-F),M=Es(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,N,D),!!M);F++);}if(d){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),F=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,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*A,R+Math.floor(this._config.deviceCharHeight/2)-F),this._tmpCtx.stroke()}this._tmpCtx.restore();let T=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),B;if(this._config.allowTransparency?B=Zl(T):B=Es(T,y,N,D),B)return ln;let S=this._findGlyphBoundingBox(T,this._workBoundingBox,f,I,U,R),L,k;for(;;){if(this._activePages.length===0){let M=this._createNewPage();L=M,k=M.currentRow,k.height=S.size.y;break}L=this._activePages[this._activePages.length-1],k=L.currentRow;for(let M of this._activePages)S.size.y<=M.currentRow.height&&(L=M,k=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let F of this._activePages[M].fixedRows)F.height<=k.height&&S.size.y<=F.height&&(L=this._activePages[M],k=F);if(S.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new xs(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),L=this._overflowSizePage,k=this._overflowSizePage.currentRow,k.x+S.size.x>=L.canvas.width&&(k.x=0,k.y+=k.height,k.height=0);break}if(k.y+S.size.y>=L.canvas.height||k.height>S.size.y+2){let M=!1;if(L.currentRow.y+L.currentRow.height+S.size.y>=L.canvas.height){let F;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+S.size.y<K.canvas.height){F=K;break}if(F)L=F;else if(Pt.maxAtlasPages&&this._pages.length>=Pt.maxAtlasPages&&k.y+S.size.y<=L.canvas.height&&k.height>=S.size.y&&k.x+S.size.x<=L.canvas.width)M=!0;else{let K=this._createNewPage();L=K,k=K.currentRow,k.height=S.size.y,M=!0}}M||(L.currentRow.height>0&&L.fixedRows.push(L.currentRow),k={x:0,y:L.currentRow.y+L.currentRow.height,height:S.size.y},L.fixedRows.push(k),L.currentRow={x:0,y:k.y+k.height,height:0})}if(k.x+S.size.x<=L.canvas.width)break;k===L.currentRow?(k.x=0,k.y+=k.height,k.height=0):L.fixedRows.splice(L.fixedRows.indexOf(k),1)}return S.texturePage=this._pages.indexOf(L),S.texturePosition.x=k.x,S.texturePosition.y=k.y,S.texturePositionClipSpace.x=k.x/L.canvas.width,S.texturePositionClipSpace.y=k.y/L.canvas.height,S.sizeClipSpace.x/=L.canvas.width,S.sizeClipSpace.y/=L.canvas.height,k.height=Math.max(k.height,S.size.y),k.x+=S.size.x,L.ctx.putImageData(T,S.texturePosition.x-this._workBoundingBox.left,S.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,S.size.x,S.size.y),L.addGlyph(S),L.version++,S}_findGlyphBoundingBox(t,i,a,c,s,r){i.top=0;let h=c?this._config.deviceCellHeight:this._tmpCanvas.height,f=c?this._config.deviceCellWidth:a,n=!1;for(let _=0;_<h;_++){for(let p=0;p<f;p++){let b=_*this._tmpCanvas.width*4+p*4+3;if(t.data[b]!==0){i.top=_,n=!0;break}}if(n)break}i.left=0,n=!1;for(let _=0;_<r+f;_++){for(let p=0;p<h;p++){let b=p*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){i.left=_,n=!0;break}}if(n)break}i.right=f,n=!1;for(let _=r+f-1;_>=r;_--){for(let p=0;p<h;p++){let b=p*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){i.right=_,n=!0;break}}if(n)break}i.bottom=h,n=!1;for(let _=h-1;_>=0;_--){for(let p=0;p<f;p++){let b=_*this._tmpCanvas.width*4+p*4+3;if(t.data[b]!==0){i.bottom=_,n=!0;break}}if(n)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+r+(c||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+r+(c||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},xs=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let a of i)this._glyphs.push(...a.glyphs),this._usedPixels+=a._usedPixels;this.canvas=so(e,t,t),this.ctx=pe(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 Es(e,t,i,a){let c=t.rgba>>>24,s=t.rgba>>>16&255,r=t.rgba>>>8&255,h=i.rgba>>>24,f=i.rgba>>>16&255,n=i.rgba>>>8&255,_=Math.floor((Math.abs(c-h)+Math.abs(s-f)+Math.abs(r-n))/12),p=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===c&&e.data[b+1]===s&&e.data[b+2]===r||a&&Math.abs(e.data[b]-c)+Math.abs(e.data[b+1]-s)+Math.abs(e.data[b+2]-r)<_?e.data[b+3]=0:p=!1;return p}function Zl(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function so(e,t,i){let a=e.createElement("canvas");return a.width=t,a.height=i,a}function Ql(e,t,i,a,c,s,r,h){let f={foreground:s.foreground,background:s.background,cursor:Oe,cursorAccent:Oe,selectionForeground:Oe,selectionBackgroundTransparent:Oe,selectionBackgroundOpaque:Oe,selectionInactiveBackgroundTransparent:Oe,selectionInactiveBackgroundOpaque:Oe,overviewRulerBorder:Oe,scrollbarSliderBackground:Oe,scrollbarSliderHoverBackground:Oe,scrollbarSliderActiveBackground:Oe,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:c.customGlyphs,devicePixelRatio:r,deviceMaxTextureSize:h,letterSpacing:c.letterSpacing,lineHeight:c.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:a,fontFamily:c.fontFamily,fontSize:c.fontSize,fontWeight:c.fontWeight,fontWeightBold:c.fontWeightBold,allowTransparency:c.allowTransparency,drawBoldTextInBrightColors:c.drawBoldTextInBrightColors,minimumContrastRatio:c.minimumContrastRatio,colors:f}}function hn(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].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 eh(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Ne=[];function ro(e,t,i,a,c,s,r,h,f){let n=Ql(a,c,s,r,t,i,h,f);for(let b=0;b<Ne.length;b++){let g=Ne[b],l=g.ownedBy.indexOf(e);if(l>=0){if(hn(g.config,n))return g.atlas;g.ownedBy.length===1?(g.atlas.dispose(),Ne.splice(b,1)):g.ownedBy.splice(l,1);break}}for(let b=0;b<Ne.length;b++){let g=Ne[b];if(hn(g.config,n))return g.ownedBy.push(e),g.atlas}let _=e._core,p={atlas:new dt(document,n,_.unicodeService),config:n,ownedBy:[e]};return Ne.push(p),p.atlas}function cn(e){for(let t=0;t<Ne.length;t++){let i=Ne[t].ownedBy.indexOf(e);if(i!==-1){Ne[t].ownedBy.length===1?(Ne[t].atlas.dispose(),Ne.splice(t,1)):Ne[t].ownedBy.splice(i,1);break}}}var Mi=600,th=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=Mi){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Mi-(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=Mi-(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})},Mi)},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 dn(e,t,i){let a=new t.ResizeObserver(c=>{let s=c.find(f=>f.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){a?.disconnect(),a=void 0;return}let r=s.devicePixelContentBoxSize[0].inlineSize,h=s.devicePixelContentBoxSize[0].blockSize;r>0&&h>0&&i(r,h)});try{a.observe(e,{box:["device-pixel-content-box"]})}catch{a.disconnect(),a=void 0}return Se(()=>a?.disconnect())}function ih(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var un=class no extends It{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Jn,this.combinedData=""}static fromCharData(t){let i=new no;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ih(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 i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let a=t[1].charCodeAt(0);if(55296<=a&&a<=56319){let c=t[1].charCodeAt(1);56320<=c&&c<=57343?this.content=(a-55296)*1024+c-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},oo=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function ao(e,t,i){let a=pe(e.createProgram());if(e.attachShader(a,pe(_n(e,e.VERTEX_SHADER,t))),e.attachShader(a,pe(_n(e,e.FRAGMENT_SHADER,i))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)}function _n(e,t,i){let a=pe(e.createShader(t));if(e.shaderSource(a,i),e.compileShader(a),e.getShaderParameter(a,e.COMPILE_STATUS))return a;console.error(e.getShaderInfoLog(a)),e.deleteShader(a)}function sh(e,t){let i=Math.min(e.length*2,t),a=new Float32Array(i);for(let c=0;c<e.length;c++)a[c]=e[c];return a}var rh=class{constructor(e){this.texture=e,this.version=-1}},nh=`#version 300 es
62
62
  layout (location = 0) in vec2 a_unitquad;
63
63
  layout (location = 1) in vec2 a_cellpos;
64
64
  layout (location = 2) in vec2 a_offset;
@@ -78,7 +78,7 @@ void main() {
78
78
  gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
79
79
  v_texpage = int(a_texpage);
80
80
  v_texcoord = a_texcoord + a_unitquad * a_texsize;
81
- }`;function Ql(e){let t="";for(let s=1;s<e;s++)t+=` else if (v_texpage == ${s}) { outColor = texture(u_texture[${s}], v_texcoord); }`;return`#version 300 es
81
+ }`;function oh(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
82
82
  precision lowp float;
83
83
 
84
84
  in vec2 v_texcoord;
@@ -92,7 +92,7 @@ void main() {
92
92
  if (v_texpage == 0) {
93
93
  outColor = texture(u_texture[0], v_texcoord);
94
94
  } ${t}
95
- }`}var ht=11,At=ht*Float32Array.BYTES_PER_ELEMENT,eh=2,ce=0,le,Es=0,Zt=0,th=class extends Ae{constructor(e,t,s,c){super(),this._terminal=e,this._gl=t,this._dimensions=s,this._optionsService=c,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let h=this._gl;lt.maxAtlasPages===void 0&&(lt.maxAtlasPages=Math.min(32,fe(h.getParameter(h.MAX_TEXTURE_IMAGE_UNITS))),lt.maxTextureSize=fe(h.getParameter(h.MAX_TEXTURE_SIZE))),this._program=fe(no(h,Zl,Ql(lt.maxAtlasPages))),this._register(Se(()=>h.deleteProgram(this._program))),this._projectionLocation=fe(h.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=fe(h.getUniformLocation(this._program,"u_resolution")),this._textureLocation=fe(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]),r=h.createBuffer();this._register(Se(()=>h.deleteBuffer(r))),h.bindBuffer(h.ARRAY_BUFFER,r),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(Se(()=>h.deleteBuffer(_))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_),h.bufferData(h.ELEMENT_ARRAY_BUFFER,l,h.STATIC_DRAW),this._attributesBuffer=fe(h.createBuffer()),this._register(Se(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,2,h.FLOAT,!1,At,0),h.vertexAttribDivisor(2,1),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,h.FLOAT,!1,At,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(3,1),h.enableVertexAttribArray(4),h.vertexAttribPointer(4,1,h.FLOAT,!1,At,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(4,1),h.enableVertexAttribArray(5),h.vertexAttribPointer(5,2,h.FLOAT,!1,At,5*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(5,1),h.enableVertexAttribArray(6),h.vertexAttribPointer(6,2,h.FLOAT,!1,At,7*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(6,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,At,9*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.useProgram(this._program);let n=new Int32Array(lt.maxAtlasPages);for(let f=0;f<lt.maxAtlasPages;f++)n[f]=f;h.uniform1iv(this._textureLocation,n),h.uniformMatrix4fv(this._projectionLocation,!1,ro),this._atlasTextures=[];for(let f=0;f<lt.maxAtlasPages;f++){let p=new Jl(fe(h.createTexture()));this._register(Se(()=>h.deleteTexture(p.texture))),h.activeTexture(h.TEXTURE0+f),h.bindTexture(h.TEXTURE_2D,p.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]=p}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,s,c,h,i,r,l,_){this._updateCell(this._vertices.attributes,e,t,s,c,h,i,r,l,_)}_updateCell(e,t,s,c,h,i,r,l,_,n){if(ce=(s*this._terminal.cols+t)*ht,c===0||c===void 0){e.fill(0,ce,ce+ht-1-eh);return}this._atlas&&(l&&l.length>1?le=this._atlas.getRasterizedGlyphCombinedChar(l,h,i,r,!1,this._terminal.element):le=this._atlas.getRasterizedGlyph(c,h,i,r,!1,this._terminal.element),Es=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),h!==n&&le.offset.x>Es?(Zt=le.offset.x-Es,e[ce]=-(le.offset.x-Zt)+this._dimensions.device.char.left,e[ce+1]=-le.offset.y+this._dimensions.device.char.top,e[ce+2]=(le.size.x-Zt)/this._dimensions.device.canvas.width,e[ce+3]=le.size.y/this._dimensions.device.canvas.height,e[ce+4]=le.texturePage,e[ce+5]=le.texturePositionClipSpace.x+Zt/this._atlas.pages[le.texturePage].canvas.width,e[ce+6]=le.texturePositionClipSpace.y,e[ce+7]=le.sizeClipSpace.x-Zt/this._atlas.pages[le.texturePage].canvas.width,e[ce+8]=le.sizeClipSpace.y):(e[ce]=-le.offset.x+this._dimensions.device.char.left,e[ce+1]=-le.offset.y+this._dimensions.device.char.top,e[ce+2]=le.size.x/this._dimensions.device.canvas.width,e[ce+3]=le.size.y/this._dimensions.device.canvas.height,e[ce+4]=le.texturePage,e[ce+5]=le.texturePositionClipSpace.x,e[ce+6]=le.texturePositionClipSpace.y,e[ce+7]=le.sizeClipSpace.x,e[ce+8]=le.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&vl(c,_,le.size.x,this._dimensions.device.cell.width)&&(e[ce+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*ht;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==t?this._vertices.attributesBuffers[s]=new Float32Array(t):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=t,s=0;for(let c=0;c<e.rows;c++)for(let h=0;h<e.cols;h++)this._vertices.attributes[s+9]=h/e.cols,this._vertices.attributes[s+10]=c/e.rows,s+=ht}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 s=this._vertices.attributesBuffers[this._activeBuffer],c=0;for(let h=0;h<e.lineLengths.length;h++){let i=h*this._terminal.cols*ht,r=this._vertices.attributes.subarray(i,i+e.lineLengths[h]*ht);s.set(r,c),c+=r.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,s.subarray(0,c),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,c/ht)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,s){e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[s].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[s].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[s].version=t.pages[s].version}setDimensions(e){this._dimensions=e}},ih=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,s,c=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let h=e.buffers.active.ydisp,i=t[1]-h,r=s[1]-h,l=Math.max(i,0),_=Math.min(r,e.rows-1);if(l>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=c,this.viewportStartRow=i,this.viewportEndRow=r,this.viewportCappedStartRow=l,this.viewportCappedEndRow=_,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function sh(){return new ih}var Ni=4,Ti=1,Bi=2,Ls=3,rh=2147483648,nh=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=sh()}resize(e,t){let s=e*t*Ni;s!==this.cells.length&&(this.cells=new Uint32Array(s),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},oh=`#version 300 es
95
+ }`}var ut=11,Bt=ut*Float32Array.BYTES_PER_ELEMENT,ah=2,ue=0,le,Ls=0,ti=0,lh=class extends Ae{constructor(e,t,i,a){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=a,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let c=this._gl;dt.maxAtlasPages===void 0&&(dt.maxAtlasPages=Math.min(32,pe(c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS))),dt.maxTextureSize=pe(c.getParameter(c.MAX_TEXTURE_SIZE))),this._program=pe(ao(c,nh,oh(dt.maxAtlasPages))),this._register(Se(()=>c.deleteProgram(this._program))),this._projectionLocation=pe(c.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=pe(c.getUniformLocation(this._program,"u_resolution")),this._textureLocation=pe(c.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=c.createVertexArray(),c.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),r=c.createBuffer();this._register(Se(()=>c.deleteBuffer(r))),c.bindBuffer(c.ARRAY_BUFFER,r),c.bufferData(c.ARRAY_BUFFER,s,c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),f=c.createBuffer();this._register(Se(()=>c.deleteBuffer(f))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,f),c.bufferData(c.ELEMENT_ARRAY_BUFFER,h,c.STATIC_DRAW),this._attributesBuffer=pe(c.createBuffer()),this._register(Se(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,2,c.FLOAT,!1,Bt,0),c.vertexAttribDivisor(2,1),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,c.FLOAT,!1,Bt,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(3,1),c.enableVertexAttribArray(4),c.vertexAttribPointer(4,1,c.FLOAT,!1,Bt,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(4,1),c.enableVertexAttribArray(5),c.vertexAttribPointer(5,2,c.FLOAT,!1,Bt,5*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(5,1),c.enableVertexAttribArray(6),c.vertexAttribPointer(6,2,c.FLOAT,!1,Bt,7*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(6,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,Bt,9*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.useProgram(this._program);let n=new Int32Array(dt.maxAtlasPages);for(let _=0;_<dt.maxAtlasPages;_++)n[_]=_;c.uniform1iv(this._textureLocation,n),c.uniformMatrix4fv(this._projectionLocation,!1,oo),this._atlasTextures=[];for(let _=0;_<dt.maxAtlasPages;_++){let p=new rh(pe(c.createTexture()));this._register(Se(()=>c.deleteTexture(p.texture))),c.activeTexture(c.TEXTURE0+_),c.bindTexture(c.TEXTURE_2D,p.texture),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,1,1,0,c.RGBA,c.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=p}c.enable(c.BLEND),c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,a,c,s,r,h,f){this._updateCell(this._vertices.attributes,e,t,i,a,c,s,r,h,f)}_updateCell(e,t,i,a,c,s,r,h,f,n){if(ue=(i*this._terminal.cols+t)*ut,a===0||a===void 0){e.fill(0,ue,ue+ut-1-ah);return}this._atlas&&(h&&h.length>1?le=this._atlas.getRasterizedGlyphCombinedChar(h,c,s,r,!1,this._terminal.element):le=this._atlas.getRasterizedGlyph(a,c,s,r,!1,this._terminal.element),Ls=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),c!==n&&le.offset.x>Ls?(ti=le.offset.x-Ls,e[ue]=-(le.offset.x-ti)+this._dimensions.device.char.left,e[ue+1]=-le.offset.y+this._dimensions.device.char.top,e[ue+2]=(le.size.x-ti)/this._dimensions.device.canvas.width,e[ue+3]=le.size.y/this._dimensions.device.canvas.height,e[ue+4]=le.texturePage,e[ue+5]=le.texturePositionClipSpace.x+ti/this._atlas.pages[le.texturePage].canvas.width,e[ue+6]=le.texturePositionClipSpace.y,e[ue+7]=le.sizeClipSpace.x-ti/this._atlas.pages[le.texturePage].canvas.width,e[ue+8]=le.sizeClipSpace.y):(e[ue]=-le.offset.x+this._dimensions.device.char.left,e[ue+1]=-le.offset.y+this._dimensions.device.char.top,e[ue+2]=le.size.x/this._dimensions.device.canvas.width,e[ue+3]=le.size.y/this._dimensions.device.canvas.height,e[ue+4]=le.texturePage,e[ue+5]=le.texturePositionClipSpace.x,e[ue+6]=le.texturePositionClipSpace.y,e[ue+7]=le.sizeClipSpace.x,e[ue+8]=le.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&xl(a,f,le.size.x,this._dimensions.device.cell.width)&&(e[ue+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*ut;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let a=0;a<e.rows;a++)for(let c=0;c<e.cols;c++)this._vertices.attributes[i+9]=c/e.cols,this._vertices.attributes[i+10]=a/e.rows,i+=ut}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 i=this._vertices.attributesBuffers[this._activeBuffer],a=0;for(let c=0;c<e.lineLengths.length;c++){let s=c*this._terminal.cols*ut,r=this._vertices.attributes.subarray(s,s+e.lineLengths[c]*ut);i.set(r,a),a+=r.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,a),t.STREAM_DRAW);for(let c=0;c<this._atlas.pages.length;c++)this._atlas.pages[c].version!==this._atlasTextures[c].version&&this._bindAtlasPageTexture(t,this._atlas,c);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,a/ut)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].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[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},hh=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,i,a=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let c=e.buffers.active.ydisp,s=t[1]-c,r=i[1]-c,h=Math.max(s,0),f=Math.min(r,e.rows-1);if(h>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=s,this.viewportEndRow=r,this.viewportCappedStartRow=h,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function ch(){return new hh}var Wi=4,Pi=1,Oi=2,ks=3,dh=2147483648,uh=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=ch()}resize(e,t){let i=e*t*Wi;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},_h=`#version 300 es
96
96
  layout (location = 0) in vec2 a_position;
97
97
  layout (location = 1) in vec2 a_size;
98
98
  layout (location = 2) in vec4 a_color;
@@ -106,7 +106,7 @@ void main() {
106
106
  vec2 zeroToOne = a_position + (a_unitquad * a_size);
107
107
  gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
108
108
  v_color = a_color;
109
- }`,ah=`#version 300 es
109
+ }`,fh=`#version 300 es
110
110
  precision lowp float;
111
111
 
112
112
  in vec4 v_color;
@@ -115,7 +115,7 @@ out vec4 outColor;
115
115
 
116
116
  void main() {
117
117
  outColor = v_color;
118
- }`,Ze=8,ks=Ze*Float32Array.BYTES_PER_ELEMENT,lh=20*Ze,un=class{constructor(){this.attributes=new Float32Array(lh),this.count=0}},Xe=0,_n=0,fn=0,pn=0,gn=0,vn=0,mn=0,hh=class extends Ae{constructor(e,t,s,c){super(),this._terminal=e,this._gl=t,this._dimensions=s,this._themeService=c,this._vertices=new un,this._verticesCursor=new un;let h=this._gl;this._program=fe(no(h,oh,ah)),this._register(Se(()=>h.deleteProgram(this._program))),this._projectionLocation=fe(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]),r=h.createBuffer();this._register(Se(()=>h.deleteBuffer(r))),h.bindBuffer(h.ARRAY_BUFFER,r),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(Se(()=>h.deleteBuffer(_))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_),h.bufferData(h.ELEMENT_ARRAY_BUFFER,l,h.STATIC_DRAW),this._attributesBuffer=fe(h.createBuffer()),this._register(Se(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,ks,0),h.vertexAttribDivisor(0,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,ks,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,ks,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(2,1),this._updateCachedColors(c.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,ro),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,s=this._vertices,c=1,h,i,r,l,_,n,f,p,S,g,a;for(h=0;h<t.rows;h++){for(r=-1,l=0,_=0,n=!1,i=0;i<t.cols;i++)f=(h*t.cols+i)*Ni,p=e.cells[f+Ti],S=e.cells[f+Bi],g=!!(S&67108864),(p!==l||S!==_&&(n||g))&&((l!==0||n&&_!==0)&&(a=c++*Ze,this._updateRectangle(s,a,_,l,r,i,h)),r=i,l=p,_=S,n=g);(l!==0||n&&_!==0)&&(a=c++*Ze,this._updateRectangle(s,a,_,l,r,t.cols,h))}s.count=c}updateCursor(e){let t=this._verticesCursor,s=e.cursor;if(!s||s.style==="block"){t.count=0;return}let c,h=0;(s.style==="bar"||s.style==="outline")&&(c=h++*Ze,this._addRectangleFloat(t.attributes,c,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(c=h++*Ze,this._addRectangleFloat(t.attributes,c,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(c=h++*Ze,this._addRectangleFloat(t.attributes,c,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),c=h++*Ze,this._addRectangleFloat(t.attributes,c,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=h}_updateRectangle(e,t,s,c,h,i,r){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:Xe=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Xe=(s&16777215)<<8;break;default:Xe=this._themeService.colors.foreground.rgba}else switch(c&50331648){case 16777216:case 33554432:Xe=this._themeService.colors.ansi[c&255].rgba;break;case 50331648:Xe=(c&16777215)<<8;break;default:Xe=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=Xl(e.attributes,this._terminal.rows*this._terminal.cols*Ze)),_n=h*this._dimensions.device.cell.width,fn=r*this._dimensions.device.cell.height,pn=(Xe>>24&255)/255,gn=(Xe>>16&255)/255,vn=(Xe>>8&255)/255,mn=1,this._addRectangle(e.attributes,t,_n,fn,(i-h)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,pn,gn,vn,mn)}_addRectangle(e,t,s,c,h,i,r,l,_,n){e[t]=s/this._dimensions.device.canvas.width,e[t+1]=c/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]=r,e[t+5]=l,e[t+6]=_,e[t+7]=n}_addRectangleFloat(e,t,s,c,h,i,r){e[t]=s/this._dimensions.device.canvas.width,e[t+1]=c/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]=r[0],e[t+5]=r[1],e[t+6]=r[2],e[t+7]=r[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])}},ch=class extends Ae{constructor(e,t,s,c,h,i,r,l){super(),this._container=t,this._alpha=h,this._coreBrowserService=i,this._optionsService=r,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-${s}-layer`),this._canvas.style.zIndex=c.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(_=>{this._refreshCharAtlas(e,_),this.reset(e)})),this._register(Se(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=fe(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,s){}handleSelectionChanged(e,t,s,c=!1){}_setTransparency(e,t){if(t===this._alpha)return;let s=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=io(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,s=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*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,s,c){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,s*this._deviceCellWidth,c*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,s*this._deviceCellWidth,c*this._deviceCellHeight))}_fillCharTrueColor(e,t,s,c){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=jn,this._clipCell(s,c,t.getWidth()),this._ctx.fillText(t.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,c*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,s){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,s){let c=t?e.options.fontWeightBold:e.options.fontWeight;return`${s?"italic":""} ${c} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},dh=class extends ch{constructor(e,t,s,c,h,i,r){super(s,e,"link",t,!0,h,i,r),this._register(c.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(c.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&&Gl(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()}},Ie=typeof window=="object"?window:globalThis,qs=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ae,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ae,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let c=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(c,t),this._onDidChangeZoomLevel.fire(c)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let c=this.getWindowId(s);this.mapWindowIdToFullScreen.set(c,t),this._onDidChangeFullscreen.fire(c)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};qs.INSTANCE=new qs;var oo=qs;function uh(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}var _u=oo.INSTANCE.onDidChangeZoomLevel,fu=oo.INSTANCE.onDidChangeFullscreen,It=typeof navigator=="object"?navigator.userAgent:"",pu=It.indexOf("Firefox")>=0,Rs=It.indexOf("AppleWebKit")>=0,_h=It.indexOf("Chrome")>=0,fh=!_h&&It.indexOf("Safari")>=0,gu=It.indexOf("Electron/")>=0,vu=It.indexOf("Android")>=0,Pi=!1;if(typeof Ie.matchMedia=="function"){let e=Ie.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ie.matchMedia("(display-mode: fullscreen)");Pi=e.matches,uh(Ie,e,({matches:s})=>{Pi&&t.matches||(Pi=s)})}function ph(){return Pi}var Bt="en",Ks=!1,Gs=!1,Oi=!1,gh=!1,ao=!1,lo=!1,vh=!1,mh=!1,wh=!1,Sh=!1,Ri,Ii=Bt,wn=Bt,bh,Je,et=globalThis,Re;typeof et.vscode<"u"&&typeof et.vscode.process<"u"?Re=et.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Re=process);var ho=typeof Re?.versions?.electron=="string",Ch=ho&&Re?.type==="renderer";if(typeof Re=="object"){Ks=Re.platform==="win32",Gs=Re.platform==="darwin",Oi=Re.platform==="linux",gh=Oi&&!!Re.env.SNAP&&!!Re.env.SNAP_REVISION,vh=ho,wh=!!Re.env.CI||!!Re.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ri=Bt,Ii=Bt;let e=Re.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ri=t.userLocale,wn=t.osLocale,Ii=t.resolvedLanguage||Bt,bh=t.languagePack?.translationsConfigFile}catch{}ao=!0}else typeof navigator=="object"&&!Ch?(Je=navigator.userAgent,Ks=Je.indexOf("Windows")>=0,Gs=Je.indexOf("Macintosh")>=0,mh=(Je.indexOf("Macintosh")>=0||Je.indexOf("iPad")>=0||Je.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Oi=Je.indexOf("Linux")>=0,Sh=Je?.indexOf("Mobi")>=0,lo=!0,Ii=globalThis._VSCODE_NLS_LANGUAGE||Bt,Ri=navigator.language.toLowerCase(),wn=Ri):console.error("Unable to resolve platform.");var As=0;Gs?As=1:Ks?As=3:Oi&&(As=2);var Ms=ao,yh=lo&&typeof et.importScripts=="function",mu=yh?et.origin:void 0,Ue=Je,ot=Ii,Sn;(e=>{function t(){return ot}e.value=t;function s(){return ot.length===2?ot==="en":ot.length>=3?ot[0]==="e"&&ot[1]==="n"&&ot[2]==="-":!1}e.isDefaultVariant=s;function c(){return ot==="en"}e.isDefault=c})(Sn||(Sn={}));var xh=typeof et.postMessage=="function"&&!et.importScripts,Eh=(()=>{if(xh){let e=[];et.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let c=0,h=e.length;c<h;c++){let i=e[c];if(i.id===s.data.vscodeScheduleAsyncWork){e.splice(c,1),i.callback();return}}});let t=0;return s=>{let c=++t;e.push({id:c,callback:s}),et.postMessage({vscodeScheduleAsyncWork:c},"*")}}return e=>setTimeout(e)})(),Lh=!!(Ue&&Ue.indexOf("Chrome")>=0),wu=!!(Ue&&Ue.indexOf("Firefox")>=0),Su=!!(!Lh&&Ue&&Ue.indexOf("Safari")>=0),bu=!!(Ue&&Ue.indexOf("Edg/")>=0),Cu=!!(Ue&&Ue.indexOf("Android")>=0),at=typeof navigator=="object"?navigator:{},yu={clipboard:{writeText:Ms||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(at&&at.clipboard&&at.clipboard.writeText),readText:Ms||!!(at&&at.clipboard&&at.clipboard.readText)},keyboard:Ms||ph()?0:at.keyboard||fh?1:2,touch:"ontouchstart"in Ie||at.maxTouchPoints>0,pointerEvents:Ie.PointerEvent&&("ontouchstart"in Ie||navigator.maxTouchPoints>0)},Zs=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}},Ds=new Zs,bn=new Zs,Cn=new Zs,xu=new Array(230),yn;(e=>{function t(l){return Ds.keyCodeToStr(l)}e.toString=t;function s(l){return Ds.strToKeyCode(l)}e.fromString=s;function c(l){return bn.keyCodeToStr(l)}e.toUserSettingsUS=c;function h(l){return Cn.keyCodeToStr(l)}e.toUserSettingsGeneral=h;function i(l){return bn.strToKeyCode(l)||Cn.strToKeyCode(l)}e.fromUserSettings=i;function r(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 Ds.keyCodeToStr(l)}e.toElectronAccelerator=r})(yn||(yn={}));var co=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),xn;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof kh?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$e.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:co})})(xn||(xn={}));var kh=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?co:(this._emitter||(this._emitter=new ae),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Rh,Ts;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Ts=(e,t)=>{Eh(()=>{if(s)return;let c=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,c-Date.now())}}))});let s=!1;return{dispose(){s||(s=!0)}}}:Ts=(e,t,s)=>{let c=e.requestIdleCallback(t,typeof s=="number"?{timeout:s}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(c))}}},Rh=e=>Ts(globalThis,e)})();var En;(e=>{async function t(c){let h,i=await Promise.all(c.map(r=>r.then(l=>l,l=>{h||(h=l)})));if(typeof h<"u")throw h;return i}e.settled=t;function s(c){return new Promise(async(h,i)=>{try{await c(h,i)}catch(r){i(r)}})}e.withAsyncBody=s})(En||(En={}));var Ln=class Be{static fromArray(t){return new Be(s=>{s.emitMany(t)})}static fromPromise(t){return new Be(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Be(async s=>{await Promise.all(t.map(async c=>s.emitOne(await c)))})}static merge(t){return new Be(async s=>{await Promise.all(t.map(async c=>{for await(let h of c)s.emitOne(h)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new ae,queueMicrotask(async()=>{let c={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(c)),this.resolve()}catch(h){this.reject(h)}finally{c.emitOne=void 0,c.emitMany=void 0,c.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 $e.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new Be(async c=>{for await(let h of t)c.emitOne(s(h))})}map(t){return Be.map(this,t)}static filter(t,s){return new Be(async c=>{for await(let h of t)s(h)&&c.emitOne(h)})}filter(t){return Be.filter(this,t)}static coalesce(t){return Be.filter(t,s=>!!s)}coalesce(){return Be.coalesce(this)}static async toPromise(t){let s=[];for await(let c of t)s.push(c);return s}toPromise(){return Be.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())}};Ln.EMPTY=Ln.fromArray([]);function Ah(e){return 55296<=e&&e<=56319}function kn(e){return 56320<=e&&e<=57343}function Mh(e,t){return(e-55296<<10)+(t-56320)+65536}function Dh(e){return Qs(e,0)}function Qs(e,t){switch(typeof e){case"object":return e===null?Qe(349,t):Array.isArray(e)?Bh(e,t):Ph(e,t);case"string":return uo(e,t);case"boolean":return Th(e,t);case"number":return Qe(e,t);case"undefined":return Qe(937,t);default:return Qe(617,t)}}function Qe(e,t){return(t<<5)-t+e|0}function Th(e,t){return Qe(e?433:863,t)}function uo(e,t){t=Qe(149417,t);for(let s=0,c=e.length;s<c;s++)t=Qe(e.charCodeAt(s),t);return t}function Bh(e,t){return t=Qe(104579,t),e.reduce((s,c)=>Qs(c,s),t)}function Ph(e,t){return t=Qe(181387,t),Object.keys(e).sort().reduce((s,c)=>(s=uo(c,s),Qs(e[c],s)),t)}function Bs(e,t,s=32){let c=s-t,h=~((1<<c)-1);return(e<<t|(h&e)>>>c)>>>0}function Rn(e,t=0,s=e.byteLength,c=0){for(let h=0;h<s;h++)e[t+h]=c}function Oh(e,t,s="0"){for(;e.length<t;)e=s+e;return e}function Qt(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(s=>s.toString(16).padStart(2,"0")).join(""):Oh((e>>>0).toString(16),t/4)}var Ih=class _o{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 s=t.length;if(s===0)return;let c=this._buff,h=this._buffLen,i=this._leftoverHighSurrogate,r,l;for(i!==0?(r=i,l=-1,i=0):(r=t.charCodeAt(0),l=0);;){let _=r;if(Ah(r))if(l+1<s){let n=t.charCodeAt(l+1);kn(n)?(l++,_=Mh(r,n)):_=65533}else{i=r;break}else kn(r)&&(_=65533);if(h=this._push(c,h,_),l++,l<s)r=t.charCodeAt(l);else break}this._buffLen=h,this._leftoverHighSurrogate=i}_push(t,s,c){return c<128?t[s++]=c:c<2048?(t[s++]=192|(c&1984)>>>6,t[s++]=128|(c&63)>>>0):c<65536?(t[s++]=224|(c&61440)>>>12,t[s++]=128|(c&4032)>>>6,t[s++]=128|(c&63)>>>0):(t[s++]=240|(c&1835008)>>>18,t[s++]=128|(c&258048)>>>12,t[s++]=128|(c&4032)>>>6,t[s++]=128|(c&63)>>>0),s>=64&&(this._step(),s-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),s}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()),Qt(this._h0)+Qt(this._h1)+Qt(this._h2)+Qt(this._h3)+Qt(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Rn(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Rn(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=_o._bigBlock32,s=this._buffDV;for(let p=0;p<64;p+=4)t.setUint32(p,s.getUint32(p,!1),!1);for(let p=64;p<320;p+=4)t.setUint32(p,Bs(t.getUint32(p-12,!1)^t.getUint32(p-32,!1)^t.getUint32(p-56,!1)^t.getUint32(p-64,!1),1),!1);let c=this._h0,h=this._h1,i=this._h2,r=this._h3,l=this._h4,_,n,f;for(let p=0;p<80;p++)p<20?(_=h&i|~h&r,n=1518500249):p<40?(_=h^i^r,n=1859775393):p<60?(_=h&i|h&r|i&r,n=2400959708):(_=h^i^r,n=3395469782),f=Bs(c,5)+_+l+n+t.getUint32(p*4,!1)&4294967295,l=r,r=i,i=Bs(h,30),h=c,c=f;this._h0=this._h0+c&4294967295,this._h1=this._h1+h&4294967295,this._h2=this._h2+i&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+l&4294967295}};Ih._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Eu,getWindow:Hh,getDocument:Lu,getWindows:ku,getWindowsCount:Ru,getWindowId:An,getWindowById:Au,hasWindow:Mu,onDidRegisterWindow:Du,onWillUnregisterWindow:Tu,onDidUnregisterWindow:Bu}=(function(){let e=new Map,t={window:Ie,disposables:new Pt};e.set(Ie.vscodeWindowId,t);let s=new ae,c=new ae,h=new ae;function i(r,l){return(typeof r=="number"?e.get(r):void 0)??(l?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:h.event,onDidUnregisterWindow:c.event,registerWindow(r){if(e.has(r.vscodeWindowId))return Ae.None;let l=new Pt,_={window:r,disposables:l.add(new Pt)};return e.set(r.vscodeWindowId,_),l.add(Se(()=>{e.delete(r.vscodeWindowId),c.fire(r)})),l.add(Vs(r,Wh.BEFORE_UNLOAD,()=>{h.fire(r)})),s.fire(_),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return e.has(r)},getWindowById:i,getWindow(r){let l=r;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let _=r;return _?.view?_.view.window:Ie},getDocument(r){return Hh(r).document}}})(),Nh=class{constructor(e,t,s,c){this._node=e,this._type=t,this._handler=s,this._options=c||!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 Vs(e,t,s,c){return new Nh(e,t,s,c)}var Fh,Mn,Ps=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){Ai(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,c=new Map,h=i=>{s.set(i,!1);let r=e.get(i)??[];for(t.set(i,r),e.set(i,[]),c.set(i,!0);r.length>0;)r.sort(Ps.sort),r.shift().execute();c.set(i,!1)};Mn=(i,r,l=0)=>{let _=An(i),n=new Ps(r,l),f=e.get(_);return f||(f=[],e.set(_,f)),f.push(n),s.get(_)||(s.set(_,!0),i.requestAnimationFrame(()=>h(_))),n},Fh=(i,r,l)=>{let _=An(i);if(c.get(_)){let n=new Ps(r,l),f=t.get(_);return f||(f=[],t.set(_,f)),f.push(n),n}else return Mn(i,r,l)}})();var Dn=class Hi{constructor(t,s){this.width=t,this.height=s}with(t=this.width,s=this.height){return t!==this.width||s!==this.height?new Hi(t,s):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Hi?t:new Hi(t.width,t.height)}static equals(t,s){return t===s?!0:!t||!s?!1:t.width===s.width&&t.height===s.height}};Dn.None=new Dn(0,0);var Pu=new class{constructor(){this.mutationObservers=new Map}observe(e,t,s){let c=this.mutationObservers.get(e);c||(c=new Map,this.mutationObservers.set(e,c));let h=Dh(s),i=c.get(h);if(i)i.users+=1;else{let r=new ae,l=new MutationObserver(n=>r.fire(n));l.observe(e,s);let _=i={users:1,observer:l,onDidMutate:r.event};t.add(Se(()=>{_.users-=1,_.users===0&&(r.dispose(),l.disconnect(),c?.delete(h),c?.size===0&&this.mutationObservers.delete(e))})),c.set(h,i)}return i.onDidMutate}},Wh={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:Rs?"webkitAnimationStart":"animationstart",ANIMATION_END:Rs?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Rs?"webkitAnimationIteration":"animationiteration"},$h=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function fo(e,t,s,...c){let h=$h.exec(t);if(!h)throw new Error("Bad use of emmet");let i=h[1]||"div",r;return e!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(e,i):r=document.createElement(i),h[3]&&(r.id=h[3]),h[4]&&(r.className=h[4].replace(/\./g," ").trim()),s&&Object.entries(s).forEach(([l,_])=>{typeof _>"u"||(/^on\w+$/.test(l)?r[l]=_:l==="selected"?_&&r.setAttribute(l,"true"):r.setAttribute(l,_))}),r.append(...c),r}function Uh(e,t,...s){return fo("http://www.w3.org/1999/xhtml",e,t,...s)}Uh.SVG=function(e,t,...s){return fo("http://www.w3.org/2000/svg",e,t,...s)};var zh=class extends Ae{constructor(e,t,s,c,h,i,r,l,_){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=s,this._coreBrowserService=c,this._coreService=h,this._decorationService=i,this._optionsService=r,this._themeService=l,this._cursorBlinkStateManager=new Yt,this._charAtlasDisposable=this._register(new Yt),this._observerDisposable=this._register(new Yt),this._model=new nh,this._workCell=new cn,this._workCell2=new cn,this._rectangleRenderer=this._register(new Yt),this._glyphRenderer=this._register(new Yt),this._onChangeTextureAtlas=this._register(new ae),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ae),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ae),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ae),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ae),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 Sl(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new dh(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,r,this._themeService)],this.dimensions=ml(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(r.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Vs(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(Vs(this._canvas,"webglcontextrestored",f=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,ln(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=hn(this._canvas,this._coreBrowserService.window,(f,p)=>this._setCanvasDevicePixelDimensions(f,p)),this._register(this._coreBrowserService.onWindowChange(f=>{this._observerDisposable.value=hn(this._canvas,f,(p,S)=>this._setCanvasDevicePixelDimensions(p,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Se(()=>{for(let f of this._renderLayers)f.dispose();this._canvas.parentElement?.removeChild(this._canvas),ln(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 s of this._renderLayers)s.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,s){for(let c of this._renderLayers)c.handleSelectionChanged(this._terminal,e,t,s);this._model.selection.update(this._core,e,t,s),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 hh(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new th(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=io(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=Fn($e.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),$e.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 s of this._renderLayers)s.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 Vl(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let s=this._core,c=this._workCell,h,i,r,l,_,n,f=0,p=!0,S,g,a,d,o,u,v,C,w;e=Tn(e,s.rows-1,0),t=Tn(t,s.rows-1,0);let y=this._coreService.decPrivateModes.cursorStyle??s.options.cursorStyle??"block",m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=m-s.buffer.ydisp,D=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),I=-1,H=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let M=!1;for(i=e;i<=t;i++)for(r=i+s.buffer.ydisp,l=s.buffer.lines.get(r),this._model.lineLengths[i]=0,a=m===r,f=0,_=this._characterJoinerService.getJoinedCharacters(r),C=0;C<s.cols;C++){if(h=this._cellColorResolver.result.bg,l.loadCell(C,c),C===0&&(h=this._cellColorResolver.result.bg),n=!1,p=C>=f,S=C,_.length>0&&C===_[0][0]&&p){g=_.shift();let N=this._model.selection.isCellSelected(this._terminal,g[0],r);for(v=g[0]+1;v<g[1];v++)p&&(p=N===this._model.selection.isCellSelected(this._terminal,v,r));p&&(p=!a||D<g[0]||D>=g[1]),p?(n=!0,c=new jh(c,l.translateToString(!0,g[0],g[1]),g[1]-g[0]),S=g[1]-1):f=g[1]}if(d=c.getChars(),o=c.getCode(),v=(i*s.cols+C)*Ni,this._cellColorResolver.resolve(c,C,r,this.dimensions.device.cell.width),H&&r===m&&(C===D&&(this._model.cursor={x:D,y:x,width:c.getWidth(),style:this._coreBrowserService.isFocused?y:s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},I=D+c.getWidth()-1),C>=D&&C<=I&&(this._coreBrowserService.isFocused&&y==="block"||this._coreBrowserService.isFocused===!1&&s.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+Ti]===this._cellColorResolver.result.bg&&this._model.cells[v+Bi]===this._cellColorResolver.result.fg&&this._model.cells[v+Ls]===this._cellColorResolver.result.ext)&&(M=!0,d.length>1&&(o|=rh),this._model.cells[v]=o,this._model.cells[v+Ti]=this._cellColorResolver.result.bg,this._model.cells[v+Bi]=this._cellColorResolver.result.fg,this._model.cells[v+Ls]=this._cellColorResolver.result.ext,u=c.getWidth(),this._glyphRenderer.value.updateCell(C,i,o,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,h),n)){for(c=this._workCell,C++;C<=S;C++)w=(i*s.cols+C)*Ni,this._glyphRenderer.value.updateCell(C,i,0,0,0,0,ul,0,0),this._model.cells[w]=0,this._model.cells[w+Ti]=this._cellColorResolver.result.bg,this._model.cells[w+Bi]=this._cellColorResolver.result.fg,this._model.cells[w+Ls]=this._cellColorResolver.result.ext;C--}}M&&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})}},jh=class extends Tt{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}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 Tn(e,t,s=0){return Math.max(Math.min(e,t),s)}var Bn="di$target",Pn="di$dependencies",Os=new Map;function ze(e){if(Os.has(e))return Os.get(e);let t=function(s,c,h){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");qh(t,s,h)};return t._id=e,Os.set(e,t),t}function qh(e,t,s){t[Bn]===t?t[Pn].push({id:e,index:s}):(t[Pn]=[{id:e,index:s}],t[Bn]=t)}var Ou=ze("BufferService"),Iu=ze("CoreMouseService"),Hu=ze("CoreService"),Nu=ze("CharsetService"),Fu=ze("InstantiationService"),Wu=ze("LogService"),Kh=ze("OptionsService"),$u=ze("OscLinkService"),Uu=ze("UnicodeService"),zu=ze("DecorationService"),Gh={trace:0,debug:1,info:2,warn:3,error:4,off:5},Vh="xterm.js: ",On=class extends Ae{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),po=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Gh[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,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":Vh)+t,...s)}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)}};On=Ka([Ga(0,Kh)],On);var po;function Yh(e){po=e}var go=class extends Ae{constructor(e){if(Un&&dl()<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 ae),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ae),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ae),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ae),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 s=t.coreService,c=t.optionsService,h=t,i=h._renderService,r=h._characterJoinerService,l=h._charSizeService,_=h._coreBrowserService,n=h._decorationService,f=h._logService,p=h._themeService;Yh(f),this._renderer=this._register(new zh(e,r,l,_,s,n,c,p,this._preserveDrawingBuffer)),this._register($e.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register($e.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register($e.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register($e.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),i.setRenderer(this._renderer),this._register(Se(()=>{if(this._terminal._core._store._isDisposed)return;let S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var vo=`/**
118
+ }`,rt=8,Rs=rt*Float32Array.BYTES_PER_ELEMENT,ph=20*rt,fn=class{constructor(){this.attributes=new Float32Array(ph),this.count=0}},it=0,pn=0,gn=0,vn=0,mn=0,wn=0,bn=0,gh=class extends Ae{constructor(e,t,i,a){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=a,this._vertices=new fn,this._verticesCursor=new fn;let c=this._gl;this._program=pe(ao(c,_h,fh)),this._register(Se(()=>c.deleteProgram(this._program))),this._projectionLocation=pe(c.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=c.createVertexArray(),c.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),r=c.createBuffer();this._register(Se(()=>c.deleteBuffer(r))),c.bindBuffer(c.ARRAY_BUFFER,r),c.bufferData(c.ARRAY_BUFFER,s,c.STATIC_DRAW),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),f=c.createBuffer();this._register(Se(()=>c.deleteBuffer(f))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,f),c.bufferData(c.ELEMENT_ARRAY_BUFFER,h,c.STATIC_DRAW),this._attributesBuffer=pe(c.createBuffer()),this._register(Se(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,Rs,0),c.vertexAttribDivisor(0,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,Rs,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,4,c.FLOAT,!1,Rs,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(2,1),this._updateCachedColors(a.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,oo),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,i=this._vertices,a=1,c,s,r,h,f,n,_,p,b,g,l;for(c=0;c<t.rows;c++){for(r=-1,h=0,f=0,n=!1,s=0;s<t.cols;s++)_=(c*t.cols+s)*Wi,p=e.cells[_+Pi],b=e.cells[_+Oi],g=!!(b&67108864),(p!==h||b!==f&&(n||g))&&((h!==0||n&&f!==0)&&(l=a++*rt,this._updateRectangle(i,l,f,h,r,s,c)),r=s,h=p,f=b,n=g);(h!==0||n&&f!==0)&&(l=a++*rt,this._updateRectangle(i,l,f,h,r,t.cols,c))}i.count=a}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let a,c=0;(i.style==="bar"||i.style==="outline")&&(a=c++*rt,this._addRectangleFloat(t.attributes,a,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(a=c++*rt,this._addRectangleFloat(t.attributes,a,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(a=c++*rt,this._addRectangleFloat(t.attributes,a,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),a=c++*rt,this._addRectangleFloat(t.attributes,a,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=c}_updateRectangle(e,t,i,a,c,s,r){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:it=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:it=(i&16777215)<<8;break;default:it=this._themeService.colors.foreground.rgba}else switch(a&50331648){case 16777216:case 33554432:it=this._themeService.colors.ansi[a&255].rgba;break;case 50331648:it=(a&16777215)<<8;break;default:it=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=sh(e.attributes,this._terminal.rows*this._terminal.cols*rt)),pn=c*this._dimensions.device.cell.width,gn=r*this._dimensions.device.cell.height,vn=(it>>24&255)/255,mn=(it>>16&255)/255,wn=(it>>8&255)/255,bn=1,this._addRectangle(e.attributes,t,pn,gn,(s-c)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,vn,mn,wn,bn)}_addRectangle(e,t,i,a,c,s,r,h,f,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=a/this._dimensions.device.canvas.height,e[t+2]=c/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=r,e[t+5]=h,e[t+6]=f,e[t+7]=n}_addRectangleFloat(e,t,i,a,c,s,r){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=a/this._dimensions.device.canvas.height,e[t+2]=c/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=r[0],e[t+5]=r[1],e[t+6]=r[2],e[t+7]=r[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])}},vh=class extends Ae{constructor(e,t,i,a,c,s,r,h){super(),this._container=t,this._alpha=c,this._coreBrowserService=s,this._optionsService=r,this._themeService=h,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-${i}-layer`),this._canvas.style.zIndex=a.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(e,f),this.reset(e)})),this._register(Se(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=pe(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,a=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=ro(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,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*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,i,a){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,a*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,a*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,a){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Kn,this._clipCell(i,a,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,a*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let a=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${a} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},mh=class extends vh{constructor(e,t,i,a,c,s,r){super(i,e,"link",t,!0,c,s,r),this._register(a.onShowLinkUnderline(h=>this._handleShowLinkUnderline(h))),this._register(a.onHideLinkUnderline(h=>this._handleHideLinkUnderline(h)))}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&&eh(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()}},We=typeof window=="object"?window:globalThis,Ks=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new oe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new oe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let a=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(a,t),this._onDidChangeZoomLevel.fire(a)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let a=this.getWindowId(i);this.mapWindowIdToFullScreen.set(a,t),this._onDidChangeFullscreen.fire(a)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Ks.INSTANCE=new Ks;var lo=Ks;function wh(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var bu=lo.INSTANCE.onDidChangeZoomLevel,Su=lo.INSTANCE.onDidChangeFullscreen,Wt=typeof navigator=="object"?navigator.userAgent:"",Cu=Wt.indexOf("Firefox")>=0,Ms=Wt.indexOf("AppleWebKit")>=0,bh=Wt.indexOf("Chrome")>=0,Sh=!bh&&Wt.indexOf("Safari")>=0,yu=Wt.indexOf("Electron/")>=0,xu=Wt.indexOf("Android")>=0,Ii=!1;if(typeof We.matchMedia=="function"){let e=We.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=We.matchMedia("(display-mode: fullscreen)");Ii=e.matches,wh(We,e,({matches:i})=>{Ii&&t.matches||(Ii=i)})}function Ch(){return Ii}var Nt="en",Gs=!1,Vs=!1,Ni=!1,yh=!1,ho=!1,co=!1,xh=!1,Eh=!1,Lh=!1,kh=!1,Ai,Fi=Nt,Sn=Nt,Rh,st,ot=globalThis,Me;typeof ot.vscode<"u"&&typeof ot.vscode.process<"u"?Me=ot.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Me=process);var uo=typeof Me?.versions?.electron=="string",Mh=uo&&Me?.type==="renderer";if(typeof Me=="object"){Gs=Me.platform==="win32",Vs=Me.platform==="darwin",Ni=Me.platform==="linux",yh=Ni&&!!Me.env.SNAP&&!!Me.env.SNAP_REVISION,xh=uo,Lh=!!Me.env.CI||!!Me.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ai=Nt,Fi=Nt;let e=Me.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ai=t.userLocale,Sn=t.osLocale,Fi=t.resolvedLanguage||Nt,Rh=t.languagePack?.translationsConfigFile}catch{}ho=!0}else typeof navigator=="object"&&!Mh?(st=navigator.userAgent,Gs=st.indexOf("Windows")>=0,Vs=st.indexOf("Macintosh")>=0,Eh=(st.indexOf("Macintosh")>=0||st.indexOf("iPad")>=0||st.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ni=st.indexOf("Linux")>=0,kh=st?.indexOf("Mobi")>=0,co=!0,Fi=globalThis._VSCODE_NLS_LANGUAGE||Nt,Ai=navigator.language.toLowerCase(),Sn=Ai):console.error("Unable to resolve platform.");var As=0;Vs?As=1:Gs?As=3:Ni&&(As=2);var Ds=ho,Ah=co&&typeof ot.importScripts=="function",Eu=Ah?ot.origin:void 0,Ge=st,ht=Fi,Cn;(e=>{function t(){return ht}e.value=t;function i(){return ht.length===2?ht==="en":ht.length>=3?ht[0]==="e"&&ht[1]==="n"&&ht[2]==="-":!1}e.isDefaultVariant=i;function a(){return ht==="en"}e.isDefault=a})(Cn||(Cn={}));var Dh=typeof ot.postMessage=="function"&&!ot.importScripts,Th=(()=>{if(Dh){let e=[];ot.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let a=0,c=e.length;a<c;a++){let s=e[a];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(a,1),s.callback();return}}});let t=0;return i=>{let a=++t;e.push({id:a,callback:i}),ot.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})(),Bh=!!(Ge&&Ge.indexOf("Chrome")>=0),Lu=!!(Ge&&Ge.indexOf("Firefox")>=0),ku=!!(!Bh&&Ge&&Ge.indexOf("Safari")>=0),Ru=!!(Ge&&Ge.indexOf("Edg/")>=0),Mu=!!(Ge&&Ge.indexOf("Android")>=0),ct=typeof navigator=="object"?navigator:{},Au={clipboard:{writeText:Ds||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(ct&&ct.clipboard&&ct.clipboard.writeText),readText:Ds||!!(ct&&ct.clipboard&&ct.clipboard.readText)},keyboard:Ds||Ch()?0:ct.keyboard||Sh?1:2,touch:"ontouchstart"in We||ct.maxTouchPoints>0,pointerEvents:We.PointerEvent&&("ontouchstart"in We||navigator.maxTouchPoints>0)},Qs=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}},Ts=new Qs,yn=new Qs,xn=new Qs,Du=new Array(230),En;(e=>{function t(h){return Ts.keyCodeToStr(h)}e.toString=t;function i(h){return Ts.strToKeyCode(h)}e.fromString=i;function a(h){return yn.keyCodeToStr(h)}e.toUserSettingsUS=a;function c(h){return xn.keyCodeToStr(h)}e.toUserSettingsGeneral=c;function s(h){return yn.strToKeyCode(h)||xn.strToKeyCode(h)}e.fromUserSettings=s;function r(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ts.keyCodeToStr(h)}e.toElectronAccelerator=r})(En||(En={}));var _o=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Ln;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Ph?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ke.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_o})})(Ln||(Ln={}));var Ph=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?_o:(this._emitter||(this._emitter=new oe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Oh,Bs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Bs=(e,t)=>{Th(()=>{if(i)return;let a=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,a-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Bs=(e,t,i)=>{let a=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),c=!1;return{dispose(){c||(c=!0,e.cancelIdleCallback(a))}}},Oh=e=>Bs(globalThis,e)})();var kn;(e=>{async function t(a){let c,s=await Promise.all(a.map(r=>r.then(h=>h,h=>{c||(c=h)})));if(typeof c<"u")throw c;return s}e.settled=t;function i(a){return new Promise(async(c,s)=>{try{await a(c,s)}catch(r){s(r)}})}e.withAsyncBody=i})(kn||(kn={}));var Rn=class Ie{static fromArray(t){return new Ie(i=>{i.emitMany(t)})}static fromPromise(t){return new Ie(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Ie(async i=>{await Promise.all(t.map(async a=>i.emitOne(await a)))})}static merge(t){return new Ie(async i=>{await Promise.all(t.map(async a=>{for await(let c of a)i.emitOne(c)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new oe,queueMicrotask(async()=>{let a={emitOne:c=>this.emitOne(c),emitMany:c=>this.emitMany(c),reject:c=>this.reject(c)};try{await Promise.resolve(t(a)),this.resolve()}catch(c){this.reject(c)}finally{a.emitOne=void 0,a.emitMany=void 0,a.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 Ke.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ie(async a=>{for await(let c of t)a.emitOne(i(c))})}map(t){return Ie.map(this,t)}static filter(t,i){return new Ie(async a=>{for await(let c of t)i(c)&&a.emitOne(c)})}filter(t){return Ie.filter(this,t)}static coalesce(t){return Ie.filter(t,i=>!!i)}coalesce(){return Ie.coalesce(this)}static async toPromise(t){let i=[];for await(let a of t)i.push(a);return i}toPromise(){return Ie.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())}};Rn.EMPTY=Rn.fromArray([]);function Ih(e){return 55296<=e&&e<=56319}function Mn(e){return 56320<=e&&e<=57343}function Nh(e,t){return(e-55296<<10)+(t-56320)+65536}function Fh(e){return er(e,0)}function er(e,t){switch(typeof e){case"object":return e===null?nt(349,t):Array.isArray(e)?Wh(e,t):$h(e,t);case"string":return fo(e,t);case"boolean":return Hh(e,t);case"number":return nt(e,t);case"undefined":return nt(937,t);default:return nt(617,t)}}function nt(e,t){return(t<<5)-t+e|0}function Hh(e,t){return nt(e?433:863,t)}function fo(e,t){t=nt(149417,t);for(let i=0,a=e.length;i<a;i++)t=nt(e.charCodeAt(i),t);return t}function Wh(e,t){return t=nt(104579,t),e.reduce((i,a)=>er(a,i),t)}function $h(e,t){return t=nt(181387,t),Object.keys(e).sort().reduce((i,a)=>(i=fo(a,i),er(e[a],i)),t)}function Ps(e,t,i=32){let a=i-t,c=~((1<<a)-1);return(e<<t|(c&e)>>>a)>>>0}function An(e,t=0,i=e.byteLength,a=0){for(let c=0;c<i;c++)e[t+c]=a}function Uh(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function ii(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):Uh((e>>>0).toString(16),t/4)}var zh=class po{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 i=t.length;if(i===0)return;let a=this._buff,c=this._buffLen,s=this._leftoverHighSurrogate,r,h;for(s!==0?(r=s,h=-1,s=0):(r=t.charCodeAt(0),h=0);;){let f=r;if(Ih(r))if(h+1<i){let n=t.charCodeAt(h+1);Mn(n)?(h++,f=Nh(r,n)):f=65533}else{s=r;break}else Mn(r)&&(f=65533);if(c=this._push(a,c,f),h++,h<i)r=t.charCodeAt(h);else break}this._buffLen=c,this._leftoverHighSurrogate=s}_push(t,i,a){return a<128?t[i++]=a:a<2048?(t[i++]=192|(a&1984)>>>6,t[i++]=128|(a&63)>>>0):a<65536?(t[i++]=224|(a&61440)>>>12,t[i++]=128|(a&4032)>>>6,t[i++]=128|(a&63)>>>0):(t[i++]=240|(a&1835008)>>>18,t[i++]=128|(a&258048)>>>12,t[i++]=128|(a&4032)>>>6,t[i++]=128|(a&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}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()),ii(this._h0)+ii(this._h1)+ii(this._h2)+ii(this._h3)+ii(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,An(this._buff,this._buffLen),this._buffLen>56&&(this._step(),An(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=po._bigBlock32,i=this._buffDV;for(let p=0;p<64;p+=4)t.setUint32(p,i.getUint32(p,!1),!1);for(let p=64;p<320;p+=4)t.setUint32(p,Ps(t.getUint32(p-12,!1)^t.getUint32(p-32,!1)^t.getUint32(p-56,!1)^t.getUint32(p-64,!1),1),!1);let a=this._h0,c=this._h1,s=this._h2,r=this._h3,h=this._h4,f,n,_;for(let p=0;p<80;p++)p<20?(f=c&s|~c&r,n=1518500249):p<40?(f=c^s^r,n=1859775393):p<60?(f=c&s|c&r|s&r,n=2400959708):(f=c^s^r,n=3395469782),_=Ps(a,5)+f+h+n+t.getUint32(p*4,!1)&4294967295,h=r,r=s,s=Ps(c,30),c=a,a=_;this._h0=this._h0+a&4294967295,this._h1=this._h1+c&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+h&4294967295}};zh._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Tu,getWindow:jh,getDocument:Bu,getWindows:Pu,getWindowsCount:Ou,getWindowId:Dn,getWindowById:Iu,hasWindow:Nu,onDidRegisterWindow:Fu,onWillUnregisterWindow:Hu,onDidUnregisterWindow:Wu}=(function(){let e=new Map,t={window:We,disposables:new Ft};e.set(We.vscodeWindowId,t);let i=new oe,a=new oe,c=new oe;function s(r,h){return(typeof r=="number"?e.get(r):void 0)??(h?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:c.event,onDidUnregisterWindow:a.event,registerWindow(r){if(e.has(r.vscodeWindowId))return Ae.None;let h=new Ft,f={window:r,disposables:h.add(new Ft)};return e.set(r.vscodeWindowId,f),h.add(Se(()=>{e.delete(r.vscodeWindowId),a.fire(r)})),h.add(Ys(r,Gh.BEFORE_UNLOAD,()=>{c.fire(r)})),i.fire(f),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return e.has(r)},getWindowById:s,getWindow(r){let h=r;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let f=r;return f?.view?f.view.window:We},getDocument(r){return jh(r).document}}})(),qh=class{constructor(e,t,i,a){this._node=e,this._type=t,this._handler=i,this._options=a||!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 Ys(e,t,i,a){return new qh(e,t,i,a)}var Kh,Tn,Os=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){Di(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,a=new Map,c=s=>{i.set(s,!1);let r=e.get(s)??[];for(t.set(s,r),e.set(s,[]),a.set(s,!0);r.length>0;)r.sort(Os.sort),r.shift().execute();a.set(s,!1)};Tn=(s,r,h=0)=>{let f=Dn(s),n=new Os(r,h),_=e.get(f);return _||(_=[],e.set(f,_)),_.push(n),i.get(f)||(i.set(f,!0),s.requestAnimationFrame(()=>c(f))),n},Kh=(s,r,h)=>{let f=Dn(s);if(a.get(f)){let n=new Os(r,h),_=t.get(f);return _||(_=[],t.set(f,_)),_.push(n),n}else return Tn(s,r,h)}})();var Bn=class Hi{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new Hi(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Hi?t:new Hi(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};Bn.None=new Bn(0,0);var $u=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let a=this.mutationObservers.get(e);a||(a=new Map,this.mutationObservers.set(e,a));let c=Fh(i),s=a.get(c);if(s)s.users+=1;else{let r=new oe,h=new MutationObserver(n=>r.fire(n));h.observe(e,i);let f=s={users:1,observer:h,onDidMutate:r.event};t.add(Se(()=>{f.users-=1,f.users===0&&(r.dispose(),h.disconnect(),a?.delete(c),a?.size===0&&this.mutationObservers.delete(e))})),a.set(c,s)}return s.onDidMutate}},Gh={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:Ms?"webkitAnimationStart":"animationstart",ANIMATION_END:Ms?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Ms?"webkitAnimationIteration":"animationiteration"},Vh=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function go(e,t,i,...a){let c=Vh.exec(t);if(!c)throw new Error("Bad use of emmet");let s=c[1]||"div",r;return e!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(e,s):r=document.createElement(s),c[3]&&(r.id=c[3]),c[4]&&(r.className=c[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([h,f])=>{typeof f>"u"||(/^on\w+$/.test(h)?r[h]=f:h==="selected"?f&&r.setAttribute(h,"true"):r.setAttribute(h,f))}),r.append(...a),r}function Yh(e,t,...i){return go("http://www.w3.org/1999/xhtml",e,t,...i)}Yh.SVG=function(e,t,...i){return go("http://www.w3.org/2000/svg",e,t,...i)};var Xh=class extends Ae{constructor(e,t,i,a,c,s,r,h,f){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=a,this._coreService=c,this._decorationService=s,this._optionsService=r,this._themeService=h,this._cursorBlinkStateManager=new Zt,this._charAtlasDisposable=this._register(new Zt),this._observerDisposable=this._register(new Zt),this._model=new uh,this._workCell=new un,this._workCell2=new un,this._rectangleRenderer=this._register(new Zt),this._glyphRenderer=this._register(new Zt),this._onChangeTextureAtlas=this._register(new oe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new oe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new oe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new oe),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new oe),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let n={antialias:!1,depth:!1,preserveDrawingBuffer:f};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 kl(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new mh(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,r,this._themeService)],this.dimensions=El(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(r.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ys(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(Ys(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,cn(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=dn(this._canvas,this._coreBrowserService.window,(_,p)=>this._setCanvasDevicePixelDimensions(_,p)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=dn(this._canvas,_,(p,b)=>this._setCanvasDevicePixelDimensions(p,b))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Se(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),cn(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 i of this._renderLayers)i.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,i){for(let a of this._renderLayers)a.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),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 gh(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new lh(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=ro(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=$n(Ke.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ke.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 i of this._renderLayers)i.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 th(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,a=this._workCell,c,s,r,h,f,n,_=0,p=!0,b,g,l,d,o,u,v,C,w;e=Pn(e,i.rows-1,0),t=Pn(t,i.rows-1,0);let y=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,E=m-i.buffer.ydisp,P=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,N=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let R=!1;for(s=e;s<=t;s++)for(r=s+i.buffer.ydisp,h=i.buffer.lines.get(r),this._model.lineLengths[s]=0,l=m===r,_=0,f=this._characterJoinerService.getJoinedCharacters(r),C=0;C<i.cols;C++){if(c=this._cellColorResolver.result.bg,h.loadCell(C,a),C===0&&(c=this._cellColorResolver.result.bg),n=!1,p=C>=_,b=C,f.length>0&&C===f[0][0]&&p){g=f.shift();let U=this._model.selection.isCellSelected(this._terminal,g[0],r);for(v=g[0]+1;v<g[1];v++)p&&(p=U===this._model.selection.isCellSelected(this._terminal,v,r));p&&(p=!l||P<g[0]||P>=g[1]),p?(n=!0,a=new Jh(a,h.translateToString(!0,g[0],g[1]),g[1]-g[0]),b=g[1]-1):_=g[1]}if(d=a.getChars(),o=a.getCode(),v=(s*i.cols+C)*Wi,this._cellColorResolver.resolve(a,C,r,this.dimensions.device.cell.width),N&&r===m&&(C===P&&(this._model.cursor={x:P,y:E,width:a.getWidth(),style:this._coreBrowserService.isFocused?y:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=P+a.getWidth()-1),C>=P&&C<=I&&(this._coreBrowserService.isFocused&&y==="block"||this._coreBrowserService.isFocused===!1&&i.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[s]=C+1),!(this._model.cells[v]===o&&this._model.cells[v+Pi]===this._cellColorResolver.result.bg&&this._model.cells[v+Oi]===this._cellColorResolver.result.fg&&this._model.cells[v+ks]===this._cellColorResolver.result.ext)&&(R=!0,d.length>1&&(o|=dh),this._model.cells[v]=o,this._model.cells[v+Pi]=this._cellColorResolver.result.bg,this._model.cells[v+Oi]=this._cellColorResolver.result.fg,this._model.cells[v+ks]=this._cellColorResolver.result.ext,u=a.getWidth(),this._glyphRenderer.value.updateCell(C,s,o,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,c),n)){for(a=this._workCell,C++;C<=b;C++)w=(s*i.cols+C)*Wi,this._glyphRenderer.value.updateCell(C,s,0,0,0,0,wl,0,0),this._model.cells[w]=0,this._model.cells[w+Pi]=this._cellColorResolver.result.bg,this._model.cells[w+Oi]=this._cellColorResolver.result.fg,this._model.cells[w+ks]=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})}},Jh=class extends It{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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 Pn(e,t,i=0){return Math.max(Math.min(e,t),i)}var On="di$target",In="di$dependencies",Is=new Map;function Ve(e){if(Is.has(e))return Is.get(e);let t=function(i,a,c){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Zh(t,i,c)};return t._id=e,Is.set(e,t),t}function Zh(e,t,i){t[On]===t?t[In].push({id:e,index:i}):(t[In]=[{id:e,index:i}],t[On]=t)}var Uu=Ve("BufferService"),zu=Ve("CoreMouseService"),ju=Ve("CoreService"),qu=Ve("CharsetService"),Ku=Ve("InstantiationService"),Gu=Ve("LogService"),Qh=Ve("OptionsService"),Vu=Ve("OscLinkService"),Yu=Ve("UnicodeService"),Xu=Ve("DecorationService"),ec={trace:0,debug:1,info:2,warn:3,error:4,off:5},tc="xterm.js: ",Nn=class extends Ae{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),vo=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=ec[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":tc)+t,...i)}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)}};Nn=Qa([el(0,Qh)],Nn);var vo;function ic(e){vo=e}var mo=class extends Ae{constructor(e){if(jn&&ml()<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 oe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new oe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new oe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new oe),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 i=t.coreService,a=t.optionsService,c=t,s=c._renderService,r=c._characterJoinerService,h=c._charSizeService,f=c._coreBrowserService,n=c._decorationService,_=c._logService,p=c._themeService;ic(_),this._renderer=this._register(new Xh(e,r,h,f,i,n,a,p,this._preserveDrawingBuffer)),this._register(Ke.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ke.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ke.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ke.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(Se(()=>{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 wo=`/**
119
119
  * Copyright (c) 2014 The xterm.js authors. All rights reserved.
120
120
  * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
121
121
  * https://github.com/chjj/term.js
@@ -333,9 +333,9 @@ void main() {
333
333
  z-index: 2;
334
334
  position: relative;
335
335
  }
336
- `;var Jh=[".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:8px;padding:4px 10px;border-bottom:1px solid var(--dsw-alias-border-l1);display:flex}",".tt_titleIcon{flex:none;display:inline-flex;color:var(--dsw-alias-label-primary)}",".tt_status{font-size:11px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;display:flex;white-space:nowrap;flex:none}",".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:26px;padding:0 8px;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_iconBtn{width:26px;padding:0;display:inline-flex;align-items:center;justify-content:center}",".tt_connAct{display:inline-flex;align-items:center;gap:5px}",".tt_searchInput{width:140px;height:26px;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:26px;height:26px;cursor:pointer;font-size:14px;line-height:1;flex:none}",".tt_close{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:26px;height:26px;cursor:pointer;font-size:15px;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_toast{position:fixed;bottom:28px;left:50%;transform:translateX(-50%);z-index:10060;background:#fff5f5;color:#7a1010;border:1px solid #f85149;border-left:4px solid #f85149;padding:11px 18px;border-radius:8px;font-size:13px;font-weight:500;line-height:1.55;box-shadow:0 10px 28px rgba(0,0,0,.5);max-width:min(640px,92vw);pointer-events:none;animation:ttToastIn .18s ease-out}","@keyframes ttToastIn{from{opacity:0;transform:translateX(-50%) translateY(8px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}",".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_tabs{flex:1 1 0;min-width:0;display:flex;align-items:center;gap:6px;overflow-x:auto;overflow-y:hidden;padding:2px 0;scrollbar-width:thin}",".tt_tab{display:inline-flex;align-items:center;gap:6px;height:26px;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:26px;height:26px;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_connbar{flex:none;display:flex;align-items:center;gap:8px;padding:3px 10px;border-bottom:1px solid var(--dsw-alias-border-l1)}",".tt_connbar[data-hidden]{display:none}",".tt_connArea{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:8px}",".tt_connDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_connDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_connDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#d29922)}",".tt_connDot[data-state=exited]{background:var(--dsw-alias-label-tertiary)}",".tt_connDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",'.tt_connTarget{font:12px "SF Mono",Menlo,Consolas,monospace;color:var(--dsw-alias-label-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}',".tt_connActions{display:flex;align-items:center;gap:6px;flex:none;margin-left:auto}",".tt_connActions{display:flex;align-items:center;gap:6px;flex:none}",".tt_tunnelPop{position:fixed;z-index:1350;display:flex;flex-direction:column;gap:8px;padding:10px 12px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:var(--dsw-shadow-lv3);min-width:280px;max-width:380px;color:var(--dsw-alias-label-primary)}",".tt_tunnelPopRow{display:flex;align-items:center;gap:8px;min-width:0}",".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[data-soldout]{opacity:.45}",".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_envItem[data-danger]{color:var(--dsw-alias-state-error-primary);font-weight:600}",".tt_envMore{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:4px 8px}",".tt_shellList{margin-top:6px}",".tt_sftpCard{width:min(720px,94vw);height:min(640px,86vh);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:16px;display:flex;flex-direction:column;gap:10px;overflow:hidden}",".tt_sftpTitleRow{display:flex;align-items:center;gap:10px}",".tt_sftpTitleRow .tt_sshTitle{flex:1}",".tt_sftpBar{display:flex;gap:8px;align-items:center}",'.tt_sftpPath{flex:1;min-width:0;height:30px;background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;font:12px "SF Mono",Menlo,Consolas,monospace;padding:0 10px;box-sizing:border-box}',".tt_sftpPath:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_sftpList{flex:1;min-height:200px;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}",".tt_sftpList[data-drag]{border-color:var(--dsw-alias-state-business-primary);border-style:dashed;background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpRow{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-primary);text-align:left;font:inherit;font-size:13px;display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:pointer}",".tt_sftpRow:hover{background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpIcon{flex:none;width:18px;text-align:center}",".tt_sftpName{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",'.tt_sftpMeta{flex:none;font-size:11px;color:var(--dsw-alias-label-tertiary);font-family:"SF Mono",Menlo,Consolas,monospace}',".tt_sftpAct{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:13px;line-height:1;flex:none;padding:3px 5px;border-radius:6px}",".tt_sftpAct:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpAct[data-danger]{color:var(--dsw-alias-state-error-primary);font-size:12px;font-weight:600}",".tt_sftpEditor{display:flex;gap:8px;align-items:center}",".tt_sftpEditor .tt_cardInput{flex:1;min-width:0;height:30px;font-size:12px}",".tt_sftpFoot{display:flex;align-items:center;gap:10px}",".tt_sftpStatus{flex:1;min-width:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".tt_sftpStatus[data-state=error]{color:var(--dsw-alias-state-error-primary)}",".tt_sftpStatus[data-state=busy]{color:var(--dsw-alias-state-business-primary)}",".tt_sftpDualCard{width:min(1180px,96vw);height:min(720px,88vh);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:16px;display:flex;flex-direction:column;gap:10px;overflow:hidden}",".tt_sftpDual{flex:1;min-height:0;display:flex;gap:12px}",".tt_sftpPane{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}",".tt_sftpPaneHead{font-size:12px;font-weight:600;color:var(--dsw-alias-label-secondary);white-space:nowrap}",".tt_sftpPane .tt_sftpBar{flex:none}",".tt_sftpTransfer{align-items:center;justify-content:center;display:flex}",".tt_sftpTransferAct{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;min-width:34px;height:26px;cursor:pointer;font-size:14px;flex:none}",".tt_sftpTransferAct:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpTransferAct:disabled{opacity:.4;cursor:default}"].join(`
337
- `),Zh="/api/dsh-tty/ws";function Qh(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+Zh}function ar(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var $i;function Lo(){document.getElementById("dsh-tty-style")||($i=document.createElement("style"),$i.id="dsh-tty-style",$i.textContent=Jh+`
338
- `+vo,document.head.appendChild($i))}var lr='<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>',ec='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.4"/><path d="M10.4 10.4L14 14"/></svg>',tc='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 4.5h11"/><path d="M6 4.5V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.5"/><path d="M4.5 4.5l.7 8.1a1 1 0 0 0 1 .9h3.6a1 1 0 0 0 1-.9l.7-8.1"/></svg>',ic='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="8" rx="1.4"/><path d="M3.5 10.5h-1v-8h8v1"/></svg>',sc='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3" width="9" height="11" rx="1.4"/><rect x="5.5" y="1.5" width="5" height="3" rx="1" fill="var(--dsw-alias-bg-base,#fff)"/></svg>',rc='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.5 8a5.5 5.5 0 1 1-1.6-3.9"/><path d="M13.7 1.8v2.7H11"/></svg>',nc='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.8 12.8V4.2a1 1 0 0 1 1-1h3l1.4 1.6h6a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2.8a1 1 0 0 1-1-1z"/></svg>',oc='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4.5 5.5L2 8l2.5 2.5"/><path d="M11.5 5.5L14 8l-2.5 2.5"/><path d="M2.8 8h10.4"/></svg>',ko=null,be=null,ie=null,qi=null,zt=null,bt=null,Ht=null,ni=null,Ki=null,Gi=null,oi=null,Nt=null,Le=null,Ft=null,Vi=!1,ai=null,tt=!1,xe=null,Yi=null,jt=null,Ct=null,Xi=null,wt=null,li=1e3,Ji="dsh-tty:tabs",se=new Map,yt=null,ts=0,Ui=!1,Oe=null,Wt=null,pt=[];function vt(e,t){if(zt===null)return;zt.textContent=e,bt.dataset.state=t,qi!==null&&(qi.style.display=t==="connected"?"none":""),jt!==null&&(jt.textContent=e),Ct!==null&&(Ct.dataset.state=t);let s=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");s!==null&&(s.dataset.state=t)}function Me(e){be!==null&&be.readyState===WebSocket.OPEN&&be.send(JSON.stringify(e))}function ut(){return yt!==null?se.get(yt):void 0}function mo(){try{let e=ko?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function ac(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Me({t:"refresh",sid:e.sid})}}var zi=null;function Ro(e){zi!==null&&clearTimeout(zi),zi=setTimeout(()=>{zi=null;let t=ut();t!==void 0&&ac(t)},e??200)}function xt(){try{let e=[...se.values()].filter(t=>!t.exited).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||ie===null?sessionStorage.removeItem(Ji):sessionStorage.setItem(Ji,JSON.stringify(e)),lc([...se.values()].map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var er="dsh-tty:persist-specs";function lc(e){try{let t=e.filter(s=>Ut(s.spawnSpec)).map(s=>({spawnSpec:s.spawnSpec,label:s.label}));t.length===0?localStorage.removeItem(er):localStorage.setItem(er,JSON.stringify(t))}catch{}}function hc(){try{let e=localStorage.getItem(er);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(s=>s!==null&&typeof s=="object"&&Ut(s.spawnSpec)):[]}catch{return[]}}function cc(){try{let e=sessionStorage.getItem(Ji);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(s=>s!==null&&typeof s=="object"&&typeof s.sid=="string"&&s.sid!==""&&s.spawnSpec!==null&&typeof s.spawnSpec=="object"):[]}catch{return[]}}function tr(e,t){return new Promise(s=>{let c=i=>{let r;try{r=JSON.parse(i.data)}catch{return}r.t===e&&(clearTimeout(h),be.removeEventListener("message",c),s(r))},h=setTimeout(()=>{be.removeEventListener("message",c),s(null)},t);be.addEventListener("message",c)})}function is(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&Me({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function ri(e,t){e.overlayEl===null||e.overlayEl===void 0||(e.overlayEl.textContent=t)}function ss(e){let t=new xo.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"SF Mono", Menlo, Consolas, "Courier New", monospace',scrollback:5e3,convertEol:!1,allowProposedApi:!0}),s=new Eo.FitAddon,c=new qr;t.loadAddon(s),t.loadAddon(c),t.loadAddon(new Kr);let h=document.createElement("div");h.className="tt_term";let i=document.createElement("div");i.className="tt_overlay",i.addEventListener("click",()=>{i.textContent="",cr(e.sid)}),h.appendChild(i),t.open(h);try{s.fit()}catch{}try{let r=new go;r.onContextLoss(()=>{try{r.dispose()}catch{}}),t.loadAddon(r)}catch{}t.onData(r=>{Me({t:"input",sid:e.sid,d:r})}),t.onResize(()=>{Ut(e.spawnSpec)&&Ro(200)}),t.attachCustomKeyEventHandler(r=>(r.ctrlKey||r.metaKey)&&r.key.toLowerCase()==="f"?(r.preventDefault(),Ho(),!1):!0),e.term=t,e.fit=s,e.search=c,e.termEl=h,e.overlayEl=i}function Zi(e,t){let s=ar(),c={sid:s,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??Lc(),label:t};return ss(c),se.set(s,c),ts+=1,qe(),qt(s),hr(c),xt(),c}function dc(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};ss(t),se.set(t.sid,t),ts+=1,qe(),qt(t.sid),Me({t:"attach",sid:t.sid})}function hr(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0;Me({...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24})}function wo(e){let t={sid:ar(),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};ss(t),se.set(t.sid,t),ts+=1,qe(),qt(t.sid),hr(t)}function cr(e){let t=se.get(e);if(t===void 0)return;let s=t.spawnSpec,c=t.label;if(t.exited||Me({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),se.delete(e);let h={sid:ar(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:s,label:c};ss(h),se.set(h.sid,h),qe(),qt(h.sid),hr(h),xt()}function uc(e){let t=se.get(e);if(t!==void 0){if(t.exited||Me({t:"kill",sid:e}),se.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),yt===e){yt=null;let s=[...se.keys()].pop()??null;s!==null&&qt(s)}qe(),se.size===0?rs():xt()}}function qt(e){let t=se.get(e);if(t!==void 0){yt=e;for(let[s,c]of se)c.termEl!==null&&(c.termEl.style.display=s===e?"":"none");Nt!==null&&t.termEl!==null&&t.termEl.parentElement!==Nt&&Nt.appendChild(t.termEl),qe(),hi();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&is(t),ri(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"")}}function qe(){if(Ht===null)return;Ht.textContent="";for(let[t,s]of se){let c=document.createElement("button");c.className="tt_tab",t===yt&&(c.dataset.active="");let h=document.createElement("span");h.textContent=s.label||"\u7EC8\u7AEF "+Ao(t),h.addEventListener("dblclick",r=>{r.stopPropagation(),pc(t,c)});let i=document.createElement("span");i.className="tt_tabClose",i.title="\u5173\u95ED",i.textContent="\u2715",c.title=h.textContent,c.appendChild(h),c.appendChild(i),c.addEventListener("click",r=>{if(r.target.closest(".tt_tabClose")!==null){r.stopPropagation(),uc(t);return}qt(t)}),Ht.appendChild(c)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.textContent="+",e.addEventListener("click",()=>{mc(e)}),Ht.appendChild(e)}function _c(e){return e?.direction==="remote"?`\u8FDC\u7A0B:${e.remoteHost||"127.0.0.1"}:${String(e.remotePort??0)} \u2192 \u672C\u673A:${String(e.localTargetPort??0)}`:`\u672C\u673A:${String(e?.localPort??0)} \u2192 ${e?.remoteHost??"?"}:${String(e?.remotePort??0)}`}function hi(){if(ni===null||Gi===null||oi===null||Ki===null)return;oi.textContent="";let e=ut(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){ni.dataset.hidden="";return}delete ni.dataset.hidden;let s=Number(t.port),c=e.persistTmux===!0?" \xB7 tmux \u6301\u4E45":t.persist===!0&&e.spawned===!0?" \xB7 \u672A\u6301\u4E45\u5316\uFF08tmux \u4E0D\u53EF\u7528\uFF09":"";Gi.textContent=(typeof e.target=="string"&&e.target!==""?e.target:typeof t.name=="string"&&t.name!==""?t.name:String(t.username??"")+"@"+String(t.host??"")+(Number.isInteger(s)&&s!==22?":"+s:""))+c,Ki.dataset.state=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";let h=(l,_,n,f)=>{let p=document.createElement("button");p.type="button",p.className="tt_toolBtn tt_connAct",p.title=n,p.innerHTML=l+"<span></span>",p.lastElementChild.textContent=_,p.addEventListener("click",f),oi.appendChild(p)};e.exited&&h(rc,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>cr(e.sid)),h(nc,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>_r(e.spawnSpec));let i=typeof t.name=="string"?t.name:"",r=i!==""?To(i):0;r>0&&h(oc,"\u96A7\u9053 "+r,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",l=>{fc(l.currentTarget,i)})}var mt=null,ji=null;function ir(){ji!==null&&(document.removeEventListener("mousedown",ji,!0),ji=null),mt!==null&&(mt.remove(),mt=null)}function fc(e,t){if(mt!==null){ir();return}let s=document.createElement("div");s.className="tt_tunnelPop";let c=document.createElement("div");c.className="tt_tunnelPopTitle",c.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,s.appendChild(c);let h=document.createElement("div");h.textContent="\u52A0\u8F7D\u4E2D\u2026",s.appendChild(h);let i=document.createElement("span");i.className="tt_cardHint",i.textContent="\u589E\u5220/\u542F\u505C\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4",s.appendChild(i),document.body.appendChild(s),mt=s;let r=e.getBoundingClientRect();s.style.top=String(r.bottom+6)+"px",s.style.left=String(Math.max(8,r.right-340))+"px";let l=_=>{mt===s&&(s.contains(_.target)||e.contains(_.target)||ir())};ji=l,setTimeout(()=>document.addEventListener("mousedown",l,!0),0),(async()=>{let _=[];try{let p=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();p.ok&&Array.isArray(p.tunnels)&&(_=p.tunnels)}catch{}if(mt!==s)return;h.textContent="";let n=dr.filter(f=>f?.bookName===t&&f?.enabled!==!1);if(n.length===0){let f=document.createElement("span");f.className="tt_cardHint",f.textContent="\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053",h.appendChild(f);return}for(let f of n){let p=_.find(o=>o?.name===f?.name),S=p?.state??"stopped",g=document.createElement("div");g.className="tt_tunnelPopRow";let a=document.createElement("span");a.className="tt_connDot",a.dataset.state=S==="active"?"connected":S==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(p?.error??p?.lastForwardError??""),d.textContent=_c(f)+" \xB7 "+S,g.appendChild(a),g.appendChild(d),h.appendChild(g)}})()}function Ao(e){let t=1;for(let s of se.keys()){if(s===e)return String(t);t+=1}return String(t)}function pc(e,t){let s=se.get(e);if(s===void 0||t.querySelector(".tt_tabRename")!==null)return;let c=t.querySelector("span:not(.tt_tabClose)");if(c===null)return;let h=document.createElement("input");h.className="tt_tabRename",h.value=s.label||"\u7EC8\u7AEF "+Ao(e),c.replaceWith(h),h.focus(),h.select();let i=!1,r=()=>{if(i)return;i=!0;let _=h.value.trim();s.label=_!==""?_:void 0,qe(),xt()},l=()=>{i||(i=!0,qe())};h.addEventListener("keydown",_=>{_.stopPropagation(),_.key==="Enter"?r():_.key==="Escape"&&l()}),h.addEventListener("blur",r),h.addEventListener("click",_=>_.stopPropagation())}var dr=[],Mo="dialog",St="off",$t=null,_t=null;function ci(e){e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(pt=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(dr=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(Mo=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(St=e.persistence),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&($t=e.maxSessions)}function gc(e){let t=document.createElement("div");t.className="tt_toast",t.textContent="\u26A0 "+e,document.body.appendChild(t),setTimeout(()=>t.remove(),4e3)}async function Do(){try{Me({t:"sessions"});let e=await tr("sessions",3e3);if(e!==null&&Array.isArray(e.list))return _t=e.list.length,_t}catch{}return null}async function Qi(){if(await Do(),$t===null||_t===null||_t<$t)return null;let e=[...se.values()].filter(c=>!c.exited).length,t=Math.max(0,_t-e),s=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${_t} \u4E2A / \u4E0A\u9650 ${$t}\uFF1A\u672C\u7A97\u53E3 ${e} \u4E2A${t>0?" + \u5176\u4ED6\u7A97\u53E3 "+t+" \u4E2A":""}\uFF09\u2014\u2014\u5173\u95ED\u4E0D\u7528\u7684\u7A97\u53E3/\u6807\u7B7E\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\u300D`;return gc(s),s}function vc(){return $t!==null&&_t!==null&&_t>=$t}function ur(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function To(e){return dr.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function sr(e){let t=Number(e?.port),s=Number.isInteger(t)&&t!==22?":"+t:"",c=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",h=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+s+" \xB7 "+c+h}async function Bo(){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 s=pt;ci(t.config),Oe!==null&&pt!==s&&rr(Oe)}}catch{}}function Po(e){Oe!==null&&(e.target instanceof Element&&(Oe.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||je())}function mc(e){if(Oe!==null){je();return}Bo(),Do().then(()=>{Oe!==null&&rr(Oe)});let t=document.createElement("div");t.className="tt_addMenu",Oe=t,rr(t),document.body.appendChild(t);let s=e.getBoundingClientRect();t.style.left=Math.max(8,Math.min(s.left,window.innerWidth-340))+"px",t.style.top=s.bottom+4+"px",document.addEventListener("mousedown",Po,!0)}function je(){Oe!==null&&(document.removeEventListener("mousedown",Po,!0),Oe.remove(),Oe=null)}function So(e,t,s,c,h){let i=document.createElement("button");i.type="button",i.className="tt_addMenuItem",h===!0&&(i.setAttribute("data-soldout",""),i.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let r=document.createElement("span");if(r.textContent=t,i.appendChild(r),s!==""){let l=document.createElement("span");l.className="tt_addMenuSub",l.textContent=s,i.appendChild(l)}i.addEventListener("click",c),e.appendChild(i)}function rr(e){e.textContent="";let t=vc();So(e,"\u672C\u5730\u7EC8\u7AEF",St==="tmux"?"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",async()=>{await Qi()||(je(),Zi())},t);let s=document.createElement("div");s.className="tt_addMenuSep",e.appendChild(s);let c=document.createElement("div");c.className="tt_addMenuTitle",c.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(c);for(let i of pt){if(i===null||typeof i!="object"||typeof i.name!="string"||i.name==="")continue;let r=document.createElement("div");r.className="tt_addMenuRow";let l=document.createElement("button");l.type="button",l.className="tt_addMenuItem",t&&(l.setAttribute("data-soldout",""),l.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let _=document.createElement("span");_.textContent=i.name;let n=document.createElement("span");n.className="tt_addMenuSub";let f=To(i.name);n.textContent=sr(i)+(f>0?" \xB7 \u21C4"+String(f):""),l.appendChild(_),l.appendChild(n),l.addEventListener("click",async()=>{if(await Qi())return;je();let g=St==="tmux"?{persist:!0,persistName:ur()}:{};Zi({t:"ssh",name:i.name,...g},i.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.textContent="\u{1F4C2}",p.addEventListener("click",()=>{je(),_r({name:i.name})});let S=document.createElement("button");S.type="button",S.className="tt_addMenuEdit",S.title="\u7F16\u8F91\u8FDE\u63A5",S.textContent="\u270E",S.addEventListener("click",()=>{je(),bo(i)}),r.appendChild(l),r.appendChild(p),r.appendChild(S),e.appendChild(r)}if(pt.length===0){let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(i)}let h=document.createElement("div");h.className="tt_addMenuSep",e.appendChild(h),So(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{je(),bo()})}function bo(e){if(Wt!==null)return;let t=e!==null&&typeof e=="object"?e:null,s=t!==null,c=document.createElement("div");c.className="tt_sshBackdrop";let h=document.createElement("div");h.className="tt_sshCard";let i=document.createElement("div");i.className="tt_sshTitle",i.textContent=s?"\u7F16\u8F91\u8FDE\u63A5 \u2014 "+String(t.name??""):"SSH \u8FDE\u63A5",h.appendChild(i);let r={},l=(E,k,A)=>{let W=document.createElement("label");W.className="tt_sshRow";let K=document.createElement("span");K.className="tt_cardLabel",K.textContent=k,W.appendChild(K);let $;if(A?.select!==void 0){$=document.createElement("select");for(let j of A.select){let P=document.createElement("option");P.value=j.value,P.textContent=j.label,$.appendChild(P)}}else $=document.createElement("input"),$.type=A?.type??"text",$.placeholder=A?.placeholder??"";return $.className="tt_cardInput",$.autocomplete="off",$.spellcheck=!1,W.appendChild($),r[E]=$,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"}),p=l("password","\u5BC6\u7801",{type:"password"}),S=E=>{let k=document.createElement("div");k.className="tt_sshRow";let A=document.createElement("input");A.type="text",A.className="tt_cardInput",A.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",A.autocomplete="off",A.spellcheck=!1;let W=document.createElement("div");W.className="tt_envList";let K=[],$=()=>{if(W.textContent="",K.length===0){let L=document.createElement("span");L.className="tt_cardHint",L.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(L);return}let j=A.value.trim().toUpperCase(),P=j===""?K:K.filter(L=>L.toUpperCase().includes(j));for(let L of P.slice(0,30)){let U=document.createElement("button");U.type="button",U.className="tt_envItem",U.textContent=L;let F="env:"+L,q=null,G=()=>{q!==null&&(clearTimeout(q),q=null),U.textContent=L,delete U.dataset.danger};U.addEventListener("click",()=>{let Q=E.value;if(Q===""||Q.startsWith("env:")||q!==null){G(),E.value=F,E.focus();return}U.textContent=L+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",U.dataset.danger="",q=setTimeout(G,4e3)}),W.appendChild(U)}if(P.length>30){let L=document.createElement("span");L.className="tt_envMore",L.textContent="\u8FD8\u6709 "+(P.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",W.appendChild(L)}else if(P.length===0){let L=document.createElement("span");L.className="tt_envMore",L.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",W.appendChild(L)}};return A.addEventListener("input",$),k.appendChild(A),k.appendChild(W),{row:k,setNames(j){K=Array.isArray(j)?j:[],$()}}},g=S(r.passphrase),a=S(r.password),d=!1;(async()=>{if(!d){d=!0;try{let k=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();k.ok&&Array.isArray(k.names)&&(g.setNames(k.names),a.setNames(k.names))}catch{}}})(),h.appendChild(n),h.appendChild(f),h.appendChild(g.row),h.appendChild(p),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 w=document.createElement("label");w.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="\u6301\u4E45\u4F1A\u8BDD\uFF08tmux \u6258\u7BA1\uFF0C\u65AD\u7EBF/\u91CD\u542F\u540E\u6062\u590D\u73B0\u573A\uFF1B\u8FDC\u7A0B\u9700\u5B89\u88C5 tmux\uFF09",w.appendChild(y),w.appendChild(m),y.checked=St==="tmux",St==="tmux"&&h.appendChild(w);let x=document.createElement("label");x.className="tt_cardRow";let D=document.createElement("input");D.type="checkbox",D.className="tt_cardCheckbox";let I=document.createElement("span");I.className="tt_cardLabel",I.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",x.appendChild(D),x.appendChild(I),h.appendChild(x);let H=l("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});H.style.display="none",h.appendChild(H),D.addEventListener("change",()=>{H.style.display=D.checked?"":"none",D.checked&&r.name.value.trim()===""&&r.host.value.trim()!==""&&(r.name.value=r.host.value.trim()),D.checked&&r.name.focus()}),s&&(x.style.display="none",r.name.value=String(t.name??""),H.style.display="",r.host.value=String(t.host??""),r.port.value=String(t.port??22),r.username.value=String(t.username??""),r.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",r.keyPath.value=String(t.keyPath??""),r.passphrase.value=String(t.passphrase??""),r.password.value=String(t.password??""),v.checked=t.agentForward===!0,y.checked=St==="tmux");let M=document.createElement("div");M.className="tt_sshError",h.appendChild(M);let N=document.createElement("div");N.className="tt_sshActions";let B=document.createElement("button");B.type="button",B.className="tt_toolBtn",B.textContent="\u53D6\u6D88";let R=document.createElement("button");R.type="button",R.className="tt_cardSave",R.textContent="\u8FDE\u63A5",N.appendChild(B);let O=document.createElement("button");O.type="button",O.className="tt_toolBtn",O.textContent="\u6587\u4EF6\u6D4F\u89C8",O.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",O.addEventListener("click",()=>{M.textContent="";let E=r.host.value.trim(),k=r.username.value.trim(),A=Number(r.port.value);if((!Number.isInteger(A)||A<1||A>65535)&&(A=22),E===""||k===""){M.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let W=r.auth.value,K={host:E,port:A,username:k,auth:W};if(W==="key"){let $=r.keyPath.value.trim();if($===""){M.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}K.keyPath=$;let j=r.passphrase.value;j!==""&&(K.passphrase=j)}if(W==="password"){let $=r.password.value;if($===""){M.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}K.password=$}v.checked&&(K.agentForward=!0),dt(),_r(K)}),N.appendChild(O);let T=null;s&&(T=document.createElement("button"),T.type="button",T.className="tt_toolBtn",T.textContent="\u4FDD\u5B58\u4FEE\u6539",T.addEventListener("click",()=>{M.textContent="";let E=r.host.value.trim(),k=r.username.value.trim();if(E===""||k===""){M.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let A=Number(r.port.value);(!Number.isInteger(A)||A<1||A>65535)&&(A=22);let W=r.auth.value,$={name:r.name.value.trim()||E,host:E,port:A,username:k,auth:W,keyPath:W==="key"?r.keyPath.value.trim():"",passphrase:r.passphrase.value,password:r.password.value,agentForward:v.checked,persist:y.checked};if(W==="key"&&$.keyPath===""){M.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}T!==null&&(T.disabled=!0),Sc(String(t.name??""),$).then(j=>{if(T!==null&&(T.disabled=!1),j!==void 0){M.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+j;return}dt()})}),N.appendChild(T)),N.appendChild(R),h.appendChild(N);let b=()=>{n.style.display=r.auth.value==="key"?"":"none",f.style.display=r.auth.value==="key"?"":"none",g.row.style.display=r.auth.value==="key"?"":"none",p.style.display=r.auth.value==="password"?"":"none",a.row.style.display=r.auth.value==="password"?"":"none"};r.auth.addEventListener("change",b),b(),B.addEventListener("click",()=>dt()),c.addEventListener("mousedown",E=>{E.target===c&&dt()}),R.addEventListener("click",async()=>{M.textContent="";let E=await Qi();if(E!==null){M.textContent=E;return}let k=r.host.value.trim(),A=r.username.value.trim(),W=Number(r.port.value);if((!Number.isInteger(W)||W<1||W>65535)&&(W=22),k===""||A===""){M.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let K=r.auth.value,$={t:"ssh",host:k,port:W,username:A,auth:K};if(K==="key"){let U=r.keyPath.value.trim();U!==""&&($.keyPath=U);let F=r.passphrase.value;F!==""&&($.passphrase=F)}if(K==="password"){let U=r.password.value;U!==""&&($.password=U)}v.checked&&($.agentForward=!0),y.checked&&($.persist=!0,$.persistName=ur());let j=W!==22?A+"@"+k+":"+W:A+"@"+k,P=U=>{dt(),ie!==null&&Zi($,U!==""?U:j)};if(!D.checked){P("");return}let L=r.name.value.trim()||k;R.disabled=!0,wc({name:L,host:k,port:W,username:A,auth:K,keyPath:$.keyPath??"",passphrase:$.passphrase??"",password:$.password??"",agentForward:v.checked,persist:y.checked}).then(U=>{if(R.disabled=!1,U!==void 0){M.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+U;return}P(L)})}),c.appendChild(h),document.body.appendChild(c),Wt=c,r.host.focus()}function dt(){Wt!==null&&(Wt.remove(),Wt=null)}async function wc(e){let t=[...pt.filter(s=>s?.name!==e.name),e];try{let s=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),c=await s.json().catch(()=>({}));if(!s.ok||!c.ok)return String(c.error||"HTTP "+s.status);ci(c.config);return}catch(s){return String(s&&s.message?s.message:s)}}async function Sc(e,t){if(t.name!==e&&pt.some(c=>c?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let s=pt.map(c=>c?.name===e?t:c);try{let c=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:s})}),h=await c.json().catch(()=>({}));if(!c.ok||!h.ok)return String(h.error||"HTTP "+c.status);ci(h.config);return}catch(c){return String(c&&c.message?c.message:c)}}function bc(e,t){if(ft!==null)return;let s=document.createElement("div");s.className="tt_sshBackdrop";let c=document.createElement("div");c.className="tt_sftpDualCard";let h=document.createElement("div");h.className="tt_sftpTitleRow";let i=document.createElement("div");i.className="tt_sshTitle",i.textContent="SFTP \u53CC\u680F \u2014 "+t;let r=document.createElement("button");r.type="button",r.className="tt_close",r.title="\u5173\u95ED",r.textContent="\u2715",r.addEventListener("click",Et),h.appendChild(i),h.appendChild(r),c.appendChild(h);let l=document.createElement("div");l.className="tt_sftpStatus";let _=(N,B)=>{l.textContent=N,B===void 0?delete l.dataset.state:l.dataset.state=B},n=!1,f=(N,B)=>{if(!(n||S.local.busy||S.remote.busy)){n=!0;for(let R of[S.local,S.remote])R.setBusy(!0);_(N,"busy"),Promise.resolve().then(B).catch(R=>_(String(R&&R.message?R.message:R),"error")).finally(()=>{n=!1;for(let R of[S.local,S.remote])R.setBusy(!1)})}},p=N=>{S[N].bar.after(a),a.style.display="",d.focus(),d.select()},S={},g=(N,B)=>{let R={kind:N,path:"",busy:!1},O=document.createElement("div");O.className="tt_sftpPane";let T=document.createElement("div");T.className="tt_sftpPaneHead",T.textContent=B,O.appendChild(T);let b=document.createElement("div");b.className="tt_sftpBar";let E=document.createElement("input");E.type="text",E.className="tt_sftpPath",E.placeholder=N==="local"?"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",E.spellcheck=!1,E.autocomplete="off";let k=document.createElement("button");k.type="button",k.className="tt_toolBtn",k.textContent="\u5237\u65B0";let A=document.createElement("button");A.type="button",A.className="tt_toolBtn",A.textContent="\u65B0\u5EFA\u76EE\u5F55",b.appendChild(E),b.appendChild(k),b.appendChild(A),O.appendChild(b);let W=document.createElement("div");W.className="tt_sftpList",O.appendChild(W),R.bar=b;let K=F=>{R.busy=F;for(let q of[k,A])q.disabled=F;E.disabled=F},$=async(F,q)=>{let G=N==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",Q=N==="local"?q:{...e,...q},ee=await fetch(G+F,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)}),te=await ee.json().catch(()=>({}));if(!ee.ok||te.ok!==!0)throw new Error(String(te.error||"HTTP "+ee.status));return te},j=(F,q)=>{if(!(R.busy||n))return K(!0),_(F,"busy"),Promise.resolve().then(q).catch(G=>_(String(G&&G.message?G.message:G),"error")).finally(()=>K(!1))},P=(F,q)=>F.endsWith("/")||F.endsWith("\\")?F+q:F+"/"+q,L=F=>{let q=P(R.path,F.name),G=[];F.isDir===!0?G.push("\u76EE\u5F55"):G.push(es(Number(F.size))||"\u2014");let Q=Oo(Number(F.mtime));Q!==""&&G.push(Q);let ee=w(F.isDir?"\u{1F4C1}":F.isSymlink?"\u2197":"\u{1F4C4}",F.name,G.join(" \xB7 ")),te=()=>R.loadDir(R.path),re=N==="local"?S.remote:S.local;return F.isDir===!0&&ee.addEventListener("click",X=>{X.target instanceof Element&&X.target.closest(".tt_sftpAct")!==null||R.loadDir(q)}),y(ee,N==="local"?"\u21E8":"\u21E6","\u4F20\u8F93\u5230"+(N==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+re.path,()=>{f("\u4F20\u8F93 "+F.name+"\u2026",async()=>{let X=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({direction:N==="local"?"up":"down",...e,localPath:N==="local"?q:P(re.path,F.name),remotePath:N==="local"?P(re.path,F.name):q})}),z=await X.json().catch(()=>({}));if(!X.ok||z.ok!==!0)throw new Error(String(z.error||"HTTP "+X.status));_("\u5DF2\u4F20\u8F93 "+F.name),await re.loadDir(re.path)})}),N!=="local"&&F.isDir!==!0&&y(ee,"\u2B07","\u4E0B\u8F7D "+F.name,()=>{x(F,q)}),y(ee,"\u270E","\u91CD\u547D\u540D "+F.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=F.name,p(N),v=async()=>{let X=d.value.trim();X===""||X===F.name||(C(),await R.runTask("\u91CD\u547D\u540D "+F.name+"\u2026",async()=>{await $("rename",{from:q,to:P(R.path,X)}),await te()}))}}),m(ee,()=>R.runTask("\u5220\u9664 "+F.name+"\u2026",async()=>{await $("remove",{path:q,recursive:F.isDir===!0}),await te(),_("\u5DF2\u5220\u9664 "+F.name)}),F),ee},U=F=>{if(W.textContent="",R.path!==""&&R.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(R.path)===!1){let G=w("\u{1F4C1}","..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","");G.addEventListener("click",()=>{R.loadDir(Io(R.path))}),W.appendChild(G)}let q=Array.isArray(F)?F:[];if(q.length===0){let G=document.createElement("div");G.className="tt_addMenuTitle",G.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",W.appendChild(G);return}for(let G of q)G===null||typeof G!="object"||typeof G.name!="string"||G.name===""||W.appendChild(L(G))};return R.loadDir=async F=>{try{let q=await $("list",{path:F??R.path});R.path=typeof q.path=="string"&&q.path!==""?q.path:R.path,E.value=R.path;let G=Array.isArray(q.entries)?q.entries.length:0;U(q.entries),_(R.path+" \u2014 "+String(G)+" \u9879")}catch(q){_(String(q&&q.message?q.message:q),"error")}},R.runTask=j,R.setBusy=K,S[N]=R,k.addEventListener("click",()=>{R.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>R.loadDir(R.path))}),A.addEventListener("click",()=>{R.busy||n||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",p(N),v=async()=>{let F=d.value.trim();F!==""&&(C(),await R.runTask("\u521B\u5EFA\u76EE\u5F55 "+F+"\u2026",async()=>{await $("mkdir",{path:P(R.path,F),parents:!0}),await R.loadDir(R.path)}))})}),E.addEventListener("keydown",F=>{if(F.key!=="Enter"||(F.preventDefault(),R.busy||n))return;let q=E.value.trim();q!==""&&R.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>R.loadDir(q))}),O},a=document.createElement("div");a.className="tt_sftpEditor",a.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let o=document.createElement("button");o.type="button",o.className="tt_toolBtn",o.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",a.appendChild(d),a.appendChild(o),a.appendChild(u);let v=null,C=()=>{a.style.display="none",d.value="",v=null};o.addEventListener("click",()=>{v?.()}),u.addEventListener("click",C),d.addEventListener("keydown",N=>{N.key==="Enter"?(N.preventDefault(),v?.()):N.key==="Escape"&&(N.stopPropagation(),C())});let w=(N,B,R)=>{let O=document.createElement("button");O.type="button",O.className="tt_sftpRow";let T=document.createElement("span");T.className="tt_sftpIcon",T.textContent=N;let b=document.createElement("span");if(b.className="tt_sftpName",b.textContent=B,b.title=B,O.appendChild(T),O.appendChild(b),R!==""){let E=document.createElement("span");E.className="tt_sftpMeta",E.textContent=R,O.appendChild(E)}return O},y=(N,B,R,O)=>{let T=document.createElement("button");T.type="button",T.className="tt_sftpAct",T.textContent=B,T.title=R,T.addEventListener("click",b=>{b.stopPropagation(),O()}),N.appendChild(T)},m=(N,B,R)=>{let O=document.createElement("button");O.type="button",O.className="tt_sftpAct",O.textContent="\u{1F5D1}",O.title="\u5220\u9664 "+R.name+(R.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let T=null;O.addEventListener("click",b=>{if(b.stopPropagation(),T!==null){clearTimeout(T),T=null,O.textContent="\u{1F5D1}",delete O.dataset.danger,B();return}O.textContent="\u786E\u8BA4?",O.dataset.danger="",T=setTimeout(()=>{T=null,O.textContent="\u{1F5D1}",delete O.dataset.danger},4e3)}),N.appendChild(O)},x=(N,B)=>S.remote.runTask("\u4E0B\u8F7D "+N.name+"\u2026",async()=>{let R=await fetch("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:B})});if(!R.ok){let E=await R.json().catch(()=>({}));throw new Error(String(E.error||"HTTP "+R.status))}let O=await R.blob(),T=URL.createObjectURL(O),b=document.createElement("a");b.href=T,b.download=N.name,b.click(),setTimeout(()=>URL.revokeObjectURL(T),3e4),_("\u5DF2\u4E0B\u8F7D "+N.name+"\uFF08"+(es(O.size)||String(O.size)+" B")+"\uFF09")}),D=g("local","\u672C\u673A"),I=g("remote","\u8FDC\u7A0B");S.local.wrap=D,S.remote.wrap=I;let H=document.createElement("div");H.className="tt_sftpDual",H.appendChild(D),H.appendChild(I),c.appendChild(H),c.appendChild(a);let M=document.createElement("div");M.className="tt_sftpFoot",M.appendChild(l),c.appendChild(M),s.addEventListener("mousedown",N=>{N.target===s&&Et()}),s.appendChild(c),document.body.appendChild(s),ft=s,S.local.loadDir(""),S.remote.loadDir("")}var ft=null;function Cc(e){let t=new TextEncoder().encode(e),s="";for(let c of t)s+=String.fromCharCode(c);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function es(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],s=e,c=-1;do s/=1024,c+=1;while(s>=1024&&c<t.length-1);return(s>=100?s.toFixed(0):s.toFixed(1))+" "+t[c]}function Oo(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let s=c=>String(c).padStart(2,"0");return t.getFullYear()+"-"+s(t.getMonth()+1)+"-"+s(t.getDate())+" "+s(t.getHours())+":"+s(t.getMinutes())}function Io(e){let t=String(e).replace(/\/+$/,""),s=t.lastIndexOf("/");return s<=0?"/":t.slice(0,s)}function si(e,t){return e.endsWith("/")?e+t:e+"/"+t}async function yc(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],s=[];for(let i of t){let r=typeof i.webkitGetAsEntry=="function"?i.webkitGetAsEntry():null;r!==null&&s.push(r)}if(s.length===0)return[...e.files??[]].map(i=>({relPath:i.name,file:i}));let c=[],h=(i,r)=>new Promise(l=>{if(i.isFile===!0){i.file(f=>{c.push({relPath:r+i.name,file:f}),l()},()=>l());return}if(i.isDirectory!==!0){l();return}let _=i.createReader(),n=()=>{_.readEntries(async f=>{if(f.length===0){l();return}for(let p of f)await h(p,r+i.name+"/");n()},()=>l())};n()});for(let i of s)await h(i,"");return c}function _r(e){if(ft!==null)return;let t=e!==null&&typeof e=="object"?e:{},s={};if(typeof t.name=="string"&&t.name!=="")s.name=t.name;else{for(let j of["host","username","auth","keyPath","passphrase","password"])typeof t[j]=="string"&&t[j]!==""&&(s[j]=t[j]);let $=Number(t.port);Number.isInteger($)&&$>=1&&$<=65535&&(s.port=$),t.agentForward===!0&&(s.agentForward=!0)}let c=s.name??(s.username!==void 0?s.username+"@"+String(s.host??""):String(s.host??""));if(Mo==="dual"){bc(s,c);return}let h=document.createElement("div");h.className="tt_sshBackdrop";let i=document.createElement("div");i.className="tt_sftpCard";let r=document.createElement("div");r.className="tt_sftpTitleRow";let l=document.createElement("div");l.className="tt_sshTitle",l.textContent="SFTP \u2014 "+c;let _=document.createElement("button");_.type="button",_.className="tt_close",_.title="\u5173\u95ED",_.textContent="\u2715",_.addEventListener("click",Et),r.appendChild(l),r.appendChild(_),i.appendChild(r);let n=document.createElement("div");n.className="tt_sftpBar";let f=document.createElement("input");f.type="text",f.className="tt_sftpPath",f.placeholder="\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",f.spellcheck=!1,f.autocomplete="off";let p=document.createElement("button");p.type="button",p.className="tt_toolBtn",p.textContent="\u5237\u65B0";let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent="\u65B0\u5EFA\u76EE\u5F55";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.textContent="\u4E0A\u4F20",g.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let a=document.createElement("input");a.type="file",a.multiple=!0,a.style.display="none",n.appendChild(f),n.appendChild(p),n.appendChild(S),n.appendChild(g),i.appendChild(n),i.appendChild(a);let d=document.createElement("div");d.className="tt_sftpEditor",d.style.display="none";let o=document.createElement("input");o.type="text",o.className="tt_cardInput",o.spellcheck=!1,o.autocomplete="off";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u786E\u5B9A";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent="\u53D6\u6D88",d.appendChild(o),d.appendChild(u),d.appendChild(v),i.appendChild(d);let C=null,w=()=>{d.style.display="none",C=null};u.addEventListener("click",()=>{C?.()}),v.addEventListener("click",w),o.addEventListener("keydown",$=>{$.key==="Enter"?($.preventDefault(),C?.()):$.key==="Escape"&&($.stopPropagation(),w())});let y=document.createElement("div");y.className="tt_sftpList",i.appendChild(y);let m=document.createElement("div");m.className="tt_sftpFoot";let x=document.createElement("div");x.className="tt_sftpStatus",m.appendChild(x),i.appendChild(m);let D={path:"",busy:!1},I=($,j)=>{x.textContent=$,j===void 0?delete x.dataset.state:x.dataset.state=j},H=$=>{D.busy=$;for(let j of[p,S,g])j.disabled=$;f.disabled=$},M=async($,j)=>{let P=await fetch("/api/dsh-tty/sftp/"+$,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...s,...j})}),L=await P.json().catch(()=>({}));if(!P.ok||L.ok!==!0)throw new Error(String(L.error||"HTTP "+P.status));return L},N=async($,j)=>{if(!D.busy){H(!0),I($,"busy");try{await j()}catch(P){I(String(P&&P.message?P.message:P),"error")}finally{H(!1)}}},B=($,j,P)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpRow";let U=document.createElement("span");U.className="tt_sftpIcon",U.textContent=$;let F=document.createElement("span");if(F.className="tt_sftpName",F.textContent=j,F.title=j,L.appendChild(U),L.appendChild(F),P!==""){let q=document.createElement("span");q.className="tt_sftpMeta",q.textContent=P,L.appendChild(q)}return L},R=($,j,P,L)=>{let U=document.createElement("button");U.type="button",U.className="tt_sftpAct",U.textContent=j,U.title=P,U.addEventListener("click",F=>{F.stopPropagation(),L()}),$.appendChild(U)},O=($,j,P)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpAct",L.textContent="\u{1F5D1}",L.title="\u5220\u9664 "+j.name+(j.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let U=null;L.addEventListener("click",F=>{if(F.stopPropagation(),!D.busy){if(U!==null){clearTimeout(U),U=null,L.textContent="\u{1F5D1}",delete L.dataset.danger,N("\u5220\u9664 "+j.name+"\u2026",async()=>{await M("remove",{path:P,recursive:j.isDir===!0}),await b(D.path),I("\u5DF2\u5220\u9664 "+j.name)});return}L.textContent="\u786E\u8BA4?",L.dataset.danger="",U=setTimeout(()=>{U=null,L.textContent="\u{1F5D1}",delete L.dataset.danger},4e3)}}),$.appendChild(L)},T=$=>{if(y.textContent="",D.path!==""&&D.path!=="/"){let P=B("\u{1F4C1}","..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","");P.addEventListener("click",()=>{N("\u52A0\u8F7D\u4E2D\u2026",()=>b(Io(D.path)))}),y.appendChild(P)}let j=Array.isArray($)?$:[];if(j.length===0){let P=document.createElement("div");P.className="tt_addMenuTitle",P.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",y.appendChild(P);return}for(let P of j){if(P===null||typeof P!="object"||typeof P.name!="string"||P.name==="")continue;let L=si(D.path,P.name),U=[];P.isDir===!0?U.push("\u76EE\u5F55"):U.push(es(Number(P.size))||"\u2014");let F=Oo(Number(P.mtime));F!==""&&U.push(F);let q=B(P.isDir?"\u{1F4C1}":P.isSymlink?"\u2197":"\u{1F4C4}",P.name,U.join(" \xB7 "));P.isDir===!0?q.addEventListener("click",G=>{G.target instanceof Element&&G.target.closest(".tt_sftpAct")!==null||N("\u52A0\u8F7D\u4E2D\u2026",()=>b(L))}):(q.addEventListener("click",G=>{G.target instanceof Element&&G.target.closest(".tt_sftpAct")!==null||E(P,L)}),R(q,"\u2B07","\u4E0B\u8F7D "+P.name,()=>{E(P,L)})),R(q,"\u270E","\u91CD\u547D\u540D "+P.name,()=>{o.placeholder="\u65B0\u540D\u79F0",o.value=P.name,d.style.display="",o.focus(),o.select(),C=async()=>{let G=o.value.trim();G===""||G===P.name||(w(),await N("\u91CD\u547D\u540D "+P.name+"\u2026",async()=>{await M("rename",{from:L,to:si(D.path,G)}),await b(D.path)}))}}),O(q,P,L),y.appendChild(q)}},b=async $=>{try{let j=await M("list",{path:$??D.path});D.path=typeof j.path=="string"&&j.path!==""?j.path:"/",f.value=D.path;let P=Array.isArray(j.entries)?j.entries.length:0;T(j.entries),I(D.path+" \u2014 "+String(P)+" \u9879")}catch(j){I(String(j&&j.message?j.message:j),"error")}},E=($,j)=>N("\u4E0B\u8F7D "+$.name+"\u2026",async()=>{let P=await fetch("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...s,path:j})});if(!P.ok){let q=await P.json().catch(()=>({}));throw new Error(String(q.error||"HTTP "+P.status))}let L=await P.blob(),U=URL.createObjectURL(L),F=document.createElement("a");F.href=U,F.download=$.name,F.click(),setTimeout(()=>URL.revokeObjectURL(U),3e4),I("\u5DF2\u4E0B\u8F7D "+$.name+"\uFF08"+(es(L.size)||String(L.size)+" B")+"\uFF09")}),k=($,j,P,L)=>new Promise((U,F)=>{let q=Cc(JSON.stringify({...s,path:si(D.path,j)})),G=new XMLHttpRequest;G.open("POST","/api/dsh-tty/sftp/upload"),G.setRequestHeader("x-dsh-sftp-meta",q);let Q=L>1?String(P)+"/"+String(L)+" ":"";G.upload.addEventListener("progress",ee=>{ee.lengthComputable&&I("\u4E0A\u4F20 "+Q+j+" "+String(Math.round(ee.loaded/ee.total*100))+"%","busy")}),G.addEventListener("load",()=>{if(G.status===200){U();return}let ee="HTTP "+G.status;try{let te=JSON.parse(G.responseText);te!==null&&typeof te=="object"&&typeof te.error=="string"&&(ee=te.error)}catch{}F(new Error(ee))}),G.addEventListener("error",()=>F(new Error("\u7F51\u7EDC\u9519\u8BEF"))),G.send($)}),A=async $=>N("\u4E0A\u4F20\u4E2D\u2026",async()=>{let j=new Set;for(let L of $){let U=L.relPath.lastIndexOf("/");if(U<=0)continue;let F=L.relPath.slice(0,U);j.has(F)||(j.add(F),await M("mkdir",{path:si(D.path,F),parents:!0}).catch(()=>{}))}let P=0;for(let L of $)P+=1,await k(L.file,L.relPath,P,$.length);I("\u4E0A\u4F20\u5B8C\u6210 "+String($.length)+" \u4E2A\u6587\u4EF6"),await b(D.path)});p.addEventListener("click",()=>{N("\u52A0\u8F7D\u4E2D\u2026",()=>b(D.path))}),S.addEventListener("click",()=>{D.busy||(o.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",o.value="",d.style.display="",o.focus(),C=async()=>{let $=o.value.trim();$!==""&&(w(),await N("\u521B\u5EFA\u76EE\u5F55 "+$+"\u2026",async()=>{await M("mkdir",{path:si(D.path,$)}),await b(D.path)}))})}),g.addEventListener("click",()=>{D.busy===!1&&a.click()}),a.addEventListener("change",()=>{let $=[...a.files??[]].map(j=>({relPath:j.name,file:j}));a.value="",$.length>0&&A($)});let W=0,K=$=>{$?y.dataset.drag="":delete y.dataset.drag};i.addEventListener("dragenter",$=>{$.preventDefault(),W+=1,K(!0)}),i.addEventListener("dragover",$=>{$.preventDefault()}),i.addEventListener("dragleave",()=>{W=Math.max(0,W-1),W===0&&K(!1)}),i.addEventListener("drop",$=>{$.preventDefault(),W=0,K(!1),!D.busy&&yc($.dataTransfer).then(j=>{j.length>0&&A(j)})}),f.addEventListener("keydown",$=>{if($.key!=="Enter"||($.preventDefault(),D.busy))return;let j=f.value.trim();j!==""&&N("\u52A0\u8F7D\u4E2D\u2026",()=>b(j))}),h.addEventListener("mousedown",$=>{$.target===h&&Et()}),h.appendChild(i),document.body.appendChild(h),ft=h,N("\u8FDE\u63A5\u4E2D\u2026",()=>b(""))}function Et(){ft!==null&&(ft.remove(),ft=null)}function Ho(){if(Le===null)return;let e=Le.style.display==="none"||Le.style.display==="";Le.style.display=e?"":"none",e&&Le.focus()}var xc={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function Ec(e){let t=ut();if(t===void 0||t.search===void 0)return;let s=Le.value;if(s==="")return;let c={decorations:xc};e?t.search.findPrevious(s,c):t.search.findNext(s,c)}function Co(){Vi||ie===null||wt!==null||(wt=setTimeout(()=>{wt=null,nr()},li),li=Math.min(li*2,5e3))}function Ut(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Lc(){return St==="tmux"?{t:"spawn",cwd:mo(),persist:!0,persistName:ur()}:{t:"spawn",cwd:mo()}}async function kc(){await Bo();let e=cc(),t=hc();if(se.size===0){if(e.length>0||t.length>0){Me({t:"sessions"});let r=await tr("sessions",4e3),l=new Map;if(r!==null&&Array.isArray(r.list))for(let n of r.list)n!==null&&typeof n=="object"&&n.attachable===!0&&l.set(n.sid,n);let _=new Set;for(let n of e){if(l.has(n.sid))dc(n);else if(Ut(n.spawnSpec))wo(n);else continue;Ut(n.spawnSpec)&&_.add(n.spawnSpec.persistName)}for(let n of t){let f=n.spawnSpec.persistName;_.has(f)||(wo(n),_.add(f))}xt()}if(se.size===0){if(await Qi())return;Zi()}return}let s=[...se.values()].filter(r=>!r.exited),c=s.filter(r=>Ut(r.spawnSpec)),h=null;if(c.length>0){Me({t:"sessions"});let r=await tr("sessions",4e3),l=new Set((r!==null&&Array.isArray(r.list)?r.list:[]).map(_=>_?.sid).filter(_=>typeof _=="string"));h=c.filter(_=>!l.has(_.sid));for(let _ of h)cr(_.sid)}let i=h!==null?new Set(h.map(r=>r.sid)):new Set;for(let r of s)i.has(r.sid)||Me({t:"attach",sid:r.sid})}function nr(){if(be!==null){try{be.close()}catch{}be=null}Vi=!1,clearTimeout(wt),wt=null,Ui=!0,vt("\u8FDE\u63A5\u4E2D\u2026","");try{be=new WebSocket(Qh())}catch(e){Ui=!1,vt("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),Co();return}be.onopen=()=>{Ui=!1,li=1e3,vt("\u5DF2\u8FDE\u63A5","connected"),kc()},be.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let s=t.sid;if(t.t==="ready"){let c=typeof t.target=="string"?t.target:"";vt(t.kind==="ssh"?"SSH "+(c!==""?c+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let h=se.get(s);if(h!==void 0){if(h.exited=!1,h.spawned=!0,h.live=!0,h.errored=!1,h.target=c,h.persistTmux=t.persist===!0,t.kind==="ssh"&&c!==""&&!h.label&&(h.label=c,qe()),hi(),ri(h,""),is(h),t.persist===!0){let i=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([i,new Promise(r=>setTimeout(r,500))]).then(()=>Ro(150))}di(),xt()}}else if(t.t==="data"){let c=se.get(s);c!==void 0&&c.term!==null&&(c.term.write(String(t.d??"")),Dc())}else if(t.t==="exit"){let c=se.get(s);if(c!==void 0){c.exited=!0,c.live=!1;let h=t.code!==null&&t.code!==void 0?"code="+t.code:"",i=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";vt("\u5DF2\u9000\u51FA "+[h,i].filter(Boolean).join(" "),""),hi(),ri(c,"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00"),di(),xt()}}else if(t.t==="error")if(vt("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof s=="string"){let c=se.get(s);c!==void 0&&(c.live||(c.errored=!0),hi(),ri(c,"\u9519\u8BEF\uFF1A"+String(t.m??"")+" \u2014 \u70B9\u51FB\u91CD\u8BD5"))}else Rc("\u70B9\u51FB\u91CD\u8BD5")},be.onclose=()=>{if(Ui=!1,!Vi){vt("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of se.values())e.exited||ri(e,"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026");Co()}},be.onerror=()=>{}}function Rc(e){Ft!==null&&(Ft.textContent=e)}function Ac(){if(ie!==null){tt&&No();return}Lo(),ie=document.createElement("div"),ie.className="tt_modalBackdrop",ie.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+lr+'</span><div class="tt_tabs"></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 tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+ec+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+tc+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+ic+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+sc+'</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\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button></div><div class="tt_connbar" data-hidden><div class="tt_connArea"><span class="tt_connDot"></span><span class="tt_connTarget">\u2014</span></div><div class="tt_connActions"></div></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(ie),qi=ie.querySelector(".tt_status"),zt=ie.querySelector(".tt_statusText"),bt=ie.querySelector(".tt_statusDot"),Ht=ie.querySelector(".tt_tabs"),ni=ie.querySelector(".tt_connbar"),Ki=ie.querySelector(".tt_connDot"),Gi=ie.querySelector(".tt_connTarget"),oi=ie.querySelector(".tt_connActions"),Nt=ie.querySelector(".tt_body"),Ft=ie.querySelector(".tt_body > .tt_overlay"),Le=ie.querySelector(".tt_searchInput"),Ft.addEventListener("click",()=>{Ft.textContent="",nr()}),ie.querySelector("[data-act=search]").addEventListener("click",()=>{Ho(),Le.style.display!=="none"&&Le.focus()}),Le.addEventListener("keydown",e=>{e.key==="Enter"?(e.preventDefault(),Ec(e.shiftKey)):e.key==="Escape"&&(e.stopPropagation(),Le.style.display="none")}),ie.querySelector("[data-act=clear]").addEventListener("click",()=>{let e=ut();e!==void 0&&e.term!==null&&e.term.clear()}),ie.querySelector("[data-act=copy]").addEventListener("click",()=>{let e=ut();if(e===void 0||e.term===null)return;let t=e.term.getSelection();t!==""&&navigator.clipboard.writeText(t).catch(()=>{})}),ie.querySelector("[data-act=paste]").addEventListener("click",()=>{let e=ut();e!==void 0&&navigator.clipboard.readText().then(t=>{Me({t:"input",sid:e.sid,d:t})}).catch(()=>{})}),ie.querySelector(".tt_min").addEventListener("click",()=>{or()}),ie.querySelector(".tt_close").addEventListener("click",()=>{rs()}),ie.addEventListener("mousedown",e=>{e.target===ie&&or()}),document.addEventListener("keydown",Fo),ai=new ResizeObserver(()=>{if(tt)return;let e=ut();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{return}e.exited||is(e)}}),ai.observe(Nt),qe(),hi(),nr()}function Mc(){xe=document.createElement("div"),xe.className="tt_dock",xe.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",xe.innerHTML='<span class="tt_dockTitle">'+lr+'<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\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button>',Yi=xe.querySelector(".tt_dockCount"),jt=xe.querySelector(".tt_dockStatus"),Ct=xe.querySelector(".tt_dockDot");let e=[...se.values()].filter(t=>!t.exited).length;Yi.textContent=se.size>0?"\xB7 "+e+"/"+se.size:"",zt!==null&&(jt.textContent=zt.textContent),bt!==null&&(Ct.dataset.state=bt.dataset.state??""),xe.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),rs();return}No()}),document.body.appendChild(xe)}function or(){ie===null||tt||(je(),dt(),Et(),tt=!0,Le!==null&&(Le.style.display="none"),ie.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?di():(Mc(),xe.classList.add("tt_dockCompact")))}function di(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!tt){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 s=[...se.values()].filter(h=>!h.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=s+"/"+se.size;let c=t.querySelector(".tt_sidebarBadgeDot");c!==null&&bt!==null&&(c.dataset.state=bt.dataset.state??"")}function Dc(){if(!tt)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Ct;e!==null&&(e.dataset.active="",clearTimeout(Xi),Xi=setTimeout(()=>{delete e.dataset.active},900))}function No(){if(ie===null||!tt)return;tt=!1,delete ie.dataset.minimized,clearTimeout(Xi),xe!==null&&(xe.remove(),xe=null),Yi=null,jt=null,Ct=null,di();let e=ut();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&is(e)}e!==void 0&&e.term!==null&&e.term.focus()}function rs(){if(ie!==null){if(Vi=!0,tt=!1,je(),dt(),Et(),clearTimeout(Xi),clearTimeout(wt),wt=null,li=1e3,xe!==null&&(xe.remove(),xe=null),Yi=null,jt=null,Ct=null,di(),be!==null){for(let e of se.values())e.exited||Me({t:"kill",sid:e.sid});try{be.close()}catch{}be=null}ai!==null&&(ai.disconnect(),ai=null);for(let e of se.values())if(e.term!==null)try{e.term.dispose()}catch{}se.clear(),yt=null,document.removeEventListener("keydown",Fo),ie.remove(),ie=null,qi=null,zt=null,bt=null,Ht=null,ni=null,Ki=null,Gi=null,oi=null,ir(),Nt=null,Ft=null,Le=null,ts=0;try{sessionStorage.removeItem(Ji)}catch{}}}function Fo(e){if(e.key==="Escape"&&ie!==null){if(e.preventDefault(),ft!==null){Et();return}if(Wt!==null){dt();return}if(Oe!==null){je();return}or()}}function Tc(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function Bc(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let s of e.children)if(s.tagName==="BUTTON")return s}function Pc(){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">'+lr+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),Ac()}),e}function yo(e,t){let s=Bc(e);if(s===void 0)return!1;if(t.parentElement!==e){let c=s.closest('[class*="logoRow"]'),h=c!==null&&c.parentElement===e?c:s,i=Array.from(e.children).filter(r=>r instanceof HTMLElement&&r.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 r=i[i.length-1];e.insertBefore(t,r.nextSibling)}else e.insertBefore(t,h.nextElementSibling)}return!0}function Oc(){if(Lo(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=Pc(),t,s=!1,c=()=>{if(t!==void 0&&!t.isConnected&&(i.disconnect(),t=void 0,s=!1),s){if(document.body.contains(e))return;i.disconnect(),t=void 0,s=!1}t??(t=Tc()),t!==void 0&&(s=yo(t,e),s&&i.observe(t,{childList:!0,subtree:!0}))},h=new MutationObserver(()=>{c()});h.observe(document.body,{childList:!0,subtree:!0});let i=new MutationObserver(()=>{if(t===void 0||!t.isConnected){s=!1,c();return}t.contains(e)||(s=yo(t,e))});return c(),()=>{h.disconnect(),i.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},s=e("react"),{jsx:c,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 r(){let[l,_]=s.useState(!1),[n,f]=s.useState(null),[p,S]=s.useState(!1),[g,a]=s.useState(!1),[d,o]=s.useState({kind:"",text:""}),[u,v]=s.useState([]),[C,w]=s.useState(!1),y=async()=>{try{let V=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();V.ok&&typeof V.config=="object"&&V.config!==null?(f(V.config),ci(V.config)):o({kind:"error",text:String(V.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(z){o({kind:"error",text:String(z&&z.message?z.message:z)})}},m=async()=>{try{let V=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();V.ok&&Array.isArray(V.shells)&&v(V.shells)}catch{}};s.useEffect(()=>{l&&!p&&(S(!0),y(),m())},[l]);let x=(z,V)=>f(Y=>({...Y||{},[z]:V})),[D,I]=s.useState(null),[H,M]=s.useState(null),[N,B]=s.useState(""),[R,O]=s.useState([]),[T,b]=s.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});s.useEffect(()=>{if(!l)return;let z=!0,V=async()=>{try{let oe=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();z&&oe.ok&&Array.isArray(oe.tunnels)&&O(oe.tunnels)}catch{}};V();let Y=setInterval(V,2e3);return()=>{z=!1,clearInterval(Y)}},[l]);let E=z=>V=>b(Y=>({...Y||{},[z]:V.target.value})),k=z=>z?.direction==="remote"?`\u8FDC\u7A0B:${z.remoteHost||"127.0.0.1"}:${String(z.remotePort??0)} \u2192 \u672C\u673A:${String(z.localTargetPort??0)}`:`\u672C\u673A:${String(z?.localPort??0)} \u2192 ${z?.remoteHost??"?"}:${String(z?.remotePort??0)}`,A=(n?.sshHosts??[]).find(z=>z?.name===T?.bookName),W=async z=>{try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:z})}),Y=await V.json().catch(()=>({}));return!V.ok||!Y.ok?(o({kind:"error",text:String(Y.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(V){return o({kind:"error",text:String(V&&V.message?V.message:V)}),!1}},K=()=>{o({kind:"",text:""});let z=T||{},V=z.bookName||(Array.isArray(n?.sshHosts)?n.sshHosts[0]?.name:"")||"";if(V===""){o({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let Y=ue=>{let it=Number(ue);return Number.isInteger(it)&&it>=1&&it<=65535?it:0},J;if(z.direction==="remote"){if(J={name:"",bookName:V,direction:"remote",remotePort:Y(z.remotePort),localTargetHost:"",localTargetPort:Y(z.localTargetPort),enabled:!0},J.remotePort<1||J.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}J.name=`${V}-R${String(J.remotePort)}`}else{if(J={name:"",bookName:V,direction:"local",localPort:Y(z.localPort),remoteHost:z.remoteHost.trim(),remotePort:Y(z.remotePort),enabled:!0},J.localPort<1||J.remoteHost===""||J.remotePort<1){o({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}J.name=`${V}-L${String(J.localPort)}`}let oe=new Set((Array.isArray(n?.tunnels)?n.tunnels:[]).map(ue=>ue?.name)),ne=J.name,_e=2;for(;oe.has(ne);)ne=`${J.name}-${String(_e)}`,_e+=1;J.name=ne;let Z=[...Array.isArray(n?.tunnels)?n.tunnels:[],J];f(ue=>({...ue||{},tunnels:Z})),b(ue=>({...ue||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),W(Z).then(ue=>{ue&&o({kind:"ok",text:`\u96A7\u9053\u300C${ne}\u300D\u5DF2\u751F\u6548`})})},$=z=>{let V=(Array.isArray(n?.tunnels)?n.tunnels:[]).filter(Y=>Y?.name!==z);f(Y=>({...Y||{},tunnels:V})),W(V)},j=(z,V)=>{let Y=(Array.isArray(n?.tunnels)?n.tunnels:[]).map(J=>J?.name===z?{...J,enabled:V}:J);f(J=>({...J||{},tunnels:Y})),W(Y)},P=z=>{I(z?.name??null),B(""),M({name:z?.name??"",host:z?.host??"",port:String(z?.port??22),username:z?.username??"",auth:z?.auth==="key"||z?.auth==="password"?z.auth:"agent",keyPath:z?.keyPath??"",passphrase:z?.passphrase??"",password:z?.password??"",agentForward:z?.agentForward===!0})},L=()=>{I(null),M(null),B("")},U=()=>{if(H===null)return;let z=H.name.trim(),V=H.host.trim(),Y=H.username.trim();if(z===""||V===""||Y===""){B("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let J=Number(H.port);if((!Number.isInteger(J)||J<1||J>65535)&&(J=22),(n?.sshHosts??[]).some(oe=>oe?.name===z&&z!==D)){B("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+z);return}if(H.auth==="key"&&H.keyPath.trim()===""){B("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}f(oe=>({...oe||{},sshHosts:(Array.isArray(oe?.sshHosts)?oe.sshHosts:[]).map(ne=>ne?.name===D?{name:z,host:V,port:J,username:Y,auth:H.auth,keyPath:H.keyPath.trim(),passphrase:H.passphrase,password:H.password,agentForward:H.agentForward}:ne)})),I(null),M(null),B(""),o({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+z+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},F=z=>{D===z&&L(),f(V=>({...V||{},sshHosts:(Array.isArray(V?.sshHosts)?V.sshHosts:[]).filter(Y=>Y?.name!==z)}))},q=async z=>{let V=(Array.isArray(n?.hostKeys)?n.hostKeys:[]).filter(Y=>!(Y?.host===z?.host&&Number(Y?.port)===Number(z?.port)));f(Y=>({...Y||{},hostKeys:V}));try{let Y=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:V})}),J=await Y.json().catch(()=>({}));!Y.ok||!J.ok?o({kind:"error",text:String(J.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(Y){o({kind:"error",text:String(Y&&Y.message?Y.message:Y)})}},G=async()=>{o({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!V.ok){o({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let Y=Array.isArray(V.entries)?V.entries:[],J=[...Array.isArray(n?.sshHosts)?n.sshHosts:[]],oe=new Set(J.map(Z=>Z?.name)),ne=0,_e=0;for(let Z of Y)if(!(Z===null||typeof Z!="object"||typeof Z.name!="string")){if(oe.has(Z.name)){_e+=1;continue}oe.add(Z.name),J.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}),ne+=1}f(Z=>({...Z||{},sshHosts:J})),o(ne===0?{kind:"ok",text:_e>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${_e} \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 ${ne} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${_e} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch(z){o({kind:"error",text:String(z&&z.message?z.message:z)})}},Q=async()=>{o({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!V.ok){o({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let Y=Array.isArray(V.entries)?V.entries:[],J=[...Array.isArray(n?.hostKeys)?n.hostKeys:[]],oe=new Set(J.map(Z=>String(Z?.host??"")+":"+String(Z?.port??22))),ne=0,_e=0;for(let Z of Y){if(Z===null||typeof Z!="object"||typeof Z.host!="string"||typeof Z.fingerprint!="string")continue;let ue=Z.host+":"+String(Z.port??22);if(oe.has(ue)){_e+=1;continue}oe.add(ue),J.push({host:Z.host,port:Number(Z.port)||22,fingerprint:Z.fingerprint}),ne+=1}if(ne===0){o({kind:"ok",text:_e>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${_e} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}f(Z=>({...Z||{},hostKeys:J}));try{let Z=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:J})}),ue=await Z.json().catch(()=>({}));if(!Z.ok||!ue.ok){o({kind:"error",text:String(ue.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}o({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ne} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${_e} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(Z){o({kind:"error",text:String(Z&&Z.message?Z.message:Z)})}}catch(z){o({kind:"error",text:String(z&&z.message?z.message:z)})}},ee=async()=>{a(!0),o({kind:"",text:""});let z={};for(let V of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose"]){let Y=(n||{})[V];Y!==void 0&&Y!==""&&(z[V]=Y)}z.sshHosts=Array.isArray(n?.sshHosts)?n.sshHosts:[],z.tunnels=Array.isArray(n?.tunnels)?n.tunnels:[];try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(z)}),Y=await V.json();!V.ok||!Y.ok?o({kind:"error",text:String(Y.error||"\u4FDD\u5B58\u5931\u8D25")}):(o({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),Y.config&&(f(Y.config),ci(Y.config)))}catch(V){o({kind:"error",text:String(V&&V.message?V.message:V)})}a(!1)},te=()=>{if(H===null)return null;let z=(V,Y,J,oe)=>h("label",{className:"tt_sshRow",children:[c("span",{className:"tt_cardLabel",children:V}),c("input",{className:"tt_cardInput",type:oe??"text",value:H[Y]??"",placeholder:J??"",autoComplete:"off",spellCheck:!1,onChange:ne=>M(_e=>({..._e||{},[Y]:ne.target.value}))})]});return h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_sshGrid",children:[z("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),z("\u7AEF\u53E3","port","22")]}),z("\u4E3B\u673A","host","example.com \u6216 IP"),z("\u7528\u6237\u540D","username","root"),h("label",{className:"tt_sshRow",children:[c("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),h("select",{className:"tt_cardInput",value:H.auth,onChange:V=>M(Y=>({...Y||{},auth:V.target.value})),children:[c("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),c("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),c("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...H.auth==="key"?[z("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),z("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...H.auth==="password"?[z("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],h("label",{className:"tt_cardRow",children:[c("input",{type:"checkbox",className:"tt_cardCheckbox",checked:H.agentForward===!0,onChange:V=>M(Y=>({...Y||{},agentForward:V.target.checked}))}),c("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),N!==""?c("span",{className:"tt_cardMessage tt_cardMessageError",children:N}):null,h("div",{className:"tt_cardRow",children:[c("button",{type:"button",className:"tt_cardSave",onClick:U,children:"\u5E94\u7528"}),c("button",{type:"button",className:"tt_toolBtn",onClick:L,children:"\u53D6\u6D88"})]})]})},re=(z,V,Y,J)=>h("label",{className:"tt_cardField",children:[c("span",{className:"tt_cardLabel",children:z}),c("input",{className:"tt_cardInput",value:n[V]??"",placeholder:Y??"",onChange:oe=>x(V,oe.target.value)}),J?c("span",{className:"tt_cardHint",children:J}):null]}),X=(z,V)=>h("label",{className:"tt_cardField tt_cardRow",children:[c("input",{type:"checkbox",className:"tt_cardCheckbox",checked:n[V]===!0,onChange:Y=>x(V,Y.target.checked)}),c("span",{className:"tt_cardLabel",children:z})]});return h("li",{className:l?"tt_card tt_cardOpen":"tt_card",children:[h("button",{type:"button",className:"tt_cardHeader","aria-expanded":l,onClick:()=>_(z=>!z),children:[h("span",{className:"tt_cardHeadText",children:[c("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),c("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\u3001tmux \u4F1A\u8BDD\u6301\u4E45\u5316\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),c("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:c("path",{d:i,fill:"currentColor"})})]}),l?h("div",{className:"tt_cardBody",children:[n===null?c("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):h("div",{children:[X("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),X("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),X("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),h("div",{className:"tt_cardField",children:[c("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),h("select",{className:"tt_cardInput",value:n.sftpStyle==="dual"?"dual":"dialog",onChange:z=>x("sftpStyle",z.target.value),children:[c("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),c("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),c("span",{className:"tt_cardHint",children:"\u53CC\u680F\u5728\u672C\u673A\u4E0E\u8FDC\u7A0B\u4E4B\u95F4\u5BF9\u62F7\u6587\u4EF6\uFF08\u76EE\u5F55\u9012\u5F52\u3001\u540C\u540D\u8986\u76D6\uFF09\uFF1B\u91CD\u65B0\u6253\u5F00 SFTP \u540E\u751F\u6548"})]}),h("div",{className:"tt_cardField",children:[c("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),h("select",{className:"tt_cardInput",value:n.persistence==="tmux"?"tmux":"off",onChange:z=>x("persistence",z.target.value),children:[c("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),c("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),c("span",{className:"tt_cardHint",children:"\u5F00\u542F\u540E\u6240\u6709\u65B0\u6807\u7B7E\uFF08\u672C\u5730/SSH \u8FDE\u63A5\u7C3F/SSH \u8FDE\u63A5\u5BF9\u8BDD\u6846\uFF09\u9ED8\u8BA4\u7531 tmux \u6258\u7BA1\u3001\u53EF\u8DE8\u5BBF\u4E3B\u91CD\u542F\u6062\u590D\uFF1B\u9700\u672C\u673A/\u8FDC\u7A0B\u5B89\u88C5 tmux\uFF1BSSH \u5BF9\u8BDD\u6846\u53EF\u5BF9\u5355\u6B21\u8FDE\u63A5\u53D6\u6D88\u52FE\u9009\uFF1B\u5DF2\u6709\u6807\u7B7E\u4E0D\u53D7\u5F71\u54CD"}),X("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),c("span",{className:"tt_cardHint",children:"\u9ED8\u8BA4\u5173\u95ED\uFF1A\u6574\u4E2A\u9875\u9762\u5173\u95ED\u65F6\u6301\u4E45\u4F1A\u8BDD\u7559\u5B58\uFF08\u4FDD\u6D3B\u671F\u540E\u53EF\u518D\u6062\u590D\uFF09\uFF1B\u5F00\u542F\u5219\u9875\u9762\u65AD\u5F00\u4E14\u4FDD\u6D3B\u671F\u7ED3\u675F\u65F6\u8FDE tmux \u4F1A\u8BDD\u4E00\u8D77\u7ED3\u675F\u2014\u2014\u6CE8\u610F\u5237\u65B0\u9875\u9762\u5728\u4FDD\u6D3B\u671F\u5185\u4E0D\u53D7\u5F71\u54CD"})]}),re("\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"),h("div",{className:"tt_cardField",onBlur:z=>{z.currentTarget.contains(z.relatedTarget)||w(!1)},children:[c("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),c("input",{className:"tt_cardInput",value:n.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>w(!0),onClick:()=>w(!0),onKeyDown:z=>{z.key==="Escape"&&w(!1)},onChange:z=>{x("shell",z.target.value),w(!0)}}),...C?[c("div",{className:"tt_envList tt_shellList",children:(()=>{let z=(n.shell??"").trim().toLowerCase(),V=z===""?u:u.filter(Y=>Y.toLowerCase().includes(z));return V.length===0?c("span",{className:"tt_envMore",children:"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF"}):V.map(Y=>c("button",{type:"button",className:"tt_envItem",onMouseDown:J=>J.preventDefault(),onClick:()=>{x("shell",Y),w(!1)},children:Y},Y))})()},"shell-list")]:[],c("span",{className:"tt_cardHint",children:"\u53EF\u4E0B\u62C9\u9009\u62E9\u672C\u673A\u5DF2\u5B89\u88C5 shell\uFF08$SHELL \u4F18\u5148\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bzsh / bash \u652F\u6301 shell \u96C6\u6210"})]},"shell-field"),re("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),re("COLORTERM","colorTerm","truecolor",""),re("\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"),re("\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:[c("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(n.sshHosts)&&n.sshHosts.length>0?[c("div",{className:"tt_hostList",children:n.sshHosts.map(z=>h("div",{children:[h("div",{className:"tt_sshHostRow",children:[c("div",{className:"tt_sshHostMeta",children:[c("span",{className:"tt_sshHostName",children:z?.name??""}),c("span",{className:"tt_sshHostTarget",children:sr(z??{})})]}),c("button",{type:"button",className:"tt_toolBtn",onClick:()=>P(z),children:"\u7F16\u8F91"}),c("button",{type:"button",className:"tt_toolBtn",onClick:()=>F(z?.name),children:"\u5220\u9664"})]}),D===z?.name?te():null]},String(z?.name??"")))})]:[c("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:[c("button",{type:"button",className:"tt_toolBtn",onClick:()=>{G()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),c("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),c("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:[c("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(n.tunnels)&&n.tunnels.length>0?[c("div",{children:n.tunnels.map(z=>{let V=R.find(J=>J.name===z?.name),Y=V?.state??"stopped";return h("div",{className:"tt_sshHostRow",children:[c("span",{className:"tt_tunnelDot","data-state":Y,title:Y}),c("div",{className:"tt_sshHostMeta",children:[c("span",{className:"tt_sshHostName",children:(z?.name??"")+" \xB7 "+k(z??{})}),c("span",{className:"tt_sshHostTarget",children:(z?.bookName??"")+(V?.error?" \xB7 "+V.error:"")+(V?.lastForwardError?" \xB7 "+V.lastForwardError:"")})]}),c("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z?.enabled!==!1,title:"\u542F\u7528",onChange:J=>j(z?.name,J.target.checked)}),c("button",{type:"button",className:"tt_toolBtn",onClick:()=>$(z?.name),children:"\u5220\u9664"})]},String(z?.name??""))})})]:[c("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:T.direction,onChange:E("direction"),children:[c("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),c("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:T.bookName,onChange:E("bookName"),children:[c("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(n?.sshHosts)?n.sshHosts.map(z=>c("option",{value:z?.name??"",children:z?.name??""})):[]]})]}),c("span",{className:"tt_cardHint",children:A!==void 0?"\u7ECF "+sr(A)+" \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"}),T.direction==="local"?h("div",{className:"tt_tunnelGridLocal",children:[c("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:T.localPort,autoComplete:"off",onChange:E("localPort")}),c("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:T.remoteHost,autoComplete:"off",onChange:E("remoteHost")}),c("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:T.remotePort,autoComplete:"off",onChange:E("remotePort")})]}):h("div",{className:"tt_tunnelGrid",children:[c("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:T.remotePort,autoComplete:"off",onChange:E("remotePort")}),c("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:T.localTargetPort,autoComplete:"off",onChange:E("localTargetPort")})]}),c("div",{className:"tt_cardRow",children:[c("button",{type:"button",className:"tt_cardSave",onClick:K,children:"\u6DFB\u52A0\u96A7\u9053"}),c("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:[c("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),c("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Q()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(n.hostKeys)&&n.hostKeys.length>0?[c("div",{className:"tt_hostList",children:n.hostKeys.map(z=>h("div",{className:"tt_sshHostRow",children:[c("div",{className:"tt_sshHostMeta",children:[c("span",{className:"tt_sshHostName",children:String(z?.host??"")+":"+String(z?.port??22)}),c("span",{className:"tt_sshHostTarget",children:"sha256:"+String(z?.fingerprint??"")})]}),c("button",{type:"button",className:"tt_toolBtn",onClick:()=>{q(z)},children:"\u5220\u9664"})]},String(z?.host??"")+":"+String(z?.port??22)))})]:[c("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"})],c("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:[c("button",{className:"tt_cardSave",disabled:g,onClick:()=>{ee()},children:g?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),c("span",{className:"tt_cardMessage"+(d.kind==="ok"?" tt_cardMessageOk":d.kind==="error"?" tt_cardMessageError":""),children:d.text})]})]})]}):null]})}return t.inject=["slots","sessions"],t.apply=l=>(ko=l.sessions,Oc(),l.slots.inject("settings.plugin.item",()=>l.slots.register({name:"settings.plugin.item",key:"tty",order:110},r)),()=>{rs()}),t}});})();
336
+ `;var rc=[".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:8px;padding:4px 10px;border-bottom:1px solid var(--dsw-alias-border-l1);display:flex}",".tt_titleIcon{flex:none;display:inline-flex;color:var(--dsw-alias-label-primary)}",".tt_status{font-size:11px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;display:flex;white-space:nowrap;flex:none}",".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:26px;padding:0 8px;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_iconBtn{width:26px;padding:0;display:inline-flex;align-items:center;justify-content:center}",".tt_connAct{display:inline-flex;align-items:center;gap:5px}",".tt_searchInput{width:140px;height:26px;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:26px;height:26px;cursor:pointer;font-size:14px;line-height:1;flex:none}",".tt_close{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:26px;height:26px;cursor:pointer;font-size:15px;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_toast{position:fixed;bottom:28px;left:50%;transform:translateX(-50%);z-index:10060;background:#fff5f5;color:#7a1010;border:1px solid #f85149;border-left:4px solid #f85149;padding:11px 18px;border-radius:8px;font-size:13px;font-weight:500;line-height:1.55;box-shadow:0 10px 28px rgba(0,0,0,.5);max-width:min(640px,92vw);pointer-events:none;animation:ttToastIn .18s ease-out}","@keyframes ttToastIn{from{opacity:0;transform:translateX(-50%) translateY(8px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}",".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_tabs{flex:1 1 0;min-width:0;display:flex;align-items:center;gap:6px;overflow-x:auto;overflow-y:hidden;padding:2px 0;scrollbar-width:thin}",".tt_tab{display:inline-flex;align-items:center;gap:6px;height:26px;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:26px;height:26px;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_connbar{flex:none;display:flex;align-items:center;gap:8px;padding:3px 10px;border-bottom:1px solid var(--dsw-alias-border-l1)}",".tt_connbar[data-hidden]{display:none}",".tt_connArea{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:8px}",".tt_connDot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}",".tt_connDot[data-state=connected]{background:var(--dsw-alias-state-success-primary)}",".tt_connDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#d29922)}",".tt_connDot[data-state=exited]{background:var(--dsw-alias-label-tertiary)}",".tt_connDot[data-state=error]{background:var(--dsw-alias-state-error-primary)}",'.tt_connTarget{font:12px "SF Mono",Menlo,Consolas,monospace;color:var(--dsw-alias-label-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}',".tt_connActions{display:flex;align-items:center;gap:6px;flex:none;margin-left:auto}",".tt_connActions{display:flex;align-items:center;gap:6px;flex:none}",".tt_tunnelPop{position:fixed;z-index:1350;display:flex;flex-direction:column;gap:8px;padding:10px 12px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:var(--dsw-shadow-lv3);min-width:280px;max-width:380px;color:var(--dsw-alias-label-primary)}",".tt_tunnelPopRow{display:flex;align-items:center;gap:8px;min-width:0}",".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[data-soldout]{opacity:.45}",".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_sshActions .tt_toolBtn,.tt_sshActions .tt_cardSave{height:26px;padding:0 10px;font-size:12px;line-height:1.5;box-sizing:border-box}",".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_sshProbeResult{margin:2px 0 4px;font-size:12px;line-height:1.5;white-space:pre-wrap;word-break:break-word}",".tt_sshProbeOk{color:var(--dsw-alias-state-success-primary)}",".tt_sshProbeBad{color:var(--dsw-alias-state-error-primary)}",".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_envItem[data-danger]{color:var(--dsw-alias-state-error-primary);font-weight:600}",".tt_envMore{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:4px 8px}",".tt_shellList{margin-top:6px}",".tt_sftpCard{width:min(720px,94vw);height:min(640px,86vh);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:16px;display:flex;flex-direction:column;gap:10px;overflow:hidden}",".tt_sftpTitleRow{display:flex;align-items:center;gap:10px}",".tt_sftpTitleRow .tt_sshTitle{flex:1}",".tt_sftpBar{display:flex;gap:8px;align-items:center}",'.tt_sftpPath{flex:1;min-width:0;height:30px;background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;font:12px "SF Mono",Menlo,Consolas,monospace;padding:0 10px;box-sizing:border-box}',".tt_sftpPath:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}",".tt_sftpList{flex:1;min-height:200px;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}",".tt_sftpList[data-drag]{border-color:var(--dsw-alias-state-business-primary);border-style:dashed;background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpRow{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-primary);text-align:left;font:inherit;font-size:13px;display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:pointer}",".tt_sftpRow:hover{background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpIcon{flex:none;width:18px;text-align:center}",".tt_sftpName{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",'.tt_sftpMeta{flex:none;font-size:11px;color:var(--dsw-alias-label-tertiary);font-family:"SF Mono",Menlo,Consolas,monospace}',".tt_sftpAct{appearance:none;background:0 0;border:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:13px;line-height:1;flex:none;padding:3px 5px;border-radius:6px}",".tt_sftpAct:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpAct[data-danger]{color:var(--dsw-alias-state-error-primary);font-size:12px;font-weight:600}",".tt_sftpEditor{display:flex;gap:8px;align-items:center}",".tt_sftpEditor .tt_cardInput{flex:1;min-width:0;height:30px;font-size:12px}",".tt_sftpFoot{display:flex;align-items:center;gap:10px}",".tt_sftpStatus{flex:1;min-width:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".tt_sftpStatus[data-state=error]{color:var(--dsw-alias-state-error-primary)}",".tt_sftpStatus[data-state=busy]{color:var(--dsw-alias-state-business-primary)}",".tt_sftpProgress{flex:none;width:172px;display:none;align-items:center;gap:6px}",".tt_sftpProgress[data-active]{display:flex}",".tt_sftpTrack{flex:1;height:4px;border-radius:2px;background:var(--dsw-alias-border-l2);overflow:hidden}",".tt_sftpFill{height:100%;width:0;border-radius:2px;background:var(--dsw-alias-state-business-primary);transition:width .15s linear}",".tt_sftpProgress[data-state=error] .tt_sftpFill{background:var(--dsw-alias-state-error-primary)}",".tt_sftpProgress[data-state=done] .tt_sftpFill{background:var(--dsw-alias-state-success-primary)}",'.tt_sftpPct{flex:none;font-size:11px;color:var(--dsw-alias-label-tertiary);font-family:"SF Mono",Menlo,Consolas,monospace;min-width:38px;max-width:110px;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',".tt_sftpDualCard{width:min(1180px,96vw);height:min(720px,88vh);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:16px;display:flex;flex-direction:column;gap:10px;overflow:hidden}",".tt_sftpDual{flex:1;min-height:0;display:flex;gap:12px}",".tt_sftpPane{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}",".tt_sftpPaneHead{font-size:12px;font-weight:600;color:var(--dsw-alias-label-secondary);white-space:nowrap}",".tt_sftpPane .tt_sftpBar{flex:none}",".tt_sftpTransfer{align-items:center;justify-content:center;display:flex}",".tt_sftpTransferAct{appearance:none;background:0 0;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:8px;min-width:34px;height:26px;cursor:pointer;font-size:14px;flex:none}",".tt_sftpTransferAct:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".tt_sftpTransferAct:disabled{opacity:.4;cursor:default}"].join(`
337
+ `),nc="/api/dsh-tty/ws";function oc(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+nc}function hr(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var zi;function Ro(){document.getElementById("dsh-tty-style")||(zi=document.createElement("style"),zi.id="dsh-tty-style",zi.textContent=rc+`
338
+ `+wo,document.head.appendChild(zi))}var cr='<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>',ac='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.4"/><path d="M10.4 10.4L14 14"/></svg>',lc='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 4.5h11"/><path d="M6 4.5V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.5"/><path d="M4.5 4.5l.7 8.1a1 1 0 0 0 1 .9h3.6a1 1 0 0 0 1-.9l.7-8.1"/></svg>',hc='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="8" rx="1.4"/><path d="M3.5 10.5h-1v-8h8v1"/></svg>',cc='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3" width="9" height="11" rx="1.4"/><rect x="5.5" y="1.5" width="5" height="3" rx="1" fill="var(--dsw-alias-bg-base,#fff)"/></svg>',dc='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.5 8a5.5 5.5 0 1 1-1.6-3.9"/><path d="M13.7 1.8v2.7H11"/></svg>',uc='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.8 12.8V4.2a1 1 0 0 1 1-1h3l1.4 1.6h6a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2.8a1 1 0 0 1-1-1z"/></svg>',_c='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4.5 5.5L2 8l2.5 2.5"/><path d="M11.5 5.5L14 8l-2.5 2.5"/><path d="M2.8 8h10.4"/></svg>',Mo=null,Ce=null,se=null,Gi=null,Gt=null,Et=null,$t=null,li=null,Vi=null,Yi=null,hi=null,Ut=null,ke=null,zt=null,Xi=!1,ci=null,at=!1,Ee=null,Ji=null,Vt=null,Lt=null,Zi=null,yt=null,di=1e3,Qi="dsh-tty:tabs",re=new Map,kt=null,is=0,ji=!1,Fe=null,jt=null,wt=[];function St(e,t){if(Gt===null)return;Gt.textContent=e,Et.dataset.state=t,Gi!==null&&(Gi.style.display=t==="connected"?"none":""),Vt!==null&&(Vt.textContent=e),Lt!==null&&(Lt.dataset.state=t);let i=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");i!==null&&(i.dataset.state=t)}function De(e){Ce!==null&&Ce.readyState===WebSocket.OPEN&&Ce.send(JSON.stringify(e))}function pt(){return kt!==null?re.get(kt):void 0}function bo(){try{let e=Mo?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function fc(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),De({t:"refresh",sid:e.sid})}}var qi=null;function Ao(e){qi!==null&&clearTimeout(qi),qi=setTimeout(()=>{qi=null;let t=pt();t!==void 0&&fc(t)},e??200)}function Rt(){try{let e=[...re.values()].filter(t=>!t.exited).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||se===null?sessionStorage.removeItem(Qi):sessionStorage.setItem(Qi,JSON.stringify(e)),pc([...re.values()].map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var ir="dsh-tty:persist-specs";function pc(e){try{let t=e.filter(i=>Kt(i.spawnSpec)).map(i=>({spawnSpec:i.spawnSpec,label:i.label}));t.length===0?localStorage.removeItem(ir):localStorage.setItem(ir,JSON.stringify(t))}catch{}}function gc(){try{let e=localStorage.getItem(ir);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&Kt(i.spawnSpec)):[]}catch{return[]}}function vc(){try{let e=sessionStorage.getItem(Qi);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&typeof i.sid=="string"&&i.sid!==""&&i.spawnSpec!==null&&typeof i.spawnSpec=="object"):[]}catch{return[]}}function sr(e,t){return new Promise(i=>{let a=s=>{let r;try{r=JSON.parse(s.data)}catch{return}r.t===e&&(clearTimeout(c),Ce.removeEventListener("message",a),i(r))},c=setTimeout(()=>{Ce.removeEventListener("message",a),i(null)},t);Ce.addEventListener("message",a)})}function ss(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&De({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function ai(e,t){e.overlayEl===null||e.overlayEl===void 0||(e.overlayEl.textContent=t)}function rs(e){let t=new Lo.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"SF Mono", Menlo, Consolas, "Courier New", monospace',scrollback:5e3,convertEol:!1,allowProposedApi:!0}),i=new ko.FitAddon,a=new Gr;t.loadAddon(i),t.loadAddon(a),t.loadAddon(new Vr);let c=document.createElement("div");c.className="tt_term";let s=document.createElement("div");s.className="tt_overlay",s.addEventListener("click",()=>{s.textContent="",ur(e.sid)}),c.appendChild(s),t.open(c);try{i.fit()}catch{}try{let r=new mo;r.onContextLoss(()=>{try{r.dispose()}catch{}}),t.loadAddon(r)}catch{}t.onData(r=>{De({t:"input",sid:e.sid,d:r})}),t.onResize(()=>{Kt(e.spawnSpec)&&Ao(200)}),t.attachCustomKeyEventHandler(r=>(r.ctrlKey||r.metaKey)&&r.key.toLowerCase()==="f"?(r.preventDefault(),jo(),!1):!0),e.term=t,e.fit=i,e.search=a,e.termEl=c,e.overlayEl=s}function es(e,t){let i=hr(),a={sid:i,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??Bc(),label:t};return rs(a),re.set(i,a),is+=1,Je(),Yt(i),dr(a),Rt(),a}function mc(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};rs(t),re.set(t.sid,t),is+=1,Je(),Yt(t.sid),De({t:"attach",sid:t.sid})}function dr(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0;De({...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24})}function So(e){let t={sid:hr(),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};rs(t),re.set(t.sid,t),is+=1,Je(),Yt(t.sid),dr(t)}function ur(e){let t=re.get(e);if(t===void 0)return;let i=t.spawnSpec,a=t.label;if(t.exited||De({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),re.delete(e);let c={sid:hr(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:i,label:a};rs(c),re.set(c.sid,c),Je(),Yt(c.sid),dr(c),Rt()}function wc(e){let t=re.get(e);if(t!==void 0){if(t.exited||De({t:"kill",sid:e}),re.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),kt===e){kt=null;let i=[...re.keys()].pop()??null;i!==null&&Yt(i)}Je(),re.size===0?ns():Rt()}}function Yt(e){let t=re.get(e);if(t!==void 0){kt=e;for(let[i,a]of re)a.termEl!==null&&(a.termEl.style.display=i===e?"":"none");Ut!==null&&t.termEl!==null&&t.termEl.parentElement!==Ut&&Ut.appendChild(t.termEl),Je(),ui();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&ss(t),ai(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"")}}function Je(){if($t===null)return;$t.textContent="";for(let[t,i]of re){let a=document.createElement("button");a.className="tt_tab",t===kt&&(a.dataset.active="");let c=document.createElement("span");c.textContent=i.label||"\u7EC8\u7AEF "+Do(t),c.addEventListener("dblclick",r=>{r.stopPropagation(),Cc(t,a)});let s=document.createElement("span");s.className="tt_tabClose",s.title="\u5173\u95ED",s.textContent="\u2715",a.title=c.textContent,a.appendChild(c),a.appendChild(s),a.addEventListener("click",r=>{if(r.target.closest(".tt_tabClose")!==null){r.stopPropagation(),wc(t);return}Yt(t)}),$t.appendChild(a)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.textContent="+",e.addEventListener("click",()=>{Ec(e)}),$t.appendChild(e)}function bc(e){return e?.direction==="remote"?`\u8FDC\u7A0B:${e.remoteHost||"127.0.0.1"}:${String(e.remotePort??0)} \u2192 \u672C\u673A:${String(e.localTargetPort??0)}`:`\u672C\u673A:${String(e?.localPort??0)} \u2192 ${e?.remoteHost??"?"}:${String(e?.remotePort??0)}`}function ui(){if(li===null||Yi===null||hi===null||Vi===null)return;hi.textContent="";let e=pt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){li.dataset.hidden="";return}delete li.dataset.hidden;let i=Number(t.port),a=e.persistTmux===!0?" \xB7 tmux \u6301\u4E45":t.persist===!0&&e.spawned===!0?" \xB7 \u672A\u6301\u4E45\u5316\uFF08tmux \u4E0D\u53EF\u7528\uFF09":"";Yi.textContent=(typeof e.target=="string"&&e.target!==""?e.target:typeof t.name=="string"&&t.name!==""?t.name:String(t.username??"")+"@"+String(t.host??"")+(Number.isInteger(i)&&i!==22?":"+i:""))+a,Vi.dataset.state=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";let c=(h,f,n,_)=>{let p=document.createElement("button");p.type="button",p.className="tt_toolBtn tt_connAct",p.title=n,p.innerHTML=h+"<span></span>",p.lastElementChild.textContent=f,p.addEventListener("click",_),hi.appendChild(p)};e.exited&&c(dc,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>ur(e.sid)),c(uc,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>pr(e.spawnSpec));let s=typeof t.name=="string"?t.name:"",r=s!==""?Po(s):0;r>0&&c(_c,"\u96A7\u9053 "+r,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",h=>{Sc(h.currentTarget,s)})}var Ct=null,Ki=null;function rr(){Ki!==null&&(document.removeEventListener("mousedown",Ki,!0),Ki=null),Ct!==null&&(Ct.remove(),Ct=null)}function Sc(e,t){if(Ct!==null){rr();return}let i=document.createElement("div");i.className="tt_tunnelPop";let a=document.createElement("div");a.className="tt_tunnelPopTitle",a.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,i.appendChild(a);let c=document.createElement("div");c.textContent="\u52A0\u8F7D\u4E2D\u2026",i.appendChild(c);let s=document.createElement("span");s.className="tt_cardHint",s.textContent="\u589E\u5220/\u542F\u505C\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4",i.appendChild(s),document.body.appendChild(i),Ct=i;let r=e.getBoundingClientRect();i.style.top=String(r.bottom+6)+"px",i.style.left=String(Math.max(8,r.right-340))+"px";let h=f=>{Ct===i&&(i.contains(f.target)||e.contains(f.target)||rr())};Ki=h,setTimeout(()=>document.addEventListener("mousedown",h,!0),0),(async()=>{let f=[];try{let p=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();p.ok&&Array.isArray(p.tunnels)&&(f=p.tunnels)}catch{}if(Ct!==i)return;c.textContent="";let n=_r.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(n.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent="\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053",c.appendChild(_);return}for(let _ of n){let p=f.find(o=>o?.name===_?.name),b=p?.state??"stopped",g=document.createElement("div");g.className="tt_tunnelPopRow";let l=document.createElement("span");l.className="tt_connDot",l.dataset.state=b==="active"?"connected":b==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(p?.error??p?.lastForwardError??""),d.textContent=bc(_)+" \xB7 "+b,g.appendChild(l),g.appendChild(d),c.appendChild(g)}})()}function Do(e){let t=1;for(let i of re.keys()){if(i===e)return String(t);t+=1}return String(t)}function Cc(e,t){let i=re.get(e);if(i===void 0||t.querySelector(".tt_tabRename")!==null)return;let a=t.querySelector("span:not(.tt_tabClose)");if(a===null)return;let c=document.createElement("input");c.className="tt_tabRename",c.value=i.label||"\u7EC8\u7AEF "+Do(e),a.replaceWith(c),c.focus(),c.select();let s=!1,r=()=>{if(s)return;s=!0;let f=c.value.trim();i.label=f!==""?f:void 0,Je(),Rt()},h=()=>{s||(s=!0,Je())};c.addEventListener("keydown",f=>{f.stopPropagation(),f.key==="Enter"?r():f.key==="Escape"&&h()}),c.addEventListener("blur",r),c.addEventListener("click",f=>f.stopPropagation())}var _r=[],To="dialog",xt="off",vt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},qt=null,gt=null;function _i(e){e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(wt=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(_r=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(To=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(xt=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(vt={...vt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(qt=e.maxSessions)}function yc(e){let t=document.createElement("div");t.className="tt_toast",t.textContent="\u26A0 "+e,document.body.appendChild(t),setTimeout(()=>t.remove(),4e3)}async function Bo(){try{De({t:"sessions"});let e=await sr("sessions",3e3);if(e!==null&&Array.isArray(e.list))return gt=e.list.length,gt}catch{}return null}async function ts(){if(await Bo(),qt===null||gt===null||gt<qt)return null;let e=[...re.values()].filter(a=>!a.exited).length,t=Math.max(0,gt-e),i=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${gt} \u4E2A / \u4E0A\u9650 ${qt}\uFF1A\u672C\u7A97\u53E3 ${e} \u4E2A${t>0?" + \u5176\u4ED6\u7A97\u53E3 "+t+" \u4E2A":""}\uFF09\u2014\u2014\u5173\u95ED\u4E0D\u7528\u7684\u7A97\u53E3/\u6807\u7B7E\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\u300D`;return yc(i),i}function xc(){return qt!==null&&gt!==null&&gt>=qt}function fr(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Po(e){return _r.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function nr(e){let t=Number(e?.port),i=Number.isInteger(t)&&t!==22?":"+t:"",a=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",c=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+i+" \xB7 "+a+c}async function Oo(e,t){let i=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),a=await i.json().catch(()=>({}));return a&&a.ok===!1&&a.error?{error:String(a.error)}:a&&a.result?{result:a.result}:{error:String(a&&a.error?a.error:"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP "+i.status+"\uFF09")}}function Io(e,t){if(!e)return"\u8FDE\u63A5\u6D4B\u8BD5\u2026";let i=e,a=typeof i.tcp?.ms=="number"?i.tcp.ms:null,c=typeof i.auth?.ms=="number"?i.auth.ms:null,s=[];i.tcp?.ok&&s.push("TCP "+(a!==null?a+"ms":"\u901A")),i.banner?.ok&&s.push("banner \u6B63\u5E38");let r=i.hostkey?.state;if(r==="matched"?s.push("\u4E3B\u673A\u5BC6\u94A5\u5339\u914D"):r==="recorded"?s.push("\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09"):r==="mismatch"&&s.push("\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01"),i.auth?.ok)return"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A"+(c!==null?"\u8BA4\u8BC1\u901A\u8FC7\uFF08"+c+"ms\uFF09":"\u8BA4\u8BC1\u901A\u8FC7")+(s.length?" \xB7 "+s.join(" \xB7 "):"");let h=i.auth?.error||i.tcp?.error||"\u672A\u77E5\u9519\u8BEF";return(t?.prefix||"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A")+h+(s.length?" \xB7 "+s.join(" \xB7 "):"")}async function No(){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 i=wt;_i(t.config),Fe!==null&&wt!==i&&or(Fe)}}catch{}}function Fo(e){Fe!==null&&(e.target instanceof Element&&(Fe.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||Ye())}function Ec(e){if(Fe!==null){Ye();return}No(),Bo().then(()=>{Fe!==null&&or(Fe)});let t=document.createElement("div");t.className="tt_addMenu",Fe=t,or(t),document.body.appendChild(t);let i=e.getBoundingClientRect();t.style.left=Math.max(8,Math.min(i.left,window.innerWidth-340))+"px",t.style.top=i.bottom+4+"px",document.addEventListener("mousedown",Fo,!0)}function Ye(){Fe!==null&&(document.removeEventListener("mousedown",Fo,!0),Fe.remove(),Fe=null)}function Co(e,t,i,a,c){let s=document.createElement("button");s.type="button",s.className="tt_addMenuItem",c===!0&&(s.setAttribute("data-soldout",""),s.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let r=document.createElement("span");if(r.textContent=t,s.appendChild(r),i!==""){let h=document.createElement("span");h.className="tt_addMenuSub",h.textContent=i,s.appendChild(h)}s.addEventListener("click",a),e.appendChild(s)}function or(e){e.textContent="";let t=xc();Co(e,"\u672C\u5730\u7EC8\u7AEF",xt==="tmux"?"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",async()=>{await ts()||(Ye(),es())},t);let i=document.createElement("div");i.className="tt_addMenuSep",e.appendChild(i);let a=document.createElement("div");a.className="tt_addMenuTitle",a.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(a);for(let s of wt){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let r=document.createElement("div");r.className="tt_addMenuRow";let h=document.createElement("button");h.type="button",h.className="tt_addMenuItem",t&&(h.setAttribute("data-soldout",""),h.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let f=document.createElement("span");f.textContent=s.name;let n=document.createElement("span");n.className="tt_addMenuSub";let _=Po(s.name);n.textContent=nr(s)+(_>0?" \xB7 \u21C4"+String(_):""),h.appendChild(f),h.appendChild(n),h.addEventListener("click",async()=>{if(await ts())return;Ye();let g=xt==="tmux"?{persist:!0,persistName:fr()}:{};es({t:"ssh",name:s.name,...g},s.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.textContent="\u{1F4C2}",p.addEventListener("click",()=>{Ye(),pr({name:s.name})});let b=document.createElement("button");b.type="button",b.className="tt_addMenuEdit",b.title="\u7F16\u8F91\u8FDE\u63A5",b.textContent="\u270E",b.addEventListener("click",()=>{Ye(),yo(s)}),r.appendChild(h),r.appendChild(p),r.appendChild(b),e.appendChild(r)}if(wt.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(s)}let c=document.createElement("div");c.className="tt_addMenuSep",e.appendChild(c),Co(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{Ye(),yo()})}function yo(e){if(jt!==null)return;let t=e!==null&&typeof e=="object"?e:null,i=t!==null,a=document.createElement("div");a.className="tt_sshBackdrop";let c=document.createElement("div");c.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshTitle",s.textContent=i?"\u7F16\u8F91\u8FDE\u63A5 \u2014 "+String(t.name??""):"SSH \u8FDE\u63A5",c.appendChild(s);let r={},h=(F,K,G)=>{let W=document.createElement("label");W.className="tt_sshRow";let O=document.createElement("span");O.className="tt_cardLabel",O.textContent=K,W.appendChild(O);let x;if(G?.select!==void 0){x=document.createElement("select");for(let H of G.select){let j=document.createElement("option");j.value=H.value,j.textContent=H.label,x.appendChild(j)}}else x=document.createElement("input"),x.type=G?.type??"text",x.placeholder=G?.placeholder??"";return x.className="tt_cardInput",x.autocomplete="off",x.spellcheck=!1,W.appendChild(x),r[F]=x,W},f=document.createElement("div");f.className="tt_sshGrid",f.appendChild(h("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),f.appendChild(h("port","\u7AEF\u53E3",{placeholder:"22"})),c.appendChild(f),c.appendChild(h("username","\u7528\u6237\u540D",{placeholder:"root"})),c.appendChild(h("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=h("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),_=h("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),p=h("password","\u5BC6\u7801",{type:"password"}),b=F=>{let K=document.createElement("div");K.className="tt_sshRow";let G=document.createElement("input");G.type="text",G.className="tt_cardInput",G.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",G.autocomplete="off",G.spellcheck=!1;let W=document.createElement("div");W.className="tt_envList";let O=[],x=()=>{if(W.textContent="",O.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 H=G.value.trim().toUpperCase(),j=H===""?O:O.filter($=>$.toUpperCase().includes(H));for(let $ of j.slice(0,30)){let q=document.createElement("button");q.type="button",q.className="tt_envItem",q.textContent=$;let Y="env:"+$,te=null,Q=()=>{te!==null&&(clearTimeout(te),te=null),q.textContent=$,delete q.dataset.danger};q.addEventListener("click",()=>{let ie=F.value;if(ie===""||ie.startsWith("env:")||te!==null){Q(),F.value=Y,F.focus();return}q.textContent=$+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",q.dataset.danger="",te=setTimeout(Q,4e3)}),W.appendChild(q)}if(j.length>30){let $=document.createElement("span");$.className="tt_envMore",$.textContent="\u8FD8\u6709 "+(j.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",W.appendChild($)}else if(j.length===0){let $=document.createElement("span");$.className="tt_envMore",$.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",W.appendChild($)}};return G.addEventListener("input",x),K.appendChild(G),K.appendChild(W),{row:K,setNames(H){O=Array.isArray(H)?H:[],x()}}},g=b(r.passphrase),l=b(r.password),d=!1;(async()=>{if(!d){d=!0;try{let K=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();K.ok&&Array.isArray(K.names)&&(g.setNames(K.names),l.setNames(K.names))}catch{}}})(),c.appendChild(n),c.appendChild(_),c.appendChild(g.row),c.appendChild(p),c.appendChild(l.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),c.appendChild(u);let w=document.createElement("label");w.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="\u6301\u4E45\u4F1A\u8BDD\uFF08tmux \u6258\u7BA1\uFF0C\u65AD\u7EBF/\u91CD\u542F\u540E\u6062\u590D\u73B0\u573A\uFF1B\u8FDC\u7A0B\u9700\u5B89\u88C5 tmux\uFF09",w.appendChild(y),w.appendChild(m),y.checked=xt==="tmux",xt==="tmux"&&c.appendChild(w);let E=document.createElement("label");E.className="tt_cardRow";let P=document.createElement("input");P.type="checkbox",P.className="tt_cardCheckbox";let I=document.createElement("span");I.className="tt_cardLabel",I.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",E.appendChild(P),E.appendChild(I),c.appendChild(E);let N=h("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});N.style.display="none",c.appendChild(N),P.addEventListener("change",()=>{N.style.display=P.checked?"":"none",P.checked&&r.name.value.trim()===""&&r.host.value.trim()!==""&&(r.name.value=r.host.value.trim()),P.checked&&r.name.focus()}),i&&(E.style.display="none",r.name.value=String(t.name??""),N.style.display="",r.host.value=String(t.host??""),r.port.value=String(t.port??22),r.username.value=String(t.username??""),r.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",r.keyPath.value=String(t.keyPath??""),r.passphrase.value=String(t.passphrase??""),r.password.value=String(t.password??""),v.checked=t.agentForward===!0,y.checked=xt==="tmux");let R=document.createElement("div");R.className="tt_sshError",c.appendChild(R);let U=document.createElement("div");U.className="tt_sshProbeResult",U.style.display="none",c.appendChild(U);let D=()=>{R.textContent="";let F=r.host.value.trim(),K=r.username.value.trim(),G=Number(r.port.value);if((!Number.isInteger(G)||G<1||G>65535)&&(G=22),F===""||K==="")return R.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B",null;let W=r.auth.value,O={host:F,port:G,username:K,auth:W};if(W==="key"){let x=r.keyPath.value.trim();if(x==="")return R.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84",null;O.keyPath=x;let H=r.passphrase.value;H!==""&&(O.passphrase=H)}if(W==="password"){let x=r.password.value;if(x==="")return R.textContent="auth=password \u9700\u8981\u5BC6\u7801",null;O.password=x}return v.checked&&(O.agentForward=!0),O},A=document.createElement("div");A.className="tt_sshActions";let T=document.createElement("button");T.type="button",T.className="tt_toolBtn",T.textContent="\u53D6\u6D88";let B=document.createElement("button");B.type="button",B.className="tt_cardSave",B.textContent="\u8FDE\u63A5",A.appendChild(T);let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent="\u6587\u4EF6\u6D4F\u89C8",S.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",S.addEventListener("click",()=>{R.textContent="";let F=r.host.value.trim(),K=r.username.value.trim(),G=Number(r.port.value);if((!Number.isInteger(G)||G<1||G>65535)&&(G=22),F===""||K===""){R.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let W=r.auth.value,O={host:F,port:G,username:K,auth:W};if(W==="key"){let x=r.keyPath.value.trim();if(x===""){R.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}O.keyPath=x;let H=r.passphrase.value;H!==""&&(O.passphrase=H)}if(W==="password"){let x=r.password.value;if(x===""){R.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}O.password=x}v.checked&&(O.agentForward=!0),ft(),pr(O)}),A.appendChild(S);let L=null;i&&(L=document.createElement("button"),L.type="button",L.className="tt_toolBtn",L.textContent="\u4FDD\u5B58\u4FEE\u6539",L.addEventListener("click",()=>{R.textContent="";let F=r.host.value.trim(),K=r.username.value.trim();if(F===""||K===""){R.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let G=Number(r.port.value);(!Number.isInteger(G)||G<1||G>65535)&&(G=22);let W=r.auth.value,x={name:r.name.value.trim()||F,host:F,port:G,username:K,auth:W,keyPath:W==="key"?r.keyPath.value.trim():"",passphrase:r.passphrase.value,password:r.password.value,agentForward:v.checked,persist:y.checked};if(W==="key"&&x.keyPath===""){R.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}L!==null&&(L.disabled=!0),kc(String(t.name??""),x).then(H=>{if(L!==null&&(L.disabled=!1),H!==void 0){R.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+H;return}ft()})}),A.appendChild(L));let k=document.createElement("button");k.type="button",k.className="tt_toolBtn",k.textContent="\u8BD5\u8FDE",k.title="\u6309\u5F53\u524D\u586B\u5199\u8BCA\u65AD\u8FDE\u63A5\uFF08TCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\uFF09\uFF1B\u4E0D\u4F1A\u65B0\u5EFA\u4F1A\u8BDD\uFF0C\u4E5F\u4E0D\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9",k.addEventListener("click",()=>{let F=D();F!==null&&(U.style.display="",U.className="tt_sshProbeResult",U.textContent="\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026",k.disabled=!0,Oo(F,!1).then(K=>{k.disabled=!1,K.result?(U.className="tt_sshProbeResult"+(K.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),U.textContent=Io(K.result)):(U.className="tt_sshProbeResult tt_sshProbeBad",U.textContent="\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(K.error||"\u672A\u77E5\u9519\u8BEF"))}))}),A.appendChild(k),A.appendChild(B),c.appendChild(A);let M=()=>{n.style.display=r.auth.value==="key"?"":"none",_.style.display=r.auth.value==="key"?"":"none",g.row.style.display=r.auth.value==="key"?"":"none",p.style.display=r.auth.value==="password"?"":"none",l.row.style.display=r.auth.value==="password"?"":"none"};r.auth.addEventListener("change",M),M(),T.addEventListener("click",()=>ft()),a.addEventListener("mousedown",F=>{F.target===a&&ft()}),B.addEventListener("click",async()=>{R.textContent="";let F=await ts();if(F!==null){R.textContent=F;return}let K=r.host.value.trim(),G=r.username.value.trim(),W=Number(r.port.value);if((!Number.isInteger(W)||W<1||W>65535)&&(W=22),K===""||G===""){R.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let O=r.auth.value,x={t:"ssh",host:K,port:W,username:G,auth:O};if(O==="key"){let q=r.keyPath.value.trim();q!==""&&(x.keyPath=q);let Y=r.passphrase.value;Y!==""&&(x.passphrase=Y)}if(O==="password"){let q=r.password.value;q!==""&&(x.password=q)}v.checked&&(x.agentForward=!0),y.checked&&(x.persist=!0,x.persistName=fr());let H=W!==22?G+"@"+K+":"+W:G+"@"+K,j=q=>{ft(),se!==null&&es(x,q!==""?q:H)};if(!P.checked){j("");return}let $=r.name.value.trim()||K;B.disabled=!0,Lc({name:$,host:K,port:W,username:G,auth:O,keyPath:x.keyPath??"",passphrase:x.passphrase??"",password:x.password??"",agentForward:v.checked,persist:y.checked}).then(q=>{if(B.disabled=!1,q!==void 0){R.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+q;return}j($)})}),a.appendChild(c),document.body.appendChild(a),jt=a,r.host.focus()}function ft(){jt!==null&&(jt.remove(),jt=null)}async function Lc(e){let t=[...wt.filter(i=>i?.name!==e.name),e];try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),a=await i.json().catch(()=>({}));if(!i.ok||!a.ok)return String(a.error||"HTTP "+i.status);_i(a.config);return}catch(i){return String(i&&i.message?i.message:i)}}async function kc(e,t){if(t.name!==e&&wt.some(a=>a?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let i=wt.map(a=>a?.name===e?t:a);try{let a=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:i})}),c=await a.json().catch(()=>({}));if(!a.ok||!c.ok)return String(c.error||"HTTP "+a.status);_i(c.config);return}catch(a){return String(a&&a.message?a.message:a)}}function Rc(e,t){if(mt!==null)return;let i=document.createElement("div");i.className="tt_sshBackdrop";let a=document.createElement("div");a.className="tt_sftpDualCard";let c=document.createElement("div");c.className="tt_sftpTitleRow";let s=document.createElement("div");s.className="tt_sshTitle",s.textContent="SFTP \u53CC\u680F \u2014 "+t;let r=document.createElement("button");r.type="button",r.className="tt_close",r.title="\u5173\u95ED",r.textContent="\u2715",r.addEventListener("click",Mt),c.appendChild(s),c.appendChild(r),a.appendChild(c);let h=document.createElement("div");h.className="tt_sftpStatus";let f=(D,A)=>{h.textContent=D,A===void 0?delete h.dataset.state:h.dataset.state=A},n=!1,_=(D,A)=>{if(!(n||b.local.busy||b.remote.busy)){n=!0;for(let T of[b.local,b.remote])T.setBusy(!0);f(D,"busy"),Promise.resolve().then(A).catch(T=>f(String(T&&T.message?T.message:T),"error")).finally(()=>{n=!1;for(let T of[b.local,b.remote])T.setBusy(!1)})}},p=D=>{b[D].bar.after(l),l.style.display="",d.focus(),d.select()},b={},g=(D,A)=>{let T={kind:D,path:"",busy:!1},B=document.createElement("div");B.className="tt_sftpPane";let S=document.createElement("div");S.className="tt_sftpPaneHead",S.textContent=A,B.appendChild(S);let L=document.createElement("div");L.className="tt_sftpBar";let k=document.createElement("input");k.type="text",k.className="tt_sftpPath",k.placeholder=D==="local"?"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",k.spellcheck=!1,k.autocomplete="off";let M=document.createElement("button");M.type="button",M.className="tt_toolBtn",M.textContent="\u5237\u65B0";let F=document.createElement("button");F.type="button",F.className="tt_toolBtn",F.textContent="\u65B0\u5EFA\u76EE\u5F55",L.appendChild(k),L.appendChild(M),L.appendChild(F),B.appendChild(L);let K=document.createElement("div");K.className="tt_sftpList",B.appendChild(K),T.bar=L;let G=$=>{T.busy=$;for(let q of[M,F])q.disabled=$;k.disabled=$},W=async($,q)=>{let Y=D==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",te=D==="local"?q:{...e,...q},Q=await fetch(Y+$,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(te)}),ie=await Q.json().catch(()=>({}));if(!Q.ok||ie.ok!==!0)throw new Error(String(ie.error||"HTTP "+Q.status));return ie},O=($,q)=>{if(!(T.busy||n))return G(!0),f($,"busy"),Promise.resolve().then(q).catch(Y=>f(String(Y&&Y.message?Y.message:Y),"error")).finally(()=>G(!1))},x=($,q)=>$.endsWith("/")||$.endsWith("\\")?$+q:$+"/"+q,H=$=>{let q=x(T.path,$.name),Y=[];$.isDir===!0?Y.push("\u76EE\u5F55"):Y.push(Xe(Number($.size))||"\u2014");let te=Ho(Number($.mtime));te!==""&&Y.push(te);let Q=w($.isDir?"\u{1F4C1}":$.isSymlink?"\u2197":"\u{1F4C4}",$.name,Y.join(" \xB7 ")),ie=()=>T.loadDir(T.path),Z=D==="local"?b.remote:b.local;return $.isDir===!0&&Q.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||T.loadDir(q)}),y(Q,D==="local"?"\u21E8":"\u21E6","\u4F20\u8F93\u5230"+(D==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+Z.path,()=>{U.reset(),U.pulse(0),_("\u4F20\u8F93 "+$.name+"\u2026",async()=>{let fe=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({direction:D==="local"?"up":"down",...e,localPath:D==="local"?q:x(Z.path,$.name),remotePath:D==="local"?x(Z.path,$.name):q})}),Te=await fe.json().catch(()=>({}));if(!fe.ok||Te.ok!==!0)throw U.fail("\u4F20\u8F93\u5931\u8D25"),new Error(String(Te.error||"HTTP "+fe.status));U.done("\u5B8C\u6210"),setTimeout(()=>U.reset(),1500),f("\u5DF2\u4F20\u8F93 "+$.name),await Z.loadDir(Z.path)})}),D!=="local"&&$.isDir!==!0&&y(Q,"\u2B07","\u4E0B\u8F7D "+$.name,()=>{E($,q)}),y(Q,"\u270E","\u91CD\u547D\u540D "+$.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=$.name,p(D),v=async()=>{let fe=d.value.trim();fe===""||fe===$.name||(C(),await T.runTask("\u91CD\u547D\u540D "+$.name+"\u2026",async()=>{await W("rename",{from:q,to:x(T.path,fe)}),await ie()}))}}),m(Q,()=>T.runTask("\u5220\u9664 "+$.name+"\u2026",async()=>{await W("remove",{path:q,recursive:$.isDir===!0}),await ie(),f("\u5DF2\u5220\u9664 "+$.name)}),$),Q},j=$=>{if(K.textContent="",T.path!==""&&T.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(T.path)===!1){let Y=w("\u{1F4C1}","..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","");Y.addEventListener("click",()=>{T.loadDir(Wo(T.path))}),K.appendChild(Y)}let q=Array.isArray($)?$:[];if(q.length===0){let Y=document.createElement("div");Y.className="tt_addMenuTitle",Y.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",K.appendChild(Y);return}for(let Y of q)Y===null||typeof Y!="object"||typeof Y.name!="string"||Y.name===""||K.appendChild(H(Y))};return T.loadDir=async $=>{try{let q=await W("list",{path:$??T.path});T.path=typeof q.path=="string"&&q.path!==""?q.path:T.path,k.value=T.path;let Y=Array.isArray(q.entries)?q.entries.length:0;j(q.entries),f(T.path+" \u2014 "+String(Y)+" \u9879")}catch(q){f(String(q&&q.message?q.message:q),"error")}},T.runTask=O,T.setBusy=G,b[D]=T,M.addEventListener("click",()=>{T.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>T.loadDir(T.path))}),F.addEventListener("click",()=>{T.busy||n||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",p(D),v=async()=>{let $=d.value.trim();$!==""&&(C(),await T.runTask("\u521B\u5EFA\u76EE\u5F55 "+$+"\u2026",async()=>{await W("mkdir",{path:x(T.path,$),parents:!0}),await T.loadDir(T.path)}))})}),k.addEventListener("keydown",$=>{if($.key!=="Enter"||($.preventDefault(),T.busy||n))return;let q=k.value.trim();q!==""&&T.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>T.loadDir(q))}),B},l=document.createElement("div");l.className="tt_sftpEditor",l.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let o=document.createElement("button");o.type="button",o.className="tt_toolBtn",o.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",l.appendChild(d),l.appendChild(o),l.appendChild(u);let v=null,C=()=>{l.style.display="none",d.value="",v=null};o.addEventListener("click",()=>{v?.()}),u.addEventListener("click",C),d.addEventListener("keydown",D=>{D.key==="Enter"?(D.preventDefault(),v?.()):D.key==="Escape"&&(D.stopPropagation(),C())});let w=(D,A,T)=>{let B=document.createElement("button");B.type="button",B.className="tt_sftpRow";let S=document.createElement("span");S.className="tt_sftpIcon",S.textContent=D;let L=document.createElement("span");if(L.className="tt_sftpName",L.textContent=A,L.title=A,B.appendChild(S),B.appendChild(L),T!==""){let k=document.createElement("span");k.className="tt_sftpMeta",k.textContent=T,B.appendChild(k)}return B},y=(D,A,T,B)=>{let S=document.createElement("button");S.type="button",S.className="tt_sftpAct",S.textContent=A,S.title=T,S.addEventListener("click",L=>{L.stopPropagation(),B()}),D.appendChild(S)},m=(D,A,T)=>{let B=document.createElement("button");B.type="button",B.className="tt_sftpAct",B.textContent="\u{1F5D1}",B.title="\u5220\u9664 "+T.name+(T.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let S=null;B.addEventListener("click",L=>{if(L.stopPropagation(),S!==null){clearTimeout(S),S=null,B.textContent="\u{1F5D1}",delete B.dataset.danger,A();return}B.textContent="\u786E\u8BA4?",B.dataset.danger="",S=setTimeout(()=>{S=null,B.textContent="\u{1F5D1}",delete B.dataset.danger},4e3)}),D.appendChild(B)},E=(D,A)=>b.remote.runTask("\u4E0B\u8F7D "+D.name+"\u2026",async()=>{U.reset();let T;try{T=await Uo("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:A})},(B,S)=>{U.set(B,S)},vt.maxDownloadMb)}catch(B){throw U.fail("\u4E0B\u8F7D\u5931\u8D25"),B}U.done("\u5B8C\u6210"),zo(T,D.name),setTimeout(()=>U.reset(),1500),f("\u5DF2\u4E0B\u8F7D "+D.name+"\uFF08"+(Xe(T.size)||String(T.size)+" B")+"\uFF09")}),P=g("local","\u672C\u673A"),I=g("remote","\u8FDC\u7A0B");b.local.wrap=P,b.remote.wrap=I;let N=document.createElement("div");N.className="tt_sftpDual",N.appendChild(P),N.appendChild(I),a.appendChild(N),a.appendChild(l);let R=document.createElement("div");R.className="tt_sftpFoot";let U=$o();R.appendChild(U.el),R.appendChild(h),a.appendChild(R),i.addEventListener("mousedown",D=>{D.target===i&&Mt()}),i.appendChild(a),document.body.appendChild(i),mt=i,b.local.loadDir(""),b.remote.loadDir("")}var mt=null;function Mc(e){let t=new TextEncoder().encode(e),i="";for(let a of t)i+=String.fromCharCode(a);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Xe(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],i=e,a=-1;do i/=1024,a+=1;while(i>=1024&&a<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[a]}function tr(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],i=e,a=-1;do i/=1024,a+=1;while(i>=1024&&a<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[a]+"/s"}function Ho(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let i=a=>String(a).padStart(2,"0");return t.getFullYear()+"-"+i(t.getMonth()+1)+"-"+i(t.getDate())+" "+i(t.getHours())+":"+i(t.getMinutes())}function Wo(e){let t=String(e).replace(/\/+$/,""),i=t.lastIndexOf("/");return i<=0?"/":t.slice(0,i)}function oi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function $o(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let i=document.createElement("div");i.className="tt_sftpFill",t.appendChild(i);let a=document.createElement("span");a.className="tt_sftpPct",a.textContent="",e.appendChild(t),e.appendChild(a);let c=_=>{a.textContent=_},s="",r=-1,h=_=>{_!==s&&(s=_,a.textContent=_)},f=_=>{let p=Math.round(_);p!==r&&(r=p,i.style.width=p+"%")};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,s="",r=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,i.style.width="0%",a.textContent=""},set(_,p){e.dataset.active="",delete e.dataset.state;let b=Date.now();if(this._last!==void 0&&b>this._lastAt){let g=(_-this._last)/((b-this._lastAt)/1e3);this._rate=this._rate===void 0?g:this._rate*.7+g*.3}if(this._last=_,this._lastAt=b,Number.isFinite(p)&&p>0){let g=Math.min(100,Math.max(0,_/p*100));f(g);let l=this._rate!==void 0&&this._rate>=0?tr(this._rate):"";h(Math.round(g)+"%"+(l!==""?" \xB7 "+l:""))}else{i.style.width="";let g=this._rate!==void 0&&this._rate>=0?tr(this._rate):"";h(Xe(_)+(g!==""?" \xB7 "+g:""))}},pulse(_){e.dataset.active="",delete e.dataset.state,i.style.width="45%",i.style.transition="none",setTimeout(()=>{i.style.transition="width .15s linear"},30);let p=Date.now();if(this._last!==void 0&&p>this._lastAt){let g=(_-this._last)/((p-this._lastAt)/1e3);this._rate=this._rate===void 0?g:this._rate*.7+g*.3}this._last=_,this._lastAt=p;let b=this._rate!==void 0&&this._rate>=0?tr(this._rate):"";h((Number.isFinite(_)?Xe(_):"\u2026")+(b!==""?" \xB7 "+b:""))},done(_){e.dataset.active="",e.dataset.state="done",i.style.width="100%",r=100,h(_!==void 0&&_!==""?_:"\u5B8C\u6210")},fail(_){e.dataset.active="",e.dataset.state="error",h(_!==void 0&&_!==""?_:"\u5931\u8D25")},text(_){delete e.dataset.state,_===void 0||_===""?(e.dataset.active="",s="",a.textContent=""):(e.dataset.active="",i.style.width="",r=-1,h(_))}}}async function Uo(e,t,i,a=0){let c=a>0?a*1024*1024:0,s=await fetch(e,t);if(!s.ok){let b="HTTP "+s.status;try{let g=await s.json();g!==null&&typeof g=="object"&&typeof g.error=="string"&&(b=g.error)}catch{}throw new Error(b)}let r=Number(s.headers.get("content-length")),h=Number.isFinite(r)&&r>0;if(c>0&&h&&r>c){try{await s.body?.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Xe(c)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}let f=s.body;if(f===null||typeof f.getReader!="function"){let b=await s.blob();if(c>0&&b.size>c)throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Xe(c)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync");return h&&i(r,r),b}let n=f.getReader(),_=[],p=0;for(;;){let{done:b,value:g}=await n.read();if(b)break;if(g!==void 0&&g.byteLength>0){if(p+=g.byteLength,c>0&&p>c){try{await n.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Xe(c)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}_.push(g),i(p,h?r:NaN)}}return new Blob(_,{type:"application/octet-stream"})}function zo(e,t){let i=URL.createObjectURL(e),a=document.createElement("a");a.href=i,a.download=t,a.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}async function Ac(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],i=[];for(let n of t){let _=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():null;_!==null&&i.push(_)}if(i.length===0)return[...e.files??[]].map(n=>({relPath:n.name,file:n}));let a=[],c=vt.maxUploadFiles,s=vt.maxUploadMb>0?vt.maxUploadMb*1024*1024:0,r=()=>c>0&&a.length>=c,h=0,f=(n,_)=>new Promise(p=>{if(r()){p();return}if(n.isFile===!0){n.file(l=>{s>0&&h+(l.size??0)>s?a._limitExceeded=!0:(a.push({relPath:_+n.name,file:l}),h+=l.size??0),p()},()=>p());return}if(n.isDirectory!==!0){p();return}let b=n.createReader(),g=()=>{b.readEntries(async l=>{if(l.length===0){p();return}for(let d of l){if(r())break;await f(d,_+n.name+"/")}if(r()){p();return}g()},()=>p())};g()});for(let n of i)await f(n,"");return a}function pr(e){if(mt!==null)return;let t=e!==null&&typeof e=="object"?e:{},i={};if(typeof t.name=="string"&&t.name!=="")i.name=t.name;else{for(let O of["host","username","auth","keyPath","passphrase","password"])typeof t[O]=="string"&&t[O]!==""&&(i[O]=t[O]);let W=Number(t.port);Number.isInteger(W)&&W>=1&&W<=65535&&(i.port=W),t.agentForward===!0&&(i.agentForward=!0)}let a=i.name??(i.username!==void 0?i.username+"@"+String(i.host??""):String(i.host??""));if(To==="dual"){Rc(i,a);return}let c=document.createElement("div");c.className="tt_sshBackdrop";let s=document.createElement("div");s.className="tt_sftpCard";let r=document.createElement("div");r.className="tt_sftpTitleRow";let h=document.createElement("div");h.className="tt_sshTitle",h.textContent="SFTP \u2014 "+a;let f=document.createElement("button");f.type="button",f.className="tt_close",f.title="\u5173\u95ED",f.textContent="\u2715",f.addEventListener("click",Mt),r.appendChild(h),r.appendChild(f),s.appendChild(r);let n=document.createElement("div");n.className="tt_sftpBar";let _=document.createElement("input");_.type="text",_.className="tt_sftpPath",_.placeholder="\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",_.spellcheck=!1,_.autocomplete="off";let p=document.createElement("button");p.type="button",p.className="tt_toolBtn",p.textContent="\u5237\u65B0";let b=document.createElement("button");b.type="button",b.className="tt_toolBtn",b.textContent="\u65B0\u5EFA\u76EE\u5F55";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.textContent="\u4E0A\u4F20",g.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let l=document.createElement("input");l.type="file",l.multiple=!0,l.style.display="none",n.appendChild(_),n.appendChild(p),n.appendChild(b),n.appendChild(g),s.appendChild(n),s.appendChild(l);let d=document.createElement("div");d.className="tt_sftpEditor",d.style.display="none";let o=document.createElement("input");o.type="text",o.className="tt_cardInput",o.spellcheck=!1,o.autocomplete="off";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u786E\u5B9A";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent="\u53D6\u6D88",d.appendChild(o),d.appendChild(u),d.appendChild(v),s.appendChild(d);let C=null,w=()=>{d.style.display="none",C=null};u.addEventListener("click",()=>{C?.()}),v.addEventListener("click",w),o.addEventListener("keydown",W=>{W.key==="Enter"?(W.preventDefault(),C?.()):W.key==="Escape"&&(W.stopPropagation(),w())});let y=document.createElement("div");y.className="tt_sftpList",s.appendChild(y);let m=document.createElement("div");m.className="tt_sftpFoot";let E=document.createElement("div");E.className="tt_sftpStatus";let P=$o();m.appendChild(P.el),m.appendChild(E),s.appendChild(m);let I={path:"",busy:!1},N=(W,O)=>{E.textContent=W,O===void 0?delete E.dataset.state:E.dataset.state=O},R=W=>{I.busy=W;for(let O of[p,b,g])O.disabled=W;_.disabled=W},U=async(W,O)=>{let x=await fetch("/api/dsh-tty/sftp/"+W,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,...O})}),H=await x.json().catch(()=>({}));if(!x.ok||H.ok!==!0)throw new Error(String(H.error||"HTTP "+x.status));return H},D=async(W,O)=>{if(!I.busy){R(!0),N(W,"busy");try{await O()}catch(x){N(String(x&&x.message?x.message:x),"error")}finally{R(!1)}}},A=(W,O,x)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let j=document.createElement("span");j.className="tt_sftpIcon",j.textContent=W;let $=document.createElement("span");if($.className="tt_sftpName",$.textContent=O,$.title=O,H.appendChild(j),H.appendChild($),x!==""){let q=document.createElement("span");q.className="tt_sftpMeta",q.textContent=x,H.appendChild(q)}return H},T=(W,O,x,H)=>{let j=document.createElement("button");j.type="button",j.className="tt_sftpAct",j.textContent=O,j.title=x,j.addEventListener("click",$=>{$.stopPropagation(),H()}),W.appendChild(j)},B=(W,O,x)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.textContent="\u{1F5D1}",H.title="\u5220\u9664 "+O.name+(O.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let j=null;H.addEventListener("click",$=>{if($.stopPropagation(),!I.busy){if(j!==null){clearTimeout(j),j=null,H.textContent="\u{1F5D1}",delete H.dataset.danger,D("\u5220\u9664 "+O.name+"\u2026",async()=>{await U("remove",{path:x,recursive:O.isDir===!0}),await L(I.path),N("\u5DF2\u5220\u9664 "+O.name)});return}H.textContent="\u786E\u8BA4?",H.dataset.danger="",j=setTimeout(()=>{j=null,H.textContent="\u{1F5D1}",delete H.dataset.danger},4e3)}}),W.appendChild(H)},S=W=>{if(y.textContent="",I.path!==""&&I.path!=="/"){let x=A("\u{1F4C1}","..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","");x.addEventListener("click",()=>{D("\u52A0\u8F7D\u4E2D\u2026",()=>L(Wo(I.path)))}),y.appendChild(x)}let O=Array.isArray(W)?W:[];if(O.length===0){let x=document.createElement("div");x.className="tt_addMenuTitle",x.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",y.appendChild(x);return}for(let x of O){if(x===null||typeof x!="object"||typeof x.name!="string"||x.name==="")continue;let H=oi(I.path,x.name),j=[];x.isDir===!0?j.push("\u76EE\u5F55"):j.push(Xe(Number(x.size))||"\u2014");let $=Ho(Number(x.mtime));$!==""&&j.push($);let q=A(x.isDir?"\u{1F4C1}":x.isSymlink?"\u2197":"\u{1F4C4}",x.name,j.join(" \xB7 "));x.isDir===!0?q.addEventListener("click",Y=>{Y.target instanceof Element&&Y.target.closest(".tt_sftpAct")!==null||D("\u52A0\u8F7D\u4E2D\u2026",()=>L(H))}):(q.addEventListener("click",Y=>{Y.target instanceof Element&&Y.target.closest(".tt_sftpAct")!==null||k(x,H)}),T(q,"\u2B07","\u4E0B\u8F7D "+x.name,()=>{k(x,H)})),T(q,"\u270E","\u91CD\u547D\u540D "+x.name,()=>{o.placeholder="\u65B0\u540D\u79F0",o.value=x.name,d.style.display="",o.focus(),o.select(),C=async()=>{let Y=o.value.trim();Y===""||Y===x.name||(w(),await D("\u91CD\u547D\u540D "+x.name+"\u2026",async()=>{await U("rename",{from:H,to:oi(I.path,Y)}),await L(I.path)}))}}),B(q,x,H),y.appendChild(q)}},L=async W=>{try{let O=await U("list",{path:W??I.path});I.path=typeof O.path=="string"&&O.path!==""?O.path:"/",_.value=I.path;let x=Array.isArray(O.entries)?O.entries.length:0;S(O.entries),N(I.path+" \u2014 "+String(x)+" \u9879")}catch(O){N(String(O&&O.message?O.message:O),"error")}},k=(W,O)=>D("\u4E0B\u8F7D "+W.name+"\u2026",async()=>{P.reset();let x;try{x=await Uo("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,path:O})},(H,j)=>{P.set(H,j)},vt.maxDownloadMb)}catch(H){throw P.fail("\u4E0B\u8F7D\u5931\u8D25"),H}P.done("\u5B8C\u6210"),zo(x,W.name),setTimeout(()=>P.reset(),1500),N("\u5DF2\u4E0B\u8F7D "+W.name+"\uFF08"+(Xe(x.size)||String(x.size)+" B")+"\uFF09")}),M=(W,O,x,H)=>new Promise((j,$)=>{let q=Mc(JSON.stringify({...i,path:oi(I.path,O)})),Y=new XMLHttpRequest;Y.open("POST","/api/dsh-tty/sftp/upload"),Y.setRequestHeader("x-dsh-sftp-meta",q);let te=H>1?String(x)+"/"+String(H)+" ":"";N("\u4E0A\u4F20 "+te+O,"busy"),Y.upload.addEventListener("progress",Q=>{Q.lengthComputable?P.set(Q.loaded,Q.total):P.pulse(0)}),Y.addEventListener("load",()=>{if(Y.status===200){H===1&&P.done("\u4E0A\u4F20\u5B8C\u6210"),j();return}P.fail("\u4E0A\u4F20\u5931\u8D25");let Q="HTTP "+Y.status;try{let ie=JSON.parse(Y.responseText);ie!==null&&typeof ie=="object"&&typeof ie.error=="string"&&(Q=ie.error)}catch{}$(new Error(Q))}),Y.addEventListener("error",()=>{P.fail("\u4E0A\u4F20\u5931\u8D25"),$(new Error("\u7F51\u7EDC\u9519\u8BEF"))}),Y.send(W)}),F=async W=>D("\u4E0A\u4F20\u4E2D\u2026",async()=>{let O=vt;if(O.maxUploadFiles>0&&W.length>O.maxUploadFiles){N("\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08"+String(O.maxUploadFiles)+"\uFF09\uFF1A\u672C\u6B21 "+String(W.length)+" \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","error"),P.fail("\u8D85\u9650");return}let x=O.maxUploadMb>0?O.maxUploadMb*1024*1024:0,H=W.find(q=>x>0&&(q.file?.size??0)>x);if(H!==void 0){N("\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08"+Xe(x)+"\uFF09\uFF1A"+String(H.relPath??"")+"\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error"),P.fail("\u8D85\u9650");return}if(W._limitExceeded===!0){N("\u6587\u4EF6\u603B\u5927\u5C0F\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF1A\u8BF7\u5206\u6279\u4E0A\u4F20\uFF08\u6216\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\uFF09","error"),P.fail("\u8D85\u9650");return}let j=new Set;for(let q of W){let Y=q.relPath.lastIndexOf("/");if(Y<=0)continue;let te=q.relPath.slice(0,Y);j.has(te)||(j.add(te),await U("mkdir",{path:oi(I.path,te),parents:!0}).catch(()=>{}))}P.reset();let $=0;for(let q of W)$+=1,await M(q.file,q.relPath,$,W.length);P.done("\u5168\u90E8\u5B8C\u6210"),setTimeout(()=>P.reset(),1500),N("\u4E0A\u4F20\u5B8C\u6210 "+String(W.length)+" \u4E2A\u6587\u4EF6"),await L(I.path)});p.addEventListener("click",()=>{D("\u52A0\u8F7D\u4E2D\u2026",()=>L(I.path))}),b.addEventListener("click",()=>{I.busy||(o.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",o.value="",d.style.display="",o.focus(),C=async()=>{let W=o.value.trim();W!==""&&(w(),await D("\u521B\u5EFA\u76EE\u5F55 "+W+"\u2026",async()=>{await U("mkdir",{path:oi(I.path,W)}),await L(I.path)}))})}),g.addEventListener("click",()=>{I.busy===!1&&l.click()}),l.addEventListener("change",()=>{let W=[...l.files??[]].map(O=>({relPath:O.name,file:O}));l.value="",W.length>0&&F(W)});let K=0,G=W=>{W?y.dataset.drag="":delete y.dataset.drag};s.addEventListener("dragenter",W=>{W.preventDefault(),K+=1,G(!0)}),s.addEventListener("dragover",W=>{W.preventDefault()}),s.addEventListener("dragleave",()=>{K=Math.max(0,K-1),K===0&&G(!1)}),s.addEventListener("drop",W=>{W.preventDefault(),K=0,G(!1),!I.busy&&Ac(W.dataTransfer).then(O=>{(O.length>0||O._limitExceeded===!0)&&F(O)})}),_.addEventListener("keydown",W=>{if(W.key!=="Enter"||(W.preventDefault(),I.busy))return;let O=_.value.trim();O!==""&&D("\u52A0\u8F7D\u4E2D\u2026",()=>L(O))}),c.addEventListener("mousedown",W=>{W.target===c&&Mt()}),c.appendChild(s),document.body.appendChild(c),mt=c,D("\u8FDE\u63A5\u4E2D\u2026",()=>L(""))}function Mt(){mt!==null&&(mt.remove(),mt=null)}function jo(){if(ke===null)return;let e=ke.style.display==="none"||ke.style.display==="";ke.style.display=e?"":"none",e&&ke.focus()}var Dc={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function Tc(e){let t=pt();if(t===void 0||t.search===void 0)return;let i=ke.value;if(i==="")return;let a={decorations:Dc};e?t.search.findPrevious(i,a):t.search.findNext(i,a)}function xo(){Xi||se===null||yt!==null||(yt=setTimeout(()=>{yt=null,ar()},di),di=Math.min(di*2,5e3))}function Kt(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Bc(){return xt==="tmux"?{t:"spawn",cwd:bo(),persist:!0,persistName:fr()}:{t:"spawn",cwd:bo()}}async function Pc(){await No();let e=vc(),t=gc();if(re.size===0){if(e.length>0||t.length>0){De({t:"sessions"});let r=await sr("sessions",4e3),h=new Map;if(r!==null&&Array.isArray(r.list))for(let n of r.list)n!==null&&typeof n=="object"&&n.attachable===!0&&h.set(n.sid,n);let f=new Set;for(let n of e){if(h.has(n.sid))mc(n);else if(Kt(n.spawnSpec))So(n);else continue;Kt(n.spawnSpec)&&f.add(n.spawnSpec.persistName)}for(let n of t){let _=n.spawnSpec.persistName;f.has(_)||(So(n),f.add(_))}Rt()}if(re.size===0){if(await ts())return;es()}return}let i=[...re.values()].filter(r=>!r.exited),a=i.filter(r=>Kt(r.spawnSpec)),c=null;if(a.length>0){De({t:"sessions"});let r=await sr("sessions",4e3),h=new Set((r!==null&&Array.isArray(r.list)?r.list:[]).map(f=>f?.sid).filter(f=>typeof f=="string"));c=a.filter(f=>!h.has(f.sid));for(let f of c)ur(f.sid)}let s=c!==null?new Set(c.map(r=>r.sid)):new Set;for(let r of i)s.has(r.sid)||De({t:"attach",sid:r.sid})}function ar(){if(Ce!==null){try{Ce.close()}catch{}Ce=null}Xi=!1,clearTimeout(yt),yt=null,ji=!0,St("\u8FDE\u63A5\u4E2D\u2026","");try{Ce=new WebSocket(oc())}catch(e){ji=!1,St("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),xo();return}Ce.onopen=()=>{ji=!1,di=1e3,St("\u5DF2\u8FDE\u63A5","connected"),Pc()},Ce.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let i=t.sid;if(t.t==="ready"){let a=typeof t.target=="string"?t.target:"";St(t.kind==="ssh"?"SSH "+(a!==""?a+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let c=re.get(i);if(c!==void 0){if(c.exited=!1,c.spawned=!0,c.live=!0,c.errored=!1,c.target=a,c.persistTmux=t.persist===!0,t.kind==="ssh"&&a!==""&&!c.label&&(c.label=a,Je()),ui(),ai(c,""),ss(c),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(r=>setTimeout(r,500))]).then(()=>Ao(150))}fi(),Rt()}}else if(t.t==="data"){let a=re.get(i);a!==void 0&&a.term!==null&&(a.term.write(String(t.d??"")),Fc())}else if(t.t==="exit"){let a=re.get(i);if(a!==void 0){a.exited=!0,a.live=!1;let c=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";St("\u5DF2\u9000\u51FA "+[c,s].filter(Boolean).join(" "),""),ui(),ai(a,"\u4F1A\u8BDD\u5DF2\u9000\u51FA \u2014 \u70B9\u51FB\u91CD\u65B0\u6253\u5F00"),fi(),Rt()}}else if(t.t==="error")if(St("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof i=="string"){let a=re.get(i);a!==void 0&&(a.live||(a.errored=!0),ui(),ai(a,"\u9519\u8BEF\uFF1A"+String(t.m??"")+" \u2014 \u70B9\u51FB\u91CD\u8BD5"))}else Oc("\u70B9\u51FB\u91CD\u8BD5")},Ce.onclose=()=>{if(ji=!1,!Xi){St("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of re.values())e.exited||ai(e,"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026");xo()}},Ce.onerror=()=>{}}function Oc(e){zt!==null&&(zt.textContent=e)}function Ic(){if(se!==null){at&&qo();return}Ro(),se=document.createElement("div"),se.className="tt_modalBackdrop",se.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+cr+'</span><div class="tt_tabs"></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 tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+ac+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+lc+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+hc+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+cc+'</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\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button></div><div class="tt_connbar" data-hidden><div class="tt_connArea"><span class="tt_connDot"></span><span class="tt_connTarget">\u2014</span></div><div class="tt_connActions"></div></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(se),Gi=se.querySelector(".tt_status"),Gt=se.querySelector(".tt_statusText"),Et=se.querySelector(".tt_statusDot"),$t=se.querySelector(".tt_tabs"),li=se.querySelector(".tt_connbar"),Vi=se.querySelector(".tt_connDot"),Yi=se.querySelector(".tt_connTarget"),hi=se.querySelector(".tt_connActions"),Ut=se.querySelector(".tt_body"),zt=se.querySelector(".tt_body > .tt_overlay"),ke=se.querySelector(".tt_searchInput"),zt.addEventListener("click",()=>{zt.textContent="",ar()}),se.querySelector("[data-act=search]").addEventListener("click",()=>{jo(),ke.style.display!=="none"&&ke.focus()}),ke.addEventListener("keydown",e=>{e.key==="Enter"?(e.preventDefault(),Tc(e.shiftKey)):e.key==="Escape"&&(e.stopPropagation(),ke.style.display="none")}),se.querySelector("[data-act=clear]").addEventListener("click",()=>{let e=pt();e!==void 0&&e.term!==null&&e.term.clear()}),se.querySelector("[data-act=copy]").addEventListener("click",()=>{let e=pt();if(e===void 0||e.term===null)return;let t=e.term.getSelection();t!==""&&navigator.clipboard.writeText(t).catch(()=>{})}),se.querySelector("[data-act=paste]").addEventListener("click",()=>{let e=pt();e!==void 0&&navigator.clipboard.readText().then(t=>{De({t:"input",sid:e.sid,d:t})}).catch(()=>{})}),se.querySelector(".tt_min").addEventListener("click",()=>{lr()}),se.querySelector(".tt_close").addEventListener("click",()=>{ns()}),se.addEventListener("mousedown",e=>{e.target===se&&lr()}),document.addEventListener("keydown",Ko),ci=new ResizeObserver(()=>{if(at)return;let e=pt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{return}e.exited||ss(e)}}),ci.observe(Ut),Je(),ui(),ar()}function Nc(){Ee=document.createElement("div"),Ee.className="tt_dock",Ee.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",Ee.innerHTML='<span class="tt_dockTitle">'+cr+'<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\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button>',Ji=Ee.querySelector(".tt_dockCount"),Vt=Ee.querySelector(".tt_dockStatus"),Lt=Ee.querySelector(".tt_dockDot");let e=[...re.values()].filter(t=>!t.exited).length;Ji.textContent=re.size>0?"\xB7 "+e+"/"+re.size:"",Gt!==null&&(Vt.textContent=Gt.textContent),Et!==null&&(Lt.dataset.state=Et.dataset.state??""),Ee.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),ns();return}qo()}),document.body.appendChild(Ee)}function lr(){se===null||at||(Ye(),ft(),Mt(),at=!0,ke!==null&&(ke.style.display="none"),se.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?fi():(Nc(),Ee.classList.add("tt_dockCompact")))}function fi(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!at){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 i=[...re.values()].filter(c=>!c.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=i+"/"+re.size;let a=t.querySelector(".tt_sidebarBadgeDot");a!==null&&Et!==null&&(a.dataset.state=Et.dataset.state??"")}function Fc(){if(!at)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Lt;e!==null&&(e.dataset.active="",clearTimeout(Zi),Zi=setTimeout(()=>{delete e.dataset.active},900))}function qo(){if(se===null||!at)return;at=!1,delete se.dataset.minimized,clearTimeout(Zi),Ee!==null&&(Ee.remove(),Ee=null),Ji=null,Vt=null,Lt=null,fi();let e=pt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&ss(e)}e!==void 0&&e.term!==null&&e.term.focus()}function ns(){if(se!==null){if(Xi=!0,at=!1,Ye(),ft(),Mt(),clearTimeout(Zi),clearTimeout(yt),yt=null,di=1e3,Ee!==null&&(Ee.remove(),Ee=null),Ji=null,Vt=null,Lt=null,fi(),Ce!==null){for(let e of re.values())e.exited||De({t:"kill",sid:e.sid});try{Ce.close()}catch{}Ce=null}ci!==null&&(ci.disconnect(),ci=null);for(let e of re.values())if(e.term!==null)try{e.term.dispose()}catch{}re.clear(),kt=null,document.removeEventListener("keydown",Ko),se.remove(),se=null,Gi=null,Gt=null,Et=null,$t=null,li=null,Vi=null,Yi=null,hi=null,rr(),Ut=null,zt=null,ke=null,is=0;try{sessionStorage.removeItem(Qi)}catch{}}}function Ko(e){if(e.key==="Escape"&&se!==null){if(e.preventDefault(),mt!==null){Mt();return}if(jt!==null){ft();return}if(Fe!==null){Ye();return}lr()}}function Hc(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function Wc(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let i of e.children)if(i.tagName==="BUTTON")return i}function $c(){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">'+cr+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),Ic()}),e}function Eo(e,t){let i=Wc(e);if(i===void 0)return!1;if(t.parentElement!==e){let a=i.closest('[class*="logoRow"]'),c=a!==null&&a.parentElement===e?a:i,s=Array.from(e.children).filter(r=>r instanceof HTMLElement&&r.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(s.length>0){let r=s[s.length-1];e.insertBefore(t,r.nextSibling)}else e.insertBefore(t,c.nextElementSibling)}return!0}function Uc(){if(Ro(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=$c(),t,i=!1,a=()=>{if(t!==void 0&&!t.isConnected&&(s.disconnect(),t=void 0,i=!1),i){if(document.body.contains(e))return;s.disconnect(),t=void 0,i=!1}t??(t=Hc()),t!==void 0&&(i=Eo(t,e),i&&s.observe(t,{childList:!0,subtree:!0}))},c=new MutationObserver(()=>{a()});c.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){i=!1,a();return}t.contains(e)||(i=Eo(t,e))});return a(),()=>{c.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},i=e("react"),{jsx:a,jsxs:c}=e("react/jsx-runtime"),s="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 r(){let[h,f]=i.useState(!1),[n,_]=i.useState(null),[p,b]=i.useState(!1),[g,l]=i.useState(!1),[d,o]=i.useState({kind:"",text:""}),[u,v]=i.useState([]),[C,w]=i.useState(!1),y=async()=>{try{let V=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();V.ok&&typeof V.config=="object"&&V.config!==null?(_(V.config),_i(V.config)):o({kind:"error",text:String(V.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(z){o({kind:"error",text:String(z&&z.message?z.message:z)})}},m=async()=>{try{let V=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();V.ok&&Array.isArray(V.shells)&&v(V.shells)}catch{}};i.useEffect(()=>{h&&!p&&(b(!0),y(),m())},[h]);let E=(z,V)=>_(X=>({...X||{},[z]:V})),P=(z,V)=>_(X=>({...X||{},sftpLimits:{...X?.sftpLimits??{},[z]:V}})),[I,N]=i.useState(null),[R,U]=i.useState(null),[D,A]=i.useState(""),[T,B]=i.useState({}),[S,L]=i.useState([]),[k,M]=i.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});i.useEffect(()=>{if(!h)return;let z=!0,V=async()=>{try{let ne=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();z&&ne.ok&&Array.isArray(ne.tunnels)&&L(ne.tunnels)}catch{}};V();let X=setInterval(V,2e3);return()=>{z=!1,clearInterval(X)}},[h]);let F=z=>V=>M(X=>({...X||{},[z]:V.target.value})),K=z=>z?.direction==="remote"?`\u8FDC\u7A0B:${z.remoteHost||"127.0.0.1"}:${String(z.remotePort??0)} \u2192 \u672C\u673A:${String(z.localTargetPort??0)}`:`\u672C\u673A:${String(z?.localPort??0)} \u2192 ${z?.remoteHost??"?"}:${String(z?.remotePort??0)}`,G=(n?.sshHosts??[]).find(z=>z?.name===k?.bookName),W=async z=>{try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:z})}),X=await V.json().catch(()=>({}));return!V.ok||!X.ok?(o({kind:"error",text:String(X.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(V){return o({kind:"error",text:String(V&&V.message?V.message:V)}),!1}},O=()=>{o({kind:"",text:""});let z=k||{},V=z.bookName||(Array.isArray(n?.sshHosts)?n.sshHosts[0]?.name:"")||"";if(V===""){o({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let X=he=>{let $e=Number(he);return Number.isInteger($e)&&$e>=1&&$e<=65535?$e:0},J;if(z.direction==="remote"){if(J={name:"",bookName:V,direction:"remote",remotePort:X(z.remotePort),localTargetHost:"",localTargetPort:X(z.localTargetPort),enabled:!0},J.remotePort<1||J.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}J.name=`${V}-R${String(J.remotePort)}`}else{if(J={name:"",bookName:V,direction:"local",localPort:X(z.localPort),remoteHost:z.remoteHost.trim(),remotePort:X(z.remotePort),enabled:!0},J.localPort<1||J.remoteHost===""||J.remotePort<1){o({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}J.name=`${V}-L${String(J.localPort)}`}let ne=new Set((Array.isArray(n?.tunnels)?n.tunnels:[]).map(he=>he?.name)),de=J.name,ae=2;for(;ne.has(de);)de=`${J.name}-${String(ae)}`,ae+=1;J.name=de;let ee=[...Array.isArray(n?.tunnels)?n.tunnels:[],J];_(he=>({...he||{},tunnels:ee})),M(he=>({...he||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),W(ee).then(he=>{he&&o({kind:"ok",text:`\u96A7\u9053\u300C${de}\u300D\u5DF2\u751F\u6548`})})},x=z=>{let V=(Array.isArray(n?.tunnels)?n.tunnels:[]).filter(X=>X?.name!==z);_(X=>({...X||{},tunnels:V})),W(V)},H=(z,V)=>{let X=(Array.isArray(n?.tunnels)?n.tunnels:[]).map(J=>J?.name===z?{...J,enabled:V}:J);_(J=>({...J||{},tunnels:X})),W(X)},j=z=>{N(z?.name??null),A(""),U({name:z?.name??"",host:z?.host??"",port:String(z?.port??22),username:z?.username??"",auth:z?.auth==="key"||z?.auth==="password"?z.auth:"agent",keyPath:z?.keyPath??"",passphrase:z?.passphrase??"",password:z?.password??"",agentForward:z?.agentForward===!0})},$=()=>{N(null),U(null),A("")},q=()=>{if(R===null)return;let z=R.name.trim(),V=R.host.trim(),X=R.username.trim();if(z===""||V===""||X===""){A("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let J=Number(R.port);if((!Number.isInteger(J)||J<1||J>65535)&&(J=22),(n?.sshHosts??[]).some(ne=>ne?.name===z&&z!==I)){A("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+z);return}if(R.auth==="key"&&R.keyPath.trim()===""){A("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}_(ne=>({...ne||{},sshHosts:(Array.isArray(ne?.sshHosts)?ne.sshHosts:[]).map(de=>de?.name===I?{name:z,host:V,port:J,username:X,auth:R.auth,keyPath:R.keyPath.trim(),passphrase:R.passphrase,password:R.password,agentForward:R.agentForward}:de)})),N(null),U(null),A(""),o({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+z+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},Y=z=>{I===z&&$(),B(V=>{let X={...V};return delete X[z],X}),_(V=>({...V||{},sshHosts:(Array.isArray(V?.sshHosts)?V.sshHosts:[]).filter(X=>X?.name!==z)}))},te=async z=>{let V=z?.name??"";if(V==="")return;let X={host:z?.host??"",port:Number(z?.port)||22,username:z?.username??"",auth:z?.auth==="key"||z?.auth==="password"?z.auth:"agent",keyPath:z?.keyPath??"",passphrase:z?.passphrase??"",password:z?.password??"",agentForward:z?.agentForward===!0};B(ne=>({...ne,[V]:{running:!0,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}}));let J=await Oo(X,!0);B(ne=>{let de=ne[V]||{};if(J.result){let ae=J.result.auth?.ok===!0;return{...ne,[V]:{running:!1,ok:ae,text:Io(J.result)}}}return{...ne,[V]:{running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(J.error||"\u672A\u77E5\u9519\u8BEF")}}})},Q=async z=>{let V=(Array.isArray(n?.hostKeys)?n.hostKeys:[]).filter(X=>!(X?.host===z?.host&&Number(X?.port)===Number(z?.port)));_(X=>({...X||{},hostKeys:V}));try{let X=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:V})}),J=await X.json().catch(()=>({}));!X.ok||!J.ok?o({kind:"error",text:String(J.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(X){o({kind:"error",text:String(X&&X.message?X.message:X)})}},ie=async()=>{o({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!V.ok){o({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],J=[...Array.isArray(n?.sshHosts)?n.sshHosts:[]],ne=new Set(J.map(ee=>ee?.name)),de=0,ae=0;for(let ee of X)if(!(ee===null||typeof ee!="object"||typeof ee.name!="string")){if(ne.has(ee.name)){ae+=1;continue}ne.add(ee.name),J.push({name:ee.name,host:String(ee.host??ee.name),port:Number(ee.port)||22,username:String(ee.username??""),auth:ee.auth==="key"?"key":"agent",keyPath:String(ee.keyPath??""),passphrase:"",password:"",agentForward:!1}),de+=1}_(ee=>({...ee||{},sshHosts:J})),o(de===0?{kind:"ok",text:ae>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${ae} \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 ${de} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${ae} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch(z){o({kind:"error",text:String(z&&z.message?z.message:z)})}},Z=async()=>{o({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!V.ok){o({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],J=[...Array.isArray(n?.hostKeys)?n.hostKeys:[]],ne=new Set(J.map(ee=>String(ee?.host??"")+":"+String(ee?.port??22))),de=0,ae=0;for(let ee of X){if(ee===null||typeof ee!="object"||typeof ee.host!="string"||typeof ee.fingerprint!="string")continue;let he=ee.host+":"+String(ee.port??22);if(ne.has(he)){ae+=1;continue}ne.add(he),J.push({host:ee.host,port:Number(ee.port)||22,fingerprint:ee.fingerprint}),de+=1}if(de===0){o({kind:"ok",text:ae>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${ae} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}_(ee=>({...ee||{},hostKeys:J}));try{let ee=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:J})}),he=await ee.json().catch(()=>({}));if(!ee.ok||!he.ok){o({kind:"error",text:String(he.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}o({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${de} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${ae} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(ee){o({kind:"error",text:String(ee&&ee.message?ee.message:ee)})}}catch(z){o({kind:"error",text:String(z&&z.message?z.message:z)})}},fe=async()=>{l(!0),o({kind:"",text:""});let z={};for(let V of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose"]){let X=(n||{})[V];X!==void 0&&X!==""&&(z[V]=X)}z.sshHosts=Array.isArray(n?.sshHosts)?n.sshHosts:[],z.tunnels=Array.isArray(n?.tunnels)?n.tunnels:[],n?.sftpLimits&&typeof n.sftpLimits=="object"&&(z.sftpLimits={maxDownloadMb:Number(n.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(n.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(n.sftpLimits.maxUploadFiles)||0});try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(z)}),X=await V.json();!V.ok||!X.ok?o({kind:"error",text:String(X.error||"\u4FDD\u5B58\u5931\u8D25")}):(o({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),X.config&&(_(X.config),_i(X.config)))}catch(V){o({kind:"error",text:String(V&&V.message?V.message:V)})}l(!1)},Te=()=>{if(R===null)return null;let z=(V,X,J,ne)=>c("label",{className:"tt_sshRow",children:[a("span",{className:"tt_cardLabel",children:V}),a("input",{className:"tt_cardInput",type:ne??"text",value:R[X]??"",placeholder:J??"",autoComplete:"off",spellCheck:!1,onChange:de=>U(ae=>({...ae||{},[X]:de.target.value}))})]});return c("div",{className:"tt_sshEdit",children:[c("div",{className:"tt_sshGrid",children:[z("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),z("\u7AEF\u53E3","port","22")]}),z("\u4E3B\u673A","host","example.com \u6216 IP"),z("\u7528\u6237\u540D","username","root"),c("label",{className:"tt_sshRow",children:[a("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),c("select",{className:"tt_cardInput",value:R.auth,onChange:V=>U(X=>({...X||{},auth:V.target.value})),children:[a("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),a("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),a("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...R.auth==="key"?[z("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),z("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...R.auth==="password"?[z("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],c("label",{className:"tt_cardRow",children:[a("input",{type:"checkbox",className:"tt_cardCheckbox",checked:R.agentForward===!0,onChange:V=>U(X=>({...X||{},agentForward:V.target.checked}))}),a("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),D!==""?a("span",{className:"tt_cardMessage tt_cardMessageError",children:D}):null,c("div",{className:"tt_cardRow",children:[a("button",{type:"button",className:"tt_cardSave",onClick:q,children:"\u5E94\u7528"}),a("button",{type:"button",className:"tt_toolBtn",onClick:$,children:"\u53D6\u6D88"})]})]})},Be=(z,V,X,J)=>c("label",{className:"tt_cardField",children:[a("span",{className:"tt_cardLabel",children:z}),a("input",{className:"tt_cardInput",value:n[V]??"",placeholder:X??"",onChange:ne=>E(V,ne.target.value)}),J?a("span",{className:"tt_cardHint",children:J}):null]}),He=(z,V)=>c("label",{className:"tt_cardField tt_cardRow",children:[a("input",{type:"checkbox",className:"tt_cardCheckbox",checked:n[V]===!0,onChange:X=>E(V,X.target.checked)}),a("span",{className:"tt_cardLabel",children:z})]});return c("li",{className:h?"tt_card tt_cardOpen":"tt_card",children:[c("button",{type:"button",className:"tt_cardHeader","aria-expanded":h,onClick:()=>f(z=>!z),children:[c("span",{className:"tt_cardHeadText",children:[a("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),a("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\u3001tmux \u4F1A\u8BDD\u6301\u4E45\u5316\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),a("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:a("path",{d:s,fill:"currentColor"})})]}),h?c("div",{className:"tt_cardBody",children:[n===null?a("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):c("div",{children:[He("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),He("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),He("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),c("div",{className:"tt_cardField",children:[a("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),c("select",{className:"tt_cardInput",value:n.sftpStyle==="dual"?"dual":"dialog",onChange:z=>E("sftpStyle",z.target.value),children:[a("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),a("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),a("span",{className:"tt_cardHint",children:"\u53CC\u680F\u5728\u672C\u673A\u4E0E\u8FDC\u7A0B\u4E4B\u95F4\u5BF9\u62F7\u6587\u4EF6\uFF08\u76EE\u5F55\u9012\u5F52\u3001\u540C\u540D\u8986\u76D6\uFF09\uFF1B\u91CD\u65B0\u6253\u5F00 SFTP \u540E\u751F\u6548"})]}),c("div",{className:"tt_cardField",children:[a("span",{className:"tt_cardLabel",children:"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09"}),c("div",{className:"tt_sshGrid",children:[c("label",{className:"tt_sshRow",children:[a("span",{className:"tt_cardLabel",children:"\u4E0B\u8F7D\u4E0A\u9650 (MB)"}),a("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxDownloadMb))?Number(n.sftpLimits.maxDownloadMb):1024),onChange:z=>P("maxDownloadMb",Number(z.target.value)||0)})]}),c("label",{className:"tt_sshRow",children:[a("span",{className:"tt_cardLabel",children:"\u4E0A\u4F20\u4E0A\u9650 (MB)"}),a("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadMb))?Number(n.sftpLimits.maxUploadMb):2048),onChange:z=>P("maxUploadMb",Number(z.target.value)||0)})]}),c("label",{className:"tt_sshRow",children:[a("span",{className:"tt_cardLabel",children:"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650"}),a("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadFiles))?Number(n.sftpLimits.maxUploadFiles):1e3),onChange:z=>P("maxUploadFiles",Number(z.target.value)||0)})]})]}),a("span",{className:"tt_cardHint",children:"\u6D4F\u89C8\u5668\u4FA7\u4FDD\u62A4\uFF1A\u5355\u4E2A\u6587\u4EF6\u8D85\u8FC7\u4E0A\u9650\u65F6\u4E2D\u6B62\u4E0B\u8F7D/\u4E0A\u4F20\uFF08\u5927\u6587\u4EF6\u8BF7\u7528\u53CC\u680F \u21E8/\u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync\uFF0C\u4E0D\u5360\u6D4F\u89C8\u5668\u5185\u5B58\uFF09\uFF1B\u6587\u4EF6\u6570\u4E0A\u9650\u9488\u5BF9\u4E00\u6B21\u6279\u91CF/\u62D6\u62FD\u4E0A\u4F20\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"})]}),c("div",{className:"tt_cardField",children:[a("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),c("select",{className:"tt_cardInput",value:n.persistence==="tmux"?"tmux":"off",onChange:z=>E("persistence",z.target.value),children:[a("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),a("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),a("span",{className:"tt_cardHint",children:"\u5F00\u542F\u540E\u6240\u6709\u65B0\u6807\u7B7E\uFF08\u672C\u5730/SSH \u8FDE\u63A5\u7C3F/SSH \u8FDE\u63A5\u5BF9\u8BDD\u6846\uFF09\u9ED8\u8BA4\u7531 tmux \u6258\u7BA1\u3001\u53EF\u8DE8\u5BBF\u4E3B\u91CD\u542F\u6062\u590D\uFF1B\u9700\u672C\u673A/\u8FDC\u7A0B\u5B89\u88C5 tmux\uFF1BSSH \u5BF9\u8BDD\u6846\u53EF\u5BF9\u5355\u6B21\u8FDE\u63A5\u53D6\u6D88\u52FE\u9009\uFF1B\u5DF2\u6709\u6807\u7B7E\u4E0D\u53D7\u5F71\u54CD"}),He("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),a("span",{className:"tt_cardHint",children:"\u9ED8\u8BA4\u5173\u95ED\uFF1A\u6574\u4E2A\u9875\u9762\u5173\u95ED\u65F6\u6301\u4E45\u4F1A\u8BDD\u7559\u5B58\uFF08\u4FDD\u6D3B\u671F\u540E\u53EF\u518D\u6062\u590D\uFF09\uFF1B\u5F00\u542F\u5219\u9875\u9762\u65AD\u5F00\u4E14\u4FDD\u6D3B\u671F\u7ED3\u675F\u65F6\u8FDE tmux \u4F1A\u8BDD\u4E00\u8D77\u7ED3\u675F\u2014\u2014\u6CE8\u610F\u5237\u65B0\u9875\u9762\u5728\u4FDD\u6D3B\u671F\u5185\u4E0D\u53D7\u5F71\u54CD"})]}),Be("\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"),c("div",{className:"tt_cardField",onBlur:z=>{z.currentTarget.contains(z.relatedTarget)||w(!1)},children:[a("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),a("input",{className:"tt_cardInput",value:n.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>w(!0),onClick:()=>w(!0),onKeyDown:z=>{z.key==="Escape"&&w(!1)},onChange:z=>{E("shell",z.target.value),w(!0)}}),...C?[a("div",{className:"tt_envList tt_shellList",children:(()=>{let z=(n.shell??"").trim().toLowerCase(),V=z===""?u:u.filter(X=>X.toLowerCase().includes(z));return V.length===0?a("span",{className:"tt_envMore",children:"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF"}):V.map(X=>a("button",{type:"button",className:"tt_envItem",onMouseDown:J=>J.preventDefault(),onClick:()=>{E("shell",X),w(!1)},children:X},X))})()},"shell-list")]:[],a("span",{className:"tt_cardHint",children:"\u53EF\u4E0B\u62C9\u9009\u62E9\u672C\u673A\u5DF2\u5B89\u88C5 shell\uFF08$SHELL \u4F18\u5148\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bzsh / bash \u652F\u6301 shell \u96C6\u6210"})]},"shell-field"),Be("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),Be("COLORTERM","colorTerm","truecolor",""),Be("\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"),Be("\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"),c("div",{className:"tt_cardField",children:[a("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(n.sshHosts)&&n.sshHosts.length>0?[a("div",{className:"tt_hostList",children:n.sshHosts.map(z=>c("div",{children:[c("div",{className:"tt_sshHostRow",children:[a("div",{className:"tt_sshHostMeta",children:[a("span",{className:"tt_sshHostName",children:z?.name??""}),a("span",{className:"tt_sshHostTarget",children:nr(z??{})})]}),a("button",{type:"button",className:"tt_toolBtn",disabled:T[z?.name]?.running===!0,onClick:()=>{te(z)},title:"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD",children:T[z?.name]?.running===!0?"\u6D4B\u8BD5\u4E2D\u2026":"\u6D4B\u8BD5"}),a("button",{type:"button",className:"tt_toolBtn",onClick:()=>j(z),children:"\u7F16\u8F91"}),a("button",{type:"button",className:"tt_toolBtn",onClick:()=>Y(z?.name),children:"\u5220\u9664"})]}),T[z?.name]&&T[z?.name].text?a("div",{className:"tt_sshProbeResult"+(T[z?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:T[z?.name].text}):null,I===z?.name?Te():null]},String(z?.name??"")))})]:[a("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"})],c("div",{className:"tt_cardRow",children:[a("button",{type:"button",className:"tt_toolBtn",onClick:()=>{ie()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),a("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),a("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"})]}),c("div",{className:"tt_cardField",children:[c("div",{className:"tt_cardField",children:[a("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(n.tunnels)&&n.tunnels.length>0?[a("div",{children:n.tunnels.map(z=>{let V=S.find(J=>J.name===z?.name),X=V?.state??"stopped";return c("div",{className:"tt_sshHostRow",children:[a("span",{className:"tt_tunnelDot","data-state":X,title:X}),a("div",{className:"tt_sshHostMeta",children:[a("span",{className:"tt_sshHostName",children:(z?.name??"")+" \xB7 "+K(z??{})}),a("span",{className:"tt_sshHostTarget",children:(z?.bookName??"")+(V?.error?" \xB7 "+V.error:"")+(V?.lastForwardError?" \xB7 "+V.lastForwardError:"")})]}),a("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z?.enabled!==!1,title:"\u542F\u7528",onChange:J=>H(z?.name,J.target.checked)}),a("button",{type:"button",className:"tt_toolBtn",onClick:()=>x(z?.name),children:"\u5220\u9664"})]},String(z?.name??""))})})]:[a("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"})],c("div",{className:"tt_sshEdit",children:[c("div",{className:"tt_cardRow",children:[c("select",{className:"tt_cardInput",value:k.direction,onChange:F("direction"),children:[a("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),a("option",{value:"remote",children:"\u8FDC\u7A0B\u8F6C\u53D1\uFF08-R\uFF09\uFF1A\u8FDC\u7A0B\u7AEF\u53E3 \u2192 \u672C\u673A\u670D\u52A1"})]}),c("select",{className:"tt_cardInput",value:k.bookName,onChange:F("bookName"),children:[a("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(n?.sshHosts)?n.sshHosts.map(z=>a("option",{value:z?.name??"",children:z?.name??""})):[]]})]}),a("span",{className:"tt_cardHint",children:G!==void 0?"\u7ECF "+nr(G)+" \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"}),k.direction==="local"?c("div",{className:"tt_tunnelGridLocal",children:[a("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:k.localPort,autoComplete:"off",onChange:F("localPort")}),a("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:k.remoteHost,autoComplete:"off",onChange:F("remoteHost")}),a("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:k.remotePort,autoComplete:"off",onChange:F("remotePort")})]}):c("div",{className:"tt_tunnelGrid",children:[a("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:k.remotePort,autoComplete:"off",onChange:F("remotePort")}),a("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:k.localTargetPort,autoComplete:"off",onChange:F("localTargetPort")})]}),a("div",{className:"tt_cardRow",children:[a("button",{type:"button",className:"tt_cardSave",onClick:O,children:"\u6DFB\u52A0\u96A7\u9053"}),a("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"})]})]})]}),c("div",{className:"tt_cardField",children:[a("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),a("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Z()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(n.hostKeys)&&n.hostKeys.length>0?[a("div",{className:"tt_hostList",children:n.hostKeys.map(z=>c("div",{className:"tt_sshHostRow",children:[a("div",{className:"tt_sshHostMeta",children:[a("span",{className:"tt_sshHostName",children:String(z?.host??"")+":"+String(z?.port??22)}),a("span",{className:"tt_sshHostTarget",children:"sha256:"+String(z?.fingerprint??"")})]}),a("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Q(z)},children:"\u5220\u9664"})]},String(z?.host??"")+":"+String(z?.port??22)))})]:[a("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"})],a("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"})]}),c("div",{className:"tt_cardField tt_cardRow",children:[a("button",{className:"tt_cardSave",disabled:g,onClick:()=>{fe()},children:g?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),a("span",{className:"tt_cardMessage"+(d.kind==="ok"?" tt_cardMessageOk":d.kind==="error"?" tt_cardMessageError":""),children:d.text})]})]})]}):null]})}return t.inject=["slots","sessions"],t.apply=h=>(Mo=h.sessions,Uc(),h.slots.inject("settings.plugin.item",()=>h.slots.register({name:"settings.plugin.item",key:"tty",order:110},r)),()=>{ns()}),t}});})();
339
339
  /*! Bundled license information:
340
340
 
341
341
  @xterm/addon-search/lib/addon-search.mjs: