@hyzyn/dsh-tty 0.12.0 → 0.15.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 ua=Object.create;var kr=Object.defineProperty;var _a=Object.getOwnPropertyDescriptor;var fa=Object.getOwnPropertyNames;var pa=Object.getPrototypeOf,va=Object.prototype.hasOwnProperty;var Lr=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var ga=(e,t,i,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let h of fa(t))!va.call(e,h)&&h!==i&&kr(e,h,{get:()=>t[h],enumerable:!(l=_a(t,h))||l.enumerable});return e};var Mr=(e,t,i)=>(i=e!=null?ua(pa(e)):{},ga(t||!e||!e.__esModule?kr(i,"default",{value:e,enumerable:!0}):i,e));var Tr=Lr((Si,us)=>{(function(e,t){if(typeof Si=="object"&&typeof us=="object")us.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var i=t();for(var l in i)(typeof Si=="object"?Si:e)[l]=i[l]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(h,s,r){var o=this&&this.__decorate||function(a,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(a,u,g,C);else for(var k=a.length-1;k>=0;k--)(b=a[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},_=this&&this.__param||function(a,u){return function(g,C){u(g,C,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let n=r(9042),f=r(9924),v=r(844),w=r(4725),p=r(2585),c=r(3656),d=s.AccessibilityManager=class extends v.Disposable{constructor(a,u,g,C){super(),this._terminal=a,this._coreBrowserService=g,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 b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,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((b=>this._handleResize(b.rows)))),this.register(this._terminal.onRender((b=>this._refreshRows(b.start,b.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((b=>this._handleChar(b)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
- `)))),this.register(this._terminal.onA11yTab((b=>this._handleTab(b)))),this.register(this._terminal.onKey((b=>this._handleKey(b.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,c.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(a){for(let u=0;u<a;u++)this._handleChar(" ")}_handleChar(a){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==a&&(this._charsToAnnounce+=a):this._charsToAnnounce+=a,a===`
3
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(a){this._clearLiveRegion(),/\p{Control}/u.test(a)||this._charsToConsume.push(a)}_refreshRows(a,u){this._liveRegionDebouncer.refresh(a,u,this._terminal.rows)}_renderRows(a,u){let g=this._terminal.buffer,C=g.lines.length.toString();for(let b=a;b<=u;b++){let y=g.lines.get(g.ydisp+b),m=[],k=y?.translateToString(!0,void 0,void 0,m)||"",B=(g.ydisp+b+1).toString(),P=this._rowElements[b];P&&(k.length===0?(P.innerText="\xA0",this._rowColumns.set(P,[0,1])):(P.textContent=k,this._rowColumns.set(P,m)),P.setAttribute("aria-posinset",B),P.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(a,u){let g=a.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(g.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||a.relatedTarget!==C)return;let b,y;if(u===0?(b=g,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(b=this._rowElements.shift(),y=g,this._rowContainer.removeChild(b)),b.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(),a.preventDefault(),a.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let a=document.getSelection();if(!a)return;if(a.isCollapsed)return void(this._rowContainer.contains(a.anchorNode)&&this._terminal.clearSelection());if(!a.anchorNode||!a.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:a.anchorNode,offset:a.anchorOffset},g={node:a.focusNode,offset:a.focusOffset};if((u.node.compareDocumentPosition(g.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===g.node&&u.offset>g.offset)&&([u,g]=[g,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(g.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(g={node:C,offset:C.textContent?.length??0}),!this._rowContainer.contains(g.node))return;let b=({node:k,offset:B})=>{let P=k instanceof Text?k.parentNode:k,H=parseInt(P?.getAttribute("aria-posinset"),10)-1;if(isNaN(H))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(P);if(!A)return console.warn("columns is null. Race condition?"),null;let F=B<A.length?A[B]:A.slice(-1)[0]+1;return F>=this._terminal.cols&&(++H,F=0),{row:H,column:F}},y=b(u),m=b(g);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(a){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>a;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let a=this._coreBrowserService.mainDocument.createElement("div");return a.setAttribute("role","listitem"),a.tabIndex=-1,this._refreshRowDimensions(a),a}_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 a=0;a<this._terminal.rows;a++)this._refreshRowDimensions(this._rowElements[a])}}_refreshRowDimensions(a){a.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=d=o([_(1,p.IInstantiationService),_(2,w.ICoreBrowserService),_(3,w.IRenderService)],d)},3614:(h,s)=>{function r(f){return f.replace(/\r?\n/g,"\r")}function o(f,v){return v?"\x1B[200~"+f+"\x1B[201~":f}function _(f,v,w,p){f=o(f=r(f),w.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(f,!0),v.value=""}function n(f,v,w){let p=w.getBoundingClientRect(),c=f.clientX-p.left-10,d=f.clientY-p.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${c}px`,v.style.top=`${d}px`,v.style.zIndex="1000",v.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=o,s.copyHandler=function(f,v){f.clipboardData&&f.clipboardData.setData("text/plain",v.selectionText),f.preventDefault()},s.handlePasteEvent=function(f,v,w,p){f.stopPropagation(),f.clipboardData&&_(f.clipboardData.getData("text/plain"),v,w,p)},s.paste=_,s.moveTextAreaUnderMouseCursor=n,s.rightClickHandler=function(f,v,w,p,c){n(f,v,w),c&&p.rightClickSelect(f),v.value=p.selectionText,v.select()}},7239:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let o=r(1505);s.ColorContrastCache=class{constructor(){this._color=new o.TwoKeyMap,this._css=new o.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,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(r,o,_,n){r.addEventListener(o,_,n);let f=!1;return{dispose:()=>{f||(f=!0,r.removeEventListener(o,_,n))}}}},3551:function(h,s,r){var o=this&&this.__decorate||function(d,a,u,g){var C,b=arguments.length,y=b<3?a:g===null?g=Object.getOwnPropertyDescriptor(a,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,a,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(b<3?C(y):b>3?C(a,u,y):C(a,u))||y);return b>3&&y&&Object.defineProperty(a,u,y),y},_=this&&this.__param||function(d,a){return function(u,g){a(u,g,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let n=r(3656),f=r(8460),v=r(844),w=r(2585),p=r(4725),c=s.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(d,a,u,g,C){super(),this._element=d,this._mouseService=a,this._renderService=u,this._bufferService=g,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,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,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 a=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!a)return;this._isMouseOut=!1;let u=d.composedPath();for(let g=0;g<u.length;g++){let C=u[g];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&a.x===this._lastBufferCell.x&&a.y===this._lastBufferCell.y||(this._handleHover(a),this._lastBufferCell=a)}_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,a){this._activeProviderReplies&&a||(this._activeProviderReplies?.forEach((g=>{g?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[g,C]of this._linkProviderService.linkProviders.entries())a?this._activeProviderReplies?.get(g)&&(u=this._checkLinkProviderResult(g,d,u)):C.provideLinks(d.y,(b=>{if(this._isMouseOut)return;let y=b?.map((m=>({link:m})));this._activeProviderReplies?.set(g,y),u=this._checkLinkProviderResult(g,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,a){let u=new Set;for(let g=0;g<a.size;g++){let C=a.get(g);if(C)for(let b=0;b<C.length;b++){let y=C[b],m=y.link.range.start.y<d?0:y.link.range.start.x,k=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let B=m;B<=k;B++){if(u.has(B)){C.splice(b--,1);break}u.add(B)}}}}_checkLinkProviderResult(d,a,u){if(!this._activeProviderReplies)return u;let g=this._activeProviderReplies.get(d),C=!1;for(let b=0;b<d;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(C=!0);if(!C&&g){let b=g.find((y=>this._linkAtPosition(y.link,a)));b&&(u=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let b=0;b<this._activeProviderReplies.size;b++){let y=this._activeProviderReplies.get(b)?.find((m=>this._linkAtPosition(m.link,a)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let a=this._positionFromMouseEvent(d,this._element,this._mouseService);a&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,a)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,a){this._currentLink&&this._lastMouseEvent&&(!d||!a||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=a)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._linkAtPosition(d.link,a)&&(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 g=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>=g&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(g,C),this._lastMouseEvent)){let b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}}))))}_linkHover(d,a,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(a,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),a.hover&&a.hover(u,a.text)}_fireUnderlineEvent(d,a){let u=d.range,g=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-g-1,u.end.x,u.end.y-g-1,void 0);(a?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(d,a,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(a,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),a.leave&&a.leave(u,a.text)}_linkAtPosition(d,a){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,g=d.range.end.y*this._bufferService.cols+d.range.end.x,C=a.y*this._bufferService.cols+a.x;return u<=C&&C<=g}_positionFromMouseEvent(d,a,u){let g=u.getCoords(d,a,this._bufferService.cols,this._bufferService.rows);if(g)return{x:g[0],y:g[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,a,u,g,C){return{x1:d,y1:a,x2:u,y2:g,cols:this._bufferService.cols,fg:C}}};s.Linkifier=c=o([_(1,p.IMouseService),_(2,p.IRenderService),_(3,w.IBufferService),_(4,p.ILinkProviderService)],c)},9042:(h,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(h,s,r){var o=this&&this.__decorate||function(p,c,d,a){var u,g=arguments.length,C=g<3?c:a===null?a=Object.getOwnPropertyDescriptor(c,d):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,a);else for(var b=p.length-1;b>=0;b--)(u=p[b])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},_=this&&this.__param||function(p,c){return function(d,a){c(d,a,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let n=r(511),f=r(2585),v=s.OscLinkProvider=class{constructor(p,c,d){this._bufferService=p,this._optionsService=c,this._oscLinkService=d}provideLinks(p,c){let d=this._bufferService.buffer.lines.get(p-1);if(!d)return void c(void 0);let a=[],u=this._optionsService.rawOptions.linkHandler,g=new n.CellData,C=d.getTrimmedLength(),b=-1,y=-1,m=!1;for(let k=0;k<C;k++)if(y!==-1||d.hasContent(k)){if(d.loadCell(k,g),g.hasExtendedAttrs()&&g.extended.urlId){if(y===-1){y=k,b=g.extended.urlId;continue}m=g.extended.urlId!==b}else y!==-1&&(m=!0);if(m||y!==-1&&k===C-1){let B=this._oscLinkService.getLinkData(b)?.uri;if(B){let P={start:{x:y+1,y:p},end:{x:k+(m||k!==C-1?0:1),y:p}},H=!1;if(!u?.allowNonHttpProtocols)try{let A=new URL(B);["http:","https:"].includes(A.protocol)||(H=!0)}catch{H=!0}H||a.push({text:B,range:P,activate:(A,F)=>u?u.activate(A,F,P):w(0,F),hover:(A,F)=>u?.hover?.(A,F,P),leave:(A,F)=>u?.leave?.(A,F,P)})}m=!1,g.hasExtendedAttrs()&&g.extended.urlId?(y=k,b=g.extended.urlId):(y=-1,b=-1)}}c(a)}};function w(p,c){if(confirm(`Do you want to navigate to ${c}?
1
+ "use strict";(()=>{var xa=Object.create;var Bs=Object.defineProperty;var Ea=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var La=Object.getPrototypeOf,Ma=Object.prototype.hasOwnProperty;var Ps=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Ra=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let h of ka(t))!Ma.call(e,h)&&h!==i&&Bs(e,h,{get:()=>t[h],enumerable:!(o=Ea(t,h))||o.enumerable});return e};var Os=(e,t,i)=>(i=e!=null?xa(La(e)):{},Ra(t||!e||!e.__esModule?Bs(i,"default",{value:e,enumerable:!0}):i,e));var Ns=Ps((ki,br)=>{(function(e,t){if(typeof ki=="object"&&typeof br=="object")br.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var i=t();for(var o in i)(typeof ki=="object"?ki:e)[o]=i[o]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(h,r,s){var a=this&&this.__decorate||function(l,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,g,C);else for(var k=l.length-1;k>=0;k--)(b=l[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},f=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let n=s(9042),_=s(9924),v=s(844),w=s(4725),p=s(2585),c=s(3656),d=r.AccessibilityManager=class extends v.Disposable{constructor(l,u,g,C){super(),this._terminal=l,this._coreBrowserService=g,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 b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,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((b=>this._handleResize(b.rows)))),this.register(this._terminal.onRender((b=>this._refreshRows(b.start,b.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((b=>this._handleChar(b)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
+ `)))),this.register(this._terminal.onA11yTab((b=>this._handleTab(b)))),this.register(this._terminal.onKey((b=>this._handleKey(b.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,c.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(l){for(let u=0;u<l;u++)this._handleChar(" ")}_handleChar(l){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==l&&(this._charsToAnnounce+=l):this._charsToAnnounce+=l,l===`
3
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),/\p{Control}/u.test(l)||this._charsToConsume.push(l)}_refreshRows(l,u){this._liveRegionDebouncer.refresh(l,u,this._terminal.rows)}_renderRows(l,u){let g=this._terminal.buffer,C=g.lines.length.toString();for(let b=l;b<=u;b++){let y=g.lines.get(g.ydisp+b),m=[],k=y?.translateToString(!0,void 0,void 0,m)||"",B=(g.ydisp+b+1).toString(),O=this._rowElements[b];O&&(k.length===0?(O.innerText="\xA0",this._rowColumns.set(O,[0,1])):(O.textContent=k,this._rowColumns.set(O,m)),O.setAttribute("aria-posinset",B),O.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,u){let g=l.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(g.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==C)return;let b,y;if(u===0?(b=g,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(b=this._rowElements.shift(),y=g,this._rowContainer.removeChild(b)),b.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(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:l.anchorNode,offset:l.anchorOffset},g={node:l.focusNode,offset:l.focusOffset};if((u.node.compareDocumentPosition(g.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===g.node&&u.offset>g.offset)&&([u,g]=[g,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(g.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(g={node:C,offset:C.textContent?.length??0}),!this._rowContainer.contains(g.node))return;let b=({node:k,offset:B})=>{let O=k instanceof Text?k.parentNode:k,H=parseInt(O?.getAttribute("aria-posinset"),10)-1;if(isNaN(H))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(O);if(!A)return console.warn("columns is null. Race condition?"),null;let W=B<A.length?A[B]:A.slice(-1)[0]+1;return W>=this._terminal.cols&&(++H,W=0),{row:H,column:W}},y=b(u),m=b(g);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(l){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>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_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 l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=d=a([f(1,p.IInstantiationService),f(2,w.ICoreBrowserService),f(3,w.IRenderService)],d)},3614:(h,r)=>{function s(_){return _.replace(/\r?\n/g,"\r")}function a(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function f(_,v,w,p){_=a(_=s(_),w.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(_,!0),v.value=""}function n(_,v,w){let p=w.getBoundingClientRect(),c=_.clientX-p.left-10,d=_.clientY-p.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${c}px`,v.style.top=`${d}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=s,r.bracketTextForPaste=a,r.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},r.handlePasteEvent=function(_,v,w,p){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),v,w,p)},r.paste=f,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(_,v,w,p,c){n(_,v,w),c&&p.rightClickSelect(_),v.value=p.selectionText,v.select()}},7239:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let a=s(1505);r.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.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:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(s,a,f,n){s.addEventListener(a,f,n);let _=!1;return{dispose:()=>{_||(_=!0,s.removeEventListener(a,f,n))}}}},3551:function(h,r,s){var a=this&&this.__decorate||function(d,l,u,g){var C,b=arguments.length,y=b<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(b<3?C(y):b>3?C(l,u,y):C(l,u))||y);return b>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,g){l(u,g,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let n=s(3656),_=s(8460),v=s(844),w=s(2585),p=s(4725),c=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(d,l,u,g,C){super(),this._element=d,this._mouseService=l,this._renderService=u,this._bufferService=g,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,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,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 l=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;let u=d.composedPath();for(let g=0;g<u.length;g++){let C=u[g];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_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,l){this._activeProviderReplies&&l||(this._activeProviderReplies?.forEach((g=>{g?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[g,C]of this._linkProviderService.linkProviders.entries())l?this._activeProviderReplies?.get(g)&&(u=this._checkLinkProviderResult(g,d,u)):C.provideLinks(d.y,(b=>{if(this._isMouseOut)return;let y=b?.map((m=>({link:m})));this._activeProviderReplies?.set(g,y),u=this._checkLinkProviderResult(g,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,l){let u=new Set;for(let g=0;g<l.size;g++){let C=l.get(g);if(C)for(let b=0;b<C.length;b++){let y=C[b],m=y.link.range.start.y<d?0:y.link.range.start.x,k=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let B=m;B<=k;B++){if(u.has(B)){C.splice(b--,1);break}u.add(B)}}}}_checkLinkProviderResult(d,l,u){if(!this._activeProviderReplies)return u;let g=this._activeProviderReplies.get(d),C=!1;for(let b=0;b<d;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(C=!0);if(!C&&g){let b=g.find((y=>this._linkAtPosition(y.link,l)));b&&(u=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let b=0;b<this._activeProviderReplies.size;b++){let y=this._activeProviderReplies.get(b)?.find((m=>this._linkAtPosition(m.link,l)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let l=this._positionFromMouseEvent(d,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,l){this._currentLink&&this._lastMouseEvent&&(!d||!l||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(d.link,l)&&(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 g=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>=g&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(g,C),this._lastMouseEvent)){let b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}}))))}_linkHover(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(u,l.text)}_fireUnderlineEvent(d,l){let u=d.range,g=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-g-1,u.end.x,u.end.y-g-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(u,l.text)}_linkAtPosition(d,l){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,g=d.range.end.y*this._bufferService.cols+d.range.end.x,C=l.y*this._bufferService.cols+l.x;return u<=C&&C<=g}_positionFromMouseEvent(d,l,u){let g=u.getCoords(d,l,this._bufferService.cols,this._bufferService.rows);if(g)return{x:g[0],y:g[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,l,u,g,C){return{x1:d,y1:l,x2:u,y2:g,cols:this._bufferService.cols,fg:C}}};r.Linkifier=c=a([f(1,p.IMouseService),f(2,p.IRenderService),f(3,w.IBufferService),f(4,p.ILinkProviderService)],c)},9042:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(h,r,s){var a=this&&this.__decorate||function(p,c,d,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var b=p.length-1;b>=0;b--)(u=p[b])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let n=s(511),_=s(2585),v=r.OscLinkProvider=class{constructor(p,c,d){this._bufferService=p,this._optionsService=c,this._oscLinkService=d}provideLinks(p,c){let d=this._bufferService.buffer.lines.get(p-1);if(!d)return void c(void 0);let l=[],u=this._optionsService.rawOptions.linkHandler,g=new n.CellData,C=d.getTrimmedLength(),b=-1,y=-1,m=!1;for(let k=0;k<C;k++)if(y!==-1||d.hasContent(k)){if(d.loadCell(k,g),g.hasExtendedAttrs()&&g.extended.urlId){if(y===-1){y=k,b=g.extended.urlId;continue}m=g.extended.urlId!==b}else y!==-1&&(m=!0);if(m||y!==-1&&k===C-1){let B=this._oscLinkService.getLinkData(b)?.uri;if(B){let O={start:{x:y+1,y:p},end:{x:k+(m||k!==C-1?0:1),y:p}},H=!1;if(!u?.allowNonHttpProtocols)try{let A=new URL(B);["http:","https:"].includes(A.protocol)||(H=!0)}catch{H=!0}H||l.push({text:B,range:O,activate:(A,W)=>u?u.activate(A,W,O):w(0,W),hover:(A,W)=>u?.hover?.(A,W,O),leave:(A,W)=>u?.leave?.(A,W,O)})}m=!1,g.hasExtendedAttrs()&&g.extended.urlId?(y=k,b=g.extended.urlId):(y=-1,b=-1)}}c(l)}};function w(p,c){if(confirm(`Do you want to navigate to ${c}?
4
4
 
5
- WARNING: This link could potentially be dangerous`)){let d=window.open();if(d){try{d.opener=null}catch{}d.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=v=o([_(0,f.IBufferService),_(1,f.IOptionsService),_(2,f.IOscLinkService)],v)},6193:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(r,o){this._renderCallback=r,this._coreBrowserService=o,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,o,_){this._rowCount=_,r=r!==void 0?r:0,o=o!==void 0?o: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,o):o,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),o=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,o),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let r of this._refreshCallbacks)r(0);this._refreshCallbacks=[]}}},3236:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let o=r(3614),_=r(3656),n=r(3551),f=r(9042),v=r(3730),w=r(1680),p=r(3107),c=r(5744),d=r(2950),a=r(1296),u=r(428),g=r(4269),C=r(5114),b=r(8934),y=r(3230),m=r(9312),k=r(4725),B=r(6731),P=r(8055),H=r(8969),A=r(8460),F=r(844),O=r(6114),T=r(8437),I=r(2584),R=r(7399),S=r(5941),E=r(9074),L=r(2585),M=r(5435),U=r(4567),q=r(779);class Y 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(D={}){super(D),this.browser=O,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new F.MutableDisposable),this._onCursorMove=this.register(new A.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new A.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new A.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new A.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new A.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new A.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new A.EventEmitter),this._onBlur=this.register(new A.EventEmitter),this._onA11yCharEmitter=this.register(new A.EventEmitter),this._onA11yTabEmitter=this.register(new A.EventEmitter),this._onWillOpen=this.register(new A.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(k.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((x,N)=>this.refresh(x,N)))),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,A.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,A.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((x=>this._afterResize(x.cols,x.rows)))),this.register((0,F.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(D){if(this._themeService)for(let x of D){let N,W="";switch(x.index){case 256:N="foreground",W="10";break;case 257:N="background",W="11";break;case 258:N="cursor",W="12";break;default:N="ansi",W="4;"+x.index}switch(x.type){case 0:let j=P.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[x.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${I.C0.ESC}]${W};${(0,S.toRgbString)(j)}${I.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((G=>G.ansi[x.index]=P.channels.toColor(...x.color)));else{let G=N;this._themeService.modifyColors((Z=>Z[G]=P.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(D){D?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(D){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.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(I.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 D=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(D);if(!x)return;let N=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,j=x.getWidth(N),G=this._renderService.dimensions.css.cell.width*j,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,K=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=K+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=G+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(x=>{this.hasSelection()&&(0,o.copyHandler)(x,this._selectionService)})));let D=x=>(0,o.handlePasteEvent)(x,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",D)),this.register((0,_.addDisposableDomListener)(this.element,"paste",D)),O.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(x=>{x.button===2&&(0,o.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(x=>{(0,o.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),O.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(x=>{x.button===1&&(0,o.moveTextAreaUnderMouseCursor)(x,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(D=>this._keyUp(D)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(D=>this._keyDown(D)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(D=>this._keyPress(D)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(D=>this._compositionHelper.compositionupdate(D)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(D=>this._inputEvent(D)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(D){if(!D)throw new Error("Terminal requires a parent element.");if(D.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=D.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"),D.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,_.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),x.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",f.promptLabel),O.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(C.CoreBrowserService,this.textarea,D.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(k.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(k.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(k.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(g.CharacterJoinerService),this._instantiationService.setService(k.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(k.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(k.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(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(k.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(a.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let D=this,x=this.element;function N(G){let Z=D._mouseService.getMouseReportCoords(G,D.screenElement);if(!Z)return!1;let K,X;switch(G.overrideType||G.type){case"mousemove":X=32,G.buttons===void 0?(K=3,G.button!==void 0&&(K=G.button<3?G.button:3)):K=1&G.buttons?0:4&G.buttons?1:2&G.buttons?2:3;break;case"mouseup":X=0,K=G.button<3?G.button:3;break;case"mousedown":X=1,K=G.button<3?G.button:3;break;case"wheel":if(D._customWheelEventHandler&&D._customWheelEventHandler(G)===!1||D.viewport.getLinesScrolled(G)===0)return!1;X=G.deltaY<0?0:1,K=4;break;default:return!1}return!(X===void 0||K===void 0||K>4)&&D.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:K,action:X,ctrl:G.ctrlKey,alt:G.altKey,shift:G.shiftKey})}let W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},j={mouseup:G=>(N(G),G.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(G)),wheel:G=>(N(G),this.cancel(G,!0)),mousedrag:G=>{G.buttons&&N(G)},mousemove:G=>{G.buttons||N(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?W.mousemove||(x.addEventListener("mousemove",j.mousemove),W.mousemove=j.mousemove):(x.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&G?W.wheel||(x.addEventListener("wheel",j.wheel,{passive:!1}),W.wheel=j.wheel):(x.removeEventListener("wheel",W.wheel),W.wheel=null),2&G?W.mouseup||(W.mouseup=j.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&G?W.mousedrag||(W.mousedrag=j.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(x,"mousedown",(G=>{if(G.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(G))return N(G),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(G)}))),this.register((0,_.addDisposableDomListener)(x,"wheel",(G=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(G)===!1)return!1;if(!this.buffer.hasScrollback){let Z=this.viewport.getLinesScrolled(G);if(Z===0)return;let K=I.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(G.deltaY<0?"A":"B"),X="";for(let te=0;te<Math.abs(Z);te++)X+=K;return this.coreService.triggerDataEvent(X,!0),this.cancel(G,!0)}return this.viewport.handleWheel(G)?this.cancel(G):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(x,"touchstart",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(G),this.cancel(G)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(x,"touchmove",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(G)?void 0:this.cancel(G)}),{passive:!1}))}refresh(D,x){this._renderService?.refreshRows(D,x)}updateCursorStyle(D){this._selectionService?.shouldColumnSelect(D)?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(D,x,N=0){N===1?(super.scrollLines(D,x,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(D)}paste(D){(0,o.paste)(D,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(D){this._customKeyEventHandler=D}attachCustomWheelEventHandler(D){this._customWheelEventHandler=D}registerLinkProvider(D){return this._linkProviderService.registerLinkProvider(D)}registerCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let x=this._characterJoinerService.register(D);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(D)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(D){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+D)}registerDecoration(D){return this._decorationService.registerDecoration(D)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(D,x,N){this._selectionService.setSelection(D,x,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(D,x){this._selectionService?.selectLines(D,x)}_keyDown(D){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;let x=this.browser.isMac&&this.options.macOptionIsMeta&&D.altKey;if(!x&&!this._compositionHelper.keydown(D))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;x||D.key!=="Dead"&&D.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,R.evaluateKeyboardEvent)(D,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(D),N.type===3||N.type===2){let W=this.rows-1;return this.scrollLines(N.type===2?-W:W),this.cancel(D,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,D)||(N.cancel&&this.cancel(D,!0),!N.key||!!(D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.key.length===1&&D.key.charCodeAt(0)>=65&&D.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==I.C0.ETX&&N.key!==I.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||D.altKey||D.ctrlKey?this.cancel(D,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(D,x){let N=D.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||D.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||D.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?N:N&&(!x.keyCode||x.keyCode>47)}_keyUp(D){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1||((function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18})(D)||this.focus(),this.updateCursorStyle(D),this._keyPressHandled=!1)}_keyPress(D){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;if(this.cancel(D),D.charCode)x=D.charCode;else if(D.which===null||D.which===void 0)x=D.keyCode;else{if(D.which===0||D.charCode===0)return!1;x=D.which}return!(!x||(D.altKey||D.ctrlKey||D.metaKey)&&!this._isThirdLevelShift(this.browser,D)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(D){if(D.data&&D.inputType==="insertText"&&(!D.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let x=D.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(D),!0}return!1}resize(D,x){D!==this.cols||x!==this.rows?super.resize(D,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(D,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 D=1;D<this.rows;D++)this.buffer.lines.push(this.buffer.getBlankLine(T.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 D=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=D,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(I.C0.ESC+"[I"):this.coreService.triggerDataEvent(I.C0.ESC+"[O")}_reportWindowsOptions(D){if(this._renderService)switch(D){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let x=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[4;${N};${x}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let W=this._renderService.dimensions.css.cell.width.toFixed(0),j=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[6;${j};${W}t`)}}cancel(D,x){if(this.options.cancelEvents||x)return D.preventDefault(),D.stopPropagation(),!1}}s.Terminal=Y},9924:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(r,o=1e3){this._renderCallback=r,this._debounceThresholdMS=o,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(r,o,_){this._rowCount=_,r=r!==void 0?r:0,o=o!==void 0?o: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,o):o;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let f=n-this._lastRefreshMs,v=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let r=Math.max(this._rowStart,0),o=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,o)}}},1680:function(h,s,r){var o=this&&this.__decorate||function(d,a,u,g){var C,b=arguments.length,y=b<3?a:g===null?g=Object.getOwnPropertyDescriptor(a,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,a,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(b<3?C(y):b>3?C(a,u,y):C(a,u))||y);return b>3&&y&&Object.defineProperty(a,u,y),y},_=this&&this.__param||function(d,a){return function(u,g){a(u,g,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let n=r(3656),f=r(4725),v=r(8460),w=r(844),p=r(2585),c=s.Viewport=class extends w.Disposable{constructor(d,a,u,g,C,b,y,m){super(),this._viewportElement=d,this._scrollArea=a,this._bufferService=u,this._optionsService=g,this._charSizeService=C,this._renderService=b,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 v.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((k=>this._activeBuffer=k.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((k=>this._renderDimensions=k))),this._handleThemeChange(m.colors),this.register(m.onChangeColors((k=>this._handleThemeChange(k)))),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 a=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==a&&(this._lastRecordedBufferHeight=a,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 a=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:a,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,a){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(a<0&&this._viewportElement.scrollTop!==0||a>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let a=this._getPixelsScrolled(d);return a!==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+a:this._smoothScrollState.target+=a,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=a,this._bubbleScroll(d,a))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let a=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+a,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 a=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?a*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._currentRowHeight*this._bufferService.rows),a}getBufferElements(d,a){let u,g="",C=[],b=a??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<b;m++){let k=y.get(m);if(!k)continue;let B=y.get(m+1)?.isWrapped;if(g+=k.translateToString(!B),!B||m===y.length-1){let P=document.createElement("div");P.textContent=g,C.push(P),g.length>0&&(u=P),g=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let a=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=this._currentRowHeight+0,this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(d,a){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&a.altKey||u==="ctrl"&&a.ctrlKey||u==="shift"&&a.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 a=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,a!==0&&(this._viewportElement.scrollTop+=a,this._bubbleScroll(d,a))}};s.Viewport=c=o([_(2,p.IBufferService),_(3,p.IOptionsService),_(4,f.ICharSizeService),_(5,f.IRenderService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],c)},3107:function(h,s,r){var o=this&&this.__decorate||function(p,c,d,a){var u,g=arguments.length,C=g<3?c:a===null?a=Object.getOwnPropertyDescriptor(c,d):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,a);else for(var b=p.length-1;b>=0;b--)(u=p[b])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},_=this&&this.__param||function(p,c){return function(d,a){c(d,a,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let n=r(4725),f=r(844),v=r(2585),w=s.BufferDecorationRenderer=class extends f.Disposable{constructor(p,c,d,a,u){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=d,this._decorationService=a,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((g=>this._removeDecoration(g)))),this.register((0,f.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),c.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let d=p.options.x??0;return d&&d>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(p,c),c}_refreshStyle(p){let c=p.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let d=this._decorationElements.get(p);d||(d=this._createElement(p),p.element=d,this._decorationElements.set(p,d),this._container.appendChild(d),p.onDispose((()=>{this._decorationElements.delete(p),d.remove()}))),d.style.top=c*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(d)}}_refreshXPosition(p,c=p.element){if(!c)return;let d=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};s.BufferDecorationRenderer=w=o([_(1,v.IBufferService),_(2,n.ICoreBrowserService),_(3,v.IDecorationService),_(4,n.IRenderService)],w)},5871:(h,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 o of this._zones)if(o.color===r.options.overviewRulerOptions.color&&o.position===r.options.overviewRulerOptions.position){if(this._lineIntersectsZone(o,r.marker.line))return;if(this._lineAdjacentToZone(o,r.marker.line,r.options.overviewRulerOptions.position))return void this._addLineToZone(o,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,o){return o>=r.startBufferLine&&o<=r.endBufferLine}_lineAdjacentToZone(r,o,_){return o>=r.startBufferLine-this._linePadding[_||"full"]&&o<=r.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(r,o){r.startBufferLine=Math.min(r.startBufferLine,o),r.endBufferLine=Math.max(r.endBufferLine,o)}}},5744:function(h,s,r){var o=this&&this.__decorate||function(u,g,C,b){var y,m=arguments.length,k=m<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(u,g,C,b);else for(var B=u.length-1;B>=0;B--)(y=u[B])&&(k=(m<3?y(k):m>3?y(g,C,k):y(g,C))||k);return m>3&&k&&Object.defineProperty(g,C,k),k},_=this&&this.__param||function(u,g){return function(C,b){g(C,b,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let n=r(5871),f=r(4725),v=r(844),w=r(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},a=s.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,g,C,b,y,m,k){super(),this._viewportElement=u,this._screenElement=g,this._bufferService=C,this._decorationService=b,this._renderService=y,this._optionsService=m,this._coreBrowserService=k,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 B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let u=Math.floor(this._canvas.width/3),g=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=u,c.center=g,c.right=u,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=c.left,d.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let u=this._canvas.height/this._bufferService.buffer.lines.length,g=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=g,p.center=g,p.right=g}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let g of this._decorationService.decorations)this._colorZoneStore.addDecoration(g);this._ctx.lineWidth=1;let u=this._colorZoneStore.zones;for(let g of u)g.position!=="full"&&this._renderColorZone(g);for(let g of u)g.position==="full"&&this._renderColorZone(g);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)-p[u.position||"full"]/2),c[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,g){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=g||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=a=o([_(2,w.IBufferService),_(3,w.IDecorationService),_(4,f.IRenderService),_(5,w.IOptionsService),_(6,f.ICoreBrowserService)],a)},2950:function(h,s,r){var o=this&&this.__decorate||function(p,c,d,a){var u,g=arguments.length,C=g<3?c:a===null?a=Object.getOwnPropertyDescriptor(c,d):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,a);else for(var b=p.length-1;b>=0;b--)(u=p[b])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},_=this&&this.__param||function(p,c){return function(d,a){c(d,a,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let n=r(4725),f=r(2585),v=r(2584),w=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,d,a,u,g){this._textarea=p,this._compositionView=c,this._bufferService=d,this._optionsService=a,this._coreService=u,this._renderService=g,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;let c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,d=c.replace(p,"");this._dataAlreadySent=d,c.length>p.length?this._coreService.triggerDataEvent(d,!0):c.length<p.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):c.length===p.length&&c!==p&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,a=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=a+"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 g=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(g.width,1)+"px",this._textarea.style.height=Math.max(g.height,1)+"px",this._textarea.style.lineHeight=g.height+"px"}p||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=w=o([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,f.ICoreService),_(5,n.IRenderService)],w)},9806:(h,s)=>{function r(o,_,n){let f=n.getBoundingClientRect(),v=o.getComputedStyle(n),w=parseInt(v.getPropertyValue("padding-left")),p=parseInt(v.getPropertyValue("padding-top"));return[_.clientX-f.left-w,_.clientY-f.top-p]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=r,s.getCoords=function(o,_,n,f,v,w,p,c,d){if(!w)return;let a=r(o,_,n);return a?(a[0]=Math.ceil((a[0]+(d?p/2:0))/p),a[1]=Math.ceil(a[1]/c),a[0]=Math.min(Math.max(a[0],1),f+(d?1:0)),a[1]=Math.min(Math.max(a[1],1),v),a):void 0}},9504:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let o=r(2584);function _(c,d,a,u){let g=c-n(c,a),C=d-n(d,a),b=Math.abs(g-C)-(function(y,m,k){let B=0,P=y-n(y,k),H=m-n(m,k);for(let A=0;A<Math.abs(P-H);A++){let F=f(y,m)==="A"?-1:1;k.buffer.lines.get(P+F*A)?.isWrapped&&B++}return B})(c,d,a);return p(b,w(f(c,d),u))}function n(c,d){let a=0,u=d.buffer.lines.get(c),g=u?.isWrapped;for(;g&&c>=0&&c<d.rows;)a++,u=d.buffer.lines.get(--c),g=u?.isWrapped;return a}function f(c,d){return c>d?"A":"B"}function v(c,d,a,u,g,C){let b=c,y=d,m="";for(;b!==a||y!==u;)b+=g?1:-1,g&&b>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,c,b),b=0,c=0,y++):!g&&b<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,c+1),b=C.cols-1,c=b,y--);return m+C.buffer.translateBufferLineToString(y,!1,c,b)}function w(c,d){let a=d?"O":"[";return o.C0.ESC+a+c}function p(c,d){c=Math.floor(c);let a="";for(let u=0;u<c;u++)a+=d;return a}s.moveToCellSequence=function(c,d,a,u){let g=a.buffer.x,C=a.buffer.y;if(!a.buffer.hasScrollback)return(function(m,k,B,P,H,A){return _(k,P,H,A).length===0?"":p(v(m,k,m,k-n(k,H),!1,H).length,w("D",A))})(g,C,0,d,a,u)+_(C,d,a,u)+(function(m,k,B,P,H,A){let F;F=_(k,P,H,A).length>0?P-n(P,H):k;let O=P,T=(function(I,R,S,E,L,M){let U;return U=_(S,E,L,M).length>0?E-n(E,L):R,I<S&&U<=E||I>=S&&U<E?"C":"D"})(m,k,B,P,H,A);return p(v(m,F,B,O,T==="C",H).length,w(T,A))})(g,C,c,d,a,u);let b;if(C===d)return b=g>c?"D":"C",p(Math.abs(g-c),w(b,u));b=C>d?"D":"C";let y=Math.abs(C-d);return p((function(m,k){return k.cols-m})(C>d?c:g,a)+(y-1)*a.cols+1+((C>d?g:c)-1),w(b,u))}},1296:function(h,s,r){var o=this&&this.__decorate||function(A,F,O,T){var I,R=arguments.length,S=R<3?F:T===null?T=Object.getOwnPropertyDescriptor(F,O):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(A,F,O,T);else for(var E=A.length-1;E>=0;E--)(I=A[E])&&(S=(R<3?I(S):R>3?I(F,O,S):I(F,O))||S);return R>3&&S&&Object.defineProperty(F,O,S),S},_=this&&this.__param||function(A,F){return function(O,T){F(O,T,A)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let n=r(3787),f=r(2550),v=r(2223),w=r(6171),p=r(6052),c=r(4725),d=r(8055),a=r(8460),u=r(844),g=r(2585),C="xterm-dom-renderer-owner-",b="xterm-rows",y="xterm-fg-",m="xterm-bg-",k="xterm-focus",B="xterm-selection",P=1,H=s.DomRenderer=class extends u.Disposable{constructor(A,F,O,T,I,R,S,E,L,M,U,q,Y){super(),this._terminal=A,this._document=F,this._element=O,this._screenElement=T,this._viewportElement=I,this._helperContainer=R,this._linkifier2=S,this._charSizeService=L,this._optionsService=M,this._bufferService=U,this._coreBrowserService=q,this._themeService=Y,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new a.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(b),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((z=>this._injectCss(z)))),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((z=>this._handleLinkHover(z)))),this.register(this._linkifier2.onHideLinkUnderline((z=>this._handleLinkLeave(z)))),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 A=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*A,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*A),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/A),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/A),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let O of this._rowElements)O.style.width=`${this.dimensions.css.canvas.width}px`,O.style.height=`${this.dimensions.css.cell.height}px`,O.style.lineHeight=`${this.dimensions.css.cell.height}px`,O.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let F=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=F,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(A){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let F=`${this._terminalSelector} .${b} { color: ${A.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;F+=`${this._terminalSelector} .${b} .xterm-dim { color: ${d.color.multiplyOpacity(A.foreground,.5).css};}`,F+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let O=`blink_underline_${this._terminalClass}`,T=`blink_bar_${this._terminalClass}`,I=`blink_block_${this._terminalClass}`;F+=`@keyframes ${O} { 50% { border-bottom-style: hidden; }}`,F+=`@keyframes ${T} { 50% { box-shadow: none; }}`,F+=`@keyframes ${I} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,F+=`${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${T} 1s step-end infinite;}${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,F+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${A.selectionInactiveBackgroundOpaque.css};}`;for(let[R,S]of A.ansi.entries())F+=`${this._terminalSelector} .${y}${R} { color: ${S.css}; }${this._terminalSelector} .${y}${R}.xterm-dim { color: ${d.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${m}${R} { background-color: ${S.css}; }`;F+=`${this._terminalSelector} .${y}${v.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(A.background).css}; }${this._terminalSelector} .${y}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=F}_setDefaultSpacing(){let A=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${A}px`,this._rowFactory.defaultSpacing=A}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(A,F){for(let O=this._rowElements.length;O<=F;O++){let T=this._document.createElement("div");this._rowContainer.appendChild(T),this._rowElements.push(T)}for(;this._rowElements.length>F;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,F){this._refreshRowElements(A,F),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(k),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(k),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,F,O){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,F,O),this.renderRows(0,this._bufferService.rows-1),!A||!F)return;this._selectionRenderModel.update(this._terminal,A,F,O);let T=this._selectionRenderModel.viewportStartRow,I=this._selectionRenderModel.viewportEndRow,R=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if(R>=this._bufferService.rows||S<0)return;let E=this._document.createDocumentFragment();if(O){let L=A[0]>F[0];E.appendChild(this._createSelectionElement(R,L?F[0]:A[0],L?A[0]:F[0],S-R+1))}else{let L=T===R?A[0]:0,M=R===I?F[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(R,L,M));let U=S-R-1;if(E.appendChild(this._createSelectionElement(R+1,0,this._bufferService.cols,U)),R!==S){let q=I===S?F[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(S,0,q))}}this._selectionContainer.appendChild(E)}_createSelectionElement(A,F,O,T=1){let I=this._document.createElement("div"),R=F*this.dimensions.css.cell.width,S=this.dimensions.css.cell.width*(O-F);return R+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-R),I.style.height=T*this.dimensions.css.cell.height+"px",I.style.top=A*this.dimensions.css.cell.height+"px",I.style.left=`${R}px`,I.style.width=`${S}px`,I}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 A of this._rowElements)A.replaceChildren()}renderRows(A,F){let O=this._bufferService.buffer,T=O.ybase+O.y,I=Math.min(O.x,this._bufferService.cols-1),R=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=A;L<=F;L++){let M=L+O.ydisp,U=this._rowElements[L],q=O.lines.get(M);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,M,M===T,S,E,I,R,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!0)}_handleLinkLeave(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!1)}_setCellUnderline(A,F,O,T,I,R){O<0&&(A=0),T<0&&(F=0);let S=this._bufferService.rows-1;O=Math.max(Math.min(O,S),0),T=Math.max(Math.min(T,S),0),I=Math.min(I,this._bufferService.cols);let E=this._bufferService.buffer,L=E.ybase+E.y,M=Math.min(E.x,I-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=O;z<=T;++z){let D=z+E.ydisp,x=this._rowElements[z],N=E.lines.get(D);if(!x||!N)break;x.replaceChildren(...this._rowFactory.createRow(N,D,D===L,q,Y,M,U,this.dimensions.css.cell.width,this._widthCache,R?z===O?A:0:-1,R?(z===T?F:I)-1:-1))}}};s.DomRenderer=H=o([_(7,g.IInstantiationService),_(8,c.ICharSizeService),_(9,g.IOptionsService),_(10,g.IBufferService),_(11,c.ICoreBrowserService),_(12,c.IThemeService)],H)},3787:function(h,s,r){var o=this&&this.__decorate||function(b,y,m,k){var B,P=arguments.length,H=P<3?y:k===null?k=Object.getOwnPropertyDescriptor(y,m):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(b,y,m,k);else for(var A=b.length-1;A>=0;A--)(B=b[A])&&(H=(P<3?B(H):P>3?B(y,m,H):B(y,m))||H);return P>3&&H&&Object.defineProperty(y,m,H),H},_=this&&this.__param||function(b,y){return function(m,k){y(m,k,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let n=r(2223),f=r(643),v=r(511),w=r(2585),p=r(8055),c=r(4725),d=r(4269),a=r(6171),u=r(3734),g=s.DomRendererRowFactory=class{constructor(b,y,m,k,B,P,H){this._document=b,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=k,this._coreService=B,this._decorationService=P,this._themeService=H,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,y,m){this._selectionStart=b,this._selectionEnd=y,this._columnSelectMode=m}createRow(b,y,m,k,B,P,H,A,F,O,T){let I=[],R=this._characterJoinerService.getJoinedCharacters(y),S=this._themeService.colors,E,L=b.getNoBgTrimmedLength();m&&L<P+1&&(L=P+1);let M=0,U="",q=0,Y=0,z=0,D=!1,x=0,N=!1,W=0,j=[],G=O!==-1&&T!==-1;for(let Z=0;Z<L;Z++){b.loadCell(Z,this._workCell);let K=this._workCell.getWidth();if(K===0)continue;let X=!1,te=Z,Q=this._workCell;if(R.length>0&&Z===R[0][0]){X=!0;let ae=R.shift();Q=new d.JoinedCellData(this._workCell,b.translateToString(!0,ae[0],ae[1]),ae[1]-ae[0]),te=ae[1]-1,K=Q.getWidth()}let ne=this._isCellInSelection(Z,y),ce=m&&Z===P,Re=G&&Z>=O&&Z<=T,ue=!1;this._decorationService.forEachDecorationAtCell(Z,y,void 0,(ae=>{ue=!0}));let Me=Q.getChars()||f.WHITESPACE_CELL_CHAR;if(Me===" "&&(Q.isUnderline()||Q.isOverline())&&(Me="\xA0"),W=K*A-F.get(Me,Q.isBold(),Q.isItalic()),E){if(M&&(ne&&N||!ne&&!N&&Q.bg===q)&&(ne&&N&&S.selectionForeground||Q.fg===Y)&&Q.extended.ext===z&&Re===D&&W===x&&!ce&&!X&&!ue){Q.isInvisible()?U+=f.WHITESPACE_CELL_CHAR:U+=Me,M++;continue}M&&(E.textContent=U),E=this._document.createElement("span"),M=0,U=""}else E=this._document.createElement("span");if(q=Q.bg,Y=Q.fg,z=Q.extended.ext,D=Re,x=W,N=ne,X&&P>=Z&&P<=te&&(P=Z),!this._coreService.isCursorHidden&&ce&&this._coreService.isCursorInitialized){if(j.push("xterm-cursor"),this._coreBrowserService.isFocused)H&&j.push("xterm-cursor-blink"),j.push(k==="bar"?"xterm-cursor-bar":k==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":j.push("xterm-cursor-outline");break;case"block":j.push("xterm-cursor-block");break;case"bar":j.push("xterm-cursor-bar");break;case"underline":j.push("xterm-cursor-underline")}}if(Q.isBold()&&j.push("xterm-bold"),Q.isItalic()&&j.push("xterm-italic"),Q.isDim()&&j.push("xterm-dim"),U=Q.isInvisible()?f.WHITESPACE_CELL_CHAR:Q.getChars()||f.WHITESPACE_CELL_CHAR,Q.isUnderline()&&(j.push(`xterm-underline-${Q.extended.underlineStyle}`),U===" "&&(U="\xA0"),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let ae=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&ae<8&&(ae+=8),E.style.textDecorationColor=S.ansi[ae].css}Q.isOverline()&&(j.push("xterm-overline"),U===" "&&(U="\xA0")),Q.isStrikethrough()&&j.push("xterm-strikethrough"),Re&&(E.style.textDecoration="underline");let $=Q.getFgColor(),V=Q.getFgColorMode(),J=Q.getBgColor(),ee=Q.getBgColorMode(),oe=!!Q.isInverse();if(oe){let ae=$;$=J,J=ae;let da=V;V=ee,ee=da}let le,pe,ie,ve=!1;switch(this._decorationService.forEachDecorationAtCell(Z,y,void 0,(ae=>{ae.options.layer!=="top"&&ve||(ae.backgroundColorRGB&&(ee=50331648,J=ae.backgroundColorRGB.rgba>>8&16777215,le=ae.backgroundColorRGB),ae.foregroundColorRGB&&(V=50331648,$=ae.foregroundColorRGB.rgba>>8&16777215,pe=ae.foregroundColorRGB),ve=ae.options.layer==="top")})),!ve&&ne&&(le=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,J=le.rgba>>8&16777215,ee=50331648,ve=!0,S.selectionForeground&&(V=50331648,$=S.selectionForeground.rgba>>8&16777215,pe=S.selectionForeground)),ve&&j.push("xterm-decoration-top"),ee){case 16777216:case 33554432:ie=S.ansi[J],j.push(`xterm-bg-${J}`);break;case 50331648:ie=p.channels.toColor(J>>16,J>>8&255,255&J),this._addStyle(E,`background-color:#${C((J>>>0).toString(16),"0",6)}`);break;default:oe?(ie=S.foreground,j.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):ie=S.background}switch(le||Q.isDim()&&(le=p.color.multiplyOpacity(ie,.5)),V){case 16777216:case 33554432:Q.isBold()&&$<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&($+=8),this._applyMinimumContrast(E,ie,S.ansi[$],Q,le,void 0)||j.push(`xterm-fg-${$}`);break;case 50331648:let ae=p.channels.toColor($>>16&255,$>>8&255,255&$);this._applyMinimumContrast(E,ie,ae,Q,le,pe)||this._addStyle(E,`color:#${C($.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ie,S.foreground,Q,le,pe)||oe&&j.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}j.length&&(E.className=j.join(" "),j.length=0),ce||X||ue?E.textContent=U:M++,W!==this.defaultSpacing&&(E.style.letterSpacing=`${W}px`),I.push(E),Z=te}return E&&M&&(E.textContent=U),I}_applyMinimumContrast(b,y,m,k,B,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,a.treatGlyphAsBackgroundColor)(k.getCode()))return!1;let H=this._getContrastCache(k),A;if(B||P||(A=H.getColor(y.rgba,m.rgba)),A===void 0){let F=this._optionsService.rawOptions.minimumContrastRatio/(k.isDim()?2:1);A=p.color.ensureContrastRatio(B||y,P||m,F),H.setColor((B||y).rgba,(P||m).rgba,A??null)}return!!A&&(this._addStyle(b,`color:${A.css}`),!0)}_getContrastCache(b){return b.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(b,y){b.setAttribute("style",`${b.getAttribute("style")||""}${y};`)}_isCellInSelection(b,y){let m=this._selectionStart,k=this._selectionEnd;return!(!m||!k)&&(this._columnSelectMode?m[0]<=k[0]?b>=m[0]&&y>=m[1]&&b<k[0]&&y<=k[1]:b<m[0]&&y>=m[1]&&b>=k[0]&&y<=k[1]:y>m[1]&&y<k[1]||m[1]===k[1]&&y===m[1]&&b>=m[0]&&b<k[0]||m[1]<k[1]&&y===k[1]&&b<k[0]||m[1]<k[1]&&y===m[1]&&b>=m[0])}};function C(b,y,m){for(;b.length<m;)b=y+b;return b}s.DomRendererRowFactory=g=o([_(1,c.ICharacterJoinerService),_(2,w.IOptionsService),_(3,c.ICoreBrowserService),_(4,w.ICoreService),_(5,w.IDecorationService),_(6,c.IThemeService)],g)},2550:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(r,o){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 v=r.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[_,n,f,v],this._container.appendChild(_),this._container.appendChild(n),this._container.appendChild(f),this._container.appendChild(v),o.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,o,_,n){r===this._font&&o===this._fontSize&&_===this._weight&&n===this._weightBold||(this._font=r,this._fontSize=o,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,o,_){let n=0;if(!o&&!_&&r.length===1&&(n=r.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let w=this._measure(r,0);return w>0&&(this._flat[n]=w),w}let f=r;o&&(f+="B"),_&&(f+="I");let v=this._holey.get(f);if(v===void 0){let w=0;o&&(w|=1),_&&(w|=2),v=this._measure(r,w),v>0&&this._holey.set(f,v)}return v}_measure(r,o){let _=this._measureElements[o];return _.textContent=r.repeat(32),_.offsetWidth/32}}},2223:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let o=r(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=o.isFirefox||o.isLegacyEdge?"bottom":"ideographic"},6171:(h,s)=>{function r(_){return 57508<=_&&_<=57558}function o(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=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(_){if(!_)throw new Error("value must not be falsy");return _},s.isPowerlineGlyph=r,s.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},s.isEmoji=o,s.allowRescaling=function(_,n,f,v){return n===1&&f>Math.ceil(1.5*v)&&_!==void 0&&_>255&&!o(_)&&!r(_)&&!(function(w){return 57344<=w&&w<=63743})(_)},s.treatGlyphAsBackgroundColor=function(_){return r(_)||(function(n){return 9472<=n&&n<=9631})(_)},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(_,n,f=0){return(_-(2*Math.round(n)-f))%(2*Math.round(n))}},6052:(h,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(_,n,f,v=!1){if(this.selectionStart=n,this.selectionEnd=f,!n||!f||n[0]===f[0]&&n[1]===f[1])return void this.clear();let w=_.buffers.active.ydisp,p=n[1]-w,c=f[1]-w,d=Math.max(p,0),a=Math.min(c,_.rows-1);d>=_.rows||a<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=a,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)}}s.createSelectionRenderModel=function(){return new r}},456:(h,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,o=this.selectionEnd;return!(!r||!o)&&(r[1]>o[1]||r[1]===o[1]&&r[0]>o[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,s,r){var o=this&&this.__decorate||function(a,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(a,u,g,C);else for(var k=a.length-1;k>=0;k--)(b=a[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},_=this&&this.__param||function(a,u){return function(g,C){u(g,C,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let n=r(2585),f=r(8460),v=r(844),w=s.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(a,u,g){super(),this._optionsService=g,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 c(a,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let a=this._measureStrategy.measure();a.width===this.width&&a.height===this.height||(this.width=a.width,this.height=a.height,this._onCharSizeChange.fire())}};s.CharSizeService=w=o([_(2,n.IOptionsService)],w);class p extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,g){u!==void 0&&u>0&&g!==void 0&&g>0&&(this._result.width=u,this._result.height=g)}}class c extends p{constructor(u,g,C){super(),this._document=u,this._parentElement=g,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 p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let g=this._ctx.measureText("W");if(!("width"in g&&"fontBoundingBoxAscent"in g&&"fontBoundingBoxDescent"in g))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,s,r){var o=this&&this.__decorate||function(d,a,u,g){var C,b=arguments.length,y=b<3?a:g===null?g=Object.getOwnPropertyDescriptor(a,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,a,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(b<3?C(y):b>3?C(a,u,y):C(a,u))||y);return b>3&&y&&Object.defineProperty(a,u,y),y},_=this&&this.__param||function(d,a){return function(u,g){a(u,g,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let n=r(3734),f=r(643),v=r(511),w=r(2585);class p extends n.AttributeData{constructor(a,u,g){super(),this.content=0,this.combinedData="",this.fg=a.fg,this.bg=a.bg,this.combinedData=u,this._width=g}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(a){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=p;let c=s.CharacterJoinerService=class Rr{constructor(a){this._bufferService=a,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(a){let u={id:this._nextCharacterJoinerId++,handler:a};return this._characterJoiners.push(u),u.id}deregister(a){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===a)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(a){if(this._characterJoiners.length===0)return[];let u=this._bufferService.buffer.lines.get(a);if(!u||u.length===0)return[];let g=[],C=u.translateToString(!0),b=0,y=0,m=0,k=u.getFg(0),B=u.getBg(0);for(let P=0;P<u.getTrimmedLength();P++)if(u.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==k||this._workCell.bg!==B){if(P-b>1){let H=this._getJoinedRanges(C,m,y,u,b);for(let A=0;A<H.length;A++)g.push(H[A])}b=P,m=y,k=this._workCell.fg,B=this._workCell.bg}y+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){let P=this._getJoinedRanges(C,m,y,u,b);for(let H=0;H<P.length;H++)g.push(P[H])}return g}_getJoinedRanges(a,u,g,C,b){let y=a.substring(u,g),m=[];try{m=this._characterJoiners[0].handler(y)}catch(k){console.error(k)}for(let k=1;k<this._characterJoiners.length;k++)try{let B=this._characterJoiners[k].handler(y);for(let P=0;P<B.length;P++)Rr._mergeRanges(m,B[P])}catch(B){console.error(B)}return this._stringRangesToCellRanges(m,C,b),m}_stringRangesToCellRanges(a,u,g){let C=0,b=!1,y=0,m=a[C];if(m){for(let k=g;k<this._bufferService.cols;k++){let B=u.getWidth(k),P=u.getString(k).length||f.WHITESPACE_CELL_CHAR.length;if(B!==0){if(!b&&m[0]<=y&&(m[0]=k,b=!0),m[1]<=y){if(m[1]=k,m=a[++C],!m)break;m[0]<=y?(m[0]=k,b=!0):b=!1}y+=P}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(a,u){let g=!1;for(let C=0;C<a.length;C++){let b=a[C];if(g){if(u[1]<=b[0])return a[C-1][1]=u[1],a;if(u[1]<=b[1])return a[C-1][1]=Math.max(u[1],b[1]),a.splice(C,1),a;a.splice(C,1),C--}else{if(u[1]<=b[0])return a.splice(C,0,u),a;if(u[1]<=b[1])return b[0]=Math.min(u[0],b[0]),a;u[0]<b[1]&&(b[0]=Math.min(u[0],b[0]),g=!0)}}return g?a[a.length-1][1]=u[1]:a.push(u),a}};s.CharacterJoinerService=c=o([_(0,w.IBufferService)],c)},5114:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let o=r(844),_=r(8460),n=r(3656);class f extends o.Disposable{constructor(p,c,d){super(),this._textarea=p,this._window=c,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((a=>this._screenDprMonitor.setWindow(a)))),this.register((0,_.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(p){this._window!==p&&(this._window=p,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}s.CoreBrowserService=f;class v extends o.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new o.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,o.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let o=r(844);class _ extends o.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,o.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(f){return this.linkProviders.push(f),{dispose:()=>{let v=this.linkProviders.indexOf(f);v!==-1&&this.linkProviders.splice(v,1)}}}}s.LinkProviderService=_},8934:function(h,s,r){var o=this&&this.__decorate||function(w,p,c,d){var a,u=arguments.length,g=u<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,c):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(w,p,c,d);else for(var C=w.length-1;C>=0;C--)(a=w[C])&&(g=(u<3?a(g):u>3?a(p,c,g):a(p,c))||g);return u>3&&g&&Object.defineProperty(p,c,g),g},_=this&&this.__param||function(w,p){return function(c,d){p(c,d,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let n=r(4725),f=r(9806),v=s.MouseService=class{constructor(w,p){this._renderService=w,this._charSizeService=p}getCoords(w,p,c,d,a){return(0,f.getCoords)(window,w,p,c,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(w,p){let c=(0,f.getCoordsRelativeToElement)(window,w,p);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};s.MouseService=v=o([_(0,n.IRenderService),_(1,n.ICharSizeService)],v)},3230:function(h,s,r){var o=this&&this.__decorate||function(a,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(a,u,g,C);else for(var k=a.length-1;k>=0;k--)(b=a[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},_=this&&this.__param||function(a,u){return function(g,C){u(g,C,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let n=r(6193),f=r(4725),v=r(8460),w=r(844),p=r(7226),c=r(2585),d=s.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(a,u,g,C,b,y,m,k){super(),this._rowCount=a,this._charSizeService=C,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((B,P)=>this._renderRows(B,P)),m),this.register(this._renderDebouncer),this.register(m.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(y.onResize((()=>this._fullRefresh()))),this.register(y.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(g.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(b.onDecorationRegistered((()=>this._fullRefresh()))),this.register(b.onDecorationRemoved((()=>this._fullRefresh()))),this.register(g.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(y.cols,y.rows),this._fullRefresh()}))),this.register(g.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(y.buffer.y,y.buffer.y,!0)))),this.register(k.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange((B=>this._registerIntersectionObserver(B,u))))}_registerIntersectionObserver(a,u){if("IntersectionObserver"in a){let g=new a.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});g.observe(u),this._observerDisposable.value=(0,w.toDisposable)((()=>g.disconnect()))}}_handleIntersectionChange(a){this._isPaused=a.isIntersecting===void 0?a.intersectionRatio===0:!a.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(a,u,g=!1){this._isPaused?this._needsFullRefresh=!0:(g||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(a,u,this._rowCount))}_renderRows(a,u){this._renderer.value&&(a=Math.min(a,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(a,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:a,end:u}),this._onRender.fire({start:a,end:u}),this._isNextRenderRedrawOnly=!0)}resize(a,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(a){this._renderer.value=a,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(a){return this._renderDebouncer.addRefreshCallback(a)}_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(a,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(a,u))):this._renderer.value.handleResize(a,u),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(a,u,g){this._selectionState.start=a,this._selectionState.end=u,this._selectionState.columnSelectMode=g,this._renderer.value?.handleSelectionChanged(a,u,g)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=d=o([_(2,c.IOptionsService),_(3,f.ICharSizeService),_(4,c.IDecorationService),_(5,c.IBufferService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],d)},9312:function(h,s,r){var o=this&&this.__decorate||function(m,k,B,P){var H,A=arguments.length,F=A<3?k:P===null?P=Object.getOwnPropertyDescriptor(k,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(m,k,B,P);else for(var O=m.length-1;O>=0;O--)(H=m[O])&&(F=(A<3?H(F):A>3?H(k,B,F):H(k,B))||F);return A>3&&F&&Object.defineProperty(k,B,F),F},_=this&&this.__param||function(m,k){return function(B,P){k(B,P,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let n=r(9806),f=r(9504),v=r(456),w=r(4725),p=r(8460),c=r(844),d=r(6114),a=r(4841),u=r(511),g=r(2585),C="\xA0",b=new RegExp(C,"g"),y=s.SelectionService=class extends c.Disposable{constructor(m,k,B,P,H,A,F,O,T){super(),this._element=m,this._screenElement=k,this._linkifier=B,this._bufferService=P,this._coreService=H,this._mouseService=A,this._optionsService=F,this._renderService=O,this._coreBrowserService=T,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=I=>this._handleMouseMove(I),this._mouseUpListener=I=>this._handleMouseUp(I),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((I=>this._handleTrim(I))),this.register(this._bufferService.buffers.onBufferActivate((I=>this._handleBufferActivate(I)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,c.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,k=this._model.finalSelectionEnd;return!(!m||!k||m[0]===k[0]&&m[1]===k[1])}get selectionText(){let m=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;if(!m||!k)return"";let B=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(m[0]===k[0])return"";let H=m[0]<k[0]?m[0]:k[0],A=m[0]<k[0]?k[0]:m[0];for(let F=m[1];F<=k[1];F++){let O=B.translateBufferLineToString(F,!0,H,A);P.push(O)}}else{let H=m[1]===k[1]?k[0]:void 0;P.push(B.translateBufferLineToString(m[1],!0,m[0],H));for(let A=m[1]+1;A<=k[1]-1;A++){let F=B.lines.get(A),O=B.translateBufferLineToString(A,!0);F?.isWrapped?P[P.length-1]+=O:P.push(O)}if(m[1]!==k[1]){let A=B.lines.get(k[1]),F=B.translateBufferLineToString(k[1],!0,0,k[0]);A&&A.isWrapped?P[P.length-1]+=F:P.push(F)}}return P.map((H=>H.replace(b," "))).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=c}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=a([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],v)},6193:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(s,a){this._renderCallback=s,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(s){return this._refreshCallbacks.push(s),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(s,a,f){this._rowCount=f,s=s!==void 0?s:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let s=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let s of this._refreshCallbacks)s(0);this._refreshCallbacks=[]}}},3236:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let a=s(3614),f=s(3656),n=s(3551),_=s(9042),v=s(3730),w=s(1680),p=s(3107),c=s(5744),d=s(2950),l=s(1296),u=s(428),g=s(4269),C=s(5114),b=s(8934),y=s(3230),m=s(9312),k=s(4725),B=s(6731),O=s(8055),H=s(8969),A=s(8460),W=s(844),P=s(6114),M=s(8437),I=s(2584),T=s(7399),S=s(5941),E=s(9074),L=s(2585),R=s(5435),U=s(4567),K=s(779);class Y 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(D={}){super(D),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new W.MutableDisposable),this._onCursorMove=this.register(new A.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new A.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new A.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new A.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new A.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new A.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new A.EventEmitter),this._onBlur=this.register(new A.EventEmitter),this._onA11yCharEmitter=this.register(new A.EventEmitter),this._onA11yTabEmitter=this.register(new A.EventEmitter),this._onWillOpen=this.register(new A.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(k.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((x,N)=>this.refresh(x,N)))),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,A.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,A.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((x=>this._afterResize(x.cols,x.rows)))),this.register((0,W.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(D){if(this._themeService)for(let x of D){let N,F="";switch(x.index){case 256:N="foreground",F="10";break;case 257:N="background",F="11";break;case 258:N="cursor",F="12";break;default:N="ansi",F="4;"+x.index}switch(x.type){case 0:let j=O.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[x.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${I.C0.ESC}]${F};${(0,S.toRgbString)(j)}${I.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((q=>q.ansi[x.index]=O.channels.toColor(...x.color)));else{let q=N;this._themeService.modifyColors((Z=>Z[q]=O.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(D){D?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(D){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.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(I.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 D=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(D);if(!x)return;let N=Math.min(this.buffer.x,this.cols-1),F=this._renderService.dimensions.css.cell.height,j=x.getWidth(N),q=this._renderService.dimensions.css.cell.width*j,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,G=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=G+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=q+"px",this.textarea.style.height=F+"px",this.textarea.style.lineHeight=F+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(x=>{this.hasSelection()&&(0,a.copyHandler)(x,this._selectionService)})));let D=x=>(0,a.handlePasteEvent)(x,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",D)),this.register((0,f.addDisposableDomListener)(this.element,"paste",D)),P.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(x=>{x.button===2&&(0,a.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(x=>{(0,a.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(x=>{x.button===1&&(0,a.moveTextAreaUnderMouseCursor)(x,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(D=>this._keyUp(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(D=>this._keyDown(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(D=>this._keyPress(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(D=>this._compositionHelper.compositionupdate(D)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(D=>this._inputEvent(D)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(D){if(!D)throw new Error("Terminal requires a parent element.");if(D.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=D.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"),D.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",(N=>this.updateCursorStyle(N)))),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),P.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,D.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(k.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),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(k.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(k.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(g.CharacterJoinerService),this._instantiationService.setService(k.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(k.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(k.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(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(k.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let D=this,x=this.element;function N(q){let Z=D._mouseService.getMouseReportCoords(q,D.screenElement);if(!Z)return!1;let G,X;switch(q.overrideType||q.type){case"mousemove":X=32,q.buttons===void 0?(G=3,q.button!==void 0&&(G=q.button<3?q.button:3)):G=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":X=0,G=q.button<3?q.button:3;break;case"mousedown":X=1,G=q.button<3?q.button:3;break;case"wheel":if(D._customWheelEventHandler&&D._customWheelEventHandler(q)===!1||D.viewport.getLinesScrolled(q)===0)return!1;X=q.deltaY<0?0:1,G=4;break;default:return!1}return!(X===void 0||G===void 0||G>4)&&D.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:G,action:X,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}let F={mouseup:null,wheel:null,mousedrag:null,mousemove:null},j={mouseup:q=>(N(q),q.buttons||(this._document.removeEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.removeEventListener("mousemove",F.mousedrag)),this.cancel(q)),wheel:q=>(N(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&N(q)},mousemove:q=>{q.buttons||N(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?F.mousemove||(x.addEventListener("mousemove",j.mousemove),F.mousemove=j.mousemove):(x.removeEventListener("mousemove",F.mousemove),F.mousemove=null),16&q?F.wheel||(x.addEventListener("wheel",j.wheel,{passive:!1}),F.wheel=j.wheel):(x.removeEventListener("wheel",F.wheel),F.wheel=null),2&q?F.mouseup||(F.mouseup=j.mouseup):(this._document.removeEventListener("mouseup",F.mouseup),F.mouseup=null),4&q?F.mousedrag||(F.mousedrag=j.mousedrag):(this._document.removeEventListener("mousemove",F.mousedrag),F.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 N(q),F.mouseup&&this._document.addEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.addEventListener("mousemove",F.mousedrag),this.cancel(q)}))),this.register((0,f.addDisposableDomListener)(x,"wheel",(q=>{if(!F.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){let Z=this.viewport.getLinesScrolled(q);if(Z===0)return;let G=I.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B"),X="";for(let Q=0;Q<Math.abs(Z);Q++)X+=G;return this.coreService.triggerDataEvent(X,!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(D,x){this._renderService?.refreshRows(D,x)}updateCursorStyle(D){this._selectionService?.shouldColumnSelect(D)?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(D,x,N=0){N===1?(super.scrollLines(D,x,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(D)}paste(D){(0,a.paste)(D,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(D){this._customKeyEventHandler=D}attachCustomWheelEventHandler(D){this._customWheelEventHandler=D}registerLinkProvider(D){return this._linkProviderService.registerLinkProvider(D)}registerCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let x=this._characterJoinerService.register(D);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(D)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(D){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+D)}registerDecoration(D){return this._decorationService.registerDecoration(D)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(D,x,N){this._selectionService.setSelection(D,x,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(D,x){this._selectionService?.selectLines(D,x)}_keyDown(D){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;let x=this.browser.isMac&&this.options.macOptionIsMeta&&D.altKey;if(!x&&!this._compositionHelper.keydown(D))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;x||D.key!=="Dead"&&D.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,T.evaluateKeyboardEvent)(D,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(D),N.type===3||N.type===2){let F=this.rows-1;return this.scrollLines(N.type===2?-F:F),this.cancel(D,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,D)||(N.cancel&&this.cancel(D,!0),!N.key||!!(D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.key.length===1&&D.key.charCodeAt(0)>=65&&D.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==I.C0.ETX&&N.key!==I.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||D.altKey||D.ctrlKey?this.cancel(D,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(D,x){let N=D.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||D.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||D.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?N:N&&(!x.keyCode||x.keyCode>47)}_keyUp(D){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1||((function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18})(D)||this.focus(),this.updateCursorStyle(D),this._keyPressHandled=!1)}_keyPress(D){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;if(this.cancel(D),D.charCode)x=D.charCode;else if(D.which===null||D.which===void 0)x=D.keyCode;else{if(D.which===0||D.charCode===0)return!1;x=D.which}return!(!x||(D.altKey||D.ctrlKey||D.metaKey)&&!this._isThirdLevelShift(this.browser,D)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(D){if(D.data&&D.inputType==="insertText"&&(!D.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let x=D.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(D),!0}return!1}resize(D,x){D!==this.cols||x!==this.rows?super.resize(D,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(D,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 D=1;D<this.rows;D++)this.buffer.lines.push(this.buffer.getBlankLine(M.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let D=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=D,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(I.C0.ESC+"[I"):this.coreService.triggerDataEvent(I.C0.ESC+"[O")}_reportWindowsOptions(D){if(this._renderService)switch(D){case R.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let x=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[4;${N};${x}t`);break;case R.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let F=this._renderService.dimensions.css.cell.width.toFixed(0),j=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[6;${j};${F}t`)}}cancel(D,x){if(this.options.cancelEvents||x)return D.preventDefault(),D.stopPropagation(),!1}}r.Terminal=Y},9924:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(s,a=1e3){this._renderCallback=s,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(s,a,f){this._rowCount=f,s=s!==void 0?s:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=n-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let s=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,a)}}},1680:function(h,r,s){var a=this&&this.__decorate||function(d,l,u,g){var C,b=arguments.length,y=b<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(b<3?C(y):b>3?C(l,u,y):C(l,u))||y);return b>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,g){l(u,g,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let n=s(3656),_=s(4725),v=s(8460),w=s(844),p=s(2585),c=r.Viewport=class extends w.Disposable{constructor(d,l,u,g,C,b,y,m){super(),this._viewportElement=d,this._scrollArea=l,this._bufferService=u,this._optionsService=g,this._charSizeService=C,this._renderService=b,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 v.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((k=>this._activeBuffer=k.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((k=>this._renderDimensions=k))),this._handleThemeChange(m.colors),this.register(m.onChangeColors((k=>this._handleThemeChange(k)))),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 l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,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 l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,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,l){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let l=this._getPixelsScrolled(d);return l!==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+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let l=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,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 l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(d,l){let u,g="",C=[],b=l??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<b;m++){let k=y.get(m);if(!k)continue;let B=y.get(m+1)?.isWrapped;if(g+=k.translateToString(!B),!B||m===y.length-1){let O=document.createElement("div");O.textContent=g,C.push(O),g.length>0&&(u=O),g=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(d,l){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&l.altKey||u==="ctrl"&&l.ctrlKey||u==="shift"&&l.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 l=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}};r.Viewport=c=a([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],c)},3107:function(h,r,s){var a=this&&this.__decorate||function(p,c,d,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var b=p.length-1;b>=0;b--)(u=p[b])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let n=s(4725),_=s(844),v=s(2585),w=r.BufferDecorationRenderer=class extends _.Disposable{constructor(p,c,d,l,u){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=d,this._decorationService=l,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((g=>this._removeDecoration(g)))),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 p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),c.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let d=p.options.x??0;return d&&d>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(p,c),c}_refreshStyle(p){let c=p.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let d=this._decorationElements.get(p);d||(d=this._createElement(p),p.element=d,this._decorationElements.set(p,d),this._container.appendChild(d),p.onDispose((()=>{this._decorationElements.delete(p),d.remove()}))),d.style.top=c*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(d)}}_refreshXPosition(p,c=p.element){if(!c)return;let d=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};r.BufferDecorationRenderer=w=a([f(1,v.IBufferService),f(2,n.ICoreBrowserService),f(3,v.IDecorationService),f(4,n.IRenderService)],w)},5871:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(s){if(s.options.overviewRulerOptions){for(let a of this._zones)if(a.color===s.options.overviewRulerOptions.color&&a.position===s.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,s.marker.line))return;if(this._lineAdjacentToZone(a,s.marker.line,s.options.overviewRulerOptions.position))return void this._addLineToZone(a,s.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=s.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=s.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=s.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=s.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:s.options.overviewRulerOptions.color,position:s.options.overviewRulerOptions.position,startBufferLine:s.marker.line,endBufferLine:s.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(s){this._linePadding=s}_lineIntersectsZone(s,a){return a>=s.startBufferLine&&a<=s.endBufferLine}_lineAdjacentToZone(s,a,f){return a>=s.startBufferLine-this._linePadding[f||"full"]&&a<=s.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(s,a){s.startBufferLine=Math.min(s.startBufferLine,a),s.endBufferLine=Math.max(s.endBufferLine,a)}}},5744:function(h,r,s){var a=this&&this.__decorate||function(u,g,C,b){var y,m=arguments.length,k=m<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(u,g,C,b);else for(var B=u.length-1;B>=0;B--)(y=u[B])&&(k=(m<3?y(k):m>3?y(g,C,k):y(g,C))||k);return m>3&&k&&Object.defineProperty(g,C,k),k},f=this&&this.__param||function(u,g){return function(C,b){g(C,b,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let n=s(5871),_=s(4725),v=s(844),w=s(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},l=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,g,C,b,y,m,k){super(),this._viewportElement=u,this._screenElement=g,this._bufferService=C,this._decorationService=b,this._renderService=y,this._optionsService=m,this._coreBrowserService=k,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 B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let u=Math.floor(this._canvas.width/3),g=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=u,c.center=g,c.right=u,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=c.left,d.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let u=this._canvas.height/this._bufferService.buffer.lines.length,g=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=g,p.center=g,p.right=g}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let g of this._decorationService.decorations)this._colorZoneStore.addDecoration(g);this._ctx.lineWidth=1;let u=this._colorZoneStore.zones;for(let g of u)g.position!=="full"&&this._renderColorZone(g);for(let g of u)g.position==="full"&&this._renderColorZone(g);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)-p[u.position||"full"]/2),c[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,g){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=g||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=l=a([f(2,w.IBufferService),f(3,w.IDecorationService),f(4,_.IRenderService),f(5,w.IOptionsService),f(6,_.ICoreBrowserService)],l)},2950:function(h,r,s){var a=this&&this.__decorate||function(p,c,d,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var b=p.length-1;b>=0;b--)(u=p[b])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let n=s(4725),_=s(2585),v=s(2584),w=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,d,l,u,g){this._textarea=p,this._compositionView=c,this._bufferService=d,this._optionsService=l,this._coreService=u,this._renderService=g,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;let c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,d=c.replace(p,"");this._dataAlreadySent=d,c.length>p.length?this._coreService.triggerDataEvent(d,!0):c.length<p.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):c.length===p.length&&c!==p&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=l+"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 g=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(g.width,1)+"px",this._textarea.style.height=Math.max(g.height,1)+"px",this._textarea.style.lineHeight=g.height+"px"}p||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=w=a([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,n.IRenderService)],w)},9806:(h,r)=>{function s(a,f,n){let _=n.getBoundingClientRect(),v=a.getComputedStyle(n),w=parseInt(v.getPropertyValue("padding-left")),p=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-_.left-w,f.clientY-_.top-p]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=s,r.getCoords=function(a,f,n,_,v,w,p,c,d){if(!w)return;let l=s(a,f,n);return l?(l[0]=Math.ceil((l[0]+(d?p/2:0))/p),l[1]=Math.ceil(l[1]/c),l[0]=Math.min(Math.max(l[0],1),_+(d?1:0)),l[1]=Math.min(Math.max(l[1],1),v),l):void 0}},9504:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let a=s(2584);function f(c,d,l,u){let g=c-n(c,l),C=d-n(d,l),b=Math.abs(g-C)-(function(y,m,k){let B=0,O=y-n(y,k),H=m-n(m,k);for(let A=0;A<Math.abs(O-H);A++){let W=_(y,m)==="A"?-1:1;k.buffer.lines.get(O+W*A)?.isWrapped&&B++}return B})(c,d,l);return p(b,w(_(c,d),u))}function n(c,d){let l=0,u=d.buffer.lines.get(c),g=u?.isWrapped;for(;g&&c>=0&&c<d.rows;)l++,u=d.buffer.lines.get(--c),g=u?.isWrapped;return l}function _(c,d){return c>d?"A":"B"}function v(c,d,l,u,g,C){let b=c,y=d,m="";for(;b!==l||y!==u;)b+=g?1:-1,g&&b>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,c,b),b=0,c=0,y++):!g&&b<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,c+1),b=C.cols-1,c=b,y--);return m+C.buffer.translateBufferLineToString(y,!1,c,b)}function w(c,d){let l=d?"O":"[";return a.C0.ESC+l+c}function p(c,d){c=Math.floor(c);let l="";for(let u=0;u<c;u++)l+=d;return l}r.moveToCellSequence=function(c,d,l,u){let g=l.buffer.x,C=l.buffer.y;if(!l.buffer.hasScrollback)return(function(m,k,B,O,H,A){return f(k,O,H,A).length===0?"":p(v(m,k,m,k-n(k,H),!1,H).length,w("D",A))})(g,C,0,d,l,u)+f(C,d,l,u)+(function(m,k,B,O,H,A){let W;W=f(k,O,H,A).length>0?O-n(O,H):k;let P=O,M=(function(I,T,S,E,L,R){let U;return U=f(S,E,L,R).length>0?E-n(E,L):T,I<S&&U<=E||I>=S&&U<E?"C":"D"})(m,k,B,O,H,A);return p(v(m,W,B,P,M==="C",H).length,w(M,A))})(g,C,c,d,l,u);let b;if(C===d)return b=g>c?"D":"C",p(Math.abs(g-c),w(b,u));b=C>d?"D":"C";let y=Math.abs(C-d);return p((function(m,k){return k.cols-m})(C>d?c:g,l)+(y-1)*l.cols+1+((C>d?g:c)-1),w(b,u))}},1296:function(h,r,s){var a=this&&this.__decorate||function(A,W,P,M){var I,T=arguments.length,S=T<3?W:M===null?M=Object.getOwnPropertyDescriptor(W,P):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(A,W,P,M);else for(var E=A.length-1;E>=0;E--)(I=A[E])&&(S=(T<3?I(S):T>3?I(W,P,S):I(W,P))||S);return T>3&&S&&Object.defineProperty(W,P,S),S},f=this&&this.__param||function(A,W){return function(P,M){W(P,M,A)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let n=s(3787),_=s(2550),v=s(2223),w=s(6171),p=s(6052),c=s(4725),d=s(8055),l=s(8460),u=s(844),g=s(2585),C="xterm-dom-renderer-owner-",b="xterm-rows",y="xterm-fg-",m="xterm-bg-",k="xterm-focus",B="xterm-selection",O=1,H=r.DomRenderer=class extends u.Disposable{constructor(A,W,P,M,I,T,S,E,L,R,U,K,Y){super(),this._terminal=A,this._document=W,this._element=P,this._screenElement=M,this._viewportElement=I,this._helperContainer=T,this._linkifier2=S,this._charSizeService=L,this._optionsService=R,this._bufferService=U,this._coreBrowserService=K,this._themeService=Y,this._terminalClass=O++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(b),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((z=>this._injectCss(z)))),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((z=>this._handleLinkHover(z)))),this.register(this._linkifier2.onHideLinkUnderline((z=>this._handleLinkLeave(z)))),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 A=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*A,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*A),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/A),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/A),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 P of this._rowElements)P.style.width=`${this.dimensions.css.canvas.width}px`,P.style.height=`${this.dimensions.css.cell.height}px`,P.style.lineHeight=`${this.dimensions.css.cell.height}px`,P.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let W=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=W,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(A){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let W=`${this._terminalSelector} .${b} { color: ${A.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;W+=`${this._terminalSelector} .${b} .xterm-dim { color: ${d.color.multiplyOpacity(A.foreground,.5).css};}`,W+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let P=`blink_underline_${this._terminalClass}`,M=`blink_bar_${this._terminalClass}`,I=`blink_block_${this._terminalClass}`;W+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,W+=`@keyframes ${M} { 50% { box-shadow: none; }}`,W+=`@keyframes ${I} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,W+=`${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${M} 1s step-end infinite;}${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,W+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${A.selectionInactiveBackgroundOpaque.css};}`;for(let[T,S]of A.ansi.entries())W+=`${this._terminalSelector} .${y}${T} { color: ${S.css}; }${this._terminalSelector} .${y}${T}.xterm-dim { color: ${d.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${m}${T} { background-color: ${S.css}; }`;W+=`${this._terminalSelector} .${y}${v.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(A.background).css}; }${this._terminalSelector} .${y}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=W}_setDefaultSpacing(){let A=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${A}px`,this._rowFactory.defaultSpacing=A}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(A,W){for(let P=this._rowElements.length;P<=W;P++){let M=this._document.createElement("div");this._rowContainer.appendChild(M),this._rowElements.push(M)}for(;this._rowElements.length>W;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,W){this._refreshRowElements(A,W),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(k),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(k),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,W,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,W,P),this.renderRows(0,this._bufferService.rows-1),!A||!W)return;this._selectionRenderModel.update(this._terminal,A,W,P);let M=this._selectionRenderModel.viewportStartRow,I=this._selectionRenderModel.viewportEndRow,T=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if(T>=this._bufferService.rows||S<0)return;let E=this._document.createDocumentFragment();if(P){let L=A[0]>W[0];E.appendChild(this._createSelectionElement(T,L?W[0]:A[0],L?A[0]:W[0],S-T+1))}else{let L=M===T?A[0]:0,R=T===I?W[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(T,L,R));let U=S-T-1;if(E.appendChild(this._createSelectionElement(T+1,0,this._bufferService.cols,U)),T!==S){let K=I===S?W[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(S,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(A,W,P,M=1){let I=this._document.createElement("div"),T=W*this.dimensions.css.cell.width,S=this.dimensions.css.cell.width*(P-W);return T+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-T),I.style.height=M*this.dimensions.css.cell.height+"px",I.style.top=A*this.dimensions.css.cell.height+"px",I.style.left=`${T}px`,I.style.width=`${S}px`,I}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 A of this._rowElements)A.replaceChildren()}renderRows(A,W){let P=this._bufferService.buffer,M=P.ybase+P.y,I=Math.min(P.x,this._bufferService.cols-1),T=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=A;L<=W;L++){let R=L+P.ydisp,U=this._rowElements[L],K=P.lines.get(R);if(!U||!K)break;U.replaceChildren(...this._rowFactory.createRow(K,R,R===M,S,E,I,T,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!0)}_handleLinkLeave(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!1)}_setCellUnderline(A,W,P,M,I,T){P<0&&(A=0),M<0&&(W=0);let S=this._bufferService.rows-1;P=Math.max(Math.min(P,S),0),M=Math.max(Math.min(M,S),0),I=Math.min(I,this._bufferService.cols);let E=this._bufferService.buffer,L=E.ybase+E.y,R=Math.min(E.x,I-1),U=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=P;z<=M;++z){let D=z+E.ydisp,x=this._rowElements[z],N=E.lines.get(D);if(!x||!N)break;x.replaceChildren(...this._rowFactory.createRow(N,D,D===L,K,Y,R,U,this.dimensions.css.cell.width,this._widthCache,T?z===P?A:0:-1,T?(z===M?W:I)-1:-1))}}};r.DomRenderer=H=a([f(7,g.IInstantiationService),f(8,c.ICharSizeService),f(9,g.IOptionsService),f(10,g.IBufferService),f(11,c.ICoreBrowserService),f(12,c.IThemeService)],H)},3787:function(h,r,s){var a=this&&this.__decorate||function(b,y,m,k){var B,O=arguments.length,H=O<3?y:k===null?k=Object.getOwnPropertyDescriptor(y,m):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(b,y,m,k);else for(var A=b.length-1;A>=0;A--)(B=b[A])&&(H=(O<3?B(H):O>3?B(y,m,H):B(y,m))||H);return O>3&&H&&Object.defineProperty(y,m,H),H},f=this&&this.__param||function(b,y){return function(m,k){y(m,k,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let n=s(2223),_=s(643),v=s(511),w=s(2585),p=s(8055),c=s(4725),d=s(4269),l=s(6171),u=s(3734),g=r.DomRendererRowFactory=class{constructor(b,y,m,k,B,O,H){this._document=b,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=k,this._coreService=B,this._decorationService=O,this._themeService=H,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,y,m){this._selectionStart=b,this._selectionEnd=y,this._columnSelectMode=m}createRow(b,y,m,k,B,O,H,A,W,P,M){let I=[],T=this._characterJoinerService.getJoinedCharacters(y),S=this._themeService.colors,E,L=b.getNoBgTrimmedLength();m&&L<O+1&&(L=O+1);let R=0,U="",K=0,Y=0,z=0,D=!1,x=0,N=!1,F=0,j=[],q=P!==-1&&M!==-1;for(let Z=0;Z<L;Z++){b.loadCell(Z,this._workCell);let G=this._workCell.getWidth();if(G===0)continue;let X=!1,Q=Z,ee=this._workCell;if(T.length>0&&Z===T[0][0]){X=!0;let ae=T.shift();ee=new d.JoinedCellData(this._workCell,b.translateToString(!0,ae[0],ae[1]),ae[1]-ae[0]),Q=ae[1]-1,G=ee.getWidth()}let ne=this._isCellInSelection(Z,y),ue=m&&Z===O,be=q&&Z>=P&&Z<=M,fe=!1;this._decorationService.forEachDecorationAtCell(Z,y,void 0,(ae=>{fe=!0}));let Te=ee.getChars()||_.WHITESPACE_CELL_CHAR;if(Te===" "&&(ee.isUnderline()||ee.isOverline())&&(Te="\xA0"),F=G*A-W.get(Te,ee.isBold(),ee.isItalic()),E){if(R&&(ne&&N||!ne&&!N&&ee.bg===K)&&(ne&&N&&S.selectionForeground||ee.fg===Y)&&ee.extended.ext===z&&be===D&&F===x&&!ue&&!X&&!fe){ee.isInvisible()?U+=_.WHITESPACE_CELL_CHAR:U+=Te,R++;continue}R&&(E.textContent=U),E=this._document.createElement("span"),R=0,U=""}else E=this._document.createElement("span");if(K=ee.bg,Y=ee.fg,z=ee.extended.ext,D=be,x=F,N=ne,X&&O>=Z&&O<=Q&&(O=Z),!this._coreService.isCursorHidden&&ue&&this._coreService.isCursorInitialized){if(j.push("xterm-cursor"),this._coreBrowserService.isFocused)H&&j.push("xterm-cursor-blink"),j.push(k==="bar"?"xterm-cursor-bar":k==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":j.push("xterm-cursor-outline");break;case"block":j.push("xterm-cursor-block");break;case"bar":j.push("xterm-cursor-bar");break;case"underline":j.push("xterm-cursor-underline")}}if(ee.isBold()&&j.push("xterm-bold"),ee.isItalic()&&j.push("xterm-italic"),ee.isDim()&&j.push("xterm-dim"),U=ee.isInvisible()?_.WHITESPACE_CELL_CHAR:ee.getChars()||_.WHITESPACE_CELL_CHAR,ee.isUnderline()&&(j.push(`xterm-underline-${ee.extended.underlineStyle}`),U===" "&&(U="\xA0"),!ee.isUnderlineColorDefault()))if(ee.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(ee.getUnderlineColor()).join(",")})`;else{let ae=ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ee.isBold()&&ae<8&&(ae+=8),E.style.textDecorationColor=S.ansi[ae].css}ee.isOverline()&&(j.push("xterm-overline"),U===" "&&(U="\xA0")),ee.isStrikethrough()&&j.push("xterm-strikethrough"),be&&(E.style.textDecoration="underline");let $=ee.getFgColor(),V=ee.getFgColorMode(),J=ee.getBgColor(),te=ee.getBgColorMode(),oe=!!ee.isInverse();if(oe){let ae=$;$=J,J=ae;let ya=V;V=te,te=ya}let le,ve,ie,ge=!1;switch(this._decorationService.forEachDecorationAtCell(Z,y,void 0,(ae=>{ae.options.layer!=="top"&&ge||(ae.backgroundColorRGB&&(te=50331648,J=ae.backgroundColorRGB.rgba>>8&16777215,le=ae.backgroundColorRGB),ae.foregroundColorRGB&&(V=50331648,$=ae.foregroundColorRGB.rgba>>8&16777215,ve=ae.foregroundColorRGB),ge=ae.options.layer==="top")})),!ge&&ne&&(le=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,J=le.rgba>>8&16777215,te=50331648,ge=!0,S.selectionForeground&&(V=50331648,$=S.selectionForeground.rgba>>8&16777215,ve=S.selectionForeground)),ge&&j.push("xterm-decoration-top"),te){case 16777216:case 33554432:ie=S.ansi[J],j.push(`xterm-bg-${J}`);break;case 50331648:ie=p.channels.toColor(J>>16,J>>8&255,255&J),this._addStyle(E,`background-color:#${C((J>>>0).toString(16),"0",6)}`);break;default:oe?(ie=S.foreground,j.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):ie=S.background}switch(le||ee.isDim()&&(le=p.color.multiplyOpacity(ie,.5)),V){case 16777216:case 33554432:ee.isBold()&&$<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&($+=8),this._applyMinimumContrast(E,ie,S.ansi[$],ee,le,void 0)||j.push(`xterm-fg-${$}`);break;case 50331648:let ae=p.channels.toColor($>>16&255,$>>8&255,255&$);this._applyMinimumContrast(E,ie,ae,ee,le,ve)||this._addStyle(E,`color:#${C($.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ie,S.foreground,ee,le,ve)||oe&&j.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}j.length&&(E.className=j.join(" "),j.length=0),ue||X||fe?E.textContent=U:R++,F!==this.defaultSpacing&&(E.style.letterSpacing=`${F}px`),I.push(E),Z=Q}return E&&R&&(E.textContent=U),I}_applyMinimumContrast(b,y,m,k,B,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(k.getCode()))return!1;let H=this._getContrastCache(k),A;if(B||O||(A=H.getColor(y.rgba,m.rgba)),A===void 0){let W=this._optionsService.rawOptions.minimumContrastRatio/(k.isDim()?2:1);A=p.color.ensureContrastRatio(B||y,O||m,W),H.setColor((B||y).rgba,(O||m).rgba,A??null)}return!!A&&(this._addStyle(b,`color:${A.css}`),!0)}_getContrastCache(b){return b.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(b,y){b.setAttribute("style",`${b.getAttribute("style")||""}${y};`)}_isCellInSelection(b,y){let m=this._selectionStart,k=this._selectionEnd;return!(!m||!k)&&(this._columnSelectMode?m[0]<=k[0]?b>=m[0]&&y>=m[1]&&b<k[0]&&y<=k[1]:b<m[0]&&y>=m[1]&&b>=k[0]&&y<=k[1]:y>m[1]&&y<k[1]||m[1]===k[1]&&y===m[1]&&b>=m[0]&&b<k[0]||m[1]<k[1]&&y===k[1]&&b<k[0]||m[1]<k[1]&&y===m[1]&&b>=m[0])}};function C(b,y,m){for(;b.length<m;)b=y+b;return b}r.DomRendererRowFactory=g=a([f(1,c.ICharacterJoinerService),f(2,w.IOptionsService),f(3,c.ICoreBrowserService),f(4,w.ICoreService),f(5,w.IDecorationService),f(6,c.IThemeService)],g)},2550:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(s,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=s.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let f=s.createElement("span");f.classList.add("xterm-char-measure-element");let n=s.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let _=s.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let v=s.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,n,_,v],this._container.appendChild(f),this._container.appendChild(n),this._container.appendChild(_),this._container.appendChild(v),a.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(s,a,f,n){s===this._font&&a===this._fontSize&&f===this._weight&&n===this._weightBold||(this._font=s,this._fontSize=a,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(s,a,f){let n=0;if(!a&&!f&&s.length===1&&(n=s.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let w=this._measure(s,0);return w>0&&(this._flat[n]=w),w}let _=s;a&&(_+="B"),f&&(_+="I");let v=this._holey.get(_);if(v===void 0){let w=0;a&&(w|=1),f&&(w|=2),v=this._measure(s,w),v>0&&this._holey.set(_,v)}return v}_measure(s,a){let f=this._measureElements[a];return f.textContent=s.repeat(32),f.offsetWidth/32}}},2223:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let a=s(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(h,r)=>{function s(f){return 57508<=f&&f<=57558}function a(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},r.isPowerlineGlyph=s,r.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},r.isEmoji=a,r.allowRescaling=function(f,n,_,v){return n===1&&_>Math.ceil(1.5*v)&&f!==void 0&&f>255&&!a(f)&&!s(f)&&!(function(w){return 57344<=w&&w<=63743})(f)},r.treatGlyphAsBackgroundColor=function(f){return s(f)||(function(n){return 9472<=n&&n<=9631})(f)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(f,n,_=0){return(f-(2*Math.round(n)-_))%(2*Math.round(n))}},6052:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class s{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,n,_,v=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();let w=f.buffers.active.ydisp,p=n[1]-w,c=_[1]-w,d=Math.max(p,0),l=Math.min(c,f.rows-1);d>=f.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=l,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)}}r.createSelectionRenderModel=function(){return new s}},456:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(s){this._bufferService=s,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?s%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)-1]:[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[s,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[Math.max(s,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let s=this.selectionStart,a=this.selectionEnd;return!(!s||!a)&&(s[1]>a[1]||s[1]===a[1]&&s[0]>a[0])}handleTrim(s){return this.selectionStart&&(this.selectionStart[1]-=s),this.selectionEnd&&(this.selectionEnd[1]-=s),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,r,s){var a=this&&this.__decorate||function(l,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,g,C);else for(var k=l.length-1;k>=0;k--)(b=l[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},f=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let n=s(2585),_=s(8460),v=s(844),w=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,u,g){super(),this._optionsService=g,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 c(l,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};r.CharSizeService=w=a([f(2,n.IOptionsService)],w);class p extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,g){u!==void 0&&u>0&&g!==void 0&&g>0&&(this._result.width=u,this._result.height=g)}}class c extends p{constructor(u,g,C){super(),this._document=u,this._parentElement=g,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 p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let g=this._ctx.measureText("W");if(!("width"in g&&"fontBoundingBoxAscent"in g&&"fontBoundingBoxDescent"in g))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,r,s){var a=this&&this.__decorate||function(d,l,u,g){var C,b=arguments.length,y=b<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(b<3?C(y):b>3?C(l,u,y):C(l,u))||y);return b>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,g){l(u,g,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let n=s(3734),_=s(643),v=s(511),w=s(2585);class p extends n.AttributeData{constructor(l,u,g){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=u,this._width=g}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=p;let c=r.CharacterJoinerService=class Is{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(l){let u={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(u),u.id}deregister(l){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===l)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];let u=this._bufferService.buffer.lines.get(l);if(!u||u.length===0)return[];let g=[],C=u.translateToString(!0),b=0,y=0,m=0,k=u.getFg(0),B=u.getBg(0);for(let O=0;O<u.getTrimmedLength();O++)if(u.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==k||this._workCell.bg!==B){if(O-b>1){let H=this._getJoinedRanges(C,m,y,u,b);for(let A=0;A<H.length;A++)g.push(H[A])}b=O,m=y,k=this._workCell.fg,B=this._workCell.bg}y+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){let O=this._getJoinedRanges(C,m,y,u,b);for(let H=0;H<O.length;H++)g.push(O[H])}return g}_getJoinedRanges(l,u,g,C,b){let y=l.substring(u,g),m=[];try{m=this._characterJoiners[0].handler(y)}catch(k){console.error(k)}for(let k=1;k<this._characterJoiners.length;k++)try{let B=this._characterJoiners[k].handler(y);for(let O=0;O<B.length;O++)Is._mergeRanges(m,B[O])}catch(B){console.error(B)}return this._stringRangesToCellRanges(m,C,b),m}_stringRangesToCellRanges(l,u,g){let C=0,b=!1,y=0,m=l[C];if(m){for(let k=g;k<this._bufferService.cols;k++){let B=u.getWidth(k),O=u.getString(k).length||_.WHITESPACE_CELL_CHAR.length;if(B!==0){if(!b&&m[0]<=y&&(m[0]=k,b=!0),m[1]<=y){if(m[1]=k,m=l[++C],!m)break;m[0]<=y?(m[0]=k,b=!0):b=!1}y+=O}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(l,u){let g=!1;for(let C=0;C<l.length;C++){let b=l[C];if(g){if(u[1]<=b[0])return l[C-1][1]=u[1],l;if(u[1]<=b[1])return l[C-1][1]=Math.max(u[1],b[1]),l.splice(C,1),l;l.splice(C,1),C--}else{if(u[1]<=b[0])return l.splice(C,0,u),l;if(u[1]<=b[1])return b[0]=Math.min(u[0],b[0]),l;u[0]<b[1]&&(b[0]=Math.min(u[0],b[0]),g=!0)}}return g?l[l.length-1][1]=u[1]:l.push(u),l}};r.CharacterJoinerService=c=a([f(0,w.IBufferService)],c)},5114:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let a=s(844),f=s(8460),n=s(3656);class _ extends a.Disposable{constructor(p,c,d){super(),this._textarea=p,this._window=c,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((l=>this._screenDprMonitor.setWindow(l)))),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(p){this._window!==p&&(this._window=p,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}r.CoreBrowserService=_;class v extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.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,a.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let a=s(844);class f extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}r.LinkProviderService=f},8934:function(h,r,s){var a=this&&this.__decorate||function(w,p,c,d){var l,u=arguments.length,g=u<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,c):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(w,p,c,d);else for(var C=w.length-1;C>=0;C--)(l=w[C])&&(g=(u<3?l(g):u>3?l(p,c,g):l(p,c))||g);return u>3&&g&&Object.defineProperty(p,c,g),g},f=this&&this.__param||function(w,p){return function(c,d){p(c,d,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let n=s(4725),_=s(9806),v=r.MouseService=class{constructor(w,p){this._renderService=w,this._charSizeService=p}getCoords(w,p,c,d,l){return(0,_.getCoords)(window,w,p,c,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(w,p){let c=(0,_.getCoordsRelativeToElement)(window,w,p);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};r.MouseService=v=a([f(0,n.IRenderService),f(1,n.ICharSizeService)],v)},3230:function(h,r,s){var a=this&&this.__decorate||function(l,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,g,C);else for(var k=l.length-1;k>=0;k--)(b=l[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},f=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let n=s(6193),_=s(4725),v=s(8460),w=s(844),p=s(7226),c=s(2585),d=r.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,g,C,b,y,m,k){super(),this._rowCount=l,this._charSizeService=C,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((B,O)=>this._renderRows(B,O)),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(g.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(b.onDecorationRegistered((()=>this._fullRefresh()))),this.register(b.onDecorationRemoved((()=>this._fullRefresh()))),this.register(g.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(y.cols,y.rows),this._fullRefresh()}))),this.register(g.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(y.buffer.y,y.buffer.y,!0)))),this.register(k.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange((B=>this._registerIntersectionObserver(B,u))))}_registerIntersectionObserver(l,u){if("IntersectionObserver"in l){let g=new l.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});g.observe(u),this._observerDisposable.value=(0,w.toDisposable)((()=>g.disconnect()))}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.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(l,u,g=!1){this._isPaused?this._needsFullRefresh=!0:(g||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,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:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,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(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_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(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(l,u))):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(l,u,g){this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=g,this._renderer.value?.handleSelectionChanged(l,u,g)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=d=a([f(2,c.IOptionsService),f(3,_.ICharSizeService),f(4,c.IDecorationService),f(5,c.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],d)},9312:function(h,r,s){var a=this&&this.__decorate||function(m,k,B,O){var H,A=arguments.length,W=A<3?k:O===null?O=Object.getOwnPropertyDescriptor(k,B):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(m,k,B,O);else for(var P=m.length-1;P>=0;P--)(H=m[P])&&(W=(A<3?H(W):A>3?H(k,B,W):H(k,B))||W);return A>3&&W&&Object.defineProperty(k,B,W),W},f=this&&this.__param||function(m,k){return function(B,O){k(B,O,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let n=s(9806),_=s(9504),v=s(456),w=s(4725),p=s(8460),c=s(844),d=s(6114),l=s(4841),u=s(511),g=s(2585),C="\xA0",b=new RegExp(C,"g"),y=r.SelectionService=class extends c.Disposable{constructor(m,k,B,O,H,A,W,P,M){super(),this._element=m,this._screenElement=k,this._linkifier=B,this._bufferService=O,this._coreService=H,this._mouseService=A,this._optionsService=W,this._renderService=P,this._coreBrowserService=M,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=I=>this._handleMouseMove(I),this._mouseUpListener=I=>this._handleMouseUp(I),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((I=>this._handleTrim(I))),this.register(this._bufferService.buffers.onBufferActivate((I=>this._handleBufferActivate(I)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,c.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,k=this._model.finalSelectionEnd;return!(!m||!k||m[0]===k[0]&&m[1]===k[1])}get selectionText(){let m=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;if(!m||!k)return"";let B=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(m[0]===k[0])return"";let H=m[0]<k[0]?m[0]:k[0],A=m[0]<k[0]?k[0]:m[0];for(let W=m[1];W<=k[1];W++){let P=B.translateBufferLineToString(W,!0,H,A);O.push(P)}}else{let H=m[1]===k[1]?k[0]:void 0;O.push(B.translateBufferLineToString(m[1],!0,m[0],H));for(let A=m[1]+1;A<=k[1]-1;A++){let W=B.lines.get(A),P=B.translateBufferLineToString(A,!0);W?.isWrapped?O[O.length-1]+=P:O.push(P)}if(m[1]!==k[1]){let A=B.lines.get(k[1]),W=B.translateBufferLineToString(k[1],!0,0,k[0]);A&&A.isWrapped?O[O.length-1]+=W:O.push(W)}}return O.map((H=>H.replace(b," "))).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 k=this._getMouseBufferCoords(m),B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(B&&P&&k)&&this._areCoordsInSelection(k,B,P)}isCellInSelection(m,k){let B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!B||!P)&&this._areCoordsInSelection([m,k],B,P)}_areCoordsInSelection(m,k,B){return m[1]>k[1]&&m[1]<B[1]||k[1]===B[1]&&m[1]===k[1]&&m[0]>=k[0]&&m[0]<B[0]||k[1]<B[1]&&m[1]===B[1]&&m[0]<B[0]||k[1]<B[1]&&m[1]===k[1]&&m[0]>=k[0]}_selectWordAtCursor(m,k){let B=this._linkifier.currentLink?.link?.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,a.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let P=this._getMouseBufferCoords(m);return!!P&&(this._selectWordAt(P,k),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,k){this._model.clearSelection(),m=Math.max(m,0),k=Math.min(k,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,k],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let k=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(k)return k[0]--,k[1]--,k[1]+=this._bufferService.buffer.ydisp,k}_getMouseEventScrollAmount(m){let k=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],B=this._renderService.dimensions.css.canvas.height;return k>=0&&k<=B?0:(k>B&&(k-=B),k=Math.min(Math.max(k,-50),50),k/=50,k/Math.abs(k)+Math.round(14*k))}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 k=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);k&&k.length!==this._model.selectionStart[0]&&k.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let k=this._getMouseBufferCoords(m);k&&(this._activeSelectionMode=2,this._selectLineAt(k[1]))}shouldColumnSelect(m){return m.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let k=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 B=this._bufferService.buffer;if(this._model.selectionEnd[1]<B.lines.length){let P=B.lines.get(this._model.selectionEnd[1]);P&&P.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}k&&k[0]===this._model.selectionEnd[0]&&k[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 k=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&k<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let B=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){let P=(0,f.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,k=this._model.finalSelectionEnd,B=!(!m||!k||m[0]===k[0]&&m[1]===k[1]);B?m&&k&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&k[0]===this._oldSelectionEnd[0]&&k[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,k,B)):this._oldHasSelection&&this._fireOnSelectionChange(m,k,B)}_fireOnSelectionChange(m,k,B){this._oldSelectionStart=m,this._oldSelectionEnd=k,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((k=>this._handleTrim(k)))}_convertViewportColToCharacterIndex(m,k){let B=k;for(let P=0;k>=P;P++){let H=m.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:H>1&&k!==P&&(B+=H-1)}return B}setSelection(m,k,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,k],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,k,B=!0,P=!0){if(m[0]>=this._bufferService.cols)return;let H=this._bufferService.buffer,A=H.lines.get(m[1]);if(!A)return;let F=H.translateBufferLineToString(m[1],!1),O=this._convertViewportColToCharacterIndex(A,m[0]),T=O,I=m[0]-O,R=0,S=0,E=0,L=0;if(F.charAt(O)===" "){for(;O>0&&F.charAt(O-1)===" ";)O--;for(;T<F.length&&F.charAt(T+1)===" ";)T++}else{let q=m[0],Y=m[0];A.getWidth(q)===0&&(R++,q--),A.getWidth(Y)===2&&(S++,Y++);let z=A.getString(Y).length;for(z>1&&(L+=z-1,T+=z-1);q>0&&O>0&&!this._isCharWordSeparator(A.loadCell(q-1,this._workCell));){A.loadCell(q-1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===0?(R++,q--):D>1&&(E+=D-1,O-=D-1),O--,q--}for(;Y<A.length&&T+1<F.length&&!this._isCharWordSeparator(A.loadCell(Y+1,this._workCell));){A.loadCell(Y+1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,Y++):D>1&&(L+=D-1,T+=D-1),T++,Y++}}T++;let M=O+I-R+E,U=Math.min(this._bufferService.cols,T-O+R+S-E-L);if(k||F.slice(O,T).trim()!==""){if(B&&M===0&&A.getCodePoint(0)!==32){let q=H.lines.get(m[1]-1);if(q&&A.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){let Y=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(Y){let z=this._bufferService.cols-Y.start;M-=z,U+=z}}}if(P&&M+U===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let q=H.lines.get(m[1]+1);if(q?.isWrapped&&q.getCodePoint(0)!==32){let Y=this._getWordAt([0,m[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:M,length:U}}}_selectWordAt(m,k){let B=this._getWordAt(m,k);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[B.start,m[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(m){let k=this._getWordAt(m,!0);if(k){let B=m[1];for(;k.start<0;)k.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;k.start+k.length>this._bufferService.cols;)k.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?k.start:k.start+k.length,B]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let k=this._bufferService.buffer.getWrappedRangeForLine(m),B={start:{x:0,y:k.first},end:{x:this._bufferService.cols-1,y:k.last}};this._model.selectionStart=[0,k.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,a.getRangeLength)(B,this._bufferService.cols)}};s.SelectionService=y=o([_(3,g.IBufferService),_(4,g.ICoreService),_(5,w.IMouseService),_(6,g.IOptionsService),_(7,w.IRenderService),_(8,w.ICoreBrowserService)],y)},4725:(h,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 o=r(8343);s.ICharSizeService=(0,o.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,o.createDecorator)("CoreBrowserService"),s.IMouseService=(0,o.createDecorator)("MouseService"),s.IRenderService=(0,o.createDecorator)("RenderService"),s.ISelectionService=(0,o.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,o.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,o.createDecorator)("ThemeService"),s.ILinkProviderService=(0,o.createDecorator)("LinkProviderService")},6731:function(h,s,r){var o=this&&this.__decorate||function(y,m,k,B){var P,H=arguments.length,A=H<3?m:B===null?B=Object.getOwnPropertyDescriptor(m,k):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,m,k,B);else for(var F=y.length-1;F>=0;F--)(P=y[F])&&(A=(H<3?P(A):H>3?P(m,k,A):P(m,k))||A);return H>3&&A&&Object.defineProperty(m,k,A),A},_=this&&this.__param||function(y,m){return function(k,B){m(k,B,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let n=r(7239),f=r(8055),v=r(8460),w=r(844),p=r(2585),c=f.css.toColor("#ffffff"),d=f.css.toColor("#000000"),a=f.css.toColor("#ffffff"),u=f.css.toColor("#000000"),g={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.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 k=0;k<216;k++){let B=m[k/36%6|0],P=m[k/6%6|0],H=m[k%6];y.push({css:f.channels.toCss(B,P,H),rgba:f.channels.toRgba(B,P,H)})}for(let k=0;k<24;k++){let B=8+10*k;y.push({css:f.channels.toCss(B,B,B),rgba:f.channels.toRgba(B,B,B)})}return y})());let C=s.ThemeService=class extends w.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 v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:d,cursor:a,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:g,selectionBackgroundOpaque:f.color.blend(d,g),selectionInactiveBackgroundTransparent:g,selectionInactiveBackgroundOpaque:f.color.blend(d,g),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=b(y.foreground,c),m.background=b(y.background,d),m.cursor=b(y.cursor,a),m.cursorAccent=b(y.cursorAccent,u),m.selectionBackgroundTransparent=b(y.selectionBackground,g),m.selectionBackgroundOpaque=f.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=b(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=f.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?b(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=s.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=b(y.black,s.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=b(y.red,s.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=b(y.green,s.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=b(y.yellow,s.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=b(y.blue,s.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=b(y.magenta,s.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=b(y.cyan,s.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=b(y.white,s.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=b(y.brightBlack,s.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=b(y.brightRed,s.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=b(y.brightGreen,s.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=b(y.brightYellow,s.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=b(y.brightBlue,s.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=b(y.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=b(y.brightCyan,s.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=b(y.brightWhite,s.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let k=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let B=0;B<k;B++)m.ansi[B+16]=b(y.extendedAnsi[B],s.DEFAULT_ANSI_COLORS[B+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 b(y,m){if(y!==void 0)try{return f.css.toColor(y)}catch{}return m}s.ThemeService=C=o([_(0,p.IOptionsService)],C)},6349:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let o=r(8460),_=r(844);class n extends _.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new o.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new o.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new o.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;let w=new Array(v);for(let p=0;p<Math.min(v,this.length);p++)w[p]=this._array[this._getCyclicIndex(p)];this._array=w,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let w=this._length;w<v;w++)this._array[w]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,w){this._array[this._getCyclicIndex(v)]=w}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,w,...p){if(w){for(let c=v;c<this._length-w;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+w)];this._length-=w,this.onDeleteEmitter.fire({index:v,amount:w})}for(let c=this._length-1;c>=v;c--)this._array[this._getCyclicIndex(c+p.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<p.length;c++)this._array[this._getCyclicIndex(v+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:v,amount:p.length}),this._length+p.length>this._maxLength){let c=this._length+p.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=p.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,w,p){if(!(w<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let d=w-1;d>=0;d--)this.set(v+d+p,this.get(v+d));let c=v+w+p-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<w;c++)this.set(v+c+p,this.get(v+c))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}s.CircularList=n},1439:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function r(o,_=5){if(typeof o!="object")return o;let n=Array.isArray(o)?[]:{};for(let f in o)n[f]=_<=1?o[f]:o[f]&&r(o[f],_-1);return n}},8055:(h,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,o=0,_=0,n=0;var f,v,w,p,c;function d(u){let g=u.toString(16);return g.length<2?"0"+g:g}function a(u,g){return u<g?(g+.05)/(u+.05):(u+.05)/(g+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(g,C,b,y){return y!==void 0?`#${d(g)}${d(C)}${d(b)}${d(y)}`:`#${d(g)}${d(C)}${d(b)}`},u.toRgba=function(g,C,b,y=255){return(g<<24|C<<16|b<<8|y)>>>0},u.toColor=function(g,C,b,y){return{css:u.toCss(g,C,b,y),rgba:u.toRgba(g,C,b,y)}}})(f||(s.channels=f={})),(function(u){function g(C,b){return n=Math.round(255*b),[r,o,_]=c.toChannels(C.rgba),{css:f.toCss(r,o,_,n),rgba:f.toRgba(r,o,_,n)}}u.blend=function(C,b){if(n=(255&b.rgba)/255,n===1)return{css:b.css,rgba:b.rgba};let y=b.rgba>>24&255,m=b.rgba>>16&255,k=b.rgba>>8&255,B=C.rgba>>24&255,P=C.rgba>>16&255,H=C.rgba>>8&255;return r=B+Math.round((y-B)*n),o=P+Math.round((m-P)*n),_=H+Math.round((k-H)*n),{css:f.toCss(r,o,_),rgba:f.toRgba(r,o,_)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,b,y){let m=c.ensureContrastRatio(C.rgba,b.rgba,y);if(m)return f.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let b=(255|C.rgba)>>>0;return[r,o,_]=c.toChannels(b),{css:f.toCss(r,o,_),rgba:b}},u.opacity=g,u.multiplyOpacity=function(C,b){return n=255&C.rgba,g(C,n*b/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(v||(s.color=v={})),(function(u){let g,C;try{let b=document.createElement("canvas");b.width=1,b.height=1;let y=b.getContext("2d",{willReadFrequently:!0});y&&(g=y,g.globalCompositeOperation="copy",C=g.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return r=parseInt(b.slice(1,2).repeat(2),16),o=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),f.toColor(r,o,_);case 5:return r=parseInt(b.slice(1,2).repeat(2),16),o=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),n=parseInt(b.slice(4,5).repeat(2),16),f.toColor(r,o,_,n);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}let y=b.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]),o=parseInt(y[2]),_=parseInt(y[3]),n=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),f.toColor(r,o,_,n);if(!g||!C)throw new Error("css.toColor: Unsupported css format");if(g.fillStyle=C,g.fillStyle=b,typeof g.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(g.fillRect(0,0,1,1),[r,o,_,n]=g.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(r,o,_,n),css:b}}})(w||(s.css=w={})),(function(u){function g(C,b,y){let m=C/255,k=b/255,B=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}u.relativeLuminance=function(C){return g(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=g})(p||(s.rgb=p={})),(function(u){function g(b,y,m){let k=b>>24&255,B=b>>16&255,P=b>>8&255,H=y>>24&255,A=y>>16&255,F=y>>8&255,O=a(p.relativeLuminance2(H,A,F),p.relativeLuminance2(k,B,P));for(;O<m&&(H>0||A>0||F>0);)H-=Math.max(0,Math.ceil(.1*H)),A-=Math.max(0,Math.ceil(.1*A)),F-=Math.max(0,Math.ceil(.1*F)),O=a(p.relativeLuminance2(H,A,F),p.relativeLuminance2(k,B,P));return(H<<24|A<<16|F<<8|255)>>>0}function C(b,y,m){let k=b>>24&255,B=b>>16&255,P=b>>8&255,H=y>>24&255,A=y>>16&255,F=y>>8&255,O=a(p.relativeLuminance2(H,A,F),p.relativeLuminance2(k,B,P));for(;O<m&&(H<255||A<255||F<255);)H=Math.min(255,H+Math.ceil(.1*(255-H))),A=Math.min(255,A+Math.ceil(.1*(255-A))),F=Math.min(255,F+Math.ceil(.1*(255-F))),O=a(p.relativeLuminance2(H,A,F),p.relativeLuminance2(k,B,P));return(H<<24|A<<16|F<<8|255)>>>0}u.blend=function(b,y){if(n=(255&y)/255,n===1)return y;let m=y>>24&255,k=y>>16&255,B=y>>8&255,P=b>>24&255,H=b>>16&255,A=b>>8&255;return r=P+Math.round((m-P)*n),o=H+Math.round((k-H)*n),_=A+Math.round((B-A)*n),f.toRgba(r,o,_)},u.ensureContrastRatio=function(b,y,m){let k=p.relativeLuminance(b>>8),B=p.relativeLuminance(y>>8);if(a(k,B)<m){if(B<k){let A=g(b,y,m),F=a(k,p.relativeLuminance(A>>8));if(F<m){let O=C(b,y,m);return F>a(k,p.relativeLuminance(O>>8))?A:O}return A}let P=C(b,y,m),H=a(k,p.relativeLuminance(P>>8));if(H<m){let A=g(b,y,m);return H>a(k,p.relativeLuminance(A>>8))?P:A}return P}},u.reduceLuminance=g,u.increaseLuminance=C,u.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}})(c||(s.rgba=c={})),s.toPaddedHex=d,s.contrastRatio=a},8969:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let o=r(844),_=r(2585),n=r(4348),f=r(7866),v=r(744),w=r(7302),p=r(6975),c=r(8460),d=r(1753),a=r(1480),u=r(7994),g=r(9282),C=r(5435),b=r(5981),y=r(2660),m=!1;class k extends o.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((P=>{this._onScrollApi?.fire(P.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(P){for(let H in P)this.optionsService.options[H]=P[H]}constructor(P){super(),this._windowsWrappingHeuristics=this.register(new o.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new w.OptionsService(P)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.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(a.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,c.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,c.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,c.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,c.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 b.WriteBuffer(((H,A)=>this._inputHandler.parse(H,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,H){this._writeBuffer.write(P,H)}writeSync(P,H){this._logService.logLevel<=_.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(P,H)}input(P,H=!0){this.coreService.triggerDataEvent(P,H)}resize(P,H){isNaN(P)||isNaN(H)||(P=Math.max(P,v.MINIMUM_COLS),H=Math.max(H,v.MINIMUM_ROWS),this._bufferService.resize(P,H))}scroll(P,H=!1){this._bufferService.scroll(P,H)}scrollLines(P,H,A){this._bufferService.scrollLines(P,H,A)}scrollPages(P){this.scrollLines(P*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(P){let H=P-this._bufferService.buffer.ydisp;H!==0&&this.scrollLines(H)}registerEscHandler(P,H){return this._inputHandler.registerEscHandler(P,H)}registerDcsHandler(P,H){return this._inputHandler.registerDcsHandler(P,H)}registerCsiHandler(P,H){return this._inputHandler.registerCsiHandler(P,H)}registerOscHandler(P,H){return this._inputHandler.registerOscHandler(P,H)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1,H=this.optionsService.rawOptions.windowsPty;H&&H.buildNumber!==void 0&&H.buildNumber!==void 0?P=H.backend==="conpty"&&H.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(P=!0),P?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let P=[];P.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),P.push(this.registerCsiHandler({final:"H"},(()=>((0,g.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,o.toDisposable)((()=>{for(let H of P)H.dispose()}))}}}s.CoreTerminal=k},8460:(h,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 o=0;o<this._listeners.length;o++)if(this._listeners[o]===r)return void this._listeners.splice(o,1)}}})),this._event}fire(r,o){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,o)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(r,o){return r((_=>o.fire(_)))},s.runAndSubscribe=function(r,o){return o(void 0),r((_=>o(_)))}},5435:function(h,s,r){var o=this&&this.__decorate||function(R,S,E,L){var M,U=arguments.length,q=U<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(R,S,E,L);else for(var Y=R.length-1;Y>=0;Y--)(M=R[Y])&&(q=(U<3?M(q):U>3?M(S,E,q):M(S,E))||q);return U>3&&q&&Object.defineProperty(S,E,q),q},_=this&&this.__param||function(R,S){return function(E,L){S(E,L,R)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let n=r(2584),f=r(7116),v=r(2015),w=r(844),p=r(482),c=r(8437),d=r(8460),a=r(643),u=r(511),g=r(3734),C=r(2585),b=r(1480),y=r(6242),m=r(6351),k=r(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function H(R,S){if(R>24)return S.setWinLines||!1;switch(R){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 A;(function(R){R[R.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",R[R.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(s.WindowsOptionsReportType=A={}));let F=0;class O extends w.Disposable{getAttrData(){return this._curAttrData}constructor(S,E,L,M,U,q,Y,z,D=new v.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=E,this._coreService=L,this._logService=M,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=Y,this._unicodeService=z,this._parser=D,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.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 T(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((x=>this._activeBuffer=x.activeBuffer))),this._parser.setCsiHandlerFallback(((x,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:N.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,N,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:N,data:W})})),this._parser.setDcsHandlerFallback(((x,N,W)=>{N==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:N,payload:W})})),this._parser.setPrintHandler(((x,N,W)=>this.print(x,N,W))),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 f.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,N)=>this.requestStatusString(x,N))))}_preserveStack(S,E,L,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=L,this._parseStack.position=M}_logSlowResolvingAsync(S){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([S,new Promise(((E,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,E){let L,M=this._activeBuffer.x,U=this._activeBuffer.y,q=0,Y=this._parseStack.paused;if(Y){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(L),L;M=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>P&&(q=this._parseStack.position+P)}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<P&&(this._parseBuffer=new Uint32Array(Math.min(S.length,P))),Y||this._dirtyRowTracker.clearRange(),S.length>P)for(let x=q;x<S.length;x+=P){let N=x+P<S.length?x+P:S.length,W=typeof S=="string"?this._stringDecoder.decode(S.substring(x,N),this._parseBuffer):this._utf8Decoder.decode(S.subarray(x,N),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,W))return this._preserveStack(M,U,W,x),this._logSlowResolvingAsync(L),L}else if(!Y){let x=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,x))return this._preserveStack(M,U,x,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===M&&this._activeBuffer.y===U||this._onCursorMove.fire();let z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),D=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);D<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(D,this._bufferService.rows-1),Math.min(z,this._bufferService.rows-1))}print(S,E,L){let M,U,q=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,z=this._bufferService.cols,D=this._coreService.decPrivateModes.wraparound,x=this._coreService.modes.insertMode,N=this._curAttrData,W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-E>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let j=this._parser.precedingJoinState;for(let G=E;G<L;++G){if(M=S[G],M<127&&q){let te=q[String.fromCharCode(M)];te&&(M=te.charCodeAt(0))}let Z=this._unicodeService.charProperties(M,j);U=b.UnicodeService.extractWidth(Z);let K=b.UnicodeService.extractShouldJoin(Z),X=K?b.UnicodeService.extractWidth(j):0;if(j=Z,Y&&this._onA11yChar.fire((0,p.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-X>z){if(D){let te=W,Q=this._activeBuffer.x-X;for(this._activeBuffer.x=X,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),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),X>0&&W instanceof c.BufferLine&&W.copyCellsFrom(te,Q,0,X,!1);Q<z;)te.setCellFromCodepoint(Q++,0,1,N)}else if(this._activeBuffer.x=z-1,U===2)continue}if(K&&this._activeBuffer.x){let te=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-te,M,U);for(let Q=U-X;--Q>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(x&&(W.insertCells(this._activeBuffer.x,U-X,this._activeBuffer.getNullCell(N)),W.getWidth(z-1)===2&&W.setCellFromCodepoint(z-1,a.NULL_CELL_CODE,a.NULL_CELL_WIDTH,N)),W.setCellFromCodepoint(this._activeBuffer.x++,M,U,N),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=j,this._activeBuffer.x<z&&L-E>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,E){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,E):this._parser.registerCsiHandler(S,(L=>!H(L.params[0],this._optionsService.rawOptions.windowOptions)||E(L)))}registerDcsHandler(S,E){return this._parser.registerDcsHandler(S,new m.DcsHandler(E))}registerEscHandler(S,E){return this._parser.registerEscHandler(S,E)}registerOscHandler(S,E){return this._parser.registerOscHandler(S,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 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,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=S,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+E)}cursorUp(S){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,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 E=S.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=S.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=S.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){let E=S.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,E,L,M=!1,U=!1){let q=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);q.replaceCells(E,L,this._activeBuffer.getNullCell(this._eraseAttrData()),U),M&&(q.isWrapped=!1)}_resetBufferLine(S,E=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),L.isWrapped=!1)}eraseInDisplay(S,E=!1){let L;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);L<this._bufferService.rows;L++)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 3:let 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,E=!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,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(S){this._restrictCursor();let E=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;E--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(S){this._restrictCursor();let E=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;E--;)this._activeBuffer.lines.splice(L,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 E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.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 E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(S){let E=S.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(S){let E=S.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(c.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 E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(0,E,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 E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(0,E,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 E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(this._activeBuffer.x,E,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 E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.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 E=this._parser.precedingJoinState;if(!E)return!0;let L=S.params[0]||1,M=b.UnicodeService.extractWidth(E),U=this._activeBuffer.x-M,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(q.length*L),z=0;for(let x=0;x<q.length;){let N=q.codePointAt(x)||0;Y[z++]=N,x+=N>65535?2:1}let D=z;for(let x=1;x<L;++x)Y.copyWithin(D,0,z),D+=z;return this.print(Y,0,D),!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 E=0;E<S.length;E++)switch(S.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(S){for(let E=0;E<S.length;E++)switch(S.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(S){for(let E=0;E<S.length;E++)switch(S.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(S){for(let E=0;E<S.length;E++)switch(S.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(),S.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(S,E){let L=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:Y,cols:z}=this._bufferService,{active:D,alt:x}=Y,N=this._optionsService.rawOptions,W=K=>K?1:2,j=S.params[0];return G=j,Z=E?j===2?4:j===4?W(q.modes.insertMode):j===12?3:j===20?W(N.convertEol):0:j===1?W(L.applicationCursorKeys):j===3?N.windowOptions.setWinLines?z===80?2:z===132?1:0:0:j===6?W(L.origin):j===7?W(L.wraparound):j===8?3:j===9?W(M==="X10"):j===12?W(N.cursorBlink):j===25?W(!q.isCursorHidden):j===45?W(L.reverseWraparound):j===66?W(L.applicationKeypad):j===67?4:j===1e3?W(M==="VT200"):j===1002?W(M==="DRAG"):j===1003?W(M==="ANY"):j===1004?W(L.sendFocus):j===1005?4:j===1006?W(U==="SGR"):j===1015?4:j===1016?W(U==="SGR_PIXELS"):j===1048?1:j===47||j===1047||j===1049?W(D===x):j===2004?W(L.bracketedPasteMode):0,q.triggerDataEvent(`${n.C0.ESC}[${E?"":"?"}${G};${Z}$y`),!0;var G,Z}_updateAttrColor(S,E,L,M,U){return E===2?(S|=50331648,S&=-16777216,S|=g.AttributeData.fromColorRGB([L,M,U])):E===5&&(S&=-50331904,S|=33554432|255&L),S}_extractColor(S,E,L){let M=[0,0,-1,0,0,0],U=0,q=0;do{if(M[q+U]=S.params[E+q],S.hasSubParams(E+q)){let Y=S.getSubParams(E+q),z=0;do M[1]===5&&(U=1),M[q+z+1+U]=Y[z];while(++z<Y.length&&z+q+1+U<M.length);break}if(M[1]===5&&q+U>=2||M[1]===2&&q+U>=5)break;M[1]&&(U=1)}while(++q+E<S.length&&q+U<M.length);for(let Y=2;Y<M.length;++Y)M[Y]===-1&&(M[Y]=0);switch(M[0]){case 38:L.fg=this._updateAttrColor(L.fg,M[1],M[3],M[4],M[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,M[1],M[3],M[4],M[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,M[1],M[3],M[4],M[5])}return q}_processUnderline(S,E){E.extended=E.extended.clone(),(!~S||S>5)&&(S=1),E.extended.underlineStyle=S,E.fg|=268435456,S===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(S){S.fg=c.DEFAULT_ATTR_DATA.fg,S.bg=c.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 E=S.length,L,M=this._curAttrData;for(let U=0;U<E;U++)L=S.params[U],L>=30&&L<=37?(M.fg&=-50331904,M.fg|=16777216|L-30):L>=40&&L<=47?(M.bg&=-50331904,M.bg|=16777216|L-40):L>=90&&L<=97?(M.fg&=-50331904,M.fg|=16777224|L-90):L>=100&&L<=107?(M.bg&=-50331904,M.bg|=16777224|L-100):L===0?this._processSGR0(M):L===1?M.fg|=134217728:L===3?M.bg|=67108864:L===4?(M.fg|=268435456,this._processUnderline(S.hasSubParams(U)?S.getSubParams(U)[0]:1,M)):L===5?M.fg|=536870912:L===7?M.fg|=67108864:L===8?M.fg|=1073741824:L===9?M.fg|=2147483648:L===2?M.bg|=134217728:L===21?this._processUnderline(2,M):L===22?(M.fg&=-134217729,M.bg&=-134217729):L===23?M.bg&=-67108865:L===24?(M.fg&=-268435457,this._processUnderline(0,M)):L===25?M.fg&=-536870913:L===27?M.fg&=-67108865:L===28?M.fg&=-1073741825:L===29?M.fg&=2147483647:L===39?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):L===49?(M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?U+=this._extractColor(S,U,M):L===53?M.bg|=1073741824:L===55?M.bg&=-1073741825:L===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):L===100?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${E};${L}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${E};${L}R`)}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=c.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 E=S.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let L=E%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(S){let E=S.params[0]||1,L;return(S.length<2||(L=S.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(S){if(!H(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;let E=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(A.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(A.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(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 E=[],L=S.split(";");for(;L.length>1;){let M=L.shift(),U=L.shift();if(/^\d+$/.exec(M)){let q=parseInt(M);if(I(q))if(U==="?")E.push({type:0,index:q});else{let Y=(0,k.parseColor)(U);Y&&E.push({type:1,index:q,color:Y})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(S){let E=S.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(S,E){this._getCurrentLinkId()&&this._finishHyperlink();let L=S.split(":"),M,U=L.findIndex((q=>q.startsWith("id=")));return U!==-1&&(M=L[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,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(S,E){let L=S.split(";");for(let M=0;M<L.length&&!(E>=this._specialColors.length);++M,++E)if(L[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let U=(0,k.parseColor)(L[M]);U&&this._onColor.fire([{type:1,index:this._specialColors[E],color:U}])}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 E=[],L=S.split(";");for(let M=0;M<L.length;++M)if(/^\d+$/.exec(L[M])){let U=parseInt(L[M]);I(U)&&E.push({type:2,index:U})}return E.length&&this._onColor.fire(E),!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,f.DEFAULT_CHARSET),!0}selectCharset(S){return S.length!==2?(this.selectDefaultCharset(),!0):(S[0]==="/"||this._charsetService.setgCharset(B[S[0]],f.CHARSETS[S[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 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=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.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 E=0;E<this._bufferService.rows;++E){let L=this._activeBuffer.ybase+this._activeBuffer.y+E,M=this._activeBuffer.lines.get(L);M&&(M.fill(S),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,E){let L=this._bufferService.buffer,M=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${U}${n.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${L.scrollTop+1};${L.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,E){this._dirtyRowTracker.markRangeDirty(S,E)}}s.InputHandler=O;let T=class{constructor(R){this._bufferService=R,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(R){R<this.start?this.start=R:R>this.end&&(this.end=R)}markRangeDirty(R,S){R>S&&(F=R,R=S,S=F),R<this.start&&(this.start=R),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function I(R){return 0<=R&&R<256}T=o([_(0,C.IBufferService)],T)},844:(h,s)=>{function r(o){for(let _ of o)_.dispose();o.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 o of this._disposables)o.dispose();this._disposables.length=0}register(o){return this._disposables.push(o),o}unregister(o){let _=this._disposables.indexOf(o);_!==-1&&this._disposables.splice(_,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(o){this._isDisposed||o===this._value||(this._value?.dispose(),this._value=o)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(o){return{dispose:o}},s.disposeArray=r,s.getDisposeArrayDisposable=function(o){return{dispose:()=>r(o)}}},1505:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.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={}}}s.TwoKeyMap=r,s.FourKeyMap=class{constructor(){this._data=new r}set(o,_,n,f,v){this._data.get(o,_)||this._data.set(o,_,new r),this._data.get(o,_).set(n,f,v)}get(o,_,n,f){return this._data.get(o,_)?.get(n,f)}clear(){this._data.clear()}}},6114:(h,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,o=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 _=r.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(o),s.isIpad=o==="iPad",s.isIphone=o==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(o),s.isLinux=o.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(r)},6106:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let r=0;s.SortedList=class{constructor(o){this._getKey=o,this._array=[]}clear(){this._array.length=0}insert(o){this._array.length!==0?(r=this._search(this._getKey(o)),this._array.splice(r,0,o)):this._array.push(o)}delete(o){if(this._array.length===0)return!1;let _=this._getKey(o);if(_===void 0||(r=this._search(_),r===-1)||this._getKey(this._array[r])!==_)return!1;do if(this._array[r]===o)return this._array.splice(r,1),!0;while(++r<this._array.length&&this._getKey(this._array[r])===_);return!1}*getKeyIterator(o){if(this._array.length!==0&&(r=this._search(o),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===o))do yield this._array[r];while(++r<this._array.length&&this._getKey(this._array[r])===o)}forEachByKey(o,_){if(this._array.length!==0&&(r=this._search(o),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===o))do _(this._array[r]);while(++r<this._array.length&&this._getKey(this._array[r])===o)}values(){return[...this._array].values()}_search(o){let _=0,n=this._array.length-1;for(;n>=_;){let f=_+n>>1,v=this._getKey(this._array[f]);if(v>o)n=f-1;else{if(!(v<o)){for(;f>0&&this._getKey(this._array[f-1])===o;)f--;return f}_=f+1}}return _}}},7226:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let o=r(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let w=0,p=0,c=v.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),p=Math.max(w,p),d=v.timeRemaining(),1.5*p>d)return c-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-w))}ms`),void this._start();c=d}this.clear()}}class n extends _{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){let w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}s.PriorityTaskQueue=n,s.IdleTaskQueue=!o.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:n,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let o=r(643);s.updateWindowsModeWrappedState=function(_){let n=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),f=n?.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&f&&(v.isWrapped=f[o.CHAR_DATA_CODE_INDEX]!==o.NULL_CELL_CODE&&f[o.CHAR_DATA_CODE_INDEX]!==o.WHITESPACE_CELL_CODE)}},3734:(h,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 o}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 o{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 o(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=o},9092:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let o=r(6349),_=r(7226),n=r(3734),f=r(8437),v=r(4634),w=r(511),p=r(643),c=r(4863),d=r(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(a,u,g){this._hasScrollback=a,this._optionsService=u,this._bufferService=g,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=w.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new o.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(a){return a?(this._nullCell.fg=a.fg,this._nullCell.bg=a.bg,this._nullCell.extended=a.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(a){return a?(this._whitespaceCell.fg=a.fg,this._whitespaceCell.bg=a.bg,this._whitespaceCell.extended=a.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(a,u){return new f.BufferLine(this._bufferService.cols,this.getNullCell(a),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let a=this.ybase+this.y-this.ydisp;return a>=0&&a<this._rows}_getCorrectBufferLength(a){if(!this._hasScrollback)return a;let u=a+this._optionsService.rawOptions.scrollback;return u>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:u}fillViewportRows(a){if(this.lines.length===0){a===void 0&&(a=f.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(a))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new o.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(a,u){let g=this.getNullCell(f.DEFAULT_ATTR_DATA),C=0,b=this._getCorrectBufferLength(u);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<a)for(let m=0;m<this.lines.length;m++)C+=+this.lines.get(m).resize(a,g);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(a,g)):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(a,g)));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(b<this.lines.maxLength){let m=this.lines.length-b;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=b}this.x=Math.min(this.x,a-1),this.y=Math.min(this.y,u-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,a-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(a,u),this._cols>a))for(let y=0;y<this.lines.length;y++)C+=+this.lines.get(y).resize(a,g);this._cols=a,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let a=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,a=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return a}get _isReflowEnabled(){let a=this._optionsService.rawOptions.windowsPty;return a&&a.buildNumber?this._hasScrollback&&a.backend==="conpty"&&a.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(a,u){this._cols!==a&&(a>this._cols?this._reflowLarger(a,u):this._reflowSmaller(a,u))}_reflowLarger(a,u){let g=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,a,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(g.length>0){let C=(0,v.reflowLargerCreateNewLayout)(this.lines,g);(0,v.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(a,u,C.countRemoved)}}_reflowLargerAdjustViewport(a,u,g){let C=this.getNullCell(f.DEFAULT_ATTR_DATA),b=g;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new f.BufferLine(a,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-g,0)}_reflowSmaller(a,u){let g=this.getNullCell(f.DEFAULT_ATTR_DATA),C=[],b=0;for(let y=this.lines.length-1;y>=0;y--){let m=this.lines.get(y);if(!m||!m.isWrapped&&m.getTrimmedLength()<=a)continue;let k=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),k.unshift(m);let B=this.ybase+this.y;if(B>=y&&B<y+k.length)continue;let P=k[k.length-1].getTrimmedLength(),H=(0,v.reflowSmallerGetNewLineLengths)(k,this._cols,a),A=H.length-k.length,F;F=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+A):Math.max(0,this.lines.length-this.lines.maxLength+A);let O=[];for(let L=0;L<A;L++){let M=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);O.push(M)}O.length>0&&(C.push({start:y+k.length+b,newLines:O}),b+=O.length),k.push(...O);let T=H.length-1,I=H[T];I===0&&(T--,I=H[T]);let R=k.length-A-1,S=P;for(;R>=0;){let L=Math.min(S,I);if(k[T]===void 0)break;if(k[T].copyCellsFrom(k[R],S-L,I-L,L,!0),I-=L,I===0&&(T--,I=H[T]),S-=L,S===0){R--;let M=Math.max(R,0);S=(0,v.getWrappedLineTrimmedLength)(k,M,this._cols)}}for(let L=0;L<k.length;L++)H[L]<a&&k[L].setCell(H[L],g);let E=A-F;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+b)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let T=0;T<this.lines.length;T++)m.push(this.lines.get(T));let k=this.lines.length,B=k-1,P=0,H=C[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let A=0;for(let T=Math.min(this.lines.maxLength-1,k+b-1);T>=0;T--)if(H&&H.start>B+A){for(let I=H.newLines.length-1;I>=0;I--)this.lines.set(T--,H.newLines[I]);T++,y.push({index:B+1,amount:H.newLines.length}),A+=H.newLines.length,H=C[++P]}else this.lines.set(T,m[B--]);let F=0;for(let T=y.length-1;T>=0;T--)y[T].index+=F,this.lines.onInsertEmitter.fire(y[T]),F+=y[T].amount;let O=Math.max(0,k+b-this.lines.maxLength);O>0&&this.lines.onTrimEmitter.fire(O)}}translateBufferLineToString(a,u,g=0,C){let b=this.lines.get(a);return b?b.translateToString(u,g,C):""}getWrappedRangeForLine(a){let u=a,g=a;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;g+1<this.lines.length&&this.lines.get(g+1).isWrapped;)g++;return{first:u,last:g}}setupTabStops(a){for(a!=null?this.tabs[a]||(a=this.prevStop(a)):(this.tabs={},a=0);a<this._cols;a+=this._optionsService.rawOptions.tabStopWidth)this.tabs[a]=!0}prevStop(a){for(a==null&&(a=this.x);!this.tabs[--a]&&a>0;);return a>=this._cols?this._cols-1:a<0?0:a}nextStop(a){for(a==null&&(a=this.x);!this.tabs[++a]&&a<this._cols;);return a>=this._cols?this._cols-1:a<0?0:a}clearMarkers(a){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===a&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let a=0;a<this.markers.length;a++)this.markers[a].dispose(),this.markers.splice(a--,1);this._isClearing=!1}addMarker(a){let u=new c.Marker(a);return this.markers.push(u),u.register(this.lines.onTrim((g=>{u.line-=g,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((g=>{u.line>=g.index&&(u.line+=g.amount)}))),u.register(this.lines.onDelete((g=>{u.line>=g.index&&u.line<g.index+g.amount&&u.dispose(),u.line>g.index&&(u.line-=g.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(a){this._isClearing||this.markers.splice(this.markers.indexOf(a),1)}}},8437:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let o=r(3734),_=r(511),n=r(643),f=r(482);s.DEFAULT_ATTR_DATA=Object.freeze(new o.AttributeData);let v=0;class w{constructor(c,d,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let u=d||_.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let g=0;g<c;++g)this.setCell(g,u);this.length=c}get(c){let d=this._data[3*c+0],a=2097151&d;return[this._data[3*c+1],2097152&d?this._combined[c]:a?(0,f.stringFromCodePoint)(a):"",d>>22,2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):a]}set(c,d){this._data[3*c+1]=d[n.CHAR_DATA_ATTR_INDEX],d[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=d[1],this._data[3*c+0]=2097152|c|d[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=d[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(c){return this._data[3*c+0]>>22}hasWidth(c){return 12582912&this._data[3*c+0]}getFg(c){return this._data[3*c+1]}getBg(c){return this._data[3*c+2]}hasContent(c){return 4194303&this._data[3*c+0]}getCodePoint(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&d}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c]:2097151&d?(0,f.stringFromCodePoint)(2097151&d):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,d){return v=3*c,d.content=this._data[v+0],d.fg=this._data[v+1],d.bg=this._data[v+2],2097152&d.content&&(d.combinedData=this._combined[c]),268435456&d.bg&&(d.extended=this._extendedAttrs[c]),d}setCell(c,d){2097152&d.content&&(this._combined[c]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[c]=d.extended),this._data[3*c+0]=d.content,this._data[3*c+1]=d.fg,this._data[3*c+2]=d.bg}setCellFromCodepoint(c,d,a,u){268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=d|a<<22,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}addCodepointToCell(c,d,a){let u=this._data[3*c+0];2097152&u?this._combined[c]+=(0,f.stringFromCodePoint)(d):2097151&u?(this._combined[c]=(0,f.stringFromCodePoint)(2097151&u)+(0,f.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,a&&(u&=-12582913,u|=a<<22),this._data[3*c+0]=u}insertCells(c,d,a){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,a),d<this.length-c){let u=new _.CellData;for(let g=this.length-c-d-1;g>=0;--g)this.setCell(c+d+g,this.loadCell(c+g,u));for(let g=0;g<d;++g)this.setCell(c+g,a)}else for(let u=c;u<this.length;++u)this.setCell(u,a);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,a)}deleteCells(c,d,a){if(c%=this.length,d<this.length-c){let u=new _.CellData;for(let g=0;g<this.length-c-d;++g)this.setCell(c+g,this.loadCell(c+d+g,u));for(let g=this.length-d;g<this.length;++g)this.setCell(g,a)}else for(let u=c;u<this.length;++u)this.setCell(u,a);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,a),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,a)}replaceCells(c,d,a,u=!1){if(u)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,a),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,a);c<d&&c<this.length;)this.isProtected(c)||this.setCell(c,a),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,a),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,a);c<d&&c<this.length;)this.setCell(c++,a)}resize(c,d){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let a=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*a)this._data=new Uint32Array(this._data.buffer,0,a);else{let u=new Uint32Array(a);u.set(this._data),this._data=u}for(let u=this.length;u<c;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,a);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let b=parseInt(u[C],10);b>=c&&delete this._combined[b]}let g=Object.keys(this._extendedAttrs);for(let C=0;C<g.length;C++){let b=parseInt(g[C],10);b>=c&&delete this._extendedAttrs[b]}}return this.length=c,4*a*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let c=new Uint32Array(this._data.length);return c.set(this._data),this._data=c,1}return 0}fill(c,d=!1){if(d)for(let a=0;a<this.length;++a)this.isProtected(a)||this.setCell(a,c);else{this._combined={},this._extendedAttrs={};for(let a=0;a<this.length;++a)this.setCell(a,c)}}copyFrom(c){this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={};for(let d in c._combined)this._combined[d]=c._combined[d];this._extendedAttrs={};for(let d in c._extendedAttrs)this._extendedAttrs[d]=c._extendedAttrs[d];this.isWrapped=c.isWrapped}clone(){let c=new w(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let d in this._combined)c._combined[d]=this._combined[d];for(let d in this._extendedAttrs)c._extendedAttrs[d]=this._extendedAttrs[d];return c.isWrapped=this.isWrapped,c}getTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0}getNoBgTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0]||50331648&this._data[3*c+2])return c+(this._data[3*c+0]>>22);return 0}copyCellsFrom(c,d,a,u,g){let C=c._data;if(g)for(let y=u-1;y>=0;y--){for(let m=0;m<3;m++)this._data[3*(a+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[a+y]=c._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(a+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[a+y]=c._extendedAttrs[d+y])}let b=Object.keys(c._combined);for(let y=0;y<b.length;y++){let m=parseInt(b[y],10);m>=d&&(this._combined[m-d+a]=c._combined[m])}}translateToString(c,d,a,u){d=d??0,a=a??this.length,c&&(a=Math.min(a,this.getTrimmedLength())),u&&(u.length=0);let g="";for(;d<a;){let C=this._data[3*d+0],b=2097151&C,y=2097152&C?this._combined[d]:b?(0,f.stringFromCodePoint)(b):n.WHITESPACE_CELL_CHAR;if(g+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),g}}s.BufferLine=w},4841:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(r,o){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 o*(r.end.y-r.start.y)+(r.end.x-r.start.x+1)}},4634:(h,s)=>{function r(o,_,n){if(_===o.length-1)return o[_].getTrimmedLength();let f=!o[_].hasContent(n-1)&&o[_].getWidth(n-1)===1,v=o[_+1].getWidth(0)===2;return f&&v?n-1:n}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(o,_,n,f,v){let w=[];for(let p=0;p<o.length-1;p++){let c=p,d=o.get(++c);if(!d.isWrapped)continue;let a=[o.get(p)];for(;c<o.length&&d.isWrapped;)a.push(d),d=o.get(++c);if(f>=p&&f<c){p+=a.length-1;continue}let u=0,g=r(a,u,_),C=1,b=0;for(;C<a.length;){let m=r(a,C,_),k=m-b,B=n-g,P=Math.min(k,B);a[u].copyCellsFrom(a[C],b,g,P,!1),g+=P,g===n&&(u++,g=0),b+=P,b===m&&(C++,b=0),g===0&&u!==0&&a[u-1].getWidth(n-1)===2&&(a[u].copyCellsFrom(a[u-1],n-1,g++,1,!1),a[u-1].setCell(n-1,v))}a[u].replaceCells(g,n,v);let y=0;for(let m=a.length-1;m>0&&(m>u||a[m].getTrimmedLength()===0);m--)y++;y>0&&(w.push(p+a.length-y),w.push(y)),p+=a.length-1}return w},s.reflowLargerCreateNewLayout=function(o,_){let n=[],f=0,v=_[f],w=0;for(let p=0;p<o.length;p++)if(v===p){let c=_[++f];o.onDeleteEmitter.fire({index:p-w,amount:c}),p+=c-1,w+=c,v=_[++f]}else n.push(p);return{layout:n,countRemoved:w}},s.reflowLargerApplyNewLayout=function(o,_){let n=[];for(let f=0;f<_.length;f++)n.push(o.get(_[f]));for(let f=0;f<n.length;f++)o.set(f,n[f]);o.length=_.length},s.reflowSmallerGetNewLineLengths=function(o,_,n){let f=[],v=o.map(((d,a)=>r(o,a,_))).reduce(((d,a)=>d+a)),w=0,p=0,c=0;for(;c<v;){if(v-c<n){f.push(v-c);break}w+=n;let d=r(o,p,_);w>d&&(w-=d,p++);let a=o[p].getWidth(w-1)===2;a&&w--;let u=a?n-1:n;f.push(u),c+=u}return f},s.getWrappedLineTrimmedLength=r},5295:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let o=r(8460),_=r(844),n=r(9092);class f extends _.Disposable{constructor(w,p){super(),this._optionsService=w,this._bufferService=p,this._onBufferActivate=this.register(new o.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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,p){this._normal.resize(w,p),this._alt.resize(w,p),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}s.BufferSet=f},511:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let o=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(w){let p=new f;return p.setFromCharData(w),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,o.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(w[_.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(w[_.CHAR_DATA_CHAR_INDEX].length===2){let c=w[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let d=w[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(c-55296)+d-56320+65536|w[_.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=w[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[_.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=w[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=f},643:(h,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:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let o=r(8460),_=r(844);class n{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new o.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}s.Marker=n,n._nextId=1},7116:(h,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:(h,s)=>{var r,o,_;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"})(o||(s.C1=o={})),(function(n){n.ST=`${r.ESC}\\`})(_||(s.C1_ESCAPED=_={}))},7399:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let o=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:["'",'"']};s.evaluateKeyboardEvent=function(n,f,v,w){let p={type:0,cancel:!1,key:void 0},c=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?p.key=f?o.C0.ESC+"OA":o.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?p.key=f?o.C0.ESC+"OD":o.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?p.key=f?o.C0.ESC+"OC":o.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(p.key=f?o.C0.ESC+"OB":o.C0.ESC+"[B");break;case 8:p.key=n.ctrlKey?"\b":o.C0.DEL,n.altKey&&(p.key=o.C0.ESC+p.key);break;case 9:if(n.shiftKey){p.key=o.C0.ESC+"[Z";break}p.key=o.C0.HT,p.cancel=!0;break;case 13:p.key=n.altKey?o.C0.ESC+o.C0.CR:o.C0.CR,p.cancel=!0;break;case 27:p.key=o.C0.ESC,n.altKey&&(p.key=o.C0.ESC+o.C0.ESC),p.cancel=!0;break;case 37:if(n.metaKey)break;c?(p.key=o.C0.ESC+"[1;"+(c+1)+"D",p.key===o.C0.ESC+"[1;3D"&&(p.key=o.C0.ESC+(v?"b":"[1;5D"))):p.key=f?o.C0.ESC+"OD":o.C0.ESC+"[D";break;case 39:if(n.metaKey)break;c?(p.key=o.C0.ESC+"[1;"+(c+1)+"C",p.key===o.C0.ESC+"[1;3C"&&(p.key=o.C0.ESC+(v?"f":"[1;5C"))):p.key=f?o.C0.ESC+"OC":o.C0.ESC+"[C";break;case 38:if(n.metaKey)break;c?(p.key=o.C0.ESC+"[1;"+(c+1)+"A",v||p.key!==o.C0.ESC+"[1;3A"||(p.key=o.C0.ESC+"[1;5A")):p.key=f?o.C0.ESC+"OA":o.C0.ESC+"[A";break;case 40:if(n.metaKey)break;c?(p.key=o.C0.ESC+"[1;"+(c+1)+"B",v||p.key!==o.C0.ESC+"[1;3B"||(p.key=o.C0.ESC+"[1;5B")):p.key=f?o.C0.ESC+"OB":o.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(p.key=o.C0.ESC+"[2~");break;case 46:p.key=c?o.C0.ESC+"[3;"+(c+1)+"~":o.C0.ESC+"[3~";break;case 36:p.key=c?o.C0.ESC+"[1;"+(c+1)+"H":f?o.C0.ESC+"OH":o.C0.ESC+"[H";break;case 35:p.key=c?o.C0.ESC+"[1;"+(c+1)+"F":f?o.C0.ESC+"OF":o.C0.ESC+"[F";break;case 33:n.shiftKey?p.type=2:n.ctrlKey?p.key=o.C0.ESC+"[5;"+(c+1)+"~":p.key=o.C0.ESC+"[5~";break;case 34:n.shiftKey?p.type=3:n.ctrlKey?p.key=o.C0.ESC+"[6;"+(c+1)+"~":p.key=o.C0.ESC+"[6~";break;case 112:p.key=c?o.C0.ESC+"[1;"+(c+1)+"P":o.C0.ESC+"OP";break;case 113:p.key=c?o.C0.ESC+"[1;"+(c+1)+"Q":o.C0.ESC+"OQ";break;case 114:p.key=c?o.C0.ESC+"[1;"+(c+1)+"R":o.C0.ESC+"OR";break;case 115:p.key=c?o.C0.ESC+"[1;"+(c+1)+"S":o.C0.ESC+"OS";break;case 116:p.key=c?o.C0.ESC+"[15;"+(c+1)+"~":o.C0.ESC+"[15~";break;case 117:p.key=c?o.C0.ESC+"[17;"+(c+1)+"~":o.C0.ESC+"[17~";break;case 118:p.key=c?o.C0.ESC+"[18;"+(c+1)+"~":o.C0.ESC+"[18~";break;case 119:p.key=c?o.C0.ESC+"[19;"+(c+1)+"~":o.C0.ESC+"[19~";break;case 120:p.key=c?o.C0.ESC+"[20;"+(c+1)+"~":o.C0.ESC+"[20~";break;case 121:p.key=c?o.C0.ESC+"[21;"+(c+1)+"~":o.C0.ESC+"[21~";break;case 122:p.key=c?o.C0.ESC+"[23;"+(c+1)+"~":o.C0.ESC+"[23~";break;case 123:p.key=c?o.C0.ESC+"[24;"+(c+1)+"~":o.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(v&&!w||!n.altKey||n.metaKey)!v||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?p.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(p.key=o.C0.US),n.key==="@"&&(p.key=o.C0.NUL)):n.keyCode===65&&(p.type=1);else{let d=_[n.keyCode],a=d?.[n.shiftKey?1:0];if(a)p.key=o.C0.ESC+a;else if(n.keyCode>=65&&n.keyCode<=90){let u=n.ctrlKey?n.keyCode-64:n.keyCode+32,g=String.fromCharCode(u);n.shiftKey&&(g=g.toUpperCase()),p.key=o.C0.ESC+g}else if(n.keyCode===32)p.key=o.C0.ESC+(n.ctrlKey?o.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let u=n.code.slice(3,4);n.shiftKey||(u=u.toLowerCase()),p.key=o.C0.ESC+u,p.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?p.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?p.key=o.C0.NUL:n.keyCode>=51&&n.keyCode<=55?p.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?p.key=o.C0.DEL:n.keyCode===219?p.key=o.C0.ESC:n.keyCode===220?p.key=o.C0.FS:n.keyCode===221&&(p.key=o.C0.GS)}return p}},482:(h,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,o=0,_=r.length){let n="";for(let f=o;f<_;++f){let v=r[f];v>65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(r,o){let _=r.length;if(!_)return 0;let n=0,f=0;if(this._interim){let v=r.charCodeAt(f++);56320<=v&&v<=57343?o[n++]=1024*(this._interim-55296)+v-56320+65536:(o[n++]=this._interim,o[n++]=v),this._interim=0}for(let v=f;v<_;++v){let w=r.charCodeAt(v);if(55296<=w&&w<=56319){if(++v>=_)return this._interim=w,n;let p=r.charCodeAt(v);56320<=p&&p<=57343?o[n++]=1024*(w-55296)+p-56320+65536:(o[n++]=w,o[n++]=p)}else w!==65279&&(o[n++]=w)}return n}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(r,o){let _=r.length;if(!_)return 0;let n,f,v,w,p=0,c=0,d=0;if(this.interim[0]){let g=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let b,y=0;for(;(b=63&this.interim[++y])&&y<4;)C<<=6,C|=b;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=m-y;for(;d<k;){if(d>=_)return 0;if(b=r[d++],(192&b)!=128){d--,g=!0;break}this.interim[y++]=b,C<<=6,C|=63&b}g||(m===2?C<128?d--:o[p++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(o[p++]=C):C<65536||C>1114111||(o[p++]=C)),this.interim.fill(0)}let a=_-4,u=d;for(;u<_;){for(;!(!(u<a)||128&(n=r[u])||128&(f=r[u+1])||128&(v=r[u+2])||128&(w=r[u+3]));)o[p++]=n,o[p++]=f,o[p++]=v,o[p++]=w,u+=4;if(n=r[u++],n<128)o[p++]=n;else if((224&n)==192){if(u>=_)return this.interim[0]=n,p;if(f=r[u++],(192&f)!=128){u--;continue}if(c=(31&n)<<6|63&f,c<128){u--;continue}o[p++]=c}else if((240&n)==224){if(u>=_)return this.interim[0]=n,p;if(f=r[u++],(192&f)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,p;if(v=r[u++],(192&v)!=128){u--;continue}if(c=(15&n)<<12|(63&f)<<6|63&v,c<2048||c>=55296&&c<=57343||c===65279)continue;o[p++]=c}else if((248&n)==240){if(u>=_)return this.interim[0]=n,p;if(f=r[u++],(192&f)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,p;if(v=r[u++],(192&v)!=128){u--;continue}if(u>=_)return this.interim[0]=n,this.interim[1]=f,this.interim[2]=v,p;if(w=r[u++],(192&w)!=128){u--;continue}if(c=(7&n)<<18|(63&f)<<12|(63&v)<<6|63&w,c<65536||c>1114111)continue;o[p++]=c}}return p}}},225:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let o=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;s.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let v=0;v<_.length;++v)f.fill(0,_[v][0],_[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?f[v]:(function(w,p){let c,d=0,a=p.length-1;if(w<p[0][0]||w>p[a][1])return!1;for(;a>=d;)if(c=d+a>>1,w>p[c][1])d=c+1;else{if(!(w<p[c][0]))return!0;a=c-1}return!1})(v,n)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let p=this.wcwidth(v),c=p===0&&w!==0;if(c){let d=o.UnicodeService.extractWidth(w);d===0?c=!1:d>p&&(p=d)}return o.UnicodeService.createPropertyValue(0,p,c)}}},5981:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let o=r(8460),_=r(844);class n extends _.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new o.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){let p=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],d=this._action(c,w);if(d){let u=g=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,g))):this._innerWrite(p,g);return void d.catch((g=>(queueMicrotask((()=>{throw g})),Promise.resolve(!1)))).then(u)}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-p>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}s.WriteBuffer=n},5941:(h,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})$/,o=/^[\da-f]+$/;function _(n,f){let v=n.toString(16),w=v.length<2?"0"+v:v;switch(f){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}s.parseColor=function(n){if(!n)return;let f=n.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);let v=r.exec(f);if(v){let w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),o.exec(f)&&[3,6,9,12].includes(f.length))){let v=f.length/3,w=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(f.slice(v*p,v*p+v),16);w[p]=v===1?c<<4:v===2?c:v===3?c>>4:c>>8}return w}},s.toRgbString=function(n,f=16){let[v,w,p]=n;return`rgb:${_(v,f)}/${_(w,f)}/${_(p,f)}`}},5770:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let o=r(482),_=r(8742),n=r(5770),f=[];s.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(w,p){this._handlers[w]===void 0&&(this._handlers[w]=[]);let c=this._handlers[w];return c.push(p),{dispose:()=>{let d=c.indexOf(p);d!==-1&&c.splice(d,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(w,p){if(this.reset(),this._ident=w,this._active=this._handlers[w]||f,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(w,p,c){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(w,p,c);else this._handlerFb(this._ident,"PUT",(0,o.utf32ToString)(w,p,c))}unhook(w,p=!0){if(this._active.length){let c=!1,d=this._active.length-1,a=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,c=p,a=this._stack.fallThrough,this._stack.paused=!1),!a&&c===!1){for(;d>=0&&(c=this._active[d].unhook(w),c!==!0);d--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,c;d--}for(;d>=0;d--)if(c=this._active[d].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",w);this._active=f,this._ident=0}};let v=new _.Params;v.addParam(0),s.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,p,c){this._hitLimit||(this._data+=(0,o.utf32ToString)(w,p,c),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let p=!1;if(this._hitLimit)p=!1;else if(w&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=v,this._data="",this._hitLimit=!1,c)));return this._params=v,this._data="",this._hitLimit=!1,p}}},2015:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let o=r(844),_=r(8742),n=r(6242),f=r(6351);class v{constructor(d){this.table=new Uint8Array(d)}setDefault(d,a){this.table.fill(d<<4|a)}add(d,a,u,g){this.table[a<<8|d]=u<<4|g}addMany(d,a,u,g){for(let C=0;C<d.length;C++)this.table[a<<8|d[C]]=u<<4|g}}s.TransitionTable=v;let w=160;s.VT500_TRANSITION_TABLE=(function(){let c=new v(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),a=(y,m)=>d.slice(y,m),u=a(32,127),g=a(0,24);g.push(25),g.push.apply(g,a(28,32));let C=a(0,14),b;for(b in c.setDefault(1,0),c.addMany(u,0,2,0),C)c.addMany([24,26,153,154],b,3,0),c.addMany(a(128,144),b,3,0),c.addMany(a(144,152),b,3,0),c.add(156,b,0,0),c.add(27,b,11,1),c.add(157,b,4,8),c.addMany([152,158,159],b,0,7),c.add(155,b,11,3),c.add(144,b,11,9);return c.addMany(g,0,3,0),c.addMany(g,1,3,1),c.add(127,1,0,1),c.addMany(g,8,0,8),c.addMany(g,3,3,3),c.add(127,3,0,3),c.addMany(g,4,3,4),c.add(127,4,0,4),c.addMany(g,6,3,6),c.addMany(g,5,3,5),c.add(127,5,0,5),c.addMany(g,2,3,2),c.add(127,2,0,2),c.add(93,1,4,8),c.addMany(u,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(a(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(u,7,0,7),c.addMany(g,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(a(64,127),3,7,0),c.addMany(a(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(a(48,60),4,8,4),c.addMany(a(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(a(32,64),6,0,6),c.add(127,6,0,6),c.addMany(a(64,127),6,0,0),c.addMany(a(32,48),3,9,5),c.addMany(a(32,48),5,9,5),c.addMany(a(48,64),5,0,6),c.addMany(a(64,127),5,7,0),c.addMany(a(32,48),4,9,5),c.addMany(a(32,48),1,9,2),c.addMany(a(32,48),2,9,2),c.addMany(a(48,127),2,10,0),c.addMany(a(48,80),1,10,0),c.addMany(a(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(a(96,127),1,10,0),c.add(80,1,11,9),c.addMany(g,9,0,9),c.add(127,9,0,9),c.addMany(a(28,32),9,0,9),c.addMany(a(32,48),9,9,12),c.addMany(a(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(g,11,0,11),c.addMany(a(32,128),11,0,11),c.addMany(a(28,32),11,0,11),c.addMany(g,10,0,10),c.add(127,10,0,10),c.addMany(a(28,32),10,0,10),c.addMany(a(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(a(32,48),10,9,12),c.addMany(g,12,0,12),c.add(127,12,0,12),c.addMany(a(28,32),12,0,12),c.addMany(a(32,48),12,9,12),c.addMany(a(48,64),12,0,11),c.addMany(a(64,127),12,12,13),c.addMany(a(64,127),10,12,13),c.addMany(a(64,127),9,12,13),c.addMany(g,13,13,13),c.addMany(u,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(w,0,2,0),c.add(w,8,5,8),c.add(w,6,0,6),c.add(w,11,0,11),c.add(w,13,13,13),c})();class p extends o.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 _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(a,u,g)=>{},this._executeHandlerFb=a=>{},this._csiHandlerFb=(a,u)=>{},this._escHandlerFb=a=>{},this._errorHandlerFb=a=>a,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,o.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,a=[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 b=d.intermediates.charCodeAt(C);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=b}}if(d.final.length!==1)throw new Error("final must be a single byte");let g=d.final.charCodeAt(0);if(a[0]>g||g>a[1])throw new Error(`final must be in range ${a[0]} .. ${a[1]}`);return u<<=8,u|=g,u}identToString(d){let a=[];for(;d;)a.push(String.fromCharCode(255&d)),d>>=8;return a.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,a){let u=this._identifier(d,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let g=this._escHandlers[u];return g.push(a),{dispose:()=>{let C=g.indexOf(a);C!==-1&&g.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,a){this._executeHandlers[d.charCodeAt(0)]=a}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,a){let u=this._identifier(d);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let g=this._csiHandlers[u];return g.push(a),{dispose:()=>{let C=g.indexOf(a);C!==-1&&g.splice(C,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,a){return this._dcsParser.registerHandler(this._identifier(d),a)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,a){return this._oscParser.registerHandler(d,a)}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,a,u,g,C){this._parseStack.state=d,this._parseStack.handlers=a,this._parseStack.handlerPos=u,this._parseStack.transition=g,this._parseStack.chunkPos=C}parse(d,a,u){let g,C=0,b=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,k=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&k>-1){for(;k>=0&&(g=m[k](this._params),g!==!0);k--)if(g instanceof Promise)return this._parseStack.handlerPos=k,g}this._parseStack.handlers=[];break;case 4:if(u===!1&&k>-1){for(;k>=0&&(g=m[k](),g!==!0);k--)if(g instanceof Promise)return this._parseStack.handlerPos=k,g}this._parseStack.handlers=[];break;case 6:if(C=d[this._parseStack.chunkPos],g=this._dcsParser.unhook(C!==24&&C!==26,u),g)return g;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],g=this._oscParser.end(C!==24&&C!==26,u),g)return g;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<a;++m){switch(C=d[m],b=this._transitions.table[this.currentState<<8|(C<160?C:w)],b>>4){case 2:for(let A=m+1;;++A){if(A>=a||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-1;break}if(++A>=a||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-1;break}if(++A>=a||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-1;break}if(++A>=a||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-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 k=this._csiHandlers[this._collect<<8|C],B=k?k.length-1:-1;for(;B>=0&&(g=k[B](this._params),g!==!0);B--)if(g instanceof Promise)return this._preserveStack(3,k,B,b,m),g;B<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<a&&(C=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let P=this._escHandlers[this._collect<<8|C],H=P?P.length-1:-1;for(;H>=0&&(g=P[H](),g!==!0);H--)if(g instanceof Promise)return this._preserveStack(4,P,H,b,m),g;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 A=m+1;;++A)if(A>=a||(C=d[A])===24||C===26||C===27||C>127&&C<w){this._dcsParser.put(d,m,A),m=A-1;break}break;case 14:if(g=this._dcsParser.unhook(C!==24&&C!==26),g)return this._preserveStack(6,[],0,b,m),g;C===27&&(b|=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 A=m+1;;A++)if(A>=a||(C=d[A])<32||C>127&&C<w){this._oscParser.put(d,m,A),m=A-1;break}break;case 6:if(g=this._oscParser.end(C!==24&&C!==26),g)return this._preserveStack(5,[],0,b,m),g;C===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}s.EscapeSequenceParser=p},6242:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let o=r(5770),_=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(f,v){this._handlers[f]===void 0&&(this._handlers[f]=[]);let w=this._handlers[f];return w.push(v),{dispose:()=>{let p=w.indexOf(v);p!==-1&&w.splice(p,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,v,w){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(f,v,w);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(f,v,w))}start(){this.reset(),this._state=1}put(f,v,w){if(this._state!==3){if(this._state===1)for(;v<w;){let p=f[v++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&w-v>0&&this._put(f,v,w)}}end(f,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,w=v,c=this._stack.fallThrough,this._stack.paused=!1),!c&&w===!1){for(;p>=0&&(w=this._active[p].end(f),w!==!0);p--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,w;p--}for(;p>=0;p--)if(w=this._active[p].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",f);this._active=n,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,v,w){this._hitLimit||(this._data+=(0,_.utf32ToString)(f,v,w),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let v=!1;if(this._hitLimit)v=!1;else if(f&&(v=this._handler(this._data),v instanceof Promise))return v.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,v}}},8742:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let r=2147483647;class o{static fromArray(n){let f=new o;if(!n.length)return f;for(let v=Array.isArray(n[0])?1:0;v<n.length;++v){let w=n[v];if(Array.isArray(w))for(let p=0;p<w.length;++p)f.addSubParam(w[p]);else f.addParam(w)}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 o(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 v=this._subParamsIdx[f]>>8,w=255&this._subParamsIdx[f];w-v>0&&n.push(Array.prototype.slice.call(this._subParams,v,w))}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,v=255&this._subParamsIdx[n];return v-f>0?this._subParams.subarray(f,v):null}getSubParamsAll(){let n={};for(let f=0;f<this.length;++f){let v=this._subParamsIdx[f]>>8,w=255&this._subParamsIdx[f];w-v>0&&(n[f]=this._subParams.slice(v,w))}return n}addDigit(n){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let v=this._digitIsSub?this._subParams:this.params,w=v[f-1];v[f-1]=~w?Math.min(10*w+n,r):n}}s.Params=o},5741:(h,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,o){let _={instance:o,dispose:o.dispose,isDisposed:!1};this._addons.push(_),o.dispose=()=>this._wrappedAddonDispose(_),o.activate(r)}_wrappedAddonDispose(r){if(r.isDisposed)return;let o=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===r){o=_;break}if(o===-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(o,1)}}},8771:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let o=r(3785),_=r(511);s.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 o.BufferLineApiView(f)}getNullCell(){return new _.CellData}}},3785:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let o=r(511);s.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 o.CellData)}translateToString(_,n,f){return this._line.translateToString(_,n,f)}}},8285:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let o=r(8771),_=r(8460),n=r(844);class f extends n.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new o.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new o.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=f},7975:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(r){this._core=r}registerCsiHandler(r,o){return this._core.registerCsiHandler(r,(_=>o(_.toArray())))}addCsiHandler(r,o){return this.registerCsiHandler(r,o)}registerDcsHandler(r,o){return this._core.registerDcsHandler(r,((_,n)=>o(_,n.toArray())))}addDcsHandler(r,o){return this.registerDcsHandler(r,o)}registerEscHandler(r,o){return this._core.registerEscHandler(r,o)}addEscHandler(r,o){return this.registerEscHandler(r,o)}registerOscHandler(r,o){return this._core.registerOscHandler(r,o)}addOscHandler(r,o){return this.registerOscHandler(r,o)}}},7090:(h,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(h,s,r){var o=this&&this.__decorate||function(c,d,a,u){var g,C=arguments.length,b=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,a):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,d,a,u);else for(var y=c.length-1;y>=0;y--)(g=c[y])&&(b=(C<3?g(b):C>3?g(d,a,b):g(d,a))||b);return C>3&&b&&Object.defineProperty(d,a,b),b},_=this&&this.__param||function(c,d){return function(a,u){d(a,u,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let n=r(8460),f=r(844),v=r(5295),w=r(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let p=s.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(c){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(c.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(c.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(c,this))}resize(c,d){this.cols=c,this.rows=d,this.buffers.resize(c,d),this._onResize.fire({cols:c,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,d=!1){let a=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===c.fg&&u.getBg(0)===c.bg||(u=a.getBlankLine(c,d),this._cachedBlankLine=u),u.isWrapped=d;let g=a.ybase+a.scrollTop,C=a.ybase+a.scrollBottom;if(a.scrollTop===0){let b=a.lines.isFull;C===a.lines.length-1?b?a.lines.recycle().copyFrom(u):a.lines.push(u.clone()):a.lines.splice(C+1,0,u.clone()),b?this.isUserScrolling&&(a.ydisp=Math.max(a.ydisp-1,0)):(a.ybase++,this.isUserScrolling||a.ydisp++)}else{let b=C-g+1;a.lines.shiftElements(g+1,b-1,-1),a.lines.set(C,u.clone())}this.isUserScrolling||(a.ydisp=a.ybase),this._onScroll.fire(a.ydisp)}scrollLines(c,d,a){let u=this.buffer;if(c<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else c+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let g=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+c,u.ybase),0),g!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};s.BufferService=p=o([_(0,w.IOptionsService)],p)},7994:(h,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,o){this._charsets[r]=o,this.glevel===r&&(this.charset=o)}}},1753:function(h,s,r){var o=this&&this.__decorate||function(u,g,C,b){var y,m=arguments.length,k=m<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(u,g,C,b);else for(var B=u.length-1;B>=0;B--)(y=u[B])&&(k=(m<3?y(k):m>3?y(g,C,k):y(g,C))||k);return m>3&&k&&Object.defineProperty(g,C,k),k},_=this&&this.__param||function(u,g){return function(C,b){g(C,b,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let n=r(2585),f=r(8460),v=r(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,g){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||g||(C|=3)),C}let c=String.fromCharCode,d={DEFAULT:u=>{let g=[p(u,!1)+32,u.col+32,u.row+32];return g[0]>255||g[1]>255||g[2]>255?"":`\x1B[M${c(g[0])}${c(g[1])}${c(g[2])}`},SGR:u=>{let g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${g}`},SGR_PIXELS:u=>{let g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${g}`}},a=s.CoreMouseService=class extends v.Disposable{constructor(u,g){super(),this._bufferService=u,this._coreService=g,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(w))this.addProtocol(C,w[C]);for(let C of Object.keys(d))this.addEncoding(C,d[C]);this.reset()}addProtocol(u,g){this._protocols[u]=g}addEncoding(u,g){this._encodings[u]=g}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 g=this._encodings[this._activeEncoding](u);return g&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(g):this._coreService.triggerDataEvent(g,!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,g,C){if(C){if(u.x!==g.x||u.y!==g.y)return!1}else if(u.col!==g.col||u.row!==g.row)return!1;return u.button===g.button&&u.action===g.action&&u.ctrl===g.ctrl&&u.alt===g.alt&&u.shift===g.shift}};s.CoreMouseService=a=o([_(0,n.IBufferService),_(1,n.ICoreService)],a)},6975:function(h,s,r){var o=this&&this.__decorate||function(a,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(a,u,g,C);else for(var k=a.length-1;k>=0;k--)(b=a[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},_=this&&this.__param||function(a,u){return function(g,C){u(g,C,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let n=r(1439),f=r(8460),v=r(844),w=r(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=s.CoreService=class extends v.Disposable{constructor(a,u,g){super(),this._bufferService=a,this._logService=u,this._optionsService=g,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(c)}reset(){this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(c)}triggerDataEvent(a,u=!1){if(this._optionsService.rawOptions.disableStdin)return;let g=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&g.ybase!==g.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${a}"`,(()=>a.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(a)}triggerBinaryEvent(a){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${a}"`,(()=>a.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(a))}};s.CoreService=d=o([_(0,w.IBufferService),_(1,w.ILogService),_(2,w.IOptionsService)],d)},9074:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let o=r(8055),_=r(8460),n=r(844),f=r(6106),v=0,w=0;class p extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList((a=>a?.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(a){if(a.marker.isDisposed)return;let u=new c(a);if(u){let g=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),g.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(let a of this._decorations.values())a.dispose();this._decorations.clear()}*getDecorationsAtCell(a,u,g){let C=0,b=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,b=C+(y.options.width??1),a>=C&&a<b&&(!g||(y.options.layer??"bottom")===g)&&(yield y)}forEachDecorationAtCell(a,u,g,C){this._decorations.forEachByKey(u,(b=>{v=b.options.x??0,w=v+(b.options.width??1),a>=v&&a<w&&(!g||(b.options.layer??"bottom")===g)&&C(b)}))}}s.DecorationService=p;class c extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=o.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=o.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(a){super(),this.options=a,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=a.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let o=r(2585),_=r(8343);class n{constructor(...v){this._entries=new Map;for(let[w,p]of v)this.set(w,p)}set(v,w){let p=this._entries.get(v);return this._entries.set(v,w),p}forEach(v){for(let[w,p]of this._entries.entries())v(w,p)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}s.ServiceCollection=n,s.InstantiationService=class{constructor(){this._services=new n,this._services.set(o.IInstantiationService,this)}setService(f,v){this._services.set(f,v)}getService(f){return this._services.get(f)}createInstance(f,...v){let w=(0,_.getServiceDependencies)(f).sort(((d,a)=>d.index-a.index)),p=[];for(let d of w){let a=this._services.get(d.id);if(!a)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${d.id}.`);p.push(a)}let c=w.length>0?w[0].index:v.length;if(v.length!==c)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${c+1} conflicts with ${v.length} static arguments`);return new f(...v,...p)}}},7866:function(h,s,r){var o=this&&this.__decorate||function(c,d,a,u){var g,C=arguments.length,b=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,a):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,d,a,u);else for(var y=c.length-1;y>=0;y--)(g=c[y])&&(b=(C<3?g(b):C>3?g(d,a,b):g(d,a))||b);return C>3&&b&&Object.defineProperty(d,a,b),b},_=this&&this.__param||function(c,d){return function(a,u){d(a,u,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let n=r(844),f=r(2585),v={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF},w,p=s.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let d=0;d<c.length;d++)typeof c[d]=="function"&&(c[d]=c[d]())}_log(c,d,a){this._evalLazyOptionalParams(a),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...a)}trace(c,...d){this._logLevel<=f.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,d)}debug(c,...d){this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,d)}info(c,...d){this._logLevel<=f.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,d)}warn(c,...d){this._logLevel<=f.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,d)}error(c,...d){this._logLevel<=f.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,d)}};s.LogService=p=o([_(0,f.IOptionsService)],p),s.setTraceLogger=function(c){w=c},s.traceCall=function(c,d,a){if(typeof a.value!="function")throw new Error("not supported");let u=a.value;a.value=function(...g){if(w.logLevel!==f.LogLevelEnum.TRACE)return u.apply(this,g);w.trace(`GlyphRenderer#${u.name}(${g.map((b=>JSON.stringify(b))).join(", ")})`);let C=u.apply(this,g);return w.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let o=r(8460),_=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 f=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends _.Disposable{constructor(p){super(),this._onOptionChange=this.register(new o.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let d in p)if(d in c)try{let a=p[d];c[d]=this._sanitizeAndValidateOption(d,a)}catch(a){console.error(a)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((d=>{d===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((d=>{p.indexOf(d)!==-1&&c()}))}_setupOptions(){let p=d=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},c=(d,a)=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);a=this._sanitizeAndValidateOption(d,a),this.rawOptions[d]!==a&&(this.rawOptions[d]=a,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let a={get:p.bind(this,d),set:c.bind(this,d)};Object.defineProperty(this.options,d,a)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[p]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${p}`);break;case"wordSeparator":c||(c=s.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=f.includes(c)?c:s.DEFAULT_OPTIONS[p];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${p} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${p} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}s.OptionsService=v},2660:function(h,s,r){var o=this&&this.__decorate||function(v,w,p,c){var d,a=arguments.length,u=a<3?w:c===null?c=Object.getOwnPropertyDescriptor(w,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(v,w,p,c);else for(var g=v.length-1;g>=0;g--)(d=v[g])&&(u=(a<3?d(u):a>3?d(w,p,u):d(w,p))||u);return a>3&&u&&Object.defineProperty(w,p,u),u},_=this&&this.__param||function(v,w){return function(p,c){w(p,c,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let n=r(2585),f=s.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){let w=this._bufferService.buffer;if(v.id===void 0){let g=w.addMarker(w.ybase+w.y),C={data:v,id:this._nextId++,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(C,g))),this._dataByLinkId.set(C.id,C),C.id}let p=v,c=this._getEntryIdKey(p),d=this._entriesWithId.get(c);if(d)return this.addLineToLink(d.id,w.ybase+w.y),d.id;let a=w.addMarker(w.ybase+w.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(u,a))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(v,w){let p=this._dataByLinkId.get(v);if(p&&p.lines.every((c=>c.line!==w))){let c=this._bufferService.buffer.addMarker(w);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){let p=v.lines.indexOf(w);p!==-1&&(v.lines.splice(p,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};s.OscLinkService=f=o([_(0,n.IBufferService)],f)},8343:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let r="di$target",o="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(_){return _[o]||[]},s.createDecorator=function(_){if(s.serviceRegistry.has(_))return s.serviceRegistry.get(_);let n=function(f,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,d){c[r]===c?c[o].push({id:p,index:d}):(c[o]=[{id:p,index:d}],c[r]=c)})(n,f,w)};return n.toString=()=>_,s.serviceRegistry.set(_,n),n}},2585:(h,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 o=r(8343);var _;s.IBufferService=(0,o.createDecorator)("BufferService"),s.ICoreMouseService=(0,o.createDecorator)("CoreMouseService"),s.ICoreService=(0,o.createDecorator)("CoreService"),s.ICharsetService=(0,o.createDecorator)("CharsetService"),s.IInstantiationService=(0,o.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"})(_||(s.LogLevelEnum=_={})),s.ILogService=(0,o.createDecorator)("LogService"),s.IOptionsService=(0,o.createDecorator)("OptionsService"),s.IOscLinkService=(0,o.createDecorator)("OscLinkService"),s.IUnicodeService=(0,o.createDecorator)("UnicodeService"),s.IDecorationService=(0,o.createDecorator)("DecorationService")},1480:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let o=r(8460),_=r(225);class n{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,p=!1){return(16777215&v)<<3|(3&w)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new o.EventEmitter,this.onChange=this._onChange.event;let v=new _.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,p=0,c=v.length;for(let d=0;d<c;++d){let a=v.charCodeAt(d);if(55296<=a&&a<=56319){if(++d>=c)return w+this.wcwidth(a);let C=v.charCodeAt(d);56320<=C&&C<=57343?a=1024*(a-55296)+C-56320+65536:w+=this.wcwidth(C)}let u=this.charProperties(a,p),g=n.extractWidth(u);n.extractShouldJoin(u)&&(g-=n.extractWidth(p)),w+=g,p=u}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}s.UnicodeService=n}},t={};function i(h){var s=t[h];if(s!==void 0)return s.exports;var r=t[h]={exports:{}};return e[h].call(r.exports,r,r.exports,i),r.exports}var l={};return(()=>{var h=l;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;let s=i(9042),r=i(3236),o=i(844),_=i(5741),n=i(8285),f=i(7975),v=i(7090),w=["cols","rows"];class p extends o.Disposable{constructor(d){super(),this._core=this.register(new r.Terminal(d)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};let a=g=>this._core.options[g],u=(g,C)=>{this._checkReadonlyOptions(g),this._core.options[g]=C};for(let g in this._core.options){let C={get:a.bind(this,g),set:u.bind(this,g)};Object.defineProperty(this._publicOptions,g,C)}}_checkReadonlyOptions(d){if(w.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 v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let d=this._core.coreService.decPrivateModes,a="none";switch(this._core.coreMouseService.activeProtocol){case"X10":a="x10";break;case"VT200":a="vt200";break;case"DRAG":a="drag";break;case"ANY":a="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:a,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let a in d)this._publicOptions[a]=d[a]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,a=!0){this._core.input(d,a)}resize(d,a){this._verifyIntegers(d,a),this._core.resize(d,a)}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,a,u){this._verifyIntegers(d,a,u),this._core.select(d,a,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,a){this._verifyIntegers(d,a),this._core.selectLines(d,a)}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,a){this._core.write(d,a)}writeln(d,a){this._core.write(d),this._core.write(`\r
9
- `,a)}paste(d){this._core.paste(d)}refresh(d,a){this._verifyIntegers(d,a),this._core.refresh(d,a)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return s}_verifyIntegers(...d){for(let a of d)if(a===1/0||isNaN(a)||a%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(let a of d)if(a&&(a===1/0||isNaN(a)||a%1!=0||a<0))throw new Error("This API only accepts positive integers")}}h.Terminal=p})(),l})()))});var Ar=Lr((Ci,_s)=>{(function(e,t){typeof Ci=="object"&&typeof _s=="object"?_s.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Ci=="object"?Ci.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 l=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(l._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,l=i._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;let h=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),n=r-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),f=o-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(f/l.css.cell.width)),rows:Math.max(1,Math.floor(n/l.css.cell.height))}}}})(),e})()))});var No=Mr(Tr(),1),Ho=Mr(Ar(),1);var ma=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Dr.isErrorNoTelemetry(e)?new Dr(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 k=this._getMouseBufferCoords(m),B=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(B&&O&&k)&&this._areCoordsInSelection(k,B,O)}isCellInSelection(m,k){let B=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!B||!O)&&this._areCoordsInSelection([m,k],B,O)}_areCoordsInSelection(m,k,B){return m[1]>k[1]&&m[1]<B[1]||k[1]===B[1]&&m[1]===k[1]&&m[0]>=k[0]&&m[0]<B[0]||k[1]<B[1]&&m[1]===B[1]&&m[0]<B[0]||k[1]<B[1]&&m[1]===k[1]&&m[0]>=k[0]}_selectWordAtCursor(m,k){let B=this._linkifier.currentLink?.link?.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let O=this._getMouseBufferCoords(m);return!!O&&(this._selectWordAt(O,k),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,k){this._model.clearSelection(),m=Math.max(m,0),k=Math.min(k,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,k],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let k=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(k)return k[0]--,k[1]--,k[1]+=this._bufferService.buffer.ydisp,k}_getMouseEventScrollAmount(m){let k=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],B=this._renderService.dimensions.css.canvas.height;return k>=0&&k<=B?0:(k>B&&(k-=B),k=Math.min(Math.max(k,-50),50),k/=50,k/Math.abs(k)+Math.round(14*k))}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 k=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);k&&k.length!==this._model.selectionStart[0]&&k.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let k=this._getMouseBufferCoords(m);k&&(this._activeSelectionMode=2,this._selectLineAt(k[1]))}shouldColumnSelect(m){return m.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let k=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 B=this._bufferService.buffer;if(this._model.selectionEnd[1]<B.lines.length){let O=B.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}k&&k[0]===this._model.selectionEnd[0]&&k[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 k=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&k<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let B=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){let O=(0,_.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,k=this._model.finalSelectionEnd,B=!(!m||!k||m[0]===k[0]&&m[1]===k[1]);B?m&&k&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&k[0]===this._oldSelectionEnd[0]&&k[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,k,B)):this._oldHasSelection&&this._fireOnSelectionChange(m,k,B)}_fireOnSelectionChange(m,k,B){this._oldSelectionStart=m,this._oldSelectionEnd=k,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((k=>this._handleTrim(k)))}_convertViewportColToCharacterIndex(m,k){let B=k;for(let O=0;k>=O;O++){let H=m.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:H>1&&k!==O&&(B+=H-1)}return B}setSelection(m,k,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,k],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,k,B=!0,O=!0){if(m[0]>=this._bufferService.cols)return;let H=this._bufferService.buffer,A=H.lines.get(m[1]);if(!A)return;let W=H.translateBufferLineToString(m[1],!1),P=this._convertViewportColToCharacterIndex(A,m[0]),M=P,I=m[0]-P,T=0,S=0,E=0,L=0;if(W.charAt(P)===" "){for(;P>0&&W.charAt(P-1)===" ";)P--;for(;M<W.length&&W.charAt(M+1)===" ";)M++}else{let K=m[0],Y=m[0];A.getWidth(K)===0&&(T++,K--),A.getWidth(Y)===2&&(S++,Y++);let z=A.getString(Y).length;for(z>1&&(L+=z-1,M+=z-1);K>0&&P>0&&!this._isCharWordSeparator(A.loadCell(K-1,this._workCell));){A.loadCell(K-1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===0?(T++,K--):D>1&&(E+=D-1,P-=D-1),P--,K--}for(;Y<A.length&&M+1<W.length&&!this._isCharWordSeparator(A.loadCell(Y+1,this._workCell));){A.loadCell(Y+1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,Y++):D>1&&(L+=D-1,M+=D-1),M++,Y++}}M++;let R=P+I-T+E,U=Math.min(this._bufferService.cols,M-P+T+S-E-L);if(k||W.slice(P,M).trim()!==""){if(B&&R===0&&A.getCodePoint(0)!==32){let K=H.lines.get(m[1]-1);if(K&&A.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let Y=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(Y){let z=this._bufferService.cols-Y.start;R-=z,U+=z}}}if(O&&R+U===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let K=H.lines.get(m[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let Y=this._getWordAt([0,m[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:R,length:U}}}_selectWordAt(m,k){let B=this._getWordAt(m,k);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[B.start,m[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(m){let k=this._getWordAt(m,!0);if(k){let B=m[1];for(;k.start<0;)k.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;k.start+k.length>this._bufferService.cols;)k.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?k.start:k.start+k.length,B]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let k=this._bufferService.buffer.getWrappedRangeForLine(m),B={start:{x:0,y:k.first},end:{x:this._bufferService.cols-1,y:k.last}};this._model.selectionStart=[0,k.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(B,this._bufferService.cols)}};r.SelectionService=y=a([f(3,g.IBufferService),f(4,g.ICoreService),f(5,w.IMouseService),f(6,g.IOptionsService),f(7,w.IRenderService),f(8,w.ICoreBrowserService)],y)},4725:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;let a=s(8343);r.ICharSizeService=(0,a.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),r.IMouseService=(0,a.createDecorator)("MouseService"),r.IRenderService=(0,a.createDecorator)("RenderService"),r.ISelectionService=(0,a.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,a.createDecorator)("ThemeService"),r.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(h,r,s){var a=this&&this.__decorate||function(y,m,k,B){var O,H=arguments.length,A=H<3?m:B===null?B=Object.getOwnPropertyDescriptor(m,k):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,m,k,B);else for(var W=y.length-1;W>=0;W--)(O=y[W])&&(A=(H<3?O(A):H>3?O(m,k,A):O(m,k))||A);return H>3&&A&&Object.defineProperty(m,k,A),A},f=this&&this.__param||function(y,m){return function(k,B){m(k,B,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let n=s(7239),_=s(8055),v=s(8460),w=s(844),p=s(2585),c=_.css.toColor("#ffffff"),d=_.css.toColor("#000000"),l=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),g={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.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 k=0;k<216;k++){let B=m[k/36%6|0],O=m[k/6%6|0],H=m[k%6];y.push({css:_.channels.toCss(B,O,H),rgba:_.channels.toRgba(B,O,H)})}for(let k=0;k<24;k++){let B=8+10*k;y.push({css:_.channels.toCss(B,B,B),rgba:_.channels.toRgba(B,B,B)})}return y})());let C=r.ThemeService=class extends w.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 v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:d,cursor:l,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:g,selectionBackgroundOpaque:_.color.blend(d,g),selectionInactiveBackgroundTransparent:g,selectionInactiveBackgroundOpaque:_.color.blend(d,g),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(y={}){let m=this._colors;if(m.foreground=b(y.foreground,c),m.background=b(y.background,d),m.cursor=b(y.cursor,l),m.cursorAccent=b(y.cursorAccent,u),m.selectionBackgroundTransparent=b(y.selectionBackground,g),m.selectionBackgroundOpaque=_.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=b(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=_.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?b(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=r.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=b(y.black,r.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=b(y.red,r.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=b(y.green,r.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=b(y.yellow,r.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=b(y.blue,r.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=b(y.magenta,r.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=b(y.cyan,r.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=b(y.white,r.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=b(y.brightBlack,r.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=b(y.brightRed,r.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=b(y.brightGreen,r.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=b(y.brightYellow,r.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=b(y.brightBlue,r.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=b(y.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=b(y.brightCyan,r.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=b(y.brightWhite,r.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let k=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let B=0;B<k;B++)m.ansi[B+16]=b(y.extendedAnsi[B],r.DEFAULT_ANSI_COLORS[B+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 b(y,m){if(y!==void 0)try{return _.css.toColor(y)}catch{}return m}r.ThemeService=C=a([f(0,p.IOptionsService)],C)},6349:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let a=s(8460),f=s(844);class n extends f.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new a.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new a.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new a.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;let w=new Array(v);for(let p=0;p<Math.min(v,this.length);p++)w[p]=this._array[this._getCyclicIndex(p)];this._array=w,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let w=this._length;w<v;w++)this._array[w]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,w){this._array[this._getCyclicIndex(v)]=w}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,w,...p){if(w){for(let c=v;c<this._length-w;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+w)];this._length-=w,this.onDeleteEmitter.fire({index:v,amount:w})}for(let c=this._length-1;c>=v;c--)this._array[this._getCyclicIndex(c+p.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<p.length;c++)this._array[this._getCyclicIndex(v+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:v,amount:p.length}),this._length+p.length>this._maxLength){let c=this._length+p.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=p.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,w,p){if(!(w<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let d=w-1;d>=0;d--)this.set(v+d+p,this.get(v+d));let c=v+w+p-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<w;c++)this.set(v+c+p,this.get(v+c))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=n},1439:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function s(a,f=5){if(typeof a!="object")return a;let n=Array.isArray(a)?[]:{};for(let _ in a)n[_]=f<=1?a[_]:a[_]&&s(a[_],f-1);return n}},8055:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let s=0,a=0,f=0,n=0;var _,v,w,p,c;function d(u){let g=u.toString(16);return g.length<2?"0"+g:g}function l(u,g){return u<g?(g+.05)/(u+.05):(u+.05)/(g+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(g,C,b,y){return y!==void 0?`#${d(g)}${d(C)}${d(b)}${d(y)}`:`#${d(g)}${d(C)}${d(b)}`},u.toRgba=function(g,C,b,y=255){return(g<<24|C<<16|b<<8|y)>>>0},u.toColor=function(g,C,b,y){return{css:u.toCss(g,C,b,y),rgba:u.toRgba(g,C,b,y)}}})(_||(r.channels=_={})),(function(u){function g(C,b){return n=Math.round(255*b),[s,a,f]=c.toChannels(C.rgba),{css:_.toCss(s,a,f,n),rgba:_.toRgba(s,a,f,n)}}u.blend=function(C,b){if(n=(255&b.rgba)/255,n===1)return{css:b.css,rgba:b.rgba};let y=b.rgba>>24&255,m=b.rgba>>16&255,k=b.rgba>>8&255,B=C.rgba>>24&255,O=C.rgba>>16&255,H=C.rgba>>8&255;return s=B+Math.round((y-B)*n),a=O+Math.round((m-O)*n),f=H+Math.round((k-H)*n),{css:_.toCss(s,a,f),rgba:_.toRgba(s,a,f)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,b,y){let m=c.ensureContrastRatio(C.rgba,b.rgba,y);if(m)return _.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let b=(255|C.rgba)>>>0;return[s,a,f]=c.toChannels(b),{css:_.toCss(s,a,f),rgba:b}},u.opacity=g,u.multiplyOpacity=function(C,b){return n=255&C.rgba,g(C,n*b/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(v||(r.color=v={})),(function(u){let g,C;try{let b=document.createElement("canvas");b.width=1,b.height=1;let y=b.getContext("2d",{willReadFrequently:!0});y&&(g=y,g.globalCompositeOperation="copy",C=g.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return s=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),f=parseInt(b.slice(3,4).repeat(2),16),_.toColor(s,a,f);case 5:return s=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),f=parseInt(b.slice(3,4).repeat(2),16),n=parseInt(b.slice(4,5).repeat(2),16),_.toColor(s,a,f,n);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}let y=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(y)return s=parseInt(y[1]),a=parseInt(y[2]),f=parseInt(y[3]),n=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),_.toColor(s,a,f,n);if(!g||!C)throw new Error("css.toColor: Unsupported css format");if(g.fillStyle=C,g.fillStyle=b,typeof g.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(g.fillRect(0,0,1,1),[s,a,f,n]=g.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(s,a,f,n),css:b}}})(w||(r.css=w={})),(function(u){function g(C,b,y){let m=C/255,k=b/255,B=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}u.relativeLuminance=function(C){return g(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=g})(p||(r.rgb=p={})),(function(u){function g(b,y,m){let k=b>>24&255,B=b>>16&255,O=b>>8&255,H=y>>24&255,A=y>>16&255,W=y>>8&255,P=l(p.relativeLuminance2(H,A,W),p.relativeLuminance2(k,B,O));for(;P<m&&(H>0||A>0||W>0);)H-=Math.max(0,Math.ceil(.1*H)),A-=Math.max(0,Math.ceil(.1*A)),W-=Math.max(0,Math.ceil(.1*W)),P=l(p.relativeLuminance2(H,A,W),p.relativeLuminance2(k,B,O));return(H<<24|A<<16|W<<8|255)>>>0}function C(b,y,m){let k=b>>24&255,B=b>>16&255,O=b>>8&255,H=y>>24&255,A=y>>16&255,W=y>>8&255,P=l(p.relativeLuminance2(H,A,W),p.relativeLuminance2(k,B,O));for(;P<m&&(H<255||A<255||W<255);)H=Math.min(255,H+Math.ceil(.1*(255-H))),A=Math.min(255,A+Math.ceil(.1*(255-A))),W=Math.min(255,W+Math.ceil(.1*(255-W))),P=l(p.relativeLuminance2(H,A,W),p.relativeLuminance2(k,B,O));return(H<<24|A<<16|W<<8|255)>>>0}u.blend=function(b,y){if(n=(255&y)/255,n===1)return y;let m=y>>24&255,k=y>>16&255,B=y>>8&255,O=b>>24&255,H=b>>16&255,A=b>>8&255;return s=O+Math.round((m-O)*n),a=H+Math.round((k-H)*n),f=A+Math.round((B-A)*n),_.toRgba(s,a,f)},u.ensureContrastRatio=function(b,y,m){let k=p.relativeLuminance(b>>8),B=p.relativeLuminance(y>>8);if(l(k,B)<m){if(B<k){let A=g(b,y,m),W=l(k,p.relativeLuminance(A>>8));if(W<m){let P=C(b,y,m);return W>l(k,p.relativeLuminance(P>>8))?A:P}return A}let O=C(b,y,m),H=l(k,p.relativeLuminance(O>>8));if(H<m){let A=g(b,y,m);return H>l(k,p.relativeLuminance(A>>8))?O:A}return O}},u.reduceLuminance=g,u.increaseLuminance=C,u.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}})(c||(r.rgba=c={})),r.toPaddedHex=d,r.contrastRatio=l},8969:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let a=s(844),f=s(2585),n=s(4348),_=s(7866),v=s(744),w=s(7302),p=s(6975),c=s(8460),d=s(1753),l=s(1480),u=s(7994),g=s(9282),C=s(5435),b=s(5981),y=s(2660),m=!1;class k extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((O=>{this._onScrollApi?.fire(O.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(O){for(let H in O)this.optionsService.options[H]=O[H]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new w.OptionsService(O)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.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(l.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,c.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,c.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,c.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,c.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 b.WriteBuffer(((H,A)=>this._inputHandler.parse(H,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,H){this._writeBuffer.write(O,H)}writeSync(O,H){this._logService.logLevel<=f.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(O,H)}input(O,H=!0){this.coreService.triggerDataEvent(O,H)}resize(O,H){isNaN(O)||isNaN(H)||(O=Math.max(O,v.MINIMUM_COLS),H=Math.max(H,v.MINIMUM_ROWS),this._bufferService.resize(O,H))}scroll(O,H=!1){this._bufferService.scroll(O,H)}scrollLines(O,H,A){this._bufferService.scrollLines(O,H,A)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){let H=O-this._bufferService.buffer.ydisp;H!==0&&this.scrollLines(H)}registerEscHandler(O,H){return this._inputHandler.registerEscHandler(O,H)}registerDcsHandler(O,H){return this._inputHandler.registerDcsHandler(O,H)}registerCsiHandler(O,H){return this._inputHandler.registerCsiHandler(O,H)}registerOscHandler(O,H){return this._inputHandler.registerOscHandler(O,H)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1,H=this.optionsService.rawOptions.windowsPty;H&&H.buildNumber!==void 0&&H.buildNumber!==void 0?O=H.backend==="conpty"&&H.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let O=[];O.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,g.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let H of O)H.dispose()}))}}}r.CoreTerminal=k},8460:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=s=>(this._listeners.push(s),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===s)return void this._listeners.splice(a,1)}}})),this._event}fire(s,a){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,s,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(s,a){return s((f=>a.fire(f)))},r.runAndSubscribe=function(s,a){return a(void 0),s((f=>a(f)))}},5435:function(h,r,s){var a=this&&this.__decorate||function(T,S,E,L){var R,U=arguments.length,K=U<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(T,S,E,L);else for(var Y=T.length-1;Y>=0;Y--)(R=T[Y])&&(K=(U<3?R(K):U>3?R(S,E,K):R(S,E))||K);return U>3&&K&&Object.defineProperty(S,E,K),K},f=this&&this.__param||function(T,S){return function(E,L){S(E,L,T)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let n=s(2584),_=s(7116),v=s(2015),w=s(844),p=s(482),c=s(8437),d=s(8460),l=s(643),u=s(511),g=s(3734),C=s(2585),b=s(1480),y=s(6242),m=s(6351),k=s(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function H(T,S){if(T>24)return S.setWinLines||!1;switch(T){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 A;(function(T){T[T.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",T[T.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(r.WindowsOptionsReportType=A={}));let W=0;class P extends w.Disposable{getAttrData(){return this._curAttrData}constructor(S,E,L,R,U,K,Y,z,D=new v.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=E,this._coreService=L,this._logService=R,this._optionsService=U,this._oscLinkService=K,this._coreMouseService=Y,this._unicodeService=z,this._parser=D,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.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 M(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((x=>this._activeBuffer=x.activeBuffer))),this._parser.setCsiHandlerFallback(((x,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:N.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,N,F)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:N,data:F})})),this._parser.setDcsHandlerFallback(((x,N,F)=>{N==="HOOK"&&(F=F.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:N,payload:F})})),this._parser.setPrintHandler(((x,N,F)=>this.print(x,N,F))),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,N)=>this.requestStatusString(x,N))))}_preserveStack(S,E,L,R){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=L,this._parseStack.position=R}_logSlowResolvingAsync(S){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([S,new Promise(((E,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,E){let L,R=this._activeBuffer.x,U=this._activeBuffer.y,K=0,Y=this._parseStack.paused;if(Y){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(L),L;R=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>O&&(K=this._parseStack.position+O)}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<O&&(this._parseBuffer=new Uint32Array(Math.min(S.length,O))),Y||this._dirtyRowTracker.clearRange(),S.length>O)for(let x=K;x<S.length;x+=O){let N=x+O<S.length?x+O:S.length,F=typeof S=="string"?this._stringDecoder.decode(S.substring(x,N),this._parseBuffer):this._utf8Decoder.decode(S.subarray(x,N),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,F))return this._preserveStack(R,U,F,x),this._logSlowResolvingAsync(L),L}else if(!Y){let x=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,x))return this._preserveStack(R,U,x,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===R&&this._activeBuffer.y===U||this._onCursorMove.fire();let z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),D=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);D<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(D,this._bufferService.rows-1),Math.min(z,this._bufferService.rows-1))}print(S,E,L){let R,U,K=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,z=this._bufferService.cols,D=this._coreService.decPrivateModes.wraparound,x=this._coreService.modes.insertMode,N=this._curAttrData,F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-E>0&&F.getWidth(this._activeBuffer.x-1)===2&&F.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let j=this._parser.precedingJoinState;for(let q=E;q<L;++q){if(R=S[q],R<127&&K){let Q=K[String.fromCharCode(R)];Q&&(R=Q.charCodeAt(0))}let Z=this._unicodeService.charProperties(R,j);U=b.UnicodeService.extractWidth(Z);let G=b.UnicodeService.extractShouldJoin(Z),X=G?b.UnicodeService.extractWidth(j):0;if(j=Z,Y&&this._onA11yChar.fire((0,p.stringFromCodePoint)(R)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-X>z){if(D){let Q=F,ee=this._activeBuffer.x-X;for(this._activeBuffer.x=X,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),X>0&&F instanceof c.BufferLine&&F.copyCellsFrom(Q,ee,0,X,!1);ee<z;)Q.setCellFromCodepoint(ee++,0,1,N)}else if(this._activeBuffer.x=z-1,U===2)continue}if(G&&this._activeBuffer.x){let Q=F.getWidth(this._activeBuffer.x-1)?1:2;F.addCodepointToCell(this._activeBuffer.x-Q,R,U);for(let ee=U-X;--ee>=0;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(x&&(F.insertCells(this._activeBuffer.x,U-X,this._activeBuffer.getNullCell(N)),F.getWidth(z-1)===2&&F.setCellFromCodepoint(z-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,N)),F.setCellFromCodepoint(this._activeBuffer.x++,R,U,N),U>0)for(;--U;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=j,this._activeBuffer.x<z&&L-E>0&&F.getWidth(this._activeBuffer.x)===0&&!F.hasContent(this._activeBuffer.x)&&F.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,E){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,E):this._parser.registerCsiHandler(S,(L=>!H(L.params[0],this._optionsService.rawOptions.windowOptions)||E(L)))}registerDcsHandler(S,E){return this._parser.registerDcsHandler(S,new m.DcsHandler(E))}registerEscHandler(S,E){return this._parser.registerEscHandler(S,E)}registerOscHandler(S,E){return this._parser.registerOscHandler(S,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 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,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=S,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+E)}cursorUp(S){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,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 E=S.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=S.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=S.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){let E=S.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,E,L,R=!1,U=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);K.replaceCells(E,L,this._activeBuffer.getNullCell(this._eraseAttrData()),U),R&&(K.isWrapped=!1)}_resetBufferLine(S,E=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),L.isWrapped=!1)}eraseInDisplay(S,E=!1){let L;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);L<this._bufferService.rows;L++)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 3:let R=this._activeBuffer.lines.length-this._bufferService.rows;R>0&&(this._activeBuffer.lines.trimStart(R),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-R,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-R,0),this._onScroll.fire(0))}return!0}eraseInLine(S,E=!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,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(S){this._restrictCursor();let E=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-R+1;for(;E--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(S){this._restrictCursor();let E=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,R;for(R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,R=this._bufferService.rows-1+this._activeBuffer.ybase-R;E--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(S){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.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 E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(S){let E=S.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(S){let E=S.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(c.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 E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);R.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);R.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);R.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=S.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);R.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.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 E=this._parser.precedingJoinState;if(!E)return!0;let L=S.params[0]||1,R=b.UnicodeService.extractWidth(E),U=this._activeBuffer.x-R,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(K.length*L),z=0;for(let x=0;x<K.length;){let N=K.codePointAt(x)||0;Y[z++]=N,x+=N>65535?2:1}let D=z;for(let x=1;x<L;++x)Y.copyWithin(D,0,z),D+=z;return this.print(Y,0,D),!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 E=0;E<S.length;E++)switch(S.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(S){for(let E=0;E<S.length;E++)switch(S.params[E]){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 E=0;E<S.length;E++)switch(S.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(S){for(let E=0;E<S.length;E++)switch(S.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(),S.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(S,E){let L=this._coreService.decPrivateModes,{activeProtocol:R,activeEncoding:U}=this._coreMouseService,K=this._coreService,{buffers:Y,cols:z}=this._bufferService,{active:D,alt:x}=Y,N=this._optionsService.rawOptions,F=G=>G?1:2,j=S.params[0];return q=j,Z=E?j===2?4:j===4?F(K.modes.insertMode):j===12?3:j===20?F(N.convertEol):0:j===1?F(L.applicationCursorKeys):j===3?N.windowOptions.setWinLines?z===80?2:z===132?1:0:0:j===6?F(L.origin):j===7?F(L.wraparound):j===8?3:j===9?F(R==="X10"):j===12?F(N.cursorBlink):j===25?F(!K.isCursorHidden):j===45?F(L.reverseWraparound):j===66?F(L.applicationKeypad):j===67?4:j===1e3?F(R==="VT200"):j===1002?F(R==="DRAG"):j===1003?F(R==="ANY"):j===1004?F(L.sendFocus):j===1005?4:j===1006?F(U==="SGR"):j===1015?4:j===1016?F(U==="SGR_PIXELS"):j===1048?1:j===47||j===1047||j===1049?F(D===x):j===2004?F(L.bracketedPasteMode):0,K.triggerDataEvent(`${n.C0.ESC}[${E?"":"?"}${q};${Z}$y`),!0;var q,Z}_updateAttrColor(S,E,L,R,U){return E===2?(S|=50331648,S&=-16777216,S|=g.AttributeData.fromColorRGB([L,R,U])):E===5&&(S&=-50331904,S|=33554432|255&L),S}_extractColor(S,E,L){let R=[0,0,-1,0,0,0],U=0,K=0;do{if(R[K+U]=S.params[E+K],S.hasSubParams(E+K)){let Y=S.getSubParams(E+K),z=0;do R[1]===5&&(U=1),R[K+z+1+U]=Y[z];while(++z<Y.length&&z+K+1+U<R.length);break}if(R[1]===5&&K+U>=2||R[1]===2&&K+U>=5)break;R[1]&&(U=1)}while(++K+E<S.length&&K+U<R.length);for(let Y=2;Y<R.length;++Y)R[Y]===-1&&(R[Y]=0);switch(R[0]){case 38:L.fg=this._updateAttrColor(L.fg,R[1],R[3],R[4],R[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,R[1],R[3],R[4],R[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,R[1],R[3],R[4],R[5])}return K}_processUnderline(S,E){E.extended=E.extended.clone(),(!~S||S>5)&&(S=1),E.extended.underlineStyle=S,E.fg|=268435456,S===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(S){S.fg=c.DEFAULT_ATTR_DATA.fg,S.bg=c.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 E=S.length,L,R=this._curAttrData;for(let U=0;U<E;U++)L=S.params[U],L>=30&&L<=37?(R.fg&=-50331904,R.fg|=16777216|L-30):L>=40&&L<=47?(R.bg&=-50331904,R.bg|=16777216|L-40):L>=90&&L<=97?(R.fg&=-50331904,R.fg|=16777224|L-90):L>=100&&L<=107?(R.bg&=-50331904,R.bg|=16777224|L-100):L===0?this._processSGR0(R):L===1?R.fg|=134217728:L===3?R.bg|=67108864:L===4?(R.fg|=268435456,this._processUnderline(S.hasSubParams(U)?S.getSubParams(U)[0]:1,R)):L===5?R.fg|=536870912:L===7?R.fg|=67108864:L===8?R.fg|=1073741824:L===9?R.fg|=2147483648:L===2?R.bg|=134217728:L===21?this._processUnderline(2,R):L===22?(R.fg&=-134217729,R.bg&=-134217729):L===23?R.bg&=-67108865:L===24?(R.fg&=-268435457,this._processUnderline(0,R)):L===25?R.fg&=-536870913:L===27?R.fg&=-67108865:L===28?R.fg&=-1073741825:L===29?R.fg&=2147483647:L===39?(R.fg&=-67108864,R.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):L===49?(R.bg&=-67108864,R.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?U+=this._extractColor(S,U,R):L===53?R.bg|=1073741824:L===55?R.bg&=-1073741825:L===59?(R.extended=R.extended.clone(),R.extended.underlineColor=-1,R.updateExtended()):L===100?(R.fg&=-67108864,R.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,R.bg&=-67108864,R.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${E};${L}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${E};${L}R`)}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=c.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 E=S.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let L=E%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(S){let E=S.params[0]||1,L;return(S.length<2||(L=S.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(S){if(!H(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;let E=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(A.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(A.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(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 E=[],L=S.split(";");for(;L.length>1;){let R=L.shift(),U=L.shift();if(/^\d+$/.exec(R)){let K=parseInt(R);if(I(K))if(U==="?")E.push({type:0,index:K});else{let Y=(0,k.parseColor)(U);Y&&E.push({type:1,index:K,color:Y})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(S){let E=S.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(S,E){this._getCurrentLinkId()&&this._finishHyperlink();let L=S.split(":"),R,U=L.findIndex((K=>K.startsWith("id=")));return U!==-1&&(R=L[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:R,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(S,E){let L=S.split(";");for(let R=0;R<L.length&&!(E>=this._specialColors.length);++R,++E)if(L[R]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let U=(0,k.parseColor)(L[R]);U&&this._onColor.fire([{type:1,index:this._specialColors[E],color:U}])}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 E=[],L=S.split(";");for(let R=0;R<L.length;++R)if(/^\d+$/.exec(L[R])){let U=parseInt(L[R]);I(U)&&E.push({type:2,index:U})}return E.length&&this._onColor.fire(E),!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(B[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=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.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 E=0;E<this._bufferService.rows;++E){let L=this._activeBuffer.ybase+this._activeBuffer.y+E,R=this._activeBuffer.lines.get(L);R&&(R.fill(S),R.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,E){let L=this._bufferService.buffer,R=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${U}${n.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:S==="m"?"P1$r0m":S===" q"?`P1$r${{block:2,underline:4,bar:6}[R.cursorStyle]-(R.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(S,E){this._dirtyRowTracker.markRangeDirty(S,E)}}r.InputHandler=P;let M=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,S){T>S&&(W=T,T=S,S=W),T<this.start&&(this.start=T),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function I(T){return 0<=T&&T<256}M=a([f(0,C.IBufferService)],M)},844:(h,r)=>{function s(a){for(let f of a)f.dispose();a.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let f=this._disposables.indexOf(a);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(a){this._isDisposed||a===this._value||(this._value?.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(a){return{dispose:a}},r.disposeArray=s,r.getDisposeArrayDisposable=function(a){return{dispose:()=>s(a)}}},1505:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class s{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={}}}r.TwoKeyMap=s,r.FourKeyMap=class{constructor(){this._data=new s}set(a,f,n,_,v){this._data.get(a,f)||this._data.set(a,f,new s),this._data.get(a,f).set(n,_,v)}get(a,f,n,_){return this._data.get(a,f)?.get(n,_)}clear(){this._data.clear()}}},6114:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;let s=r.isNode?"node":navigator.userAgent,a=r.isNode?"node":navigator.platform;r.isFirefox=s.includes("Firefox"),r.isLegacyEdge=s.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(s),r.getSafariVersion=function(){if(!r.isSafari)return 0;let f=s.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),r.isIpad=a==="iPad",r.isIphone=a==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),r.isLinux=a.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(s)},6106:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let s=0;r.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(s=this._search(this._getKey(a)),this._array.splice(s,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let f=this._getKey(a);if(f===void 0||(s=this._search(f),s===-1)||this._getKey(this._array[s])!==f)return!1;do if(this._array[s]===a)return this._array.splice(s,1),!0;while(++s<this._array.length&&this._getKey(this._array[s])===f);return!1}*getKeyIterator(a){if(this._array.length!==0&&(s=this._search(a),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===a))do yield this._array[s];while(++s<this._array.length&&this._getKey(this._array[s])===a)}forEachByKey(a,f){if(this._array.length!==0&&(s=this._search(a),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===a))do f(this._array[s]);while(++s<this._array.length&&this._getKey(this._array[s])===a)}values(){return[...this._array].values()}_search(a){let f=0,n=this._array.length-1;for(;n>=f;){let _=f+n>>1,v=this._getKey(this._array[_]);if(v>a)n=_-1;else{if(!(v<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}f=_+1}}return f}}},7226:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let a=s(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let w=0,p=0,c=v.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),p=Math.max(w,p),d=v.timeRemaining(),1.5*p>d)return c-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-w))}ms`),void this._start();c=d}this.clear()}}class n extends f{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){let w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}r.PriorityTaskQueue=n,r.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let a=s(643);r.updateWindowsModeWrappedState=function(f){let n=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=n?.get(f.cols-1),v=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);v&&_&&(v.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class s{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){let n=new s;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=s;class a{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 a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=a},9092:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let a=s(6349),f=s(7226),n=s(3734),_=s(8437),v=s(4634),w=s(511),p=s(643),c=s(4863),d=s(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(l,u,g){this._hasScrollback=l,this._optionsService=u,this._bufferService=g,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=w.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.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 a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,u){return new _.BufferLine(this._bufferService.cols,this.getNullCell(l),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;let u=l+this._optionsService.rawOptions.scrollback;return u>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:u}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=_.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,u){let g=this.getNullCell(_.DEFAULT_ATTR_DATA),C=0,b=this._getCorrectBufferLength(u);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<l)for(let m=0;m<this.lines.length;m++)C+=+this.lines.get(m).resize(l,g);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(l,g)):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(l,g)));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(b<this.lines.maxLength){let m=this.lines.length-b;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=b}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,u-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(l,u),this._cols>l))for(let y=0;y<this.lines.length;y++)C+=+this.lines.get(y).resize(l,g);this._cols=l,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return l}get _isReflowEnabled(){let l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,u){this._cols!==l&&(l>this._cols?this._reflowLarger(l,u):this._reflowSmaller(l,u))}_reflowLarger(l,u){let g=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(g.length>0){let C=(0,v.reflowLargerCreateNewLayout)(this.lines,g);(0,v.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(l,u,C.countRemoved)}}_reflowLargerAdjustViewport(l,u,g){let C=this.getNullCell(_.DEFAULT_ATTR_DATA),b=g;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new _.BufferLine(l,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-g,0)}_reflowSmaller(l,u){let g=this.getNullCell(_.DEFAULT_ATTR_DATA),C=[],b=0;for(let y=this.lines.length-1;y>=0;y--){let m=this.lines.get(y);if(!m||!m.isWrapped&&m.getTrimmedLength()<=l)continue;let k=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),k.unshift(m);let B=this.ybase+this.y;if(B>=y&&B<y+k.length)continue;let O=k[k.length-1].getTrimmedLength(),H=(0,v.reflowSmallerGetNewLineLengths)(k,this._cols,l),A=H.length-k.length,W;W=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+A):Math.max(0,this.lines.length-this.lines.maxLength+A);let P=[];for(let L=0;L<A;L++){let R=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);P.push(R)}P.length>0&&(C.push({start:y+k.length+b,newLines:P}),b+=P.length),k.push(...P);let M=H.length-1,I=H[M];I===0&&(M--,I=H[M]);let T=k.length-A-1,S=O;for(;T>=0;){let L=Math.min(S,I);if(k[M]===void 0)break;if(k[M].copyCellsFrom(k[T],S-L,I-L,L,!0),I-=L,I===0&&(M--,I=H[M]),S-=L,S===0){T--;let R=Math.max(T,0);S=(0,v.getWrappedLineTrimmedLength)(k,R,this._cols)}}for(let L=0;L<k.length;L++)H[L]<l&&k[L].setCell(H[L],g);let E=A-W;for(;E-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let M=0;M<this.lines.length;M++)m.push(this.lines.get(M));let k=this.lines.length,B=k-1,O=0,H=C[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let A=0;for(let M=Math.min(this.lines.maxLength-1,k+b-1);M>=0;M--)if(H&&H.start>B+A){for(let I=H.newLines.length-1;I>=0;I--)this.lines.set(M--,H.newLines[I]);M++,y.push({index:B+1,amount:H.newLines.length}),A+=H.newLines.length,H=C[++O]}else this.lines.set(M,m[B--]);let W=0;for(let M=y.length-1;M>=0;M--)y[M].index+=W,this.lines.onInsertEmitter.fire(y[M]),W+=y[M].amount;let P=Math.max(0,k+b-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(l,u,g=0,C){let b=this.lines.get(l);return b?b.translateToString(u,g,C):""}getWrappedRangeForLine(l){let u=l,g=l;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;g+1<this.lines.length&&this.lines.get(g+1).isWrapped;)g++;return{first:u,last:g}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===l&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){let u=new c.Marker(l);return this.markers.push(u),u.register(this.lines.onTrim((g=>{u.line-=g,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((g=>{u.line>=g.index&&(u.line+=g.amount)}))),u.register(this.lines.onDelete((g=>{u.line>=g.index&&u.line<g.index+g.amount&&u.dispose(),u.line>g.index&&(u.line-=g.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let a=s(3734),f=s(511),n=s(643),_=s(482);r.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let v=0;class w{constructor(c,d,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let u=d||f.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let g=0;g<c;++g)this.setCell(g,u);this.length=c}get(c){let d=this._data[3*c+0],l=2097151&d;return[this._data[3*c+1],2097152&d?this._combined[c]:l?(0,_.stringFromCodePoint)(l):"",d>>22,2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):l]}set(c,d){this._data[3*c+1]=d[n.CHAR_DATA_ATTR_INDEX],d[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=d[1],this._data[3*c+0]=2097152|c|d[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=d[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(c){return this._data[3*c+0]>>22}hasWidth(c){return 12582912&this._data[3*c+0]}getFg(c){return this._data[3*c+1]}getBg(c){return this._data[3*c+2]}hasContent(c){return 4194303&this._data[3*c+0]}getCodePoint(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&d}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c]:2097151&d?(0,_.stringFromCodePoint)(2097151&d):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,d){return v=3*c,d.content=this._data[v+0],d.fg=this._data[v+1],d.bg=this._data[v+2],2097152&d.content&&(d.combinedData=this._combined[c]),268435456&d.bg&&(d.extended=this._extendedAttrs[c]),d}setCell(c,d){2097152&d.content&&(this._combined[c]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[c]=d.extended),this._data[3*c+0]=d.content,this._data[3*c+1]=d.fg,this._data[3*c+2]=d.bg}setCellFromCodepoint(c,d,l,u){268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=d|l<<22,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}addCodepointToCell(c,d,l){let u=this._data[3*c+0];2097152&u?this._combined[c]+=(0,_.stringFromCodePoint)(d):2097151&u?(this._combined[c]=(0,_.stringFromCodePoint)(2097151&u)+(0,_.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,l&&(u&=-12582913,u|=l<<22),this._data[3*c+0]=u}insertCells(c,d,l){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length-c){let u=new f.CellData;for(let g=this.length-c-d-1;g>=0;--g)this.setCell(c+d+g,this.loadCell(c+g,u));for(let g=0;g<d;++g)this.setCell(c+g,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(c,d,l){if(c%=this.length,d<this.length-c){let u=new f.CellData;for(let g=0;g<this.length-c-d;++g)this.setCell(c+g,this.loadCell(c+d+g,u));for(let g=this.length-d;g<this.length;++g)this.setCell(g,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,l)}replaceCells(c,d,l,u=!1){if(u)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.isProtected(c)||this.setCell(c,l),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.setCell(c++,l)}resize(c,d){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let l=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{let u=new Uint32Array(l);u.set(this._data),this._data=u}for(let u=this.length;u<c;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,l);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let b=parseInt(u[C],10);b>=c&&delete this._combined[b]}let g=Object.keys(this._extendedAttrs);for(let C=0;C<g.length;C++){let b=parseInt(g[C],10);b>=c&&delete this._extendedAttrs[b]}}return this.length=c,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let c=new Uint32Array(this._data.length);return c.set(this._data),this._data=c,1}return 0}fill(c,d=!1){if(d)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,c);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,c)}}copyFrom(c){this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={};for(let d in c._combined)this._combined[d]=c._combined[d];this._extendedAttrs={};for(let d in c._extendedAttrs)this._extendedAttrs[d]=c._extendedAttrs[d];this.isWrapped=c.isWrapped}clone(){let c=new w(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let d in this._combined)c._combined[d]=this._combined[d];for(let d in this._extendedAttrs)c._extendedAttrs[d]=this._extendedAttrs[d];return c.isWrapped=this.isWrapped,c}getTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0}getNoBgTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0]||50331648&this._data[3*c+2])return c+(this._data[3*c+0]>>22);return 0}copyCellsFrom(c,d,l,u,g){let C=c._data;if(g)for(let y=u-1;y>=0;y--){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}let b=Object.keys(c._combined);for(let y=0;y<b.length;y++){let m=parseInt(b[y],10);m>=d&&(this._combined[m-d+l]=c._combined[m])}}translateToString(c,d,l,u){d=d??0,l=l??this.length,c&&(l=Math.min(l,this.getTrimmedLength())),u&&(u.length=0);let g="";for(;d<l;){let C=this._data[3*d+0],b=2097151&C,y=2097152&C?this._combined[d]:b?(0,_.stringFromCodePoint)(b):n.WHITESPACE_CELL_CHAR;if(g+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),g}}r.BufferLine=w},4841:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(s,a){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return a*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}},4634:(h,r)=>{function s(a,f,n){if(f===a.length-1)return a[f].getTrimmedLength();let _=!a[f].hasContent(n-1)&&a[f].getWidth(n-1)===1,v=a[f+1].getWidth(0)===2;return _&&v?n-1:n}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(a,f,n,_,v){let w=[];for(let p=0;p<a.length-1;p++){let c=p,d=a.get(++c);if(!d.isWrapped)continue;let l=[a.get(p)];for(;c<a.length&&d.isWrapped;)l.push(d),d=a.get(++c);if(_>=p&&_<c){p+=l.length-1;continue}let u=0,g=s(l,u,f),C=1,b=0;for(;C<l.length;){let m=s(l,C,f),k=m-b,B=n-g,O=Math.min(k,B);l[u].copyCellsFrom(l[C],b,g,O,!1),g+=O,g===n&&(u++,g=0),b+=O,b===m&&(C++,b=0),g===0&&u!==0&&l[u-1].getWidth(n-1)===2&&(l[u].copyCellsFrom(l[u-1],n-1,g++,1,!1),l[u-1].setCell(n-1,v))}l[u].replaceCells(g,n,v);let y=0;for(let m=l.length-1;m>0&&(m>u||l[m].getTrimmedLength()===0);m--)y++;y>0&&(w.push(p+l.length-y),w.push(y)),p+=l.length-1}return w},r.reflowLargerCreateNewLayout=function(a,f){let n=[],_=0,v=f[_],w=0;for(let p=0;p<a.length;p++)if(v===p){let c=f[++_];a.onDeleteEmitter.fire({index:p-w,amount:c}),p+=c-1,w+=c,v=f[++_]}else n.push(p);return{layout:n,countRemoved:w}},r.reflowLargerApplyNewLayout=function(a,f){let n=[];for(let _=0;_<f.length;_++)n.push(a.get(f[_]));for(let _=0;_<n.length;_++)a.set(_,n[_]);a.length=f.length},r.reflowSmallerGetNewLineLengths=function(a,f,n){let _=[],v=a.map(((d,l)=>s(a,l,f))).reduce(((d,l)=>d+l)),w=0,p=0,c=0;for(;c<v;){if(v-c<n){_.push(v-c);break}w+=n;let d=s(a,p,f);w>d&&(w-=d,p++);let l=a[p].getWidth(w-1)===2;l&&w--;let u=l?n-1:n;_.push(u),c+=u}return _},r.getWrappedLineTrimmedLength=s},5295:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let a=s(8460),f=s(844),n=s(9092);class _ extends f.Disposable{constructor(w,p){super(),this._optionsService=w,this._bufferService=p,this._onBufferActivate=this.register(new a.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new 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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,p){this._normal.resize(w,p),this._alt.resize(w,p),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}r.BufferSet=_},511:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let a=s(482),f=s(643),n=s(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(w){let p=new _;return p.setFromCharData(w),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(w[f.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(w[f.CHAR_DATA_CHAR_INDEX].length===2){let c=w[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let d=w[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(c-55296)+d-56320+65536|w[f.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=w[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[f.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=w[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},643:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let a=s(8460),f=s(844);class n{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new a.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}r.Marker=n,n._nextId=1},7116:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(h,r)=>{var s,a,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
8
+ `,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL="\x7F"})(s||(r.C0=s={})),(function(n){n.PAD="\x80",n.HOP="\x81",n.BPH="\x82",n.NBH="\x83",n.IND="\x84",n.NEL="\x85",n.SSA="\x86",n.ESA="\x87",n.HTS="\x88",n.HTJ="\x89",n.VTS="\x8A",n.PLD="\x8B",n.PLU="\x8C",n.RI="\x8D",n.SS2="\x8E",n.SS3="\x8F",n.DCS="\x90",n.PU1="\x91",n.PU2="\x92",n.STS="\x93",n.CCH="\x94",n.MW="\x95",n.SPA="\x96",n.EPA="\x97",n.SOS="\x98",n.SGCI="\x99",n.SCI="\x9A",n.CSI="\x9B",n.ST="\x9C",n.OSC="\x9D",n.PM="\x9E",n.APC="\x9F"})(a||(r.C1=a={})),(function(n){n.ST=`${s.ESC}\\`})(f||(r.C1_ESCAPED=f={}))},7399:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let a=s(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(n,_,v,w){let p={type:0,cancel:!1,key:void 0},c=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=n.ctrlKey?"\b":a.C0.DEL,n.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(n.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=n.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,n.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(v?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(v?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"A",v||p.key!==a.C0.ESC+"[1;3A"||(p.key=a.C0.ESC+"[1;5A")):p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"B",v||p.key!==a.C0.ESC+"[1;3B"||(p.key=a.C0.ESC+"[1;5B")):p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(p.key=a.C0.ESC+"[2~");break;case 46:p.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:p.key=c?a.C0.ESC+"[1;"+(c+1)+"H":_?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:p.key=c?a.C0.ESC+"[1;"+(c+1)+"F":_?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:n.shiftKey?p.type=2:n.ctrlKey?p.key=a.C0.ESC+"[5;"+(c+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:n.shiftKey?p.type=3:n.ctrlKey?p.key=a.C0.ESC+"[6;"+(c+1)+"~":p.key=a.C0.ESC+"[6~";break;case 112:p.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:p.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:p.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:p.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:p.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:p.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:p.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:p.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:p.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:p.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:p.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:p.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(v&&!w||!n.altKey||n.metaKey)!v||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?p.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(p.key=a.C0.US),n.key==="@"&&(p.key=a.C0.NUL)):n.keyCode===65&&(p.type=1);else{let d=f[n.keyCode],l=d?.[n.shiftKey?1:0];if(l)p.key=a.C0.ESC+l;else if(n.keyCode>=65&&n.keyCode<=90){let u=n.ctrlKey?n.keyCode-64:n.keyCode+32,g=String.fromCharCode(u);n.shiftKey&&(g=g.toUpperCase()),p.key=a.C0.ESC+g}else if(n.keyCode===32)p.key=a.C0.ESC+(n.ctrlKey?a.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let u=n.code.slice(3,4);n.shiftKey||(u=u.toLowerCase()),p.key=a.C0.ESC+u,p.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?p.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?p.key=a.C0.NUL:n.keyCode>=51&&n.keyCode<=55?p.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?p.key=a.C0.DEL:n.keyCode===219?p.key=a.C0.ESC:n.keyCode===220?p.key=a.C0.FS:n.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(s){return s>65535?(s-=65536,String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)},r.utf32ToString=function(s,a=0,f=s.length){let n="";for(let _=a;_<f;++_){let v=s[_];v>65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(s,a){let f=s.length;if(!f)return 0;let n=0,_=0;if(this._interim){let v=s.charCodeAt(_++);56320<=v&&v<=57343?a[n++]=1024*(this._interim-55296)+v-56320+65536:(a[n++]=this._interim,a[n++]=v),this._interim=0}for(let v=_;v<f;++v){let w=s.charCodeAt(v);if(55296<=w&&w<=56319){if(++v>=f)return this._interim=w,n;let p=s.charCodeAt(v);56320<=p&&p<=57343?a[n++]=1024*(w-55296)+p-56320+65536:(a[n++]=w,a[n++]=p)}else w!==65279&&(a[n++]=w)}return n}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(s,a){let f=s.length;if(!f)return 0;let n,_,v,w,p=0,c=0,d=0;if(this.interim[0]){let g=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let b,y=0;for(;(b=63&this.interim[++y])&&y<4;)C<<=6,C|=b;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=m-y;for(;d<k;){if(d>=f)return 0;if(b=s[d++],(192&b)!=128){d--,g=!0;break}this.interim[y++]=b,C<<=6,C|=63&b}g||(m===2?C<128?d--:a[p++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(a[p++]=C):C<65536||C>1114111||(a[p++]=C)),this.interim.fill(0)}let l=f-4,u=d;for(;u<f;){for(;!(!(u<l)||128&(n=s[u])||128&(_=s[u+1])||128&(v=s[u+2])||128&(w=s[u+3]));)a[p++]=n,a[p++]=_,a[p++]=v,a[p++]=w,u+=4;if(n=s[u++],n<128)a[p++]=n;else if((224&n)==192){if(u>=f)return this.interim[0]=n,p;if(_=s[u++],(192&_)!=128){u--;continue}if(c=(31&n)<<6|63&_,c<128){u--;continue}a[p++]=c}else if((240&n)==224){if(u>=f)return this.interim[0]=n,p;if(_=s[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,p;if(v=s[u++],(192&v)!=128){u--;continue}if(c=(15&n)<<12|(63&_)<<6|63&v,c<2048||c>=55296&&c<=57343||c===65279)continue;a[p++]=c}else if((248&n)==240){if(u>=f)return this.interim[0]=n,p;if(_=s[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,p;if(v=s[u++],(192&v)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=v,p;if(w=s[u++],(192&w)!=128){u--;continue}if(c=(7&n)<<18|(63&_)<<12|(63&v)<<6|63&w,c<65536||c>1114111)continue;a[p++]=c}}return p}}},225:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let a=s(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]],_;r.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;v<f.length;++v)_.fill(0,f[v][0],f[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?_[v]:(function(w,p){let c,d=0,l=p.length-1;if(w<p[0][0]||w>p[l][1])return!1;for(;l>=d;)if(c=d+l>>1,w>p[c][1])d=c+1;else{if(!(w<p[c][0]))return!0;l=c-1}return!1})(v,n)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let p=this.wcwidth(v),c=p===0&&w!==0;if(c){let d=a.UnicodeService.extractWidth(w);d===0?c=!1:d>p&&(p=d)}return a.UnicodeService.createPropertyValue(0,p,c)}}},5981:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let a=s(8460),f=s(844);class n extends f.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){let p=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],d=this._action(c,w);if(d){let u=g=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,g))):this._innerWrite(p,g);return void d.catch((g=>(queueMicrotask((()=>{throw g})),Promise.resolve(!1)))).then(u)}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-p>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=n},5941:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;let s=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,a=/^[\da-f]+$/;function f(n,_){let v=n.toString(16),w=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}r.parseColor=function(n){if(!n)return;let _=n.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let v=s.exec(_);if(v){let w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let v=_.length/3,w=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(_.slice(v*p,v*p+v),16);w[p]=v===1?c<<4:v===2?c:v===3?c>>4:c>>8}return w}},r.toRgbString=function(n,_=16){let[v,w,p]=n;return`rgb:${f(v,_)}/${f(w,_)}/${f(p,_)}`}},5770:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let a=s(482),f=s(8742),n=s(5770),_=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(w,p){this._handlers[w]===void 0&&(this._handlers[w]=[]);let c=this._handlers[w];return c.push(p),{dispose:()=>{let d=c.indexOf(p);d!==-1&&c.splice(d,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(w,p){if(this.reset(),this._ident=w,this._active=this._handlers[w]||_,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(w,p,c){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(w,p,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(w,p,c))}unhook(w,p=!0){if(this._active.length){let c=!1,d=this._active.length-1,l=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,c=p,l=this._stack.fallThrough,this._stack.paused=!1),!l&&c===!1){for(;d>=0&&(c=this._active[d].unhook(w),c!==!0);d--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,c;d--}for(;d>=0;d--)if(c=this._active[d].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",w);this._active=_,this._ident=0}};let v=new f.Params;v.addParam(0),r.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,p,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(w,p,c),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let p=!1;if(this._hitLimit)p=!1;else if(w&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=v,this._data="",this._hitLimit=!1,c)));return this._params=v,this._data="",this._hitLimit=!1,p}}},2015:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let a=s(844),f=s(8742),n=s(6242),_=s(6351);class v{constructor(d){this.table=new Uint8Array(d)}setDefault(d,l){this.table.fill(d<<4|l)}add(d,l,u,g){this.table[l<<8|d]=u<<4|g}addMany(d,l,u,g){for(let C=0;C<d.length;C++)this.table[l<<8|d[C]]=u<<4|g}}r.TransitionTable=v;let w=160;r.VT500_TRANSITION_TABLE=(function(){let c=new v(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),l=(y,m)=>d.slice(y,m),u=l(32,127),g=l(0,24);g.push(25),g.push.apply(g,l(28,32));let C=l(0,14),b;for(b in c.setDefault(1,0),c.addMany(u,0,2,0),C)c.addMany([24,26,153,154],b,3,0),c.addMany(l(128,144),b,3,0),c.addMany(l(144,152),b,3,0),c.add(156,b,0,0),c.add(27,b,11,1),c.add(157,b,4,8),c.addMany([152,158,159],b,0,7),c.add(155,b,11,3),c.add(144,b,11,9);return c.addMany(g,0,3,0),c.addMany(g,1,3,1),c.add(127,1,0,1),c.addMany(g,8,0,8),c.addMany(g,3,3,3),c.add(127,3,0,3),c.addMany(g,4,3,4),c.add(127,4,0,4),c.addMany(g,6,3,6),c.addMany(g,5,3,5),c.add(127,5,0,5),c.addMany(g,2,3,2),c.add(127,2,0,2),c.add(93,1,4,8),c.addMany(u,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(l(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(u,7,0,7),c.addMany(g,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(l(64,127),3,7,0),c.addMany(l(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(l(48,60),4,8,4),c.addMany(l(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(l(32,64),6,0,6),c.add(127,6,0,6),c.addMany(l(64,127),6,0,0),c.addMany(l(32,48),3,9,5),c.addMany(l(32,48),5,9,5),c.addMany(l(48,64),5,0,6),c.addMany(l(64,127),5,7,0),c.addMany(l(32,48),4,9,5),c.addMany(l(32,48),1,9,2),c.addMany(l(32,48),2,9,2),c.addMany(l(48,127),2,10,0),c.addMany(l(48,80),1,10,0),c.addMany(l(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(l(96,127),1,10,0),c.add(80,1,11,9),c.addMany(g,9,0,9),c.add(127,9,0,9),c.addMany(l(28,32),9,0,9),c.addMany(l(32,48),9,9,12),c.addMany(l(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(g,11,0,11),c.addMany(l(32,128),11,0,11),c.addMany(l(28,32),11,0,11),c.addMany(g,10,0,10),c.add(127,10,0,10),c.addMany(l(28,32),10,0,10),c.addMany(l(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(l(32,48),10,9,12),c.addMany(g,12,0,12),c.add(127,12,0,12),c.addMany(l(28,32),12,0,12),c.addMany(l(32,48),12,9,12),c.addMany(l(48,64),12,0,11),c.addMany(l(64,127),12,12,13),c.addMany(l(64,127),10,12,13),c.addMany(l(64,127),9,12,13),c.addMany(g,13,13,13),c.addMany(u,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(w,0,2,0),c.add(w,8,5,8),c.add(w,6,0,6),c.add(w,11,0,11),c.add(w,13,13,13),c})();class p extends a.Disposable{constructor(d=r.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=(l,u,g)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,u)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,a.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,l=[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 b=d.intermediates.charCodeAt(C);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=b}}if(d.final.length!==1)throw new Error("final must be a single byte");let g=d.final.charCodeAt(0);if(l[0]>g||g>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return u<<=8,u|=g,u}identToString(d){let l=[];for(;d;)l.push(String.fromCharCode(255&d)),d>>=8;return l.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,l){let u=this._identifier(d,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let g=this._escHandlers[u];return g.push(l),{dispose:()=>{let C=g.indexOf(l);C!==-1&&g.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,l){this._executeHandlers[d.charCodeAt(0)]=l}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,l){let u=this._identifier(d);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let g=this._csiHandlers[u];return g.push(l),{dispose:()=>{let C=g.indexOf(l);C!==-1&&g.splice(C,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,l){return this._dcsParser.registerHandler(this._identifier(d),l)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,l){return this._oscParser.registerHandler(d,l)}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,l,u,g,C){this._parseStack.state=d,this._parseStack.handlers=l,this._parseStack.handlerPos=u,this._parseStack.transition=g,this._parseStack.chunkPos=C}parse(d,l,u){let g,C=0,b=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,k=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&k>-1){for(;k>=0&&(g=m[k](this._params),g!==!0);k--)if(g instanceof Promise)return this._parseStack.handlerPos=k,g}this._parseStack.handlers=[];break;case 4:if(u===!1&&k>-1){for(;k>=0&&(g=m[k](),g!==!0);k--)if(g instanceof Promise)return this._parseStack.handlerPos=k,g}this._parseStack.handlers=[];break;case 6:if(C=d[this._parseStack.chunkPos],g=this._dcsParser.unhook(C!==24&&C!==26,u),g)return g;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],g=this._oscParser.end(C!==24&&C!==26,u),g)return g;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<l;++m){switch(C=d[m],b=this._transitions.table[this.currentState<<8|(C<160?C:w)],b>>4){case 2:for(let A=m+1;;++A){if(A>=l||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-1;break}if(++A>=l||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-1;break}if(++A>=l||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-1;break}if(++A>=l||(C=d[A])<32||C>126&&C<w){this._printHandler(d,m,A),m=A-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 k=this._csiHandlers[this._collect<<8|C],B=k?k.length-1:-1;for(;B>=0&&(g=k[B](this._params),g!==!0);B--)if(g instanceof Promise)return this._preserveStack(3,k,B,b,m),g;B<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<l&&(C=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let O=this._escHandlers[this._collect<<8|C],H=O?O.length-1:-1;for(;H>=0&&(g=O[H](),g!==!0);H--)if(g instanceof Promise)return this._preserveStack(4,O,H,b,m),g;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 A=m+1;;++A)if(A>=l||(C=d[A])===24||C===26||C===27||C>127&&C<w){this._dcsParser.put(d,m,A),m=A-1;break}break;case 14:if(g=this._dcsParser.unhook(C!==24&&C!==26),g)return this._preserveStack(6,[],0,b,m),g;C===27&&(b|=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 A=m+1;;A++)if(A>=l||(C=d[A])<32||C>127&&C<w){this._oscParser.put(d,m,A),m=A-1;break}break;case 6:if(g=this._oscParser.end(C!==24&&C!==26),g)return this._preserveStack(5,[],0,b,m),g;C===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}r.EscapeSequenceParser=p},6242:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let a=s(5770),f=s(482),n=[];r.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(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);let w=this._handlers[_];return w.push(v),{dispose:()=>{let p=w.indexOf(v);p!==-1&&w.splice(p,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(_,v,w){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,v,w);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,v,w))}start(){this.reset(),this._state=1}put(_,v,w){if(this._state!==3){if(this._state===1)for(;v<w;){let p=_[v++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&w-v>0&&this._put(_,v,w)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,w=v,c=this._stack.fallThrough,this._stack.paused=!1),!c&&w===!1){for(;p>=0&&(w=this._active[p].end(_),w!==!0);p--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,w;p--}for(;p>=0;p--)if(w=this._active[p].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",_);this._active=n,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,w){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,v,w),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,v}}},8742:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let s=2147483647;class a{static fromArray(n){let _=new a;if(!n.length)return _;for(let v=Array.isArray(n[0])?1:0;v<n.length;++v){let w=n[v];if(Array.isArray(w))for(let p=0;p<w.length;++p)_.addSubParam(w[p]);else _.addParam(w)}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 a(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 v=this._subParamsIdx[_]>>8,w=255&this._subParamsIdx[_];w-v>0&&n.push(Array.prototype.slice.call(this._subParams,v,w))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>s?s:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>s?s:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let _=this._subParamsIdx[n]>>8,v=255&this._subParamsIdx[n];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){let n={};for(let _=0;_<this.length;++_){let v=this._subParamsIdx[_]>>8,w=255&this._subParamsIdx[_];w-v>0&&(n[_]=this._subParams.slice(v,w))}return n}addDigit(n){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let v=this._digitIsSub?this._subParams:this.params,w=v[_-1];v[_-1]=~w?Math.min(10*w+n,s):n}}r.Params=a},5741:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let s=this._addons.length-1;s>=0;s--)this._addons[s].instance.dispose()}loadAddon(s,a){let f={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(f),a.dispose=()=>this._wrappedAddonDispose(f),a.activate(s)}_wrappedAddonDispose(s){if(s.isDisposed)return;let a=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===s){a=f;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");s.isDisposed=!0,s.dispose.apply(s.instance),this._addons.splice(a,1)}}},8771:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let a=s(3785),f=s(511);r.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 a.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let a=s(511);r.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 a.CellData)}translateToString(f,n,_){return this._line.translateToString(f,n,_)}}},8285:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let a=s(8771),f=s(8460),n=s(844);class _ extends n.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new a.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new a.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=_},7975:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(s){this._core=s}registerCsiHandler(s,a){return this._core.registerCsiHandler(s,(f=>a(f.toArray())))}addCsiHandler(s,a){return this.registerCsiHandler(s,a)}registerDcsHandler(s,a){return this._core.registerDcsHandler(s,((f,n)=>a(f,n.toArray())))}addDcsHandler(s,a){return this.registerDcsHandler(s,a)}registerEscHandler(s,a){return this._core.registerEscHandler(s,a)}addEscHandler(s,a){return this.registerEscHandler(s,a)}registerOscHandler(s,a){return this._core.registerOscHandler(s,a)}addOscHandler(s,a){return this.registerOscHandler(s,a)}}},7090:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(s){this._core=s}register(s){this._core.unicodeService.register(s)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(s){this._core.unicodeService.activeVersion=s}}},744:function(h,r,s){var a=this&&this.__decorate||function(c,d,l,u){var g,C=arguments.length,b=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(g=c[y])&&(b=(C<3?g(b):C>3?g(d,l,b):g(d,l))||b);return C>3&&b&&Object.defineProperty(d,l,b),b},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let n=s(8460),_=s(844),v=s(5295),w=s(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let p=r.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(c){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(c.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(c.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(c,this))}resize(c,d){this.cols=c,this.rows=d,this.buffers.resize(c,d),this._onResize.fire({cols:c,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,d=!1){let l=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===c.fg&&u.getBg(0)===c.bg||(u=l.getBlankLine(c,d),this._cachedBlankLine=u),u.isWrapped=d;let g=l.ybase+l.scrollTop,C=l.ybase+l.scrollBottom;if(l.scrollTop===0){let b=l.lines.isFull;C===l.lines.length-1?b?l.lines.recycle().copyFrom(u):l.lines.push(u.clone()):l.lines.splice(C+1,0,u.clone()),b?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{let b=C-g+1;l.lines.shiftElements(g+1,b-1,-1),l.lines.set(C,u.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(c,d,l){let u=this.buffer;if(c<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else c+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let g=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+c,u.ybase),0),g!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};r.BufferService=p=a([f(0,w.IOptionsService)],p)},7994:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(s){this.glevel=s,this.charset=this._charsets[s]}setgCharset(s,a){this._charsets[s]=a,this.glevel===s&&(this.charset=a)}}},1753:function(h,r,s){var a=this&&this.__decorate||function(u,g,C,b){var y,m=arguments.length,k=m<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(u,g,C,b);else for(var B=u.length-1;B>=0;B--)(y=u[B])&&(k=(m<3?y(k):m>3?y(g,C,k):y(g,C))||k);return m>3&&k&&Object.defineProperty(g,C,k),k},f=this&&this.__param||function(u,g){return function(C,b){g(C,b,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let n=s(2585),_=s(8460),v=s(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,g){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||g||(C|=3)),C}let c=String.fromCharCode,d={DEFAULT:u=>{let g=[p(u,!1)+32,u.col+32,u.row+32];return g[0]>255||g[1]>255||g[2]>255?"":`\x1B[M${c(g[0])}${c(g[1])}${c(g[2])}`},SGR:u=>{let g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${g}`},SGR_PIXELS:u=>{let g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${g}`}},l=r.CoreMouseService=class extends v.Disposable{constructor(u,g){super(),this._bufferService=u,this._coreService=g,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(w))this.addProtocol(C,w[C]);for(let C of Object.keys(d))this.addEncoding(C,d[C]);this.reset()}addProtocol(u,g){this._protocols[u]=g}addEncoding(u,g){this._encodings[u]=g}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 g=this._encodings[this._activeEncoding](u);return g&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(g):this._coreService.triggerDataEvent(g,!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,g,C){if(C){if(u.x!==g.x||u.y!==g.y)return!1}else if(u.col!==g.col||u.row!==g.row)return!1;return u.button===g.button&&u.action===g.action&&u.ctrl===g.ctrl&&u.alt===g.alt&&u.shift===g.shift}};r.CoreMouseService=l=a([f(0,n.IBufferService),f(1,n.ICoreService)],l)},6975:function(h,r,s){var a=this&&this.__decorate||function(l,u,g,C){var b,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,g,C);else for(var k=l.length-1;k>=0;k--)(b=l[k])&&(m=(y<3?b(m):y>3?b(u,g,m):b(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},f=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let n=s(1439),_=s(8460),v=s(844),w=s(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=r.CoreService=class extends v.Disposable{constructor(l,u,g){super(),this._bufferService=l,this._logService=u,this._optionsService=g,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)(p),this.decPrivateModes=(0,n.clone)(c)}reset(){this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(c)}triggerDataEvent(l,u=!1){if(this._optionsService.rawOptions.disableStdin)return;let g=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&g.ybase!==g.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(l))}};r.CoreService=d=a([f(0,w.IBufferService),f(1,w.ILogService),f(2,w.IOptionsService)],d)},9074:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let a=s(8055),f=s(8460),n=s(844),_=s(6106),v=0,w=0;class p extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((l=>l?.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(l){if(l.marker.isDisposed)return;let u=new c(l);if(u){let g=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),g.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(let l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,u,g){let C=0,b=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,b=C+(y.options.width??1),l>=C&&l<b&&(!g||(y.options.layer??"bottom")===g)&&(yield y)}forEachDecorationAtCell(l,u,g,C){this._decorations.forEachByKey(u,(b=>{v=b.options.x??0,w=v+(b.options.width??1),l>=v&&l<w&&(!g||(b.options.layer??"bottom")===g)&&C(b)}))}}r.DecorationService=p;class c extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=a.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=a.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,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=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let a=s(2585),f=s(8343);class n{constructor(...v){this._entries=new Map;for(let[w,p]of v)this.set(w,p)}set(v,w){let p=this._entries.get(v);return this._entries.set(v,w),p}forEach(v){for(let[w,p]of this._entries.entries())v(w,p)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=n,r.InstantiationService=class{constructor(){this._services=new n,this._services.set(a.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){let w=(0,f.getServiceDependencies)(_).sort(((d,l)=>d.index-l.index)),p=[];for(let d of w){let l=this._services.get(d.id);if(!l)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${d.id}.`);p.push(l)}let c=w.length>0?w[0].index:v.length;if(v.length!==c)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${c+1} conflicts with ${v.length} static arguments`);return new _(...v,...p)}}},7866:function(h,r,s){var a=this&&this.__decorate||function(c,d,l,u){var g,C=arguments.length,b=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(g=c[y])&&(b=(C<3?g(b):C>3?g(d,l,b):g(d,l))||b);return C>3&&b&&Object.defineProperty(d,l,b),b},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let n=s(844),_=s(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},w,p=r.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let d=0;d<c.length;d++)typeof c[d]=="function"&&(c[d]=c[d]())}_log(c,d,l){this._evalLazyOptionalParams(l),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...l)}trace(c,...d){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,d)}debug(c,...d){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,d)}info(c,...d){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,d)}warn(c,...d){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,d)}error(c,...d){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,d)}};r.LogService=p=a([f(0,_.IOptionsService)],p),r.setTraceLogger=function(c){w=c},r.traceCall=function(c,d,l){if(typeof l.value!="function")throw new Error("not supported");let u=l.value;l.value=function(...g){if(w.logLevel!==_.LogLevelEnum.TRACE)return u.apply(this,g);w.trace(`GlyphRenderer#${u.name}(${g.map((b=>JSON.stringify(b))).join(", ")})`);let C=u.apply(this,g);return w.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let a=s(8460),f=s(844),n=s(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord: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 v extends f.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...r.DEFAULT_OPTIONS};for(let d in p)if(d in c)try{let l=p[d];c[d]=this._sanitizeAndValidateOption(d,l)}catch(l){console.error(l)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((d=>{d===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((d=>{p.indexOf(d)!==-1&&c()}))}_setupOptions(){let p=d=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},c=(d,l)=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);l=this._sanitizeAndValidateOption(d,l),this.rawOptions[d]!==l&&(this.rawOptions[d]=l,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let l={get:p.bind(this,d),set:c.bind(this,d)};Object.defineProperty(this.options,d,l)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=r.DEFAULT_OPTIONS[p]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${p}`);break;case"wordSeparator":c||(c=r.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=_.includes(c)?c:r.DEFAULT_OPTIONS[p];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${p} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${p} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}r.OptionsService=v},2660:function(h,r,s){var a=this&&this.__decorate||function(v,w,p,c){var d,l=arguments.length,u=l<3?w:c===null?c=Object.getOwnPropertyDescriptor(w,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(v,w,p,c);else for(var g=v.length-1;g>=0;g--)(d=v[g])&&(u=(l<3?d(u):l>3?d(w,p,u):d(w,p))||u);return l>3&&u&&Object.defineProperty(w,p,u),u},f=this&&this.__param||function(v,w){return function(p,c){w(p,c,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let n=s(2585),_=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){let w=this._bufferService.buffer;if(v.id===void 0){let g=w.addMarker(w.ybase+w.y),C={data:v,id:this._nextId++,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(C,g))),this._dataByLinkId.set(C.id,C),C.id}let p=v,c=this._getEntryIdKey(p),d=this._entriesWithId.get(c);if(d)return this.addLineToLink(d.id,w.ybase+w.y),d.id;let l=w.addMarker(w.ybase+w.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(u,l))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(v,w){let p=this._dataByLinkId.get(v);if(p&&p.lines.every((c=>c.line!==w))){let c=this._bufferService.buffer.addMarker(w);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){let p=v.lines.indexOf(w);p!==-1&&(v.lines.splice(p,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=_=a([f(0,n.IBufferService)],_)},8343:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let s="di$target",a="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[a]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);let n=function(_,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,d){c[s]===c?c[a].push({id:p,index:d}):(c[a]=[{id:p,index:d}],c[s]=c)})(n,_,w)};return n.toString=()=>f,r.serviceRegistry.set(f,n),n}},2585:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;let a=s(8343);var f;r.IBufferService=(0,a.createDecorator)("BufferService"),r.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),r.ICoreService=(0,a.createDecorator)("CoreService"),r.ICharsetService=(0,a.createDecorator)("CharsetService"),r.IInstantiationService=(0,a.createDecorator)("InstantiationService"),(function(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||(r.LogLevelEnum=f={})),r.ILogService=(0,a.createDecorator)("LogService"),r.IOptionsService=(0,a.createDecorator)("OptionsService"),r.IOscLinkService=(0,a.createDecorator)("OscLinkService"),r.IUnicodeService=(0,a.createDecorator)("UnicodeService"),r.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let a=s(8460),f=s(225);class n{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,p=!1){return(16777215&v)<<3|(3&w)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let v=new f.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,p=0,c=v.length;for(let d=0;d<c;++d){let l=v.charCodeAt(d);if(55296<=l&&l<=56319){if(++d>=c)return w+this.wcwidth(l);let C=v.charCodeAt(d);56320<=C&&C<=57343?l=1024*(l-55296)+C-56320+65536:w+=this.wcwidth(C)}let u=this.charProperties(l,p),g=n.extractWidth(u);n.extractShouldJoin(u)&&(g-=n.extractWidth(p)),w+=g,p=u}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}r.UnicodeService=n}},t={};function i(h){var r=t[h];if(r!==void 0)return r.exports;var s=t[h]={exports:{}};return e[h].call(s.exports,s,s.exports,i),s.exports}var o={};return(()=>{var h=o;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;let r=i(9042),s=i(3236),a=i(844),f=i(5741),n=i(8285),_=i(7975),v=i(7090),w=["cols","rows"];class p extends a.Disposable{constructor(d){super(),this._core=this.register(new s.Terminal(d)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let l=g=>this._core.options[g],u=(g,C)=>{this._checkReadonlyOptions(g),this._core.options[g]=C};for(let g in this._core.options){let C={get:l.bind(this,g),set:u.bind(this,g)};Object.defineProperty(this._publicOptions,g,C)}}_checkReadonlyOptions(d){if(w.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 v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let d=this._core.coreService.decPrivateModes,l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let l in d)this._publicOptions[l]=d[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,l=!0){this._core.input(d,l)}resize(d,l){this._verifyIntegers(d,l),this._core.resize(d,l)}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,l,u){this._verifyIntegers(d,l,u),this._core.select(d,l,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,l){this._verifyIntegers(d,l),this._core.selectLines(d,l)}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,l){this._core.write(d,l)}writeln(d,l){this._core.write(d),this._core.write(`\r
9
+ `,l)}paste(d){this._core.paste(d)}refresh(d,l){this._verifyIntegers(d,l),this._core.refresh(d,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return r}_verifyIntegers(...d){for(let l of d)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(let l of d)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}h.Terminal=p})(),o})()))});var Hs=Ps((Li,wr)=>{(function(e,t){typeof Li=="object"&&typeof wr=="object"?wr.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Li=="object"?Li.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 o=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(o._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,o=i._renderService.dimensions;if(o.css.cell.width===0||o.css.cell.height===0)return;let h=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),n=s-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),_=a-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(_/o.css.cell.width)),rows:Math.max(1,Math.floor(n/o.css.cell.height))}}}})(),e})()))});var jo=Os(Ns(),1),qo=Os(Hs(),1);var Ta=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Fs.isErrorNoTelemetry(e)?new Fs(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)}},ba=new ma;function fs(e){wa(e)||ba.onUnexpectedError(e)}var gs="Canceled";function wa(e){return e instanceof Sa?!0:e instanceof Error&&e.name===gs&&e.message===gs}var Sa=class extends Error{constructor(){super(gs),this.name=this.message}},Dr=class ms extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ms)return t;let i=new ms;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Ca(e,t,i=0,l=e.length){let h=i,s=l;for(;h<s;){let r=Math.floor((h+s)/2);t(e[r])?h=r+1:s=r}return h-1}var ya=class jr{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(jr.assertInvariants){if(this._prevFindLastPredicate){for(let l of this._array)if(this._prevFindLastPredicate(l)&&!t(l))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=Ca(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};ya.assertInvariants=!1;var bs;(e=>{function t(s){return s<0}e.isLessThan=t;function i(s){return s<=0}e.isLessThanOrEqual=i;function l(s){return s>0}e.isGreaterThan=l;function h(s){return s===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(bs||(bs={}));function xa(e,t){return(i,l)=>t(e(i),e(l))}var Ea=(e,t)=>e-t,Br=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(l=>t(l)?i(l):!0))}map(t){return new ws(i=>this.iterate(l=>i(t(l))))}some(t){let i=!1;return this.iterate(l=>(i=t(l),!i)),i}findFirst(t){let i;return this.iterate(l=>t(l)?(i=l,!1):!0),i}findLast(t){let i;return this.iterate(l=>(t(l)&&(i=l),!0)),i}findLastMaxBy(t){let i,l=!0;return this.iterate(h=>((l||bs.isGreaterThan(t(h,i)))&&(l=!1,i=h),!0)),i}};Br.empty=new Br(e=>{});function ka(e,t){let i=Object.create(null);for(let l of e){let h=t(l),s=i[h];s||(s=i[h]=[]),s.push(l)}return i}var Pr,Or,fu=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Pr]="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))}[(Or=Symbol.iterator,Pr=Symbol.toStringTag,Or)](){return this.values()}},La=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 Ma(e,t){let i=this,l=!1,h;return function(){if(l)return h;if(l=!0,t)try{h=e.apply(i,arguments)}finally{t()}else h=e.apply(i,arguments);return h}}var Ss;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function l(){return i}e.empty=l;function*h(b){yield b}e.single=h;function s(b){return t(b)?b:h(b)}e.wrap=s;function r(b){return b||i}e.from=r;function*o(b){for(let y=b.length-1;y>=0;y--)yield b[y]}e.reverse=o;function _(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=_;function n(b){return b[Symbol.iterator]().next().value}e.first=n;function f(b,y){let m=0;for(let k of b)if(y(k,m++))return!0;return!1}e.some=f;function v(b,y){for(let m of b)if(y(m))return m}e.find=v;function*w(b,y){for(let m of b)y(m)&&(yield m)}e.filter=w;function*p(b,y){let m=0;for(let k of b)yield y(k,m++)}e.map=p;function*c(b,y){let m=0;for(let k of b)yield*y(k,m++)}e.flatMap=c;function*d(...b){for(let y of b)yield*y}e.concat=d;function a(b,y,m){let k=m;for(let B of b)k=y(k,B);return k}e.reduce=a;function*u(b,y,m=b.length){for(y<0&&(y+=b.length),m<0?m+=b.length:m>b.length&&(m=b.length);y<m;y++)yield b[y]}e.slice=u;function g(b,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,b];let k=b[Symbol.iterator]();for(let B=0;B<y;B++){let P=k.next();if(P.done)return[m,e.empty()];m.push(P.value)}return[m,{[Symbol.iterator](){return k}}]}e.consume=g;async function C(b){let y=[];for await(let m of b)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Ss||(Ss={}));var Ra=!1,Bt=null,Ta=class qr{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:qr.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 l=this.getDisposableData(t);l.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let l=i.get(t);if(l)return l;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,h),h}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 l;if(i)l=i;else{let _=new Map,n=[...this.livingDisposables.values()].filter(v=>v.source!==null&&!this.getRootParent(v,_).isSingleton);if(n.length===0)return;let f=new Set(n.map(v=>v.value));if(l=n.filter(v=>!(v.parent&&f.has(v.parent))),l.length===0)throw new Error("There are cyclic diposable chains!")}if(!l)return;function h(_){function n(v,w){for(;v.length>0&&w.some(p=>typeof p=="string"?p===v[0]:v[0].match(p));)v.shift()}let f=_.source.split(`
14
- `).map(v=>v.trim().replace("at ","")).filter(v=>v!=="");return n(f,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),f.reverse()}let s=new La;for(let _ of l){let n=h(_);for(let f=0;f<=n.length;f++)s.add(n.slice(0,f).join(`
15
- `),_)}l.sort(xa(_=>_.idx,Ea));let r="",o=0;for(let _ of l.slice(0,t)){o++;let n=h(_),f=[];for(let v=0;v<n.length;v++){let w=n[v];w=`(shared with ${s.get(n.slice(0,v+1).join(`
16
- `)).size}/${l.length} leaks) at ${w}`;let p=s.get(n.slice(0,v).join(`
17
- `)),c=ka([...p].map(d=>h(d)[v]),d=>d);delete c[n[v]];for(let[d,a]of Object.entries(c))f.unshift(` - stacktraces of ${a.length} other leaks continue with ${d}`);f.unshift(w)}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)}},Aa=new Ta;function Sr(e){Da(e)||Aa.onUnexpectedError(e)}var xr="Canceled";function Da(e){return e instanceof Ba?!0:e instanceof Error&&e.name===xr&&e.message===xr}var Ba=class extends Error{constructor(){super(xr),this.name=this.message}},Fs=class Er extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Er)return t;let i=new Er;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Pa(e,t,i=0,o=e.length){let h=i,r=o;for(;h<r;){let s=Math.floor((h+r)/2);t(e[s])?h=s+1:r=s}return h-1}var Oa=class Js{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Js.assertInvariants){if(this._prevFindLastPredicate){for(let o of this._array)if(this._prevFindLastPredicate(o)&&!t(o))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=Pa(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Oa.assertInvariants=!1;var kr;(e=>{function t(r){return r<0}e.isLessThan=t;function i(r){return r<=0}e.isLessThanOrEqual=i;function o(r){return r>0}e.isGreaterThan=o;function h(r){return r===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(kr||(kr={}));function Ia(e,t){return(i,o)=>t(e(i),e(o))}var Na=(e,t)=>e-t,Ws=class Lr{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 Lr(i=>this.iterate(o=>t(o)?i(o):!0))}map(t){return new Lr(i=>this.iterate(o=>i(t(o))))}some(t){let i=!1;return this.iterate(o=>(i=t(o),!i)),i}findFirst(t){let i;return this.iterate(o=>t(o)?(i=o,!1):!0),i}findLast(t){let i;return this.iterate(o=>(t(o)&&(i=o),!0)),i}findLastMaxBy(t){let i,o=!0;return this.iterate(h=>((o||kr.isGreaterThan(t(h,i)))&&(o=!1,i=h),!0)),i}};Ws.empty=new Ws(e=>{});function Ha(e,t){let i=Object.create(null);for(let o of e){let h=t(o),r=i[h];r||(r=i[h]=[]),r.push(o)}return i}var $s,Us,Ru=class{constructor(e,t){this.toKey=t,this._map=new Map,this[$s]="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))}[(Us=Symbol.iterator,$s=Symbol.toStringTag,Us)](){return this.values()}},Fa=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 Wa(e,t){let i=this,o=!1,h;return function(){if(o)return h;if(o=!0,t)try{h=e.apply(i,arguments)}finally{t()}else h=e.apply(i,arguments);return h}}var Mr;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function o(){return i}e.empty=o;function*h(b){yield b}e.single=h;function r(b){return t(b)?b:h(b)}e.wrap=r;function s(b){return b||i}e.from=s;function*a(b){for(let y=b.length-1;y>=0;y--)yield b[y]}e.reverse=a;function f(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=f;function n(b){return b[Symbol.iterator]().next().value}e.first=n;function _(b,y){let m=0;for(let k of b)if(y(k,m++))return!0;return!1}e.some=_;function v(b,y){for(let m of b)if(y(m))return m}e.find=v;function*w(b,y){for(let m of b)y(m)&&(yield m)}e.filter=w;function*p(b,y){let m=0;for(let k of b)yield y(k,m++)}e.map=p;function*c(b,y){let m=0;for(let k of b)yield*y(k,m++)}e.flatMap=c;function*d(...b){for(let y of b)yield*y}e.concat=d;function l(b,y,m){let k=m;for(let B of b)k=y(k,B);return k}e.reduce=l;function*u(b,y,m=b.length){for(y<0&&(y+=b.length),m<0?m+=b.length:m>b.length&&(m=b.length);y<m;y++)yield b[y]}e.slice=u;function g(b,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,b];let k=b[Symbol.iterator]();for(let B=0;B<y;B++){let O=k.next();if(O.done)return[m,e.empty()];m.push(O.value)}return[m,{[Symbol.iterator](){return k}}]}e.consume=g;async function C(b){let y=[];for await(let m of b)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Mr||(Mr={}));var $a=!1,Bt=null,Ua=class Zs{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:Zs.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 o=this.getDisposableData(t);o.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let o=i.get(t);if(o)return o;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,h),h}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 o;if(i)o=i;else{let f=new Map,n=[...this.livingDisposables.values()].filter(v=>v.source!==null&&!this.getRootParent(v,f).isSingleton);if(n.length===0)return;let _=new Set(n.map(v=>v.value));if(o=n.filter(v=>!(v.parent&&_.has(v.parent))),o.length===0)throw new Error("There are cyclic diposable chains!")}if(!o)return;function h(f){function n(v,w){for(;v.length>0&&w.some(p=>typeof p=="string"?p===v[0]:v[0].match(p));)v.shift()}let _=f.source.split(`
14
+ `).map(v=>v.trim().replace("at ","")).filter(v=>v!=="");return n(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let r=new Fa;for(let f of o){let n=h(f);for(let _=0;_<=n.length;_++)r.add(n.slice(0,_).join(`
15
+ `),f)}o.sort(Ia(f=>f.idx,Na));let s="",a=0;for(let f of o.slice(0,t)){a++;let n=h(f),_=[];for(let v=0;v<n.length;v++){let w=n[v];w=`(shared with ${r.get(n.slice(0,v+1).join(`
16
+ `)).size}/${o.length} leaks) at ${w}`;let p=r.get(n.slice(0,v).join(`
17
+ `)),c=Ha([...p].map(d=>h(d)[v]),d=>d);delete c[n[v]];for(let[d,l]of Object.entries(c))_.unshift(` - stacktraces of ${l.length} other leaks continue with ${d}`);_.unshift(w)}s+=`
18
18
 
19
19
 
20
- ==================== Leaking disposable ${o}/${l.length}: ${_.value.constructor.name} ====================
21
- ${f.join(`
20
+ ==================== Leaking disposable ${a}/${o.length}: ${f.value.constructor.name} ====================
21
+ ${_.join(`
22
22
  `)}
23
23
  ============================================================
24
24
 
25
- `}return l.length>t&&(r+=`
25
+ `}return o.length>t&&(s+=`
26
26
 
27
27
 
28
- ... and ${l.length-t} more leaking disposables
28
+ ... and ${o.length-t} more leaking disposables
29
29
 
30
- `),{leaks:l,details:r}}};Ta.idx=0;function Aa(e){Bt=e}if(Ra){let e="__is_disposable_tracked__";Aa(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!==je.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==je.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Ti(e){return Bt?.trackDisposable(e),e}function Ai(e){Bt?.markAsDisposed(e)}function ei(e,t){Bt?.setParent(e,t)}function Da(e,t){if(Bt)for(let i of e)Bt.setParent(i,t)}function Qt(e){if(Ss.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(l){t.push(l)}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 Kr(...e){let t=Pt(()=>Qt(e));return Da(e,t),t}function Pt(e){let t=Ti({dispose:Ma(()=>{Ai(t),e()})});return t}var Gr=class Vr{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ti(this)}dispose(){this._isDisposed||(Ai(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Qt(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?Vr.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))}};Gr.DISABLE_DISPOSED_WARNING=!1;var Ms=Gr,je=class{constructor(){this._store=new Ms,Ti(this),ei(this._store,this)}dispose(){Ai(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};je.None=Object.freeze({dispose(){}});var Mi=class{constructor(){this._isDisposed=!1,Ti(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,Ai(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ei(e,null),e}},Ir=class Cs{constructor(t){this.element=t,this.next=Cs.Undefined,this.prev=Cs.Undefined}};Ir.Undefined=new Ir(void 0);var Ba=globalThis.performance&&typeof globalThis.performance.now=="function",Pa=class Yr{static create(t){return new Yr(t)}constructor(t){this._now=Ba&&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}},Oa=!1,Nr=!1,Ia=!1,Ri;(e=>{e.None=()=>je.None;function t(O){if(Ia){let{onDidAddListener:T}=O,I=Es.create(),R=0;O.onDidAddListener=()=>{++R===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),I.print()),T?.()}}}function i(O,T){return w(O,()=>{},0,void 0,!0,void 0,T)}e.defer=i;function l(O){return(T,I=null,R)=>{let S=!1,E;return E=O(L=>{if(!S)return E?E.dispose():S=!0,T.call(I,L)},null,R),S&&E.dispose(),E}}e.once=l;function h(O,T,I){return f((R,S=null,E)=>O(L=>R.call(S,T(L)),null,E),I)}e.map=h;function s(O,T,I){return f((R,S=null,E)=>O(L=>{T(L),R.call(S,L)},null,E),I)}e.forEach=s;function r(O,T,I){return f((R,S=null,E)=>O(L=>T(L)&&R.call(S,L),null,E),I)}e.filter=r;function o(O){return O}e.signal=o;function _(...O){return(T,I=null,R)=>{let S=Kr(...O.map(E=>E(L=>T.call(I,L))));return v(S,R)}}e.any=_;function n(O,T,I,R){let S=I;return h(O,E=>(S=T(S,E),S),R)}e.reduce=n;function f(O,T){let I,R={onWillAddFirstListener(){I=O(S.fire,S)},onDidRemoveLastListener(){I?.dispose()}};T||t(R);let S=new ze(R);return T?.add(S),S.event}function v(O,T){return T instanceof Array?T.push(O):T&&T.add(O),O}function w(O,T,I=100,R=!1,S=!1,E,L){let M,U,q,Y=0,z,D={leakWarningThreshold:E,onWillAddFirstListener(){M=O(N=>{Y++,U=T(U,N),R&&!q&&(x.fire(U),U=void 0),z=()=>{let W=U;U=void 0,q=void 0,(!R||Y>1)&&x.fire(W),Y=0},typeof I=="number"?(clearTimeout(q),q=setTimeout(z,I)):q===void 0&&(q=0,queueMicrotask(z))})},onWillRemoveListener(){S&&Y>0&&z?.()},onDidRemoveLastListener(){z=void 0,M.dispose()}};L||t(D);let x=new ze(D);return L?.add(x),x.event}e.debounce=w;function p(O,T=0,I){return e.debounce(O,(R,S)=>R?(R.push(S),R):[S],T,void 0,!0,void 0,I)}e.accumulate=p;function c(O,T=(R,S)=>R===S,I){let R=!0,S;return r(O,E=>{let L=R||!T(E,S);return R=!1,S=E,L},I)}e.latch=c;function d(O,T,I){return[e.filter(O,T,I),e.filter(O,R=>!T(R),I)]}e.split=d;function a(O,T=!1,I=[],R){let S=I.slice(),E=O(U=>{S?S.push(U):M.fire(U)});R&&R.add(E);let L=()=>{S?.forEach(U=>M.fire(U)),S=null},M=new ze({onWillAddFirstListener(){E||(E=O(U=>M.fire(U)),R&&R.add(E))},onDidAddFirstListener(){S&&(T?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return R&&R.add(M),M.event}e.buffer=a;function u(O,T){return(I,R,S)=>{let E=T(new C);return O(function(L){let M=E.evaluate(L);M!==g&&I.call(R,M)},void 0,S)}}e.chain=u;let g=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push(I=>(T(I),I)),this}filter(T){return this.steps.push(I=>T(I)?I:g),this}reduce(T,I){let R=I;return this.steps.push(S=>(R=T(R,S),R)),this}latch(T=(I,R)=>I===R){let I=!0,R;return this.steps.push(S=>{let E=I||!T(S,R);return I=!1,R=S,E?S:g}),this}evaluate(T){for(let I of this.steps)if(T=I(T),T===g)break;return T}}function b(O,T,I=R=>R){let R=(...M)=>L.fire(I(...M)),S=()=>O.on(T,R),E=()=>O.removeListener(T,R),L=new ze({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=b;function y(O,T,I=R=>R){let R=(...M)=>L.fire(I(...M)),S=()=>O.addEventListener(T,R),E=()=>O.removeEventListener(T,R),L=new ze({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(O){return new Promise(T=>l(O)(T))}e.toPromise=m;function k(O){let T=new ze;return O.then(I=>{T.fire(I)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}e.fromPromise=k;function B(O,T){return O(I=>T.fire(I))}e.forward=B;function P(O,T,I){return T(I),O(R=>T(R))}e.runAndSubscribe=P;class H{constructor(T,I){this._observable=T,this._counter=0,this._hasChanged=!1;let R={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};I||t(R),this.emitter=new ze(R),I&&I.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,I){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,T){return new H(O,T).emitter.event}e.fromObservable=A;function F(O){return(T,I,R)=>{let S=0,E=!1,L={beginUpdate(){S++},endUpdate(){S--,S===0&&(O.reportChanges(),E&&(E=!1,T.call(I)))},handlePossibleChange(){},handleChange(){E=!0}};O.addObserver(L),O.reportChanges();let M={dispose(){O.removeObserver(L)}};return R instanceof Ms?R.add(M):Array.isArray(R)&&R.push(M),M}}e.fromObservableLight=F})(Ri||(Ri={}));var ys=class xs{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${xs._idPool++}`,xs.all.add(this)}start(t){this._stopWatch=new Pa,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}}};ys.all=new Set,ys._idPool=0;var Na=ys,Hr=-1,Xr=class Jr{constructor(t,i,l=(Jr._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=l,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let l=this.threshold;if(l<=0||i<l)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=l*.5;let[s,r]=this.getMostFrequentStack(),o=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${r}):`;console.warn(o),console.warn(s);let _=new Fa(o,s);this._errorHandler(_)}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[l,h]of this._stacks)(!t||i<h)&&(t=[l,h],i=h);return t}};Xr._idPool=1;var Ha=Xr,Es=class Zr{constructor(t){this.value=t}static create(){let t=new Error;return new Zr(t.stack??"")}print(){console.warn(this.value.split(`
30
+ `),{leaks:o,details:s}}};Ua.idx=0;function za(e){Bt=e}if($a){let e="__is_disposable_tracked__";za(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!==je.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==je.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Oi(e){return Bt?.trackDisposable(e),e}function Ii(e){Bt?.markAsDisposed(e)}function ti(e,t){Bt?.setParent(e,t)}function ja(e,t){if(Bt)for(let i of e)Bt.setParent(i,t)}function ei(e){if(Mr.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(o){t.push(o)}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 Qs(...e){let t=Pt(()=>ei(e));return ja(e,t),t}function Pt(e){let t=Oi({dispose:Wa(()=>{Ii(t),e()})});return t}var en=class tn{constructor(){this._toDispose=new Set,this._isDisposed=!1,Oi(this)}dispose(){this._isDisposed||(Ii(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ei(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 ti(t,this),this._isDisposed?tn.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),ti(t,null))}};en.DISABLE_DISPOSED_WARNING=!1;var Or=en,je=class{constructor(){this._store=new Or,Oi(this),ti(this._store,this)}dispose(){Ii(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};je.None=Object.freeze({dispose(){}});var Bi=class{constructor(){this._isDisposed=!1,Oi(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ti(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Ii(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ti(e,null),e}},zs=class Rr{constructor(t){this.element=t,this.next=Rr.Undefined,this.prev=Rr.Undefined}};zs.Undefined=new zs(void 0);var qa=globalThis.performance&&typeof globalThis.performance.now=="function",Ka=class rn{static create(t){return new rn(t)}constructor(t){this._now=qa&&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}},Ga=!1,js=!1,Va=!1,Pi;(e=>{e.None=()=>je.None;function t(P){if(Va){let{onDidAddListener:M}=P,I=Dr.create(),T=0;P.onDidAddListener=()=>{++T===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),I.print()),M?.()}}}function i(P,M){return w(P,()=>{},0,void 0,!0,void 0,M)}e.defer=i;function o(P){return(M,I=null,T)=>{let S=!1,E;return E=P(L=>{if(!S)return E?E.dispose():S=!0,M.call(I,L)},null,T),S&&E.dispose(),E}}e.once=o;function h(P,M,I){return _((T,S=null,E)=>P(L=>T.call(S,M(L)),null,E),I)}e.map=h;function r(P,M,I){return _((T,S=null,E)=>P(L=>{M(L),T.call(S,L)},null,E),I)}e.forEach=r;function s(P,M,I){return _((T,S=null,E)=>P(L=>M(L)&&T.call(S,L),null,E),I)}e.filter=s;function a(P){return P}e.signal=a;function f(...P){return(M,I=null,T)=>{let S=Qs(...P.map(E=>E(L=>M.call(I,L))));return v(S,T)}}e.any=f;function n(P,M,I,T){let S=I;return h(P,E=>(S=M(S,E),S),T)}e.reduce=n;function _(P,M){let I,T={onWillAddFirstListener(){I=P(S.fire,S)},onDidRemoveLastListener(){I?.dispose()}};M||t(T);let S=new ze(T);return M?.add(S),S.event}function v(P,M){return M instanceof Array?M.push(P):M&&M.add(P),P}function w(P,M,I=100,T=!1,S=!1,E,L){let R,U,K,Y=0,z,D={leakWarningThreshold:E,onWillAddFirstListener(){R=P(N=>{Y++,U=M(U,N),T&&!K&&(x.fire(U),U=void 0),z=()=>{let F=U;U=void 0,K=void 0,(!T||Y>1)&&x.fire(F),Y=0},typeof I=="number"?(clearTimeout(K),K=setTimeout(z,I)):K===void 0&&(K=0,queueMicrotask(z))})},onWillRemoveListener(){S&&Y>0&&z?.()},onDidRemoveLastListener(){z=void 0,R.dispose()}};L||t(D);let x=new ze(D);return L?.add(x),x.event}e.debounce=w;function p(P,M=0,I){return e.debounce(P,(T,S)=>T?(T.push(S),T):[S],M,void 0,!0,void 0,I)}e.accumulate=p;function c(P,M=(T,S)=>T===S,I){let T=!0,S;return s(P,E=>{let L=T||!M(E,S);return T=!1,S=E,L},I)}e.latch=c;function d(P,M,I){return[e.filter(P,M,I),e.filter(P,T=>!M(T),I)]}e.split=d;function l(P,M=!1,I=[],T){let S=I.slice(),E=P(U=>{S?S.push(U):R.fire(U)});T&&T.add(E);let L=()=>{S?.forEach(U=>R.fire(U)),S=null},R=new ze({onWillAddFirstListener(){E||(E=P(U=>R.fire(U)),T&&T.add(E))},onDidAddFirstListener(){S&&(M?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return T&&T.add(R),R.event}e.buffer=l;function u(P,M){return(I,T,S)=>{let E=M(new C);return P(function(L){let R=E.evaluate(L);R!==g&&I.call(T,R)},void 0,S)}}e.chain=u;let g=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(I=>(M(I),I)),this}filter(M){return this.steps.push(I=>M(I)?I:g),this}reduce(M,I){let T=I;return this.steps.push(S=>(T=M(T,S),T)),this}latch(M=(I,T)=>I===T){let I=!0,T;return this.steps.push(S=>{let E=I||!M(S,T);return I=!1,T=S,E?S:g}),this}evaluate(M){for(let I of this.steps)if(M=I(M),M===g)break;return M}}function b(P,M,I=T=>T){let T=(...R)=>L.fire(I(...R)),S=()=>P.on(M,T),E=()=>P.removeListener(M,T),L=new ze({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=b;function y(P,M,I=T=>T){let T=(...R)=>L.fire(I(...R)),S=()=>P.addEventListener(M,T),E=()=>P.removeEventListener(M,T),L=new ze({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(P){return new Promise(M=>o(P)(M))}e.toPromise=m;function k(P){let M=new ze;return P.then(I=>{M.fire(I)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=k;function B(P,M){return P(I=>M.fire(I))}e.forward=B;function O(P,M,I){return M(I),P(T=>M(T))}e.runAndSubscribe=O;class H{constructor(M,I){this._observable=M,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};I||t(T),this.emitter=new ze(T),I&&I.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,I){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(P,M){return new H(P,M).emitter.event}e.fromObservable=A;function W(P){return(M,I,T)=>{let S=0,E=!1,L={beginUpdate(){S++},endUpdate(){S--,S===0&&(P.reportChanges(),E&&(E=!1,M.call(I)))},handlePossibleChange(){},handleChange(){E=!0}};P.addObserver(L),P.reportChanges();let R={dispose(){P.removeObserver(L)}};return T instanceof Or?T.add(R):Array.isArray(T)&&T.push(R),R}}e.fromObservableLight=W})(Pi||(Pi={}));var Tr=class Ar{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ar._idPool++}`,Ar.all.add(this)}start(t){this._stopWatch=new Ka,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}}};Tr.all=new Set,Tr._idPool=0;var Ya=Tr,qs=-1,sn=class nn{constructor(t,i,o=(nn._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=o,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let o=this.threshold;if(o<=0||i<o)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=o*.5;let[r,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(r);let f=new Ja(a,r);this._errorHandler(f)}return()=>{let r=this._stacks.get(t.value)||0;this._stacks.set(t.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[o,h]of this._stacks)(!t||i<h)&&(t=[o,h],i=h);return t}};sn._idPool=1;var Xa=sn,Dr=class on{constructor(t){this.value=t}static create(){let t=new Error;return new on(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}},Wa=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},$a=0,xi=class{constructor(e){this.value=e,this.id=$a++}},Ua=2,za=(e,t)=>{if(e instanceof xi)t(e);else for(let i=0;i<e.length;i++){let l=e[i];l&&t(l)}},Ei;if(Oa){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),Ei=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var ze=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Hr>0||this._options?.leakWarningThreshold?new Ha(e?.onListenerError??fs,this._options?.leakWarningThreshold??Hr):void 0,this._perfMon=this._options?._profName?new Na(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(Nr){let e=this._listeners;queueMicrotask(()=>{za(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 o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new Wa(`${o}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(this._options?.onListenerError||fs)(n),je.None}if(this._disposed)return je.None;t&&(e=e.bind(t));let l=new xi(e),h,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(l.stack=Es.create(),h=this._leakageMon.check(l.stack,this._size+1)),Nr&&(l.stack=s??Es.create()),this._listeners?this._listeners instanceof xi?(this._deliveryQueue??(this._deliveryQueue=new ja),this._listeners=[this._listeners,l]):this._listeners.push(l):(this._options?.onWillAddFirstListener?.(this),this._listeners=l,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=Pt(()=>{Ei?.unregister(r),h?.(),this._removeListener(l)});if(i instanceof Ms?i.add(r):Array.isArray(i)&&i.push(r),Ei){let o=new Error().stack.split(`
32
+ `))}},Ja=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Za=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Qa=0,Ri=class{constructor(e){this.value=e,this.id=Qa++}},el=2,tl=(e,t)=>{if(e instanceof Ri)t(e);else for(let i=0;i<e.length;i++){let o=e[i];o&&t(o)}},Ti;if(Ga){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),Ti=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var ze=class{constructor(e){this._size=0,this._options=e,this._leakageMon=qs>0||this._options?.leakWarningThreshold?new Xa(e?.onListenerError??Sr,this._options?.leakWarningThreshold??qs):void 0,this._perfMon=this._options?._profName?new Ya(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(js){let e=this._listeners;queueMicrotask(()=>{tl(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 a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new Za(`${a}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Sr)(n),je.None}if(this._disposed)return je.None;t&&(e=e.bind(t));let o=new Ri(e),h,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=Dr.create(),h=this._leakageMon.check(o.stack,this._size+1)),js&&(o.stack=r??Dr.create()),this._listeners?this._listeners instanceof Ri?(this._deliveryQueue??(this._deliveryQueue=new il),this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=Pt(()=>{Ti?.unregister(s),h?.(),this._removeListener(o)});if(i instanceof Or?i.add(s):Array.isArray(i)&&i.push(s),Ti){let a=new Error().stack.split(`
34
34
  `).slice(2,3).join(`
35
- `).trim(),_=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(o);Ei.register(r,_?.[2]??o,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 l=this._deliveryQueue.current===this;if(this._size*Ua<=t.length){let h=0;for(let s=0;s<t.length;s++)t[s]?t[h++]=t[s]:l&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||fs;if(!i){e.value(t);return}try{e.value(t)}catch(l){i(l)}}_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 xi)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}},ja=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}},Qr=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Fr;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof qa?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ri.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Qr})})(Fr||(Fr={}));var qa=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?Qr:(this._emitter||(this._emitter=new ze),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Dt="en",ks=!1,Ls=!1,ki=!1,Ka=!1,Ga=!1,en=!1,Va=!1,Ya=!1,Xa=!1,Ja=!1,yi,Li=Dt,Wr=Dt,Za,Qe,et=globalThis,De;typeof et.vscode<"u"&&typeof et.vscode.process<"u"?De=et.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(De=process);var tn=typeof De?.versions?.electron=="string",Qa=tn&&De?.type==="renderer";if(typeof De=="object"){ks=De.platform==="win32",Ls=De.platform==="darwin",ki=De.platform==="linux",Ka=ki&&!!De.env.SNAP&&!!De.env.SNAP_REVISION,Va=tn,Xa=!!De.env.CI||!!De.env.BUILD_ARTIFACTSTAGINGDIRECTORY,yi=Dt,Li=Dt;let e=De.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);yi=t.userLocale,Wr=t.osLocale,Li=t.resolvedLanguage||Dt,Za=t.languagePack?.translationsConfigFile}catch{}Ga=!0}else typeof navigator=="object"&&!Qa?(Qe=navigator.userAgent,ks=Qe.indexOf("Windows")>=0,Ls=Qe.indexOf("Macintosh")>=0,Ya=(Qe.indexOf("Macintosh")>=0||Qe.indexOf("iPad")>=0||Qe.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ki=Qe.indexOf("Linux")>=0,Ja=Qe?.indexOf("Mobi")>=0,en=!0,Li=globalThis._VSCODE_NLS_LANGUAGE||Dt,yi=navigator.language.toLowerCase(),Wr=yi):console.error("Unable to resolve platform.");var ps=0;Ls?ps=1:ks?ps=3:ki&&(ps=2);var el=en&&typeof et.importScripts=="function",pu=el?et.origin:void 0,qe=Qe,ct=Li,$r;(e=>{function t(){return ct}e.value=t;function i(){return ct.length===2?ct==="en":ct.length>=3?ct[0]==="e"&&ct[1]==="n"&&ct[2]==="-":!1}e.isDefaultVariant=i;function l(){return ct==="en"}e.isDefault=l})($r||($r={}));var tl=typeof et.postMessage=="function"&&!et.importScripts,il=(()=>{if(tl){let e=[];et.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let l=0,h=e.length;l<h;l++){let s=e[l];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(l,1),s.callback();return}}});let t=0;return i=>{let l=++t;e.push({id:l,callback:i}),et.postMessage({vscodeScheduleAsyncWork:l},"*")}}return e=>setTimeout(e)})(),sl=!!(qe&&qe.indexOf("Chrome")>=0),vu=!!(qe&&qe.indexOf("Firefox")>=0),gu=!!(!sl&&qe&&qe.indexOf("Safari")>=0),mu=!!(qe&&qe.indexOf("Edg/")>=0),bu=!!(qe&&qe.indexOf("Android")>=0);function sn(e,t=0,i){let l=setTimeout(()=>{e(),i&&h.dispose()},t),h=Pt(()=>{clearTimeout(l),i?.deleteAndLeak(h)});return i?.add(h),h}var rl,vs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?vs=(e,t)=>{il(()=>{if(i)return;let l=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,l-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:vs=(e,t,i)=>{let l=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(l))}}},rl=e=>vs(globalThis,e)})();var Ur;(e=>{async function t(l){let h,s=await Promise.all(l.map(r=>r.then(o=>o,o=>{h||(h=o)})));if(typeof h<"u")throw h;return s}e.settled=t;function i(l){return new Promise(async(h,s)=>{try{await l(h,s)}catch(r){s(r)}})}e.withAsyncBody=i})(Ur||(Ur={}));var zr=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 l=>i.emitOne(await l)))})}static merge(t){return new Ie(async i=>{await Promise.all(t.map(async l=>{for await(let h of l)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ze,queueMicrotask(async()=>{let l={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(l)),this.resolve()}catch(h){this.reject(h)}finally{l.emitOne=void 0,l.emitMany=void 0,l.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 Ri.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ie(async l=>{for await(let h of t)l.emitOne(i(h))})}map(t){return Ie.map(this,t)}static filter(t,i){return new Ie(async l=>{for await(let h of t)i(h)&&l.emitOne(h)})}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 l of t)i.push(l);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())}};zr.EMPTY=zr.fromArray([]);var nl=class extends je{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Mi),this._linesCacheDisposables=this._register(new Mi),this._register(Pt(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Kr(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=sn(()=>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=[],l=[0],h=this._terminal.buffer.active.getLine(e);for(;h;){let s=this._terminal.buffer.active.getLine(e+1),r=s?s.isWrapped:!1,o=h.translateToString(!r&&t);if(r&&s){let _=h.getCell(h.length-1);_&&_.getCode()===0&&_.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(o=o.slice(0,-1))}if(i.push(o),r)l.push(l[l.length-1]+o.length);else break;e++,h=s}return[i.join(""),l]}},ol=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}},al=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,l){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 h={startRow:t,startCol:i},s=this._findInLine(e,h,l);if(!s)for(let r=t+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=r,h.startCol=0,s=this._findInLine(e,h,l),!s);r++);return s}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let l=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,s=0;l&&(i===e?(h=l.end.x,s=l.end.y):(h=l.start.x,s=l.start.y)),this._lineCache.initLinesCache();let r={startRow:s,startCol:h},o=this._findInLine(e,r,t);if(!o)for(let _=s+1;_<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=_,r.startCol=0,o=this._findInLine(e,r,t),!o);_++);if(!o&&s!==0)for(let _=0;_<s&&(r.startRow=_,r.startCol=0,o=this._findInLine(e,r,t),!o);_++);return!o&&l&&(r.startRow=l.start.y,r.startCol=0,o=this._findInLine(e,r,t)),o}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let l=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,r=!0;this._lineCache.initLinesCache();let o={startRow:h,startCol:s},_;if(l&&(o.startRow=h=l.start.y,o.startCol=s=l.start.x,i!==e&&(_=this._findInLine(e,o,t,!1),_||(o.startRow=h=l.end.y,o.startCol=s=l.end.x))),_||(_=this._findInLine(e,o,t,r)),!_){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=h-1;n>=0&&(o.startRow=n,_=this._findInLine(e,o,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&&(o.startRow=n,_=this._findInLine(e,o,t,r),!_);n--);return _}_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={},l=!1){let h=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(h)?.isWrapped){if(l){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let r=this._lineCache.getLineFromCache(h);r||(r=this._lineCache.translateBufferLineToStringWithWrap(h,!0),this._lineCache.setLineInCache(h,r));let[o,_]=r,n=this._bufferColsToStringOffset(h,s),f=e,v=o;i.regex||(f=i.caseSensitive?e:e.toLowerCase(),v=i.caseSensitive?o:o.toLowerCase());let w=-1;if(i.regex){let p=RegExp(f,i.caseSensitive?"g":"gi"),c;if(l)for(;c=p.exec(v.slice(0,n));)w=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(v.slice(n)),c&&c[0].length>0&&(w=n+(p.lastIndex-c[0].length),e=c[0])}else l?n-f.length>=0&&(w=v.lastIndexOf(f,n-f.length)):w=v.indexOf(f,n);if(w>=0){if(i.wholeWord&&!this._isWholeWord(w,v,e))return;let p=0;for(;p<_.length-1&&w>=_[p+1];)p++;let c=p;for(;c<_.length-1&&w+e.length>=_[c+1];)c++;let d=w-_[p],a=w+e.length-_[c],u=this._stringLengthToBufferSize(h+p,d),g=this._stringLengthToBufferSize(h+c,a)-u+this._terminal.cols*(c-p);return{term:e,col:u,row:h+p,size:g}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let l=0;l<t;l++){let h=i.getCell(l);if(!h)break;let s=h.getChars();s.length>1&&(t-=s.length-1);let r=i.getCell(l+1);r&&r.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,l=0,h=this._terminal.buffer.active.getLine(i);for(;t>0&&h;){for(let s=0;s<t&&s<this._terminal.cols;s++){let r=h.getCell(s);if(!r)break;r.getWidth()&&(l+=r.getCode()===0?1:r.getChars().length)}if(i++,h=this._terminal.buffer.active.getLine(i),h&&!h.isWrapped)break;t-=this._terminal.cols}return l}},ll=class extends je{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Pt(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let l=this._createResultDecorations(i,t,!1);if(l)for(let h of l)this._storeDecoration(h,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){Qt(i)}}}clearHighlightDecorations(){Qt(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 l=[],h=e.col,s=e.size,r=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let _=Math.min(this._terminal.cols-h,s);l.push([r,h,_]),h=0,s-=_,r++}let o=[];for(let _ of l){let n=this._terminal.registerMarker(_[0]),f=this._terminal.registerDecoration({marker:n,x:_[1],width:_[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(n.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(f){let v=[];v.push(n),v.push(f.onRender(w=>this._applyStyles(w,i?t.activeMatchBorder:t.matchBorder,!1))),v.push(f.onDispose(()=>Qt(v))),o.push(f)}}return o.length===0?void 0:o}},cl=class extends je{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new ze)}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()}},rn=class extends je{constructor(e){super(),this._highlightTimeout=this._register(new Mi),this._lineCache=this._register(new Mi),this._state=new ol,this._resultTracker=this._register(new cl),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new nl(e),this._engine=new al(e,this._lineCache.value),this._decorationManager=new ll(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Pt(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=sn(()=>{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 l=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,l}_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=[],l,h=this._engine.find(e,0,0,t);for(;h&&(l?.row!==h.row||l?.col!==h.col)&&!(i.length>=this._highlightLimit);)l=h,i.push(l),h=this._engine.find(e,l.col+l.term.length>=this._terminal.cols?l.row+1:l.row,l.col+l.term.length>=this._terminal.cols?0:l.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 l=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(l,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 l=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,l}_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 l=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(l,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 l=this._decorationManager.createActiveDecoration(e,t);l&&(this._resultTracker.selectedDecoration=l)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let l=e.row-this._terminal.buffer.active.viewportY;l-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(l)}return!0}};var hl=class{constructor(e,t,i,l={}){this._terminal=e,this._regex=t,this._handler=i,this._options=l}provideLinks(e,t){let i=ul.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,l)=>{if(this._options.hover){let{range:h}=t;this._options.hover(i,l,h)}},t))}};function dl(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 ul=class Di{static computeLink(t,i,l,h){let s=new RegExp(i.source,(i.flags||"")+"g"),[r,o]=Di._getWindowedLineStrings(t-1,l),_=r.join(""),n,f=[];for(;n=s.exec(_);){let v=n[0];if(!dl(v))continue;let[w,p]=Di._mapStrIdx(l,o,0,n.index),[c,d]=Di._mapStrIdx(l,w,p,v.length);if(w===-1||p===-1||c===-1||d===-1)continue;let a={start:{x:p+1,y:w+1},end:{x:d,y:c+1}};f.push({range:a,text:v,activate:h})}return f}static _getWindowedLineStrings(t,i){let l,h=t,s=t,r=0,o="",_=[];if(l=i.buffer.active.getLine(t)){let n=l.translateToString(!0);if(l.isWrapped&&n[0]!==" "){for(r=0;(l=i.buffer.active.getLine(--h))&&r<2048&&(o=l.translateToString(!0),r+=o.length,_.push(o),!(!l.isWrapped||o.indexOf(" ")!==-1)););_.reverse()}for(_.push(n),r=0;(l=i.buffer.active.getLine(++s))&&l.isWrapped&&r<2048&&(o=l.translateToString(!0),r+=o.length,_.push(o),o.indexOf(" ")===-1););}return[_,h]}static _mapStrIdx(t,i,l,h){let s=t.buffer.active,r=s.getNullCell(),o=l;for(;h;){let _=s.getLine(i);if(!_)return[-1,-1];for(let n=o;n<_.length;++n){_.getCell(n,r);let f=r.getChars();if(r.getWidth()&&(h-=f.length||1,n===_.length-1&&f==="")){let v=s.getLine(i+1);v&&v.isWrapped&&(v.getCell(0,r),r.getWidth()===2&&(h+=1))}if(h<0)return[i,n]}i++,o=0}return[i,o]}},_l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function fl(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 nn=class{constructor(e=fl,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||_l;this._linkProvider=this._terminal.registerLinkProvider(new hl(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var pl=Object.defineProperty,vl=Object.getOwnPropertyDescriptor,gl=(e,t,i,l)=>{for(var h=l>1?void 0:l?vl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(h=(l?r(t,i,h):r(h))||h);return l&&h&&pl(t,i,h),h},ml=(e,t)=>(i,l)=>t(i,l,e),bl=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?on.isErrorNoTelemetry(e)?new on(e.message+`
35
+ `).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Ti.register(s,f?.[2]??a,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,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 o=this._deliveryQueue.current===this;if(this._size*el<=t.length){let h=0;for(let r=0;r<t.length;r++)t[r]?t[h++]=t[r]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Sr;if(!i){e.value(t);return}try{e.value(t)}catch(o){i(o)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ri)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},il=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}},an=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Ks;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof rl?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:an})})(Ks||(Ks={}));var rl=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?an:(this._emitter||(this._emitter=new ze),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Dt="en",Br=!1,Pr=!1,Ai=!1,sl=!1,nl=!1,ln=!1,ol=!1,al=!1,ll=!1,cl=!1,Mi,Di=Dt,Gs=Dt,hl,Qe,et=globalThis,Be;typeof et.vscode<"u"&&typeof et.vscode.process<"u"?Be=et.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Be=process);var cn=typeof Be?.versions?.electron=="string",dl=cn&&Be?.type==="renderer";if(typeof Be=="object"){Br=Be.platform==="win32",Pr=Be.platform==="darwin",Ai=Be.platform==="linux",sl=Ai&&!!Be.env.SNAP&&!!Be.env.SNAP_REVISION,ol=cn,ll=!!Be.env.CI||!!Be.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Mi=Dt,Di=Dt;let e=Be.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Mi=t.userLocale,Gs=t.osLocale,Di=t.resolvedLanguage||Dt,hl=t.languagePack?.translationsConfigFile}catch{}nl=!0}else typeof navigator=="object"&&!dl?(Qe=navigator.userAgent,Br=Qe.indexOf("Windows")>=0,Pr=Qe.indexOf("Macintosh")>=0,al=(Qe.indexOf("Macintosh")>=0||Qe.indexOf("iPad")>=0||Qe.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ai=Qe.indexOf("Linux")>=0,cl=Qe?.indexOf("Mobi")>=0,ln=!0,Di=globalThis._VSCODE_NLS_LANGUAGE||Dt,Mi=navigator.language.toLowerCase(),Gs=Mi):console.error("Unable to resolve platform.");var Cr=0;Pr?Cr=1:Br?Cr=3:Ai&&(Cr=2);var ul=ln&&typeof et.importScripts=="function",Tu=ul?et.origin:void 0,qe=Qe,ct=Di,Vs;(e=>{function t(){return ct}e.value=t;function i(){return ct.length===2?ct==="en":ct.length>=3?ct[0]==="e"&&ct[1]==="n"&&ct[2]==="-":!1}e.isDefaultVariant=i;function o(){return ct==="en"}e.isDefault=o})(Vs||(Vs={}));var fl=typeof et.postMessage=="function"&&!et.importScripts,_l=(()=>{if(fl){let e=[];et.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let o=0,h=e.length;o<h;o++){let r=e[o];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(o,1),r.callback();return}}});let t=0;return i=>{let o=++t;e.push({id:o,callback:i}),et.postMessage({vscodeScheduleAsyncWork:o},"*")}}return e=>setTimeout(e)})(),pl=!!(qe&&qe.indexOf("Chrome")>=0),Au=!!(qe&&qe.indexOf("Firefox")>=0),Du=!!(!pl&&qe&&qe.indexOf("Safari")>=0),Bu=!!(qe&&qe.indexOf("Edg/")>=0),Pu=!!(qe&&qe.indexOf("Android")>=0);function hn(e,t=0,i){let o=setTimeout(()=>{e(),i&&h.dispose()},t),h=Pt(()=>{clearTimeout(o),i?.deleteAndLeak(h)});return i?.add(h),h}var vl,yr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?yr=(e,t)=>{_l(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:yr=(e,t,i)=>{let o=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(o))}}},vl=e=>yr(globalThis,e)})();var Ys;(e=>{async function t(o){let h,r=await Promise.all(o.map(s=>s.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return r}e.settled=t;function i(o){return new Promise(async(h,r)=>{try{await o(h,r)}catch(s){r(s)}})}e.withAsyncBody=i})(Ys||(Ys={}));var Xs=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 o=>i.emitOne(await o)))})}static merge(t){return new Ie(async i=>{await Promise.all(t.map(async o=>{for await(let h of o)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ze,queueMicrotask(async()=>{let o={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(o)),this.resolve()}catch(h){this.reject(h)}finally{o.emitOne=void 0,o.emitMany=void 0,o.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 Pi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ie(async o=>{for await(let h of t)o.emitOne(i(h))})}map(t){return Ie.map(this,t)}static filter(t,i){return new Ie(async o=>{for await(let h of t)i(h)&&o.emitOne(h)})}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 o of t)i.push(o);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())}};Xs.EMPTY=Xs.fromArray([]);var gl=class extends je{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Bi),this._linesCacheDisposables=this._register(new Bi),this._register(Pt(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Qs(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=hn(()=>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=[],o=[0],h=this._terminal.buffer.active.getLine(e);for(;h;){let r=this._terminal.buffer.active.getLine(e+1),s=r?r.isWrapped:!1,a=h.translateToString(!s&&t);if(s&&r){let f=h.getCell(h.length-1);f&&f.getCode()===0&&f.getWidth()===1&&r.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),s)o.push(o[o.length-1]+a.length);else break;e++,h=r}return[i.join(""),o]}},ml=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}},bl=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,o){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 h={startRow:t,startCol:i},r=this._findInLine(e,h,o);if(!r)for(let s=t+1;s<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=s,h.startCol=0,r=this._findInLine(e,h,o),!r);s++);return r}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,r=0;o&&(i===e?(h=o.end.x,r=o.end.y):(h=o.start.x,r=o.start.y)),this._lineCache.initLinesCache();let s={startRow:r,startCol:h},a=this._findInLine(e,s,t);if(!a)for(let f=r+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=f,s.startCol=0,a=this._findInLine(e,s,t),!a);f++);if(!a&&r!==0)for(let f=0;f<r&&(s.startRow=f,s.startCol=0,a=this._findInLine(e,s,t),!a);f++);return!a&&o&&(s.startRow=o.start.y,s.startCol=0,a=this._findInLine(e,s,t)),a}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols,s=!0;this._lineCache.initLinesCache();let a={startRow:h,startCol:r},f;if(o&&(a.startRow=h=o.start.y,a.startCol=r=o.start.x,i!==e&&(f=this._findInLine(e,a,t,!1),f||(a.startRow=h=o.end.y,a.startCol=r=o.end.x))),f||(f=this._findInLine(e,a,t,s)),!f){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let n=h-1;n>=0&&(a.startRow=n,f=this._findInLine(e,a,t,s),!f);n--);}if(!f&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=h&&(a.startRow=n,f=this._findInLine(e,a,t,s),!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={},o=!1){let h=t.startRow,r=t.startCol;if(this._terminal.buffer.active.getLine(h)?.isWrapped){if(o){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let s=this._lineCache.getLineFromCache(h);s||(s=this._lineCache.translateBufferLineToStringWithWrap(h,!0),this._lineCache.setLineInCache(h,s));let[a,f]=s,n=this._bufferColsToStringOffset(h,r),_=e,v=a;i.regex||(_=i.caseSensitive?e:e.toLowerCase(),v=i.caseSensitive?a:a.toLowerCase());let w=-1;if(i.regex){let p=RegExp(_,i.caseSensitive?"g":"gi"),c;if(o)for(;c=p.exec(v.slice(0,n));)w=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(v.slice(n)),c&&c[0].length>0&&(w=n+(p.lastIndex-c[0].length),e=c[0])}else o?n-_.length>=0&&(w=v.lastIndexOf(_,n-_.length)):w=v.indexOf(_,n);if(w>=0){if(i.wholeWord&&!this._isWholeWord(w,v,e))return;let p=0;for(;p<f.length-1&&w>=f[p+1];)p++;let c=p;for(;c<f.length-1&&w+e.length>=f[c+1];)c++;let d=w-f[p],l=w+e.length-f[c],u=this._stringLengthToBufferSize(h+p,d),g=this._stringLengthToBufferSize(h+c,l)-u+this._terminal.cols*(c-p);return{term:e,col:u,row:h+p,size:g}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let o=0;o<t;o++){let h=i.getCell(o);if(!h)break;let r=h.getChars();r.length>1&&(t-=r.length-1);let s=i.getCell(o+1);s&&s.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,o=0,h=this._terminal.buffer.active.getLine(i);for(;t>0&&h;){for(let r=0;r<t&&r<this._terminal.cols;r++){let s=h.getCell(r);if(!s)break;s.getWidth()&&(o+=s.getCode()===0?1:s.getChars().length)}if(i++,h=this._terminal.buffer.active.getLine(i),h&&!h.isWrapped)break;t-=this._terminal.cols}return o}},wl=class extends je{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Pt(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let o=this._createResultDecorations(i,t,!1);if(o)for(let h of o)this._storeDecoration(h,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){ei(i)}}}clearHighlightDecorations(){ei(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 o=[],h=e.col,r=e.size,s=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;r>0;){let f=Math.min(this._terminal.cols-h,r);o.push([s,h,f]),h=0,r-=f,s++}let a=[];for(let f of o){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 v=[];v.push(n),v.push(_.onRender(w=>this._applyStyles(w,i?t.activeMatchBorder:t.matchBorder,!1))),v.push(_.onDispose(()=>ei(v))),a.push(_)}}return a.length===0?void 0:a}},Sl=class extends je{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new ze)}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()}},dn=class extends je{constructor(e){super(),this._highlightTimeout=this._register(new Bi),this._lineCache=this._register(new Bi),this._state=new ml,this._resultTracker=this._register(new Sl),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new gl(e),this._engine=new bl(e,this._lineCache.value),this._decorationManager=new wl(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Pt(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=hn(()=>{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 o=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,o}_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=[],o,h=this._engine.find(e,0,0,t);for(;h&&(o?.row!==h.row||o?.col!==h.col)&&!(i.length>=this._highlightLimit);)o=h,i.push(o),h=this._engine.find(e,o.col+o.term.length>=this._terminal.cols?o.row+1:o.row,o.col+o.term.length>=this._terminal.cols?0:o.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 o=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(o,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 o=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,o}_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 o=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(o,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 o=this._decorationManager.createActiveDecoration(e,t);o&&(this._resultTracker.selectedDecoration=o)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let o=e.row-this._terminal.buffer.active.viewportY;o-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(o)}return!0}};var Cl=class{constructor(e,t,i,o={}){this._terminal=e,this._regex=t,this._handler=i,this._options=o}provideLinks(e,t){let i=xl.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,o)=>{if(this._options.hover){let{range:h}=t;this._options.hover(i,o,h)}},t))}};function yl(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 xl=class Ni{static computeLink(t,i,o,h){let r=new RegExp(i.source,(i.flags||"")+"g"),[s,a]=Ni._getWindowedLineStrings(t-1,o),f=s.join(""),n,_=[];for(;n=r.exec(f);){let v=n[0];if(!yl(v))continue;let[w,p]=Ni._mapStrIdx(o,a,0,n.index),[c,d]=Ni._mapStrIdx(o,w,p,v.length);if(w===-1||p===-1||c===-1||d===-1)continue;let l={start:{x:p+1,y:w+1},end:{x:d,y:c+1}};_.push({range:l,text:v,activate:h})}return _}static _getWindowedLineStrings(t,i){let o,h=t,r=t,s=0,a="",f=[];if(o=i.buffer.active.getLine(t)){let n=o.translateToString(!0);if(o.isWrapped&&n[0]!==" "){for(s=0;(o=i.buffer.active.getLine(--h))&&s<2048&&(a=o.translateToString(!0),s+=a.length,f.push(a),!(!o.isWrapped||a.indexOf(" ")!==-1)););f.reverse()}for(f.push(n),s=0;(o=i.buffer.active.getLine(++r))&&o.isWrapped&&s<2048&&(a=o.translateToString(!0),s+=a.length,f.push(a),a.indexOf(" ")===-1););}return[f,h]}static _mapStrIdx(t,i,o,h){let r=t.buffer.active,s=r.getNullCell(),a=o;for(;h;){let f=r.getLine(i);if(!f)return[-1,-1];for(let n=a;n<f.length;++n){f.getCell(n,s);let _=s.getChars();if(s.getWidth()&&(h-=_.length||1,n===f.length-1&&_==="")){let v=r.getLine(i+1);v&&v.isWrapped&&(v.getCell(0,s),s.getWidth()===2&&(h+=1))}if(h<0)return[i,n]}i++,a=0}return[i,a]}},El=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function kl(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 un=class{constructor(e=kl,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||El;this._linkProvider=this._terminal.registerLinkProvider(new Cl(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var Ll=Object.defineProperty,Ml=Object.getOwnPropertyDescriptor,Rl=(e,t,i,o)=>{for(var h=o>1?void 0:o?Ml(t,i):t,r=e.length-1,s;r>=0;r--)(s=e[r])&&(h=(o?s(t,i,h):s(h))||h);return o&&h&&Ll(t,i,h),h},Tl=(e,t)=>(i,o)=>t(i,o,e),Al=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?fn.isErrorNoTelemetry(e)?new fn(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)}},wl=new bl;function Ni(e){Sl(e)||wl.onUnexpectedError(e)}var zs="Canceled";function Sl(e){return e instanceof Cl?!0:e instanceof Error&&e.name===zs&&e.message===zs}var Cl=class extends Error{constructor(){super(zs),this.name=this.message}},on=class js extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof js)return t;let i=new js;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function yl(e,t,i=0,l=e.length){let h=i,s=l;for(;h<s;){let r=Math.floor((h+s)/2);t(e[r])?h=r+1:s=r}return h-1}var xl=class Vn{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Vn.assertInvariants){if(this._prevFindLastPredicate){for(let l of this._array)if(this._prevFindLastPredicate(l)&&!t(l))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=yl(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};xl.assertInvariants=!1;var qs;(e=>{function t(s){return s<0}e.isLessThan=t;function i(s){return s<=0}e.isLessThanOrEqual=i;function l(s){return s>0}e.isGreaterThan=l;function h(s){return s===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(qs||(qs={}));function El(e,t){return(i,l)=>t(e(i),e(l))}var kl=(e,t)=>e-t,an=class Ks{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 Ks(i=>this.iterate(l=>t(l)?i(l):!0))}map(t){return new Ks(i=>this.iterate(l=>i(t(l))))}some(t){let i=!1;return this.iterate(l=>(i=t(l),!i)),i}findFirst(t){let i;return this.iterate(l=>t(l)?(i=l,!1):!0),i}findLast(t){let i;return this.iterate(l=>(t(l)&&(i=l),!0)),i}findLastMaxBy(t){let i,l=!0;return this.iterate(h=>((l||qs.isGreaterThan(t(h,i)))&&(l=!1,i=h),!0)),i}};an.empty=new an(e=>{});function Ll(e,t){let i=Object.create(null);for(let l of e){let h=t(l),s=i[h];s||(s=i[h]=[]),s.push(l)}return i}var ln,cn,zu=class{constructor(e,t){this.toKey=t,this._map=new Map,this[ln]="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))}[(cn=Symbol.iterator,ln=Symbol.toStringTag,cn)](){return this.values()}},Ml=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 Rl(e,t){let i=this,l=!1,h;return function(){if(l)return h;if(l=!0,t)try{h=e.apply(i,arguments)}finally{t()}else h=e.apply(i,arguments);return h}}var Gs;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function l(){return i}e.empty=l;function*h(b){yield b}e.single=h;function s(b){return t(b)?b:h(b)}e.wrap=s;function r(b){return b||i}e.from=r;function*o(b){for(let y=b.length-1;y>=0;y--)yield b[y]}e.reverse=o;function _(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=_;function n(b){return b[Symbol.iterator]().next().value}e.first=n;function f(b,y){let m=0;for(let k of b)if(y(k,m++))return!0;return!1}e.some=f;function v(b,y){for(let m of b)if(y(m))return m}e.find=v;function*w(b,y){for(let m of b)y(m)&&(yield m)}e.filter=w;function*p(b,y){let m=0;for(let k of b)yield y(k,m++)}e.map=p;function*c(b,y){let m=0;for(let k of b)yield*y(k,m++)}e.flatMap=c;function*d(...b){for(let y of b)yield*y}e.concat=d;function a(b,y,m){let k=m;for(let B of b)k=y(k,B);return k}e.reduce=a;function*u(b,y,m=b.length){for(y<0&&(y+=b.length),m<0?m+=b.length:m>b.length&&(m=b.length);y<m;y++)yield b[y]}e.slice=u;function g(b,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,b];let k=b[Symbol.iterator]();for(let B=0;B<y;B++){let P=k.next();if(P.done)return[m,e.empty()];m.push(P.value)}return[m,{[Symbol.iterator](){return k}}]}e.consume=g;async function C(b){let y=[];for await(let m of b)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Gs||(Gs={}));var Tl=!1,$t=null,Al=class Yn{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:Yn.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 l=this.getDisposableData(t);l.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let l=i.get(t);if(l)return l;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,h),h}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 l;if(i)l=i;else{let _=new Map,n=[...this.livingDisposables.values()].filter(v=>v.source!==null&&!this.getRootParent(v,_).isSingleton);if(n.length===0)return;let f=new Set(n.map(v=>v.value));if(l=n.filter(v=>!(v.parent&&f.has(v.parent))),l.length===0)throw new Error("There are cyclic diposable chains!")}if(!l)return;function h(_){function n(v,w){for(;v.length>0&&w.some(p=>typeof p=="string"?p===v[0]:v[0].match(p));)v.shift()}let f=_.source.split(`
40
- `).map(v=>v.trim().replace("at ","")).filter(v=>v!=="");return n(f,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),f.reverse()}let s=new Ml;for(let _ of l){let n=h(_);for(let f=0;f<=n.length;f++)s.add(n.slice(0,f).join(`
41
- `),_)}l.sort(El(_=>_.idx,kl));let r="",o=0;for(let _ of l.slice(0,t)){o++;let n=h(_),f=[];for(let v=0;v<n.length;v++){let w=n[v];w=`(shared with ${s.get(n.slice(0,v+1).join(`
42
- `)).size}/${l.length} leaks) at ${w}`;let p=s.get(n.slice(0,v).join(`
43
- `)),c=Ll([...p].map(d=>h(d)[v]),d=>d);delete c[n[v]];for(let[d,a]of Object.entries(c))f.unshift(` - stacktraces of ${a.length} other leaks continue with ${d}`);f.unshift(w)}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)}},Dl=new Al;function Ui(e){Bl(e)||Dl.onUnexpectedError(e)}var Xr="Canceled";function Bl(e){return e instanceof Pl?!0:e instanceof Error&&e.name===Xr&&e.message===Xr}var Pl=class extends Error{constructor(){super(Xr),this.name=this.message}},fn=class Jr extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Jr)return t;let i=new Jr;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Ol(e,t,i=0,o=e.length){let h=i,r=o;for(;h<r;){let s=Math.floor((h+r)/2);t(e[s])?h=s+1:r=s}return h-1}var Il=class to{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(to.assertInvariants){if(this._prevFindLastPredicate){for(let o of this._array)if(this._prevFindLastPredicate(o)&&!t(o))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=Ol(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Il.assertInvariants=!1;var Zr;(e=>{function t(r){return r<0}e.isLessThan=t;function i(r){return r<=0}e.isLessThanOrEqual=i;function o(r){return r>0}e.isGreaterThan=o;function h(r){return r===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zr||(Zr={}));function Nl(e,t){return(i,o)=>t(e(i),e(o))}var Hl=(e,t)=>e-t,_n=class Qr{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 Qr(i=>this.iterate(o=>t(o)?i(o):!0))}map(t){return new Qr(i=>this.iterate(o=>i(t(o))))}some(t){let i=!1;return this.iterate(o=>(i=t(o),!i)),i}findFirst(t){let i;return this.iterate(o=>t(o)?(i=o,!1):!0),i}findLast(t){let i;return this.iterate(o=>(t(o)&&(i=o),!0)),i}findLastMaxBy(t){let i,o=!0;return this.iterate(h=>((o||Zr.isGreaterThan(t(h,i)))&&(o=!1,i=h),!0)),i}};_n.empty=new _n(e=>{});function Fl(e,t){let i=Object.create(null);for(let o of e){let h=t(o),r=i[h];r||(r=i[h]=[]),r.push(o)}return i}var pn,vn,nf=class{constructor(e,t){this.toKey=t,this._map=new Map,this[pn]="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))}[(vn=Symbol.iterator,pn=Symbol.toStringTag,vn)](){return this.values()}},Wl=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 $l(e,t){let i=this,o=!1,h;return function(){if(o)return h;if(o=!0,t)try{h=e.apply(i,arguments)}finally{t()}else h=e.apply(i,arguments);return h}}var es;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function o(){return i}e.empty=o;function*h(b){yield b}e.single=h;function r(b){return t(b)?b:h(b)}e.wrap=r;function s(b){return b||i}e.from=s;function*a(b){for(let y=b.length-1;y>=0;y--)yield b[y]}e.reverse=a;function f(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=f;function n(b){return b[Symbol.iterator]().next().value}e.first=n;function _(b,y){let m=0;for(let k of b)if(y(k,m++))return!0;return!1}e.some=_;function v(b,y){for(let m of b)if(y(m))return m}e.find=v;function*w(b,y){for(let m of b)y(m)&&(yield m)}e.filter=w;function*p(b,y){let m=0;for(let k of b)yield y(k,m++)}e.map=p;function*c(b,y){let m=0;for(let k of b)yield*y(k,m++)}e.flatMap=c;function*d(...b){for(let y of b)yield*y}e.concat=d;function l(b,y,m){let k=m;for(let B of b)k=y(k,B);return k}e.reduce=l;function*u(b,y,m=b.length){for(y<0&&(y+=b.length),m<0?m+=b.length:m>b.length&&(m=b.length);y<m;y++)yield b[y]}e.slice=u;function g(b,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,b];let k=b[Symbol.iterator]();for(let B=0;B<y;B++){let O=k.next();if(O.done)return[m,e.empty()];m.push(O.value)}return[m,{[Symbol.iterator](){return k}}]}e.consume=g;async function C(b){let y=[];for await(let m of b)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(es||(es={}));var Ul=!1,$t=null,zl=class io{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:io.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 o=this.getDisposableData(t);o.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let o=i.get(t);if(o)return o;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,h),h}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 o;if(i)o=i;else{let f=new Map,n=[...this.livingDisposables.values()].filter(v=>v.source!==null&&!this.getRootParent(v,f).isSingleton);if(n.length===0)return;let _=new Set(n.map(v=>v.value));if(o=n.filter(v=>!(v.parent&&_.has(v.parent))),o.length===0)throw new Error("There are cyclic diposable chains!")}if(!o)return;function h(f){function n(v,w){for(;v.length>0&&w.some(p=>typeof p=="string"?p===v[0]:v[0].match(p));)v.shift()}let _=f.source.split(`
40
+ `).map(v=>v.trim().replace("at ","")).filter(v=>v!=="");return n(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let r=new Wl;for(let f of o){let n=h(f);for(let _=0;_<=n.length;_++)r.add(n.slice(0,_).join(`
41
+ `),f)}o.sort(Nl(f=>f.idx,Hl));let s="",a=0;for(let f of o.slice(0,t)){a++;let n=h(f),_=[];for(let v=0;v<n.length;v++){let w=n[v];w=`(shared with ${r.get(n.slice(0,v+1).join(`
42
+ `)).size}/${o.length} leaks) at ${w}`;let p=r.get(n.slice(0,v).join(`
43
+ `)),c=Fl([...p].map(d=>h(d)[v]),d=>d);delete c[n[v]];for(let[d,l]of Object.entries(c))_.unshift(` - stacktraces of ${l.length} other leaks continue with ${d}`);_.unshift(w)}s+=`
44
44
 
45
45
 
46
- ==================== Leaking disposable ${o}/${l.length}: ${_.value.constructor.name} ====================
47
- ${f.join(`
46
+ ==================== Leaking disposable ${a}/${o.length}: ${f.value.constructor.name} ====================
47
+ ${_.join(`
48
48
  `)}
49
49
  ============================================================
50
50
 
51
- `}return l.length>t&&(r+=`
51
+ `}return o.length>t&&(s+=`
52
52
 
53
53
 
54
- ... and ${l.length-t} more leaking disposables
54
+ ... and ${o.length-t} more leaking disposables
55
55
 
56
- `),{leaks:l,details:r}}};Al.idx=0;function Dl(e){$t=e}if(Tl){let e="__is_disposable_tracked__";Dl(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!==Pe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Pe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Gi(e){return $t?.trackDisposable(e),e}function Vi(e){$t?.markAsDisposed(e)}function oi(e,t){$t?.setParent(e,t)}function Bl(e,t){if($t)for(let i of e)$t.setParent(i,t)}function Xn(e){if(Gs.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(l){t.push(l)}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 Jn(...e){let t=ye(()=>Xn(e));return Bl(e,t),t}function ye(e){let t=Gi({dispose:Rl(()=>{Vi(t),e()})});return t}var Zn=class Qn{constructor(){this._toDispose=new Set,this._isDisposed=!1,Gi(this)}dispose(){this._isDisposed||(Vi(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Xn(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 oi(t,this),this._isDisposed?Qn.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),oi(t,null))}};Zn.DISABLE_DISPOSED_WARNING=!1;var Wt=Zn,Pe=class{constructor(){this._store=new Wt,Gi(this),oi(this._store,this)}dispose(){Vi(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Pe.None=Object.freeze({dispose(){}});var ti=class{constructor(){this._isDisposed=!1,Gi(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&oi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Vi(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&oi(e,null),e}},ir=typeof process<"u"&&"title"in process,li=ir?"node":navigator.userAgent,sr=ir?"node":navigator.platform,Pl=li.includes("Firefox"),Ol=li.includes("Edge"),eo=/^((?!chrome|android).)*safari/i.test(li);function Il(){if(!eo)return 0;let e=li.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ju=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(sr),qu=["Windows","Win16","Win32","WinCE"].includes(sr),Ku=sr.indexOf("Linux")>=0,Gu=/\bCrOS\b/.test(li),Nl="",be=0,we=0,Se=0,fe=0,Ne={css:"#00000000",rgba:0},ke;(e=>{function t(h,s,r,o){return o!==void 0?`#${Ct(h)}${Ct(s)}${Ct(r)}${Ct(o)}`:`#${Ct(h)}${Ct(s)}${Ct(r)}`}e.toCss=t;function i(h,s,r,o=255){return(h<<24|s<<16|r<<8|o)>>>0}e.toRgba=i;function l(h,s,r,o){return{css:e.toCss(h,s,r,o),rgba:e.toRgba(h,s,r,o)}}e.toColor=l})(ke||(ke={}));var Nt;(e=>{function t(_,n){if(fe=(n.rgba&255)/255,fe===1)return{css:n.css,rgba:n.rgba};let f=n.rgba>>24&255,v=n.rgba>>16&255,w=n.rgba>>8&255,p=_.rgba>>24&255,c=_.rgba>>16&255,d=_.rgba>>8&255;be=p+Math.round((f-p)*fe),we=c+Math.round((v-c)*fe),Se=d+Math.round((w-d)*fe);let a=ke.toCss(be,we,Se),u=ke.toRgba(be,we,Se);return{css:a,rgba:u}}e.blend=t;function i(_){return(_.rgba&255)===255}e.isOpaque=i;function l(_,n,f){let v=ft.ensureContrastRatio(_.rgba,n.rgba,f);if(v)return ke.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=l;function h(_){let n=(_.rgba|255)>>>0;return[be,we,Se]=ft.toChannels(n),{css:ke.toCss(be,we,Se),rgba:n}}e.opaque=h;function s(_,n){return fe=Math.round(n*255),[be,we,Se]=ft.toChannels(_.rgba),{css:ke.toCss(be,we,Se,fe),rgba:ke.toRgba(be,we,Se,fe)}}e.opacity=s;function r(_,n){return fe=_.rgba&255,s(_,fe*n/255)}e.multiplyOpacity=r;function o(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=o})(Nt||(Nt={}));var hn;(e=>{let t,i;try{let h=document.createElement("canvas");h.width=1,h.height=1;let s=h.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function l(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return be=parseInt(h.slice(1,2).repeat(2),16),we=parseInt(h.slice(2,3).repeat(2),16),Se=parseInt(h.slice(3,4).repeat(2),16),ke.toColor(be,we,Se);case 5:return be=parseInt(h.slice(1,2).repeat(2),16),we=parseInt(h.slice(2,3).repeat(2),16),Se=parseInt(h.slice(3,4).repeat(2),16),fe=parseInt(h.slice(4,5).repeat(2),16),ke.toColor(be,we,Se,fe);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 s=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(s)return be=parseInt(s[1]),we=parseInt(s[2]),Se=parseInt(s[3]),fe=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),ke.toColor(be,we,Se,fe);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=h,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[be,we,Se,fe]=t.getImageData(0,0,1,1).data,fe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ke.toRgba(be,we,Se,fe),css:h}}e.toColor=l})(hn||(hn={}));var Ee;(e=>{function t(l){return i(l>>16&255,l>>8&255,l&255)}e.relativeLuminance=t;function i(l,h,s){let r=l/255,o=h/255,_=s/255,n=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),f=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),v=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return n*.2126+f*.7152+v*.0722}e.relativeLuminance2=i})(Ee||(Ee={}));var ft;(e=>{function t(r,o){if(fe=(o&255)/255,fe===1)return o;let _=o>>24&255,n=o>>16&255,f=o>>8&255,v=r>>24&255,w=r>>16&255,p=r>>8&255;return be=v+Math.round((_-v)*fe),we=w+Math.round((n-w)*fe),Se=p+Math.round((f-p)*fe),ke.toRgba(be,we,Se)}e.blend=t;function i(r,o,_){let n=Ee.relativeLuminance(r>>8),f=Ee.relativeLuminance(o>>8);if(tt(n,f)<_){if(f<n){let p=l(r,o,_),c=tt(n,Ee.relativeLuminance(p>>8));if(c<_){let d=h(r,o,_),a=tt(n,Ee.relativeLuminance(d>>8));return c>a?p:d}return p}let v=h(r,o,_),w=tt(n,Ee.relativeLuminance(v>>8));if(w<_){let p=l(r,o,_),c=tt(n,Ee.relativeLuminance(p>>8));return w>c?v:p}return v}}e.ensureContrastRatio=i;function l(r,o,_){let n=r>>24&255,f=r>>16&255,v=r>>8&255,w=o>>24&255,p=o>>16&255,c=o>>8&255,d=tt(Ee.relativeLuminance2(w,p,c),Ee.relativeLuminance2(n,f,v));for(;d<_&&(w>0||p>0||c>0);)w-=Math.max(0,Math.ceil(w*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),d=tt(Ee.relativeLuminance2(w,p,c),Ee.relativeLuminance2(n,f,v));return(w<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=l;function h(r,o,_){let n=r>>24&255,f=r>>16&255,v=r>>8&255,w=o>>24&255,p=o>>16&255,c=o>>8&255,d=tt(Ee.relativeLuminance2(w,p,c),Ee.relativeLuminance2(n,f,v));for(;d<_&&(w<255||p<255||c<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),d=tt(Ee.relativeLuminance2(w,p,c),Ee.relativeLuminance2(n,f,v));return(w<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=h;function s(r){return[r>>24&255,r>>16&255,r>>8&255,r&255]}e.toChannels=s})(ft||(ft={}));function Ct(e){let t=e.toString(16);return t.length<2?"0"+t:t}function tt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function ge(e){if(!e)throw new Error("value must not be falsy");return e}function rr(e){return 57508<=e&&e<=57558}function Hl(e){return 57520<=e&&e<=57527}function Fl(e){return 57344<=e&&e<=63743}function Wl(e){return 9472<=e&&e<=9631}function $l(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 Ul(e,t,i,l){return t===1&&i>Math.ceil(l*1.5)&&e!==void 0&&e>255&&!$l(e)&&!rr(e)&&!Fl(e)}function to(e){return rr(e)||Wl(e)}function zl(){return{css:{canvas:Bi(),cell:Bi()},device:{canvas:Bi(),cell:Bi(),char:{width:0,height:0,left:0,top:0}}}}function Bi(){return{width:0,height:0}}function jl(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Ce=0,me=0,Ke=!1,it=!1,Pi=!1,Te,Rs=0,ql=class{constructor(e,t,i,l,h,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=l,this._coreBrowserService=h,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,l){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,me=0,Ce=0,it=!1,Ke=!1,Pi=!1,Te=this._themeService.colors,Rs=0,e.getCode()!==0&&e.extended.underlineStyle===4){let h=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Rs=t*l%(Math.round(h)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",h=>{h.backgroundColorRGB&&(me=h.backgroundColorRGB.rgba>>8&16777215,it=!0),h.foregroundColorRGB&&(Ce=h.foregroundColorRGB.rgba>>8&16777215,Ke=!0)}),Pi=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Pi){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:me=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:me=(this.result.fg&16777215)<<8|255;break;default:me=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:me=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:me=(this.result.bg&16777215)<<8|255;break}me=ft.blend(me,(this._coreBrowserService.isFocused?Te.selectionBackgroundOpaque:Te.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else me=(this._coreBrowserService.isFocused?Te.selectionBackgroundOpaque:Te.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(it=!0,Te.selectionForeground&&(Ce=Te.selectionForeground.rgba>>8&16777215,Ke=!0),to(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ce=(this._coreBrowserService.isFocused?Te.selectionBackgroundOpaque:Te.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ce=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ce=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ce=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ce=(this.result.fg&16777215)<<8|255;break;default:Ce=this._themeService.colors.foreground.rgba}Ce=ft.blend(Ce,(this._coreBrowserService.isFocused?Te.selectionBackgroundOpaque:Te.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ke=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",h=>{h.backgroundColorRGB&&(me=h.backgroundColorRGB.rgba>>8&16777215,it=!0),h.foregroundColorRGB&&(Ce=h.foregroundColorRGB.rgba>>8&16777215,Ke=!0)}),it&&(Pi?me=e.bg&-16777216&-134217729|me|50331648:me=e.bg&-16777216|me|50331648),Ke&&(Ce=e.fg&-16777216&-67108865|Ce|50331648),this.result.fg&67108864&&(it&&!Ke&&((this.result.bg&50331648)===0?Ce=this.result.fg&-134217728|Te.background.rgba>>8&16777215&16777215|50331648:Ce=this.result.fg&-134217728|this.result.bg&67108863,Ke=!0),!it&&Ke&&((this.result.fg&50331648)===0?me=this.result.bg&-67108864|Te.foreground.rgba>>8&16777215&16777215|50331648:me=this.result.bg&-67108864|this.result.fg&67108863,it=!0)),Te=void 0,this.result.bg=it?me:this.result.bg,this.result.fg=Ke?Ce:this.result.fg,this.result.ext&=536870911,this.result.ext|=Rs<<29&3758096384}},Kl=.5,io=Pl||Ol?"bottom":"ideographic",Gl={"\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}]},Vl={"\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]]},Yl={"\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`}},ai={"\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}};ai["\uE0BB"]=ai["\uE0BD"];ai["\uE0BF"]=ai["\uE0B9"];function Xl(e,t,i,l,h,s,r,o){let _=Gl[t];if(_)return Jl(e,_,i,l,h,s),!0;let n=Vl[t];if(n)return Zl(e,n,i,l,h,s),!0;let f=Yl[t];if(f)return Ql(e,f,i,l,h,s,o),!0;let v=ai[t];return v?(ec(e,v,i,l,h,s,r,o),!0):!1}function Jl(e,t,i,l,h,s){for(let r=0;r<t.length;r++){let o=t[r],_=h/8,n=s/8;e.fillRect(i+o.x*_,l+o.y*n,o.w*_,o.h*n)}}var dn=new Map;function Zl(e,t,i,l,h,s){let r=dn.get(t);r||(r=new Map,dn.set(t,r));let o=e.fillStyle;if(typeof o!="string")throw new Error(`Unexpected fillStyle type "${o}"`);let _=r.get(o);if(!_){let n=t[0].length,f=t.length,v=e.canvas.ownerDocument.createElement("canvas");v.width=n,v.height=f;let w=ge(v.getContext("2d")),p=new ImageData(n,f),c,d,a,u;if(o.startsWith("#"))c=parseInt(o.slice(1,3),16),d=parseInt(o.slice(3,5),16),a=parseInt(o.slice(5,7),16),u=o.length>7&&parseInt(o.slice(7,9),16)||1;else if(o.startsWith("rgba"))[c,d,a,u]=o.substring(5,o.length-1).split(",").map(g=>parseFloat(g));else throw new Error(`Unexpected fillStyle color format "${o}" when drawing pattern glyph`);for(let g=0;g<f;g++)for(let C=0;C<n;C++)p.data[(g*n+C)*4]=c,p.data[(g*n+C)*4+1]=d,p.data[(g*n+C)*4+2]=a,p.data[(g*n+C)*4+3]=t[g][C]*(u*255);w.putImageData(p,0,0),_=ge(e.createPattern(v,null)),r.set(o,_)}e.fillStyle=_,e.fillRect(i,l,h,s)}function Ql(e,t,i,l,h,s,r){e.strokeStyle=e.fillStyle;for(let[o,_]of Object.entries(t)){e.beginPath(),e.lineWidth=r*Number.parseInt(o);let n;if(typeof _=="function"){let f=.15/s*h;n=_(.15,f)}else n=_;for(let f of n.split(" ")){let v=f[0],w=so[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}let p=f.substring(1).split(",");!p[0]||!p[1]||w(e,ro(p,h,s,i,l,!0,r))}e.stroke(),e.closePath()}}function ec(e,t,i,l,h,s,r,o){let _=new Path2D;_.rect(i,l,h,s),e.clip(_),e.beginPath();let n=r/12;e.lineWidth=o*n;for(let f of t.d.split(" ")){let v=f[0],w=so[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}let p=f.substring(1).split(",");!p[0]||!p[1]||w(e,ro(p,h,s,i,l,!1,o,(t.leftPadding??0)*(n/2),(t.rightPadding??0)*(n/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function un(e,t,i=0){return Math.max(Math.min(e,t),i)}var so={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 ro(e,t,i,l,h,s,r,o=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-o*r-_*r,s&&n[f]!==0&&(n[f]=un(Math.round(n[f]+.5)-.5,t,0)),n[f]+=l+o*r;for(let f=1;f<n.length;f+=2)n[f]*=i,s&&n[f]!==0&&(n[f]=un(Math.round(n[f]+.5)-.5,i,0)),n[f]+=h;return n}var _n=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={}}},fn=class{constructor(){this._data=new _n}set(e,t,i,l,h){this._data.get(e,t)||this._data.set(e,t,new _n),this._data.get(e,t).set(i,l,h)}get(e,t,i,l){return this._data.get(e,t)?.get(i,l)}clear(){this._data.clear()}},no=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,l=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),i=Math.max(t,i),h=e.timeRemaining(),i*1.5>h){l-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(l-t))}ms`),this._start();return}l=h}this.clear()}},tc=class extends no{_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())}}},ic=class extends no{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},sc=!ir&&"requestIdleCallback"in window?ic:tc,Ht=class oo{constructor(){this.fg=0,this.bg=0,this.extended=new ao}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 oo;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}},ao=class lo{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 lo(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},pn=class Vs{constructor(t){this.element=t,this.next=Vs.Undefined,this.prev=Vs.Undefined}};pn.Undefined=new pn(void 0);var rc=globalThis.performance&&typeof globalThis.performance.now=="function",nc=class co{static create(t){return new co(t)}constructor(t){this._now=rc&&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}},oc=!1,vn=!1,ac=!1,Ge;(e=>{e.None=()=>Pe.None;function t(O){if(ac){let{onDidAddListener:T}=O,I=Js.create(),R=0;O.onDidAddListener=()=>{++R===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),I.print()),T?.()}}}function i(O,T){return w(O,()=>{},0,void 0,!0,void 0,T)}e.defer=i;function l(O){return(T,I=null,R)=>{let S=!1,E;return E=O(L=>{if(!S)return E?E.dispose():S=!0,T.call(I,L)},null,R),S&&E.dispose(),E}}e.once=l;function h(O,T,I){return f((R,S=null,E)=>O(L=>R.call(S,T(L)),null,E),I)}e.map=h;function s(O,T,I){return f((R,S=null,E)=>O(L=>{T(L),R.call(S,L)},null,E),I)}e.forEach=s;function r(O,T,I){return f((R,S=null,E)=>O(L=>T(L)&&R.call(S,L),null,E),I)}e.filter=r;function o(O){return O}e.signal=o;function _(...O){return(T,I=null,R)=>{let S=Jn(...O.map(E=>E(L=>T.call(I,L))));return v(S,R)}}e.any=_;function n(O,T,I,R){let S=I;return h(O,E=>(S=T(S,E),S),R)}e.reduce=n;function f(O,T){let I,R={onWillAddFirstListener(){I=O(S.fire,S)},onDidRemoveLastListener(){I?.dispose()}};T||t(R);let S=new he(R);return T?.add(S),S.event}function v(O,T){return T instanceof Array?T.push(O):T&&T.add(O),O}function w(O,T,I=100,R=!1,S=!1,E,L){let M,U,q,Y=0,z,D={leakWarningThreshold:E,onWillAddFirstListener(){M=O(N=>{Y++,U=T(U,N),R&&!q&&(x.fire(U),U=void 0),z=()=>{let W=U;U=void 0,q=void 0,(!R||Y>1)&&x.fire(W),Y=0},typeof I=="number"?(clearTimeout(q),q=setTimeout(z,I)):q===void 0&&(q=0,queueMicrotask(z))})},onWillRemoveListener(){S&&Y>0&&z?.()},onDidRemoveLastListener(){z=void 0,M.dispose()}};L||t(D);let x=new he(D);return L?.add(x),x.event}e.debounce=w;function p(O,T=0,I){return e.debounce(O,(R,S)=>R?(R.push(S),R):[S],T,void 0,!0,void 0,I)}e.accumulate=p;function c(O,T=(R,S)=>R===S,I){let R=!0,S;return r(O,E=>{let L=R||!T(E,S);return R=!1,S=E,L},I)}e.latch=c;function d(O,T,I){return[e.filter(O,T,I),e.filter(O,R=>!T(R),I)]}e.split=d;function a(O,T=!1,I=[],R){let S=I.slice(),E=O(U=>{S?S.push(U):M.fire(U)});R&&R.add(E);let L=()=>{S?.forEach(U=>M.fire(U)),S=null},M=new he({onWillAddFirstListener(){E||(E=O(U=>M.fire(U)),R&&R.add(E))},onDidAddFirstListener(){S&&(T?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return R&&R.add(M),M.event}e.buffer=a;function u(O,T){return(I,R,S)=>{let E=T(new C);return O(function(L){let M=E.evaluate(L);M!==g&&I.call(R,M)},void 0,S)}}e.chain=u;let g=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push(I=>(T(I),I)),this}filter(T){return this.steps.push(I=>T(I)?I:g),this}reduce(T,I){let R=I;return this.steps.push(S=>(R=T(R,S),R)),this}latch(T=(I,R)=>I===R){let I=!0,R;return this.steps.push(S=>{let E=I||!T(S,R);return I=!1,R=S,E?S:g}),this}evaluate(T){for(let I of this.steps)if(T=I(T),T===g)break;return T}}function b(O,T,I=R=>R){let R=(...M)=>L.fire(I(...M)),S=()=>O.on(T,R),E=()=>O.removeListener(T,R),L=new he({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=b;function y(O,T,I=R=>R){let R=(...M)=>L.fire(I(...M)),S=()=>O.addEventListener(T,R),E=()=>O.removeEventListener(T,R),L=new he({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(O){return new Promise(T=>l(O)(T))}e.toPromise=m;function k(O){let T=new he;return O.then(I=>{T.fire(I)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}e.fromPromise=k;function B(O,T){return O(I=>T.fire(I))}e.forward=B;function P(O,T,I){return T(I),O(R=>T(R))}e.runAndSubscribe=P;class H{constructor(T,I){this._observable=T,this._counter=0,this._hasChanged=!1;let R={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};I||t(R),this.emitter=new he(R),I&&I.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,I){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,T){return new H(O,T).emitter.event}e.fromObservable=A;function F(O){return(T,I,R)=>{let S=0,E=!1,L={beginUpdate(){S++},endUpdate(){S--,S===0&&(O.reportChanges(),E&&(E=!1,T.call(I)))},handlePossibleChange(){},handleChange(){E=!0}};O.addObserver(L),O.reportChanges();let M={dispose(){O.removeObserver(L)}};return R instanceof Wt?R.add(M):Array.isArray(R)&&R.push(M),M}}e.fromObservableLight=F})(Ge||(Ge={}));var Ys=class Xs{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Xs._idPool++}`,Xs.all.add(this)}start(t){this._stopWatch=new nc,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}}};Ys.all=new Set,Ys._idPool=0;var lc=Ys,gn=-1,ho=class uo{constructor(t,i,l=(uo._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=l,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let l=this.threshold;if(l<=0||i<l)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=l*.5;let[s,r]=this.getMostFrequentStack(),o=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${r}):`;console.warn(o),console.warn(s);let _=new hc(o,s);this._errorHandler(_)}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[l,h]of this._stacks)(!t||i<h)&&(t=[l,h],i=h);return t}};ho._idPool=1;var cc=ho,Js=class _o{constructor(t){this.value=t}static create(){let t=new Error;return new _o(t.stack??"")}print(){console.warn(this.value.split(`
56
+ `),{leaks:o,details:s}}};zl.idx=0;function jl(e){$t=e}if(Ul){let e="__is_disposable_tracked__";jl(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!==Oe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Oe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Zi(e){return $t?.trackDisposable(e),e}function Qi(e){$t?.markAsDisposed(e)}function ai(e,t){$t?.setParent(e,t)}function ql(e,t){if($t)for(let i of e)$t.setParent(i,t)}function ro(e){if(es.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(o){t.push(o)}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 so(...e){let t=ke(()=>ro(e));return ql(e,t),t}function ke(e){let t=Zi({dispose:$l(()=>{Qi(t),e()})});return t}var no=class oo{constructor(){this._toDispose=new Set,this._isDisposed=!1,Zi(this)}dispose(){this._isDisposed||(Qi(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ro(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 ai(t,this),this._isDisposed?oo.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),ai(t,null))}};no.DISABLE_DISPOSED_WARNING=!1;var Wt=no,Oe=class{constructor(){this._store=new Wt,Zi(this),ai(this._store,this)}dispose(){Qi(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Oe.None=Object.freeze({dispose(){}});var ii=class{constructor(){this._isDisposed=!1,Zi(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ai(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Qi(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ai(e,null),e}},cs=typeof process<"u"&&"title"in process,ci=cs?"node":navigator.userAgent,hs=cs?"node":navigator.platform,Kl=ci.includes("Firefox"),Gl=ci.includes("Edge"),ao=/^((?!chrome|android).)*safari/i.test(ci);function Vl(){if(!ao)return 0;let e=ci.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var of=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(hs),af=["Windows","Win16","Win32","WinCE"].includes(hs),lf=hs.indexOf("Linux")>=0,cf=/\bCrOS\b/.test(ci),Yl="",Se=0,Ce=0,ye=0,pe=0,Ne={css:"#00000000",rgba:0},Me;(e=>{function t(h,r,s,a){return a!==void 0?`#${Ct(h)}${Ct(r)}${Ct(s)}${Ct(a)}`:`#${Ct(h)}${Ct(r)}${Ct(s)}`}e.toCss=t;function i(h,r,s,a=255){return(h<<24|r<<16|s<<8|a)>>>0}e.toRgba=i;function o(h,r,s,a){return{css:e.toCss(h,r,s,a),rgba:e.toRgba(h,r,s,a)}}e.toColor=o})(Me||(Me={}));var Nt;(e=>{function t(f,n){if(pe=(n.rgba&255)/255,pe===1)return{css:n.css,rgba:n.rgba};let _=n.rgba>>24&255,v=n.rgba>>16&255,w=n.rgba>>8&255,p=f.rgba>>24&255,c=f.rgba>>16&255,d=f.rgba>>8&255;Se=p+Math.round((_-p)*pe),Ce=c+Math.round((v-c)*pe),ye=d+Math.round((w-d)*pe);let l=Me.toCss(Se,Ce,ye),u=Me.toRgba(Se,Ce,ye);return{css:l,rgba:u}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function o(f,n,_){let v=_t.ensureContrastRatio(f.rgba,n.rgba,_);if(v)return Me.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=o;function h(f){let n=(f.rgba|255)>>>0;return[Se,Ce,ye]=_t.toChannels(n),{css:Me.toCss(Se,Ce,ye),rgba:n}}e.opaque=h;function r(f,n){return pe=Math.round(n*255),[Se,Ce,ye]=_t.toChannels(f.rgba),{css:Me.toCss(Se,Ce,ye,pe),rgba:Me.toRgba(Se,Ce,ye,pe)}}e.opacity=r;function s(f,n){return pe=f.rgba&255,r(f,pe*n/255)}e.multiplyOpacity=s;function a(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=a})(Nt||(Nt={}));var gn;(e=>{let t,i;try{let h=document.createElement("canvas");h.width=1,h.height=1;let r=h.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function o(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return Se=parseInt(h.slice(1,2).repeat(2),16),Ce=parseInt(h.slice(2,3).repeat(2),16),ye=parseInt(h.slice(3,4).repeat(2),16),Me.toColor(Se,Ce,ye);case 5:return Se=parseInt(h.slice(1,2).repeat(2),16),Ce=parseInt(h.slice(2,3).repeat(2),16),ye=parseInt(h.slice(3,4).repeat(2),16),pe=parseInt(h.slice(4,5).repeat(2),16),Me.toColor(Se,Ce,ye,pe);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 r=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(r)return Se=parseInt(r[1]),Ce=parseInt(r[2]),ye=parseInt(r[3]),pe=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Me.toColor(Se,Ce,ye,pe);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=h,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Se,Ce,ye,pe]=t.getImageData(0,0,1,1).data,pe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Me.toRgba(Se,Ce,ye,pe),css:h}}e.toColor=o})(gn||(gn={}));var Le;(e=>{function t(o){return i(o>>16&255,o>>8&255,o&255)}e.relativeLuminance=t;function i(o,h,r){let s=o/255,a=h/255,f=r/255,n=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),v=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return n*.2126+_*.7152+v*.0722}e.relativeLuminance2=i})(Le||(Le={}));var _t;(e=>{function t(s,a){if(pe=(a&255)/255,pe===1)return a;let f=a>>24&255,n=a>>16&255,_=a>>8&255,v=s>>24&255,w=s>>16&255,p=s>>8&255;return Se=v+Math.round((f-v)*pe),Ce=w+Math.round((n-w)*pe),ye=p+Math.round((_-p)*pe),Me.toRgba(Se,Ce,ye)}e.blend=t;function i(s,a,f){let n=Le.relativeLuminance(s>>8),_=Le.relativeLuminance(a>>8);if(tt(n,_)<f){if(_<n){let p=o(s,a,f),c=tt(n,Le.relativeLuminance(p>>8));if(c<f){let d=h(s,a,f),l=tt(n,Le.relativeLuminance(d>>8));return c>l?p:d}return p}let v=h(s,a,f),w=tt(n,Le.relativeLuminance(v>>8));if(w<f){let p=o(s,a,f),c=tt(n,Le.relativeLuminance(p>>8));return w>c?v:p}return v}}e.ensureContrastRatio=i;function o(s,a,f){let n=s>>24&255,_=s>>16&255,v=s>>8&255,w=a>>24&255,p=a>>16&255,c=a>>8&255,d=tt(Le.relativeLuminance2(w,p,c),Le.relativeLuminance2(n,_,v));for(;d<f&&(w>0||p>0||c>0);)w-=Math.max(0,Math.ceil(w*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),d=tt(Le.relativeLuminance2(w,p,c),Le.relativeLuminance2(n,_,v));return(w<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=o;function h(s,a,f){let n=s>>24&255,_=s>>16&255,v=s>>8&255,w=a>>24&255,p=a>>16&255,c=a>>8&255,d=tt(Le.relativeLuminance2(w,p,c),Le.relativeLuminance2(n,_,v));for(;d<f&&(w<255||p<255||c<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),d=tt(Le.relativeLuminance2(w,p,c),Le.relativeLuminance2(n,_,v));return(w<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=h;function r(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]}e.toChannels=r})(_t||(_t={}));function Ct(e){let t=e.toString(16);return t.length<2?"0"+t:t}function tt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function me(e){if(!e)throw new Error("value must not be falsy");return e}function ds(e){return 57508<=e&&e<=57558}function Xl(e){return 57520<=e&&e<=57527}function Jl(e){return 57344<=e&&e<=63743}function Zl(e){return 9472<=e&&e<=9631}function Ql(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 ec(e,t,i,o){return t===1&&i>Math.ceil(o*1.5)&&e!==void 0&&e>255&&!Ql(e)&&!ds(e)&&!Jl(e)}function lo(e){return ds(e)||Zl(e)}function tc(){return{css:{canvas:Hi(),cell:Hi()},device:{canvas:Hi(),cell:Hi(),char:{width:0,height:0,left:0,top:0}}}}function Hi(){return{width:0,height:0}}function ic(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Ee=0,we=0,Ke=!1,it=!1,Fi=!1,Ae,Ir=0,rc=class{constructor(e,t,i,o,h,r){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=o,this._coreBrowserService=h,this._themeService=r,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,o){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,we=0,Ee=0,it=!1,Ke=!1,Fi=!1,Ae=this._themeService.colors,Ir=0,e.getCode()!==0&&e.extended.underlineStyle===4){let h=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Ir=t*o%(Math.round(h)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",h=>{h.backgroundColorRGB&&(we=h.backgroundColorRGB.rgba>>8&16777215,it=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Ke=!0)}),Fi=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Fi){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)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}else 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}we=_t.blend(we,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else we=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(it=!0,Ae.selectionForeground&&(Ee=Ae.selectionForeground.rgba>>8&16777215,Ke=!0),lo(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ee=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ee=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ee=(this.result.fg&16777215)<<8|255;break;default:Ee=this._themeService.colors.foreground.rgba}Ee=_t.blend(Ee,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ke=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",h=>{h.backgroundColorRGB&&(we=h.backgroundColorRGB.rgba>>8&16777215,it=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Ke=!0)}),it&&(Fi?we=e.bg&-16777216&-134217729|we|50331648:we=e.bg&-16777216|we|50331648),Ke&&(Ee=e.fg&-16777216&-67108865|Ee|50331648),this.result.fg&67108864&&(it&&!Ke&&((this.result.bg&50331648)===0?Ee=this.result.fg&-134217728|Ae.background.rgba>>8&16777215&16777215|50331648:Ee=this.result.fg&-134217728|this.result.bg&67108863,Ke=!0),!it&&Ke&&((this.result.fg&50331648)===0?we=this.result.bg&-67108864|Ae.foreground.rgba>>8&16777215&16777215|50331648:we=this.result.bg&-67108864|this.result.fg&67108863,it=!0)),Ae=void 0,this.result.bg=it?we:this.result.bg,this.result.fg=Ke?Ee:this.result.fg,this.result.ext&=536870911,this.result.ext|=Ir<<29&3758096384}},sc=.5,co=Kl||Gl?"bottom":"ideographic",nc={"\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}]},oc={"\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]]},ac={"\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`}},li={"\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}};li["\uE0BB"]=li["\uE0BD"];li["\uE0BF"]=li["\uE0B9"];function lc(e,t,i,o,h,r,s,a){let f=nc[t];if(f)return cc(e,f,i,o,h,r),!0;let n=oc[t];if(n)return hc(e,n,i,o,h,r),!0;let _=ac[t];if(_)return dc(e,_,i,o,h,r,a),!0;let v=li[t];return v?(uc(e,v,i,o,h,r,s,a),!0):!1}function cc(e,t,i,o,h,r){for(let s=0;s<t.length;s++){let a=t[s],f=h/8,n=r/8;e.fillRect(i+a.x*f,o+a.y*n,a.w*f,a.h*n)}}var mn=new Map;function hc(e,t,i,o,h,r){let s=mn.get(t);s||(s=new Map,mn.set(t,s));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let f=s.get(a);if(!f){let n=t[0].length,_=t.length,v=e.canvas.ownerDocument.createElement("canvas");v.width=n,v.height=_;let w=me(v.getContext("2d")),p=new ImageData(n,_),c,d,l,u;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),d=parseInt(a.slice(3,5),16),l=parseInt(a.slice(5,7),16),u=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,d,l,u]=a.substring(5,a.length-1).split(",").map(g=>parseFloat(g));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let g=0;g<_;g++)for(let C=0;C<n;C++)p.data[(g*n+C)*4]=c,p.data[(g*n+C)*4+1]=d,p.data[(g*n+C)*4+2]=l,p.data[(g*n+C)*4+3]=t[g][C]*(u*255);w.putImageData(p,0,0),f=me(e.createPattern(v,null)),s.set(a,f)}e.fillStyle=f,e.fillRect(i,o,h,r)}function dc(e,t,i,o,h,r,s){e.strokeStyle=e.fillStyle;for(let[a,f]of Object.entries(t)){e.beginPath(),e.lineWidth=s*Number.parseInt(a);let n;if(typeof f=="function"){let _=.15/r*h;n=f(.15,_)}else n=f;for(let _ of n.split(" ")){let v=_[0],w=ho[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||w(e,uo(p,h,r,i,o,!0,s))}e.stroke(),e.closePath()}}function uc(e,t,i,o,h,r,s,a){let f=new Path2D;f.rect(i,o,h,r),e.clip(f),e.beginPath();let n=s/12;e.lineWidth=a*n;for(let _ of t.d.split(" ")){let v=_[0],w=ho[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||w(e,uo(p,h,r,i,o,!1,a,(t.leftPadding??0)*(n/2),(t.rightPadding??0)*(n/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function bn(e,t,i=0){return Math.max(Math.min(e,t),i)}var ho={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 uo(e,t,i,o,h,r,s,a=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-a*s-f*s,r&&n[_]!==0&&(n[_]=bn(Math.round(n[_]+.5)-.5,t,0)),n[_]+=o+a*s;for(let _=1;_<n.length;_+=2)n[_]*=i,r&&n[_]!==0&&(n[_]=bn(Math.round(n[_]+.5)-.5,i,0)),n[_]+=h;return n}var wn=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={}}},Sn=class{constructor(){this._data=new wn}set(e,t,i,o,h){this._data.get(e,t)||this._data.set(e,t,new wn),this._data.get(e,t).set(i,o,h)}get(e,t,i,o){return this._data.get(e,t)?.get(i,o)}clear(){this._data.clear()}},fo=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,o=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),i=Math.max(t,i),h=e.timeRemaining(),i*1.5>h){o-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(o-t))}ms`),this._start();return}o=h}this.clear()}},fc=class extends fo{_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())}}},_c=class extends fo{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},pc=!cs&&"requestIdleCallback"in window?_c:fc,Ht=class _o{constructor(){this.fg=0,this.bg=0,this.extended=new po}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 _o;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}},po=class vo{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 vo(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Cn=class ts{constructor(t){this.element=t,this.next=ts.Undefined,this.prev=ts.Undefined}};Cn.Undefined=new Cn(void 0);var vc=globalThis.performance&&typeof globalThis.performance.now=="function",gc=class go{static create(t){return new go(t)}constructor(t){this._now=vc&&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}},mc=!1,yn=!1,bc=!1,Ge;(e=>{e.None=()=>Oe.None;function t(P){if(bc){let{onDidAddListener:M}=P,I=ss.create(),T=0;P.onDidAddListener=()=>{++T===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),I.print()),M?.()}}}function i(P,M){return w(P,()=>{},0,void 0,!0,void 0,M)}e.defer=i;function o(P){return(M,I=null,T)=>{let S=!1,E;return E=P(L=>{if(!S)return E?E.dispose():S=!0,M.call(I,L)},null,T),S&&E.dispose(),E}}e.once=o;function h(P,M,I){return _((T,S=null,E)=>P(L=>T.call(S,M(L)),null,E),I)}e.map=h;function r(P,M,I){return _((T,S=null,E)=>P(L=>{M(L),T.call(S,L)},null,E),I)}e.forEach=r;function s(P,M,I){return _((T,S=null,E)=>P(L=>M(L)&&T.call(S,L),null,E),I)}e.filter=s;function a(P){return P}e.signal=a;function f(...P){return(M,I=null,T)=>{let S=so(...P.map(E=>E(L=>M.call(I,L))));return v(S,T)}}e.any=f;function n(P,M,I,T){let S=I;return h(P,E=>(S=M(S,E),S),T)}e.reduce=n;function _(P,M){let I,T={onWillAddFirstListener(){I=P(S.fire,S)},onDidRemoveLastListener(){I?.dispose()}};M||t(T);let S=new he(T);return M?.add(S),S.event}function v(P,M){return M instanceof Array?M.push(P):M&&M.add(P),P}function w(P,M,I=100,T=!1,S=!1,E,L){let R,U,K,Y=0,z,D={leakWarningThreshold:E,onWillAddFirstListener(){R=P(N=>{Y++,U=M(U,N),T&&!K&&(x.fire(U),U=void 0),z=()=>{let F=U;U=void 0,K=void 0,(!T||Y>1)&&x.fire(F),Y=0},typeof I=="number"?(clearTimeout(K),K=setTimeout(z,I)):K===void 0&&(K=0,queueMicrotask(z))})},onWillRemoveListener(){S&&Y>0&&z?.()},onDidRemoveLastListener(){z=void 0,R.dispose()}};L||t(D);let x=new he(D);return L?.add(x),x.event}e.debounce=w;function p(P,M=0,I){return e.debounce(P,(T,S)=>T?(T.push(S),T):[S],M,void 0,!0,void 0,I)}e.accumulate=p;function c(P,M=(T,S)=>T===S,I){let T=!0,S;return s(P,E=>{let L=T||!M(E,S);return T=!1,S=E,L},I)}e.latch=c;function d(P,M,I){return[e.filter(P,M,I),e.filter(P,T=>!M(T),I)]}e.split=d;function l(P,M=!1,I=[],T){let S=I.slice(),E=P(U=>{S?S.push(U):R.fire(U)});T&&T.add(E);let L=()=>{S?.forEach(U=>R.fire(U)),S=null},R=new he({onWillAddFirstListener(){E||(E=P(U=>R.fire(U)),T&&T.add(E))},onDidAddFirstListener(){S&&(M?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return T&&T.add(R),R.event}e.buffer=l;function u(P,M){return(I,T,S)=>{let E=M(new C);return P(function(L){let R=E.evaluate(L);R!==g&&I.call(T,R)},void 0,S)}}e.chain=u;let g=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(I=>(M(I),I)),this}filter(M){return this.steps.push(I=>M(I)?I:g),this}reduce(M,I){let T=I;return this.steps.push(S=>(T=M(T,S),T)),this}latch(M=(I,T)=>I===T){let I=!0,T;return this.steps.push(S=>{let E=I||!M(S,T);return I=!1,T=S,E?S:g}),this}evaluate(M){for(let I of this.steps)if(M=I(M),M===g)break;return M}}function b(P,M,I=T=>T){let T=(...R)=>L.fire(I(...R)),S=()=>P.on(M,T),E=()=>P.removeListener(M,T),L=new he({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=b;function y(P,M,I=T=>T){let T=(...R)=>L.fire(I(...R)),S=()=>P.addEventListener(M,T),E=()=>P.removeEventListener(M,T),L=new he({onWillAddFirstListener:S,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(P){return new Promise(M=>o(P)(M))}e.toPromise=m;function k(P){let M=new he;return P.then(I=>{M.fire(I)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=k;function B(P,M){return P(I=>M.fire(I))}e.forward=B;function O(P,M,I){return M(I),P(T=>M(T))}e.runAndSubscribe=O;class H{constructor(M,I){this._observable=M,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};I||t(T),this.emitter=new he(T),I&&I.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,I){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(P,M){return new H(P,M).emitter.event}e.fromObservable=A;function W(P){return(M,I,T)=>{let S=0,E=!1,L={beginUpdate(){S++},endUpdate(){S--,S===0&&(P.reportChanges(),E&&(E=!1,M.call(I)))},handlePossibleChange(){},handleChange(){E=!0}};P.addObserver(L),P.reportChanges();let R={dispose(){P.removeObserver(L)}};return T instanceof Wt?T.add(R):Array.isArray(T)&&T.push(R),R}}e.fromObservableLight=W})(Ge||(Ge={}));var is=class rs{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${rs._idPool++}`,rs.all.add(this)}start(t){this._stopWatch=new gc,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}}};is.all=new Set,is._idPool=0;var wc=is,xn=-1,mo=class bo{constructor(t,i,o=(bo._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=o,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let o=this.threshold;if(o<=0||i<o)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=o*.5;let[r,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(r);let f=new Cc(a,r);this._errorHandler(f)}return()=>{let r=this._stacks.get(t.value)||0;this._stacks.set(t.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[o,h]of this._stacks)(!t||i<h)&&(t=[o,h],i=h);return t}};mo._idPool=1;var Sc=mo,ss=class wo{constructor(t){this.value=t}static create(){let t=new Error;return new wo(t.stack??"")}print(){console.warn(this.value.split(`
57
57
  `).slice(2).join(`
58
- `))}},hc=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},dc=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},uc=0,Hi=class{constructor(e){this.value=e,this.id=uc++}},_c=2,fc=(e,t)=>{if(e instanceof Hi)t(e);else for(let i=0;i<e.length;i++){let l=e[i];l&&t(l)}},Fi;if(oc){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),Fi=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var he=class{constructor(e){this._size=0,this._options=e,this._leakageMon=gn>0||this._options?.leakWarningThreshold?new cc(e?.onListenerError??Ni,this._options?.leakWarningThreshold??gn):void 0,this._perfMon=this._options?._profName?new lc(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(vn){let e=this._listeners;queueMicrotask(()=>{fc(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 o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new dc(`${o}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(this._options?.onListenerError||Ni)(n),Pe.None}if(this._disposed)return Pe.None;t&&(e=e.bind(t));let l=new Hi(e),h,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(l.stack=Js.create(),h=this._leakageMon.check(l.stack,this._size+1)),vn&&(l.stack=s??Js.create()),this._listeners?this._listeners instanceof Hi?(this._deliveryQueue??(this._deliveryQueue=new pc),this._listeners=[this._listeners,l]):this._listeners.push(l):(this._options?.onWillAddFirstListener?.(this),this._listeners=l,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=ye(()=>{Fi?.unregister(r),h?.(),this._removeListener(l)});if(i instanceof Wt?i.add(r):Array.isArray(i)&&i.push(r),Fi){let o=new Error().stack.split(`
58
+ `))}},Cc=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},yc=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},xc=0,zi=class{constructor(e){this.value=e,this.id=xc++}},Ec=2,kc=(e,t)=>{if(e instanceof zi)t(e);else for(let i=0;i<e.length;i++){let o=e[i];o&&t(o)}},ji;if(mc){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),ji=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var he=class{constructor(e){this._size=0,this._options=e,this._leakageMon=xn>0||this._options?.leakWarningThreshold?new Sc(e?.onListenerError??Ui,this._options?.leakWarningThreshold??xn):void 0,this._perfMon=this._options?._profName?new wc(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(yn){let e=this._listeners;queueMicrotask(()=>{kc(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 a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new yc(`${a}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Ui)(n),Oe.None}if(this._disposed)return Oe.None;t&&(e=e.bind(t));let o=new zi(e),h,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=ss.create(),h=this._leakageMon.check(o.stack,this._size+1)),yn&&(o.stack=r??ss.create()),this._listeners?this._listeners instanceof zi?(this._deliveryQueue??(this._deliveryQueue=new Lc),this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=ke(()=>{ji?.unregister(s),h?.(),this._removeListener(o)});if(i instanceof Wt?i.add(s):Array.isArray(i)&&i.push(s),ji){let a=new Error().stack.split(`
60
60
  `).slice(2,3).join(`
61
- `).trim(),_=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(o);Fi.register(r,_?.[2]??o,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 l=this._deliveryQueue.current===this;if(this._size*_c<=t.length){let h=0;for(let s=0;s<t.length;s++)t[s]?t[h++]=t[s]:l&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Ni;if(!i){e.value(t);return}try{e.value(t)}catch(l){i(l)}}_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 Hi)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}},pc=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}},mn={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}},ii=2,si,ut=class It{constructor(t,i,l){this._document=t,this._config=i,this._unicodeService=l,this._didWarmUp=!1,this._cacheMap=new fn,this._cacheMapCombined=new fn,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ht,this._textureSize=512,this._onAddTextureAtlasCanvas=new he,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new he,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=fo(t,this._config.deviceCellWidth*4+ii*2,this._config.deviceCellHeight+ii*2),this._tmpCtx=ge(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 sc;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let l=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,l)}})}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(It.maxAtlasPages&&this._pages.length>=Math.max(4,It.maxAtlasPages)){let i=this._pages.filter(n=>n.canvas.width*2<=(It.maxTextureSize||4096)).sort((n,f)=>f.canvas.width!==n.canvas.width?f.canvas.width-n.canvas.width:f.percentageUsed-n.percentageUsed),l=-1,h=0;for(let n=0;n<i.length;n++)if(i[n].canvas.width!==h)l=n,h=i[n].canvas.width;else if(n-l===3)break;let s=i.slice(l,l+4),r=s.map(n=>n.glyphs[0].texturePage).sort((n,f)=>n>f?1:-1),o=this.pages.length-s.length,_=this._mergePages(s,o);_.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 Ts(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let l=t[0].canvas.width*2,h=new Ts(this._document,l,t);for(let[s,r]of t.entries()){let o=s*r.canvas.width%l,_=Math.floor(s/2)*r.canvas.height;h.ctx.drawImage(r.canvas,o,_);for(let f of r.glyphs)f.texturePage=i,f.sizeClipSpace.x=f.size.x/l,f.sizeClipSpace.y=f.size.y/l,f.texturePosition.x+=o,f.texturePosition.y+=_,f.texturePositionClipSpace.x=f.texturePosition.x/l,f.texturePositionClipSpace.y=f.texturePosition.y/l;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 i=t;i<this._pages.length;i++){let l=this._pages[i];for(let h of l.glyphs)h.texturePage--;l.version++}}getRasterizedGlyphCombinedChar(t,i,l,h,s,r){return this._getFromCacheMap(this._cacheMapCombined,t,i,l,h,s,r)}getRasterizedGlyph(t,i,l,h,s,r){return this._getFromCacheMap(this._cacheMap,t,i,l,h,s,r)}_getFromCacheMap(t,i,l,h,s,r,o){return si=t.get(i,l,h,s),si||(si=this._drawToCache(i,l,h,s,r,o),t.set(i,l,h,s,si)),si}_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,l,h){if(this._config.allowTransparency)return Ne;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(i);break;case 50331648:let r=Ht.toColorRGB(i);s=ke.toColor(r[0],r[1],r[2]);break;default:l?s=Nt.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=Nt.opaque(s)),s}_getForegroundColor(t,i,l,h,s,r,o,_,n,f){let v=this._getMinimumContrastColor(t,i,l,h,s,r,o,n,_,f);if(v)return v;let w;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&n&&r<8&&(r+=8),w=this._getColorFromAnsiIndex(r);break;case 50331648:let p=Ht.toColorRGB(r);w=ke.toColor(p[0],p[1],p[2]);break;default:o?w=this._config.colors.background:w=this._config.colors.foreground}return this._config.allowTransparency&&(w=Nt.opaque(w)),_&&(w=Nt.multiplyOpacity(w,Kl)),w}_resolveBackgroundRgba(t,i,l){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return l?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,l,h){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&h&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return l?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,l,h,s,r,o,_,n,f){if(this._config.minimumContrastRatio===1||f)return;let v=this._getContrastCache(n),w=v.getColor(t,h);if(w!==void 0)return w||void 0;let p=this._resolveBackgroundRgba(i,l,o),c=this._resolveForegroundRgba(s,r,o,_),d=ft.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(n?2:1));if(!d){v.setColor(t,h,null);return}let a=ke.toColor(d>>24&255,d>>16&255,d>>8&255);return v.setColor(t,h,a),a}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,l,h,s,r){let o=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(o.length,2)+ii*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<_&&(this._tmpCanvas.width=_);let n=Math.min(this._config.deviceCellHeight+ii*4,this._textureSize);if(this._tmpCanvas.height<n&&(this._tmpCanvas.height=n),this._tmpCtx.save(),this._workAttributeData.fg=l,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=h,!!this._workAttributeData.isInvisible())return mn;let f=!!this._workAttributeData.isBold(),v=!!this._workAttributeData.isInverse(),w=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),a=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),g=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(v){let M=u;u=C,C=M;let U=g;g=b,b=U}let y=this._getBackgroundColor(b,C,v,w);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,k=p?"italic":"";this._tmpCtx.font=`${k} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=io;let B=o.length===1&&rr(o.charCodeAt(0)),P=o.length===1&&Hl(o.charCodeAt(0)),H=this._getForegroundColor(i,b,C,l,g,u,v,w,f,to(o.charCodeAt(0)));this._tmpCtx.fillStyle=H.css;let A=P?0:ii*2,F=!1;this._config.customGlyphs!==!1&&(F=Xl(this._tmpCtx,o,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let O=!B,T;if(typeof t=="number"?T=this._unicodeService.wcwidth(t):T=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),U=M%2===1?.5:0;if(this._tmpCtx.lineWidth=M,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())O=!1,this._tmpCtx.strokeStyle=`rgb(${Ht.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{O=!1;let N=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&N<8&&(N+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(N).css}this._tmpCtx.beginPath();let q=A,Y=Math.ceil(A+this._config.deviceCharHeight)-U-(s?M*2:0),z=Y+M,D=Y+M*2,x=this._workAttributeData.getUnderlineVariantOffset();for(let N=0;N<T;N++){this._tmpCtx.save();let W=q+N*this._config.deviceCellWidth,j=q+(N+1)*this._config.deviceCellWidth,G=W+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(W,Y),this._tmpCtx.lineTo(j,Y),this._tmpCtx.moveTo(W,D),this._tmpCtx.lineTo(j,D);break;case 3:let Z=M<=1?D:Math.ceil(A+this._config.deviceCharHeight-M/2)-U,K=M<=1?Y:Math.ceil(A+this._config.deviceCharHeight+M/2)-U,X=new Path2D;X.rect(W,Y,this._config.deviceCellWidth,D-Y),this._tmpCtx.clip(X),this._tmpCtx.moveTo(W-this._config.deviceCellWidth/2,z),this._tmpCtx.bezierCurveTo(W-this._config.deviceCellWidth/2,K,W,K,W,z),this._tmpCtx.bezierCurveTo(W,Z,G,Z,G,z),this._tmpCtx.bezierCurveTo(G,K,j,K,j,z),this._tmpCtx.bezierCurveTo(j,Z,j+this._config.deviceCellWidth/2,Z,j+this._config.deviceCellWidth/2,z);break;case 4:let te=x===0?0:x>=M?M*2-x:M-x;x>=M||te===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(W+te,Y),this._tmpCtx.lineTo(j,Y)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(W,Y),this._tmpCtx.lineTo(W+te,Y),this._tmpCtx.moveTo(W+te+M,Y),this._tmpCtx.lineTo(j,Y)),x=jl(j-W,M,x);break;case 5:let Q=.6,ne=.3,ce=j-W,Re=Math.floor(Q*ce),ue=Math.floor(ne*ce),Me=ce-Re-ue;this._tmpCtx.setLineDash([Re,ue,Me]),this._tmpCtx.moveTo(W,Y),this._tmpCtx.lineTo(j,Y);break;default:this._tmpCtx.moveTo(W,Y),this._tmpCtx.lineTo(j,Y);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!F&&this._config.fontSize>=12&&!this._config.allowTransparency&&o!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let N=this._tmpCtx.measureText(o);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in N&&N.actualBoundingBoxDescent>0){this._tmpCtx.save();let W=new Path2D;W.rect(q,Y-Math.ceil(M/2),this._config.deviceCellWidth*T,D-Y+Math.ceil(M/2)),this._tmpCtx.clip(W),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(o,A,A+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(a){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),U=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+U),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*T,A+U),this._tmpCtx.stroke()}if(F||this._tmpCtx.fillText(o,A,A+this._config.deviceCharHeight),o==="_"&&!this._config.allowTransparency){let M=As(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),y,H,O);if(M)for(let U=1;U<=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(o,A,A+this._config.deviceCharHeight-U),M=As(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),y,H,O),!!M);U++);}if(d){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),U=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+Math.floor(this._config.deviceCharHeight/2)-U),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*T,A+Math.floor(this._config.deviceCharHeight/2)-U),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),R;if(this._config.allowTransparency?R=vc(I):R=As(I,y,H,O),R)return mn;let S=this._findGlyphBoundingBox(I,this._workBoundingBox,_,P,F,A),E,L;for(;;){if(this._activePages.length===0){let M=this._createNewPage();E=M,L=M.currentRow,L.height=S.size.y;break}E=this._activePages[this._activePages.length-1],L=E.currentRow;for(let M of this._activePages)S.size.y<=M.currentRow.height&&(E=M,L=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let U of this._activePages[M].fixedRows)U.height<=L.height&&S.size.y<=U.height&&(E=this._activePages[M],L=U);if(S.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Ts(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+S.size.x>=E.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+S.size.y>=E.canvas.height||L.height>S.size.y+2){let M=!1;if(E.currentRow.y+E.currentRow.height+S.size.y>=E.canvas.height){let U;for(let q of this._activePages)if(q.currentRow.y+q.currentRow.height+S.size.y<q.canvas.height){U=q;break}if(U)E=U;else if(It.maxAtlasPages&&this._pages.length>=It.maxAtlasPages&&L.y+S.size.y<=E.canvas.height&&L.height>=S.size.y&&L.x+S.size.x<=E.canvas.width)M=!0;else{let q=this._createNewPage();E=q,L=q.currentRow,L.height=S.size.y,M=!0}}M||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),L={x:0,y:E.currentRow.y+E.currentRow.height,height:S.size.y},E.fixedRows.push(L),E.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+S.size.x<=E.canvas.width)break;L===E.currentRow?(L.x=0,L.y+=L.height,L.height=0):E.fixedRows.splice(E.fixedRows.indexOf(L),1)}return S.texturePage=this._pages.indexOf(E),S.texturePosition.x=L.x,S.texturePosition.y=L.y,S.texturePositionClipSpace.x=L.x/E.canvas.width,S.texturePositionClipSpace.y=L.y/E.canvas.height,S.sizeClipSpace.x/=E.canvas.width,S.sizeClipSpace.y/=E.canvas.height,L.height=Math.max(L.height,S.size.y),L.x+=S.size.x,E.ctx.putImageData(I,S.texturePosition.x-this._workBoundingBox.left,S.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,S.size.x,S.size.y),E.addGlyph(S),E.version++,S}_findGlyphBoundingBox(t,i,l,h,s,r){i.top=0;let o=h?this._config.deviceCellHeight:this._tmpCanvas.height,_=h?this._config.deviceCellWidth:l,n=!1;for(let f=0;f<o;f++){for(let v=0;v<_;v++){let w=f*this._tmpCanvas.width*4+v*4+3;if(t.data[w]!==0){i.top=f,n=!0;break}}if(n)break}i.left=0,n=!1;for(let f=0;f<r+_;f++){for(let v=0;v<o;v++){let w=v*this._tmpCanvas.width*4+f*4+3;if(t.data[w]!==0){i.left=f,n=!0;break}}if(n)break}i.right=_,n=!1;for(let f=r+_-1;f>=r;f--){for(let v=0;v<o;v++){let w=v*this._tmpCanvas.width*4+f*4+3;if(t.data[w]!==0){i.right=f,n=!0;break}}if(n)break}i.bottom=o,n=!1;for(let f=o-1;f>=0;f--){for(let v=0;v<_;v++){let w=f*this._tmpCanvas.width*4+v*4+3;if(t.data[w]!==0){i.bottom=f,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+(h||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+r+(h||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Ts=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 l of i)this._glyphs.push(...l.glyphs),this._usedPixels+=l._usedPixels;this.canvas=fo(e,t,t),this.ctx=ge(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 As(e,t,i,l){let h=t.rgba>>>24,s=t.rgba>>>16&255,r=t.rgba>>>8&255,o=i.rgba>>>24,_=i.rgba>>>16&255,n=i.rgba>>>8&255,f=Math.floor((Math.abs(h-o)+Math.abs(s-_)+Math.abs(r-n))/12),v=!0;for(let w=0;w<e.data.length;w+=4)e.data[w]===h&&e.data[w+1]===s&&e.data[w+2]===r||l&&Math.abs(e.data[w]-h)+Math.abs(e.data[w+1]-s)+Math.abs(e.data[w+2]-r)<f?e.data[w+3]=0:v=!1;return v}function vc(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function fo(e,t,i){let l=e.createElement("canvas");return l.width=t,l.height=i,l}function gc(e,t,i,l,h,s,r,o){let _={foreground:s.foreground,background:s.background,cursor:Ne,cursorAccent:Ne,selectionForeground:Ne,selectionBackgroundTransparent:Ne,selectionBackgroundOpaque:Ne,selectionInactiveBackgroundTransparent:Ne,selectionInactiveBackgroundOpaque:Ne,overviewRulerBorder:Ne,scrollbarSliderBackground:Ne,scrollbarSliderHoverBackground:Ne,scrollbarSliderActiveBackground:Ne,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:h.customGlyphs,devicePixelRatio:r,deviceMaxTextureSize:o,letterSpacing:h.letterSpacing,lineHeight:h.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:l,fontFamily:h.fontFamily,fontSize:h.fontSize,fontWeight:h.fontWeight,fontWeightBold:h.fontWeightBold,allowTransparency:h.allowTransparency,drawBoldTextInBrightColors:h.drawBoldTextInBrightColors,minimumContrastRatio:h.minimumContrastRatio,colors:_}}function bn(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 mc(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Fe=[];function po(e,t,i,l,h,s,r,o,_){let n=gc(l,h,s,r,t,i,o,_);for(let w=0;w<Fe.length;w++){let p=Fe[w],c=p.ownedBy.indexOf(e);if(c>=0){if(bn(p.config,n))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),Fe.splice(w,1)):p.ownedBy.splice(c,1);break}}for(let w=0;w<Fe.length;w++){let p=Fe[w];if(bn(p.config,n))return p.ownedBy.push(e),p.atlas}let f=e._core,v={atlas:new ut(document,n,f.unicodeService),config:n,ownedBy:[e]};return Fe.push(v),v.atlas}function wn(e){for(let t=0;t<Fe.length;t++){let i=Fe[t].ownedBy.indexOf(e);if(i!==-1){Fe[t].ownedBy.length===1?(Fe[t].atlas.dispose(),Fe.splice(t,1)):Fe[t].ownedBy.splice(i,1);break}}}var Oi=600,bc=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=Oi){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Oi-(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=Oi-(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})},Oi)},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 Sn(e,t,i){let l=new t.ResizeObserver(h=>{let s=h.find(_=>_.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){l?.disconnect(),l=void 0;return}let r=s.devicePixelContentBoxSize[0].inlineSize,o=s.devicePixelContentBoxSize[0].blockSize;r>0&&o>0&&i(r,o)});try{l.observe(e,{box:["device-pixel-content-box"]})}catch{l.disconnect(),l=void 0}return ye(()=>l?.disconnect())}function wc(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Cn=class vo extends Ht{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ao,this.combinedData=""}static fromCharData(t){let i=new vo;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?wc(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 l=t[1].charCodeAt(0);if(55296<=l&&l<=56319){let h=t[1].charCodeAt(1);56320<=h&&h<=57343?this.content=(l-55296)*1024+h-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()]}},go=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function mo(e,t,i){let l=ge(e.createProgram());if(e.attachShader(l,ge(yn(e,e.VERTEX_SHADER,t))),e.attachShader(l,ge(yn(e,e.FRAGMENT_SHADER,i))),e.linkProgram(l),e.getProgramParameter(l,e.LINK_STATUS))return l;console.error(e.getProgramInfoLog(l)),e.deleteProgram(l)}function yn(e,t,i){let l=ge(e.createShader(t));if(e.shaderSource(l,i),e.compileShader(l),e.getShaderParameter(l,e.COMPILE_STATUS))return l;console.error(e.getShaderInfoLog(l)),e.deleteShader(l)}function Sc(e,t){let i=Math.min(e.length*2,t),l=new Float32Array(i);for(let h=0;h<e.length;h++)l[h]=e[h];return l}var Cc=class{constructor(e){this.texture=e,this.version=-1}},yc=`#version 300 es
61
+ `).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);ji.register(s,f?.[2]??a,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,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 o=this._deliveryQueue.current===this;if(this._size*Ec<=t.length){let h=0;for(let r=0;r<t.length;r++)t[r]?t[h++]=t[r]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Ui;if(!i){e.value(t);return}try{e.value(t)}catch(o){i(o)}}_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 zi)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}},Lc=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}},En={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}},ri=2,si,ut=class It{constructor(t,i,o){this._document=t,this._config=i,this._unicodeService=o,this._didWarmUp=!1,this._cacheMap=new Sn,this._cacheMapCombined=new Sn,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ht,this._textureSize=512,this._onAddTextureAtlasCanvas=new he,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new he,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=So(t,this._config.deviceCellWidth*4+ri*2,this._config.deviceCellHeight+ri*2),this._tmpCtx=me(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 pc;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let o=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,o)}})}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(It.maxAtlasPages&&this._pages.length>=Math.max(4,It.maxAtlasPages)){let i=this._pages.filter(n=>n.canvas.width*2<=(It.maxTextureSize||4096)).sort((n,_)=>_.canvas.width!==n.canvas.width?_.canvas.width-n.canvas.width:_.percentageUsed-n.percentageUsed),o=-1,h=0;for(let n=0;n<i.length;n++)if(i[n].canvas.width!==h)o=n,h=i[n].canvas.width;else if(n-o===3)break;let r=i.slice(o,o+4),s=r.map(n=>n.glyphs[0].texturePage).sort((n,_)=>n>_?1:-1),a=this.pages.length-r.length,f=this._mergePages(r,a);f.version++;for(let n=s.length-1;n>=0;n--)this._deletePage(s[n]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new Nr(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let o=t[0].canvas.width*2,h=new Nr(this._document,o,t);for(let[r,s]of t.entries()){let a=r*s.canvas.width%o,f=Math.floor(r/2)*s.canvas.height;h.ctx.drawImage(s.canvas,a,f);for(let _ of s.glyphs)_.texturePage=i,_.sizeClipSpace.x=_.size.x/o,_.sizeClipSpace.y=_.size.y/o,_.texturePosition.x+=a,_.texturePosition.y+=f,_.texturePositionClipSpace.x=_.texturePosition.x/o,_.texturePositionClipSpace.y=_.texturePosition.y/o;this._onRemoveTextureAtlasCanvas.fire(s.canvas);let n=this._activePages.indexOf(s);n!==-1&&this._activePages.splice(n,1)}return h}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let o=this._pages[i];for(let h of o.glyphs)h.texturePage--;o.version++}}getRasterizedGlyphCombinedChar(t,i,o,h,r,s){return this._getFromCacheMap(this._cacheMapCombined,t,i,o,h,r,s)}getRasterizedGlyph(t,i,o,h,r,s){return this._getFromCacheMap(this._cacheMap,t,i,o,h,r,s)}_getFromCacheMap(t,i,o,h,r,s,a){return si=t.get(i,o,h,r),si||(si=this._drawToCache(i,o,h,r,s,a),t.set(i,o,h,r,si)),si}_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,o,h){if(this._config.allowTransparency)return Ne;let r;switch(t){case 16777216:case 33554432:r=this._getColorFromAnsiIndex(i);break;case 50331648:let s=Ht.toColorRGB(i);r=Me.toColor(s[0],s[1],s[2]);break;default:o?r=Nt.opaque(this._config.colors.foreground):r=this._config.colors.background;break}return this._config.allowTransparency||(r=Nt.opaque(r)),r}_getForegroundColor(t,i,o,h,r,s,a,f,n,_){let v=this._getMinimumContrastColor(t,i,o,h,r,s,a,n,f,_);if(v)return v;let w;switch(r){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&n&&s<8&&(s+=8),w=this._getColorFromAnsiIndex(s);break;case 50331648:let p=Ht.toColorRGB(s);w=Me.toColor(p[0],p[1],p[2]);break;default:a?w=this._config.colors.background:w=this._config.colors.foreground}return this._config.allowTransparency&&(w=Nt.opaque(w)),f&&(w=Nt.multiplyOpacity(w,sc)),w}_resolveBackgroundRgba(t,i,o){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return o?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,o,h){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&h&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return o?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,o,h,r,s,a,f,n,_){if(this._config.minimumContrastRatio===1||_)return;let v=this._getContrastCache(n),w=v.getColor(t,h);if(w!==void 0)return w||void 0;let p=this._resolveBackgroundRgba(i,o,a),c=this._resolveForegroundRgba(r,s,a,f),d=_t.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(n?2:1));if(!d){v.setColor(t,h,null);return}let l=Me.toColor(d>>24&255,d>>16&255,d>>8&255);return v.setColor(t,h,l),l}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,o,h,r,s){let a=typeof t=="number"?String.fromCharCode(t):t;s&&this._tmpCanvas.parentElement!==s&&(this._tmpCanvas.style.display="none",s.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+ri*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let n=Math.min(this._config.deviceCellHeight+ri*4,this._textureSize);if(this._tmpCanvas.height<n&&(this._tmpCanvas.height=n),this._tmpCtx.save(),this._workAttributeData.fg=o,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=h,!!this._workAttributeData.isInvisible())return En;let _=!!this._workAttributeData.isBold(),v=!!this._workAttributeData.isInverse(),w=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),l=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),g=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(v){let R=u;u=C,C=R;let U=g;g=b,b=U}let y=this._getBackgroundColor(b,C,v,w);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,k=p?"italic":"";this._tmpCtx.font=`${k} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=co;let B=a.length===1&&ds(a.charCodeAt(0)),O=a.length===1&&Xl(a.charCodeAt(0)),H=this._getForegroundColor(i,b,C,o,g,u,v,w,_,lo(a.charCodeAt(0)));this._tmpCtx.fillStyle=H.css;let A=O?0:ri*2,W=!1;this._config.customGlyphs!==!1&&(W=lc(this._tmpCtx,a,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let P=!B,M;if(typeof t=="number"?M=this._unicodeService.wcwidth(t):M=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let R=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),U=R%2===1?.5:0;if(this._tmpCtx.lineWidth=R,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())P=!1,this._tmpCtx.strokeStyle=`rgb(${Ht.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{P=!1;let N=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&N<8&&(N+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(N).css}this._tmpCtx.beginPath();let K=A,Y=Math.ceil(A+this._config.deviceCharHeight)-U-(r?R*2:0),z=Y+R,D=Y+R*2,x=this._workAttributeData.getUnderlineVariantOffset();for(let N=0;N<M;N++){this._tmpCtx.save();let F=K+N*this._config.deviceCellWidth,j=K+(N+1)*this._config.deviceCellWidth,q=F+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(F,Y),this._tmpCtx.lineTo(j,Y),this._tmpCtx.moveTo(F,D),this._tmpCtx.lineTo(j,D);break;case 3:let Z=R<=1?D:Math.ceil(A+this._config.deviceCharHeight-R/2)-U,G=R<=1?Y:Math.ceil(A+this._config.deviceCharHeight+R/2)-U,X=new Path2D;X.rect(F,Y,this._config.deviceCellWidth,D-Y),this._tmpCtx.clip(X),this._tmpCtx.moveTo(F-this._config.deviceCellWidth/2,z),this._tmpCtx.bezierCurveTo(F-this._config.deviceCellWidth/2,G,F,G,F,z),this._tmpCtx.bezierCurveTo(F,Z,q,Z,q,z),this._tmpCtx.bezierCurveTo(q,G,j,G,j,z),this._tmpCtx.bezierCurveTo(j,Z,j+this._config.deviceCellWidth/2,Z,j+this._config.deviceCellWidth/2,z);break;case 4:let Q=x===0?0:x>=R?R*2-x:R-x;x>=R||Q===0?(this._tmpCtx.setLineDash([Math.round(R),Math.round(R)]),this._tmpCtx.moveTo(F+Q,Y),this._tmpCtx.lineTo(j,Y)):(this._tmpCtx.setLineDash([Math.round(R),Math.round(R)]),this._tmpCtx.moveTo(F,Y),this._tmpCtx.lineTo(F+Q,Y),this._tmpCtx.moveTo(F+Q+R,Y),this._tmpCtx.lineTo(j,Y)),x=ic(j-F,R,x);break;case 5:let ee=.6,ne=.3,ue=j-F,be=Math.floor(ee*ue),fe=Math.floor(ne*ue),Te=ue-be-fe;this._tmpCtx.setLineDash([be,fe,Te]),this._tmpCtx.moveTo(F,Y),this._tmpCtx.lineTo(j,Y);break;default:this._tmpCtx.moveTo(F,Y),this._tmpCtx.lineTo(j,Y);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!W&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let N=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in N&&N.actualBoundingBoxDescent>0){this._tmpCtx.save();let F=new Path2D;F.rect(K,Y-Math.ceil(R/2),this._config.deviceCellWidth*M,D-Y+Math.ceil(R/2)),this._tmpCtx.clip(F),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(a,A,A+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(l){let R=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),U=R%2===1?.5:0;this._tmpCtx.lineWidth=R,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+U),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*M,A+U),this._tmpCtx.stroke()}if(W||this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let R=Hr(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),y,H,P);if(R)for(let U=1;U<=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(a,A,A+this._config.deviceCharHeight-U),R=Hr(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),y,H,P),!!R);U++);}if(d){let R=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),U=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=R,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+Math.floor(this._config.deviceCharHeight/2)-U),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*M,A+Math.floor(this._config.deviceCharHeight/2)-U),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),T;if(this._config.allowTransparency?T=Mc(I):T=Hr(I,y,H,P),T)return En;let S=this._findGlyphBoundingBox(I,this._workBoundingBox,f,O,W,A),E,L;for(;;){if(this._activePages.length===0){let R=this._createNewPage();E=R,L=R.currentRow,L.height=S.size.y;break}E=this._activePages[this._activePages.length-1],L=E.currentRow;for(let R of this._activePages)S.size.y<=R.currentRow.height&&(E=R,L=R.currentRow);for(let R=this._activePages.length-1;R>=0;R--)for(let U of this._activePages[R].fixedRows)U.height<=L.height&&S.size.y<=U.height&&(E=this._activePages[R],L=U);if(S.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Nr(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+S.size.x>=E.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+S.size.y>=E.canvas.height||L.height>S.size.y+2){let R=!1;if(E.currentRow.y+E.currentRow.height+S.size.y>=E.canvas.height){let U;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+S.size.y<K.canvas.height){U=K;break}if(U)E=U;else if(It.maxAtlasPages&&this._pages.length>=It.maxAtlasPages&&L.y+S.size.y<=E.canvas.height&&L.height>=S.size.y&&L.x+S.size.x<=E.canvas.width)R=!0;else{let K=this._createNewPage();E=K,L=K.currentRow,L.height=S.size.y,R=!0}}R||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),L={x:0,y:E.currentRow.y+E.currentRow.height,height:S.size.y},E.fixedRows.push(L),E.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+S.size.x<=E.canvas.width)break;L===E.currentRow?(L.x=0,L.y+=L.height,L.height=0):E.fixedRows.splice(E.fixedRows.indexOf(L),1)}return S.texturePage=this._pages.indexOf(E),S.texturePosition.x=L.x,S.texturePosition.y=L.y,S.texturePositionClipSpace.x=L.x/E.canvas.width,S.texturePositionClipSpace.y=L.y/E.canvas.height,S.sizeClipSpace.x/=E.canvas.width,S.sizeClipSpace.y/=E.canvas.height,L.height=Math.max(L.height,S.size.y),L.x+=S.size.x,E.ctx.putImageData(I,S.texturePosition.x-this._workBoundingBox.left,S.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,S.size.x,S.size.y),E.addGlyph(S),E.version++,S}_findGlyphBoundingBox(t,i,o,h,r,s){i.top=0;let a=h?this._config.deviceCellHeight:this._tmpCanvas.height,f=h?this._config.deviceCellWidth:o,n=!1;for(let _=0;_<a;_++){for(let v=0;v<f;v++){let w=_*this._tmpCanvas.width*4+v*4+3;if(t.data[w]!==0){i.top=_,n=!0;break}}if(n)break}i.left=0,n=!1;for(let _=0;_<s+f;_++){for(let v=0;v<a;v++){let w=v*this._tmpCanvas.width*4+_*4+3;if(t.data[w]!==0){i.left=_,n=!0;break}}if(n)break}i.right=f,n=!1;for(let _=s+f-1;_>=s;_--){for(let v=0;v<a;v++){let w=v*this._tmpCanvas.width*4+_*4+3;if(t.data[w]!==0){i.right=_,n=!0;break}}if(n)break}i.bottom=a,n=!1;for(let _=a-1;_>=0;_--){for(let v=0;v<f;v++){let w=_*this._tmpCanvas.width*4+v*4+3;if(t.data[w]!==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+s+(h||r?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+s+(h||r?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Nr=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 o of i)this._glyphs.push(...o.glyphs),this._usedPixels+=o._usedPixels;this.canvas=So(e,t,t),this.ctx=me(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 Hr(e,t,i,o){let h=t.rgba>>>24,r=t.rgba>>>16&255,s=t.rgba>>>8&255,a=i.rgba>>>24,f=i.rgba>>>16&255,n=i.rgba>>>8&255,_=Math.floor((Math.abs(h-a)+Math.abs(r-f)+Math.abs(s-n))/12),v=!0;for(let w=0;w<e.data.length;w+=4)e.data[w]===h&&e.data[w+1]===r&&e.data[w+2]===s||o&&Math.abs(e.data[w]-h)+Math.abs(e.data[w+1]-r)+Math.abs(e.data[w+2]-s)<_?e.data[w+3]=0:v=!1;return v}function Mc(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 o=e.createElement("canvas");return o.width=t,o.height=i,o}function Rc(e,t,i,o,h,r,s,a){let f={foreground:r.foreground,background:r.background,cursor:Ne,cursorAccent:Ne,selectionForeground:Ne,selectionBackgroundTransparent:Ne,selectionBackgroundOpaque:Ne,selectionInactiveBackgroundTransparent:Ne,selectionInactiveBackgroundOpaque:Ne,overviewRulerBorder:Ne,scrollbarSliderBackground:Ne,scrollbarSliderHoverBackground:Ne,scrollbarSliderActiveBackground:Ne,ansi:r.ansi.slice(),contrastCache:r.contrastCache,halfContrastCache:r.halfContrastCache};return{customGlyphs:h.customGlyphs,devicePixelRatio:s,deviceMaxTextureSize:a,letterSpacing:h.letterSpacing,lineHeight:h.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:o,fontFamily:h.fontFamily,fontSize:h.fontSize,fontWeight:h.fontWeight,fontWeightBold:h.fontWeightBold,allowTransparency:h.allowTransparency,drawBoldTextInBrightColors:h.drawBoldTextInBrightColors,minimumContrastRatio:h.minimumContrastRatio,colors:f}}function kn(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 Tc(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Fe=[];function Co(e,t,i,o,h,r,s,a,f){let n=Rc(o,h,r,s,t,i,a,f);for(let w=0;w<Fe.length;w++){let p=Fe[w],c=p.ownedBy.indexOf(e);if(c>=0){if(kn(p.config,n))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),Fe.splice(w,1)):p.ownedBy.splice(c,1);break}}for(let w=0;w<Fe.length;w++){let p=Fe[w];if(kn(p.config,n))return p.ownedBy.push(e),p.atlas}let _=e._core,v={atlas:new ut(document,n,_.unicodeService),config:n,ownedBy:[e]};return Fe.push(v),v.atlas}function Ln(e){for(let t=0;t<Fe.length;t++){let i=Fe[t].ownedBy.indexOf(e);if(i!==-1){Fe[t].ownedBy.length===1?(Fe[t].atlas.dispose(),Fe.splice(t,1)):Fe[t].ownedBy.splice(i,1);break}}}var Wi=600,Ac=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=Wi){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Wi-(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=Wi-(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})},Wi)},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 Mn(e,t,i){let o=new t.ResizeObserver(h=>{let r=h.find(f=>f.target===e);if(!r)return;if(!("devicePixelContentBoxSize"in r)){o?.disconnect(),o=void 0;return}let s=r.devicePixelContentBoxSize[0].inlineSize,a=r.devicePixelContentBoxSize[0].blockSize;s>0&&a>0&&i(s,a)});try{o.observe(e,{box:["device-pixel-content-box"]})}catch{o.disconnect(),o=void 0}return ke(()=>o?.disconnect())}function Dc(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Rn=class yo extends Ht{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new po,this.combinedData=""}static fromCharData(t){let i=new yo;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?Dc(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 o=t[1].charCodeAt(0);if(55296<=o&&o<=56319){let h=t[1].charCodeAt(1);56320<=h&&h<=57343?this.content=(o-55296)*1024+h-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()]}},xo=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Eo(e,t,i){let o=me(e.createProgram());if(e.attachShader(o,me(Tn(e,e.VERTEX_SHADER,t))),e.attachShader(o,me(Tn(e,e.FRAGMENT_SHADER,i))),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS))return o;console.error(e.getProgramInfoLog(o)),e.deleteProgram(o)}function Tn(e,t,i){let o=me(e.createShader(t));if(e.shaderSource(o,i),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;console.error(e.getShaderInfoLog(o)),e.deleteShader(o)}function Bc(e,t){let i=Math.min(e.length*2,t),o=new Float32Array(i);for(let h=0;h<e.length;h++)o[h]=e[h];return o}var Pc=class{constructor(e){this.texture=e,this.version=-1}},Oc=`#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 xc(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
81
+ }`;function Ic(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 _t=11,Ot=_t*Float32Array.BYTES_PER_ELEMENT,Ec=2,_e=0,de,Ds=0,ri=0,kc=class extends Pe{constructor(e,t,i,l){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=l,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let h=this._gl;ut.maxAtlasPages===void 0&&(ut.maxAtlasPages=Math.min(32,ge(h.getParameter(h.MAX_TEXTURE_IMAGE_UNITS))),ut.maxTextureSize=ge(h.getParameter(h.MAX_TEXTURE_SIZE))),this._program=ge(mo(h,yc,xc(ut.maxAtlasPages))),this._register(ye(()=>h.deleteProgram(this._program))),this._projectionLocation=ge(h.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=ge(h.getUniformLocation(this._program,"u_resolution")),this._textureLocation=ge(h.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),r=h.createBuffer();this._register(ye(()=>h.deleteBuffer(r))),h.bindBuffer(h.ARRAY_BUFFER,r),h.bufferData(h.ARRAY_BUFFER,s,h.STATIC_DRAW),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let o=new Uint8Array([0,1,2,3]),_=h.createBuffer();this._register(ye(()=>h.deleteBuffer(_))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_),h.bufferData(h.ELEMENT_ARRAY_BUFFER,o,h.STATIC_DRAW),this._attributesBuffer=ge(h.createBuffer()),this._register(ye(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,2,h.FLOAT,!1,Ot,0),h.vertexAttribDivisor(2,1),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,h.FLOAT,!1,Ot,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(3,1),h.enableVertexAttribArray(4),h.vertexAttribPointer(4,1,h.FLOAT,!1,Ot,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(4,1),h.enableVertexAttribArray(5),h.vertexAttribPointer(5,2,h.FLOAT,!1,Ot,5*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(5,1),h.enableVertexAttribArray(6),h.vertexAttribPointer(6,2,h.FLOAT,!1,Ot,7*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(6,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,Ot,9*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.useProgram(this._program);let n=new Int32Array(ut.maxAtlasPages);for(let f=0;f<ut.maxAtlasPages;f++)n[f]=f;h.uniform1iv(this._textureLocation,n),h.uniformMatrix4fv(this._projectionLocation,!1,go),this._atlasTextures=[];for(let f=0;f<ut.maxAtlasPages;f++){let v=new Cc(ge(h.createTexture()));this._register(ye(()=>h.deleteTexture(v.texture))),h.activeTexture(h.TEXTURE0+f),h.bindTexture(h.TEXTURE_2D,v.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]=v}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,i,l,h,s,r,o,_){this._updateCell(this._vertices.attributes,e,t,i,l,h,s,r,o,_)}_updateCell(e,t,i,l,h,s,r,o,_,n){if(_e=(i*this._terminal.cols+t)*_t,l===0||l===void 0){e.fill(0,_e,_e+_t-1-Ec);return}this._atlas&&(o&&o.length>1?de=this._atlas.getRasterizedGlyphCombinedChar(o,h,s,r,!1,this._terminal.element):de=this._atlas.getRasterizedGlyph(l,h,s,r,!1,this._terminal.element),Ds=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),h!==n&&de.offset.x>Ds?(ri=de.offset.x-Ds,e[_e]=-(de.offset.x-ri)+this._dimensions.device.char.left,e[_e+1]=-de.offset.y+this._dimensions.device.char.top,e[_e+2]=(de.size.x-ri)/this._dimensions.device.canvas.width,e[_e+3]=de.size.y/this._dimensions.device.canvas.height,e[_e+4]=de.texturePage,e[_e+5]=de.texturePositionClipSpace.x+ri/this._atlas.pages[de.texturePage].canvas.width,e[_e+6]=de.texturePositionClipSpace.y,e[_e+7]=de.sizeClipSpace.x-ri/this._atlas.pages[de.texturePage].canvas.width,e[_e+8]=de.sizeClipSpace.y):(e[_e]=-de.offset.x+this._dimensions.device.char.left,e[_e+1]=-de.offset.y+this._dimensions.device.char.top,e[_e+2]=de.size.x/this._dimensions.device.canvas.width,e[_e+3]=de.size.y/this._dimensions.device.canvas.height,e[_e+4]=de.texturePage,e[_e+5]=de.texturePositionClipSpace.x,e[_e+6]=de.texturePositionClipSpace.y,e[_e+7]=de.sizeClipSpace.x,e[_e+8]=de.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Ul(l,_,de.size.x,this._dimensions.device.cell.width)&&(e[_e+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*_t;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 l=0;l<e.rows;l++)for(let h=0;h<e.cols;h++)this._vertices.attributes[i+9]=h/e.cols,this._vertices.attributes[i+10]=l/e.rows,i+=_t}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],l=0;for(let h=0;h<e.lineLengths.length;h++){let s=h*this._terminal.cols*_t,r=this._vertices.attributes.subarray(s,s+e.lineLengths[h]*_t);i.set(r,l),l+=r.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,l),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,l/_t)}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}},Lc=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,l=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let h=e.buffers.active.ydisp,s=t[1]-h,r=i[1]-h,o=Math.max(s,0),_=Math.min(r,e.rows-1);if(o>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=l,this.viewportStartRow=s,this.viewportEndRow=r,this.viewportCappedStartRow=o,this.viewportCappedEndRow=_,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 Mc(){return new Lc}var Ki=4,Wi=1,$i=2,Bs=3,Rc=2147483648,Tc=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Mc()}resize(e,t){let i=e*t*Ki;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)}},Ac=`#version 300 es
95
+ }`}var ft=11,Ot=ft*Float32Array.BYTES_PER_ELEMENT,Nc=2,_e=0,de,Fr=0,ni=0,Hc=class extends Oe{constructor(e,t,i,o){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=o,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let h=this._gl;ut.maxAtlasPages===void 0&&(ut.maxAtlasPages=Math.min(32,me(h.getParameter(h.MAX_TEXTURE_IMAGE_UNITS))),ut.maxTextureSize=me(h.getParameter(h.MAX_TEXTURE_SIZE))),this._program=me(Eo(h,Oc,Ic(ut.maxAtlasPages))),this._register(ke(()=>h.deleteProgram(this._program))),this._projectionLocation=me(h.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=me(h.getUniformLocation(this._program,"u_resolution")),this._textureLocation=me(h.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let r=new Float32Array([0,0,1,0,0,1,1,1]),s=h.createBuffer();this._register(ke(()=>h.deleteBuffer(s))),h.bindBuffer(h.ARRAY_BUFFER,s),h.bufferData(h.ARRAY_BUFFER,r,h.STATIC_DRAW),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=h.createBuffer();this._register(ke(()=>h.deleteBuffer(f))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f),h.bufferData(h.ELEMENT_ARRAY_BUFFER,a,h.STATIC_DRAW),this._attributesBuffer=me(h.createBuffer()),this._register(ke(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,2,h.FLOAT,!1,Ot,0),h.vertexAttribDivisor(2,1),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,h.FLOAT,!1,Ot,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(3,1),h.enableVertexAttribArray(4),h.vertexAttribPointer(4,1,h.FLOAT,!1,Ot,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(4,1),h.enableVertexAttribArray(5),h.vertexAttribPointer(5,2,h.FLOAT,!1,Ot,5*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(5,1),h.enableVertexAttribArray(6),h.vertexAttribPointer(6,2,h.FLOAT,!1,Ot,7*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(6,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,Ot,9*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.useProgram(this._program);let n=new Int32Array(ut.maxAtlasPages);for(let _=0;_<ut.maxAtlasPages;_++)n[_]=_;h.uniform1iv(this._textureLocation,n),h.uniformMatrix4fv(this._projectionLocation,!1,xo),this._atlasTextures=[];for(let _=0;_<ut.maxAtlasPages;_++){let v=new Pc(me(h.createTexture()));this._register(ke(()=>h.deleteTexture(v.texture))),h.activeTexture(h.TEXTURE0+_),h.bindTexture(h.TEXTURE_2D,v.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[_]=v}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,i,o,h,r,s,a,f){this._updateCell(this._vertices.attributes,e,t,i,o,h,r,s,a,f)}_updateCell(e,t,i,o,h,r,s,a,f,n){if(_e=(i*this._terminal.cols+t)*ft,o===0||o===void 0){e.fill(0,_e,_e+ft-1-Nc);return}this._atlas&&(a&&a.length>1?de=this._atlas.getRasterizedGlyphCombinedChar(a,h,r,s,!1,this._terminal.element):de=this._atlas.getRasterizedGlyph(o,h,r,s,!1,this._terminal.element),Fr=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),h!==n&&de.offset.x>Fr?(ni=de.offset.x-Fr,e[_e]=-(de.offset.x-ni)+this._dimensions.device.char.left,e[_e+1]=-de.offset.y+this._dimensions.device.char.top,e[_e+2]=(de.size.x-ni)/this._dimensions.device.canvas.width,e[_e+3]=de.size.y/this._dimensions.device.canvas.height,e[_e+4]=de.texturePage,e[_e+5]=de.texturePositionClipSpace.x+ni/this._atlas.pages[de.texturePage].canvas.width,e[_e+6]=de.texturePositionClipSpace.y,e[_e+7]=de.sizeClipSpace.x-ni/this._atlas.pages[de.texturePage].canvas.width,e[_e+8]=de.sizeClipSpace.y):(e[_e]=-de.offset.x+this._dimensions.device.char.left,e[_e+1]=-de.offset.y+this._dimensions.device.char.top,e[_e+2]=de.size.x/this._dimensions.device.canvas.width,e[_e+3]=de.size.y/this._dimensions.device.canvas.height,e[_e+4]=de.texturePage,e[_e+5]=de.texturePositionClipSpace.x,e[_e+6]=de.texturePositionClipSpace.y,e[_e+7]=de.sizeClipSpace.x,e[_e+8]=de.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&ec(o,f,de.size.x,this._dimensions.device.cell.width)&&(e[_e+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*ft;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 o=0;o<e.rows;o++)for(let h=0;h<e.cols;h++)this._vertices.attributes[i+9]=h/e.cols,this._vertices.attributes[i+10]=o/e.rows,i+=ft}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],o=0;for(let h=0;h<e.lineLengths.length;h++){let r=h*this._terminal.cols*ft,s=this._vertices.attributes.subarray(r,r+e.lineLengths[h]*ft);i.set(s,o),o+=s.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,o),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,o/ft)}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}},Fc=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,o=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let h=e.buffers.active.ydisp,r=t[1]-h,s=i[1]-h,a=Math.max(r,0),f=Math.min(s,e.rows-1);if(a>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=o,this.viewportStartRow=r,this.viewportEndRow=s,this.viewportCappedStartRow=a,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 Wc(){return new Fc}var Ji=4,qi=1,Ki=2,Wr=3,$c=2147483648,Uc=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Wc()}resize(e,t){let i=e*t*Ji;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)}},zc=`#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
- }`,Dc=`#version 300 es
109
+ }`,jc=`#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
- }`,nt=8,Ps=nt*Float32Array.BYTES_PER_ELEMENT,Bc=20*nt,xn=class{constructor(){this.attributes=new Float32Array(Bc),this.count=0}},st=0,En=0,kn=0,Ln=0,Mn=0,Rn=0,Tn=0,Pc=class extends Pe{constructor(e,t,i,l){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=l,this._vertices=new xn,this._verticesCursor=new xn;let h=this._gl;this._program=ge(mo(h,Ac,Dc)),this._register(ye(()=>h.deleteProgram(this._program))),this._projectionLocation=ge(h.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),r=h.createBuffer();this._register(ye(()=>h.deleteBuffer(r))),h.bindBuffer(h.ARRAY_BUFFER,r),h.bufferData(h.ARRAY_BUFFER,s,h.STATIC_DRAW),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let o=new Uint8Array([0,1,2,3]),_=h.createBuffer();this._register(ye(()=>h.deleteBuffer(_))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_),h.bufferData(h.ELEMENT_ARRAY_BUFFER,o,h.STATIC_DRAW),this._attributesBuffer=ge(h.createBuffer()),this._register(ye(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,Ps,0),h.vertexAttribDivisor(0,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,Ps,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,Ps,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(2,1),this._updateCachedColors(l.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,go),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,l=1,h,s,r,o,_,n,f,v,w,p,c;for(h=0;h<t.rows;h++){for(r=-1,o=0,_=0,n=!1,s=0;s<t.cols;s++)f=(h*t.cols+s)*Ki,v=e.cells[f+Wi],w=e.cells[f+$i],p=!!(w&67108864),(v!==o||w!==_&&(n||p))&&((o!==0||n&&_!==0)&&(c=l++*nt,this._updateRectangle(i,c,_,o,r,s,h)),r=s,o=v,_=w,n=p);(o!==0||n&&_!==0)&&(c=l++*nt,this._updateRectangle(i,c,_,o,r,t.cols,h))}i.count=l}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let l,h=0;(i.style==="bar"||i.style==="outline")&&(l=h++*nt,this._addRectangleFloat(t.attributes,l,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")&&(l=h++*nt,this._addRectangleFloat(t.attributes,l,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"&&(l=h++*nt,this._addRectangleFloat(t.attributes,l,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),l=h++*nt,this._addRectangleFloat(t.attributes,l,(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=h}_updateRectangle(e,t,i,l,h,s,r){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:st=(i&16777215)<<8;break;default:st=this._themeService.colors.foreground.rgba}else switch(l&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[l&255].rgba;break;case 50331648:st=(l&16777215)<<8;break;default:st=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=Sc(e.attributes,this._terminal.rows*this._terminal.cols*nt)),En=h*this._dimensions.device.cell.width,kn=r*this._dimensions.device.cell.height,Ln=(st>>24&255)/255,Mn=(st>>16&255)/255,Rn=(st>>8&255)/255,Tn=1,this._addRectangle(e.attributes,t,En,kn,(s-h)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Ln,Mn,Rn,Tn)}_addRectangle(e,t,i,l,h,s,r,o,_,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=l/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=r,e[t+5]=o,e[t+6]=_,e[t+7]=n}_addRectangleFloat(e,t,i,l,h,s,r){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=l/this._dimensions.device.canvas.height,e[t+2]=h/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])}},Oc=class extends Pe{constructor(e,t,i,l,h,s,r,o){super(),this._container=t,this._alpha=h,this._coreBrowserService=s,this._optionsService=r,this._themeService=o,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=l.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(_=>{this._refreshCharAtlas(e,_),this.reset(e)})),this._register(ye(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ge(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,l=!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=po(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,l){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,l*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,l*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,l){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=io,this._clipCell(i,l,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,l*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 l=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${l} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Ic=class extends Oc{constructor(e,t,i,l,h,s,r){super(i,e,"link",t,!0,h,s,r),this._register(l.onShowLinkUnderline(o=>this._handleShowLinkUnderline(o))),this._register(l.onHideLinkUnderline(o=>this._handleHideLinkUnderline(o)))}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&&mc(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()}},Ue=typeof window=="object"?window:globalThis,Zs=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new he,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new he,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 l=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(l,t),this._onDidChangeZoomLevel.fire(l)}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 l=this.getWindowId(i);this.mapWindowIdToFullScreen.set(l,t),this._onDidChangeFullscreen.fire(l)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Zs.INSTANCE=new Zs;var bo=Zs;function Nc(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var Yu=bo.INSTANCE.onDidChangeZoomLevel,Xu=bo.INSTANCE.onDidChangeFullscreen,Ut=typeof navigator=="object"?navigator.userAgent:"",Ju=Ut.indexOf("Firefox")>=0,Os=Ut.indexOf("AppleWebKit")>=0,Hc=Ut.indexOf("Chrome")>=0,Fc=!Hc&&Ut.indexOf("Safari")>=0,Zu=Ut.indexOf("Electron/")>=0,Qu=Ut.indexOf("Android")>=0,Ui=!1;if(typeof Ue.matchMedia=="function"){let e=Ue.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ue.matchMedia("(display-mode: fullscreen)");Ui=e.matches,Nc(Ue,e,({matches:i})=>{Ui&&t.matches||(Ui=i)})}function Wc(){return Ui}var Ft="en",Qs=!1,er=!1,zi=!1,$c=!1,wo=!1,So=!1,Uc=!1,zc=!1,jc=!1,qc=!1,Ii,ji=Ft,An=Ft,Kc,rt,at=globalThis,Be;typeof at.vscode<"u"&&typeof at.vscode.process<"u"?Be=at.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Be=process);var Co=typeof Be?.versions?.electron=="string",Gc=Co&&Be?.type==="renderer";if(typeof Be=="object"){Qs=Be.platform==="win32",er=Be.platform==="darwin",zi=Be.platform==="linux",$c=zi&&!!Be.env.SNAP&&!!Be.env.SNAP_REVISION,Uc=Co,jc=!!Be.env.CI||!!Be.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ii=Ft,ji=Ft;let e=Be.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ii=t.userLocale,An=t.osLocale,ji=t.resolvedLanguage||Ft,Kc=t.languagePack?.translationsConfigFile}catch{}wo=!0}else typeof navigator=="object"&&!Gc?(rt=navigator.userAgent,Qs=rt.indexOf("Windows")>=0,er=rt.indexOf("Macintosh")>=0,zc=(rt.indexOf("Macintosh")>=0||rt.indexOf("iPad")>=0||rt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,zi=rt.indexOf("Linux")>=0,qc=rt?.indexOf("Mobi")>=0,So=!0,ji=globalThis._VSCODE_NLS_LANGUAGE||Ft,Ii=navigator.language.toLowerCase(),An=Ii):console.error("Unable to resolve platform.");var Is=0;er?Is=1:Qs?Is=3:zi&&(Is=2);var Ns=wo,Vc=So&&typeof at.importScripts=="function",e_=Vc?at.origin:void 0,Ve=rt,ht=ji,Dn;(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 l(){return ht==="en"}e.isDefault=l})(Dn||(Dn={}));var Yc=typeof at.postMessage=="function"&&!at.importScripts,Xc=(()=>{if(Yc){let e=[];at.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let l=0,h=e.length;l<h;l++){let s=e[l];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(l,1),s.callback();return}}});let t=0;return i=>{let l=++t;e.push({id:l,callback:i}),at.postMessage({vscodeScheduleAsyncWork:l},"*")}}return e=>setTimeout(e)})(),Jc=!!(Ve&&Ve.indexOf("Chrome")>=0),t_=!!(Ve&&Ve.indexOf("Firefox")>=0),i_=!!(!Jc&&Ve&&Ve.indexOf("Safari")>=0),s_=!!(Ve&&Ve.indexOf("Edg/")>=0),r_=!!(Ve&&Ve.indexOf("Android")>=0),dt=typeof navigator=="object"?navigator:{},n_={clipboard:{writeText:Ns||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(dt&&dt.clipboard&&dt.clipboard.writeText),readText:Ns||!!(dt&&dt.clipboard&&dt.clipboard.readText)},keyboard:Ns||Wc()?0:dt.keyboard||Fc?1:2,touch:"ontouchstart"in Ue||dt.maxTouchPoints>0,pointerEvents:Ue.PointerEvent&&("ontouchstart"in Ue||navigator.maxTouchPoints>0)},nr=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Hs=new nr,Bn=new nr,Pn=new nr,o_=new Array(230),On;(e=>{function t(o){return Hs.keyCodeToStr(o)}e.toString=t;function i(o){return Hs.strToKeyCode(o)}e.fromString=i;function l(o){return Bn.keyCodeToStr(o)}e.toUserSettingsUS=l;function h(o){return Pn.keyCodeToStr(o)}e.toUserSettingsGeneral=h;function s(o){return Bn.strToKeyCode(o)||Pn.strToKeyCode(o)}e.fromUserSettings=s;function r(o){if(o>=98&&o<=113)return null;switch(o){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Hs.keyCodeToStr(o)}e.toElectronAccelerator=r})(On||(On={}));var yo=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),In;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Zc?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ge.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:yo})})(In||(In={}));var Zc=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?yo:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Qc,Fs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Fs=(e,t)=>{Xc(()=>{if(i)return;let l=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,l-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Fs=(e,t,i)=>{let l=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(l))}}},Qc=e=>Fs(globalThis,e)})();var Nn;(e=>{async function t(l){let h,s=await Promise.all(l.map(r=>r.then(o=>o,o=>{h||(h=o)})));if(typeof h<"u")throw h;return s}e.settled=t;function i(l){return new Promise(async(h,s)=>{try{await l(h,s)}catch(r){s(r)}})}e.withAsyncBody=i})(Nn||(Nn={}));var Hn=class He{static fromArray(t){return new He(i=>{i.emitMany(t)})}static fromPromise(t){return new He(async i=>{i.emitMany(await t)})}static fromPromises(t){return new He(async i=>{await Promise.all(t.map(async l=>i.emitOne(await l)))})}static merge(t){return new He(async i=>{await Promise.all(t.map(async l=>{for await(let h of l)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new he,queueMicrotask(async()=>{let l={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(l)),this.resolve()}catch(h){this.reject(h)}finally{l.emitOne=void 0,l.emitMany=void 0,l.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 Ge.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new He(async l=>{for await(let h of t)l.emitOne(i(h))})}map(t){return He.map(this,t)}static filter(t,i){return new He(async l=>{for await(let h of t)i(h)&&l.emitOne(h)})}filter(t){return He.filter(this,t)}static coalesce(t){return He.filter(t,i=>!!i)}coalesce(){return He.coalesce(this)}static async toPromise(t){let i=[];for await(let l of t)i.push(l);return i}toPromise(){return He.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())}};Hn.EMPTY=Hn.fromArray([]);function eh(e){return 55296<=e&&e<=56319}function Fn(e){return 56320<=e&&e<=57343}function th(e,t){return(e-55296<<10)+(t-56320)+65536}function ih(e){return or(e,0)}function or(e,t){switch(typeof e){case"object":return e===null?ot(349,t):Array.isArray(e)?rh(e,t):nh(e,t);case"string":return xo(e,t);case"boolean":return sh(e,t);case"number":return ot(e,t);case"undefined":return ot(937,t);default:return ot(617,t)}}function ot(e,t){return(t<<5)-t+e|0}function sh(e,t){return ot(e?433:863,t)}function xo(e,t){t=ot(149417,t);for(let i=0,l=e.length;i<l;i++)t=ot(e.charCodeAt(i),t);return t}function rh(e,t){return t=ot(104579,t),e.reduce((i,l)=>or(l,i),t)}function nh(e,t){return t=ot(181387,t),Object.keys(e).sort().reduce((i,l)=>(i=xo(l,i),or(e[l],i)),t)}function Ws(e,t,i=32){let l=i-t,h=~((1<<l)-1);return(e<<t|(h&e)>>>l)>>>0}function Wn(e,t=0,i=e.byteLength,l=0){for(let h=0;h<i;h++)e[t+h]=l}function oh(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function ni(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):oh((e>>>0).toString(16),t/4)}var ah=class Eo{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 l=this._buff,h=this._buffLen,s=this._leftoverHighSurrogate,r,o;for(s!==0?(r=s,o=-1,s=0):(r=t.charCodeAt(0),o=0);;){let _=r;if(eh(r))if(o+1<i){let n=t.charCodeAt(o+1);Fn(n)?(o++,_=th(r,n)):_=65533}else{s=r;break}else Fn(r)&&(_=65533);if(h=this._push(l,h,_),o++,o<i)r=t.charCodeAt(o);else break}this._buffLen=h,this._leftoverHighSurrogate=s}_push(t,i,l){return l<128?t[i++]=l:l<2048?(t[i++]=192|(l&1984)>>>6,t[i++]=128|(l&63)>>>0):l<65536?(t[i++]=224|(l&61440)>>>12,t[i++]=128|(l&4032)>>>6,t[i++]=128|(l&63)>>>0):(t[i++]=240|(l&1835008)>>>18,t[i++]=128|(l&258048)>>>12,t[i++]=128|(l&4032)>>>6,t[i++]=128|(l&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()),ni(this._h0)+ni(this._h1)+ni(this._h2)+ni(this._h3)+ni(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Wn(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Wn(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=Eo._bigBlock32,i=this._buffDV;for(let v=0;v<64;v+=4)t.setUint32(v,i.getUint32(v,!1),!1);for(let v=64;v<320;v+=4)t.setUint32(v,Ws(t.getUint32(v-12,!1)^t.getUint32(v-32,!1)^t.getUint32(v-56,!1)^t.getUint32(v-64,!1),1),!1);let l=this._h0,h=this._h1,s=this._h2,r=this._h3,o=this._h4,_,n,f;for(let v=0;v<80;v++)v<20?(_=h&s|~h&r,n=1518500249):v<40?(_=h^s^r,n=1859775393):v<60?(_=h&s|h&r|s&r,n=2400959708):(_=h^s^r,n=3395469782),f=Ws(l,5)+_+o+n+t.getUint32(v*4,!1)&4294967295,o=r,r=s,s=Ws(h,30),h=l,l=f;this._h0=this._h0+l&4294967295,this._h1=this._h1+h&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+o&4294967295}};ah._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:a_,getWindow:lh,getDocument:l_,getWindows:c_,getWindowsCount:h_,getWindowId:$n,getWindowById:d_,hasWindow:u_,onDidRegisterWindow:__,onWillUnregisterWindow:f_,onDidUnregisterWindow:p_}=(function(){let e=new Map,t={window:Ue,disposables:new Wt};e.set(Ue.vscodeWindowId,t);let i=new he,l=new he,h=new he;function s(r,o){return(typeof r=="number"?e.get(r):void 0)??(o?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:h.event,onDidUnregisterWindow:l.event,registerWindow(r){if(e.has(r.vscodeWindowId))return Pe.None;let o=new Wt,_={window:r,disposables:o.add(new Wt)};return e.set(r.vscodeWindowId,_),o.add(ye(()=>{e.delete(r.vscodeWindowId),l.fire(r)})),o.add(tr(r,dh.BEFORE_UNLOAD,()=>{h.fire(r)})),i.fire(_),o},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return e.has(r)},getWindowById:s,getWindow(r){let o=r;if(o?.ownerDocument?.defaultView)return o.ownerDocument.defaultView.window;let _=r;return _?.view?_.view.window:Ue},getDocument(r){return lh(r).document}}})(),ch=class{constructor(e,t,i,l){this._node=e,this._type=t,this._handler=i,this._options=l||!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 tr(e,t,i,l){return new ch(e,t,i,l)}var hh,Un,$s=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){Ni(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,l=new Map,h=s=>{i.set(s,!1);let r=e.get(s)??[];for(t.set(s,r),e.set(s,[]),l.set(s,!0);r.length>0;)r.sort($s.sort),r.shift().execute();l.set(s,!1)};Un=(s,r,o=0)=>{let _=$n(s),n=new $s(r,o),f=e.get(_);return f||(f=[],e.set(_,f)),f.push(n),i.get(_)||(i.set(_,!0),s.requestAnimationFrame(()=>h(_))),n},hh=(s,r,o)=>{let _=$n(s);if(l.get(_)){let n=new $s(r,o),f=t.get(_);return f||(f=[],t.set(_,f)),f.push(n),n}else return Un(s,r,o)}})();var zn=class qi{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new qi(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof qi?t:new qi(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};zn.None=new zn(0,0);var v_=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let l=this.mutationObservers.get(e);l||(l=new Map,this.mutationObservers.set(e,l));let h=ih(i),s=l.get(h);if(s)s.users+=1;else{let r=new he,o=new MutationObserver(n=>r.fire(n));o.observe(e,i);let _=s={users:1,observer:o,onDidMutate:r.event};t.add(ye(()=>{_.users-=1,_.users===0&&(r.dispose(),o.disconnect(),l?.delete(h),l?.size===0&&this.mutationObservers.delete(e))})),l.set(h,s)}return s.onDidMutate}},dh={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Os?"webkitAnimationStart":"animationstart",ANIMATION_END:Os?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Os?"webkitAnimationIteration":"animationiteration"},uh=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function ko(e,t,i,...l){let h=uh.exec(t);if(!h)throw new Error("Bad use of emmet");let s=h[1]||"div",r;return e!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(e,s):r=document.createElement(s),h[3]&&(r.id=h[3]),h[4]&&(r.className=h[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([o,_])=>{typeof _>"u"||(/^on\w+$/.test(o)?r[o]=_:o==="selected"?_&&r.setAttribute(o,"true"):r.setAttribute(o,_))}),r.append(...l),r}function _h(e,t,...i){return ko("http://www.w3.org/1999/xhtml",e,t,...i)}_h.SVG=function(e,t,...i){return ko("http://www.w3.org/2000/svg",e,t,...i)};var fh=class extends Pe{constructor(e,t,i,l,h,s,r,o,_){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=l,this._coreService=h,this._decorationService=s,this._optionsService=r,this._themeService=o,this._cursorBlinkStateManager=new ti,this._charAtlasDisposable=this._register(new ti),this._observerDisposable=this._register(new ti),this._model=new Tc,this._workCell=new Cn,this._workCell2=new Cn,this._rectangleRenderer=this._register(new ti),this._glyphRenderer=this._register(new ti),this._onChangeTextureAtlas=this._register(new he),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new he),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new he),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new he),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new he),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 ql(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Ic(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,r,this._themeService)],this.dimensions=zl(),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(tr(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(tr(this._canvas,"webglcontextrestored",f=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,wn(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Sn(this._canvas,this._coreBrowserService.window,(f,v)=>this._setCanvasDevicePixelDimensions(f,v)),this._register(this._coreBrowserService.onWindowChange(f=>{this._observerDisposable.value=Sn(this._canvas,f,(v,w)=>this._setCanvasDevicePixelDimensions(v,w))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ye(()=>{for(let f of this._renderLayers)f.dispose();this._canvas.parentElement?.removeChild(this._canvas),wn(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 l of this._renderLayers)l.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 Pc(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new kc(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=po(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=Jn(Ge.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ge.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 bc(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,l=this._workCell,h,s,r,o,_,n,f=0,v=!0,w,p,c,d,a,u,g,C,b;e=jn(e,i.rows-1,0),t=jn(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,k=m-i.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),P=-1,H=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let A=!1;for(s=e;s<=t;s++)for(r=s+i.buffer.ydisp,o=i.buffer.lines.get(r),this._model.lineLengths[s]=0,c=m===r,f=0,_=this._characterJoinerService.getJoinedCharacters(r),C=0;C<i.cols;C++){if(h=this._cellColorResolver.result.bg,o.loadCell(C,l),C===0&&(h=this._cellColorResolver.result.bg),n=!1,v=C>=f,w=C,_.length>0&&C===_[0][0]&&v){p=_.shift();let F=this._model.selection.isCellSelected(this._terminal,p[0],r);for(g=p[0]+1;g<p[1];g++)v&&(v=F===this._model.selection.isCellSelected(this._terminal,g,r));v&&(v=!c||B<p[0]||B>=p[1]),v?(n=!0,l=new ph(l,o.translateToString(!0,p[0],p[1]),p[1]-p[0]),w=p[1]-1):f=p[1]}if(d=l.getChars(),a=l.getCode(),g=(s*i.cols+C)*Ki,this._cellColorResolver.resolve(l,C,r,this.dimensions.device.cell.width),H&&r===m&&(C===B&&(this._model.cursor={x:B,y:k,width:l.getWidth(),style:this._coreBrowserService.isFocused?y:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},P=B+l.getWidth()-1),C>=B&&C<=P&&(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)),a!==0&&(this._model.lineLengths[s]=C+1),!(this._model.cells[g]===a&&this._model.cells[g+Wi]===this._cellColorResolver.result.bg&&this._model.cells[g+$i]===this._cellColorResolver.result.fg&&this._model.cells[g+Bs]===this._cellColorResolver.result.ext)&&(A=!0,d.length>1&&(a|=Rc),this._model.cells[g]=a,this._model.cells[g+Wi]=this._cellColorResolver.result.bg,this._model.cells[g+$i]=this._cellColorResolver.result.fg,this._model.cells[g+Bs]=this._cellColorResolver.result.ext,u=l.getWidth(),this._glyphRenderer.value.updateCell(C,s,a,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,h),n)){for(l=this._workCell,C++;C<=w;C++)b=(s*i.cols+C)*Ki,this._glyphRenderer.value.updateCell(C,s,0,0,0,0,Nl,0,0),this._model.cells[b]=0,this._model.cells[b+Wi]=this._cellColorResolver.result.bg,this._model.cells[b+$i]=this._cellColorResolver.result.fg,this._model.cells[b+Bs]=this._cellColorResolver.result.ext;C--}}A&&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})}},ph=class extends Ht{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 jn(e,t,i=0){return Math.max(Math.min(e,t),i)}var qn="di$target",Kn="di$dependencies",Us=new Map;function Ye(e){if(Us.has(e))return Us.get(e);let t=function(i,l,h){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");vh(t,i,h)};return t._id=e,Us.set(e,t),t}function vh(e,t,i){t[qn]===t?t[Kn].push({id:e,index:i}):(t[Kn]=[{id:e,index:i}],t[qn]=t)}var g_=Ye("BufferService"),m_=Ye("CoreMouseService"),b_=Ye("CoreService"),w_=Ye("CharsetService"),S_=Ye("InstantiationService"),C_=Ye("LogService"),gh=Ye("OptionsService"),y_=Ye("OscLinkService"),x_=Ye("UnicodeService"),E_=Ye("DecorationService"),mh={trace:0,debug:1,info:2,warn:3,error:4,off:5},bh="xterm.js: ",Gn=class extends Pe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Lo=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=mh[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?"":bh)+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)}};Gn=gl([ml(0,gh)],Gn);var Lo;function wh(e){Lo=e}var Mo=class extends Pe{constructor(e){if(eo&&Il()<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 he),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new he),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new he),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new he),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,l=t.optionsService,h=t,s=h._renderService,r=h._characterJoinerService,o=h._charSizeService,_=h._coreBrowserService,n=h._decorationService,f=h._logService,v=h._themeService;wh(f),this._renderer=this._register(new fh(e,r,o,_,i,n,l,v,this._preserveDrawingBuffer)),this._register(Ge.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ge.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ge.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ge.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(ye(()=>{if(this._terminal._core._store._isDisposed)return;let w=this._terminal._core._renderService;w.setRenderer(this._terminal._core._createRenderer()),w.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Ro=`/**
118
+ }`,nt=8,$r=nt*Float32Array.BYTES_PER_ELEMENT,qc=20*nt,An=class{constructor(){this.attributes=new Float32Array(qc),this.count=0}},rt=0,Dn=0,Bn=0,Pn=0,On=0,In=0,Nn=0,Kc=class extends Oe{constructor(e,t,i,o){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=o,this._vertices=new An,this._verticesCursor=new An;let h=this._gl;this._program=me(Eo(h,zc,jc)),this._register(ke(()=>h.deleteProgram(this._program))),this._projectionLocation=me(h.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let r=new Float32Array([0,0,1,0,0,1,1,1]),s=h.createBuffer();this._register(ke(()=>h.deleteBuffer(s))),h.bindBuffer(h.ARRAY_BUFFER,s),h.bufferData(h.ARRAY_BUFFER,r,h.STATIC_DRAW),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=h.createBuffer();this._register(ke(()=>h.deleteBuffer(f))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f),h.bufferData(h.ELEMENT_ARRAY_BUFFER,a,h.STATIC_DRAW),this._attributesBuffer=me(h.createBuffer()),this._register(ke(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,$r,0),h.vertexAttribDivisor(0,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,$r,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,$r,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(2,1),this._updateCachedColors(o.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,xo),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,o=1,h,r,s,a,f,n,_,v,w,p,c;for(h=0;h<t.rows;h++){for(s=-1,a=0,f=0,n=!1,r=0;r<t.cols;r++)_=(h*t.cols+r)*Ji,v=e.cells[_+qi],w=e.cells[_+Ki],p=!!(w&67108864),(v!==a||w!==f&&(n||p))&&((a!==0||n&&f!==0)&&(c=o++*nt,this._updateRectangle(i,c,f,a,s,r,h)),s=r,a=v,f=w,n=p);(a!==0||n&&f!==0)&&(c=o++*nt,this._updateRectangle(i,c,f,a,s,t.cols,h))}i.count=o}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let o,h=0;(i.style==="bar"||i.style==="outline")&&(o=h++*nt,this._addRectangleFloat(t.attributes,o,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")&&(o=h++*nt,this._addRectangleFloat(t.attributes,o,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"&&(o=h++*nt,this._addRectangleFloat(t.attributes,o,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),o=h++*nt,this._addRectangleFloat(t.attributes,o,(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=h}_updateRectangle(e,t,i,o,h,r,s){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:rt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:rt=(i&16777215)<<8;break;default:rt=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:rt=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:rt=(o&16777215)<<8;break;default:rt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=Bc(e.attributes,this._terminal.rows*this._terminal.cols*nt)),Dn=h*this._dimensions.device.cell.width,Bn=s*this._dimensions.device.cell.height,Pn=(rt>>24&255)/255,On=(rt>>16&255)/255,In=(rt>>8&255)/255,Nn=1,this._addRectangle(e.attributes,t,Dn,Bn,(r-h)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Pn,On,In,Nn)}_addRectangle(e,t,i,o,h,r,s,a,f,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=o/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=r/this._dimensions.device.canvas.height,e[t+4]=s,e[t+5]=a,e[t+6]=f,e[t+7]=n}_addRectangleFloat(e,t,i,o,h,r,s){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=o/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=r/this._dimensions.device.canvas.height,e[t+4]=s[0],e[t+5]=s[1],e[t+6]=s[2],e[t+7]=s[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Gc=class extends Oe{constructor(e,t,i,o,h,r,s,a){super(),this._container=t,this._alpha=h,this._coreBrowserService=r,this._optionsService=s,this._themeService=a,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=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(e,f),this.reset(e)})),this._register(ke(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=me(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,o=!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=Co(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,o){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,o){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=co,this._clipCell(i,o,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,o*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 o=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${o} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Vc=class extends Gc{constructor(e,t,i,o,h,r,s){super(i,e,"link",t,!0,h,r,s),this._register(o.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(o.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}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&&Tc(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()}},Ue=typeof window=="object"?window:globalThis,ns=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new he,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new he,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 o=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(o,t),this._onDidChangeZoomLevel.fire(o)}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 o=this.getWindowId(i);this.mapWindowIdToFullScreen.set(o,t),this._onDidChangeFullscreen.fire(o)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};ns.INSTANCE=new ns;var ko=ns;function Yc(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var df=ko.INSTANCE.onDidChangeZoomLevel,uf=ko.INSTANCE.onDidChangeFullscreen,Ut=typeof navigator=="object"?navigator.userAgent:"",ff=Ut.indexOf("Firefox")>=0,Ur=Ut.indexOf("AppleWebKit")>=0,Xc=Ut.indexOf("Chrome")>=0,Jc=!Xc&&Ut.indexOf("Safari")>=0,_f=Ut.indexOf("Electron/")>=0,pf=Ut.indexOf("Android")>=0,Gi=!1;if(typeof Ue.matchMedia=="function"){let e=Ue.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ue.matchMedia("(display-mode: fullscreen)");Gi=e.matches,Yc(Ue,e,({matches:i})=>{Gi&&t.matches||(Gi=i)})}function Zc(){return Gi}var Ft="en",os=!1,as=!1,Vi=!1,Qc=!1,Lo=!1,Mo=!1,eh=!1,th=!1,ih=!1,rh=!1,$i,Yi=Ft,Hn=Ft,sh,st,at=globalThis,Pe;typeof at.vscode<"u"&&typeof at.vscode.process<"u"?Pe=at.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Pe=process);var Ro=typeof Pe?.versions?.electron=="string",nh=Ro&&Pe?.type==="renderer";if(typeof Pe=="object"){os=Pe.platform==="win32",as=Pe.platform==="darwin",Vi=Pe.platform==="linux",Qc=Vi&&!!Pe.env.SNAP&&!!Pe.env.SNAP_REVISION,eh=Ro,ih=!!Pe.env.CI||!!Pe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,$i=Ft,Yi=Ft;let e=Pe.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);$i=t.userLocale,Hn=t.osLocale,Yi=t.resolvedLanguage||Ft,sh=t.languagePack?.translationsConfigFile}catch{}Lo=!0}else typeof navigator=="object"&&!nh?(st=navigator.userAgent,os=st.indexOf("Windows")>=0,as=st.indexOf("Macintosh")>=0,th=(st.indexOf("Macintosh")>=0||st.indexOf("iPad")>=0||st.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Vi=st.indexOf("Linux")>=0,rh=st?.indexOf("Mobi")>=0,Mo=!0,Yi=globalThis._VSCODE_NLS_LANGUAGE||Ft,$i=navigator.language.toLowerCase(),Hn=$i):console.error("Unable to resolve platform.");var zr=0;as?zr=1:os?zr=3:Vi&&(zr=2);var jr=Lo,oh=Mo&&typeof at.importScripts=="function",vf=oh?at.origin:void 0,Ve=st,ht=Yi,Fn;(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 o(){return ht==="en"}e.isDefault=o})(Fn||(Fn={}));var ah=typeof at.postMessage=="function"&&!at.importScripts,lh=(()=>{if(ah){let e=[];at.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let o=0,h=e.length;o<h;o++){let r=e[o];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(o,1),r.callback();return}}});let t=0;return i=>{let o=++t;e.push({id:o,callback:i}),at.postMessage({vscodeScheduleAsyncWork:o},"*")}}return e=>setTimeout(e)})(),ch=!!(Ve&&Ve.indexOf("Chrome")>=0),gf=!!(Ve&&Ve.indexOf("Firefox")>=0),mf=!!(!ch&&Ve&&Ve.indexOf("Safari")>=0),bf=!!(Ve&&Ve.indexOf("Edg/")>=0),wf=!!(Ve&&Ve.indexOf("Android")>=0),dt=typeof navigator=="object"?navigator:{},Sf={clipboard:{writeText:jr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(dt&&dt.clipboard&&dt.clipboard.writeText),readText:jr||!!(dt&&dt.clipboard&&dt.clipboard.readText)},keyboard:jr||Zc()?0:dt.keyboard||Jc?1:2,touch:"ontouchstart"in Ue||dt.maxTouchPoints>0,pointerEvents:Ue.PointerEvent&&("ontouchstart"in Ue||navigator.maxTouchPoints>0)},us=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}},qr=new us,Wn=new us,$n=new us,Cf=new Array(230),Un;(e=>{function t(a){return qr.keyCodeToStr(a)}e.toString=t;function i(a){return qr.strToKeyCode(a)}e.fromString=i;function o(a){return Wn.keyCodeToStr(a)}e.toUserSettingsUS=o;function h(a){return $n.keyCodeToStr(a)}e.toUserSettingsGeneral=h;function r(a){return Wn.strToKeyCode(a)||$n.strToKeyCode(a)}e.fromUserSettings=r;function s(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return qr.keyCodeToStr(a)}e.toElectronAccelerator=s})(Un||(Un={}));var To=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),zn;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof hh?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ge.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:To})})(zn||(zn={}));var hh=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?To:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var dh,Kr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Kr=(e,t)=>{lh(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Kr=(e,t,i)=>{let o=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(o))}}},dh=e=>Kr(globalThis,e)})();var jn;(e=>{async function t(o){let h,r=await Promise.all(o.map(s=>s.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return r}e.settled=t;function i(o){return new Promise(async(h,r)=>{try{await o(h,r)}catch(s){r(s)}})}e.withAsyncBody=i})(jn||(jn={}));var qn=class He{static fromArray(t){return new He(i=>{i.emitMany(t)})}static fromPromise(t){return new He(async i=>{i.emitMany(await t)})}static fromPromises(t){return new He(async i=>{await Promise.all(t.map(async o=>i.emitOne(await o)))})}static merge(t){return new He(async i=>{await Promise.all(t.map(async o=>{for await(let h of o)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new he,queueMicrotask(async()=>{let o={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(o)),this.resolve()}catch(h){this.reject(h)}finally{o.emitOne=void 0,o.emitMany=void 0,o.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 Ge.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new He(async o=>{for await(let h of t)o.emitOne(i(h))})}map(t){return He.map(this,t)}static filter(t,i){return new He(async o=>{for await(let h of t)i(h)&&o.emitOne(h)})}filter(t){return He.filter(this,t)}static coalesce(t){return He.filter(t,i=>!!i)}coalesce(){return He.coalesce(this)}static async toPromise(t){let i=[];for await(let o of t)i.push(o);return i}toPromise(){return He.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())}};qn.EMPTY=qn.fromArray([]);function uh(e){return 55296<=e&&e<=56319}function Kn(e){return 56320<=e&&e<=57343}function fh(e,t){return(e-55296<<10)+(t-56320)+65536}function _h(e){return fs(e,0)}function fs(e,t){switch(typeof e){case"object":return e===null?ot(349,t):Array.isArray(e)?vh(e,t):gh(e,t);case"string":return Ao(e,t);case"boolean":return ph(e,t);case"number":return ot(e,t);case"undefined":return ot(937,t);default:return ot(617,t)}}function ot(e,t){return(t<<5)-t+e|0}function ph(e,t){return ot(e?433:863,t)}function Ao(e,t){t=ot(149417,t);for(let i=0,o=e.length;i<o;i++)t=ot(e.charCodeAt(i),t);return t}function vh(e,t){return t=ot(104579,t),e.reduce((i,o)=>fs(o,i),t)}function gh(e,t){return t=ot(181387,t),Object.keys(e).sort().reduce((i,o)=>(i=Ao(o,i),fs(e[o],i)),t)}function Gr(e,t,i=32){let o=i-t,h=~((1<<o)-1);return(e<<t|(h&e)>>>o)>>>0}function Gn(e,t=0,i=e.byteLength,o=0){for(let h=0;h<i;h++)e[t+h]=o}function mh(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function oi(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):mh((e>>>0).toString(16),t/4)}var bh=class Do{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 o=this._buff,h=this._buffLen,r=this._leftoverHighSurrogate,s,a;for(r!==0?(s=r,a=-1,r=0):(s=t.charCodeAt(0),a=0);;){let f=s;if(uh(s))if(a+1<i){let n=t.charCodeAt(a+1);Kn(n)?(a++,f=fh(s,n)):f=65533}else{r=s;break}else Kn(s)&&(f=65533);if(h=this._push(o,h,f),a++,a<i)s=t.charCodeAt(a);else break}this._buffLen=h,this._leftoverHighSurrogate=r}_push(t,i,o){return o<128?t[i++]=o:o<2048?(t[i++]=192|(o&1984)>>>6,t[i++]=128|(o&63)>>>0):o<65536?(t[i++]=224|(o&61440)>>>12,t[i++]=128|(o&4032)>>>6,t[i++]=128|(o&63)>>>0):(t[i++]=240|(o&1835008)>>>18,t[i++]=128|(o&258048)>>>12,t[i++]=128|(o&4032)>>>6,t[i++]=128|(o&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()),oi(this._h0)+oi(this._h1)+oi(this._h2)+oi(this._h3)+oi(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Gn(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Gn(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=Do._bigBlock32,i=this._buffDV;for(let v=0;v<64;v+=4)t.setUint32(v,i.getUint32(v,!1),!1);for(let v=64;v<320;v+=4)t.setUint32(v,Gr(t.getUint32(v-12,!1)^t.getUint32(v-32,!1)^t.getUint32(v-56,!1)^t.getUint32(v-64,!1),1),!1);let o=this._h0,h=this._h1,r=this._h2,s=this._h3,a=this._h4,f,n,_;for(let v=0;v<80;v++)v<20?(f=h&r|~h&s,n=1518500249):v<40?(f=h^r^s,n=1859775393):v<60?(f=h&r|h&s|r&s,n=2400959708):(f=h^r^s,n=3395469782),_=Gr(o,5)+f+a+n+t.getUint32(v*4,!1)&4294967295,a=s,s=r,r=Gr(h,30),h=o,o=_;this._h0=this._h0+o&4294967295,this._h1=this._h1+h&4294967295,this._h2=this._h2+r&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};bh._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:yf,getWindow:wh,getDocument:xf,getWindows:Ef,getWindowsCount:kf,getWindowId:Vn,getWindowById:Lf,hasWindow:Mf,onDidRegisterWindow:Rf,onWillUnregisterWindow:Tf,onDidUnregisterWindow:Af}=(function(){let e=new Map,t={window:Ue,disposables:new Wt};e.set(Ue.vscodeWindowId,t);let i=new he,o=new he,h=new he;function r(s,a){return(typeof s=="number"?e.get(s):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:h.event,onDidUnregisterWindow:o.event,registerWindow(s){if(e.has(s.vscodeWindowId))return Oe.None;let a=new Wt,f={window:s,disposables:a.add(new Wt)};return e.set(s.vscodeWindowId,f),a.add(ke(()=>{e.delete(s.vscodeWindowId),o.fire(s)})),a.add(ls(s,yh.BEFORE_UNLOAD,()=>{h.fire(s)})),i.fire(f),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(s){return s.vscodeWindowId},hasWindow(s){return e.has(s)},getWindowById:r,getWindow(s){let a=s;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let f=s;return f?.view?f.view.window:Ue},getDocument(s){return wh(s).document}}})(),Sh=class{constructor(e,t,i,o){this._node=e,this._type=t,this._handler=i,this._options=o||!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 ls(e,t,i,o){return new Sh(e,t,i,o)}var Ch,Yn,Vr=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){Ui(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,o=new Map,h=r=>{i.set(r,!1);let s=e.get(r)??[];for(t.set(r,s),e.set(r,[]),o.set(r,!0);s.length>0;)s.sort(Vr.sort),s.shift().execute();o.set(r,!1)};Yn=(r,s,a=0)=>{let f=Vn(r),n=new Vr(s,a),_=e.get(f);return _||(_=[],e.set(f,_)),_.push(n),i.get(f)||(i.set(f,!0),r.requestAnimationFrame(()=>h(f))),n},Ch=(r,s,a)=>{let f=Vn(r);if(o.get(f)){let n=new Vr(s,a),_=t.get(f);return _||(_=[],t.set(f,_)),_.push(n),n}else return Yn(r,s,a)}})();var Xn=class Xi{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new Xi(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Xi?t:new Xi(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};Xn.None=new Xn(0,0);var Df=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let o=this.mutationObservers.get(e);o||(o=new Map,this.mutationObservers.set(e,o));let h=_h(i),r=o.get(h);if(r)r.users+=1;else{let s=new he,a=new MutationObserver(n=>s.fire(n));a.observe(e,i);let f=r={users:1,observer:a,onDidMutate:s.event};t.add(ke(()=>{f.users-=1,f.users===0&&(s.dispose(),a.disconnect(),o?.delete(h),o?.size===0&&this.mutationObservers.delete(e))})),o.set(h,r)}return r.onDidMutate}},yh={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:Ur?"webkitAnimationStart":"animationstart",ANIMATION_END:Ur?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Ur?"webkitAnimationIteration":"animationiteration"},xh=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Bo(e,t,i,...o){let h=xh.exec(t);if(!h)throw new Error("Bad use of emmet");let r=h[1]||"div",s;return e!=="http://www.w3.org/1999/xhtml"?s=document.createElementNS(e,r):s=document.createElement(r),h[3]&&(s.id=h[3]),h[4]&&(s.className=h[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,f])=>{typeof f>"u"||(/^on\w+$/.test(a)?s[a]=f:a==="selected"?f&&s.setAttribute(a,"true"):s.setAttribute(a,f))}),s.append(...o),s}function Eh(e,t,...i){return Bo("http://www.w3.org/1999/xhtml",e,t,...i)}Eh.SVG=function(e,t,...i){return Bo("http://www.w3.org/2000/svg",e,t,...i)};var kh=class extends Oe{constructor(e,t,i,o,h,r,s,a,f){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=o,this._coreService=h,this._decorationService=r,this._optionsService=s,this._themeService=a,this._cursorBlinkStateManager=new ii,this._charAtlasDisposable=this._register(new ii),this._observerDisposable=this._register(new ii),this._model=new Uc,this._workCell=new Rn,this._workCell2=new Rn,this._rectangleRenderer=this._register(new ii),this._glyphRenderer=this._register(new ii),this._onChangeTextureAtlas=this._register(new he),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new he),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new he),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new he),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new he),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 rc(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Vc(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,s,this._themeService)],this.dimensions=tc(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(s.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(ls(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(ls(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Ln(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Mn(this._canvas,this._coreBrowserService.window,(_,v)=>this._setCanvasDevicePixelDimensions(_,v)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=Mn(this._canvas,_,(v,w)=>this._setCanvasDevicePixelDimensions(v,w))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ke(()=>{for(let _ of this._renderLayers)_.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 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 o of this._renderLayers)o.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 Kc(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Hc(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=Co(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=so(Ge.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ge.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 Ac(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,o=this._workCell,h,r,s,a,f,n,_=0,v=!0,w,p,c,d,l,u,g,C,b;e=Jn(e,i.rows-1,0),t=Jn(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,k=m-i.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),O=-1,H=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let A=!1;for(r=e;r<=t;r++)for(s=r+i.buffer.ydisp,a=i.buffer.lines.get(s),this._model.lineLengths[r]=0,c=m===s,_=0,f=this._characterJoinerService.getJoinedCharacters(s),C=0;C<i.cols;C++){if(h=this._cellColorResolver.result.bg,a.loadCell(C,o),C===0&&(h=this._cellColorResolver.result.bg),n=!1,v=C>=_,w=C,f.length>0&&C===f[0][0]&&v){p=f.shift();let W=this._model.selection.isCellSelected(this._terminal,p[0],s);for(g=p[0]+1;g<p[1];g++)v&&(v=W===this._model.selection.isCellSelected(this._terminal,g,s));v&&(v=!c||B<p[0]||B>=p[1]),v?(n=!0,o=new Lh(o,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),w=p[1]-1):_=p[1]}if(d=o.getChars(),l=o.getCode(),g=(r*i.cols+C)*Ji,this._cellColorResolver.resolve(o,C,s,this.dimensions.device.cell.width),H&&s===m&&(C===B&&(this._model.cursor={x:B,y:k,width:o.getWidth(),style:this._coreBrowserService.isFocused?y:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},O=B+o.getWidth()-1),C>=B&&C<=O&&(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)),l!==0&&(this._model.lineLengths[r]=C+1),!(this._model.cells[g]===l&&this._model.cells[g+qi]===this._cellColorResolver.result.bg&&this._model.cells[g+Ki]===this._cellColorResolver.result.fg&&this._model.cells[g+Wr]===this._cellColorResolver.result.ext)&&(A=!0,d.length>1&&(l|=$c),this._model.cells[g]=l,this._model.cells[g+qi]=this._cellColorResolver.result.bg,this._model.cells[g+Ki]=this._cellColorResolver.result.fg,this._model.cells[g+Wr]=this._cellColorResolver.result.ext,u=o.getWidth(),this._glyphRenderer.value.updateCell(C,r,l,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,h),n)){for(o=this._workCell,C++;C<=w;C++)b=(r*i.cols+C)*Ji,this._glyphRenderer.value.updateCell(C,r,0,0,0,0,Yl,0,0),this._model.cells[b]=0,this._model.cells[b+qi]=this._cellColorResolver.result.bg,this._model.cells[b+Ki]=this._cellColorResolver.result.fg,this._model.cells[b+Wr]=this._cellColorResolver.result.ext;C--}}A&&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})}},Lh=class extends Ht{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 Jn(e,t,i=0){return Math.max(Math.min(e,t),i)}var Zn="di$target",Qn="di$dependencies",Yr=new Map;function Ye(e){if(Yr.has(e))return Yr.get(e);let t=function(i,o,h){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Mh(t,i,h)};return t._id=e,Yr.set(e,t),t}function Mh(e,t,i){t[Zn]===t?t[Qn].push({id:e,index:i}):(t[Qn]=[{id:e,index:i}],t[Zn]=t)}var Bf=Ye("BufferService"),Pf=Ye("CoreMouseService"),Of=Ye("CoreService"),If=Ye("CharsetService"),Nf=Ye("InstantiationService"),Hf=Ye("LogService"),Rh=Ye("OptionsService"),Ff=Ye("OscLinkService"),Wf=Ye("UnicodeService"),$f=Ye("DecorationService"),Th={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ah="xterm.js: ",eo=class extends Oe{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=Th[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?"":Ah)+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)}};eo=Rl([Tl(0,Rh)],eo);var Po;function Dh(e){Po=e}var Oo=class extends Oe{constructor(e){if(ao&&Vl()<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 he),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new he),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new he),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new he),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,o=t.optionsService,h=t,r=h._renderService,s=h._characterJoinerService,a=h._charSizeService,f=h._coreBrowserService,n=h._decorationService,_=h._logService,v=h._themeService;Dh(_),this._renderer=this._register(new kh(e,s,a,f,i,n,o,v,this._preserveDrawingBuffer)),this._register(Ge.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ge.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ge.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ge.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this._register(ke(()=>{if(this._terminal._core._store._isDisposed)return;let w=this._terminal._core._renderService;w.setRenderer(this._terminal._core._createRenderer()),w.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Io=`/**
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,7 +333,7 @@ void main() {
333
333
  z-index: 2;
334
334
  position: relative;
335
335
  }
336
- `;var To=`/* eslint-disable */
336
+ `;var No=`/* eslint-disable */
337
337
  /**
338
338
  * @hyzyn/dsh-tty \u2014 \u9762\u677F\u6837\u5F0F\u8868\u3002
339
339
  *
@@ -1522,12 +1522,28 @@ void main() {
1522
1522
  font-size: 12.5px;
1523
1523
  box-sizing: border-box;
1524
1524
  }
1525
- .tt_sshError {
1526
- min-height: 16px;
1527
- color: var(--tt-danger);
1525
+ /*
1526
+ * \u72B6\u6001\u5E26\uFF1A\u5B9A\u9AD8\uFF08\u4E24\u884C\uFF09\uFF0C\u9519\u8BEF\u4E0E\u8BD5\u8FDE\u7ED3\u679C\u90FD\u843D\u5728\u8FD9\u91CC\u3002
1527
+ * \u5B9A\u9AD8 = \u6D88\u606F\u51FA\u73B0 / \u6D88\u5931\u4E0D\u6539\u53D8\u5361\u7247\u9AD8\u5EA6\u2014\u2014\u5361\u7247\u5728\u906E\u7F69\u91CC\u5782\u76F4\u5C45\u4E2D\uFF0C\u4E00\u53D8\u9AD8\u6574\u4E2A\u5BF9\u8BDD\u6846
1528
+ * \u90FD\u4F1A\u8DF3\uFF0C\u70B9\u4E00\u4E0B\u300C\u8BD5\u8FDE\u300D\u5E03\u5C40\u5C31\u52A8\uFF0C\u5B9E\u6D4B\u5F88\u96BE\u53D7\u3002\u7A7A\u5143\u7D20\u7528 :empty \u6458\u51FA\u5E03\u5C40\uFF0C
1529
+ * \u6709\u6D88\u606F\u65F6\u8D34\u7740\u5E95\u90E8\uFF08\u9760\u8FD1\u52A8\u4F5C\u884C\uFF09\u663E\u793A\u3002
1530
+ */
1531
+ .tt_sshStatus {
1532
+ flex: none;
1533
+ display: flex;
1534
+ flex-direction: column;
1535
+ justify-content: flex-end;
1536
+ height: 38px;
1537
+ overflow-y: auto;
1528
1538
  font-size: 12px;
1529
1539
  line-height: 1.45;
1530
1540
  }
1541
+ .tt_sshStatus > :empty {
1542
+ display: none;
1543
+ }
1544
+ .tt_sshError {
1545
+ color: var(--tt-danger);
1546
+ }
1531
1547
  .tt_sshHostRow {
1532
1548
  display: flex;
1533
1549
  align-items: center;
@@ -1559,7 +1575,7 @@ void main() {
1559
1575
  text-overflow: ellipsis;
1560
1576
  }
1561
1577
  .tt_sshProbeResult {
1562
- margin: 2px 0 4px;
1578
+ margin: 0;
1563
1579
  font-size: 12px;
1564
1580
  line-height: 1.5;
1565
1581
  white-space: pre-wrap;
@@ -2148,8 +2164,8 @@ void main() {
2148
2164
  transition: none !important;
2149
2165
  }
2150
2166
  }
2151
- `;var yh="/api/dsh-tty/ws";function xh(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+yh}function gr(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var Yi;function Fo(){document.getElementById("dsh-tty-style")||(Yi=document.createElement("style"),Yi.id="dsh-tty-style",Yi.textContent=To+`
2152
- `+Ro,document.head.appendChild(Yi))}var as='<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>',Eh='<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>',kh='<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>',Lh='<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>',Mh='<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>',Rh='<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>',Th='<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>',Ah='<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>',Dh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4 8h8"/></svg>',mr='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7"/><path d="M11.5 4.5l-7 7"/></svg>',Bh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.6v8.8"/><path d="M3.6 8h8.8"/></svg>',mi='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/></svg>',Wo='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 2.6h4.4l3.6 3.6v7.2a.9.9 0 0 1-.9.9H4.9a.9.9 0 0 1-.9-.9V3.5a.9.9 0 0 1 .9-.9z"/><path d="M8.2 2.7v3.4h3.4"/></svg>',$o='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.4 9.6l3.2-3.2"/><path d="M9.2 4.6l1-1a2.5 2.5 0 0 1 3.5 3.5l-1 1"/><path d="M6.8 11.4l-1 1a2.5 2.5 0 0 1-3.5-3.5l1-1"/></svg>',Uo='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 12.6V4.2"/><path d="M4.4 7.8L8 4.2l3.6 3.6"/></svg>',zo='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v7.2"/><path d="M5 7.4L8 10.4l3-3"/><path d="M3.4 12.8h9.2"/></svg>',Ph='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 10.4V3.2"/><path d="M5 6.2L8 3.2l3 3"/><path d="M3.4 12.8h9.2"/></svg>',br='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.2 2.9l1.9 1.9-7.3 7.3-2.4.5.5-2.4z"/></svg>',zt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4.6h10"/><path d="M6.2 4.6V3.4a.8.8 0 0 1 .8-.8h2a.8.8 0 0 1 .8.8v1.2"/><path d="M4.6 4.6l.6 8a.9.9 0 0 0 .9.8h3.8a.9.9 0 0 0 .9-.8l.6-8"/></svg>',wr='<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="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',jo='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/><path d="M8 6.6v3.6"/><path d="M6.2 8.4h3.6"/></svg>',Oh='<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="M3.4 8h9"/><path d="M9.2 4.8L12.4 8l-3.2 3.2"/></svg>',Ih='<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="M12.6 8h-9"/><path d="M6.8 4.8L3.6 8l3.2 3.2"/></svg>',Nh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.4" y="3.2" width="11.2" height="4" rx="1.2"/><rect x="2.4" y="8.8" width="11.2" height="4" rx="1.2"/><path d="M5 5.2h.01"/><path d="M5 10.8h.01"/></svg>',Hh='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.6l5.8 10.4H2.2z"/><path d="M8 6.4v3.2"/><path d="M8 11.6h.01"/></svg>',Fh='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M8 7.2v3.6"/><path d="M8 5.1h.01"/></svg>',qo='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M6 6l4 4"/><path d="M10 6l-4 4"/></svg>',Wh='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.8v5"/><path d="M11.6 4.6a5.2 5.2 0 1 1-7.2 0"/></svg>',Ko='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5.6" cy="6" r="2.8"/><path d="M7.8 7.9l5.4 5.4"/><path d="M10.6 10.7l1.2-1.2"/></svg>',Go=null,xe=null,se=null,Qi=null,Yt=null,Lt=null,vt=null,di=null,ui=null,es=null,We=null,_i=null,jt=null,Ae=null,qt=null,ts=!1,fi=null,lt=!1,Le=null,is=null,Xt=null,Mt=null,ss=null,Et=null,pi=1e3,rs="dsh-tty:tabs",re=new Map,Rt=null,ls=0,Xi=!1,$e=null,Kt=null,St=[];function yt(e,t){if(Yt===null)return;Yt.textContent=e,Lt.dataset.state=t,Qi!==null&&(Qi.style.display=t==="connected"?"none":""),Xt!==null&&(Xt.textContent=e),Mt!==null&&(Mt.dataset.state=t);let i=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");i!==null&&(i.dataset.state=t)}function Oe(e){xe!==null&&xe.readyState===WebSocket.OPEN&&xe.send(JSON.stringify(e))}function gt(){return Rt!==null?re.get(Rt):void 0}function Ao(){try{let e=Go?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function $h(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Oe({t:"refresh",sid:e.sid})}}var Ji=null;function Vo(e){Ji!==null&&clearTimeout(Ji),Ji=setTimeout(()=>{Ji=null;let t=gt();t!==void 0&&$h(t)},e??200)}function Tt(){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(rs):sessionStorage.setItem(rs,JSON.stringify(e)),Uh([...re.values()].map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var cr="dsh-tty:persist-specs";function Uh(e){try{let t=e.filter(i=>Vt(i.spawnSpec)).map(i=>({spawnSpec:i.spawnSpec,label:i.label}));t.length===0?localStorage.removeItem(cr):localStorage.setItem(cr,JSON.stringify(t))}catch{}}function zh(){try{let e=localStorage.getItem(cr);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&Vt(i.spawnSpec)):[]}catch{return[]}}function jh(){try{let e=sessionStorage.getItem(rs);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 hr(e,t){return new Promise(i=>{let l=s=>{let r;try{r=JSON.parse(s.data)}catch{return}r.t===e&&(clearTimeout(h),xe.removeEventListener("message",l),i(r))},h=setTimeout(()=>{xe.removeEventListener("message",l),i(null)},t);xe.addEventListener("message",l)})}function cs(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&Oe({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function hi(e,t,i,l){if(e.overlayEl===null||e.overlayEl===void 0)return;let h=e.overlayEl;if(t===""||t===void 0){h.textContent="";return}let s=l==="error"||l==="info"?l:"exited";h.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?qo:s==="info"?wr:Wh)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(i===void 0||i===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",h.querySelector(".tt_overlayMain").textContent=t,i!==void 0&&i!==""&&(h.querySelector(".tt_overlayHint").textContent=i)}function qh(e,t){try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i!==""?i:t}catch{return t}}function hs(e){let t=qh("--dsw-alias-state-business-primary","#7c9cff"),i=new No.Terminal({cursorBlink:!0,cursorStyle:"bar",cursorInactiveStyle:"outline",fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontWeight:400,fontWeightBold:600,lineHeight:1.35,scrollback:5e3,convertEol:!1,allowProposedApi:!0,theme:{background:"#0b0e14",foreground:"#d7dce5",cursor:t,cursorAccent:"#0b0e14",selectionBackground:"rgba(124, 156, 255, .30)",black:"#1b2028",red:"#f07178",green:"#7ec699",yellow:"#e6b673",blue:"#7aa2f7",magenta:"#c792ea",cyan:"#7fdbca",white:"#c8d0dc",brightBlack:"#556070",brightRed:"#ff8b92",brightGreen:"#9fe0b4",brightYellow:"#f5cc8c",brightBlue:"#9ab8ff",brightMagenta:"#dbb3ff",brightCyan:"#a3f0e2",brightWhite:"#eef2f8"}}),l=new Ho.FitAddon,h=new rn;i.loadAddon(l),i.loadAddon(h),i.loadAddon(new nn);let s=document.createElement("div");s.className="tt_term";let r=document.createElement("div");r.className="tt_overlay",r.addEventListener("click",()=>{r.textContent="",Cr(e.sid)}),s.appendChild(r),i.open(s);try{l.fit()}catch{}try{let o=new Mo;o.onContextLoss(()=>{try{o.dispose()}catch{}}),i.loadAddon(o)}catch{}i.onData(o=>{Oe({t:"input",sid:e.sid,d:o})}),i.onResize(()=>{Vt(e.spawnSpec)&&Vo(200)}),i.attachCustomKeyEventHandler(o=>(o.ctrlKey||o.metaKey)&&o.key.toLowerCase()==="f"?(o.preventDefault(),la(),!1):!0),e.term=i,e.fit=l,e.search=h,e.termEl=s,e.overlayEl=r}function ns(e,t){let i=gr(),l={sid:i,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??ld(),label:t};return hs(l),re.set(i,l),ls+=1,Ze(),Zt(i),Sr(l),Tt(),l}function Kh(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};hs(t),re.set(t.sid,t),ls+=1,Ze(),Zt(t.sid),Oe({t:"attach",sid:t.sid})}function Sr(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0;Oe({...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24})}function Do(e){let t={sid:gr(),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};hs(t),re.set(t.sid,t),ls+=1,Ze(),Zt(t.sid),Sr(t)}function Cr(e){let t=re.get(e);if(t===void 0)return;let i=t.spawnSpec,l=t.label;if(t.exited||Oe({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),re.delete(e);let h={sid:gr(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:i,label:l};hs(h),re.set(h.sid,h),Ze(),Zt(h.sid),Sr(h),Tt()}function Gh(e){let t=re.get(e);if(t!==void 0){if(t.exited||Oe({t:"kill",sid:e}),re.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),Rt===e){Rt=null;let i=[...re.keys()].pop()??null;i!==null&&Zt(i)}Ze(),re.size===0?ds():Tt()}}function Zt(e){let t=re.get(e);if(t!==void 0){Rt=e;for(let[i,l]of re)l.termEl!==null&&(l.termEl.style.display=i===e?"":"none");jt!==null&&t.termEl!==null&&t.termEl.parentElement!==jt&&jt.appendChild(t.termEl),Ze(),vi();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&cs(t),hi(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA":"",t.exited?"\u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"","exited")}}function ar(e){if(vt===null)return;let t=re.get(e);if(t===void 0)return;let l=vt.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");l!=null&&(l.dataset.state=t.exited?"exited":t.live===!0?"connected":t.errored===!0?"error":"connecting")}function Ze(){if(vt===null)return;vt.textContent="";for(let[t,i]of re){let l=document.createElement("button");l.className="tt_tab",l.dataset.sid=t,t===Rt&&(l.dataset.active="");let h=document.createElement("span");h.className="tt_tabDot",h.dataset.state=i.exited?"exited":i.live===!0?"connected":i.errored===!0?"error":"connecting",l.appendChild(h);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=i.label||"\u7EC8\u7AEF "+Yo(t),s.addEventListener("dblclick",o=>{o.stopPropagation(),Xh(t,l)});let r=document.createElement("span");r.className="tt_tabClose",r.title="\u5173\u95ED",r.textContent="\u2715",l.title=s.textContent,l.appendChild(s),l.appendChild(r),l.addEventListener("click",o=>{if(o.target.closest(".tt_tabClose")!==null){o.stopPropagation(),Gh(t);return}Zt(t)}),vt.appendChild(l)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.innerHTML=Bh,e.addEventListener("click",()=>{Qh(e)}),vt.appendChild(e)}function Vh(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 vi(){if(di===null||es===null||_i===null||ui===null)return;_i.textContent="";let e=gt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){di.dataset.hidden="";return}delete di.dataset.hidden;let i=Number(t.port);es.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:""),We!==null&&(e.persistTmux===!0?(We.textContent="tmux",We.dataset.state="ok",We.title="\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A"):t.persist===!0&&e.spawned===!0?(We.textContent="\u672A\u6301\u4E45\u5316",We.dataset.state="warn",We.title="\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD"):(We.textContent="",delete We.dataset.state,We.removeAttribute("title")));let l=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";ui.dataset.state=l,ui.title=l==="connected"?"\u5DF2\u8FDE\u63A5":l==="connecting"?"\u8FDE\u63A5\u4E2D":l==="error"?"\u8FDE\u63A5\u51FA\u9519":"\u4F1A\u8BDD\u5DF2\u9000\u51FA";let h=(o,_,n,f)=>{let v=document.createElement("button");v.type="button",v.className="tt_toolBtn tt_connAct",v.title=n,v.innerHTML=o+"<span></span>",v.lastElementChild.textContent=_,v.addEventListener("click",f),_i.appendChild(v)};e.exited&&h(Rh,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>Cr(e.sid)),h(Th,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>Er(e.spawnSpec));let s=typeof t.name=="string"?t.name:"",r=s!==""?Zo(s):0;r>0&&h(Ah,"\u96A7\u9053 "+r,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",o=>{Yh(o.currentTarget,s)})}var xt=null,Zi=null;function dr(){Zi!==null&&(document.removeEventListener("mousedown",Zi,!0),Zi=null),xt!==null&&(xt.remove(),xt=null)}function Yh(e,t){if(xt!==null){dr();return}let i=document.createElement("div");i.className="tt_tunnelPop";let l=document.createElement("div");l.className="tt_tunnelPopTitle",l.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,i.appendChild(l);let h=document.createElement("div");h.textContent="\u52A0\u8F7D\u4E2D\u2026",i.appendChild(h);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),xt=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 o=_=>{xt===i&&(i.contains(_.target)||e.contains(_.target)||dr())};Zi=o,setTimeout(()=>document.addEventListener("mousedown",o,!0),0),(async()=>{let _=[];try{let v=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();v.ok&&Array.isArray(v.tunnels)&&(_=v.tunnels)}catch{}if(xt!==i)return;h.textContent="";let n=yr.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 v=_.find(a=>a?.name===f?.name),w=v?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=w==="active"?"connected":w==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(v?.error??v?.lastForwardError??""),d.textContent=Vh(f)+" \xB7 "+w,p.appendChild(c),p.appendChild(d),h.appendChild(p)}})()}function Yo(e){let t=1;for(let i of re.keys()){if(i===e)return String(t);t+=1}return String(t)}function Xh(e,t){let i=re.get(e);if(i===void 0||t.querySelector(".tt_tabRename")!==null)return;let l=t.querySelector(".tt_tabLabel");if(l===null)return;let h=document.createElement("input");h.className="tt_tabRename",h.value=i.label||"\u7EC8\u7AEF "+Yo(e),l.replaceWith(h),h.focus(),h.select();let s=!1,r=()=>{if(s)return;s=!0;let _=h.value.trim();i.label=_!==""?_:void 0,Ze(),Tt()},o=()=>{s||(s=!0,Ze())};h.addEventListener("keydown",_=>{_.stopPropagation(),_.key==="Enter"?r():_.key==="Escape"&&o()}),h.addEventListener("blur",r),h.addEventListener("click",_=>_.stopPropagation())}var yr=[],Xo="dialog",kt="off",bt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},Gt=null,mt=null;function bi(e){e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(St=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(yr=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(Xo=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(kt=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(bt={...bt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(Gt=e.maxSessions)}function Jh(e,t){let i=t==="error"||t==="info"?t:"warn",l=document.createElement("div");l.className="tt_toast",l.dataset.kind=i,l.innerHTML='<span class="tt_toastIcon">'+(i==="error"?qo:i==="info"?Fh:Hh)+'</span><span class="tt_toastText"></span>',l.lastElementChild.textContent=e,document.body.appendChild(l),setTimeout(()=>l.remove(),4e3)}async function Jo(){try{Oe({t:"sessions"});let e=await hr("sessions",3e3);if(e!==null&&Array.isArray(e.list))return mt=e.list.length,mt}catch{}return null}async function os(){if(await Jo(),Gt===null||mt===null||mt<Gt)return null;let e=[...re.values()].filter(l=>!l.exited).length,t=Math.max(0,mt-e),i=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${mt} \u4E2A / \u4E0A\u9650 ${Gt}\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 Jh(i),i}function Zh(){return Gt!==null&&mt!==null&&mt>=Gt}function xr(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Zo(e){return yr.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function ur(e){let t=Number(e?.port),i=Number.isInteger(t)&&t!==22?":"+t:"",l=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",h=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+i+" \xB7 "+l+h}async function Qo(e,t){let i=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),l=await i.json().catch(()=>({}));return l&&l.ok===!1&&l.error?{error:String(l.error)}:l&&l.result?{result:l.result}:{error:String(l&&l.error?l.error:"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP "+i.status+"\uFF09")}}function ea(e,t){if(!e)return"\u8FDE\u63A5\u6D4B\u8BD5\u2026";let i=e,l=typeof i.tcp?.ms=="number"?i.tcp.ms:null,h=typeof i.auth?.ms=="number"?i.auth.ms:null,s=[];i.tcp?.ok&&s.push("TCP "+(l!==null?l+"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"+(h!==null?"\u8BA4\u8BC1\u901A\u8FC7\uFF08"+h+"ms\uFF09":"\u8BA4\u8BC1\u901A\u8FC7")+(s.length?" \xB7 "+s.join(" \xB7 "):"");let o=i.auth?.error||i.tcp?.error||"\u672A\u77E5\u9519\u8BEF";return(t?.prefix||"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A")+o+(s.length?" \xB7 "+s.join(" \xB7 "):"")}async function ta(){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=St;bi(t.config),$e!==null&&St!==i&&_r($e)}}catch{}}function ia(e){$e!==null&&(e.target instanceof Element&&($e.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||Xe())}function Qh(e){if($e!==null){Xe();return}ta(),Jo().then(()=>{$e!==null&&_r($e)});let t=document.createElement("div");t.className="tt_addMenu",$e=t,_r(t),document.body.appendChild(t);let i=e.getBoundingClientRect(),l=t.offsetWidth,s=i.left+l>window.innerWidth-8?i.right-l:i.left;t.style.left=Math.max(8,Math.min(s,window.innerWidth-l-8))+"px",t.style.top=i.bottom+6+"px",document.addEventListener("mousedown",ia,!0)}function Xe(){$e!==null&&(document.removeEventListener("mousedown",ia,!0),$e.remove(),$e=null)}function Bo(e,t,i,l,h,s){let r=document.createElement("button");if(r.type="button",r.className="tt_addMenuItem",h===!0&&(r.setAttribute("data-soldout",""),r.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E"),s!==void 0){let n=document.createElement("span");n.className="tt_addMenuIcon",n.innerHTML=s,r.appendChild(n)}let o=document.createElement("span");o.className="tt_addMenuText";let _=document.createElement("span");if(_.className="tt_addMenuMain",_.textContent=t,o.appendChild(_),i!==""){let n=document.createElement("span");n.className="tt_addMenuSub",n.textContent=i,o.appendChild(n)}r.appendChild(o),r.addEventListener("click",l),e.appendChild(r)}function _r(e){e.textContent="";let t=Zh();Bo(e,"\u672C\u5730\u7EC8\u7AEF",kt==="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 os()||(Xe(),ns())},t,as);let i=document.createElement("div");i.className="tt_addMenuSep",e.appendChild(i);let l=document.createElement("div");l.className="tt_addMenuTitle",l.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(l);for(let s of St){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let r=document.createElement("div");r.className="tt_addMenuRow";let o=document.createElement("button");o.type="button",o.className="tt_addMenuItem",t&&(o.setAttribute("data-soldout",""),o.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let _=document.createElement("span");_.className="tt_addMenuIcon",_.innerHTML=Nh;let n=document.createElement("span");n.className="tt_addMenuText";let f=document.createElement("span");f.className="tt_addMenuMain",f.textContent=s.name;let v=document.createElement("span");v.className="tt_addMenuSub";let w=Zo(s.name);v.textContent=ur(s)+(w>0?" \xB7 \u21C4"+String(w):""),n.appendChild(f),n.appendChild(v),o.appendChild(_),o.appendChild(n),o.addEventListener("click",async()=>{if(await os())return;Xe();let d=kt==="tmux"?{persist:!0,persistName:xr()}:{};ns({t:"ssh",name:s.name,...d},s.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.innerHTML=mi,p.addEventListener("click",()=>{Xe(),Er({name:s.name})});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title="\u7F16\u8F91\u8FDE\u63A5",c.innerHTML=br,c.addEventListener("click",()=>{Xe(),Po(s)}),r.appendChild(o),r.appendChild(p),r.appendChild(c),e.appendChild(r)}if(St.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 h=document.createElement("div");h.className="tt_addMenuSep",e.appendChild(h),Bo(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{Xe(),Po()},!1,Ko)}function Po(e){if(Kt!==null)return;let t=e!==null&&typeof e=="object"?e:null,i=t!==null,l=document.createElement("div");l.className="tt_sshBackdrop";let h=document.createElement("div");h.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=Ko+"<span></span>",s.lastElementChild.textContent=i?"\u7F16\u8F91\u8FDE\u63A5 \xB7 "+String(t.name??""):"SSH \u8FDE\u63A5",h.appendChild(s);let r=z=>{let D=document.createElement("div");return D.className="tt_sshSection",D.textContent=z,D},o={},_=(z,D,x)=>{let N=document.createElement("label");N.className="tt_sshRow";let W=document.createElement("span");W.className="tt_cardLabel",W.textContent=D,N.appendChild(W);let j;if(x?.select!==void 0){j=document.createElement("select");for(let G of x.select){let Z=document.createElement("option");Z.value=G.value,Z.textContent=G.label,j.appendChild(Z)}}else j=document.createElement("input"),j.type=x?.type??"text",j.placeholder=x?.placeholder??"";return j.className="tt_cardInput",j.autocomplete="off",j.spellcheck=!1,N.appendChild(j),o[z]=j,N};h.appendChild(r("\u8FDE\u63A5"));let n=document.createElement("div");n.className="tt_sshGrid",n.appendChild(_("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),n.appendChild(_("port","\u7AEF\u53E3",{placeholder:"22"})),h.appendChild(n),h.appendChild(_("username","\u7528\u6237\u540D",{placeholder:"root"})),h.appendChild(r("\u8BA4\u8BC1")),h.appendChild(_("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 f=_("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),v=_("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),w=_("password","\u5BC6\u7801",{type:"password"}),p=z=>{let D=document.createElement("div");D.className="tt_sshRow";let x=document.createElement("input");x.type="text",x.className="tt_cardInput",x.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",x.autocomplete="off",x.spellcheck=!1;let N=document.createElement("div");N.className="tt_envList",N.dataset.hidden="";let W=[],j=()=>{if(N.textContent="",W.length===0){let K=document.createElement("span");K.className="tt_cardHint",K.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",N.appendChild(K);return}let G=x.value.trim().toUpperCase(),Z=G===""?W:W.filter(K=>K.toUpperCase().includes(G));for(let K of Z.slice(0,30)){let X=document.createElement("button");X.type="button",X.className="tt_envItem",X.textContent=K;let te="env:"+K,Q=null,ne=()=>{Q!==null&&(clearTimeout(Q),Q=null),X.textContent=K,delete X.dataset.danger};X.addEventListener("mousedown",ce=>ce.preventDefault()),X.addEventListener("click",()=>{let ce=z.value;if(ce===""||ce.startsWith("env:")||Q!==null){ne(),z.value=te,z.focus();return}X.textContent=K+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",X.dataset.danger="",Q=setTimeout(ne,4e3)}),N.appendChild(X)}if(Z.length>30){let K=document.createElement("span");K.className="tt_envMore",K.textContent="\u8FD8\u6709 "+(Z.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",N.appendChild(K)}else if(Z.length===0){let K=document.createElement("span");K.className="tt_envMore",K.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",N.appendChild(K)}};return x.addEventListener("input",j),x.addEventListener("focus",()=>{delete N.dataset.hidden}),x.addEventListener("blur",()=>{x.value.trim()===""&&(N.dataset.hidden="")}),D.appendChild(x),D.appendChild(N),{row:D,setNames(G){W=Array.isArray(G)?G:[],j()}}},c=p(o.passphrase),d=p(o.password),a=!1;(async()=>{if(!a){a=!0;try{let D=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();D.ok&&Array.isArray(D.names)&&(c.setNames(D.names),d.setNames(D.names))}catch{}}})(),h.appendChild(f),h.appendChild(v),h.appendChild(c.row),h.appendChild(w),h.appendChild(d.row),h.appendChild(r("\u9009\u9879")),h.appendChild(r("\u9009\u9879"));let g=document.createElement("label");g.className="tt_cardRow";let C=document.createElement("input");C.type="checkbox",C.className="tt_cardCheckbox";let b=document.createElement("span");b.className="tt_cardLabel",b.textContent="agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09",g.appendChild(C),g.appendChild(b),h.appendChild(g);let y=document.createElement("label");y.className="tt_cardRow";let m=document.createElement("input");m.type="checkbox",m.className="tt_cardCheckbox";let k=document.createElement("span");k.className="tt_cardLabel",k.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",y.appendChild(m),y.appendChild(k),m.checked=kt==="tmux",kt==="tmux"&&h.appendChild(y);let B=document.createElement("label");B.className="tt_cardRow";let P=document.createElement("input");P.type="checkbox",P.className="tt_cardCheckbox";let H=document.createElement("span");H.className="tt_cardLabel",H.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",B.appendChild(P),B.appendChild(H),h.appendChild(B);let A=_("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});A.style.display="none",h.appendChild(A),P.addEventListener("change",()=>{A.style.display=P.checked?"":"none",P.checked&&o.name.value.trim()===""&&o.host.value.trim()!==""&&(o.name.value=o.host.value.trim()),P.checked&&o.name.focus()}),i&&(B.style.display="none",o.name.value=String(t.name??""),A.style.display="",o.host.value=String(t.host??""),o.port.value=String(t.port??22),o.username.value=String(t.username??""),o.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",o.keyPath.value=String(t.keyPath??""),o.passphrase.value=String(t.passphrase??""),o.password.value=String(t.password??""),C.checked=t.agentForward===!0,m.checked=kt==="tmux");let F=document.createElement("div");F.className="tt_sshError",h.appendChild(F);let O=document.createElement("div");O.className="tt_sshProbeResult",O.style.display="none",h.appendChild(O);let T=()=>{F.textContent="";let z=o.host.value.trim(),D=o.username.value.trim(),x=Number(o.port.value);if((!Number.isInteger(x)||x<1||x>65535)&&(x=22),z===""||D==="")return F.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B",null;let N=o.auth.value,W={host:z,port:x,username:D,auth:N};if(N==="key"){let j=o.keyPath.value.trim();if(j==="")return F.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84",null;W.keyPath=j;let G=o.passphrase.value;G!==""&&(W.passphrase=G)}if(N==="password"){let j=o.password.value;if(j==="")return F.textContent="auth=password \u9700\u8981\u5BC6\u7801",null;W.password=j}return C.checked&&(W.agentForward=!0),W},I=document.createElement("div");I.className="tt_sshActions";let R=document.createElement("div");R.className="tt_sshActionsGroup";let S=document.createElement("div");S.className="tt_sshActionsGroup",I.appendChild(R),I.appendChild(S);let E=document.createElement("button");E.type="button",E.className="tt_toolBtn",E.textContent="\u53D6\u6D88";let L=document.createElement("button");L.type="button",L.className="tt_cardSave",L.textContent="\u8FDE\u63A5",R.appendChild(E);let M=document.createElement("button");M.type="button",M.className="tt_toolBtn",M.textContent="\u6587\u4EF6\u6D4F\u89C8",M.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",M.addEventListener("click",()=>{F.textContent="";let z=o.host.value.trim(),D=o.username.value.trim(),x=Number(o.port.value);if((!Number.isInteger(x)||x<1||x>65535)&&(x=22),z===""||D===""){F.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let N=o.auth.value,W={host:z,port:x,username:D,auth:N};if(N==="key"){let j=o.keyPath.value.trim();if(j===""){F.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}W.keyPath=j;let G=o.passphrase.value;G!==""&&(W.passphrase=G)}if(N==="password"){let j=o.password.value;if(j===""){F.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}W.password=j}C.checked&&(W.agentForward=!0),pt(),Er(W)}),R.appendChild(M);let U=null;i&&(U=document.createElement("button"),U.type="button",U.className="tt_toolBtn",U.textContent="\u4FDD\u5B58\u4FEE\u6539",U.addEventListener("click",()=>{F.textContent="";let z=o.host.value.trim(),D=o.username.value.trim();if(z===""||D===""){F.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let x=Number(o.port.value);(!Number.isInteger(x)||x<1||x>65535)&&(x=22);let N=o.auth.value,j={name:o.name.value.trim()||z,host:z,port:x,username:D,auth:N,keyPath:N==="key"?o.keyPath.value.trim():"",passphrase:o.passphrase.value,password:o.password.value,agentForward:C.checked,persist:m.checked};if(N==="key"&&j.keyPath===""){F.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}U!==null&&(U.disabled=!0),td(String(t.name??""),j).then(G=>{if(U!==null&&(U.disabled=!1),G!==void 0){F.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+G;return}pt()})}),R.appendChild(U));let q=document.createElement("button");q.type="button",q.className="tt_toolBtn",q.textContent="\u8BD5\u8FDE",q.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",q.addEventListener("click",()=>{let z=T();z!==null&&(O.style.display="",O.className="tt_sshProbeResult",O.textContent="\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026",q.disabled=!0,Qo(z,!1).then(D=>{q.disabled=!1,D.result?(O.className="tt_sshProbeResult"+(D.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),O.textContent=ea(D.result)):(O.className="tt_sshProbeResult tt_sshProbeBad",O.textContent="\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(D.error||"\u672A\u77E5\u9519\u8BEF"))}))}),R.appendChild(q),S.appendChild(L),h.appendChild(I);let Y=()=>{f.style.display=o.auth.value==="key"?"":"none",v.style.display=o.auth.value==="key"?"":"none",c.row.style.display=o.auth.value==="key"?"":"none",w.style.display=o.auth.value==="password"?"":"none",d.row.style.display=o.auth.value==="password"?"":"none"};o.auth.addEventListener("change",Y),Y(),E.addEventListener("click",()=>pt()),l.addEventListener("mousedown",z=>{z.target===l&&pt()}),L.addEventListener("click",async()=>{F.textContent="";let z=await os();if(z!==null){F.textContent=z;return}let D=o.host.value.trim(),x=o.username.value.trim(),N=Number(o.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),D===""||x===""){F.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let W=o.auth.value,j={t:"ssh",host:D,port:N,username:x,auth:W};if(W==="key"){let X=o.keyPath.value.trim();X!==""&&(j.keyPath=X);let te=o.passphrase.value;te!==""&&(j.passphrase=te)}if(W==="password"){let X=o.password.value;X!==""&&(j.password=X)}C.checked&&(j.agentForward=!0),m.checked&&(j.persist=!0,j.persistName=xr());let G=N!==22?x+"@"+D+":"+N:x+"@"+D,Z=X=>{pt(),se!==null&&ns(j,X!==""?X:G)};if(!P.checked){Z("");return}let K=o.name.value.trim()||D;L.disabled=!0,ed({name:K,host:D,port:N,username:x,auth:W,keyPath:j.keyPath??"",passphrase:j.passphrase??"",password:j.password??"",agentForward:C.checked,persist:m.checked}).then(X=>{if(L.disabled=!1,X!==void 0){F.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+X;return}Z(K)})}),l.appendChild(h),document.body.appendChild(l),Kt=l,o.host.focus()}function pt(){Kt!==null&&(Kt.remove(),Kt=null)}async function ed(e){let t=[...St.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})}),l=await i.json().catch(()=>({}));if(!i.ok||!l.ok)return String(l.error||"HTTP "+i.status);bi(l.config);return}catch(i){return String(i&&i.message?i.message:i)}}async function td(e,t){if(t.name!==e&&St.some(l=>l?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let i=St.map(l=>l?.name===e?t:l);try{let l=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:i})}),h=await l.json().catch(()=>({}));if(!l.ok||!h.ok)return String(h.error||"HTTP "+l.status);bi(h.config);return}catch(l){return String(l&&l.message?l.message:l)}}function id(e,t){if(wt!==null)return;let i=document.createElement("div");i.className="tt_sshBackdrop";let l=document.createElement("div");l.className="tt_sftpDualCard";let h=document.createElement("div");h.className="tt_sftpTitleRow";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=mi+"<span></span>",s.lastElementChild.textContent="SFTP \u53CC\u680F \xB7 "+t;let r=document.createElement("button");r.type="button",r.className="tt_close",r.title="\u5173\u95ED",r.innerHTML=mr,r.addEventListener("click",At),h.appendChild(s),h.appendChild(r),l.appendChild(h);let o=document.createElement("div");o.className="tt_sftpStatus";let _=(T,I)=>{o.textContent=T,I===void 0?delete o.dataset.state:o.dataset.state=I},n=!1,f=(T,I)=>{if(!(n||w.local.busy||w.remote.busy)){n=!0;for(let R of[w.local,w.remote])R.setBusy(!0);_(T,"busy"),Promise.resolve().then(I).catch(R=>{(R===null||typeof R!="object"||R.name!=="TransferCanceledError")&&F.fail("\u5931\u8D25"),_(String(R&&R.message?R.message:R),"error")}).finally(()=>{n=!1;for(let R of[w.local,w.remote])R.setBusy(!1)})}},v=T=>{w[T].bar.after(c),c.style.display="",d.focus(),d.select()},w={},p=(T,I)=>{let R={kind:T,path:"",busy:!1},S=document.createElement("div");S.className="tt_sftpPane";let E=document.createElement("div");E.className="tt_sftpPaneHead";let L=document.createElement("span");L.textContent=I;let M=document.createElement("span");M.className="tt_sftpPaneMeta",E.appendChild(L),E.appendChild(M),S.appendChild(E);let U=document.createElement("div");U.className="tt_sftpBar";let q=document.createElement("input");q.type="text",q.className="tt_sftpPath",q.placeholder=T==="local"?"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",q.spellcheck=!1,q.autocomplete="off";let Y=document.createElement("button");Y.type="button",Y.className="tt_toolBtn",Y.innerHTML=wr+"<span>\u5237\u65B0</span>";let z=document.createElement("button");z.type="button",z.className="tt_toolBtn",z.innerHTML=jo+"<span>\u65B0\u5EFA\u76EE\u5F55</span>",U.appendChild(q),U.appendChild(Y),U.appendChild(z),S.appendChild(U);let D=document.createElement("div");D.className="tt_sftpList",S.appendChild(D),R.bar=U;let x=K=>{R.busy=K;for(let X of[Y,z])X.disabled=K;q.disabled=K},N=async(K,X)=>{let te=T==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",Q=T==="local"?X:{...e,...X},ne=await fetch(te+K,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)}),ce=await ne.json().catch(()=>({}));if(!ne.ok||ce.ok!==!0)throw new Error(String(ce.error||"HTTP "+ne.status));return ce},W=(K,X)=>{if(!(R.busy||n))return x(!0),_(K,"busy"),Promise.resolve().then(X).catch(te=>_(String(te&&te.message?te.message:te),"error")).finally(()=>x(!1))},j=(K,X)=>K.endsWith("/")||K.endsWith("\\")?K+X:K+"/"+X,G=K=>{let X=j(R.path,K.name),te=[];K.isDir===!0?te.push("\u76EE\u5F55"):te.push(Je(Number(K.size))||"\u2014");let Q=sa(Number(K.mtime));Q!==""&&te.push(Q);let ne=b(K.isDir?mi:K.isSymlink?$o:Wo,K.name,te.join(" \xB7 "),K.isDir===!0?"dir":K.isSymlink===!0?"link":"file"),ce=()=>R.loadDir(R.path),Re=T==="local"?w.remote:w.local;return K.isDir===!0&&ne.addEventListener("click",ue=>{ue.target instanceof Element&&ue.target.closest(".tt_sftpAct")!==null||R.loadDir(X)}),y(ne,T==="local"?Oh:Ih,"\u4F20\u8F93\u5230"+(T==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+Re.path,()=>{F.reset(),F.pulse(0),f("\u4F20\u8F93 "+K.name+"\u2026",async()=>{let ue=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:T==="local"?"up":"down",...e,localPath:T==="local"?X:j(Re.path,K.name),remotePath:T==="local"?j(Re.path,K.name):X})}),Me=await ue.json().catch(()=>({}));if(!ue.ok||Me.ok!==!0)throw F.fail("\u4F20\u8F93\u5931\u8D25"),new Error(String(Me.error||"HTTP "+ue.status));let $=Me.job?.id;if(typeof $!="string"||$==="")throw F.fail("\u4F20\u8F93\u5931\u8D25"),new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id");await O($,K.name)==="canceled"?(F.reset(),_("\u5DF2\u53D6\u6D88\u4F20\u8F93 "+K.name)):(F.done("\u5B8C\u6210"),setTimeout(()=>F.reset(),1500),_("\u5DF2\u4F20\u8F93 "+K.name)),await Re.loadDir(Re.path)})}),T!=="local"&&K.isDir!==!0&&y(ne,zo,"\u4E0B\u8F7D "+K.name,()=>{k(K,X)}),y(ne,br,"\u91CD\u547D\u540D "+K.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=K.name,v(T),g=async()=>{let ue=d.value.trim();ue===""||ue===K.name||(C(),await R.runTask("\u91CD\u547D\u540D "+K.name+"\u2026",async()=>{await N("rename",{from:X,to:j(R.path,ue)}),await ce()}))}}),m(ne,()=>R.runTask("\u5220\u9664 "+K.name+"\u2026",async()=>{await N("remove",{path:X,recursive:K.isDir===!0}),await ce(),_("\u5DF2\u5220\u9664 "+K.name)}),K),ne},Z=K=>{if(D.textContent="",R.path!==""&&R.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(R.path)===!1){let te=b(Uo,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");te.addEventListener("click",()=>{R.loadDir(ra(R.path))}),D.appendChild(te)}let X=Array.isArray(K)?K:[];if(X.length===0){let te=document.createElement("div");te.className="tt_addMenuTitle",te.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",D.appendChild(te);return}for(let te of X)te===null||typeof te!="object"||typeof te.name!="string"||te.name===""||D.appendChild(G(te))};return R.loadDir=async K=>{try{let X=await N("list",{path:K??R.path});R.path=typeof X.path=="string"&&X.path!==""?X.path:R.path,q.value=R.path;let te=Array.isArray(X.entries)?X.entries.length:0;Z(X.entries),M.textContent=String(te)+" \u9879",_(R.path)}catch(X){_(String(X&&X.message?X.message:X),"error")}},R.runTask=W,R.setBusy=x,w[T]=R,Y.addEventListener("click",()=>{R.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>R.loadDir(R.path))}),z.addEventListener("click",()=>{R.busy||n||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",v(T),g=async()=>{let K=d.value.trim();K!==""&&(C(),await R.runTask("\u521B\u5EFA\u76EE\u5F55 "+K+"\u2026",async()=>{await N("mkdir",{path:j(R.path,K),parents:!0}),await R.loadDir(R.path)}))})}),q.addEventListener("keydown",K=>{if(K.key!=="Enter"||(K.preventDefault(),R.busy||n))return;let X=q.value.trim();X!==""&&R.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>R.loadDir(X))}),S},c=document.createElement("div");c.className="tt_sftpEditor",c.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let a=document.createElement("button");a.type="button",a.className="tt_toolBtn",a.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",c.appendChild(d),c.appendChild(a),c.appendChild(u);let g=null,C=()=>{c.style.display="none",d.value="",g=null};a.addEventListener("click",()=>{g?.()}),u.addEventListener("click",C),d.addEventListener("keydown",T=>{T.key==="Enter"?(T.preventDefault(),g?.()):T.key==="Escape"&&(T.stopPropagation(),C())});let b=(T,I,R,S)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpRow";let L=document.createElement("span");L.className="tt_sftpIcon",L.innerHTML=T,S!==void 0&&(L.dataset.kind=S);let M=document.createElement("span");if(M.className="tt_sftpName",M.textContent=I,M.title=I,E.appendChild(L),E.appendChild(M),R!==""){let U=document.createElement("span");U.className="tt_sftpMeta",U.textContent=R,E.appendChild(U)}return E},y=(T,I,R,S)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpAct",E.innerHTML=I,E.title=R,E.addEventListener("click",L=>{L.stopPropagation(),S()}),T.appendChild(E)},m=(T,I,R)=>{let S=document.createElement("button");S.type="button",S.className="tt_sftpAct",S.innerHTML=zt,S.title="\u5220\u9664 "+R.name+(R.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let E=null;S.addEventListener("click",L=>{if(L.stopPropagation(),E!==null){clearTimeout(E),E=null,S.innerHTML=zt,delete S.dataset.danger,I();return}S.textContent="\u786E\u8BA4?",S.dataset.danger="",E=setTimeout(()=>{E=null,S.innerHTML=zt,delete S.dataset.danger},4e3)}),T.appendChild(S)},k=(T,I)=>w.remote.runTask("\u4E0B\u8F7D "+T.name+"\u2026",async()=>{F.reset();let R;try{R=await oa("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:I})},(S,E)=>{F.set(S,E)},bt.maxDownloadMb,S=>F.setCancel(S))}catch(S){if(fr(S)){F.reset(),_("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+T.name);return}throw F.fail("\u4E0B\u8F7D\u5931\u8D25"),S}F.done("\u5B8C\u6210"),aa(R,T.name),setTimeout(()=>F.reset(),1500),_("\u5DF2\u4E0B\u8F7D "+T.name+"\uFF08"+(Je(R.size)||String(R.size)+" B")+"\uFF09")}),B=p("local","\u672C\u673A"),P=p("remote","\u8FDC\u7A0B");w.local.wrap=B,w.remote.wrap=P;let H=document.createElement("div");H.className="tt_sftpDual",H.appendChild(B),H.appendChild(P),l.appendChild(H),l.appendChild(c);let A=document.createElement("div");A.className="tt_sftpFoot";let F=na();A.appendChild(F.el),A.appendChild(o),l.appendChild(A);let O=async(T,I)=>{let R=!1;F.setCancel(()=>{R||(R=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:T})}).catch(()=>{}))});try{for(;;){await new Promise(M=>setTimeout(M,400));let S=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:T})}),E=await S.json().catch(()=>({}));if(!S.ok||E.ok!==!0){if(R)return"canceled";throw new Error(String(E.error||"HTTP "+S.status))}let L=E.job;if(L===null||typeof L!="object")throw new Error("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001");if(L.state==="running"){let M=typeof L.current=="string"&&L.current!==""?L.current:I;_("\u4F20\u8F93 "+M+"\u2026","busy"),Number.isFinite(L.total)&&L.total>0?F.set(Number(L.bytes)||0,L.total):F.pulse(Number(L.bytes)||0);continue}if(L.state==="canceled")return"canceled";if(L.state!=="done")throw new Error(String(L.error||"\u4F20\u8F93\u5931\u8D25"));return"done"}}finally{F.setCancel(null)}};i.addEventListener("mousedown",T=>{T.target===i&&At()}),i.appendChild(l),document.body.appendChild(i),wt=i,w.local.loadDir(""),w.remote.loadDir("")}var wt=null,gi=null;function sd(){let e=gi;if(gi=null,e!==null)try{e.click()}catch{}}function rd(e){let t=new TextEncoder().encode(e),i="";for(let l of t)i+=String.fromCharCode(l);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Je(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],i=e,l=-1;do i/=1024,l+=1;while(i>=1024&&l<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[l]}function lr(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],i=e,l=-1;do i/=1024,l+=1;while(i>=1024&&l<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[l]+"/s"}function sa(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let i=l=>String(l).padStart(2,"0");return t.getFullYear()+"-"+i(t.getMonth()+1)+"-"+i(t.getDate())+" "+i(t.getHours())+":"+i(t.getMinutes())}function ra(e){let t=String(e).replace(/\/+$/,""),i=t.lastIndexOf("/");return i<=0?"/":t.slice(0,i)}function ci(e,t){return e.endsWith("/")?e+t:e+"/"+t}function na(){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 l=document.createElement("span");l.className="tt_sftpPct",l.textContent="";let h=document.createElement("button");h.type="button",h.className="tt_sftpCancel",h.title="\u53D6\u6D88\u4F20\u8F93",h.textContent="\u2715",h.style.display="none";let s=null;h.addEventListener("click",p=>{p.stopPropagation();let c=s;c!==null&&(h.disabled=!0,c())}),e.appendChild(t),e.appendChild(l),e.appendChild(h);let r=p=>{l.textContent=p},o="",_=-1,n=p=>{p!==o&&(o=p,l.textContent=p)},f=p=>{let c=Math.round(p);c!==_&&(_=c,i.style.width=c+"%")},v=()=>{s=null,gi===h&&(gi=null),h.style.display="none",h.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,o="",_=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,i.style.width="0%",l.textContent="",v()},setCancel(p){if(p==null){v();return}s=p,gi=h,h.disabled=!1,h.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let d=Date.now();if(this._last!==void 0&&d>this._lastAt){let a=(p-this._last)/((d-this._lastAt)/1e3);this._rate=this._rate===void 0?a:this._rate*.7+a*.3}if(this._last=p,this._lastAt=d,Number.isFinite(c)&&c>0){let a=Math.min(100,Math.max(0,p/c*100));f(a);let u=this._rate!==void 0&&this._rate>=0?lr(this._rate):"";n(Math.round(a)+"%"+(u!==""?" \xB7 "+u:""))}else{i.style.width="";let a=this._rate!==void 0&&this._rate>=0?lr(this._rate):"";n(Je(p)+(a!==""?" \xB7 "+a:""))}},pulse(p){e.dataset.active="",delete e.dataset.state,i.style.width="45%",i.style.transition="none",setTimeout(()=>{i.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let a=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?a:this._rate*.7+a*.3}this._last=p,this._lastAt=c;let d=this._rate!==void 0&&this._rate>=0?lr(this._rate):"";n((Number.isFinite(p)?Je(p):"\u2026")+(d!==""?" \xB7 "+d:""))},done(p){e.dataset.active="",e.dataset.state="done",i.style.width="100%",_=100,v(),n(p!==void 0&&p!==""?p:"\u5B8C\u6210")},fail(p){e.dataset.active="",e.dataset.state="error",v(),n(p!==void 0&&p!==""?p:"\u5931\u8D25")},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",o="",l.textContent=""):(e.dataset.active="",i.style.width="",_=-1,n(p))}}}async function oa(e,t,i,l=0,h=null){let s=l>0?l*1024*1024:0,r=typeof AbortController=="function"?new AbortController:null,o=!1;r!==null&&(t={...t,signal:r.signal},typeof h=="function"&&h(()=>{o=!0,r.abort()}));let _=await fetch(e,t);if(!_.ok){let d="HTTP "+_.status;try{let a=await _.json();a!==null&&typeof a=="object"&&typeof a.error=="string"&&(d=a.error)}catch{}throw new Error(d)}let n=Number(_.headers.get("content-length")),f=Number.isFinite(n)&&n>0;if(s>0&&f&&n>s){try{await _.body?.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Je(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}let v=_.body;if(v===null||typeof v.getReader!="function"){let d=await _.blob();if(s>0&&d.size>s)throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Je(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync");return f&&i(n,n),d}let w=v.getReader(),p=[],c=0;try{for(;;){let{done:d,value:a}=await w.read();if(d)break;if(a!==void 0&&a.byteLength>0){if(c+=a.byteLength,s>0&&c>s){try{await w.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Je(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}p.push(a),i(c,f?n:NaN)}}}catch(d){if(o||d!==null&&typeof d=="object"&&d.name==="AbortError"){try{await w.cancel()}catch{}throw new Jt}throw d}return new Blob(p,{type:"application/octet-stream"})}var Jt=class extends Error{constructor(){super("\u5DF2\u53D6\u6D88"),this.name="TransferCanceledError"}};function fr(e){return e instanceof Jt}function aa(e,t){let i=URL.createObjectURL(e),l=document.createElement("a");l.href=i,l.download=t,l.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}async function nd(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],i=[];for(let n of t){let f=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():null;f!==null&&i.push(f)}if(i.length===0)return[...e.files??[]].map(n=>({relPath:n.name,file:n}));let l=[],h=bt.maxUploadFiles,s=bt.maxUploadMb>0?bt.maxUploadMb*1024*1024:0,r=()=>h>0&&l.length>=h,o=0,_=(n,f)=>new Promise(v=>{if(r()){v();return}if(n.isFile===!0){n.file(c=>{s>0&&o+(c.size??0)>s?l._limitExceeded=!0:(l.push({relPath:f+n.name,file:c}),o+=c.size??0),v()},()=>v());return}if(n.isDirectory!==!0){v();return}let w=n.createReader(),p=()=>{w.readEntries(async c=>{if(c.length===0){v();return}for(let d of c){if(r())break;await _(d,f+n.name+"/")}if(r()){v();return}p()},()=>v())};p()});for(let n of i)await _(n,"");return l}function Er(e){if(wt!==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 D of["host","username","auth","keyPath","passphrase","password"])typeof t[D]=="string"&&t[D]!==""&&(i[D]=t[D]);let z=Number(t.port);Number.isInteger(z)&&z>=1&&z<=65535&&(i.port=z),t.agentForward===!0&&(i.agentForward=!0)}let l=i.name??(i.username!==void 0?i.username+"@"+String(i.host??""):String(i.host??""));if(Xo==="dual"){id(i,l);return}let h=document.createElement("div");h.className="tt_sshBackdrop";let s=document.createElement("div");s.className="tt_sftpCard";let r=document.createElement("div");r.className="tt_sftpTitleRow";let o=document.createElement("div");o.className="tt_sshTitle",o.innerHTML=mi+"<span></span>",o.lastElementChild.textContent="SFTP \xB7 "+l;let _=document.createElement("button");_.type="button",_.className="tt_close",_.title="\u5173\u95ED",_.innerHTML=mr,_.addEventListener("click",At),r.appendChild(o),r.appendChild(_),s.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 v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.innerHTML=wr+"<span>\u5237\u65B0</span>";let w=document.createElement("button");w.type="button",w.className="tt_toolBtn",w.innerHTML=jo+"<span>\u65B0\u5EFA\u76EE\u5F55</span>";let p=document.createElement("button");p.type="button",p.className="tt_toolBtn",p.innerHTML=Ph+"<span>\u4E0A\u4F20</span>",p.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let c=document.createElement("input");c.type="file",c.multiple=!0,c.style.display="none",n.appendChild(f),n.appendChild(v),n.appendChild(w),n.appendChild(p),s.appendChild(n),s.appendChild(c);let d=document.createElement("div");d.className="tt_sftpEditor",d.style.display="none";let a=document.createElement("input");a.type="text",a.className="tt_cardInput",a.spellcheck=!1,a.autocomplete="off";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u786E\u5B9A";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.textContent="\u53D6\u6D88",d.appendChild(a),d.appendChild(u),d.appendChild(g),s.appendChild(d);let C=null,b=()=>{d.style.display="none",C=null};u.addEventListener("click",()=>{C?.()}),g.addEventListener("click",b),a.addEventListener("keydown",z=>{z.key==="Enter"?(z.preventDefault(),C?.()):z.key==="Escape"&&(z.stopPropagation(),b())});let y=document.createElement("div");y.className="tt_sftpList",s.appendChild(y);let m=document.createElement("div");m.className="tt_sftpFoot";let k=document.createElement("div");k.className="tt_sftpStatus";let B=na();m.appendChild(B.el),m.appendChild(k),s.appendChild(m);let P={path:"",busy:!1},H=(z,D)=>{k.textContent=z,D===void 0?delete k.dataset.state:k.dataset.state=D},A=z=>{P.busy=z;for(let D of[v,w,p])D.disabled=z;f.disabled=z},F=async(z,D)=>{let x=await fetch("/api/dsh-tty/sftp/"+z,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,...D})}),N=await x.json().catch(()=>({}));if(!x.ok||N.ok!==!0)throw new Error(String(N.error||"HTTP "+x.status));return N},O=async(z,D)=>{if(!P.busy){A(!0),H(z,"busy");try{await D()}catch(x){H(String(x&&x.message?x.message:x),"error")}finally{A(!1)}}},T=(z,D,x,N)=>{let W=document.createElement("button");W.type="button",W.className="tt_sftpRow";let j=document.createElement("span");j.className="tt_sftpIcon",j.innerHTML=z,N!==void 0&&(j.dataset.kind=N);let G=document.createElement("span");if(G.className="tt_sftpName",G.textContent=D,G.title=D,W.appendChild(j),W.appendChild(G),x!==""){let Z=document.createElement("span");Z.className="tt_sftpMeta",Z.textContent=x,W.appendChild(Z)}return W},I=(z,D,x,N)=>{let W=document.createElement("button");W.type="button",W.className="tt_sftpAct",W.innerHTML=D,W.title=x,W.addEventListener("click",j=>{j.stopPropagation(),N()}),z.appendChild(W)},R=(z,D,x)=>{let N=document.createElement("button");N.type="button",N.className="tt_sftpAct",N.innerHTML=zt,N.title="\u5220\u9664 "+D.name+(D.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let W=null;N.addEventListener("click",j=>{if(j.stopPropagation(),!P.busy){if(W!==null){clearTimeout(W),W=null,N.innerHTML=zt,delete N.dataset.danger,O("\u5220\u9664 "+D.name+"\u2026",async()=>{await F("remove",{path:x,recursive:D.isDir===!0}),await E(P.path),H("\u5DF2\u5220\u9664 "+D.name)});return}N.textContent="\u786E\u8BA4?",N.dataset.danger="",W=setTimeout(()=>{W=null,N.innerHTML=zt,delete N.dataset.danger},4e3)}}),z.appendChild(N)},S=z=>{if(y.textContent="",P.path!==""&&P.path!=="/"){let x=T(Uo,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");x.addEventListener("click",()=>{O("\u52A0\u8F7D\u4E2D\u2026",()=>E(ra(P.path)))}),y.appendChild(x)}let D=Array.isArray(z)?z:[];if(D.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 D){if(x===null||typeof x!="object"||typeof x.name!="string"||x.name==="")continue;let N=ci(P.path,x.name),W=[];x.isDir===!0?W.push("\u76EE\u5F55"):W.push(Je(Number(x.size))||"\u2014");let j=sa(Number(x.mtime));j!==""&&W.push(j);let G=T(x.isDir?mi:x.isSymlink?$o:Wo,x.name,W.join(" \xB7 "),x.isDir===!0?"dir":x.isSymlink===!0?"link":"file");x.isDir===!0?G.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest(".tt_sftpAct")!==null||O("\u52A0\u8F7D\u4E2D\u2026",()=>E(N))}):(G.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest(".tt_sftpAct")!==null||L(x,N)}),I(G,zo,"\u4E0B\u8F7D "+x.name,()=>{L(x,N)})),I(G,br,"\u91CD\u547D\u540D "+x.name,()=>{a.placeholder="\u65B0\u540D\u79F0",a.value=x.name,d.style.display="",a.focus(),a.select(),C=async()=>{let Z=a.value.trim();Z===""||Z===x.name||(b(),await O("\u91CD\u547D\u540D "+x.name+"\u2026",async()=>{await F("rename",{from:N,to:ci(P.path,Z)}),await E(P.path)}))}}),R(G,x,N),y.appendChild(G)}},E=async z=>{try{let D=await F("list",{path:z??P.path});P.path=typeof D.path=="string"&&D.path!==""?D.path:"/",f.value=P.path;let x=Array.isArray(D.entries)?D.entries.length:0;S(D.entries),H(P.path+" \u2014 "+String(x)+" \u9879")}catch(D){H(String(D&&D.message?D.message:D),"error")}},L=(z,D)=>O("\u4E0B\u8F7D "+z.name+"\u2026",async()=>{B.reset();let x;try{x=await oa("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,path:D})},(N,W)=>{B.set(N,W)},bt.maxDownloadMb,N=>B.setCancel(N))}catch(N){if(fr(N)){B.reset(),H("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+z.name);return}throw B.fail("\u4E0B\u8F7D\u5931\u8D25"),N}B.done("\u5B8C\u6210"),aa(x,z.name),setTimeout(()=>B.reset(),1500),H("\u5DF2\u4E0B\u8F7D "+z.name+"\uFF08"+(Je(x.size)||String(x.size)+" B")+"\uFF09")}),M=(z,D,x,N,W)=>new Promise((j,G)=>{let Z=rd(JSON.stringify({...i,path:ci(P.path,D)})),K=new XMLHttpRequest;W.abort=()=>{W.stopped=!0,K.abort()},K.open("POST","/api/dsh-tty/sftp/upload"),K.setRequestHeader("x-dsh-sftp-meta",Z);let X=N>1?String(x)+"/"+String(N)+" ":"";H("\u4E0A\u4F20 "+X+D,"busy"),K.upload.addEventListener("progress",ne=>{ne.lengthComputable?B.set(ne.loaded,ne.total):B.pulse(0)});let te=!1,Q=ne=>{te||(te=!0,ne===null?j():G(ne))};K.addEventListener("load",()=>{if(K.status===200){N===1&&B.done("\u4E0A\u4F20\u5B8C\u6210"),Q(null);return}if(W.stopped)return;B.fail("\u4E0A\u4F20\u5931\u8D25");let ne="HTTP "+K.status;try{let ce=JSON.parse(K.responseText);ce!==null&&typeof ce=="object"&&typeof ce.error=="string"&&(ne=ce.error)}catch{}Q(new Error(ne))}),K.addEventListener("error",()=>{if(W.stopped){Q(new Jt);return}B.fail("\u4E0A\u4F20\u5931\u8D25"),Q(new Error("\u7F51\u7EDC\u9519\u8BEF"))}),K.addEventListener("abort",()=>{Q(new Jt)}),K.send(z)}),U=async z=>O("\u4E0A\u4F20\u4E2D\u2026",async()=>{let D=bt;if(D.maxUploadFiles>0&&z.length>D.maxUploadFiles){H("\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08"+String(D.maxUploadFiles)+"\uFF09\uFF1A\u672C\u6B21 "+String(z.length)+" \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","error"),B.fail("\u8D85\u9650");return}let x=D.maxUploadMb>0?D.maxUploadMb*1024*1024:0,N=z.find(K=>x>0&&(K.file?.size??0)>x);if(N!==void 0){H("\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08"+Je(x)+"\uFF09\uFF1A"+String(N.relPath??"")+"\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error"),B.fail("\u8D85\u9650");return}if(z._limitExceeded===!0){H("\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"),B.fail("\u8D85\u9650");return}let W=new Set;for(let K of z){let X=K.relPath.lastIndexOf("/");if(X<=0)continue;let te=K.relPath.slice(0,X);W.has(te)||(W.add(te),await F("mkdir",{path:ci(P.path,te),parents:!0}).catch(()=>{}))}B.reset();let j={stopped:!1,abort:null};B.setCancel(()=>j.abort?.());let G=0,Z=0;try{for(let K of z){if(j.stopped)break;G+=1,j.abort=null;try{await M(K.file,K.relPath,G,z.length,j),Z+=1}catch(X){if(fr(X)||j.stopped)break;throw X}}}finally{B.setCancel(null)}if(j.stopped){B.reset(),H("\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 "+String(Z)+"/"+String(z.length)+" \u4E2A\uFF09"),await E(P.path);return}B.done("\u5168\u90E8\u5B8C\u6210"),setTimeout(()=>B.reset(),1500),H("\u4E0A\u4F20\u5B8C\u6210 "+String(z.length)+" \u4E2A\u6587\u4EF6"),await E(P.path)});v.addEventListener("click",()=>{O("\u52A0\u8F7D\u4E2D\u2026",()=>E(P.path))}),w.addEventListener("click",()=>{P.busy||(a.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",a.value="",d.style.display="",a.focus(),C=async()=>{let z=a.value.trim();z!==""&&(b(),await O("\u521B\u5EFA\u76EE\u5F55 "+z+"\u2026",async()=>{await F("mkdir",{path:ci(P.path,z)}),await E(P.path)}))})}),p.addEventListener("click",()=>{P.busy===!1&&c.click()}),c.addEventListener("change",()=>{let z=[...c.files??[]].map(D=>({relPath:D.name,file:D}));c.value="",z.length>0&&U(z)});let q=0,Y=z=>{z?y.dataset.drag="":delete y.dataset.drag};s.addEventListener("dragenter",z=>{z.preventDefault(),q+=1,Y(!0)}),s.addEventListener("dragover",z=>{z.preventDefault()}),s.addEventListener("dragleave",()=>{q=Math.max(0,q-1),q===0&&Y(!1)}),s.addEventListener("drop",z=>{z.preventDefault(),q=0,Y(!1),!P.busy&&nd(z.dataTransfer).then(D=>{(D.length>0||D._limitExceeded===!0)&&U(D)})}),f.addEventListener("keydown",z=>{if(z.key!=="Enter"||(z.preventDefault(),P.busy))return;let D=f.value.trim();D!==""&&O("\u52A0\u8F7D\u4E2D\u2026",()=>E(D))}),h.addEventListener("mousedown",z=>{z.target===h&&At()}),h.appendChild(s),document.body.appendChild(h),wt=h,O("\u8FDE\u63A5\u4E2D\u2026",()=>E(""))}function At(){wt!==null&&(sd(),wt.remove(),wt=null)}function la(){if(Ae===null)return;let e=Ae.style.display==="none"||Ae.style.display==="";Ae.style.display=e?"":"none";let t=se!==null?se.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&Ae.focus()}var od={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function ad(e){let t=gt();if(t===void 0||t.search===void 0)return;let i=Ae.value;if(i==="")return;let l={decorations:od};e?t.search.findPrevious(i,l):t.search.findNext(i,l)}function Oo(){ts||se===null||Et!==null||(Et=setTimeout(()=>{Et=null,pr()},pi),pi=Math.min(pi*2,5e3))}function Vt(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function ld(){return kt==="tmux"?{t:"spawn",cwd:Ao(),persist:!0,persistName:xr()}:{t:"spawn",cwd:Ao()}}async function cd(){await ta();let e=jh(),t=zh();if(re.size===0){if(e.length>0||t.length>0){Oe({t:"sessions"});let r=await hr("sessions",4e3),o=new Map;if(r!==null&&Array.isArray(r.list))for(let n of r.list)n!==null&&typeof n=="object"&&n.attachable===!0&&o.set(n.sid,n);let _=new Set;for(let n of e){if(o.has(n.sid))Kh(n);else if(Vt(n.spawnSpec))Do(n);else continue;Vt(n.spawnSpec)&&_.add(n.spawnSpec.persistName)}for(let n of t){let f=n.spawnSpec.persistName;_.has(f)||(Do(n),_.add(f))}Tt()}if(re.size===0){if(await os())return;ns()}return}let i=[...re.values()].filter(r=>!r.exited),l=i.filter(r=>Vt(r.spawnSpec)),h=null;if(l.length>0){Oe({t:"sessions"});let r=await hr("sessions",4e3),o=new Set((r!==null&&Array.isArray(r.list)?r.list:[]).map(_=>_?.sid).filter(_=>typeof _=="string"));h=l.filter(_=>!o.has(_.sid));for(let _ of h)Cr(_.sid)}let s=h!==null?new Set(h.map(r=>r.sid)):new Set;for(let r of i)s.has(r.sid)||Oe({t:"attach",sid:r.sid})}function pr(){if(xe!==null){try{xe.close()}catch{}xe=null}ts=!1,clearTimeout(Et),Et=null,Xi=!0,yt("\u8FDE\u63A5\u4E2D\u2026","");try{xe=new WebSocket(xh())}catch(e){Xi=!1,yt("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),Oo();return}xe.onopen=()=>{Xi=!1,pi=1e3,yt("\u5DF2\u8FDE\u63A5","connected"),cd()},xe.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let i=t.sid;if(t.t==="ready"){let l=typeof t.target=="string"?t.target:"";yt(t.kind==="ssh"?"SSH "+(l!==""?l+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let h=re.get(i);if(h!==void 0){if(h.exited=!1,h.spawned=!0,h.live=!0,h.errored=!1,h.target=l,h.persistTmux=t.persist===!0,t.kind==="ssh"&&l!==""&&!h.label&&(h.label=l,Ze()),vi(),ar(i),hi(h,""),cs(h),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(()=>Vo(150))}wi(),Tt()}}else if(t.t==="data"){let l=re.get(i);l!==void 0&&l.term!==null&&(l.term.write(String(t.d??"")),_d())}else if(t.t==="exit"){let l=re.get(i);if(l!==void 0){l.exited=!0,l.live=!1;let h=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";yt("\u5DF2\u9000\u51FA "+[h,s].filter(Boolean).join(" "),""),vi(),ar(i),hi(l,"\u4F1A\u8BDD\u5DF2\u9000\u51FA","\u70B9\u51FB\u91CD\u65B0\u6253\u5F00","exited"),wi(),Tt()}}else if(t.t==="error")if(yt("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof i=="string"){let l=re.get(i);l!==void 0&&(l.live||(l.errored=!0),vi(),ar(i),hi(l,"\u8FDE\u63A5\u51FA\u9519",String(t.m??"")+" \xB7 \u70B9\u51FB\u91CD\u8BD5","error"))}else hd("\u70B9\u51FB\u91CD\u8BD5")},xe.onclose=()=>{if(Xi=!1,!ts){yt("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of re.values())e.exited||hi(e,"\u8FDE\u63A5\u65AD\u5F00","\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","info");Oo()}},xe.onerror=()=>{}}function hd(e){qt!==null&&(qt.textContent=e)}function dd(){if(se!==null){lt&&ca();return}Fo(),se=document.createElement("div"),se.className="tt_modalBackdrop",se.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+as+'</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)" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+Eh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+kh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+Lh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+Mh+'</button></span><span class="tt_winGroup"><button class="tt_min" title="\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09">'+Dh+'</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">'+mr+'</button></span></div><div class="tt_connbar" data-hidden><div class="tt_connArea"><span class="tt_connDot"></span><span class="tt_connTarget">\u2014</span><span class="tt_connBadge"></span></div><div class="tt_connActions"></div></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(se),Qi=se.querySelector(".tt_status"),Yt=se.querySelector(".tt_statusText"),Lt=se.querySelector(".tt_statusDot"),vt=se.querySelector(".tt_tabs"),di=se.querySelector(".tt_connbar"),ui=se.querySelector(".tt_connDot"),es=se.querySelector(".tt_connTarget"),We=se.querySelector(".tt_connBadge"),_i=se.querySelector(".tt_connActions"),jt=se.querySelector(".tt_body"),qt=se.querySelector(".tt_body > .tt_overlay"),Ae=se.querySelector(".tt_searchInput"),qt.addEventListener("click",()=>{qt.textContent="",pr()});let e=se.querySelector("[data-act=search]");e.addEventListener("click",()=>{la(),Ae.style.display!=="none"&&Ae.focus()}),e.dataset.on="",Ae.addEventListener("keydown",t=>{t.key==="Enter"?(t.preventDefault(),ad(t.shiftKey)):t.key==="Escape"&&(t.stopPropagation(),Ae.style.display="none")}),se.querySelector("[data-act=clear]").addEventListener("click",()=>{let t=gt();t!==void 0&&t.term!==null&&t.term.clear()}),se.querySelector("[data-act=copy]").addEventListener("click",()=>{let t=gt();if(t===void 0||t.term===null)return;let i=t.term.getSelection();i!==""&&navigator.clipboard.writeText(i).catch(()=>{})}),se.querySelector("[data-act=paste]").addEventListener("click",()=>{let t=gt();t!==void 0&&navigator.clipboard.readText().then(i=>{Oe({t:"input",sid:t.sid,d:i})}).catch(()=>{})}),se.querySelector(".tt_min").addEventListener("click",()=>{vr()}),se.querySelector(".tt_close").addEventListener("click",()=>{ds()}),se.addEventListener("mousedown",t=>{t.target===se&&vr()}),document.addEventListener("keydown",ha),fi=new ResizeObserver(()=>{if(lt)return;let t=gt();if(t!==void 0&&t.fit!==void 0){try{t.fit.fit()}catch{return}t.exited||cs(t)}}),fi.observe(jt),Ze(),vi(),pr()}function ud(){Le=document.createElement("div"),Le.className="tt_dock",Le.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",Le.innerHTML='<span class="tt_dockTitle">'+as+'<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>',is=Le.querySelector(".tt_dockCount"),Xt=Le.querySelector(".tt_dockStatus"),Mt=Le.querySelector(".tt_dockDot");let e=[...re.values()].filter(t=>!t.exited).length;is.textContent=re.size>0?"\xB7 "+e+"/"+re.size:"",Yt!==null&&(Xt.textContent=Yt.textContent),Lt!==null&&(Mt.dataset.state=Lt.dataset.state??""),Le.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),ds();return}ca()}),document.body.appendChild(Le)}function vr(){se===null||lt||(Xe(),pt(),At(),lt=!0,Ae!==null&&(Ae.style.display="none"),se.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?wi():(ud(),Le.classList.add("tt_dockCompact")))}function wi(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!lt){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.dataset.minimized="",e.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let i=[...re.values()].filter(h=>!h.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=i+"/"+re.size;let l=t.querySelector(".tt_sidebarBadgeDot");l!==null&&Lt!==null&&(l.dataset.state=Lt.dataset.state??"")}function _d(){if(!lt)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Mt;e!==null&&(e.dataset.active="",clearTimeout(ss),ss=setTimeout(()=>{delete e.dataset.active},900))}function ca(){if(se===null||!lt)return;lt=!1,delete se.dataset.minimized,clearTimeout(ss),Le!==null&&(Le.remove(),Le=null),is=null,Xt=null,Mt=null,wi();let e=gt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&cs(e)}e!==void 0&&e.term!==null&&e.term.focus()}function ds(){if(se!==null){if(ts=!0,lt=!1,Xe(),pt(),At(),clearTimeout(ss),clearTimeout(Et),Et=null,pi=1e3,Le!==null&&(Le.remove(),Le=null),is=null,Xt=null,Mt=null,wi(),xe!==null){for(let e of re.values())e.exited||Oe({t:"kill",sid:e.sid});try{xe.close()}catch{}xe=null}fi!==null&&(fi.disconnect(),fi=null);for(let e of re.values())if(e.term!==null)try{e.term.dispose()}catch{}re.clear(),Rt=null,document.removeEventListener("keydown",ha),se.remove(),se=null,Qi=null,Yt=null,Lt=null,vt=null,di=null,ui=null,es=null,We=null,_i=null,dr(),jt=null,qt=null,Ae=null,ls=0;try{sessionStorage.removeItem(rs)}catch{}}}function ha(e){if(e.key==="Escape"&&se!==null){if(e.preventDefault(),wt!==null){At();return}if(Kt!==null){pt();return}if($e!==null){Xe();return}vr()}}function fd(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function pd(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 vd(){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">'+as+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),dd()}),e}function Io(e,t){let i=pd(e);if(i===void 0)return!1;if(t.parentElement!==e){let l=i.closest('[class*="logoRow"]'),h=l!==null&&l.parentElement===e?l: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,h.nextElementSibling)}return!0}function gd(){if(Fo(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=vd(),t,i=!1,l=()=>{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=fd()),t!==void 0&&(i=Io(t,e),i&&s.observe(t,{childList:!0,subtree:!0}))},h=new MutationObserver(()=>{l()});h.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){i=!1,l();return}t.contains(e)||(i=Io(t,e))});return l(),()=>{h.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},i=e("react"),{jsx:l,jsxs:h}=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[o,_]=i.useState(!1),[n,f]=i.useState(null),[v,w]=i.useState(!1),[p,c]=i.useState(!1),[d,a]=i.useState({kind:"",text:""}),[u,g]=i.useState([]),[C,b]=i.useState(!1),y=$=>l("div",{className:"tt_cardSection",children:$}),m=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),bi(V.config)):a({kind:"error",text:String(V.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch($){a({kind:"error",text:String($&&$.message?$.message:$)})}},k=async()=>{try{let V=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();V.ok&&Array.isArray(V.shells)&&g(V.shells)}catch{}};i.useEffect(()=>{o&&!v&&(w(!0),m(),k())},[o]);let B=($,V)=>f(J=>({...J||{},[$]:V})),P=($,V)=>f(J=>({...J||{},sftpLimits:{...J?.sftpLimits??{},[$]:V}})),[H,A]=i.useState(null),[F,O]=i.useState(null),[T,I]=i.useState(""),[R,S]=i.useState({}),[E,L]=i.useState([]),[M,U]=i.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});i.useEffect(()=>{if(!o)return;let $=!0,V=async()=>{try{let oe=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();$&&oe.ok&&Array.isArray(oe.tunnels)&&L(oe.tunnels)}catch{}};V();let J=setInterval(V,2e3);return()=>{$=!1,clearInterval(J)}},[o]);let q=$=>V=>U(J=>({...J||{},[$]:V.target.value})),Y=$=>$?.direction==="remote"?`\u8FDC\u7A0B:${$.remoteHost||"127.0.0.1"}:${String($.remotePort??0)} \u2192 \u672C\u673A:${String($.localTargetPort??0)}`:`\u672C\u673A:${String($?.localPort??0)} \u2192 ${$?.remoteHost??"?"}:${String($?.remotePort??0)}`,z=(n?.sshHosts??[]).find($=>$?.name===M?.bookName),D=async $=>{try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:$})}),J=await V.json().catch(()=>({}));return!V.ok||!J.ok?(a({kind:"error",text:String(J.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(V){return a({kind:"error",text:String(V&&V.message?V.message:V)}),!1}},x=()=>{a({kind:"",text:""});let $=M||{},V=$.bookName||(Array.isArray(n?.sshHosts)?n.sshHosts[0]?.name:"")||"";if(V===""){a({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let J=ve=>{let ae=Number(ve);return Number.isInteger(ae)&&ae>=1&&ae<=65535?ae:0},ee;if($.direction==="remote"){if(ee={name:"",bookName:V,direction:"remote",remotePort:J($.remotePort),localTargetHost:"",localTargetPort:J($.localTargetPort),enabled:!0},ee.remotePort<1||ee.localTargetPort<1){a({kind:"error",text:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09"});return}ee.name=`${V}-R${String(ee.remotePort)}`}else{if(ee={name:"",bookName:V,direction:"local",localPort:J($.localPort),remoteHost:$.remoteHost.trim(),remotePort:J($.remotePort),enabled:!0},ee.localPort<1||ee.remoteHost===""||ee.remotePort<1){a({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}ee.name=`${V}-L${String(ee.localPort)}`}let oe=new Set((Array.isArray(n?.tunnels)?n.tunnels:[]).map(ve=>ve?.name)),le=ee.name,pe=2;for(;oe.has(le);)le=`${ee.name}-${String(pe)}`,pe+=1;ee.name=le;let ie=[...Array.isArray(n?.tunnels)?n.tunnels:[],ee];f(ve=>({...ve||{},tunnels:ie})),U(ve=>({...ve||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),D(ie).then(ve=>{ve&&a({kind:"ok",text:`\u96A7\u9053\u300C${le}\u300D\u5DF2\u751F\u6548`})})},N=$=>{let V=(Array.isArray(n?.tunnels)?n.tunnels:[]).filter(J=>J?.name!==$);f(J=>({...J||{},tunnels:V})),D(V)},W=($,V)=>{let J=(Array.isArray(n?.tunnels)?n.tunnels:[]).map(ee=>ee?.name===$?{...ee,enabled:V}:ee);f(ee=>({...ee||{},tunnels:J})),D(J)},j=$=>{A($?.name??null),I(""),O({name:$?.name??"",host:$?.host??"",port:String($?.port??22),username:$?.username??"",auth:$?.auth==="key"||$?.auth==="password"?$.auth:"agent",keyPath:$?.keyPath??"",passphrase:$?.passphrase??"",password:$?.password??"",agentForward:$?.agentForward===!0})},G=()=>{A(null),O(null),I("")},Z=()=>{if(F===null)return;let $=F.name.trim(),V=F.host.trim(),J=F.username.trim();if($===""||V===""||J===""){I("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let ee=Number(F.port);if((!Number.isInteger(ee)||ee<1||ee>65535)&&(ee=22),(n?.sshHosts??[]).some(oe=>oe?.name===$&&$!==H)){I("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+$);return}if(F.auth==="key"&&F.keyPath.trim()===""){I("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}f(oe=>({...oe||{},sshHosts:(Array.isArray(oe?.sshHosts)?oe.sshHosts:[]).map(le=>le?.name===H?{name:$,host:V,port:ee,username:J,auth:F.auth,keyPath:F.keyPath.trim(),passphrase:F.passphrase,password:F.password,agentForward:F.agentForward}:le)})),A(null),O(null),I(""),a({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+$+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},K=$=>{H===$&&G(),S(V=>{let J={...V};return delete J[$],J}),f(V=>({...V||{},sshHosts:(Array.isArray(V?.sshHosts)?V.sshHosts:[]).filter(J=>J?.name!==$)}))},X=async $=>{let V=$?.name??"";if(V==="")return;let J={host:$?.host??"",port:Number($?.port)||22,username:$?.username??"",auth:$?.auth==="key"||$?.auth==="password"?$.auth:"agent",keyPath:$?.keyPath??"",passphrase:$?.passphrase??"",password:$?.password??"",agentForward:$?.agentForward===!0};S(oe=>({...oe,[V]:{running:!0,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}}));let ee=await Qo(J,!0);S(oe=>{let le=oe[V]||{};if(ee.result){let pe=ee.result.auth?.ok===!0;return{...oe,[V]:{running:!1,ok:pe,text:ea(ee.result)}}}return{...oe,[V]:{running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(ee.error||"\u672A\u77E5\u9519\u8BEF")}}})},te=async $=>{let V=(Array.isArray(n?.hostKeys)?n.hostKeys:[]).filter(J=>!(J?.host===$?.host&&Number(J?.port)===Number($?.port)));f(J=>({...J||{},hostKeys:V}));try{let J=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:V})}),ee=await J.json().catch(()=>({}));!J.ok||!ee.ok?a({kind:"error",text:String(ee.error||"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25")}):a({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(J){a({kind:"error",text:String(J&&J.message?J.message:J)})}},Q=async()=>{a({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!V.ok){a({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let J=Array.isArray(V.entries)?V.entries:[],ee=[...Array.isArray(n?.sshHosts)?n.sshHosts:[]],oe=new Set(ee.map(ie=>ie?.name)),le=0,pe=0;for(let ie of J)if(!(ie===null||typeof ie!="object"||typeof ie.name!="string")){if(oe.has(ie.name)){pe+=1;continue}oe.add(ie.name),ee.push({name:ie.name,host:String(ie.host??ie.name),port:Number(ie.port)||22,username:String(ie.username??""),auth:ie.auth==="key"?"key":"agent",keyPath:String(ie.keyPath??""),passphrase:"",password:"",agentForward:!1}),le+=1}f(ie=>({...ie||{},sshHosts:ee})),a(le===0?{kind:"ok",text:pe>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${pe} \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 ${le} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${pe} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch($){a({kind:"error",text:String($&&$.message?$.message:$)})}},ne=async()=>{a({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!V.ok){a({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let J=Array.isArray(V.entries)?V.entries:[],ee=[...Array.isArray(n?.hostKeys)?n.hostKeys:[]],oe=new Set(ee.map(ie=>String(ie?.host??"")+":"+String(ie?.port??22))),le=0,pe=0;for(let ie of J){if(ie===null||typeof ie!="object"||typeof ie.host!="string"||typeof ie.fingerprint!="string")continue;let ve=ie.host+":"+String(ie.port??22);if(oe.has(ve)){pe+=1;continue}oe.add(ve),ee.push({host:ie.host,port:Number(ie.port)||22,fingerprint:ie.fingerprint}),le+=1}if(le===0){a({kind:"ok",text:pe>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${pe} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}f(ie=>({...ie||{},hostKeys:ee}));try{let ie=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:ee})}),ve=await ie.json().catch(()=>({}));if(!ie.ok||!ve.ok){a({kind:"error",text:String(ve.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}a({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${le} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${pe} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(ie){a({kind:"error",text:String(ie&&ie.message?ie.message:ie)})}}catch($){a({kind:"error",text:String($&&$.message?$.message:$)})}},ce=async()=>{c(!0),a({kind:"",text:""});let $={};for(let V of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose"]){let J=(n||{})[V];J!==void 0&&J!==""&&($[V]=J)}$.sshHosts=Array.isArray(n?.sshHosts)?n.sshHosts:[],$.tunnels=Array.isArray(n?.tunnels)?n.tunnels:[],n?.sftpLimits&&typeof n.sftpLimits=="object"&&($.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($)}),J=await V.json();!V.ok||!J.ok?a({kind:"error",text:String(J.error||"\u4FDD\u5B58\u5931\u8D25")}):(a({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),J.config&&(f(J.config),bi(J.config)))}catch(V){a({kind:"error",text:String(V&&V.message?V.message:V)})}c(!1)},Re=()=>{if(F===null)return null;let $=(V,J,ee,oe)=>h("label",{className:"tt_sshRow",children:[l("span",{className:"tt_cardLabel",children:V}),l("input",{className:"tt_cardInput",type:oe??"text",value:F[J]??"",placeholder:ee??"",autoComplete:"off",spellCheck:!1,onChange:le=>O(pe=>({...pe||{},[J]:le.target.value}))})]});return h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_sshGrid",children:[$("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),$("\u7AEF\u53E3","port","22")]}),$("\u4E3B\u673A","host","example.com \u6216 IP"),$("\u7528\u6237\u540D","username","root"),h("label",{className:"tt_sshRow",children:[l("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),h("select",{className:"tt_cardInput",value:F.auth,onChange:V=>O(J=>({...J||{},auth:V.target.value})),children:[l("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),l("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),l("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...F.auth==="key"?[$("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),$("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...F.auth==="password"?[$("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],h("label",{className:"tt_cardRow",children:[l("input",{type:"checkbox",className:"tt_cardCheckbox",checked:F.agentForward===!0,onChange:V=>O(J=>({...J||{},agentForward:V.target.checked}))}),l("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),T!==""?l("span",{className:"tt_cardMessage tt_cardMessageError",children:T}):null,h("div",{className:"tt_cardRow",children:[l("button",{type:"button",className:"tt_cardSave",onClick:Z,children:"\u5E94\u7528"}),l("button",{type:"button",className:"tt_toolBtn",onClick:G,children:"\u53D6\u6D88"})]})]})},ue=($,V,J,ee)=>h("label",{className:"tt_cardField",children:[l("span",{className:"tt_cardLabel",children:$}),l("input",{className:"tt_cardInput",value:n[V]??"",placeholder:J??"",onChange:oe=>B(V,oe.target.value)}),ee?l("span",{className:"tt_cardHint",children:ee}):null]}),Me=($,V)=>h("label",{className:"tt_cardField tt_cardRow",children:[l("input",{type:"checkbox",className:"tt_cardCheckbox",checked:n[V]===!0,onChange:J=>B(V,J.target.checked)}),l("span",{className:"tt_cardLabel",children:$})]});return h("li",{className:o?"tt_card tt_cardOpen":"tt_card",children:[h("button",{type:"button",className:"tt_cardHeader","aria-expanded":o,onClick:()=>_($=>!$),children:[h("span",{className:"tt_cardHeadText",children:[l("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),l("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"})]}),l("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:l("path",{d:s,fill:"currentColor"})})]}),o?h("div",{className:"tt_cardBody",children:[n===null?l("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):h("div",{children:[y("\u57FA\u7840"),Me("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),Me("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),Me("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),y("SFTP \u6587\u4EF6\u4F20\u8F93"),h("div",{className:"tt_cardField",children:[l("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),h("select",{className:"tt_cardInput",value:n.sftpStyle==="dual"?"dual":"dialog",onChange:$=>B("sftpStyle",$.target.value),children:[l("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),l("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),l("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:[l("span",{className:"tt_cardLabel",children:"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09"}),h("div",{className:"tt_limitGrid",children:[h("label",{className:"tt_sshRow",children:[l("span",{className:"tt_cardLabel",children:"\u4E0B\u8F7D\u4E0A\u9650 (MB)"}),l("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxDownloadMb))?Number(n.sftpLimits.maxDownloadMb):1024),onChange:$=>P("maxDownloadMb",Number($.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[l("span",{className:"tt_cardLabel",children:"\u4E0A\u4F20\u4E0A\u9650 (MB)"}),l("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadMb))?Number(n.sftpLimits.maxUploadMb):2048),onChange:$=>P("maxUploadMb",Number($.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[l("span",{className:"tt_cardLabel",children:"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650"}),l("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadFiles))?Number(n.sftpLimits.maxUploadFiles):1e3),onChange:$=>P("maxUploadFiles",Number($.target.value)||0)})]})]}),l("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"})]}),y("\u4F1A\u8BDD"),h("div",{className:"tt_cardField",children:[l("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),h("select",{className:"tt_cardInput",value:n.persistence==="tmux"?"tmux":"off",onChange:$=>B("persistence",$.target.value),children:[l("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),l("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),l("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"}),Me("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),l("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"})]}),ue("\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:$=>{$.currentTarget.contains($.relatedTarget)||b(!1)},children:[l("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),l("input",{className:"tt_cardInput",value:n.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>b(!0),onClick:()=>b(!0),onKeyDown:$=>{$.key==="Escape"&&b(!1)},onChange:$=>{B("shell",$.target.value),b(!0)}}),...C?[l("div",{className:"tt_envList tt_shellList",children:(()=>{let $=(n.shell??"").trim().toLowerCase(),V=$===""?u:u.filter(J=>J.toLowerCase().includes($));return V.length===0?l("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(J=>l("button",{type:"button",className:"tt_envItem",onMouseDown:ee=>ee.preventDefault(),onClick:()=>{B("shell",J),b(!1)},children:J},J))})()},"shell-list")]:[],l("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"),ue("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),ue("COLORTERM","colorTerm","truecolor",""),ue("\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"),ue("\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"),y("SSH \u8FDE\u63A5"),h("div",{className:"tt_cardField",children:[l("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(n.sshHosts)&&n.sshHosts.length>0?[l("div",{className:"tt_hostList",children:n.sshHosts.map($=>h("div",{children:[h("div",{className:"tt_sshHostRow",children:[l("div",{className:"tt_sshHostMeta",children:[l("span",{className:"tt_sshHostName",children:$?.name??""}),l("span",{className:"tt_sshHostTarget",children:ur($??{})})]}),l("button",{type:"button",className:"tt_toolBtn",disabled:R[$?.name]?.running===!0,onClick:()=>{X($)},title:"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD",children:R[$?.name]?.running===!0?"\u6D4B\u8BD5\u4E2D\u2026":"\u6D4B\u8BD5"}),l("button",{type:"button",className:"tt_toolBtn",onClick:()=>j($),children:"\u7F16\u8F91"}),l("button",{type:"button",className:"tt_toolBtn",onClick:()=>K($?.name),children:"\u5220\u9664"})]}),R[$?.name]&&R[$?.name].text?l("div",{className:"tt_sshProbeResult"+(R[$?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:R[$?.name].text}):null,H===$?.name?Re():null]},String($?.name??"")))})]:[l("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:[l("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Q()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),l("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),l("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:[l("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(n.tunnels)&&n.tunnels.length>0?[l("div",{children:n.tunnels.map($=>{let V=E.find(ee=>ee.name===$?.name),J=V?.state??"stopped";return h("div",{className:"tt_sshHostRow",children:[l("span",{className:"tt_tunnelDot","data-state":J,title:J}),l("div",{className:"tt_sshHostMeta",children:[l("span",{className:"tt_sshHostName",children:($?.name??"")+" \xB7 "+Y($??{})}),l("span",{className:"tt_sshHostTarget",children:($?.bookName??"")+(V?.error?" \xB7 "+V.error:"")+(V?.lastForwardError?" \xB7 "+V.lastForwardError:"")})]}),l("input",{type:"checkbox",className:"tt_cardCheckbox",checked:$?.enabled!==!1,title:"\u542F\u7528",onChange:ee=>W($?.name,ee.target.checked)}),l("button",{type:"button",className:"tt_toolBtn",onClick:()=>N($?.name),children:"\u5220\u9664"})]},String($?.name??""))})})]:[l("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:M.direction,onChange:q("direction"),children:[l("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),l("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:M.bookName,onChange:q("bookName"),children:[l("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(n?.sshHosts)?n.sshHosts.map($=>l("option",{value:$?.name??"",children:$?.name??""})):[]]})]}),l("span",{className:"tt_cardHint",children:z!==void 0?"\u7ECF "+ur(z)+" \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"}),M.direction==="local"?h("div",{className:"tt_tunnelGridLocal",children:[l("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:M.localPort,autoComplete:"off",onChange:q("localPort")}),l("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:M.remoteHost,autoComplete:"off",onChange:q("remoteHost")}),l("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:q("remotePort")})]}):h("div",{className:"tt_tunnelGrid",children:[l("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:q("remotePort")}),l("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:M.localTargetPort,autoComplete:"off",onChange:q("localTargetPort")})]}),l("div",{className:"tt_cardRow",children:[l("button",{type:"button",className:"tt_cardSave",onClick:x,children:"\u6DFB\u52A0\u96A7\u9053"}),l("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:[l("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),l("button",{type:"button",className:"tt_toolBtn",onClick:()=>{ne()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(n.hostKeys)&&n.hostKeys.length>0?[l("div",{className:"tt_hostList",children:n.hostKeys.map($=>h("div",{className:"tt_sshHostRow",children:[l("div",{className:"tt_sshHostMeta",children:[l("span",{className:"tt_sshHostName",children:String($?.host??"")+":"+String($?.port??22)}),l("span",{className:"tt_sshHostTarget",children:"sha256:"+String($?.fingerprint??"")})]}),l("button",{type:"button",className:"tt_toolBtn",onClick:()=>{te($)},children:"\u5220\u9664"})]},String($?.host??"")+":"+String($?.port??22)))})]:[l("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"})],l("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:[l("button",{className:"tt_cardSave",disabled:p,onClick:()=>{ce()},children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),l("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=o=>(Go=o.sessions,gd(),o.slots.inject("settings.plugin.item",()=>o.slots.register({name:"settings.plugin.item",key:"tty",order:110},r)),()=>{ds()}),t}});})();
2167
+ `;var Oh="/api/dsh-tty/ws";function Ih(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+Oh}function ur(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var er;function fr(){document.getElementById("dsh-tty-style")||(er=document.createElement("style"),er.id="dsh-tty-style",er.textContent=No+`
2168
+ `+Io,document.head.appendChild(er))}var _r='<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>',Nh='<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>',Hh='<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>',Fh='<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>',Wh='<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>',$h='<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>',Uh='<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>',zh='<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>',jh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4 8h8"/></svg>',Es='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7"/><path d="M11.5 4.5l-7 7"/></svg>',qh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.6v8.8"/><path d="M3.6 8h8.8"/></svg>',gi='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/></svg>',Ko='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 2.6h4.4l3.6 3.6v7.2a.9.9 0 0 1-.9.9H4.9a.9.9 0 0 1-.9-.9V3.5a.9.9 0 0 1 .9-.9z"/><path d="M8.2 2.7v3.4h3.4"/></svg>',Go='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.4 9.6l3.2-3.2"/><path d="M9.2 4.6l1-1a2.5 2.5 0 0 1 3.5 3.5l-1 1"/><path d="M6.8 11.4l-1 1a2.5 2.5 0 0 1-3.5-3.5l1-1"/></svg>',Vo='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 12.6V4.2"/><path d="M4.4 7.8L8 4.2l3.6 3.6"/></svg>',Yo='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v7.2"/><path d="M5 7.4L8 10.4l3-3"/><path d="M3.4 12.8h9.2"/></svg>',Kh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 10.4V3.2"/><path d="M5 6.2L8 3.2l3 3"/><path d="M3.4 12.8h9.2"/></svg>',ks='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.2 2.9l1.9 1.9-7.3 7.3-2.4.5.5-2.4z"/></svg>',jt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4.6h10"/><path d="M6.2 4.6V3.4a.8.8 0 0 1 .8-.8h2a.8.8 0 0 1 .8.8v1.2"/><path d="M4.6 4.6l.6 8a.9.9 0 0 0 .9.8h3.8a.9.9 0 0 0 .9-.8l.6-8"/></svg>',Ls='<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="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',Xo='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/><path d="M8 6.6v3.6"/><path d="M6.2 8.4h3.6"/></svg>',Gh='<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="M3.4 8h9"/><path d="M9.2 4.8L12.4 8l-3.2 3.2"/></svg>',Vh='<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="M12.6 8h-9"/><path d="M6.8 4.8L3.6 8l3.2 3.2"/></svg>',Yh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.4" y="3.2" width="11.2" height="4" rx="1.2"/><rect x="2.4" y="8.8" width="11.2" height="4" rx="1.2"/><path d="M5 5.2h.01"/><path d="M5 10.8h.01"/></svg>',Xh='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.6l5.8 10.4H2.2z"/><path d="M8 6.4v3.2"/><path d="M8 11.6h.01"/></svg>',Jh='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M8 7.2v3.6"/><path d="M8 5.1h.01"/></svg>',Jo='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M6 6l4 4"/><path d="M10 6l-4 4"/></svg>',Zh='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.8v5"/><path d="M11.6 4.6a5.2 5.2 0 1 1-7.2 0"/></svg>',Zo='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5.6" cy="6" r="2.8"/><path d="M7.8 7.9l5.4 5.4"/><path d="M10.6 10.7l1.2-1.2"/></svg>',Qo=null,ce=null,re=null,sr=null,Xt=null,Lt=null,vt=null,di=null,ui=null,nr=null,We=null,fi=null,qt=null,De=null,Kt=null,mi=!1,_i=null,lt=!1,Re=null,or=null,Jt=null,Mt=null,ar=null,Et=null,pi=1e3,lr="dsh-tty:tabs",se=new Map,Ci=new Set,Ms=()=>Ci.size>0,vs=new Set,Rt=null,pr=0,tr=!1,$e=null,Gt=null,St=[],gs=new Set;function vr(e){return gs.add(e),()=>gs.delete(e)}vr(({tab:e,addAction:t})=>{e.exited&&t($h,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>Rs(e.sid))});vr(({tab:e,addAction:t})=>{t(Uh,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>Ds(e.spawnSpec))});vr(({bookName:e,addAction:t})=>{let i=e!==""?la(e):0;i>0&&t(zh,"\u96A7\u9053 "+i,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",o=>hd(o.currentTarget,e))});function yt(e,t){if(Xt===null)return;Xt.textContent=e,Lt.dataset.state=t,sr!==null&&(sr.style.display=t==="connected"?"none":""),Jt!==null&&(Jt.textContent=e),Mt!==null&&(Mt.dataset.state=t);let i=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");i!==null&&(i.dataset.state=t)}function xe(e){ce!==null&&ce.readyState===WebSocket.OPEN&&ce.send(JSON.stringify(e))}function gt(){return Rt!==null?se.get(Rt):void 0}function Ho(){try{let e=Qo?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function Qh(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),xe({t:"refresh",sid:e.sid})}}var ir=null;function ea(e){ir!==null&&clearTimeout(ir),ir=setTimeout(()=>{ir=null;let t=gt();t!==void 0&&Qh(t)},e??200)}function Tt(){try{let e=[...se.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||re===null?sessionStorage.removeItem(lr):sessionStorage.setItem(lr,JSON.stringify(e)),ed([...se.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var ms="dsh-tty:persist-specs";function ed(e){try{let t=e.filter(i=>Ei(i.spawnSpec)).map(i=>({spawnSpec:i.spawnSpec,label:i.label}));t.length===0?localStorage.removeItem(ms):localStorage.setItem(ms,JSON.stringify(t))}catch{}}function td(){try{let e=localStorage.getItem(ms);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&Ei(i.spawnSpec)):[]}catch{return[]}}function id(){try{let e=sessionStorage.getItem(lr);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 cr(e,t){return new Promise(i=>{let o=r=>{let s;try{s=JSON.parse(r.data)}catch{return}s.t===e&&(clearTimeout(h),ce.removeEventListener("message",o),i(s))},h=setTimeout(()=>{ce.removeEventListener("message",o),i(null)},t);ce.addEventListener("message",o)})}function yi(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&xe({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function zt(e,t,i,o){if(e.overlayEl===null||e.overlayEl===void 0)return;let h=e.overlayEl;if(t===""||t===void 0){h.textContent="";return}let r=o==="error"||o==="info"?o:"exited";h.innerHTML='<div class="tt_overlayCard" data-kind="'+r+'"><span class="tt_overlayIcon">'+(r==="error"?Jo:r==="info"?Ls:Zh)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(i===void 0||i===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",h.querySelector(".tt_overlayMain").textContent=t,i!==void 0&&i!==""&&(h.querySelector(".tt_overlayHint").textContent=i)}function rd(e,t){try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i!==""?i:t}catch{return t}}function xi(e){let t=rd("--dsw-alias-state-business-primary","#7c9cff"),i=new jo.Terminal({cursorBlink:!0,cursorStyle:"bar",cursorInactiveStyle:"outline",fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontWeight:400,fontWeightBold:600,lineHeight:1.35,scrollback:5e3,convertEol:!1,allowProposedApi:!0,theme:{background:"#0b0e14",foreground:"#d7dce5",cursor:t,cursorAccent:"#0b0e14",selectionBackground:"rgba(124, 156, 255, .30)",black:"#1b2028",red:"#f07178",green:"#7ec699",yellow:"#e6b673",blue:"#7aa2f7",magenta:"#c792ea",cyan:"#7fdbca",white:"#c8d0dc",brightBlack:"#556070",brightRed:"#ff8b92",brightGreen:"#9fe0b4",brightYellow:"#f5cc8c",brightBlue:"#9ab8ff",brightMagenta:"#dbb3ff",brightCyan:"#a3f0e2",brightWhite:"#eef2f8"}}),o=new qo.FitAddon,h=new dn;i.loadAddon(o),i.loadAddon(h),i.loadAddon(new un);let r=document.createElement("div");r.className="tt_term";let s=document.createElement("div");s.className="tt_overlay",s.addEventListener("click",()=>{s.textContent="",Rs(e.sid)}),r.appendChild(s),i.open(r);try{o.fit()}catch{}try{let a=new Oo;a.onContextLoss(()=>{try{a.dispose()}catch{}}),i.loadAddon(a)}catch{}i.onData(a=>{xe({t:"input",sid:e.sid,d:a})}),i.onResize(()=>{Ei(e.spawnSpec)&&ea(200)}),i.attachCustomKeyEventHandler(a=>e.embedded===!0?!0:(a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="f"?(a.preventDefault(),ma(),!1):!0),e.term=i,e.fit=o,e.search=h,e.termEl=r,e.overlayEl=s}function bi(e,t){let i=ur(),o={sid:i,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??yd(),label:t};return xi(o),se.set(i,o),pr+=1,Ze(),Qt(i),gr(o),Tt(),o}function sd(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};xi(t),se.set(t.sid,t),pr+=1,Ze(),Qt(t.sid),xe({t:"attach",sid:t.sid})}function gr(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0,i={...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24};if(ce===null||ce.readyState!==WebSocket.OPEN){vs.add({tab:e,frame:i});return}xe(i)}function Fo(e){let t={sid:ur(),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};xi(t),se.set(t.sid,t),pr+=1,Ze(),Qt(t.sid),gr(t)}function Rs(e){let t=se.get(e);if(t===void 0)return;if(t.embedded===!0){sa(t);return}let i=t.spawnSpec,o=t.label;if(t.exited||xe({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),se.delete(e);let h={sid:ur(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:i,label:o};xi(h),se.set(h.sid,h),Ze(),Qt(h.sid),gr(h),Tt()}function nd(e){let t=se.get(e);if(t!==void 0){if(t.exited||xe({t:"kill",sid:e}),se.delete(e),Ci.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),Rt===e){Rt=null;let i=[...se.keys()].pop()??null;i!==null&&Qt(i)}Ze(),[...se.values()].some(i=>i.embedded!==!0)?Tt():mr()}}function ta(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error("ttyTerminal \u9700\u8981 command");if(/[\r\n\0]/.test(t))throw new Error("command \u5FC5\u987B\u662F\u5355\u884C");return t}function ia(e,t){return typeof e?.book=="string"&&e.book!==""?{t:"ssh",name:e.book,command:t}:e?.spec!==null&&typeof e?.spec=="object"?{t:"ssh",...e.spec,command:t}:{t:"spawn",...typeof e?.cwd=="string"&&e.cwd!==""?{cwd:e.cwd}:{},command:t}}function od(e){let t=e.controller;t===void 0||t.observer!==null||(t.observer=new ResizeObserver(()=>{if(!(t.disposed||t.tab!==e||e.term===null)){try{e.fit.fit()}catch{return}e.spawned&&!e.exited&&yi(e)}}),t.observer.observe(t.hostEl))}function ra(e,t,i){let o={sid:ur(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:i};return xi(o),se.set(o.sid,o),Ci.add(o.sid),e.hostEl.appendChild(o.termEl),od(o),gr(o),o}function sa(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||xe({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),se.delete(e.sid),Ci.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=ra(t,e.spawnSpec,e.label),t.tab}}function ad(e,t){if(!(e instanceof HTMLElement))throw new Error("ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9");let i=ta(t),o=ia(t,i),h=typeof t?.label=="string"&&t.label!==""?t.label:void 0;fr();let r={hostEl:e,tab:null,observer:null,disposed:!1};return r.tab=ra(r,o,h),xd(),()=>ld(r)}function ld(e){if(e.disposed)return;e.disposed=!0,e.observer!==null&&(e.observer.disconnect(),e.observer=null);let t=e.tab;if(t!==null){t.exited||xe({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),se.delete(t.sid),Ci.delete(t.sid),e.tab=null}if(re===null&&!Ms()&&ce!==null){mi=!0;try{ce.close()}catch{}ce=null}}function Qt(e){let t=se.get(e);if(t!==void 0){Rt=e;for(let[i,o]of se)o.embedded!==!0&&o.termEl!==null&&(o.termEl.style.display=i===e?"":"none");t.embedded!==!0&&qt!==null&&t.termEl!==null&&t.termEl.parentElement!==qt&&qt.appendChild(t.termEl),Ze(),Vt();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&yi(t),zt(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA":"",t.exited?"\u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"","exited")}}function _s(e){if(vt===null)return;let t=se.get(e);if(t===void 0)return;let o=vt.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");o!=null&&(o.dataset.state=t.exited?"exited":t.live===!0?"connected":t.errored===!0?"error":"connecting")}function Ze(){if(vt===null)return;vt.textContent="";for(let[t,i]of se){if(i.embedded===!0)continue;let o=document.createElement("button");o.className="tt_tab",o.dataset.sid=t,t===Rt&&(o.dataset.active="");let h=document.createElement("span");h.className="tt_tabDot",h.dataset.state=i.exited?"exited":i.live===!0?"connected":i.errored===!0?"error":"connecting",o.appendChild(h);let r=document.createElement("span");r.className="tt_tabLabel",r.textContent=i.label||"\u7EC8\u7AEF "+na(t),r.addEventListener("dblclick",a=>{a.stopPropagation(),dd(t,o)});let s=document.createElement("span");s.className="tt_tabClose",s.title="\u5173\u95ED",s.textContent="\u2715",o.title=r.textContent,o.appendChild(r),o.appendChild(s),o.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),nd(t);return}Qt(t)}),vt.appendChild(o)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.innerHTML=qh,e.addEventListener("click",()=>{_d(e)}),vt.appendChild(e)}function cd(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 Vt(){if(di===null||nr===null||fi===null||ui===null)return;fi.textContent="";let e=gt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){di.dataset.hidden="";return}delete di.dataset.hidden;let i=Number(t.port);nr.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:""),We!==null&&(e.persistTmux===!0?(We.textContent="tmux",We.dataset.state="ok",We.title="\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A"):t.persist===!0&&e.spawned===!0?(We.textContent="\u672A\u6301\u4E45\u5316",We.dataset.state="warn",We.title="\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD"):(We.textContent="",delete We.dataset.state,We.removeAttribute("title")));let o=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";ui.dataset.state=o,ui.title=o==="connected"?"\u5DF2\u8FDE\u63A5":o==="connecting"?"\u8FDE\u63A5\u4E2D":o==="error"?"\u8FDE\u63A5\u51FA\u9519":"\u4F1A\u8BDD\u5DF2\u9000\u51FA";let h=(s,a,f,n)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=f,_.innerHTML=s+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",n),fi.appendChild(_)},r=typeof t.name=="string"?t.name:"";for(let s of gs)try{s({tab:e,spec:t,bookName:r,addAction:h})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}var xt=null,rr=null;function bs(){rr!==null&&(document.removeEventListener("mousedown",rr,!0),rr=null),xt!==null&&(xt.remove(),xt=null)}function hd(e,t){if(xt!==null){bs();return}let i=document.createElement("div");i.className="tt_tunnelPop";let o=document.createElement("div");o.className="tt_tunnelPopTitle",o.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,i.appendChild(o);let h=document.createElement("div");h.textContent="\u52A0\u8F7D\u4E2D\u2026",i.appendChild(h);let r=document.createElement("span");r.className="tt_cardHint",r.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(r),document.body.appendChild(i),xt=i;let s=e.getBoundingClientRect();i.style.top=String(s.bottom+6)+"px",i.style.left=String(Math.max(8,s.right-340))+"px";let a=f=>{xt===i&&(i.contains(f.target)||e.contains(f.target)||bs())};rr=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let f=[];try{let v=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();v.ok&&Array.isArray(v.tunnels)&&(f=v.tunnels)}catch{}if(xt!==i)return;h.textContent="";let n=Ts.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",h.appendChild(_);return}for(let _ of n){let v=f.find(l=>l?.name===_?.name),w=v?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=w==="active"?"connected":w==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(v?.error??v?.lastForwardError??""),d.textContent=cd(_)+" \xB7 "+w,p.appendChild(c),p.appendChild(d),h.appendChild(p)}})()}function na(e){let t=1;for(let i of se.keys()){if(i===e)return String(t);t+=1}return String(t)}function dd(e,t){let i=se.get(e);if(i===void 0||t.querySelector(".tt_tabRename")!==null)return;let o=t.querySelector(".tt_tabLabel");if(o===null)return;let h=document.createElement("input");h.className="tt_tabRename",h.value=i.label||"\u7EC8\u7AEF "+na(e),o.replaceWith(h),h.focus(),h.select();let r=!1,s=()=>{if(r)return;r=!0;let f=h.value.trim();i.label=f!==""?f:void 0,Ze(),Tt()},a=()=>{r||(r=!0,Ze())};h.addEventListener("keydown",f=>{f.stopPropagation(),f.key==="Enter"?s():f.key==="Escape"&&a()}),h.addEventListener("blur",s),h.addEventListener("click",f=>f.stopPropagation())}var Ts=[],oa="dialog",kt="off",bt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},Yt=null,mt=null;function wi(e){e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(St=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(Ts=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(oa=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(kt=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(bt={...bt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(Yt=e.maxSessions)}function ud(e,t){let i=t==="error"||t==="info"?t:"warn",o=document.createElement("div");o.className="tt_toast",o.dataset.kind=i,o.innerHTML='<span class="tt_toastIcon">'+(i==="error"?Jo:i==="info"?Jh:Xh)+'</span><span class="tt_toastText"></span>',o.lastElementChild.textContent=e,document.body.appendChild(o),setTimeout(()=>o.remove(),4e3)}async function aa(){try{xe({t:"sessions"});let e=await cr("sessions",3e3);if(e!==null&&Array.isArray(e.list))return mt=e.list.length,mt}catch{}return null}async function hr(){if(await aa(),Yt===null||mt===null||mt<Yt)return null;let e=[...se.values()].filter(o=>!o.exited).length,t=Math.max(0,mt-e),i=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${mt} \u4E2A / \u4E0A\u9650 ${Yt}\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 ud(i),i}function fd(){return Yt!==null&&mt!==null&&mt>=Yt}function As(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function la(e){return Ts.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function ws(e){let t=Number(e?.port),i=Number.isInteger(t)&&t!==22?":"+t:"",o=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",h=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+i+" \xB7 "+o+h}async function ca(e,t){let i=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),o=await i.json().catch(()=>({}));return o&&o.ok===!1&&o.error?{error:String(o.error)}:o&&o.result?{result:o.result}:{error:String(o&&o.error?o.error:"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP "+i.status+"\uFF09")}}function ha(e,t){if(!e)return"\u8FDE\u63A5\u6D4B\u8BD5\u2026";let i=e,o=typeof i.tcp?.ms=="number"?i.tcp.ms:null,h=typeof i.auth?.ms=="number"?i.auth.ms:null,r=[];i.tcp?.ok&&r.push("TCP "+(o!==null?o+"ms":"\u901A")),i.banner?.ok&&r.push("banner \u6B63\u5E38");let s=i.hostkey?.state;if(s==="matched"?r.push("\u4E3B\u673A\u5BC6\u94A5\u5339\u914D"):s==="recorded"?r.push("\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09"):s==="mismatch"&&r.push("\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01"),i.auth?.ok)return"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A"+(h!==null?"\u8BA4\u8BC1\u901A\u8FC7\uFF08"+h+"ms\uFF09":"\u8BA4\u8BC1\u901A\u8FC7")+(r.length?" \xB7 "+r.join(" \xB7 "):"");let a=i.auth?.error||i.tcp?.error||"\u672A\u77E5\u9519\u8BEF";return(t?.prefix||"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A")+a+(r.length?" \xB7 "+r.join(" \xB7 "):"")}async function da(){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=St;wi(t.config),$e!==null&&St!==i&&Ss($e)}}catch{}}function ua(e){$e!==null&&(e.target instanceof Element&&($e.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||Xe())}function _d(e){if($e!==null){Xe();return}da(),aa().then(()=>{$e!==null&&Ss($e)});let t=document.createElement("div");t.className="tt_addMenu",$e=t,Ss(t),document.body.appendChild(t);let i=e.getBoundingClientRect(),o=t.offsetWidth,r=i.left+o>window.innerWidth-8?i.right-o:i.left;t.style.left=Math.max(8,Math.min(r,window.innerWidth-o-8))+"px",t.style.top=i.bottom+6+"px",document.addEventListener("mousedown",ua,!0)}function Xe(){$e!==null&&(document.removeEventListener("mousedown",ua,!0),$e.remove(),$e=null)}function Wo(e,t,i,o,h,r){let s=document.createElement("button");if(s.type="button",s.className="tt_addMenuItem",h===!0&&(s.setAttribute("data-soldout",""),s.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E"),r!==void 0){let n=document.createElement("span");n.className="tt_addMenuIcon",n.innerHTML=r,s.appendChild(n)}let a=document.createElement("span");a.className="tt_addMenuText";let f=document.createElement("span");if(f.className="tt_addMenuMain",f.textContent=t,a.appendChild(f),i!==""){let n=document.createElement("span");n.className="tt_addMenuSub",n.textContent=i,a.appendChild(n)}s.appendChild(a),s.addEventListener("click",o),e.appendChild(s)}function Ss(e){e.textContent="";let t=fd();Wo(e,"\u672C\u5730\u7EC8\u7AEF",kt==="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 hr()||(Xe(),bi())},t,_r);let i=document.createElement("div");i.className="tt_addMenuSep",e.appendChild(i);let o=document.createElement("div");o.className="tt_addMenuTitle",o.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(o);for(let r of St){if(r===null||typeof r!="object"||typeof r.name!="string"||r.name==="")continue;let s=document.createElement("div");s.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let f=document.createElement("span");f.className="tt_addMenuIcon",f.innerHTML=Yh;let n=document.createElement("span");n.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=r.name;let v=document.createElement("span");v.className="tt_addMenuSub";let w=la(r.name);v.textContent=ws(r)+(w>0?" \xB7 \u21C4"+String(w):""),n.appendChild(_),n.appendChild(v),a.appendChild(f),a.appendChild(n),a.addEventListener("click",async()=>{if(await hr())return;Xe();let d=kt==="tmux"?{persist:!0,persistName:As()}:{};bi({t:"ssh",name:r.name,...d},r.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.innerHTML=gi,p.addEventListener("click",()=>{Xe(),Ds({name:r.name})});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title="\u7F16\u8F91\u8FDE\u63A5",c.innerHTML=ks,c.addEventListener("click",()=>{Xe(),$o(r)}),s.appendChild(a),s.appendChild(p),s.appendChild(c),e.appendChild(s)}if(St.length===0){let r=document.createElement("div");r.className="tt_addMenuTitle",r.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(r)}let h=document.createElement("div");h.className="tt_addMenuSep",e.appendChild(h),Wo(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{Xe(),$o()},!1,Zo)}function $o(e){if(Gt!==null)return;let t=e!==null&&typeof e=="object"?e:null,i=t!==null,o=document.createElement("div");o.className="tt_sshBackdrop";let h=document.createElement("div");h.className="tt_sshCard";let r=document.createElement("div");r.className="tt_sshTitle",r.innerHTML=Zo+"<span></span>",r.lastElementChild.textContent=i?"\u7F16\u8F91\u8FDE\u63A5 \xB7 "+String(t.name??""):"SSH \u8FDE\u63A5",h.appendChild(r);let s=D=>{let x=document.createElement("div");return x.className="tt_sshSection",x.textContent=D,x},a={},f=(D,x,N)=>{let F=document.createElement("label");F.className="tt_sshRow";let j=document.createElement("span");j.className="tt_cardLabel",j.textContent=x,F.appendChild(j);let q;if(N?.select!==void 0){q=document.createElement("select");for(let Z of N.select){let G=document.createElement("option");G.value=Z.value,G.textContent=Z.label,q.appendChild(G)}}else q=document.createElement("input"),q.type=N?.type??"text",q.placeholder=N?.placeholder??"";return q.className="tt_cardInput",q.autocomplete="off",q.spellcheck=!1,F.appendChild(q),a[D]=q,F};h.appendChild(s("\u8FDE\u63A5"));let n=document.createElement("div");n.className="tt_sshGrid",n.appendChild(f("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),n.appendChild(f("port","\u7AEF\u53E3",{placeholder:"22"})),h.appendChild(n),h.appendChild(f("username","\u7528\u6237\u540D",{placeholder:"root"})),h.appendChild(s("\u8BA4\u8BC1")),h.appendChild(f("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 _=f("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),v=f("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),w=f("password","\u5BC6\u7801",{type:"password"}),p=D=>{let x=document.createElement("div");x.className="tt_sshRow";let N=document.createElement("input");N.type="text",N.className="tt_cardInput",N.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",N.autocomplete="off",N.spellcheck=!1;let F=document.createElement("div");F.className="tt_envList",F.dataset.hidden="";let j=[],q=()=>{if(F.textContent="",j.length===0){let X=document.createElement("span");X.className="tt_cardHint",X.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",F.appendChild(X);return}let Z=N.value.trim().toUpperCase(),G=Z===""?j:j.filter(X=>X.toUpperCase().includes(Z));for(let X of G.slice(0,30)){let Q=document.createElement("button");Q.type="button",Q.className="tt_envItem",Q.textContent=X;let ee="env:"+X,ne=null,ue=()=>{ne!==null&&(clearTimeout(ne),ne=null),Q.textContent=X,delete Q.dataset.danger};Q.addEventListener("mousedown",be=>be.preventDefault()),Q.addEventListener("click",()=>{let be=D.value;if(be===""||be.startsWith("env:")||ne!==null){ue(),D.value=ee,D.focus();return}Q.textContent=X+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",Q.dataset.danger="",ne=setTimeout(ue,4e3)}),F.appendChild(Q)}if(G.length>30){let X=document.createElement("span");X.className="tt_envMore",X.textContent="\u8FD8\u6709 "+(G.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",F.appendChild(X)}else if(G.length===0){let X=document.createElement("span");X.className="tt_envMore",X.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",F.appendChild(X)}};return N.addEventListener("input",q),N.addEventListener("focus",()=>{delete F.dataset.hidden}),N.addEventListener("blur",()=>{N.value.trim()===""&&(F.dataset.hidden="")}),x.appendChild(N),x.appendChild(F),{row:x,setNames(Z){j=Array.isArray(Z)?Z:[],q()}}},c=p(a.passphrase),d=p(a.password),l=!1;(async()=>{if(!l){l=!0;try{let x=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();x.ok&&Array.isArray(x.names)&&(c.setNames(x.names),d.setNames(x.names))}catch{}}})(),h.appendChild(_),h.appendChild(v),h.appendChild(c.row),h.appendChild(w),h.appendChild(d.row),h.appendChild(s("\u9009\u9879"));let g=document.createElement("label");g.className="tt_cardRow";let C=document.createElement("input");C.type="checkbox",C.className="tt_cardCheckbox";let b=document.createElement("span");b.className="tt_cardLabel",b.textContent="agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09",g.appendChild(C),g.appendChild(b),h.appendChild(g);let y=document.createElement("label");y.className="tt_cardRow";let m=document.createElement("input");m.type="checkbox",m.className="tt_cardCheckbox";let k=document.createElement("span");k.className="tt_cardLabel",k.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",y.appendChild(m),y.appendChild(k),m.checked=kt==="tmux",kt==="tmux"&&h.appendChild(y);let B=document.createElement("label");B.className="tt_cardRow";let O=document.createElement("input");O.type="checkbox",O.className="tt_cardCheckbox";let H=document.createElement("span");H.className="tt_cardLabel",H.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",B.appendChild(O),B.appendChild(H),h.appendChild(B);let A=f("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});A.style.display="none",h.appendChild(A),O.addEventListener("change",()=>{A.style.display=O.checked?"":"none",O.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),O.checked&&a.name.focus()}),i&&(B.style.display="none",a.name.value=String(t.name??""),A.style.display="",a.host.value=String(t.host??""),a.port.value=String(t.port??22),a.username.value=String(t.username??""),a.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",a.keyPath.value=String(t.keyPath??""),a.passphrase.value=String(t.passphrase??""),a.password.value=String(t.password??""),C.checked=t.agentForward===!0,m.checked=kt==="tmux");let W=document.createElement("div");W.className="tt_sshStatus";let P=document.createElement("div");P.className="tt_sshError";let M=document.createElement("div");M.className="tt_sshProbeResult",W.appendChild(P),W.appendChild(M),h.appendChild(W);let I=()=>{P.textContent="";let D=a.host.value.trim(),x=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),D===""||x==="")return P.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B",null;let F=a.auth.value,j={host:D,port:N,username:x,auth:F};if(F==="key"){let q=a.keyPath.value.trim();if(q==="")return P.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84",null;j.keyPath=q;let Z=a.passphrase.value;Z!==""&&(j.passphrase=Z)}if(F==="password"){let q=a.password.value;if(q==="")return P.textContent="auth=password \u9700\u8981\u5BC6\u7801",null;j.password=q}return C.checked&&(j.agentForward=!0),j},T=document.createElement("div");T.className="tt_sshActions";let S=document.createElement("div");S.className="tt_sshActionsGroup";let E=document.createElement("div");E.className="tt_sshActionsGroup",T.appendChild(S),T.appendChild(E);let L=document.createElement("button");L.type="button",L.className="tt_toolBtn",L.textContent="\u53D6\u6D88";let R=document.createElement("button");R.type="button",R.className="tt_cardSave",R.textContent="\u8FDE\u63A5",S.appendChild(L);let U=document.createElement("button");U.type="button",U.className="tt_toolBtn",U.textContent="\u6587\u4EF6\u6D4F\u89C8",U.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",U.addEventListener("click",()=>{P.textContent="";let D=a.host.value.trim(),x=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),D===""||x===""){P.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let F=a.auth.value,j={host:D,port:N,username:x,auth:F};if(F==="key"){let q=a.keyPath.value.trim();if(q===""){P.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}j.keyPath=q;let Z=a.passphrase.value;Z!==""&&(j.passphrase=Z)}if(F==="password"){let q=a.password.value;if(q===""){P.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}j.password=q}C.checked&&(j.agentForward=!0),pt(),Ds(j)}),S.appendChild(U);let K=null;i&&(K=document.createElement("button"),K.type="button",K.className="tt_toolBtn",K.textContent="\u4FDD\u5B58\u4FEE\u6539",K.addEventListener("click",()=>{P.textContent="";let D=a.host.value.trim(),x=a.username.value.trim();if(D===""||x===""){P.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let N=Number(a.port.value);(!Number.isInteger(N)||N<1||N>65535)&&(N=22);let F=a.auth.value,q={name:a.name.value.trim()||D,host:D,port:N,username:x,auth:F,keyPath:F==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:C.checked,persist:m.checked};if(F==="key"&&q.keyPath===""){P.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}K!==null&&(K.disabled=!0),vd(String(t.name??""),q).then(Z=>{if(K!==null&&(K.disabled=!1),Z!==void 0){P.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+Z;return}pt()})}),S.appendChild(K));let Y=document.createElement("button");Y.type="button",Y.className="tt_toolBtn",Y.textContent="\u8BD5\u8FDE",Y.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",Y.addEventListener("click",()=>{let D=I();D!==null&&(M.className="tt_sshProbeResult",M.textContent="\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026",Y.disabled=!0,ca(D,!1).then(x=>{Y.disabled=!1,x.result?(M.className="tt_sshProbeResult"+(x.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),M.textContent=ha(x.result)):(M.className="tt_sshProbeResult tt_sshProbeBad",M.textContent="\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(x.error||"\u672A\u77E5\u9519\u8BEF"))}))}),S.appendChild(Y),E.appendChild(R),h.appendChild(T);let z=()=>{_.style.display=a.auth.value==="key"?"":"none",v.style.display=a.auth.value==="key"?"":"none",c.row.style.display=a.auth.value==="key"?"":"none",w.style.display=a.auth.value==="password"?"":"none",d.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",z),z(),L.addEventListener("click",()=>pt()),o.addEventListener("mousedown",D=>{D.target===o&&pt()}),R.addEventListener("click",async()=>{P.textContent="";let D=await hr();if(D!==null){P.textContent=D;return}let x=a.host.value.trim(),N=a.username.value.trim(),F=Number(a.port.value);if((!Number.isInteger(F)||F<1||F>65535)&&(F=22),x===""||N===""){P.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let j=a.auth.value,q={t:"ssh",host:x,port:F,username:N,auth:j};if(j==="key"){let Q=a.keyPath.value.trim();Q!==""&&(q.keyPath=Q);let ee=a.passphrase.value;ee!==""&&(q.passphrase=ee)}if(j==="password"){let Q=a.password.value;Q!==""&&(q.password=Q)}C.checked&&(q.agentForward=!0),m.checked&&(q.persist=!0,q.persistName=As());let Z=F!==22?N+"@"+x+":"+F:N+"@"+x,G=Q=>{pt(),re!==null&&bi(q,Q!==""?Q:Z)};if(!O.checked){G("");return}let X=a.name.value.trim()||x;R.disabled=!0,pd({name:X,host:x,port:F,username:N,auth:j,keyPath:q.keyPath??"",passphrase:q.passphrase??"",password:q.password??"",agentForward:C.checked,persist:m.checked}).then(Q=>{if(R.disabled=!1,Q!==void 0){P.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+Q;return}G(X)})}),o.appendChild(h),document.body.appendChild(o),Gt=o,a.host.focus()}function pt(){Gt!==null&&(Gt.remove(),Gt=null)}async function pd(e){let t=[...St.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})}),o=await i.json().catch(()=>({}));if(!i.ok||!o.ok)return String(o.error||"HTTP "+i.status);wi(o.config);return}catch(i){return String(i&&i.message?i.message:i)}}async function vd(e,t){if(t.name!==e&&St.some(o=>o?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let i=St.map(o=>o?.name===e?t:o);try{let o=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:i})}),h=await o.json().catch(()=>({}));if(!o.ok||!h.ok)return String(h.error||"HTTP "+o.status);wi(h.config);return}catch(o){return String(o&&o.message?o.message:o)}}function gd(e,t){if(wt!==null)return;let i=document.createElement("div");i.className="tt_sshBackdrop";let o=document.createElement("div");o.className="tt_sftpDualCard";let h=document.createElement("div");h.className="tt_sftpTitleRow";let r=document.createElement("div");r.className="tt_sshTitle",r.innerHTML=gi+"<span></span>",r.lastElementChild.textContent="SFTP \u53CC\u680F \xB7 "+t;let s=document.createElement("button");s.type="button",s.className="tt_close",s.title="\u5173\u95ED",s.innerHTML=Es,s.addEventListener("click",At),h.appendChild(r),h.appendChild(s),o.appendChild(h);let a=document.createElement("div");a.className="tt_sftpStatus";let f=(M,I)=>{a.textContent=M,I===void 0?delete a.dataset.state:a.dataset.state=I},n=!1,_=(M,I)=>{if(!(n||w.local.busy||w.remote.busy)){n=!0;for(let T of[w.local,w.remote])T.setBusy(!0);f(M,"busy"),Promise.resolve().then(I).catch(T=>{(T===null||typeof T!="object"||T.name!=="TransferCanceledError")&&W.fail("\u5931\u8D25"),f(String(T&&T.message?T.message:T),"error")}).finally(()=>{n=!1;for(let T of[w.local,w.remote])T.setBusy(!1)})}},v=M=>{w[M].bar.after(c),c.style.display="",d.focus(),d.select()},w={},p=(M,I)=>{let T={kind:M,path:"",busy:!1},S=document.createElement("div");S.className="tt_sftpPane";let E=document.createElement("div");E.className="tt_sftpPaneHead";let L=document.createElement("span");L.textContent=I;let R=document.createElement("span");R.className="tt_sftpPaneMeta",E.appendChild(L),E.appendChild(R),S.appendChild(E);let U=document.createElement("div");U.className="tt_sftpBar";let K=document.createElement("input");K.type="text",K.className="tt_sftpPath",K.placeholder=M==="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 Y=document.createElement("button");Y.type="button",Y.className="tt_toolBtn",Y.innerHTML=Ls+"<span>\u5237\u65B0</span>";let z=document.createElement("button");z.type="button",z.className="tt_toolBtn",z.innerHTML=Xo+"<span>\u65B0\u5EFA\u76EE\u5F55</span>",U.appendChild(K),U.appendChild(Y),U.appendChild(z),S.appendChild(U);let D=document.createElement("div");D.className="tt_sftpList",S.appendChild(D),T.bar=U;let x=G=>{T.busy=G;for(let X of[Y,z])X.disabled=G;K.disabled=G},N=async(G,X)=>{let Q=M==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",ee=M==="local"?X:{...e,...X},ne=await fetch(Q+G,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ee)}),ue=await ne.json().catch(()=>({}));if(!ne.ok||ue.ok!==!0)throw new Error(String(ue.error||"HTTP "+ne.status));return ue},F=(G,X)=>{if(!(T.busy||n))return x(!0),f(G,"busy"),Promise.resolve().then(X).catch(Q=>f(String(Q&&Q.message?Q.message:Q),"error")).finally(()=>x(!1))},j=(G,X)=>G.endsWith("/")||G.endsWith("\\")?G+X:G+"/"+X,q=G=>{let X=j(T.path,G.name),Q=[];G.isDir===!0?Q.push("\u76EE\u5F55"):Q.push(Je(Number(G.size))||"\u2014");let ee=fa(Number(G.mtime));ee!==""&&Q.push(ee);let ne=b(G.isDir?gi:G.isSymlink?Go:Ko,G.name,Q.join(" \xB7 "),G.isDir===!0?"dir":G.isSymlink===!0?"link":"file"),ue=()=>T.loadDir(T.path),be=M==="local"?w.remote:w.local;return G.isDir===!0&&ne.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||T.loadDir(X)}),y(ne,M==="local"?Gh:Vh,"\u4F20\u8F93\u5230"+(M==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+be.path,()=>{W.reset(),W.pulse(0),_("\u4F20\u8F93 "+G.name+"\u2026",async()=>{let fe=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:M==="local"?"up":"down",...e,localPath:M==="local"?X:j(be.path,G.name),remotePath:M==="local"?j(be.path,G.name):X})}),Te=await fe.json().catch(()=>({}));if(!fe.ok||Te.ok!==!0)throw W.fail("\u4F20\u8F93\u5931\u8D25"),new Error(String(Te.error||"HTTP "+fe.status));let $=Te.job?.id;if(typeof $!="string"||$==="")throw W.fail("\u4F20\u8F93\u5931\u8D25"),new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id");await P($,G.name)==="canceled"?(W.reset(),f("\u5DF2\u53D6\u6D88\u4F20\u8F93 "+G.name)):(W.done("\u5B8C\u6210"),setTimeout(()=>W.reset(),1500),f("\u5DF2\u4F20\u8F93 "+G.name)),await be.loadDir(be.path)})}),M!=="local"&&G.isDir!==!0&&y(ne,Yo,"\u4E0B\u8F7D "+G.name,()=>{k(G,X)}),y(ne,ks,"\u91CD\u547D\u540D "+G.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=G.name,v(M),g=async()=>{let fe=d.value.trim();fe===""||fe===G.name||(C(),await T.runTask("\u91CD\u547D\u540D "+G.name+"\u2026",async()=>{await N("rename",{from:X,to:j(T.path,fe)}),await ue()}))}}),m(ne,()=>T.runTask("\u5220\u9664 "+G.name+"\u2026",async()=>{await N("remove",{path:X,recursive:G.isDir===!0}),await ue(),f("\u5DF2\u5220\u9664 "+G.name)}),G),ne},Z=G=>{if(D.textContent="",T.path!==""&&T.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(T.path)===!1){let Q=b(Vo,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");Q.addEventListener("click",()=>{T.loadDir(_a(T.path))}),D.appendChild(Q)}let X=Array.isArray(G)?G:[];if(X.length===0){let Q=document.createElement("div");Q.className="tt_addMenuTitle",Q.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",D.appendChild(Q);return}for(let Q of X)Q===null||typeof Q!="object"||typeof Q.name!="string"||Q.name===""||D.appendChild(q(Q))};return T.loadDir=async G=>{try{let X=await N("list",{path:G??T.path});T.path=typeof X.path=="string"&&X.path!==""?X.path:T.path,K.value=T.path;let Q=Array.isArray(X.entries)?X.entries.length:0;Z(X.entries),R.textContent=String(Q)+" \u9879",f(T.path)}catch(X){f(String(X&&X.message?X.message:X),"error")}},T.runTask=F,T.setBusy=x,w[M]=T,Y.addEventListener("click",()=>{T.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>T.loadDir(T.path))}),z.addEventListener("click",()=>{T.busy||n||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",v(M),g=async()=>{let G=d.value.trim();G!==""&&(C(),await T.runTask("\u521B\u5EFA\u76EE\u5F55 "+G+"\u2026",async()=>{await N("mkdir",{path:j(T.path,G),parents:!0}),await T.loadDir(T.path)}))})}),K.addEventListener("keydown",G=>{if(G.key!=="Enter"||(G.preventDefault(),T.busy||n))return;let X=K.value.trim();X!==""&&T.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>T.loadDir(X))}),S},c=document.createElement("div");c.className="tt_sftpEditor",c.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",c.appendChild(d),c.appendChild(l),c.appendChild(u);let g=null,C=()=>{c.style.display="none",d.value="",g=null};l.addEventListener("click",()=>{g?.()}),u.addEventListener("click",C),d.addEventListener("keydown",M=>{M.key==="Enter"?(M.preventDefault(),g?.()):M.key==="Escape"&&(M.stopPropagation(),C())});let b=(M,I,T,S)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpRow";let L=document.createElement("span");L.className="tt_sftpIcon",L.innerHTML=M,S!==void 0&&(L.dataset.kind=S);let R=document.createElement("span");if(R.className="tt_sftpName",R.textContent=I,R.title=I,E.appendChild(L),E.appendChild(R),T!==""){let U=document.createElement("span");U.className="tt_sftpMeta",U.textContent=T,E.appendChild(U)}return E},y=(M,I,T,S)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpAct",E.innerHTML=I,E.title=T,E.addEventListener("click",L=>{L.stopPropagation(),S()}),M.appendChild(E)},m=(M,I,T)=>{let S=document.createElement("button");S.type="button",S.className="tt_sftpAct",S.innerHTML=jt,S.title="\u5220\u9664 "+T.name+(T.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let E=null;S.addEventListener("click",L=>{if(L.stopPropagation(),E!==null){clearTimeout(E),E=null,S.innerHTML=jt,delete S.dataset.danger,I();return}S.textContent="\u786E\u8BA4?",S.dataset.danger="",E=setTimeout(()=>{E=null,S.innerHTML=jt,delete S.dataset.danger},4e3)}),M.appendChild(S)},k=(M,I)=>w.remote.runTask("\u4E0B\u8F7D "+M.name+"\u2026",async()=>{W.reset();let T;try{T=await va("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:I})},(S,E)=>{W.set(S,E)},bt.maxDownloadMb,S=>W.setCancel(S))}catch(S){if(Cs(S)){W.reset(),f("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+M.name);return}throw W.fail("\u4E0B\u8F7D\u5931\u8D25"),S}W.done("\u5B8C\u6210"),ga(T,M.name),setTimeout(()=>W.reset(),1500),f("\u5DF2\u4E0B\u8F7D "+M.name+"\uFF08"+(Je(T.size)||String(T.size)+" B")+"\uFF09")}),B=p("local","\u672C\u673A"),O=p("remote","\u8FDC\u7A0B");w.local.wrap=B,w.remote.wrap=O;let H=document.createElement("div");H.className="tt_sftpDual",H.appendChild(B),H.appendChild(O),o.appendChild(H),o.appendChild(c);let A=document.createElement("div");A.className="tt_sftpFoot";let W=pa();A.appendChild(W.el),A.appendChild(a),o.appendChild(A);let P=async(M,I)=>{let T=!1;W.setCancel(()=>{T||(T=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:M})}).catch(()=>{}))});try{for(;;){await new Promise(R=>setTimeout(R,400));let S=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:M})}),E=await S.json().catch(()=>({}));if(!S.ok||E.ok!==!0){if(T)return"canceled";throw new Error(String(E.error||"HTTP "+S.status))}let L=E.job;if(L===null||typeof L!="object")throw new Error("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001");if(L.state==="running"){let R=typeof L.current=="string"&&L.current!==""?L.current:I;f("\u4F20\u8F93 "+R+"\u2026","busy"),Number.isFinite(L.total)&&L.total>0?W.set(Number(L.bytes)||0,L.total):W.pulse(Number(L.bytes)||0);continue}if(L.state==="canceled")return"canceled";if(L.state!=="done")throw new Error(String(L.error||"\u4F20\u8F93\u5931\u8D25"));return"done"}}finally{W.setCancel(null)}};i.addEventListener("mousedown",M=>{M.target===i&&At()}),i.appendChild(o),document.body.appendChild(i),wt=i,w.local.loadDir(""),w.remote.loadDir("")}var wt=null,vi=null;function md(){let e=vi;if(vi=null,e!==null)try{e.click()}catch{}}function bd(e){let t=new TextEncoder().encode(e),i="";for(let o of t)i+=String.fromCharCode(o);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Je(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],i=e,o=-1;do i/=1024,o+=1;while(i>=1024&&o<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[o]}function ps(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],i=e,o=-1;do i/=1024,o+=1;while(i>=1024&&o<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[o]+"/s"}function fa(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let i=o=>String(o).padStart(2,"0");return t.getFullYear()+"-"+i(t.getMonth()+1)+"-"+i(t.getDate())+" "+i(t.getHours())+":"+i(t.getMinutes())}function _a(e){let t=String(e).replace(/\/+$/,""),i=t.lastIndexOf("/");return i<=0?"/":t.slice(0,i)}function hi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function pa(){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 o=document.createElement("span");o.className="tt_sftpPct",o.textContent="";let h=document.createElement("button");h.type="button",h.className="tt_sftpCancel",h.title="\u53D6\u6D88\u4F20\u8F93",h.textContent="\u2715",h.style.display="none";let r=null;h.addEventListener("click",p=>{p.stopPropagation();let c=r;c!==null&&(h.disabled=!0,c())}),e.appendChild(t),e.appendChild(o),e.appendChild(h);let s=p=>{o.textContent=p},a="",f=-1,n=p=>{p!==a&&(a=p,o.textContent=p)},_=p=>{let c=Math.round(p);c!==f&&(f=c,i.style.width=c+"%")},v=()=>{r=null,vi===h&&(vi=null),h.style.display="none",h.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",f=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,i.style.width="0%",o.textContent="",v()},setCancel(p){if(p==null){v();return}r=p,vi=h,h.disabled=!1,h.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let d=Date.now();if(this._last!==void 0&&d>this._lastAt){let l=(p-this._last)/((d-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}if(this._last=p,this._lastAt=d,Number.isFinite(c)&&c>0){let l=Math.min(100,Math.max(0,p/c*100));_(l);let u=this._rate!==void 0&&this._rate>=0?ps(this._rate):"";n(Math.round(l)+"%"+(u!==""?" \xB7 "+u:""))}else{i.style.width="";let l=this._rate!==void 0&&this._rate>=0?ps(this._rate):"";n(Je(p)+(l!==""?" \xB7 "+l:""))}},pulse(p){e.dataset.active="",delete e.dataset.state,i.style.width="45%",i.style.transition="none",setTimeout(()=>{i.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let l=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}this._last=p,this._lastAt=c;let d=this._rate!==void 0&&this._rate>=0?ps(this._rate):"";n((Number.isFinite(p)?Je(p):"\u2026")+(d!==""?" \xB7 "+d:""))},done(p){e.dataset.active="",e.dataset.state="done",i.style.width="100%",f=100,v(),n(p!==void 0&&p!==""?p:"\u5B8C\u6210")},fail(p){e.dataset.active="",e.dataset.state="error",v(),n(p!==void 0&&p!==""?p:"\u5931\u8D25")},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",o.textContent=""):(e.dataset.active="",i.style.width="",f=-1,n(p))}}}async function va(e,t,i,o=0,h=null){let r=o>0?o*1024*1024:0,s=typeof AbortController=="function"?new AbortController:null,a=!1;s!==null&&(t={...t,signal:s.signal},typeof h=="function"&&h(()=>{a=!0,s.abort()}));let f=await fetch(e,t);if(!f.ok){let d="HTTP "+f.status;try{let l=await f.json();l!==null&&typeof l=="object"&&typeof l.error=="string"&&(d=l.error)}catch{}throw new Error(d)}let n=Number(f.headers.get("content-length")),_=Number.isFinite(n)&&n>0;if(r>0&&_&&n>r){try{await f.body?.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Je(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}let v=f.body;if(v===null||typeof v.getReader!="function"){let d=await f.blob();if(r>0&&d.size>r)throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Je(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync");return _&&i(n,n),d}let w=v.getReader(),p=[],c=0;try{for(;;){let{done:d,value:l}=await w.read();if(d)break;if(l!==void 0&&l.byteLength>0){if(c+=l.byteLength,r>0&&c>r){try{await w.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Je(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}p.push(l),i(c,_?n:NaN)}}}catch(d){if(a||d!==null&&typeof d=="object"&&d.name==="AbortError"){try{await w.cancel()}catch{}throw new Zt}throw d}return new Blob(p,{type:"application/octet-stream"})}var Zt=class extends Error{constructor(){super("\u5DF2\u53D6\u6D88"),this.name="TransferCanceledError"}};function Cs(e){return e instanceof Zt}function ga(e,t){let i=URL.createObjectURL(e),o=document.createElement("a");o.href=i,o.download=t,o.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}async function wd(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 o=[],h=bt.maxUploadFiles,r=bt.maxUploadMb>0?bt.maxUploadMb*1024*1024:0,s=()=>h>0&&o.length>=h,a=0,f=(n,_)=>new Promise(v=>{if(s()){v();return}if(n.isFile===!0){n.file(c=>{r>0&&a+(c.size??0)>r?o._limitExceeded=!0:(o.push({relPath:_+n.name,file:c}),a+=c.size??0),v()},()=>v());return}if(n.isDirectory!==!0){v();return}let w=n.createReader(),p=()=>{w.readEntries(async c=>{if(c.length===0){v();return}for(let d of c){if(s())break;await f(d,_+n.name+"/")}if(s()){v();return}p()},()=>v())};p()});for(let n of i)await f(n,"");return o}function Ds(e){if(wt!==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 D of["host","username","auth","keyPath","passphrase","password"])typeof t[D]=="string"&&t[D]!==""&&(i[D]=t[D]);let z=Number(t.port);Number.isInteger(z)&&z>=1&&z<=65535&&(i.port=z),t.agentForward===!0&&(i.agentForward=!0)}let o=i.name??(i.username!==void 0?i.username+"@"+String(i.host??""):String(i.host??""));if(oa==="dual"){gd(i,o);return}let h=document.createElement("div");h.className="tt_sshBackdrop";let r=document.createElement("div");r.className="tt_sftpCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let a=document.createElement("div");a.className="tt_sshTitle",a.innerHTML=gi+"<span></span>",a.lastElementChild.textContent="SFTP \xB7 "+o;let f=document.createElement("button");f.type="button",f.className="tt_close",f.title="\u5173\u95ED",f.innerHTML=Es,f.addEventListener("click",At),s.appendChild(a),s.appendChild(f),r.appendChild(s);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 v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.innerHTML=Ls+"<span>\u5237\u65B0</span>";let w=document.createElement("button");w.type="button",w.className="tt_toolBtn",w.innerHTML=Xo+"<span>\u65B0\u5EFA\u76EE\u5F55</span>";let p=document.createElement("button");p.type="button",p.className="tt_toolBtn",p.innerHTML=Kh+"<span>\u4E0A\u4F20</span>",p.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let c=document.createElement("input");c.type="file",c.multiple=!0,c.style.display="none",n.appendChild(_),n.appendChild(v),n.appendChild(w),n.appendChild(p),r.appendChild(n),r.appendChild(c);let d=document.createElement("div");d.className="tt_sftpEditor",d.style.display="none";let l=document.createElement("input");l.type="text",l.className="tt_cardInput",l.spellcheck=!1,l.autocomplete="off";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u786E\u5B9A";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.textContent="\u53D6\u6D88",d.appendChild(l),d.appendChild(u),d.appendChild(g),r.appendChild(d);let C=null,b=()=>{d.style.display="none",C=null};u.addEventListener("click",()=>{C?.()}),g.addEventListener("click",b),l.addEventListener("keydown",z=>{z.key==="Enter"?(z.preventDefault(),C?.()):z.key==="Escape"&&(z.stopPropagation(),b())});let y=document.createElement("div");y.className="tt_sftpList",r.appendChild(y);let m=document.createElement("div");m.className="tt_sftpFoot";let k=document.createElement("div");k.className="tt_sftpStatus";let B=pa();m.appendChild(B.el),m.appendChild(k),r.appendChild(m);let O={path:"",busy:!1},H=(z,D)=>{k.textContent=z,D===void 0?delete k.dataset.state:k.dataset.state=D},A=z=>{O.busy=z;for(let D of[v,w,p])D.disabled=z;_.disabled=z},W=async(z,D)=>{let x=await fetch("/api/dsh-tty/sftp/"+z,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,...D})}),N=await x.json().catch(()=>({}));if(!x.ok||N.ok!==!0)throw new Error(String(N.error||"HTTP "+x.status));return N},P=async(z,D)=>{if(!O.busy){A(!0),H(z,"busy");try{await D()}catch(x){H(String(x&&x.message?x.message:x),"error")}finally{A(!1)}}},M=(z,D,x,N)=>{let F=document.createElement("button");F.type="button",F.className="tt_sftpRow";let j=document.createElement("span");j.className="tt_sftpIcon",j.innerHTML=z,N!==void 0&&(j.dataset.kind=N);let q=document.createElement("span");if(q.className="tt_sftpName",q.textContent=D,q.title=D,F.appendChild(j),F.appendChild(q),x!==""){let Z=document.createElement("span");Z.className="tt_sftpMeta",Z.textContent=x,F.appendChild(Z)}return F},I=(z,D,x,N)=>{let F=document.createElement("button");F.type="button",F.className="tt_sftpAct",F.innerHTML=D,F.title=x,F.addEventListener("click",j=>{j.stopPropagation(),N()}),z.appendChild(F)},T=(z,D,x)=>{let N=document.createElement("button");N.type="button",N.className="tt_sftpAct",N.innerHTML=jt,N.title="\u5220\u9664 "+D.name+(D.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let F=null;N.addEventListener("click",j=>{if(j.stopPropagation(),!O.busy){if(F!==null){clearTimeout(F),F=null,N.innerHTML=jt,delete N.dataset.danger,P("\u5220\u9664 "+D.name+"\u2026",async()=>{await W("remove",{path:x,recursive:D.isDir===!0}),await E(O.path),H("\u5DF2\u5220\u9664 "+D.name)});return}N.textContent="\u786E\u8BA4?",N.dataset.danger="",F=setTimeout(()=>{F=null,N.innerHTML=jt,delete N.dataset.danger},4e3)}}),z.appendChild(N)},S=z=>{if(y.textContent="",O.path!==""&&O.path!=="/"){let x=M(Vo,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");x.addEventListener("click",()=>{P("\u52A0\u8F7D\u4E2D\u2026",()=>E(_a(O.path)))}),y.appendChild(x)}let D=Array.isArray(z)?z:[];if(D.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 D){if(x===null||typeof x!="object"||typeof x.name!="string"||x.name==="")continue;let N=hi(O.path,x.name),F=[];x.isDir===!0?F.push("\u76EE\u5F55"):F.push(Je(Number(x.size))||"\u2014");let j=fa(Number(x.mtime));j!==""&&F.push(j);let q=M(x.isDir?gi:x.isSymlink?Go:Ko,x.name,F.join(" \xB7 "),x.isDir===!0?"dir":x.isSymlink===!0?"link":"file");x.isDir===!0?q.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest(".tt_sftpAct")!==null||P("\u52A0\u8F7D\u4E2D\u2026",()=>E(N))}):(q.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest(".tt_sftpAct")!==null||L(x,N)}),I(q,Yo,"\u4E0B\u8F7D "+x.name,()=>{L(x,N)})),I(q,ks,"\u91CD\u547D\u540D "+x.name,()=>{l.placeholder="\u65B0\u540D\u79F0",l.value=x.name,d.style.display="",l.focus(),l.select(),C=async()=>{let Z=l.value.trim();Z===""||Z===x.name||(b(),await P("\u91CD\u547D\u540D "+x.name+"\u2026",async()=>{await W("rename",{from:N,to:hi(O.path,Z)}),await E(O.path)}))}}),T(q,x,N),y.appendChild(q)}},E=async z=>{try{let D=await W("list",{path:z??O.path});O.path=typeof D.path=="string"&&D.path!==""?D.path:"/",_.value=O.path;let x=Array.isArray(D.entries)?D.entries.length:0;S(D.entries),H(O.path+" \u2014 "+String(x)+" \u9879")}catch(D){H(String(D&&D.message?D.message:D),"error")}},L=(z,D)=>P("\u4E0B\u8F7D "+z.name+"\u2026",async()=>{B.reset();let x;try{x=await va("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,path:D})},(N,F)=>{B.set(N,F)},bt.maxDownloadMb,N=>B.setCancel(N))}catch(N){if(Cs(N)){B.reset(),H("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+z.name);return}throw B.fail("\u4E0B\u8F7D\u5931\u8D25"),N}B.done("\u5B8C\u6210"),ga(x,z.name),setTimeout(()=>B.reset(),1500),H("\u5DF2\u4E0B\u8F7D "+z.name+"\uFF08"+(Je(x.size)||String(x.size)+" B")+"\uFF09")}),R=(z,D,x,N,F)=>new Promise((j,q)=>{let Z=bd(JSON.stringify({...i,path:hi(O.path,D)})),G=new XMLHttpRequest;F.abort=()=>{F.stopped=!0,G.abort()},G.open("POST","/api/dsh-tty/sftp/upload"),G.setRequestHeader("x-dsh-sftp-meta",Z);let X=N>1?String(x)+"/"+String(N)+" ":"";H("\u4E0A\u4F20 "+X+D,"busy"),G.upload.addEventListener("progress",ne=>{ne.lengthComputable?B.set(ne.loaded,ne.total):B.pulse(0)});let Q=!1,ee=ne=>{Q||(Q=!0,ne===null?j():q(ne))};G.addEventListener("load",()=>{if(G.status===200){N===1&&B.done("\u4E0A\u4F20\u5B8C\u6210"),ee(null);return}if(F.stopped)return;B.fail("\u4E0A\u4F20\u5931\u8D25");let ne="HTTP "+G.status;try{let ue=JSON.parse(G.responseText);ue!==null&&typeof ue=="object"&&typeof ue.error=="string"&&(ne=ue.error)}catch{}ee(new Error(ne))}),G.addEventListener("error",()=>{if(F.stopped){ee(new Zt);return}B.fail("\u4E0A\u4F20\u5931\u8D25"),ee(new Error("\u7F51\u7EDC\u9519\u8BEF"))}),G.addEventListener("abort",()=>{ee(new Zt)}),G.send(z)}),U=async z=>P("\u4E0A\u4F20\u4E2D\u2026",async()=>{let D=bt;if(D.maxUploadFiles>0&&z.length>D.maxUploadFiles){H("\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08"+String(D.maxUploadFiles)+"\uFF09\uFF1A\u672C\u6B21 "+String(z.length)+" \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","error"),B.fail("\u8D85\u9650");return}let x=D.maxUploadMb>0?D.maxUploadMb*1024*1024:0,N=z.find(G=>x>0&&(G.file?.size??0)>x);if(N!==void 0){H("\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08"+Je(x)+"\uFF09\uFF1A"+String(N.relPath??"")+"\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error"),B.fail("\u8D85\u9650");return}if(z._limitExceeded===!0){H("\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"),B.fail("\u8D85\u9650");return}let F=new Set;for(let G of z){let X=G.relPath.lastIndexOf("/");if(X<=0)continue;let Q=G.relPath.slice(0,X);F.has(Q)||(F.add(Q),await W("mkdir",{path:hi(O.path,Q),parents:!0}).catch(()=>{}))}B.reset();let j={stopped:!1,abort:null};B.setCancel(()=>j.abort?.());let q=0,Z=0;try{for(let G of z){if(j.stopped)break;q+=1,j.abort=null;try{await R(G.file,G.relPath,q,z.length,j),Z+=1}catch(X){if(Cs(X)||j.stopped)break;throw X}}}finally{B.setCancel(null)}if(j.stopped){B.reset(),H("\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 "+String(Z)+"/"+String(z.length)+" \u4E2A\uFF09"),await E(O.path);return}B.done("\u5168\u90E8\u5B8C\u6210"),setTimeout(()=>B.reset(),1500),H("\u4E0A\u4F20\u5B8C\u6210 "+String(z.length)+" \u4E2A\u6587\u4EF6"),await E(O.path)});v.addEventListener("click",()=>{P("\u52A0\u8F7D\u4E2D\u2026",()=>E(O.path))}),w.addEventListener("click",()=>{O.busy||(l.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",l.value="",d.style.display="",l.focus(),C=async()=>{let z=l.value.trim();z!==""&&(b(),await P("\u521B\u5EFA\u76EE\u5F55 "+z+"\u2026",async()=>{await W("mkdir",{path:hi(O.path,z)}),await E(O.path)}))})}),p.addEventListener("click",()=>{O.busy===!1&&c.click()}),c.addEventListener("change",()=>{let z=[...c.files??[]].map(D=>({relPath:D.name,file:D}));c.value="",z.length>0&&U(z)});let K=0,Y=z=>{z?y.dataset.drag="":delete y.dataset.drag};r.addEventListener("dragenter",z=>{z.preventDefault(),K+=1,Y(!0)}),r.addEventListener("dragover",z=>{z.preventDefault()}),r.addEventListener("dragleave",()=>{K=Math.max(0,K-1),K===0&&Y(!1)}),r.addEventListener("drop",z=>{z.preventDefault(),K=0,Y(!1),!O.busy&&wd(z.dataTransfer).then(D=>{(D.length>0||D._limitExceeded===!0)&&U(D)})}),_.addEventListener("keydown",z=>{if(z.key!=="Enter"||(z.preventDefault(),O.busy))return;let D=_.value.trim();D!==""&&P("\u52A0\u8F7D\u4E2D\u2026",()=>E(D))}),h.addEventListener("mousedown",z=>{z.target===h&&At()}),h.appendChild(r),document.body.appendChild(h),wt=h,P("\u8FDE\u63A5\u4E2D\u2026",()=>E(""))}function At(){wt!==null&&(md(),wt.remove(),wt=null)}function ma(){if(De===null)return;let e=De.style.display==="none"||De.style.display==="";De.style.display=e?"":"none";let t=re!==null?re.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&De.focus()}var Sd={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function Cd(e){let t=gt();if(t===void 0||t.search===void 0)return;let i=De.value;if(i==="")return;let o={decorations:Sd};e?t.search.findPrevious(i,o):t.search.findNext(i,o)}function Uo(){mi||re===null&&!Ms()||Et!==null||(Et=setTimeout(()=>{Et=null,dr()},pi),pi=Math.min(pi*2,5e3))}function Ei(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function ys(e){return Ei(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function yd(){return kt==="tmux"?{t:"spawn",cwd:Ho(),persist:!0,persistName:As()}:{t:"spawn",cwd:Ho()}}async function ba(){if(await da(),re===null){await Ed();return}let e=id(),t=td();if(![...se.values()].some(s=>s.embedded!==!0)){if(e.length>0||t.length>0){xe({t:"sessions"});let s=await cr("sessions",4e3),a=new Map;if(s!==null&&Array.isArray(s.list))for(let n of s.list)n!==null&&typeof n=="object"&&n.attachable===!0&&a.set(n.sid,n);let f=new Set;for(let n of e){if(a.has(n.sid))sd(n);else if(ys(n.spawnSpec))Fo(n);else continue;Ei(n.spawnSpec)&&f.add(n.spawnSpec.persistName)}for(let n of t){let _=n.spawnSpec.persistName;f.has(_)||(Fo(n),f.add(_))}Tt()}if(![...se.values()].some(s=>s.embedded!==!0)){if(await hr())return;bi()}return}let i=[...se.values()].filter(s=>!s.exited&&(s.embedded!==!0||s.spawned===!0)),o=i.filter(s=>ys(s.spawnSpec)),h=null;if(o.length>0){xe({t:"sessions"});let s=await cr("sessions",4e3),a=new Set((s!==null&&Array.isArray(s.list)?s.list:[]).map(f=>f?.sid).filter(f=>typeof f=="string"));h=o.filter(f=>!a.has(f.sid));for(let f of h)Rs(f.sid)}let r=h!==null?new Set(h.map(s=>s.sid)):new Set;for(let s of i)r.has(s.sid)||xe({t:"attach",sid:s.sid})}function xd(){ce!==null&&(ce.readyState===WebSocket.OPEN||ce.readyState===WebSocket.CONNECTING)||dr()}async function Ed(){let e=[...se.values()].filter(o=>o.embedded===!0&&!o.exited);if(e.length===0)return;xe({t:"sessions"});let t=await cr("sessions",4e3),i=new Set((t!==null&&Array.isArray(t.list)?t.list:[]).map(o=>o?.sid).filter(o=>typeof o=="string"));for(let o of e)o.spawned===!0&&(i.has(o.sid)?xe({t:"attach",sid:o.sid}):ys(o.spawnSpec)?sa(o):(o.exited=!0,o.live=!1,zt(o,"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","\u70B9\u51FB\u91CD\u65B0\u6267\u884C","exited")))}function dr(){if(ce!==null){try{ce.close()}catch{}ce=null}mi=!1,clearTimeout(Et),Et=null,tr=!0,yt("\u8FDE\u63A5\u4E2D\u2026","");try{ce=new WebSocket(Ih())}catch(e){tr=!1,yt("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),Uo();return}ce.onopen=()=>{tr=!1,pi=1e3,yt("\u5DF2\u8FDE\u63A5","connected");for(let e of[...vs])vs.delete(e),se.has(e.tab.sid)&&xe(e.frame);ba()},ce.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let i=t.sid;if(t.t==="ready"){let o=typeof t.target=="string"?t.target:"";yt(t.kind==="ssh"?"SSH "+(o!==""?o+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let h=se.get(i);if(h!==void 0){if(h.exited=!1,h.spawned=!0,h.live=!0,h.errored=!1,h.target=o,h.persistTmux=t.persist===!0,t.kind==="ssh"&&o!==""&&!h.label&&(h.label=o,Ze()),Vt(),_s(i),zt(h,""),yi(h),t.persist===!0){let r=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([r,new Promise(s=>setTimeout(s,500))]).then(()=>ea(150))}Si(),Tt()}}else if(t.t==="data"){let o=se.get(i);o!==void 0&&o.term!==null&&(o.term.write(String(t.d??"")),Md())}else if(t.t==="exit"){let o=se.get(i);if(o!==void 0){o.exited=!0,o.live=!1;let h=t.code!==null&&t.code!==void 0?"code="+t.code:"",r=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";yt("\u5DF2\u9000\u51FA "+[h,r].filter(Boolean).join(" "),""),Vt(),_s(i),zt(o,"\u4F1A\u8BDD\u5DF2\u9000\u51FA","\u70B9\u51FB\u91CD\u65B0\u6253\u5F00","exited"),Si(),Tt()}}else if(t.t==="error")if(yt("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof i=="string"){let o=se.get(i);o!==void 0&&(o.live||(o.errored=!0),Vt(),_s(i),zt(o,"\u8FDE\u63A5\u51FA\u9519",String(t.m??"")+" \xB7 \u70B9\u51FB\u91CD\u8BD5","error"))}else kd("\u70B9\u51FB\u91CD\u8BD5")},ce.onclose=()=>{if(tr=!1,!mi){yt("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of se.values())e.exited||zt(e,"\u8FDE\u63A5\u65AD\u5F00","\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","info");Uo()}},ce.onerror=()=>{}}function kd(e){Kt!==null&&(Kt.textContent=e)}function wa(){if(re!==null){lt&&Sa();return}fr(),re=document.createElement("div"),re.className="tt_modalBackdrop",re.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+_r+'</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)" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+Nh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+Hh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+Fh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+Wh+'</button></span><span class="tt_winGroup"><button class="tt_min" title="\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09">'+jh+'</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">'+Es+'</button></span></div><div class="tt_connbar" data-hidden><div class="tt_connArea"><span class="tt_connDot"></span><span class="tt_connTarget">\u2014</span><span class="tt_connBadge"></span></div><div class="tt_connActions"></div></div><div class="tt_body"><div class="tt_overlay"></div></div></div>',document.body.appendChild(re),sr=re.querySelector(".tt_status"),Xt=re.querySelector(".tt_statusText"),Lt=re.querySelector(".tt_statusDot"),vt=re.querySelector(".tt_tabs"),di=re.querySelector(".tt_connbar"),ui=re.querySelector(".tt_connDot"),nr=re.querySelector(".tt_connTarget"),We=re.querySelector(".tt_connBadge"),fi=re.querySelector(".tt_connActions"),qt=re.querySelector(".tt_body"),Kt=re.querySelector(".tt_body > .tt_overlay"),De=re.querySelector(".tt_searchInput"),Kt.addEventListener("click",()=>{Kt.textContent="",dr()});let e=re.querySelector("[data-act=search]");e.addEventListener("click",()=>{ma(),De.style.display!=="none"&&De.focus()}),e.dataset.on="",De.addEventListener("keydown",t=>{t.key==="Enter"?(t.preventDefault(),Cd(t.shiftKey)):t.key==="Escape"&&(t.stopPropagation(),De.style.display="none")}),re.querySelector("[data-act=clear]").addEventListener("click",()=>{let t=gt();t!==void 0&&t.term!==null&&t.term.clear()}),re.querySelector("[data-act=copy]").addEventListener("click",()=>{let t=gt();if(t===void 0||t.term===null)return;let i=t.term.getSelection();i!==""&&navigator.clipboard.writeText(i).catch(()=>{})}),re.querySelector("[data-act=paste]").addEventListener("click",()=>{let t=gt();t!==void 0&&navigator.clipboard.readText().then(i=>{xe({t:"input",sid:t.sid,d:i})}).catch(()=>{})}),re.querySelector(".tt_min").addEventListener("click",()=>{xs()}),re.querySelector(".tt_close").addEventListener("click",()=>{mr()}),re.addEventListener("mousedown",t=>{t.target===re&&xs()}),document.addEventListener("keydown",Ca),_i=new ResizeObserver(()=>{if(lt)return;let t=gt();if(t!==void 0&&t.fit!==void 0){try{t.fit.fit()}catch{return}t.exited||yi(t)}}),_i.observe(qt),Ze(),Vt(),ce!==null&&ce.readyState===WebSocket.OPEN?ba():dr()}function Ld(){Re=document.createElement("div"),Re.className="tt_dock",Re.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",Re.innerHTML='<span class="tt_dockTitle">'+_r+'<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>',or=Re.querySelector(".tt_dockCount"),Jt=Re.querySelector(".tt_dockStatus"),Mt=Re.querySelector(".tt_dockDot");let e=[...se.values()].filter(t=>!t.exited).length;or.textContent=se.size>0?"\xB7 "+e+"/"+se.size:"",Xt!==null&&(Jt.textContent=Xt.textContent),Lt!==null&&(Mt.dataset.state=Lt.dataset.state??""),Re.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),mr();return}Sa()}),document.body.appendChild(Re)}function xs(){re===null||lt||(Xe(),pt(),At(),lt=!0,De!==null&&(De.style.display="none"),re.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?Si():(Ld(),Re.classList.add("tt_dockCompact")))}function Si(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!lt){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.dataset.minimized="",e.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let i=[...se.values()].filter(h=>!h.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=i+"/"+se.size;let o=t.querySelector(".tt_sidebarBadgeDot");o!==null&&Lt!==null&&(o.dataset.state=Lt.dataset.state??"")}function Md(){if(!lt)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Mt;e!==null&&(e.dataset.active="",clearTimeout(ar),ar=setTimeout(()=>{delete e.dataset.active},900))}function Sa(){if(re===null||!lt)return;lt=!1,delete re.dataset.minimized,clearTimeout(ar),Re!==null&&(Re.remove(),Re=null),or=null,Jt=null,Mt=null,Si();let e=gt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&yi(e)}e!==void 0&&e.term!==null&&e.term.focus()}function mr(){if(re===null)return;let e=Ms();if(mi=!e,lt=!1,Xe(),pt(),At(),clearTimeout(ar),clearTimeout(Et),Et=null,pi=1e3,Re!==null&&(Re.remove(),Re=null),or=null,Jt=null,Mt=null,Si(),ce!==null){for(let t of se.values())!t.exited&&t.embedded!==!0&&xe({t:"kill",sid:t.sid});if(!e){try{ce.close()}catch{}ce=null}}_i!==null&&(_i.disconnect(),_i=null);for(let[t,i]of[...se])if(i.embedded!==!0){if(i.term!==null)try{i.term.dispose()}catch{}se.delete(t)}Rt=null,document.removeEventListener("keydown",Ca),re.remove(),re=null,sr=null,Xt=null,Lt=null,vt=null,di=null,ui=null,nr=null,We=null,fi=null,bs(),qt=null,Kt=null,De=null,pr=0;try{sessionStorage.removeItem(lr)}catch{}}function Ca(e){if(e.key==="Escape"&&re!==null){if(e.preventDefault(),wt!==null){At();return}if(Gt!==null){pt();return}if($e!==null){Xe();return}xs()}}function Rd(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function Td(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 Ad(){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">'+_r+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),wa()}),e}function zo(e,t){let i=Td(e);if(i===void 0)return!1;if(t.parentElement!==e){let o=i.closest('[class*="logoRow"]'),h=o!==null&&o.parentElement===e?o:i,r=Array.from(e.children).filter(s=>s instanceof HTMLElement&&s.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(r.length>0){let s=r[r.length-1];e.insertBefore(t,s.nextSibling)}else e.insertBefore(t,h.nextElementSibling)}return!0}function Dd(){if(fr(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=Ad(),t,i=!1,o=()=>{if(t!==void 0&&!t.isConnected&&(r.disconnect(),t=void 0,i=!1),i){if(document.body.contains(e))return;r.disconnect(),t=void 0,i=!1}t??(t=Rd()),t!==void 0&&(i=zo(t,e),i&&r.observe(t,{childList:!0,subtree:!0}))},h=new MutationObserver(()=>{o()});h.observe(document.body,{childList:!0,subtree:!0});let r=new MutationObserver(()=>{if(t===void 0||!t.isConnected){i=!1,o();return}t.contains(e)||(i=zo(t,e))});return o(),()=>{h.disconnect(),r.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},i=e("react"),{jsx:o,jsxs:h}=e("react/jsx-runtime"),r="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function s(){let[a,f]=i.useState(!1),[n,_]=i.useState(null),[v,w]=i.useState(!1),[p,c]=i.useState(!1),[d,l]=i.useState({kind:"",text:""}),[u,g]=i.useState([]),[C,b]=i.useState(!1),y=$=>o("div",{className:"tt_cardSection",children:$}),m=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),wi(V.config)):l({kind:"error",text:String(V.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch($){l({kind:"error",text:String($&&$.message?$.message:$)})}},k=async()=>{try{let V=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();V.ok&&Array.isArray(V.shells)&&g(V.shells)}catch{}};i.useEffect(()=>{a&&!v&&(w(!0),m(),k())},[a]);let B=($,V)=>_(J=>({...J||{},[$]:V})),O=($,V)=>_(J=>({...J||{},sftpLimits:{...J?.sftpLimits??{},[$]:V}})),[H,A]=i.useState(null),[W,P]=i.useState(null),[M,I]=i.useState(""),[T,S]=i.useState({}),[E,L]=i.useState([]),[R,U]=i.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});i.useEffect(()=>{if(!a)return;let $=!0,V=async()=>{try{let oe=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();$&&oe.ok&&Array.isArray(oe.tunnels)&&L(oe.tunnels)}catch{}};V();let J=setInterval(V,2e3);return()=>{$=!1,clearInterval(J)}},[a]);let K=$=>V=>U(J=>({...J||{},[$]:V.target.value})),Y=$=>$?.direction==="remote"?`\u8FDC\u7A0B:${$.remoteHost||"127.0.0.1"}:${String($.remotePort??0)} \u2192 \u672C\u673A:${String($.localTargetPort??0)}`:`\u672C\u673A:${String($?.localPort??0)} \u2192 ${$?.remoteHost??"?"}:${String($?.remotePort??0)}`,z=(n?.sshHosts??[]).find($=>$?.name===R?.bookName),D=async $=>{try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:$})}),J=await V.json().catch(()=>({}));return!V.ok||!J.ok?(l({kind:"error",text:String(J.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(V){return l({kind:"error",text:String(V&&V.message?V.message:V)}),!1}},x=()=>{l({kind:"",text:""});let $=R||{},V=$.bookName||(Array.isArray(n?.sshHosts)?n.sshHosts[0]?.name:"")||"";if(V===""){l({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let J=ge=>{let ae=Number(ge);return Number.isInteger(ae)&&ae>=1&&ae<=65535?ae:0},te;if($.direction==="remote"){if(te={name:"",bookName:V,direction:"remote",remotePort:J($.remotePort),localTargetHost:"",localTargetPort:J($.localTargetPort),enabled:!0},te.remotePort<1||te.localTargetPort<1){l({kind:"error",text:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09"});return}te.name=`${V}-R${String(te.remotePort)}`}else{if(te={name:"",bookName:V,direction:"local",localPort:J($.localPort),remoteHost:$.remoteHost.trim(),remotePort:J($.remotePort),enabled:!0},te.localPort<1||te.remoteHost===""||te.remotePort<1){l({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}te.name=`${V}-L${String(te.localPort)}`}let oe=new Set((Array.isArray(n?.tunnels)?n.tunnels:[]).map(ge=>ge?.name)),le=te.name,ve=2;for(;oe.has(le);)le=`${te.name}-${String(ve)}`,ve+=1;te.name=le;let ie=[...Array.isArray(n?.tunnels)?n.tunnels:[],te];_(ge=>({...ge||{},tunnels:ie})),U(ge=>({...ge||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),D(ie).then(ge=>{ge&&l({kind:"ok",text:`\u96A7\u9053\u300C${le}\u300D\u5DF2\u751F\u6548`})})},N=$=>{let V=(Array.isArray(n?.tunnels)?n.tunnels:[]).filter(J=>J?.name!==$);_(J=>({...J||{},tunnels:V})),D(V)},F=($,V)=>{let J=(Array.isArray(n?.tunnels)?n.tunnels:[]).map(te=>te?.name===$?{...te,enabled:V}:te);_(te=>({...te||{},tunnels:J})),D(J)},j=$=>{A($?.name??null),I(""),P({name:$?.name??"",host:$?.host??"",port:String($?.port??22),username:$?.username??"",auth:$?.auth==="key"||$?.auth==="password"?$.auth:"agent",keyPath:$?.keyPath??"",passphrase:$?.passphrase??"",password:$?.password??"",agentForward:$?.agentForward===!0})},q=()=>{A(null),P(null),I("")},Z=()=>{if(W===null)return;let $=W.name.trim(),V=W.host.trim(),J=W.username.trim();if($===""||V===""||J===""){I("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let te=Number(W.port);if((!Number.isInteger(te)||te<1||te>65535)&&(te=22),(n?.sshHosts??[]).some(oe=>oe?.name===$&&$!==H)){I("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+$);return}if(W.auth==="key"&&W.keyPath.trim()===""){I("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}_(oe=>({...oe||{},sshHosts:(Array.isArray(oe?.sshHosts)?oe.sshHosts:[]).map(le=>le?.name===H?{name:$,host:V,port:te,username:J,auth:W.auth,keyPath:W.keyPath.trim(),passphrase:W.passphrase,password:W.password,agentForward:W.agentForward}:le)})),A(null),P(null),I(""),l({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+$+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},G=$=>{H===$&&q(),S(V=>{let J={...V};return delete J[$],J}),_(V=>({...V||{},sshHosts:(Array.isArray(V?.sshHosts)?V.sshHosts:[]).filter(J=>J?.name!==$)}))},X=async $=>{let V=$?.name??"";if(V==="")return;let J={host:$?.host??"",port:Number($?.port)||22,username:$?.username??"",auth:$?.auth==="key"||$?.auth==="password"?$.auth:"agent",keyPath:$?.keyPath??"",passphrase:$?.passphrase??"",password:$?.password??"",agentForward:$?.agentForward===!0};S(oe=>({...oe,[V]:{running:!0,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}}));let te=await ca(J,!0);S(oe=>{let le=oe[V]||{};if(te.result){let ve=te.result.auth?.ok===!0;return{...oe,[V]:{running:!1,ok:ve,text:ha(te.result)}}}return{...oe,[V]:{running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(te.error||"\u672A\u77E5\u9519\u8BEF")}}})},Q=async $=>{let V=(Array.isArray(n?.hostKeys)?n.hostKeys:[]).filter(J=>!(J?.host===$?.host&&Number(J?.port)===Number($?.port)));_(J=>({...J||{},hostKeys:V}));try{let J=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:V})}),te=await J.json().catch(()=>({}));!J.ok||!te.ok?l({kind:"error",text:String(te.error||"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25")}):l({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(J){l({kind:"error",text:String(J&&J.message?J.message:J)})}},ee=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let J=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(n?.sshHosts)?n.sshHosts:[]],oe=new Set(te.map(ie=>ie?.name)),le=0,ve=0;for(let ie of J)if(!(ie===null||typeof ie!="object"||typeof ie.name!="string")){if(oe.has(ie.name)){ve+=1;continue}oe.add(ie.name),te.push({name:ie.name,host:String(ie.host??ie.name),port:Number(ie.port)||22,username:String(ie.username??""),auth:ie.auth==="key"?"key":"agent",keyPath:String(ie.keyPath??""),passphrase:"",password:"",agentForward:!1}),le+=1}_(ie=>({...ie||{},sshHosts:te})),l(le===0?{kind:"ok",text:ve>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${ve} \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 ${le} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${ve} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch($){l({kind:"error",text:String($&&$.message?$.message:$)})}},ne=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let J=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(n?.hostKeys)?n.hostKeys:[]],oe=new Set(te.map(ie=>String(ie?.host??"")+":"+String(ie?.port??22))),le=0,ve=0;for(let ie of J){if(ie===null||typeof ie!="object"||typeof ie.host!="string"||typeof ie.fingerprint!="string")continue;let ge=ie.host+":"+String(ie.port??22);if(oe.has(ge)){ve+=1;continue}oe.add(ge),te.push({host:ie.host,port:Number(ie.port)||22,fingerprint:ie.fingerprint}),le+=1}if(le===0){l({kind:"ok",text:ve>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${ve} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}_(ie=>({...ie||{},hostKeys:te}));try{let ie=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:te})}),ge=await ie.json().catch(()=>({}));if(!ie.ok||!ge.ok){l({kind:"error",text:String(ge.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}l({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${le} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${ve} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(ie){l({kind:"error",text:String(ie&&ie.message?ie.message:ie)})}}catch($){l({kind:"error",text:String($&&$.message?$.message:$)})}},ue=async()=>{c(!0),l({kind:"",text:""});let $={};for(let V of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose"]){let J=(n||{})[V];J!==void 0&&J!==""&&($[V]=J)}$.sshHosts=Array.isArray(n?.sshHosts)?n.sshHosts:[],$.tunnels=Array.isArray(n?.tunnels)?n.tunnels:[],n?.sftpLimits&&typeof n.sftpLimits=="object"&&($.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($)}),J=await V.json();!V.ok||!J.ok?l({kind:"error",text:String(J.error||"\u4FDD\u5B58\u5931\u8D25")}):(l({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),J.config&&(_(J.config),wi(J.config)))}catch(V){l({kind:"error",text:String(V&&V.message?V.message:V)})}c(!1)},be=()=>{if(W===null)return null;let $=(V,J,te,oe)=>h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:V}),o("input",{className:"tt_cardInput",type:oe??"text",value:W[J]??"",placeholder:te??"",autoComplete:"off",spellCheck:!1,onChange:le=>P(ve=>({...ve||{},[J]:le.target.value}))})]});return h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_sshGrid",children:[$("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),$("\u7AEF\u53E3","port","22")]}),$("\u4E3B\u673A","host","example.com \u6216 IP"),$("\u7528\u6237\u540D","username","root"),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),h("select",{className:"tt_cardInput",value:W.auth,onChange:V=>P(J=>({...J||{},auth:V.target.value})),children:[o("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),o("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),o("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...W.auth==="key"?[$("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),$("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...W.auth==="password"?[$("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],h("label",{className:"tt_cardRow",children:[o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:W.agentForward===!0,onChange:V=>P(J=>({...J||{},agentForward:V.target.checked}))}),o("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),M!==""?o("span",{className:"tt_cardMessage tt_cardMessageError",children:M}):null,h("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_cardSave",onClick:Z,children:"\u5E94\u7528"}),o("button",{type:"button",className:"tt_toolBtn",onClick:q,children:"\u53D6\u6D88"})]})]})},fe=($,V,J,te)=>h("label",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:$}),o("input",{className:"tt_cardInput",value:n[V]??"",placeholder:J??"",onChange:oe=>B(V,oe.target.value)}),te?o("span",{className:"tt_cardHint",children:te}):null]}),Te=($,V)=>h("label",{className:"tt_cardField tt_cardRow",children:[o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:n[V]===!0,onChange:J=>B(V,J.target.checked)}),o("span",{className:"tt_cardLabel",children:$})]});return h("li",{className:a?"tt_card tt_cardOpen":"tt_card",children:[h("button",{type:"button",className:"tt_cardHeader","aria-expanded":a,onClick:()=>f($=>!$),children:[h("span",{className:"tt_cardHeadText",children:[o("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),o("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"})]}),o("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:o("path",{d:r,fill:"currentColor"})})]}),a?h("div",{className:"tt_cardBody",children:[n===null?o("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):h("div",{children:[y("\u57FA\u7840"),Te("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),Te("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),Te("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),y("SFTP \u6587\u4EF6\u4F20\u8F93"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),h("select",{className:"tt_cardInput",value:n.sftpStyle==="dual"?"dual":"dialog",onChange:$=>B("sftpStyle",$.target.value),children:[o("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),o("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),o("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:[o("span",{className:"tt_cardLabel",children:"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09"}),h("div",{className:"tt_limitGrid",children:[h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u4E0B\u8F7D\u4E0A\u9650 (MB)"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxDownloadMb))?Number(n.sftpLimits.maxDownloadMb):1024),onChange:$=>O("maxDownloadMb",Number($.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u4E0A\u4F20\u4E0A\u9650 (MB)"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadMb))?Number(n.sftpLimits.maxUploadMb):2048),onChange:$=>O("maxUploadMb",Number($.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadFiles))?Number(n.sftpLimits.maxUploadFiles):1e3),onChange:$=>O("maxUploadFiles",Number($.target.value)||0)})]})]}),o("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"})]}),y("\u4F1A\u8BDD"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),h("select",{className:"tt_cardInput",value:n.persistence==="tmux"?"tmux":"off",onChange:$=>B("persistence",$.target.value),children:[o("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),o("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),o("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"}),Te("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),o("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"})]}),fe("\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:$=>{$.currentTarget.contains($.relatedTarget)||b(!1)},children:[o("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),o("input",{className:"tt_cardInput",value:n.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>b(!0),onClick:()=>b(!0),onKeyDown:$=>{$.key==="Escape"&&b(!1)},onChange:$=>{B("shell",$.target.value),b(!0)}}),...C?[o("div",{className:"tt_envList tt_shellList",children:(()=>{let $=(n.shell??"").trim().toLowerCase(),V=$===""?u:u.filter(J=>J.toLowerCase().includes($));return V.length===0?o("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(J=>o("button",{type:"button",className:"tt_envItem",onMouseDown:te=>te.preventDefault(),onClick:()=>{B("shell",J),b(!1)},children:J},J))})()},"shell-list")]:[],o("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"),fe("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),fe("COLORTERM","colorTerm","truecolor",""),fe("\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"),fe("\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"),y("SSH \u8FDE\u63A5"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(n.sshHosts)&&n.sshHosts.length>0?[o("div",{className:"tt_hostList",children:n.sshHosts.map($=>h("div",{children:[h("div",{className:"tt_sshHostRow",children:[o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:$?.name??""}),o("span",{className:"tt_sshHostTarget",children:ws($??{})})]}),o("button",{type:"button",className:"tt_toolBtn",disabled:T[$?.name]?.running===!0,onClick:()=>{X($)},title:"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD",children:T[$?.name]?.running===!0?"\u6D4B\u8BD5\u4E2D\u2026":"\u6D4B\u8BD5"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>j($),children:"\u7F16\u8F91"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>G($?.name),children:"\u5220\u9664"})]}),T[$?.name]&&T[$?.name].text?o("div",{className:"tt_sshProbeResult"+(T[$?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:T[$?.name].text}):null,H===$?.name?be():null]},String($?.name??"")))})]:[o("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:[o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{ee()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),o("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),o("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:[o("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(n.tunnels)&&n.tunnels.length>0?[o("div",{children:n.tunnels.map($=>{let V=E.find(te=>te.name===$?.name),J=V?.state??"stopped";return h("div",{className:"tt_sshHostRow",children:[o("span",{className:"tt_tunnelDot","data-state":J,title:J}),o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:($?.name??"")+" \xB7 "+Y($??{})}),o("span",{className:"tt_sshHostTarget",children:($?.bookName??"")+(V?.error?" \xB7 "+V.error:"")+(V?.lastForwardError?" \xB7 "+V.lastForwardError:"")})]}),o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:$?.enabled!==!1,title:"\u542F\u7528",onChange:te=>F($?.name,te.target.checked)}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>N($?.name),children:"\u5220\u9664"})]},String($?.name??""))})})]:[o("span",{className:"tt_cardHint",children:"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3"})],h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_cardRow",children:[h("select",{className:"tt_cardInput",value:R.direction,onChange:K("direction"),children:[o("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),o("option",{value:"remote",children:"\u8FDC\u7A0B\u8F6C\u53D1\uFF08-R\uFF09\uFF1A\u8FDC\u7A0B\u7AEF\u53E3 \u2192 \u672C\u673A\u670D\u52A1"})]}),h("select",{className:"tt_cardInput",value:R.bookName,onChange:K("bookName"),children:[o("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(n?.sshHosts)?n.sshHosts.map($=>o("option",{value:$?.name??"",children:$?.name??""})):[]]})]}),o("span",{className:"tt_cardHint",children:z!==void 0?"\u7ECF "+ws(z)+" \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE":"\u9009\u62E9\u8FD9\u6761\u96A7\u9053\u8981\u8D70\u54EA\u53F0 SSH \u8FDE\u63A5\uFF08\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8FDE\u63A5\u7C3F\uFF09"}),R.direction==="local"?h("div",{className:"tt_tunnelGridLocal",children:[o("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:R.localPort,autoComplete:"off",onChange:K("localPort")}),o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:R.remoteHost,autoComplete:"off",onChange:K("remoteHost")}),o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:R.remotePort,autoComplete:"off",onChange:K("remotePort")})]}):h("div",{className:"tt_tunnelGrid",children:[o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:R.remotePort,autoComplete:"off",onChange:K("remotePort")}),o("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:R.localTargetPort,autoComplete:"off",onChange:K("localTargetPort")})]}),o("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_cardSave",onClick:x,children:"\u6DFB\u52A0\u96A7\u9053"}),o("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:[o("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{ne()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(n.hostKeys)&&n.hostKeys.length>0?[o("div",{className:"tt_hostList",children:n.hostKeys.map($=>h("div",{className:"tt_sshHostRow",children:[o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:String($?.host??"")+":"+String($?.port??22)}),o("span",{className:"tt_sshHostTarget",children:"sha256:"+String($?.fingerprint??"")})]}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Q($)},children:"\u5220\u9664"})]},String($?.host??"")+":"+String($?.port??22)))})]:[o("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"})],o("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:[o("button",{className:"tt_cardSave",disabled:p,onClick:()=>{ue()},children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),o("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=a=>{Qo=a.sessions,Dd(),a.slots.inject("settings.plugin.item",()=>a.slots.register({name:"settings.plugin.item",key:"tty",order:110},s));let f=a.provide("ttyConnbar",{version:1,addAction:vr,requestRender(){Vt()}}),n=a.provide("ttyTerminal",{version:2,open(_){let v=ta(_),w=ia(_,v),p=typeof _?.label=="string"&&_.label!==""?_.label:void 0;fr(),re===null&&wa(),bi(w,p)},mount(_,v){return ad(_,v)}});return()=>{n(),f(),mr()}},t}});})();
2153
2169
  /*! Bundled license information:
2154
2170
 
2155
2171
  @xterm/addon-search/lib/addon-search.mjs: