@hyzyn/dsh-tty 0.31.0 → 0.32.1

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,20 +1,20 @@
1
- "use strict";(()=>{var su=Object.create;var La=Object.defineProperty;var nu=Object.getOwnPropertyDescriptor;var ou=Object.getOwnPropertyNames;var au=Object.getPrototypeOf,lu=Object.prototype.hasOwnProperty;var Ta=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var cu=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ou(t))!lu.call(e,o)&&o!==r&&La(e,o,{get:()=>t[o],enumerable:!(i=nu(t,o))||i.enumerable});return e};var Ma=(e,t,r)=>(r=e!=null?su(au(e)):{},cu(t||!e||!e.__esModule?La(r,"default",{value:e,enumerable:!0}):r,e));var Aa=Ta((cs,En)=>{(function(e,t){if(typeof cs=="object"&&typeof En=="object")En.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var i in r)(typeof cs=="object"?cs:e)[i]=r[i]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(o,s,n){var a=this&&this.__decorate||function(h,p,g,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,g,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,g,w):b(p,g))||w);return x>3&&w&&Object.defineProperty(p,g,w),w},u=this&&this.__param||function(h,p){return function(g,S){p(g,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let l=n(9042),d=n(9924),m=n(844),y=n(4725),_=n(2585),c=n(3656),f=s.AccessibilityManager=class extends m.Disposable{constructor(h,p,g,S){super(),this._terminal=h,this._coreBrowserService=g,this._renderService=S,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 d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((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(`
1
+ "use strict";(()=>{var nu=Object.create;var Ta=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var au=Object.getOwnPropertyNames;var lu=Object.getPrototypeOf,cu=Object.prototype.hasOwnProperty;var Ma=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var hu=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of au(t))!cu.call(e,o)&&o!==r&&Ta(e,o,{get:()=>t[o],enumerable:!(i=ou(t,o))||i.enumerable});return e};var Ra=(e,t,r)=>(r=e!=null?nu(lu(e)):{},hu(t||!e||!e.__esModule?Ta(r,"default",{value:e,enumerable:!0}):r,e));var Da=Ma((cs,Ln)=>{(function(e,t){if(typeof cs=="object"&&typeof Ln=="object")Ln.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var i in r)(typeof cs=="object"?cs:e)[i]=r[i]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let l=n(9042),d=n(9924),m=n(844),y=n(4725),_=n(2585),c=n(3656),f=s.AccessibilityManager=class extends m.Disposable{constructor(h,p,v,S){super(),this._terminal=h,this._coreBrowserService=v,this._renderService=S,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 d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((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
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,m.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(h){for(let p=0;p<h;p++)this._handleChar(" ")}_handleChar(h){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==h&&(this._charsToAnnounce+=h):this._charsToAnnounce+=h,h===`
3
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(h){this._clearLiveRegion(),/\p{Control}/u.test(h)||this._charsToConsume.push(h)}_refreshRows(h,p){this._liveRegionDebouncer.refresh(h,p,this._terminal.rows)}_renderRows(h,p){let g=this._terminal.buffer,S=g.lines.length.toString();for(let b=h;b<=p;b++){let x=g.lines.get(g.ydisp+b),w=[],E=x?.translateToString(!0,void 0,void 0,w)||"",B=(g.ydisp+b+1).toString(),P=this._rowElements[b];P&&(E.length===0?(P.innerText="\xA0",this._rowColumns.set(P,[0,1])):(P.textContent=E,this._rowColumns.set(P,w)),P.setAttribute("aria-posinset",B),P.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,p){let g=h.target,S=this._rowElements[p===0?1:this._rowElements.length-2];if(g.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==S)return;let b,x;if(p===0?(b=g,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(b=this._rowElements.shift(),x=g,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){let w=this._createAccessibilityTreeNode();this._rowElements.unshift(w),this._rowContainer.insertAdjacentElement("afterbegin",w)}else{let w=this._createAccessibilityTreeNode();this._rowElements.push(w),this._rowContainer.appendChild(w)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let h=document.getSelection();if(!h)return;if(h.isCollapsed)return void(this._rowContainer.contains(h.anchorNode)&&this._terminal.clearSelection());if(!h.anchorNode||!h.focusNode)return void console.error("anchorNode and/or focusNode are null");let p={node:h.anchorNode,offset:h.anchorOffset},g={node:h.focusNode,offset:h.focusOffset};if((p.node.compareDocumentPosition(g.node)&Node.DOCUMENT_POSITION_PRECEDING||p.node===g.node&&p.offset>g.offset)&&([p,g]=[g,p]),p.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(p={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(p.node))return;let S=this._rowElements.slice(-1)[0];if(g.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(g={node:S,offset:S.textContent?.length??0}),!this._rowContainer.contains(g.node))return;let b=({node:E,offset:B})=>{let P=E instanceof Text?E.parentNode:E,W=parseInt(P?.getAttribute("aria-posinset"),10)-1;if(isNaN(W))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 V=B<A.length?A[B]:A.slice(-1)[0]+1;return V>=this._terminal.cols&&(++W,V=0),{row:W,column:V}},x=b(p),w=b(g);if(x&&w){if(x.row>w.row||x.row===w.row&&x.column>=w.column)throw new Error("invalid range");this._terminal.select(x.column,x.row,(w.row-x.row)*this._terminal.cols-x.column+w.column)}}_handleResize(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let h=this._coreBrowserService.mainDocument.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h}_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 h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}}_refreshRowDimensions(h){h.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=f=a([u(1,_.IInstantiationService),u(2,y.ICoreBrowserService),u(3,y.IRenderService)],f)},3614:(o,s)=>{function n(d){return d.replace(/\r?\n/g,"\r")}function a(d,m){return m?"\x1B[200~"+d+"\x1B[201~":d}function u(d,m,y,_){d=a(d=n(d),y.decPrivateModes.bracketedPasteMode&&_.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(d,!0),m.value=""}function l(d,m,y){let _=y.getBoundingClientRect(),c=d.clientX-_.left-10,f=d.clientY-_.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${c}px`,m.style.top=`${f}px`,m.style.zIndex="1000",m.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=n,s.bracketTextForPaste=a,s.copyHandler=function(d,m){d.clipboardData&&d.clipboardData.setData("text/plain",m.selectionText),d.preventDefault()},s.handlePasteEvent=function(d,m,y,_){d.stopPropagation(),d.clipboardData&&u(d.clipboardData.getData("text/plain"),m,y,_)},s.paste=u,s.moveTextAreaUnderMouseCursor=l,s.rightClickHandler=function(d,m,y,_,c){l(d,m,y),c&&_.rightClickSelect(d),m.value=_.selectionText,m.select()}},7239:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let a=n(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(u,l,d){this._css.set(u,l,d)}getCss(u,l){return this._css.get(u,l)}setColor(u,l,d){this._color.set(u,l,d)}getColor(u,l){return this._color.get(u,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(n,a,u,l){n.addEventListener(a,u,l);let d=!1;return{dispose:()=>{d||(d=!0,n.removeEventListener(a,u,l))}}}},3551:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,g){var S,b=arguments.length,x=b<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,p):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,g);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,g){h(p,g,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let l=n(3656),d=n(8460),m=n(844),y=n(2585),_=n(4725),c=s.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(f,h,p,g,S){super(),this._element=f,this._mouseService=h,this._renderService=p,this._bufferService=g,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;let h=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!h)return;this._isMouseOut=!1;let p=f.composedPath();for(let g=0;g<p.length;g++){let S=p[g];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&h.x===this._lastBufferCell.x&&h.y===this._lastBufferCell.y||(this._handleHover(h),this._lastBufferCell=h)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,h){this._activeProviderReplies&&h||(this._activeProviderReplies?.forEach((g=>{g?.forEach((S=>{S.link.dispose&&S.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=f.y);let p=!1;for(let[g,S]of this._linkProviderService.linkProviders.entries())h?this._activeProviderReplies?.get(g)&&(p=this._checkLinkProviderResult(g,f,p)):S.provideLinks(f.y,(b=>{if(this._isMouseOut)return;let x=b?.map((w=>({link:w})));this._activeProviderReplies?.set(g,x),p=this._checkLinkProviderResult(g,f,p),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)}))}_removeIntersectingLinks(f,h){let p=new Set;for(let g=0;g<h.size;g++){let S=h.get(g);if(S)for(let b=0;b<S.length;b++){let x=S[b],w=x.link.range.start.y<f?0:x.link.range.start.x,E=x.link.range.end.y>f?this._bufferService.cols:x.link.range.end.x;for(let B=w;B<=E;B++){if(p.has(B)){S.splice(b--,1);break}p.add(B)}}}}_checkLinkProviderResult(f,h,p){if(!this._activeProviderReplies)return p;let g=this._activeProviderReplies.get(f),S=!1;for(let b=0;b<f;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(S=!0);if(!S&&g){let b=g.find((x=>this._linkAtPosition(x.link,h)));b&&(p=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!p)for(let b=0;b<this._activeProviderReplies.size;b++){let x=this._activeProviderReplies.get(b)?.find((w=>this._linkAtPosition(w.link,h)));if(x){p=!0,this._handleNewLink(x);break}}return p}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;let h=this._positionFromMouseEvent(f,this._element,this._mouseService);h&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,h){this._currentLink&&this._lastMouseEvent&&(!f||!h||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=h)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._linkAtPosition(f.link,h)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:p=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==p&&(this._currentLink.state.decorations.pointerCursor=p,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",p))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:p=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==p&&(this._currentLink.state.decorations.underline=p,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,p))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((p=>{if(!this._currentLink)return;let g=p.start===0?0:p.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+p.end;if(this._currentLink.link.range.start.y>=g&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(g,S),this._lastMouseEvent)){let b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}}))))}_linkHover(f,h,p){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(p,h.text)}_fireUnderlineEvent(f,h){let p=f.range,g=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(p.start.x-1,p.start.y-g-1,p.end.x,p.end.y-g-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(f,h,p){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(p,h.text)}_linkAtPosition(f,h){let p=f.range.start.y*this._bufferService.cols+f.range.start.x,g=f.range.end.y*this._bufferService.cols+f.range.end.x,S=h.y*this._bufferService.cols+h.x;return p<=S&&S<=g}_positionFromMouseEvent(f,h,p){let g=p.getCoords(f,h,this._bufferService.cols,this._bufferService.rows);if(g)return{x:g[0],y:g[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,h,p,g,S){return{x1:f,y1:h,x2:p,y2:g,cols:this._bufferService.cols,fg:S}}};s.Linkifier=c=a([u(1,_.IMouseService),u(2,_.IRenderService),u(3,y.IBufferService),u(4,_.ILinkProviderService)],c)},9042:(o,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(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,g=arguments.length,S=g<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(g<3?p(S):g>3?p(c,f,S):p(c,f))||S);return g>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let l=n(511),d=n(2585),m=s.OscLinkProvider=class{constructor(_,c,f){this._bufferService=_,this._optionsService=c,this._oscLinkService=f}provideLinks(_,c){let f=this._bufferService.buffer.lines.get(_-1);if(!f)return void c(void 0);let h=[],p=this._optionsService.rawOptions.linkHandler,g=new l.CellData,S=f.getTrimmedLength(),b=-1,x=-1,w=!1;for(let E=0;E<S;E++)if(x!==-1||f.hasContent(E)){if(f.loadCell(E,g),g.hasExtendedAttrs()&&g.extended.urlId){if(x===-1){x=E,b=g.extended.urlId;continue}w=g.extended.urlId!==b}else x!==-1&&(w=!0);if(w||x!==-1&&E===S-1){let B=this._oscLinkService.getLinkData(b)?.uri;if(B){let P={start:{x:x+1,y:_},end:{x:E+(w||E!==S-1?0:1),y:_}},W=!1;if(!p?.allowNonHttpProtocols)try{let A=new URL(B);["http:","https:"].includes(A.protocol)||(W=!0)}catch{W=!0}W||h.push({text:B,range:P,activate:(A,V)=>p?p.activate(A,V,P):y(0,V),hover:(A,V)=>p?.hover?.(A,V,P),leave:(A,V)=>p?.leave?.(A,V,P)})}w=!1,g.hasExtendedAttrs()&&g.extended.urlId?(x=E,b=g.extended.urlId):(x=-1,b=-1)}}c(h)}};function y(_,c){if(confirm(`Do you want to navigate to ${c}?
3
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(h){this._clearLiveRegion(),/\p{Control}/u.test(h)||this._charsToConsume.push(h)}_refreshRows(h,p){this._liveRegionDebouncer.refresh(h,p,this._terminal.rows)}_renderRows(h,p){let v=this._terminal.buffer,S=v.lines.length.toString();for(let b=h;b<=p;b++){let x=v.lines.get(v.ydisp+b),w=[],E=x?.translateToString(!0,void 0,void 0,w)||"",B=(v.ydisp+b+1).toString(),P=this._rowElements[b];P&&(E.length===0?(P.innerText="\xA0",this._rowColumns.set(P,[0,1])):(P.textContent=E,this._rowColumns.set(P,w)),P.setAttribute("aria-posinset",B),P.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,p){let v=h.target,S=this._rowElements[p===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==S)return;let b,x;if(p===0?(b=v,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(b=this._rowElements.shift(),x=v,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){let w=this._createAccessibilityTreeNode();this._rowElements.unshift(w),this._rowContainer.insertAdjacentElement("afterbegin",w)}else{let w=this._createAccessibilityTreeNode();this._rowElements.push(w),this._rowContainer.appendChild(w)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let h=document.getSelection();if(!h)return;if(h.isCollapsed)return void(this._rowContainer.contains(h.anchorNode)&&this._terminal.clearSelection());if(!h.anchorNode||!h.focusNode)return void console.error("anchorNode and/or focusNode are null");let p={node:h.anchorNode,offset:h.anchorOffset},v={node:h.focusNode,offset:h.focusOffset};if((p.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||p.node===v.node&&p.offset>v.offset)&&([p,v]=[v,p]),p.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(p={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(p.node))return;let S=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:S,offset:S.textContent?.length??0}),!this._rowContainer.contains(v.node))return;let b=({node:E,offset:B})=>{let P=E instanceof Text?E.parentNode:E,W=parseInt(P?.getAttribute("aria-posinset"),10)-1;if(isNaN(W))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 V=B<A.length?A[B]:A.slice(-1)[0]+1;return V>=this._terminal.cols&&(++W,V=0),{row:W,column:V}},x=b(p),w=b(v);if(x&&w){if(x.row>w.row||x.row===w.row&&x.column>=w.column)throw new Error("invalid range");this._terminal.select(x.column,x.row,(w.row-x.row)*this._terminal.cols-x.column+w.column)}}_handleResize(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let h=this._coreBrowserService.mainDocument.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h}_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 h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}}_refreshRowDimensions(h){h.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=f=a([u(1,_.IInstantiationService),u(2,y.ICoreBrowserService),u(3,y.IRenderService)],f)},3614:(o,s)=>{function n(d){return d.replace(/\r?\n/g,"\r")}function a(d,m){return m?"\x1B[200~"+d+"\x1B[201~":d}function u(d,m,y,_){d=a(d=n(d),y.decPrivateModes.bracketedPasteMode&&_.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(d,!0),m.value=""}function l(d,m,y){let _=y.getBoundingClientRect(),c=d.clientX-_.left-10,f=d.clientY-_.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${c}px`,m.style.top=`${f}px`,m.style.zIndex="1000",m.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=n,s.bracketTextForPaste=a,s.copyHandler=function(d,m){d.clipboardData&&d.clipboardData.setData("text/plain",m.selectionText),d.preventDefault()},s.handlePasteEvent=function(d,m,y,_){d.stopPropagation(),d.clipboardData&&u(d.clipboardData.getData("text/plain"),m,y,_)},s.paste=u,s.moveTextAreaUnderMouseCursor=l,s.rightClickHandler=function(d,m,y,_,c){l(d,m,y),c&&_.rightClickSelect(d),m.value=_.selectionText,m.select()}},7239:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let a=n(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(u,l,d){this._css.set(u,l,d)}getCss(u,l){return this._css.get(u,l)}setColor(u,l,d){this._color.set(u,l,d)}getColor(u,l){return this._color.get(u,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(n,a,u,l){n.addEventListener(a,u,l);let d=!1;return{dispose:()=>{d||(d=!0,n.removeEventListener(a,u,l))}}}},3551:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,v){var S,b=arguments.length,x=b<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,v);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,v){h(p,v,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let l=n(3656),d=n(8460),m=n(844),y=n(2585),_=n(4725),c=s.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(f,h,p,v,S){super(),this._element=f,this._mouseService=h,this._renderService=p,this._bufferService=v,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;let h=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!h)return;this._isMouseOut=!1;let p=f.composedPath();for(let v=0;v<p.length;v++){let S=p[v];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&h.x===this._lastBufferCell.x&&h.y===this._lastBufferCell.y||(this._handleHover(h),this._lastBufferCell=h)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,h){this._activeProviderReplies&&h||(this._activeProviderReplies?.forEach((v=>{v?.forEach((S=>{S.link.dispose&&S.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=f.y);let p=!1;for(let[v,S]of this._linkProviderService.linkProviders.entries())h?this._activeProviderReplies?.get(v)&&(p=this._checkLinkProviderResult(v,f,p)):S.provideLinks(f.y,(b=>{if(this._isMouseOut)return;let x=b?.map((w=>({link:w})));this._activeProviderReplies?.set(v,x),p=this._checkLinkProviderResult(v,f,p),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)}))}_removeIntersectingLinks(f,h){let p=new Set;for(let v=0;v<h.size;v++){let S=h.get(v);if(S)for(let b=0;b<S.length;b++){let x=S[b],w=x.link.range.start.y<f?0:x.link.range.start.x,E=x.link.range.end.y>f?this._bufferService.cols:x.link.range.end.x;for(let B=w;B<=E;B++){if(p.has(B)){S.splice(b--,1);break}p.add(B)}}}}_checkLinkProviderResult(f,h,p){if(!this._activeProviderReplies)return p;let v=this._activeProviderReplies.get(f),S=!1;for(let b=0;b<f;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(S=!0);if(!S&&v){let b=v.find((x=>this._linkAtPosition(x.link,h)));b&&(p=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!p)for(let b=0;b<this._activeProviderReplies.size;b++){let x=this._activeProviderReplies.get(b)?.find((w=>this._linkAtPosition(w.link,h)));if(x){p=!0,this._handleNewLink(x);break}}return p}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;let h=this._positionFromMouseEvent(f,this._element,this._mouseService);h&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,h){this._currentLink&&this._lastMouseEvent&&(!f||!h||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=h)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._linkAtPosition(f.link,h)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:p=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==p&&(this._currentLink.state.decorations.pointerCursor=p,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",p))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:p=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==p&&(this._currentLink.state.decorations.underline=p,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,p))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((p=>{if(!this._currentLink)return;let v=p.start===0?0:p.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+p.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(v,S),this._lastMouseEvent)){let b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}}))))}_linkHover(f,h,p){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(p,h.text)}_fireUnderlineEvent(f,h){let p=f.range,v=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(p.start.x-1,p.start.y-v-1,p.end.x,p.end.y-v-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(f,h,p){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(p,h.text)}_linkAtPosition(f,h){let p=f.range.start.y*this._bufferService.cols+f.range.start.x,v=f.range.end.y*this._bufferService.cols+f.range.end.x,S=h.y*this._bufferService.cols+h.x;return p<=S&&S<=v}_positionFromMouseEvent(f,h,p){let v=p.getCoords(f,h,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,h,p,v,S){return{x1:f,y1:h,x2:p,y2:v,cols:this._bufferService.cols,fg:S}}};s.Linkifier=c=a([u(1,_.IMouseService),u(2,_.IRenderService),u(3,y.IBufferService),u(4,_.ILinkProviderService)],c)},9042:(o,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(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(v<3?p(S):v>3?p(c,f,S):p(c,f))||S);return v>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let l=n(511),d=n(2585),m=s.OscLinkProvider=class{constructor(_,c,f){this._bufferService=_,this._optionsService=c,this._oscLinkService=f}provideLinks(_,c){let f=this._bufferService.buffer.lines.get(_-1);if(!f)return void c(void 0);let h=[],p=this._optionsService.rawOptions.linkHandler,v=new l.CellData,S=f.getTrimmedLength(),b=-1,x=-1,w=!1;for(let E=0;E<S;E++)if(x!==-1||f.hasContent(E)){if(f.loadCell(E,v),v.hasExtendedAttrs()&&v.extended.urlId){if(x===-1){x=E,b=v.extended.urlId;continue}w=v.extended.urlId!==b}else x!==-1&&(w=!0);if(w||x!==-1&&E===S-1){let B=this._oscLinkService.getLinkData(b)?.uri;if(B){let P={start:{x:x+1,y:_},end:{x:E+(w||E!==S-1?0:1),y:_}},W=!1;if(!p?.allowNonHttpProtocols)try{let A=new URL(B);["http:","https:"].includes(A.protocol)||(W=!0)}catch{W=!0}W||h.push({text:B,range:P,activate:(A,V)=>p?p.activate(A,V,P):y(0,V),hover:(A,V)=>p?.hover?.(A,V,P),leave:(A,V)=>p?.leave?.(A,V,P)})}w=!1,v.hasExtendedAttrs()&&v.extended.urlId?(x=E,b=v.extended.urlId):(x=-1,b=-1)}}c(h)}};function y(_,c){if(confirm(`Do you want to navigate to ${c}?
4
4
 
5
- WARNING: This link could potentially be dangerous`)){let f=window.open();if(f){try{f.opener=null}catch{}f.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=m=a([u(0,d.IBufferService),u(1,d.IOptionsService),u(2,d.IOscLinkService)],m)},6193:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(n,a){this._renderCallback=n,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(n){return this._refreshCallbacks.push(n),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let a=n(3614),u=n(3656),l=n(3551),d=n(9042),m=n(3730),y=n(1680),_=n(3107),c=n(5744),f=n(2950),h=n(1296),p=n(428),g=n(4269),S=n(5114),b=n(8934),x=n(3230),w=n(9312),E=n(4725),B=n(6731),P=n(8055),W=n(8969),A=n(8460),V=n(844),O=n(6114),R=n(8437),F=n(2584),I=n(7399),C=n(5941),L=n(9074),T=n(2585),D=n(5435),N=n(4567),G=n(779);class $ extends W.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(H={}){super(H),this.browser=O,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new V.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(L.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(G.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,j)=>this.refresh(k,j)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((k=>this._reportWindowsOptions(k)))),this.register(this._inputHandler.onColor((k=>this._handleColorEvent(k)))),this.register((0,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((k=>this._afterResize(k.cols,k.rows)))),this.register((0,V.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(H){if(this._themeService)for(let k of H){let j,q="";switch(k.index){case 256:j="foreground",q="10";break;case 257:j="background",q="11";break;case 258:j="cursor",q="12";break;default:j="ansi",q="4;"+k.index}switch(k.type){case 0:let U=P.color.toColorRGB(j==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[j]);this.coreService.triggerDataEvent(`${F.C0.ESC}]${q};${(0,C.toRgbString)(U)}${F.C1_ESCAPED.ST}`);break;case 1:if(j==="ansi")this._themeService.modifyColors((J=>J.ansi[k.index]=P.channels.toColor(...k.color)));else{let J=j;this._themeService.modifyColors((Z=>Z[J]=P.channels.toColor(...k.color)))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(H){H?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(H){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.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(F.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let H=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(H);if(!k)return;let j=Math.min(this.buffer.x,this.cols-1),q=this._renderService.dimensions.css.cell.height,U=k.getWidth(j),J=this._renderService.dimensions.css.cell.width*U,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,se=j*this._renderService.dimensions.css.cell.width;this.textarea.style.left=se+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=J+"px",this.textarea.style.height=q+"px",this.textarea.style.lineHeight=q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let H=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",H)),this.register((0,u.addDisposableDomListener)(this.element,"paste",H)),O.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),O.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",(H=>this._keyUp(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",(H=>this._keyDown(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",(H=>this._keyPress(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",(H=>this._compositionHelper.compositionupdate(H)))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,u.addDisposableDomListener)(this.textarea,"input",(H=>this._inputEvent(H)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(H){if(!H)throw new Error("Terminal requires a parent element.");if(H.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=H.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),H.appendChild(this.element);let k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,u.addDisposableDomListener)(this.screenElement,"mousemove",(j=>this.updateCursorStyle(j)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.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(S.CoreBrowserService,this.textarea,H.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",(j=>this._handleTextAreaFocus(j)))),this.register((0,u.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(g.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((j=>this._onRender.fire(j)))),this.onResize((j=>this._renderService.resize(j.cols,j.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((j=>this.scrollLines(j.amount,j.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(w.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((j=>this.scrollLines(j.amount,j.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((j=>this._renderService.handleSelectionChanged(j.start,j.end,j.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((j=>{this.textarea.value=j,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((j=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(j=>this._selectionService.handleMouseDown(j)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(j=>this._handleScreenReaderModeOptionChange(j)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(j=>{!this._overviewRulerRenderer&&j&&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(h.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let H=this,k=this.element;function j(J){let Z=H._mouseService.getMouseReportCoords(J,H.screenElement);if(!Z)return!1;let se,he;switch(J.overrideType||J.type){case"mousemove":he=32,J.buttons===void 0?(se=3,J.button!==void 0&&(se=J.button<3?J.button:3)):se=1&J.buttons?0:4&J.buttons?1:2&J.buttons?2:3;break;case"mouseup":he=0,se=J.button<3?J.button:3;break;case"mousedown":he=1,se=J.button<3?J.button:3;break;case"wheel":if(H._customWheelEventHandler&&H._customWheelEventHandler(J)===!1||H.viewport.getLinesScrolled(J)===0)return!1;he=J.deltaY<0?0:1,se=4;break;default:return!1}return!(he===void 0||se===void 0||se>4)&&H.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:se,action:he,ctrl:J.ctrlKey,alt:J.altKey,shift:J.shiftKey})}let q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},U={mouseup:J=>(j(J),J.buttons||(this._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.removeEventListener("mousemove",q.mousedrag)),this.cancel(J)),wheel:J=>(j(J),this.cancel(J,!0)),mousedrag:J=>{J.buttons&&j(J)},mousemove:J=>{J.buttons||j(J)}};this.register(this.coreMouseService.onProtocolChange((J=>{J?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(J)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&J?q.mousemove||(k.addEventListener("mousemove",U.mousemove),q.mousemove=U.mousemove):(k.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&J?q.wheel||(k.addEventListener("wheel",U.wheel,{passive:!1}),q.wheel=U.wheel):(k.removeEventListener("wheel",q.wheel),q.wheel=null),2&J?q.mouseup||(q.mouseup=U.mouseup):(this._document.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&J?q.mousedrag||(q.mousedrag=U.mousedrag):(this._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(k,"mousedown",(J=>{if(J.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(J))return j(J),q.mouseup&&this._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.addEventListener("mousemove",q.mousedrag),this.cancel(J)}))),this.register((0,u.addDisposableDomListener)(k,"wheel",(J=>{if(!q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(J)===!1)return!1;if(!this.buffer.hasScrollback){let Z=this.viewport.getLinesScrolled(J);if(Z===0)return;let se=F.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(J.deltaY<0?"A":"B"),he="";for(let fe=0;fe<Math.abs(Z);fe++)he+=se;return this.coreService.triggerDataEvent(he,!0),this.cancel(J,!0)}return this.viewport.handleWheel(J)?this.cancel(J):void 0}}),{passive:!1})),this.register((0,u.addDisposableDomListener)(k,"touchstart",(J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(J),this.cancel(J)}),{passive:!0})),this.register((0,u.addDisposableDomListener)(k,"touchmove",(J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(J)?void 0:this.cancel(J)}),{passive:!1}))}refresh(H,k){this._renderService?.refreshRows(H,k)}updateCursorStyle(H){this._selectionService?.shouldColumnSelect(H)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(H,k,j=0){j===1?(super.scrollLines(H,k,j),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(H)}paste(H){(0,a.paste)(H,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(H){this._customKeyEventHandler=H}attachCustomWheelEventHandler(H){this._customWheelEventHandler=H}registerLinkProvider(H){return this._linkProviderService.registerLinkProvider(H)}registerCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(H);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(H)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(H){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+H)}registerDecoration(H){return this._decorationService.registerDecoration(H)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(H,k,j){this._selectionService.setSelection(H,k,j)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(H,k){this._selectionService?.selectLines(H,k)}_keyDown(H){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&H.altKey;if(!k&&!this._compositionHelper.keydown(H))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||H.key!=="Dead"&&H.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let j=(0,I.evaluateKeyboardEvent)(H,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(H),j.type===3||j.type===2){let q=this.rows-1;return this.scrollLines(j.type===2?-q:q),this.cancel(H,!0)}return j.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,H)||(j.cancel&&this.cancel(H,!0),!j.key||!!(H.key&&!H.ctrlKey&&!H.altKey&&!H.metaKey&&H.key.length===1&&H.key.charCodeAt(0)>=65&&H.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(j.key!==F.C0.ETX&&j.key!==F.C0.CR||(this.textarea.value=""),this._onKey.fire({key:j.key,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(j.key,!0),!this.optionsService.rawOptions.screenReaderMode||H.altKey||H.ctrlKey?this.cancel(H,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(H,k){let j=H.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||H.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||H.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?j:j&&(!k.keyCode||k.keyCode>47)}_keyUp(H){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(H)||this.focus(),this.updateCursorStyle(H),this._keyPressHandled=!1)}_keyPress(H){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;if(this.cancel(H),H.charCode)k=H.charCode;else if(H.which===null||H.which===void 0)k=H.keyCode;else{if(H.which===0||H.charCode===0)return!1;k=H.which}return!(!k||(H.altKey||H.ctrlKey||H.metaKey)&&!this._isThirdLevelShift(this.browser,H)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(H){if(H.data&&H.inputType==="insertText"&&(!H.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=H.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(H),!0}return!1}resize(H,k){H!==this.cols||k!==this.rows?super.resize(H,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(H,k){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(R.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let H=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=H,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(F.C0.ESC+"[I"):this.coreService.triggerDataEvent(F.C0.ESC+"[O")}_reportWindowsOptions(H){if(this._renderService)switch(H){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),j=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[4;${j};${k}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let q=this._renderService.dimensions.css.cell.width.toFixed(0),U=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[6;${U};${q}t`)}}cancel(H,k){if(this.options.cancelEvents||k)return H.preventDefault(),H.stopPropagation(),!1}}s.Terminal=$},9924:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(n,a=1e3){this._renderCallback=n,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){let d=l-this._lastRefreshMs,m=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a)}}},1680:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,g){var S,b=arguments.length,x=b<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,p):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,g);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,g){h(p,g,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let l=n(3656),d=n(4725),m=n(8460),y=n(844),_=n(2585),c=s.Viewport=class extends y.Disposable{constructor(f,h,p,g,S,b,x,w){super(),this._viewportElement=f,this._scrollArea=h,this._bufferService=p,this._optionsService=g,this._charSizeService=S,this._renderService=b,this._coreBrowserService=x,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 m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(w.colors),this.register(w.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.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(f){if(f)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 h=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==h&&(this._lastRecordedBufferHeight=h,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){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 h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<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(f,h){let p=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&p<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){let h=this._getPixelsScrolled(f);return h!==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+h:this._smoothScrollState.target+=h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let h=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(f,h){let p,g="",S=[],b=h??this._bufferService.buffer.lines.length,x=this._bufferService.buffer.lines;for(let w=f;w<b;w++){let E=x.get(w);if(!E)continue;let B=x.get(w+1)?.isWrapped;if(g+=E.translateToString(!B),!B||w===x.length-1){let P=document.createElement("div");P.textContent=g,S.push(P),g.length>0&&(p=P),g=""}}return{bufferElements:S,cursorElement:p}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(f,h){let p=this._optionsService.rawOptions.fastScrollModifier;return p==="alt"&&h.altKey||p==="ctrl"&&h.ctrlKey||p==="shift"&&h.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){let h=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}};s.Viewport=c=a([u(2,_.IBufferService),u(3,_.IOptionsService),u(4,d.ICharSizeService),u(5,d.IRenderService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],c)},3107:function(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,g=arguments.length,S=g<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(g<3?p(S):g>3?p(c,f,S):p(c,f))||S);return g>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let l=n(4725),d=n(844),m=n(2585),y=s.BufferDecorationRenderer=class extends d.Disposable{constructor(_,c,f,h,p){super(),this._screenElement=_,this._bufferService=c,this._coreBrowserService=f,this._decorationService=h,this._renderService=p,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,d.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let _ of this._decorationService.decorations)this._renderDecoration(_);this._dimensionsChanged=!1}_renderDecoration(_){this._refreshStyle(_),this._dimensionsChanged&&this._refreshXPosition(_)}_createElement(_){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",_?.options?.layer==="top"),c.style.width=`${Math.round((_.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(_.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(_.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 f=_.options.x??0;return f&&f>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(_,c),c}_refreshStyle(_){let c=_.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)_.element&&(_.element.style.display="none",_.onRenderEmitter.fire(_.element));else{let f=this._decorationElements.get(_);f||(f=this._createElement(_),_.element=f,this._decorationElements.set(_,f),this._container.appendChild(f),_.onDispose((()=>{this._decorationElements.delete(_),f.remove()}))),f.style.top=c*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",_.onRenderEmitter.fire(f)}}_refreshXPosition(_,c=_.element){if(!c)return;let f=_.options.x??0;(_.options.anchor||"left")==="right"?c.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(_){this._decorationElements.get(_)?.remove(),this._decorationElements.delete(_),_.dispose()}};s.BufferDecorationRenderer=y=a([u(1,m.IBufferService),u(2,l.ICoreBrowserService),u(3,m.IDecorationService),u(4,l.IRenderService)],y)},5871:(o,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(n){if(n.options.overviewRulerOptions){for(let a of this._zones)if(a.color===n.options.overviewRulerOptions.color&&a.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,n.marker.line))return;if(this._lineAdjacentToZone(a,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(a,n.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=n.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=n.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=n.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=n.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:n.options.overviewRulerOptions.color,position:n.options.overviewRulerOptions.position,startBufferLine:n.marker.line,endBufferLine:n.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(n){this._linePadding=n}_lineIntersectsZone(n,a){return a>=n.startBufferLine&&a<=n.endBufferLine}_lineAdjacentToZone(n,a,u){return a>=n.startBufferLine-this._linePadding[u||"full"]&&a<=n.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(n,a){n.startBufferLine=Math.min(n.startBufferLine,a),n.endBufferLine=Math.max(n.endBufferLine,a)}}},5744:function(o,s,n){var a=this&&this.__decorate||function(p,g,S,b){var x,w=arguments.length,E=w<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(p,g,S,b);else for(var B=p.length-1;B>=0;B--)(x=p[B])&&(E=(w<3?x(E):w>3?x(g,S,E):x(g,S))||E);return w>3&&E&&Object.defineProperty(g,S,E),E},u=this&&this.__param||function(p,g){return function(S,b){g(S,b,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let l=n(5871),d=n(4725),m=n(844),y=n(2585),_={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},h=s.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,g,S,b,x,w,E){super(),this._viewportElement=p,this._screenElement=g,this._bufferService=S,this._decorationService=b,this._renderService=x,this._optionsService=w,this._coreBrowserService=E,this._colorZoneStore=new l.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,m.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 p=Math.floor(this._canvas.width/3),g=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=p,c.center=g,c.right=p,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=c.left,f.right=c.left+c.center}_refreshDrawHeightConstants(){_.full=Math.round(2*this._coreBrowserService.dpr);let p=this._canvas.height/this._bufferService.buffer.lines.length,g=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowserService.dpr);_.left=g,_.center=g,_.right=g}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.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 p=this._colorZoneStore.zones;for(let g of p)g.position!=="full"&&this._renderColorZone(g);for(let g of p)g.position==="full"&&this._renderColorZone(g);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(f[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-_[p.position||"full"]/2),c[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+_[p.position||"full"]))}_queueRefresh(p,g){this._shouldUpdateDimensions=p||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=h=a([u(2,y.IBufferService),u(3,y.IDecorationService),u(4,d.IRenderService),u(5,y.IOptionsService),u(6,d.ICoreBrowserService)],h)},2950:function(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,g=arguments.length,S=g<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(g<3?p(S):g>3?p(c,f,S):p(c,f))||S);return g>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let l=n(4725),d=n(2585),m=n(2584),y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,c,f,h,p,g){this._textarea=_,this._compositionView=c,this._bufferService=f,this._optionsService=h,this._coreService=p,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(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),f.length>0&&this._coreService.triggerDataEvent(f,!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 _=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,f=c.replace(_,"");this._dataAlreadySent=f,c.length>_.length?this._coreService.triggerDataEvent(f,!0):c.length<_.length?this._coreService.triggerDataEvent(`${m.C0.DEL}`,!0):c.length===_.length&&c!==_&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,p=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=p+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"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=p+"px",this._textarea.style.top=h+"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"}_||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=y=a([u(2,d.IBufferService),u(3,d.IOptionsService),u(4,d.ICoreService),u(5,l.IRenderService)],y)},9806:(o,s)=>{function n(a,u,l){let d=l.getBoundingClientRect(),m=a.getComputedStyle(l),y=parseInt(m.getPropertyValue("padding-left")),_=parseInt(m.getPropertyValue("padding-top"));return[u.clientX-d.left-y,u.clientY-d.top-_]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=n,s.getCoords=function(a,u,l,d,m,y,_,c,f){if(!y)return;let h=n(a,u,l);return h?(h[0]=Math.ceil((h[0]+(f?_/2:0))/_),h[1]=Math.ceil(h[1]/c),h[0]=Math.min(Math.max(h[0],1),d+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),m),h):void 0}},9504:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let a=n(2584);function u(c,f,h,p){let g=c-l(c,h),S=f-l(f,h),b=Math.abs(g-S)-(function(x,w,E){let B=0,P=x-l(x,E),W=w-l(w,E);for(let A=0;A<Math.abs(P-W);A++){let V=d(x,w)==="A"?-1:1;E.buffer.lines.get(P+V*A)?.isWrapped&&B++}return B})(c,f,h);return _(b,y(d(c,f),p))}function l(c,f){let h=0,p=f.buffer.lines.get(c),g=p?.isWrapped;for(;g&&c>=0&&c<f.rows;)h++,p=f.buffer.lines.get(--c),g=p?.isWrapped;return h}function d(c,f){return c>f?"A":"B"}function m(c,f,h,p,g,S){let b=c,x=f,w="";for(;b!==h||x!==p;)b+=g?1:-1,g&&b>S.cols-1?(w+=S.buffer.translateBufferLineToString(x,!1,c,b),b=0,c=0,x++):!g&&b<0&&(w+=S.buffer.translateBufferLineToString(x,!1,0,c+1),b=S.cols-1,c=b,x--);return w+S.buffer.translateBufferLineToString(x,!1,c,b)}function y(c,f){let h=f?"O":"[";return a.C0.ESC+h+c}function _(c,f){c=Math.floor(c);let h="";for(let p=0;p<c;p++)h+=f;return h}s.moveToCellSequence=function(c,f,h,p){let g=h.buffer.x,S=h.buffer.y;if(!h.buffer.hasScrollback)return(function(w,E,B,P,W,A){return u(E,P,W,A).length===0?"":_(m(w,E,w,E-l(E,W),!1,W).length,y("D",A))})(g,S,0,f,h,p)+u(S,f,h,p)+(function(w,E,B,P,W,A){let V;V=u(E,P,W,A).length>0?P-l(P,W):E;let O=P,R=(function(F,I,C,L,T,D){let N;return N=u(C,L,T,D).length>0?L-l(L,T):I,F<C&&N<=L||F>=C&&N<L?"C":"D"})(w,E,B,P,W,A);return _(m(w,V,B,O,R==="C",W).length,y(R,A))})(g,S,c,f,h,p);let b;if(S===f)return b=g>c?"D":"C",_(Math.abs(g-c),y(b,p));b=S>f?"D":"C";let x=Math.abs(S-f);return _((function(w,E){return E.cols-w})(S>f?c:g,h)+(x-1)*h.cols+1+((S>f?g:c)-1),y(b,p))}},1296:function(o,s,n){var a=this&&this.__decorate||function(A,V,O,R){var F,I=arguments.length,C=I<3?V:R===null?R=Object.getOwnPropertyDescriptor(V,O):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(A,V,O,R);else for(var L=A.length-1;L>=0;L--)(F=A[L])&&(C=(I<3?F(C):I>3?F(V,O,C):F(V,O))||C);return I>3&&C&&Object.defineProperty(V,O,C),C},u=this&&this.__param||function(A,V){return function(O,R){V(O,R,A)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let l=n(3787),d=n(2550),m=n(2223),y=n(6171),_=n(6052),c=n(4725),f=n(8055),h=n(8460),p=n(844),g=n(2585),S="xterm-dom-renderer-owner-",b="xterm-rows",x="xterm-fg-",w="xterm-bg-",E="xterm-focus",B="xterm-selection",P=1,W=s.DomRenderer=class extends p.Disposable{constructor(A,V,O,R,F,I,C,L,T,D,N,G,$){super(),this._terminal=A,this._document=V,this._element=O,this._screenElement=R,this._viewportElement=F,this._helperContainer=I,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=N,this._coreBrowserService=G,this._themeService=$,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,_.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new h.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,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Y=>this._injectCss(Y)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(l.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Y=>this._handleLinkHover(Y)))),this.register(this._linkifier2.onHideLinkUnderline((Y=>this._handleLinkLeave(Y)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(S+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new d.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let 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 V=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=V,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 V=`${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}`;V+=`${this._terminalSelector} .${b} .xterm-dim { color: ${f.color.multiplyOpacity(A.foreground,.5).css};}`,V+=`${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}`,R=`blink_bar_${this._terminalClass}`,F=`blink_block_${this._terminalClass}`;V+=`@keyframes ${O} { 50% { border-bottom-style: hidden; }}`,V+=`@keyframes ${R} { 50% { box-shadow: none; }}`,V+=`@keyframes ${F} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,V+=`${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${R} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${F} 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);}`,V+=`${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[I,C]of A.ansi.entries())V+=`${this._terminalSelector} .${x}${I} { color: ${C.css}; }${this._terminalSelector} .${x}${I}.xterm-dim { color: ${f.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${w}${I} { background-color: ${C.css}; }`;V+=`${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(A.background).css}; }${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${w}${m.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=V}_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,V){for(let O=this._rowElements.length;O<=V;O++){let R=this._document.createElement("div");this._rowContainer.appendChild(R),this._rowElements.push(R)}for(;this._rowElements.length>V;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,V){this._refreshRowElements(A,V),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,V,O){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,V,O),this.renderRows(0,this._bufferService.rows-1),!A||!V)return;this._selectionRenderModel.update(this._terminal,A,V,O);let R=this._selectionRenderModel.viewportStartRow,F=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||C<0)return;let L=this._document.createDocumentFragment();if(O){let T=A[0]>V[0];L.appendChild(this._createSelectionElement(I,T?V[0]:A[0],T?A[0]:V[0],C-I+1))}else{let T=R===I?A[0]:0,D=I===F?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(I,T,D));let N=C-I-1;if(L.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,N)),I!==C){let G=F===C?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,G))}}this._selectionContainer.appendChild(L)}_createSelectionElement(A,V,O,R=1){let F=this._document.createElement("div"),I=V*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(O-V);return I+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-I),F.style.height=R*this.dimensions.css.cell.height+"px",F.style.top=A*this.dimensions.css.cell.height+"px",F.style.left=`${I}px`,F.style.width=`${C}px`,F}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,V){let O=this._bufferService.buffer,R=O.ybase+O.y,F=Math.min(O.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=A;T<=V;T++){let D=T+O.ydisp,N=this._rowElements[T],G=O.lines.get(D);if(!N||!G)break;N.replaceChildren(...this._rowFactory.createRow(G,D,D===R,C,L,F,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${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,V,O,R,F,I){O<0&&(A=0),R<0&&(V=0);let C=this._bufferService.rows-1;O=Math.max(Math.min(O,C),0),R=Math.max(Math.min(R,C),0),F=Math.min(F,this._bufferService.cols);let L=this._bufferService.buffer,T=L.ybase+L.y,D=Math.min(L.x,F-1),N=this._optionsService.rawOptions.cursorBlink,G=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=O;Y<=R;++Y){let H=Y+L.ydisp,k=this._rowElements[Y],j=L.lines.get(H);if(!k||!j)break;k.replaceChildren(...this._rowFactory.createRow(j,H,H===T,G,$,D,N,this.dimensions.css.cell.width,this._widthCache,I?Y===O?A:0:-1,I?(Y===R?V:F)-1:-1))}}};s.DomRenderer=W=a([u(7,g.IInstantiationService),u(8,c.ICharSizeService),u(9,g.IOptionsService),u(10,g.IBufferService),u(11,c.ICoreBrowserService),u(12,c.IThemeService)],W)},3787:function(o,s,n){var a=this&&this.__decorate||function(b,x,w,E){var B,P=arguments.length,W=P<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(b,x,w,E);else for(var A=b.length-1;A>=0;A--)(B=b[A])&&(W=(P<3?B(W):P>3?B(x,w,W):B(x,w))||W);return P>3&&W&&Object.defineProperty(x,w,W),W},u=this&&this.__param||function(b,x){return function(w,E){x(w,E,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let l=n(2223),d=n(643),m=n(511),y=n(2585),_=n(8055),c=n(4725),f=n(4269),h=n(6171),p=n(3734),g=s.DomRendererRowFactory=class{constructor(b,x,w,E,B,P,W){this._document=b,this._characterJoinerService=x,this._optionsService=w,this._coreBrowserService=E,this._coreService=B,this._decorationService=P,this._themeService=W,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,x,w){this._selectionStart=b,this._selectionEnd=x,this._columnSelectMode=w}createRow(b,x,w,E,B,P,W,A,V,O,R){let F=[],I=this._characterJoinerService.getJoinedCharacters(x),C=this._themeService.colors,L,T=b.getNoBgTrimmedLength();w&&T<P+1&&(T=P+1);let D=0,N="",G=0,$=0,Y=0,H=!1,k=0,j=!1,q=0,U=[],J=O!==-1&&R!==-1;for(let Z=0;Z<T;Z++){b.loadCell(Z,this._workCell);let se=this._workCell.getWidth();if(se===0)continue;let he=!1,fe=Z,te=this._workCell;if(I.length>0&&Z===I[0][0]){he=!0;let we=I.shift();te=new f.JoinedCellData(this._workCell,b.translateToString(!0,we[0],we[1]),we[1]-we[0]),fe=we[1]-1,se=te.getWidth()}let qe=this._isCellInSelection(Z,x),le=w&&Z===P,Me=J&&Z>=O&&Z<=R,st=!1;this._decorationService.forEachDecorationAtCell(Z,x,void 0,(we=>{st=!0}));let He=te.getChars()||d.WHITESPACE_CELL_CHAR;if(He===" "&&(te.isUnderline()||te.isOverline())&&(He="\xA0"),q=se*A-V.get(He,te.isBold(),te.isItalic()),L){if(D&&(qe&&j||!qe&&!j&&te.bg===G)&&(qe&&j&&C.selectionForeground||te.fg===$)&&te.extended.ext===Y&&Me===H&&q===k&&!le&&!he&&!st){te.isInvisible()?N+=d.WHITESPACE_CELL_CHAR:N+=He,D++;continue}D&&(L.textContent=N),L=this._document.createElement("span"),D=0,N=""}else L=this._document.createElement("span");if(G=te.bg,$=te.fg,Y=te.extended.ext,H=Me,k=q,j=qe,he&&P>=Z&&P<=fe&&(P=Z),!this._coreService.isCursorHidden&&le&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&U.push("xterm-cursor-blink"),U.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline")}}if(te.isBold()&&U.push("xterm-bold"),te.isItalic()&&U.push("xterm-italic"),te.isDim()&&U.push("xterm-dim"),N=te.isInvisible()?d.WHITESPACE_CELL_CHAR:te.getChars()||d.WHITESPACE_CELL_CHAR,te.isUnderline()&&(U.push(`xterm-underline-${te.extended.underlineStyle}`),N===" "&&(N="\xA0"),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let we=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&we<8&&(we+=8),L.style.textDecorationColor=C.ansi[we].css}te.isOverline()&&(U.push("xterm-overline"),N===" "&&(N="\xA0")),te.isStrikethrough()&&U.push("xterm-strikethrough"),Me&&(L.style.textDecoration="underline");let ee=te.getFgColor(),ne=te.getFgColorMode(),ge=te.getBgColor(),be=te.getBgColorMode(),je=!!te.isInverse();if(je){let we=ee;ee=ge,ge=we;let _t=ne;ne=be,be=_t}let Oe,ze,Re,We=!1;switch(this._decorationService.forEachDecorationAtCell(Z,x,void 0,(we=>{we.options.layer!=="top"&&We||(we.backgroundColorRGB&&(be=50331648,ge=we.backgroundColorRGB.rgba>>8&16777215,Oe=we.backgroundColorRGB),we.foregroundColorRGB&&(ne=50331648,ee=we.foregroundColorRGB.rgba>>8&16777215,ze=we.foregroundColorRGB),We=we.options.layer==="top")})),!We&&qe&&(Oe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ge=Oe.rgba>>8&16777215,be=50331648,We=!0,C.selectionForeground&&(ne=50331648,ee=C.selectionForeground.rgba>>8&16777215,ze=C.selectionForeground)),We&&U.push("xterm-decoration-top"),be){case 16777216:case 33554432:Re=C.ansi[ge],U.push(`xterm-bg-${ge}`);break;case 50331648:Re=_.channels.toColor(ge>>16,ge>>8&255,255&ge),this._addStyle(L,`background-color:#${S((ge>>>0).toString(16),"0",6)}`);break;default:je?(Re=C.foreground,U.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):Re=C.background}switch(Oe||te.isDim()&&(Oe=_.color.multiplyOpacity(Re,.5)),ne){case 16777216:case 33554432:te.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(L,Re,C.ansi[ee],te,Oe,void 0)||U.push(`xterm-fg-${ee}`);break;case 50331648:let we=_.channels.toColor(ee>>16&255,ee>>8&255,255&ee);this._applyMinimumContrast(L,Re,we,te,Oe,ze)||this._addStyle(L,`color:#${S(ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Re,C.foreground,te,Oe,ze)||je&&U.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}U.length&&(L.className=U.join(" "),U.length=0),le||he||st?L.textContent=N:D++,q!==this.defaultSpacing&&(L.style.letterSpacing=`${q}px`),F.push(L),Z=fe}return L&&D&&(L.textContent=N),F}_applyMinimumContrast(b,x,w,E,B,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.treatGlyphAsBackgroundColor)(E.getCode()))return!1;let W=this._getContrastCache(E),A;if(B||P||(A=W.getColor(x.rgba,w.rgba)),A===void 0){let V=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);A=_.color.ensureContrastRatio(B||x,P||w,V),W.setColor((B||x).rgba,(P||w).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,x){b.setAttribute("style",`${b.getAttribute("style")||""}${x};`)}_isCellInSelection(b,x){let w=this._selectionStart,E=this._selectionEnd;return!(!w||!E)&&(this._columnSelectMode?w[0]<=E[0]?b>=w[0]&&x>=w[1]&&b<E[0]&&x<=E[1]:b<w[0]&&x>=w[1]&&b>=E[0]&&x<=E[1]:x>w[1]&&x<E[1]||w[1]===E[1]&&x===w[1]&&b>=w[0]&&b<E[0]||w[1]<E[1]&&x===E[1]&&b<E[0]||w[1]<E[1]&&x===w[1]&&b>=w[0])}};function S(b,x,w){for(;b.length<w;)b=x+b;return b}s.DomRendererRowFactory=g=a([u(1,c.ICharacterJoinerService),u(2,y.IOptionsService),u(3,c.ICoreBrowserService),u(4,y.ICoreService),u(5,y.IDecorationService),u(6,c.IThemeService)],g)},2550:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(n,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=n.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let u=n.createElement("span");u.classList.add("xterm-char-measure-element");let l=n.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let d=n.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";let m=n.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[u,l,d,m],this._container.appendChild(u),this._container.appendChild(l),this._container.appendChild(d),this._container.appendChild(m),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(n,a,u,l){n===this._font&&a===this._fontSize&&u===this._weight&&l===this._weightBold||(this._font=n,this._fontSize=a,this._weight=u,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(n,a,u){let l=0;if(!a&&!u&&n.length===1&&(l=n.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let y=this._measure(n,0);return y>0&&(this._flat[l]=y),y}let d=n;a&&(d+="B"),u&&(d+="I");let m=this._holey.get(d);if(m===void 0){let y=0;a&&(y|=1),u&&(y|=2),m=this._measure(n,y),m>0&&this._holey.set(d,m)}return m}_measure(n,a){let u=this._measureElements[a];return u.textContent=n.repeat(32),u.offsetWidth/32}}},2223:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let a=n(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(o,s)=>{function n(u){return 57508<=u&&u<=57558}function a(u){return u>=128512&&u<=128591||u>=127744&&u<=128511||u>=128640&&u<=128767||u>=9728&&u<=9983||u>=9984&&u<=10175||u>=65024&&u<=65039||u>=129280&&u<=129535||u>=127462&&u<=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(u){if(!u)throw new Error("value must not be falsy");return u},s.isPowerlineGlyph=n,s.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},s.isEmoji=a,s.allowRescaling=function(u,l,d,m){return l===1&&d>Math.ceil(1.5*m)&&u!==void 0&&u>255&&!a(u)&&!n(u)&&!(function(y){return 57344<=y&&y<=63743})(u)},s.treatGlyphAsBackgroundColor=function(u){return n(u)||(function(l){return 9472<=l&&l<=9631})(u)},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(u,l,d=0){return(u-(2*Math.round(l)-d))%(2*Math.round(l))}},6052:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(u,l,d,m=!1){if(this.selectionStart=l,this.selectionEnd=d,!l||!d||l[0]===d[0]&&l[1]===d[1])return void this.clear();let y=u.buffers.active.ydisp,_=l[1]-y,c=d[1]-y,f=Math.max(_,0),h=Math.min(c,u.rows-1);f>=u.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=_,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=h,this.startCol=l[0],this.endCol=d[0])}isCellSelected(u,l,d){return!!this.hasSelection&&(d-=u.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&d>=this.viewportCappedStartRow&&l<this.endCol&&d<=this.viewportCappedEndRow:l<this.startCol&&d>=this.viewportCappedStartRow&&l>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol)}}s.createSelectionRenderModel=function(){return new n}},456:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(n){this._bufferService=n,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?n%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)-1]:[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[n,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[Math.max(n,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let n=this.selectionStart,a=this.selectionEnd;return!(!n||!a)&&(n[1]>a[1]||n[1]===a[1]&&n[0]>a[0])}handleTrim(n){return this.selectionStart&&(this.selectionStart[1]-=n),this.selectionEnd&&(this.selectionEnd[1]-=n),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(o,s,n){var a=this&&this.__decorate||function(h,p,g,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,g,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,g,w):b(p,g))||w);return x>3&&w&&Object.defineProperty(p,g,w),w},u=this&&this.__param||function(h,p){return function(g,S){p(g,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let l=n(2585),d=n(8460),m=n(844),y=s.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(h,p,g){super(),this._optionsService=g,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new c(h,p,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let h=this._measureStrategy.measure();h.width===this.width&&h.height===this.height||(this.width=h.width,this.height=h.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=a([u(2,l.IOptionsService)],y);class _ extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(p,g){p!==void 0&&p>0&&g!==void 0&&g>0&&(this._result.width=p,this._result.height=g)}}class c extends _{constructor(p,g,S){super(),this._document=p,this._parentElement=g,this._optionsService=S,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 f extends _{constructor(p){super(),this._optionsService=p,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 p=this._ctx.measureText("W");return this._validateAndSet(p.width,p.fontBoundingBoxAscent+p.fontBoundingBoxDescent),this._result}}},4269:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,g){var S,b=arguments.length,x=b<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,p):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,g);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,g){h(p,g,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let l=n(3734),d=n(643),m=n(511),y=n(2585);class _ extends l.AttributeData{constructor(h,p,g){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=p,this._width=g}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(h){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=_;let c=s.CharacterJoinerService=class Ra{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(h){let p={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(p),p.id}deregister(h){for(let p=0;p<this._characterJoiners.length;p++)if(this._characterJoiners[p].id===h)return this._characterJoiners.splice(p,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];let p=this._bufferService.buffer.lines.get(h);if(!p||p.length===0)return[];let g=[],S=p.translateToString(!0),b=0,x=0,w=0,E=p.getFg(0),B=p.getBg(0);for(let P=0;P<p.getTrimmedLength();P++)if(p.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==B){if(P-b>1){let W=this._getJoinedRanges(S,w,x,p,b);for(let A=0;A<W.length;A++)g.push(W[A])}b=P,w=x,E=this._workCell.fg,B=this._workCell.bg}x+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){let P=this._getJoinedRanges(S,w,x,p,b);for(let W=0;W<P.length;W++)g.push(P[W])}return g}_getJoinedRanges(h,p,g,S,b){let x=h.substring(p,g),w=[];try{w=this._characterJoiners[0].handler(x)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{let B=this._characterJoiners[E].handler(x);for(let P=0;P<B.length;P++)Ra._mergeRanges(w,B[P])}catch(B){console.error(B)}return this._stringRangesToCellRanges(w,S,b),w}_stringRangesToCellRanges(h,p,g){let S=0,b=!1,x=0,w=h[S];if(w){for(let E=g;E<this._bufferService.cols;E++){let B=p.getWidth(E),P=p.getString(E).length||d.WHITESPACE_CELL_CHAR.length;if(B!==0){if(!b&&w[0]<=x&&(w[0]=E,b=!0),w[1]<=x){if(w[1]=E,w=h[++S],!w)break;w[0]<=x?(w[0]=E,b=!0):b=!1}x+=P}}w&&(w[1]=this._bufferService.cols)}}static _mergeRanges(h,p){let g=!1;for(let S=0;S<h.length;S++){let b=h[S];if(g){if(p[1]<=b[0])return h[S-1][1]=p[1],h;if(p[1]<=b[1])return h[S-1][1]=Math.max(p[1],b[1]),h.splice(S,1),h;h.splice(S,1),S--}else{if(p[1]<=b[0])return h.splice(S,0,p),h;if(p[1]<=b[1])return b[0]=Math.min(p[0],b[0]),h;p[0]<b[1]&&(b[0]=Math.min(p[0],b[0]),g=!0)}}return g?h[h.length-1][1]=p[1]:h.push(p),h}};s.CharacterJoinerService=c=a([u(0,y.IBufferService)],c)},5114:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let a=n(844),u=n(8460),l=n(3656);class d extends a.Disposable{constructor(_,c,f){super(),this._textarea=_,this._window=c,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new u.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((h=>this._screenDprMonitor.setWindow(h)))),this.register((0,u.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(_){this._window!==_&&(this._window=_,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=d;class m extends a.Disposable{constructor(_){super(),this._parentWindow=_,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new u.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(_){this._parentWindow=_,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,l.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:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let a=n(844);class u extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{let m=this.linkProviders.indexOf(d);m!==-1&&this.linkProviders.splice(m,1)}}}}s.LinkProviderService=u},8934:function(o,s,n){var a=this&&this.__decorate||function(y,_,c,f){var h,p=arguments.length,g=p<3?_:f===null?f=Object.getOwnPropertyDescriptor(_,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(y,_,c,f);else for(var S=y.length-1;S>=0;S--)(h=y[S])&&(g=(p<3?h(g):p>3?h(_,c,g):h(_,c))||g);return p>3&&g&&Object.defineProperty(_,c,g),g},u=this&&this.__param||function(y,_){return function(c,f){_(c,f,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let l=n(4725),d=n(9806),m=s.MouseService=class{constructor(y,_){this._renderService=y,this._charSizeService=_}getCoords(y,_,c,f,h){return(0,d.getCoords)(window,y,_,c,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(y,_){let c=(0,d.getCoordsRelativeToElement)(window,y,_);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=m=a([u(0,l.IRenderService),u(1,l.ICharSizeService)],m)},3230:function(o,s,n){var a=this&&this.__decorate||function(h,p,g,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,g,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,g,w):b(p,g))||w);return x>3&&w&&Object.defineProperty(p,g,w),w},u=this&&this.__param||function(h,p){return function(g,S){p(g,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let l=n(6193),d=n(4725),m=n(8460),y=n(844),_=n(7226),c=n(2585),f=s.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(h,p,g,S,b,x,w,E){super(),this._rowCount=h,this._charSizeService=S,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new _.DebouncedIdleTask,this._observerDisposable=this.register(new y.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 m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new l.RenderDebouncer(((B,P)=>this._renderRows(B,P)),w),this.register(this._renderDebouncer),this.register(w.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(x.onResize((()=>this._fullRefresh()))),this.register(x.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(x.cols,x.rows),this._fullRefresh()}))),this.register(g.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(x.buffer.y,x.buffer.y,!0)))),this.register(E.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(w.window,p),this.register(w.onWindowChange((B=>this._registerIntersectionObserver(B,p))))}_registerIntersectionObserver(h,p){if("IntersectionObserver"in h){let g=new h.IntersectionObserver((S=>this._handleIntersectionChange(S[S.length-1])),{threshold:0});g.observe(p),this._observerDisposable.value=(0,y.toDisposable)((()=>g.disconnect()))}}_handleIntersectionChange(h){this._isPaused=h.isIntersecting===void 0?h.intersectionRatio===0:!h.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(h,p,g=!1){this._isPaused?this._needsFullRefresh=!0:(g||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(h,p,this._rowCount))}_renderRows(h,p){this._renderer.value&&(h=Math.min(h,this._rowCount-1),p=Math.min(p,this._rowCount-1),this._renderer.value.renderRows(h,p),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:h,end:p}),this._onRender.fire({start:h,end:p}),this._isNextRenderRedrawOnly=!0)}resize(h,p){this._rowCount=p,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(h){this._renderer.value=h,this._renderer.value&&(this._renderer.value.onRequestRedraw((p=>this.refreshRows(p.start,p.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(h){return this._renderDebouncer.addRefreshCallback(h)}_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(h,p){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(h,p))):this._renderer.value.handleResize(h,p),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(h,p,g){this._selectionState.start=h,this._selectionState.end=p,this._selectionState.columnSelectMode=g,this._renderer.value?.handleSelectionChanged(h,p,g)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=f=a([u(2,c.IOptionsService),u(3,d.ICharSizeService),u(4,c.IDecorationService),u(5,c.IBufferService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],f)},9312:function(o,s,n){var a=this&&this.__decorate||function(w,E,B,P){var W,A=arguments.length,V=A<3?E:P===null?P=Object.getOwnPropertyDescriptor(E,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(w,E,B,P);else for(var O=w.length-1;O>=0;O--)(W=w[O])&&(V=(A<3?W(V):A>3?W(E,B,V):W(E,B))||V);return A>3&&V&&Object.defineProperty(E,B,V),V},u=this&&this.__param||function(w,E){return function(B,P){E(B,P,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let l=n(9806),d=n(9504),m=n(456),y=n(4725),_=n(8460),c=n(844),f=n(6114),h=n(4841),p=n(511),g=n(2585),S="\xA0",b=new RegExp(S,"g"),x=s.SelectionService=class extends c.Disposable{constructor(w,E,B,P,W,A,V,O,R){super(),this._element=w,this._screenElement=E,this._linkifier=B,this._bufferService=P,this._coreService=W,this._mouseService=A,this._optionsService=V,this._renderService=O,this._coreBrowserService=R,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=F=>this._handleMouseMove(F),this._mouseUpListener=F=>this._handleMouseUp(F),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((F=>this._handleTrim(F))),this.register(this._bufferService.buffers.onBufferActivate((F=>this._handleBufferActivate(F)))),this.enable(),this._model=new m.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 w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!w||!E||w[0]===E[0]&&w[1]===E[1])}get selectionText(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!w||!E)return"";let B=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(w[0]===E[0])return"";let W=w[0]<E[0]?w[0]:E[0],A=w[0]<E[0]?E[0]:w[0];for(let V=w[1];V<=E[1];V++){let O=B.translateBufferLineToString(V,!0,W,A);P.push(O)}}else{let W=w[1]===E[1]?E[0]:void 0;P.push(B.translateBufferLineToString(w[1],!0,w[0],W));for(let A=w[1]+1;A<=E[1]-1;A++){let V=B.lines.get(A),O=B.translateBufferLineToString(A,!0);V?.isWrapped?P[P.length-1]+=O:P.push(O)}if(w[1]!==E[1]){let A=B.lines.get(E[1]),V=B.translateBufferLineToString(E[1],!0,0,E[0]);A&&A.isWrapped?P[P.length-1]+=V:P.push(V)}}return P.map((W=>W.replace(b," "))).join(f.isWindows?`\r
5
+ WARNING: This link could potentially be dangerous`)){let f=window.open();if(f){try{f.opener=null}catch{}f.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=m=a([u(0,d.IBufferService),u(1,d.IOptionsService),u(2,d.IOscLinkService)],m)},6193:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(n,a){this._renderCallback=n,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(n){return this._refreshCallbacks.push(n),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let a=n(3614),u=n(3656),l=n(3551),d=n(9042),m=n(3730),y=n(1680),_=n(3107),c=n(5744),f=n(2950),h=n(1296),p=n(428),v=n(4269),S=n(5114),b=n(8934),x=n(3230),w=n(9312),E=n(4725),B=n(6731),P=n(8055),W=n(8969),A=n(8460),V=n(844),O=n(6114),R=n(8437),F=n(2584),I=n(7399),C=n(5941),L=n(9074),T=n(2585),D=n(5435),N=n(4567),G=n(779);class $ extends W.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(H={}){super(H),this.browser=O,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new V.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(L.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(G.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,j)=>this.refresh(k,j)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((k=>this._reportWindowsOptions(k)))),this.register(this._inputHandler.onColor((k=>this._handleColorEvent(k)))),this.register((0,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((k=>this._afterResize(k.cols,k.rows)))),this.register((0,V.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(H){if(this._themeService)for(let k of H){let j,q="";switch(k.index){case 256:j="foreground",q="10";break;case 257:j="background",q="11";break;case 258:j="cursor",q="12";break;default:j="ansi",q="4;"+k.index}switch(k.type){case 0:let U=P.color.toColorRGB(j==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[j]);this.coreService.triggerDataEvent(`${F.C0.ESC}]${q};${(0,C.toRgbString)(U)}${F.C1_ESCAPED.ST}`);break;case 1:if(j==="ansi")this._themeService.modifyColors((J=>J.ansi[k.index]=P.channels.toColor(...k.color)));else{let J=j;this._themeService.modifyColors((Z=>Z[J]=P.channels.toColor(...k.color)))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(H){H?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(H){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.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(F.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let H=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(H);if(!k)return;let j=Math.min(this.buffer.x,this.cols-1),q=this._renderService.dimensions.css.cell.height,U=k.getWidth(j),J=this._renderService.dimensions.css.cell.width*U,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,se=j*this._renderService.dimensions.css.cell.width;this.textarea.style.left=se+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=J+"px",this.textarea.style.height=q+"px",this.textarea.style.lineHeight=q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let H=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",H)),this.register((0,u.addDisposableDomListener)(this.element,"paste",H)),O.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),O.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",(H=>this._keyUp(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",(H=>this._keyDown(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",(H=>this._keyPress(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",(H=>this._compositionHelper.compositionupdate(H)))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,u.addDisposableDomListener)(this.textarea,"input",(H=>this._inputEvent(H)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(H){if(!H)throw new Error("Terminal requires a parent element.");if(H.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=H.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),H.appendChild(this.element);let k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,u.addDisposableDomListener)(this.screenElement,"mousemove",(j=>this.updateCursorStyle(j)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.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(S.CoreBrowserService,this.textarea,H.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",(j=>this._handleTextAreaFocus(j)))),this.register((0,u.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((j=>this._onRender.fire(j)))),this.onResize((j=>this._renderService.resize(j.cols,j.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((j=>this.scrollLines(j.amount,j.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(w.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((j=>this.scrollLines(j.amount,j.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((j=>this._renderService.handleSelectionChanged(j.start,j.end,j.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((j=>{this.textarea.value=j,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((j=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(j=>this._selectionService.handleMouseDown(j)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(j=>this._handleScreenReaderModeOptionChange(j)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(j=>{!this._overviewRulerRenderer&&j&&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(h.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let H=this,k=this.element;function j(J){let Z=H._mouseService.getMouseReportCoords(J,H.screenElement);if(!Z)return!1;let se,he;switch(J.overrideType||J.type){case"mousemove":he=32,J.buttons===void 0?(se=3,J.button!==void 0&&(se=J.button<3?J.button:3)):se=1&J.buttons?0:4&J.buttons?1:2&J.buttons?2:3;break;case"mouseup":he=0,se=J.button<3?J.button:3;break;case"mousedown":he=1,se=J.button<3?J.button:3;break;case"wheel":if(H._customWheelEventHandler&&H._customWheelEventHandler(J)===!1||H.viewport.getLinesScrolled(J)===0)return!1;he=J.deltaY<0?0:1,se=4;break;default:return!1}return!(he===void 0||se===void 0||se>4)&&H.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:se,action:he,ctrl:J.ctrlKey,alt:J.altKey,shift:J.shiftKey})}let q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},U={mouseup:J=>(j(J),J.buttons||(this._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.removeEventListener("mousemove",q.mousedrag)),this.cancel(J)),wheel:J=>(j(J),this.cancel(J,!0)),mousedrag:J=>{J.buttons&&j(J)},mousemove:J=>{J.buttons||j(J)}};this.register(this.coreMouseService.onProtocolChange((J=>{J?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(J)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&J?q.mousemove||(k.addEventListener("mousemove",U.mousemove),q.mousemove=U.mousemove):(k.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&J?q.wheel||(k.addEventListener("wheel",U.wheel,{passive:!1}),q.wheel=U.wheel):(k.removeEventListener("wheel",q.wheel),q.wheel=null),2&J?q.mouseup||(q.mouseup=U.mouseup):(this._document.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&J?q.mousedrag||(q.mousedrag=U.mousedrag):(this._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(k,"mousedown",(J=>{if(J.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(J))return j(J),q.mouseup&&this._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.addEventListener("mousemove",q.mousedrag),this.cancel(J)}))),this.register((0,u.addDisposableDomListener)(k,"wheel",(J=>{if(!q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(J)===!1)return!1;if(!this.buffer.hasScrollback){let Z=this.viewport.getLinesScrolled(J);if(Z===0)return;let se=F.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(J.deltaY<0?"A":"B"),he="";for(let fe=0;fe<Math.abs(Z);fe++)he+=se;return this.coreService.triggerDataEvent(he,!0),this.cancel(J,!0)}return this.viewport.handleWheel(J)?this.cancel(J):void 0}}),{passive:!1})),this.register((0,u.addDisposableDomListener)(k,"touchstart",(J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(J),this.cancel(J)}),{passive:!0})),this.register((0,u.addDisposableDomListener)(k,"touchmove",(J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(J)?void 0:this.cancel(J)}),{passive:!1}))}refresh(H,k){this._renderService?.refreshRows(H,k)}updateCursorStyle(H){this._selectionService?.shouldColumnSelect(H)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(H,k,j=0){j===1?(super.scrollLines(H,k,j),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(H)}paste(H){(0,a.paste)(H,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(H){this._customKeyEventHandler=H}attachCustomWheelEventHandler(H){this._customWheelEventHandler=H}registerLinkProvider(H){return this._linkProviderService.registerLinkProvider(H)}registerCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(H);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(H)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(H){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+H)}registerDecoration(H){return this._decorationService.registerDecoration(H)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(H,k,j){this._selectionService.setSelection(H,k,j)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(H,k){this._selectionService?.selectLines(H,k)}_keyDown(H){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&H.altKey;if(!k&&!this._compositionHelper.keydown(H))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||H.key!=="Dead"&&H.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let j=(0,I.evaluateKeyboardEvent)(H,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(H),j.type===3||j.type===2){let q=this.rows-1;return this.scrollLines(j.type===2?-q:q),this.cancel(H,!0)}return j.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,H)||(j.cancel&&this.cancel(H,!0),!j.key||!!(H.key&&!H.ctrlKey&&!H.altKey&&!H.metaKey&&H.key.length===1&&H.key.charCodeAt(0)>=65&&H.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(j.key!==F.C0.ETX&&j.key!==F.C0.CR||(this.textarea.value=""),this._onKey.fire({key:j.key,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(j.key,!0),!this.optionsService.rawOptions.screenReaderMode||H.altKey||H.ctrlKey?this.cancel(H,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(H,k){let j=H.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||H.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||H.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?j:j&&(!k.keyCode||k.keyCode>47)}_keyUp(H){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(H)||this.focus(),this.updateCursorStyle(H),this._keyPressHandled=!1)}_keyPress(H){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;if(this.cancel(H),H.charCode)k=H.charCode;else if(H.which===null||H.which===void 0)k=H.keyCode;else{if(H.which===0||H.charCode===0)return!1;k=H.which}return!(!k||(H.altKey||H.ctrlKey||H.metaKey)&&!this._isThirdLevelShift(this.browser,H)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(H){if(H.data&&H.inputType==="insertText"&&(!H.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=H.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(H),!0}return!1}resize(H,k){H!==this.cols||k!==this.rows?super.resize(H,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(H,k){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(R.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let H=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=H,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(F.C0.ESC+"[I"):this.coreService.triggerDataEvent(F.C0.ESC+"[O")}_reportWindowsOptions(H){if(this._renderService)switch(H){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),j=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[4;${j};${k}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let q=this._renderService.dimensions.css.cell.width.toFixed(0),U=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[6;${U};${q}t`)}}cancel(H,k){if(this.options.cancelEvents||k)return H.preventDefault(),H.stopPropagation(),!1}}s.Terminal=$},9924:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(n,a=1e3){this._renderCallback=n,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){let d=l-this._lastRefreshMs,m=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a)}}},1680:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,v){var S,b=arguments.length,x=b<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,v);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,v){h(p,v,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let l=n(3656),d=n(4725),m=n(8460),y=n(844),_=n(2585),c=s.Viewport=class extends y.Disposable{constructor(f,h,p,v,S,b,x,w){super(),this._viewportElement=f,this._scrollArea=h,this._bufferService=p,this._optionsService=v,this._charSizeService=S,this._renderService=b,this._coreBrowserService=x,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 m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(w.colors),this.register(w.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.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(f){if(f)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 h=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==h&&(this._lastRecordedBufferHeight=h,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){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 h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<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(f,h){let p=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&p<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){let h=this._getPixelsScrolled(f);return h!==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+h:this._smoothScrollState.target+=h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let h=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(f,h){let p,v="",S=[],b=h??this._bufferService.buffer.lines.length,x=this._bufferService.buffer.lines;for(let w=f;w<b;w++){let E=x.get(w);if(!E)continue;let B=x.get(w+1)?.isWrapped;if(v+=E.translateToString(!B),!B||w===x.length-1){let P=document.createElement("div");P.textContent=v,S.push(P),v.length>0&&(p=P),v=""}}return{bufferElements:S,cursorElement:p}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(f,h){let p=this._optionsService.rawOptions.fastScrollModifier;return p==="alt"&&h.altKey||p==="ctrl"&&h.ctrlKey||p==="shift"&&h.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){let h=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}};s.Viewport=c=a([u(2,_.IBufferService),u(3,_.IOptionsService),u(4,d.ICharSizeService),u(5,d.IRenderService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],c)},3107:function(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(v<3?p(S):v>3?p(c,f,S):p(c,f))||S);return v>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let l=n(4725),d=n(844),m=n(2585),y=s.BufferDecorationRenderer=class extends d.Disposable{constructor(_,c,f,h,p){super(),this._screenElement=_,this._bufferService=c,this._coreBrowserService=f,this._decorationService=h,this._renderService=p,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((v=>this._removeDecoration(v)))),this.register((0,d.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let _ of this._decorationService.decorations)this._renderDecoration(_);this._dimensionsChanged=!1}_renderDecoration(_){this._refreshStyle(_),this._dimensionsChanged&&this._refreshXPosition(_)}_createElement(_){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",_?.options?.layer==="top"),c.style.width=`${Math.round((_.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(_.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(_.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 f=_.options.x??0;return f&&f>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(_,c),c}_refreshStyle(_){let c=_.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)_.element&&(_.element.style.display="none",_.onRenderEmitter.fire(_.element));else{let f=this._decorationElements.get(_);f||(f=this._createElement(_),_.element=f,this._decorationElements.set(_,f),this._container.appendChild(f),_.onDispose((()=>{this._decorationElements.delete(_),f.remove()}))),f.style.top=c*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",_.onRenderEmitter.fire(f)}}_refreshXPosition(_,c=_.element){if(!c)return;let f=_.options.x??0;(_.options.anchor||"left")==="right"?c.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(_){this._decorationElements.get(_)?.remove(),this._decorationElements.delete(_),_.dispose()}};s.BufferDecorationRenderer=y=a([u(1,m.IBufferService),u(2,l.ICoreBrowserService),u(3,m.IDecorationService),u(4,l.IRenderService)],y)},5871:(o,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(n){if(n.options.overviewRulerOptions){for(let a of this._zones)if(a.color===n.options.overviewRulerOptions.color&&a.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,n.marker.line))return;if(this._lineAdjacentToZone(a,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(a,n.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=n.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=n.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=n.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=n.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:n.options.overviewRulerOptions.color,position:n.options.overviewRulerOptions.position,startBufferLine:n.marker.line,endBufferLine:n.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(n){this._linePadding=n}_lineIntersectsZone(n,a){return a>=n.startBufferLine&&a<=n.endBufferLine}_lineAdjacentToZone(n,a,u){return a>=n.startBufferLine-this._linePadding[u||"full"]&&a<=n.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(n,a){n.startBufferLine=Math.min(n.startBufferLine,a),n.endBufferLine=Math.max(n.endBufferLine,a)}}},5744:function(o,s,n){var a=this&&this.__decorate||function(p,v,S,b){var x,w=arguments.length,E=w<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(p,v,S,b);else for(var B=p.length-1;B>=0;B--)(x=p[B])&&(E=(w<3?x(E):w>3?x(v,S,E):x(v,S))||E);return w>3&&E&&Object.defineProperty(v,S,E),E},u=this&&this.__param||function(p,v){return function(S,b){v(S,b,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let l=n(5871),d=n(4725),m=n(844),y=n(2585),_={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},h=s.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,v,S,b,x,w,E){super(),this._viewportElement=p,this._screenElement=v,this._bufferService=S,this._decorationService=b,this._renderService=x,this._optionsService=w,this._coreBrowserService=E,this._colorZoneStore=new l.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,m.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 p=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=p,c.center=v,c.right=p,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=c.left,f.right=c.left+c.center}_refreshDrawHeightConstants(){_.full=Math.round(2*this._coreBrowserService.dpr);let p=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowserService.dpr);_.left=v,_.center=v,_.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;let p=this._colorZoneStore.zones;for(let v of p)v.position!=="full"&&this._renderColorZone(v);for(let v of p)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(f[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-_[p.position||"full"]/2),c[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+_[p.position||"full"]))}_queueRefresh(p,v){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=h=a([u(2,y.IBufferService),u(3,y.IDecorationService),u(4,d.IRenderService),u(5,y.IOptionsService),u(6,d.ICoreBrowserService)],h)},2950:function(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(v<3?p(S):v>3?p(c,f,S):p(c,f))||S);return v>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let l=n(4725),d=n(2585),m=n(2584),y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,c,f,h,p,v){this._textarea=_,this._compositionView=c,this._bufferService=f,this._optionsService=h,this._coreService=p,this._renderService=v,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),f.length>0&&this._coreService.triggerDataEvent(f,!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 _=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,f=c.replace(_,"");this._dataAlreadySent=f,c.length>_.length?this._coreService.triggerDataEvent(f,!0):c.length<_.length?this._coreService.triggerDataEvent(`${m.C0.DEL}`,!0):c.length===_.length&&c!==_&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,p=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=p+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let v=this._compositionView.getBoundingClientRect();this._textarea.style.left=p+"px",this._textarea.style.top=h+"px",this._textarea.style.width=Math.max(v.width,1)+"px",this._textarea.style.height=Math.max(v.height,1)+"px",this._textarea.style.lineHeight=v.height+"px"}_||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=y=a([u(2,d.IBufferService),u(3,d.IOptionsService),u(4,d.ICoreService),u(5,l.IRenderService)],y)},9806:(o,s)=>{function n(a,u,l){let d=l.getBoundingClientRect(),m=a.getComputedStyle(l),y=parseInt(m.getPropertyValue("padding-left")),_=parseInt(m.getPropertyValue("padding-top"));return[u.clientX-d.left-y,u.clientY-d.top-_]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=n,s.getCoords=function(a,u,l,d,m,y,_,c,f){if(!y)return;let h=n(a,u,l);return h?(h[0]=Math.ceil((h[0]+(f?_/2:0))/_),h[1]=Math.ceil(h[1]/c),h[0]=Math.min(Math.max(h[0],1),d+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),m),h):void 0}},9504:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let a=n(2584);function u(c,f,h,p){let v=c-l(c,h),S=f-l(f,h),b=Math.abs(v-S)-(function(x,w,E){let B=0,P=x-l(x,E),W=w-l(w,E);for(let A=0;A<Math.abs(P-W);A++){let V=d(x,w)==="A"?-1:1;E.buffer.lines.get(P+V*A)?.isWrapped&&B++}return B})(c,f,h);return _(b,y(d(c,f),p))}function l(c,f){let h=0,p=f.buffer.lines.get(c),v=p?.isWrapped;for(;v&&c>=0&&c<f.rows;)h++,p=f.buffer.lines.get(--c),v=p?.isWrapped;return h}function d(c,f){return c>f?"A":"B"}function m(c,f,h,p,v,S){let b=c,x=f,w="";for(;b!==h||x!==p;)b+=v?1:-1,v&&b>S.cols-1?(w+=S.buffer.translateBufferLineToString(x,!1,c,b),b=0,c=0,x++):!v&&b<0&&(w+=S.buffer.translateBufferLineToString(x,!1,0,c+1),b=S.cols-1,c=b,x--);return w+S.buffer.translateBufferLineToString(x,!1,c,b)}function y(c,f){let h=f?"O":"[";return a.C0.ESC+h+c}function _(c,f){c=Math.floor(c);let h="";for(let p=0;p<c;p++)h+=f;return h}s.moveToCellSequence=function(c,f,h,p){let v=h.buffer.x,S=h.buffer.y;if(!h.buffer.hasScrollback)return(function(w,E,B,P,W,A){return u(E,P,W,A).length===0?"":_(m(w,E,w,E-l(E,W),!1,W).length,y("D",A))})(v,S,0,f,h,p)+u(S,f,h,p)+(function(w,E,B,P,W,A){let V;V=u(E,P,W,A).length>0?P-l(P,W):E;let O=P,R=(function(F,I,C,L,T,D){let N;return N=u(C,L,T,D).length>0?L-l(L,T):I,F<C&&N<=L||F>=C&&N<L?"C":"D"})(w,E,B,P,W,A);return _(m(w,V,B,O,R==="C",W).length,y(R,A))})(v,S,c,f,h,p);let b;if(S===f)return b=v>c?"D":"C",_(Math.abs(v-c),y(b,p));b=S>f?"D":"C";let x=Math.abs(S-f);return _((function(w,E){return E.cols-w})(S>f?c:v,h)+(x-1)*h.cols+1+((S>f?v:c)-1),y(b,p))}},1296:function(o,s,n){var a=this&&this.__decorate||function(A,V,O,R){var F,I=arguments.length,C=I<3?V:R===null?R=Object.getOwnPropertyDescriptor(V,O):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(A,V,O,R);else for(var L=A.length-1;L>=0;L--)(F=A[L])&&(C=(I<3?F(C):I>3?F(V,O,C):F(V,O))||C);return I>3&&C&&Object.defineProperty(V,O,C),C},u=this&&this.__param||function(A,V){return function(O,R){V(O,R,A)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let l=n(3787),d=n(2550),m=n(2223),y=n(6171),_=n(6052),c=n(4725),f=n(8055),h=n(8460),p=n(844),v=n(2585),S="xterm-dom-renderer-owner-",b="xterm-rows",x="xterm-fg-",w="xterm-bg-",E="xterm-focus",B="xterm-selection",P=1,W=s.DomRenderer=class extends p.Disposable{constructor(A,V,O,R,F,I,C,L,T,D,N,G,$){super(),this._terminal=A,this._document=V,this._element=O,this._screenElement=R,this._viewportElement=F,this._helperContainer=I,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=N,this._coreBrowserService=G,this._themeService=$,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,_.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new h.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,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Y=>this._injectCss(Y)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(l.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Y=>this._handleLinkHover(Y)))),this.register(this._linkifier2.onHideLinkUnderline((Y=>this._handleLinkLeave(Y)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(S+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new d.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let 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 V=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=V,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 V=`${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}`;V+=`${this._terminalSelector} .${b} .xterm-dim { color: ${f.color.multiplyOpacity(A.foreground,.5).css};}`,V+=`${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}`,R=`blink_bar_${this._terminalClass}`,F=`blink_block_${this._terminalClass}`;V+=`@keyframes ${O} { 50% { border-bottom-style: hidden; }}`,V+=`@keyframes ${R} { 50% { box-shadow: none; }}`,V+=`@keyframes ${F} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,V+=`${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${R} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${F} 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);}`,V+=`${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[I,C]of A.ansi.entries())V+=`${this._terminalSelector} .${x}${I} { color: ${C.css}; }${this._terminalSelector} .${x}${I}.xterm-dim { color: ${f.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${w}${I} { background-color: ${C.css}; }`;V+=`${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(A.background).css}; }${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${w}${m.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=V}_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,V){for(let O=this._rowElements.length;O<=V;O++){let R=this._document.createElement("div");this._rowContainer.appendChild(R),this._rowElements.push(R)}for(;this._rowElements.length>V;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,V){this._refreshRowElements(A,V),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,V,O){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,V,O),this.renderRows(0,this._bufferService.rows-1),!A||!V)return;this._selectionRenderModel.update(this._terminal,A,V,O);let R=this._selectionRenderModel.viewportStartRow,F=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||C<0)return;let L=this._document.createDocumentFragment();if(O){let T=A[0]>V[0];L.appendChild(this._createSelectionElement(I,T?V[0]:A[0],T?A[0]:V[0],C-I+1))}else{let T=R===I?A[0]:0,D=I===F?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(I,T,D));let N=C-I-1;if(L.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,N)),I!==C){let G=F===C?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,G))}}this._selectionContainer.appendChild(L)}_createSelectionElement(A,V,O,R=1){let F=this._document.createElement("div"),I=V*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(O-V);return I+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-I),F.style.height=R*this.dimensions.css.cell.height+"px",F.style.top=A*this.dimensions.css.cell.height+"px",F.style.left=`${I}px`,F.style.width=`${C}px`,F}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,V){let O=this._bufferService.buffer,R=O.ybase+O.y,F=Math.min(O.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=A;T<=V;T++){let D=T+O.ydisp,N=this._rowElements[T],G=O.lines.get(D);if(!N||!G)break;N.replaceChildren(...this._rowFactory.createRow(G,D,D===R,C,L,F,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${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,V,O,R,F,I){O<0&&(A=0),R<0&&(V=0);let C=this._bufferService.rows-1;O=Math.max(Math.min(O,C),0),R=Math.max(Math.min(R,C),0),F=Math.min(F,this._bufferService.cols);let L=this._bufferService.buffer,T=L.ybase+L.y,D=Math.min(L.x,F-1),N=this._optionsService.rawOptions.cursorBlink,G=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=O;Y<=R;++Y){let H=Y+L.ydisp,k=this._rowElements[Y],j=L.lines.get(H);if(!k||!j)break;k.replaceChildren(...this._rowFactory.createRow(j,H,H===T,G,$,D,N,this.dimensions.css.cell.width,this._widthCache,I?Y===O?A:0:-1,I?(Y===R?V:F)-1:-1))}}};s.DomRenderer=W=a([u(7,v.IInstantiationService),u(8,c.ICharSizeService),u(9,v.IOptionsService),u(10,v.IBufferService),u(11,c.ICoreBrowserService),u(12,c.IThemeService)],W)},3787:function(o,s,n){var a=this&&this.__decorate||function(b,x,w,E){var B,P=arguments.length,W=P<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(b,x,w,E);else for(var A=b.length-1;A>=0;A--)(B=b[A])&&(W=(P<3?B(W):P>3?B(x,w,W):B(x,w))||W);return P>3&&W&&Object.defineProperty(x,w,W),W},u=this&&this.__param||function(b,x){return function(w,E){x(w,E,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let l=n(2223),d=n(643),m=n(511),y=n(2585),_=n(8055),c=n(4725),f=n(4269),h=n(6171),p=n(3734),v=s.DomRendererRowFactory=class{constructor(b,x,w,E,B,P,W){this._document=b,this._characterJoinerService=x,this._optionsService=w,this._coreBrowserService=E,this._coreService=B,this._decorationService=P,this._themeService=W,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,x,w){this._selectionStart=b,this._selectionEnd=x,this._columnSelectMode=w}createRow(b,x,w,E,B,P,W,A,V,O,R){let F=[],I=this._characterJoinerService.getJoinedCharacters(x),C=this._themeService.colors,L,T=b.getNoBgTrimmedLength();w&&T<P+1&&(T=P+1);let D=0,N="",G=0,$=0,Y=0,H=!1,k=0,j=!1,q=0,U=[],J=O!==-1&&R!==-1;for(let Z=0;Z<T;Z++){b.loadCell(Z,this._workCell);let se=this._workCell.getWidth();if(se===0)continue;let he=!1,fe=Z,te=this._workCell;if(I.length>0&&Z===I[0][0]){he=!0;let we=I.shift();te=new f.JoinedCellData(this._workCell,b.translateToString(!0,we[0],we[1]),we[1]-we[0]),fe=we[1]-1,se=te.getWidth()}let qe=this._isCellInSelection(Z,x),le=w&&Z===P,Me=J&&Z>=O&&Z<=R,st=!1;this._decorationService.forEachDecorationAtCell(Z,x,void 0,(we=>{st=!0}));let He=te.getChars()||d.WHITESPACE_CELL_CHAR;if(He===" "&&(te.isUnderline()||te.isOverline())&&(He="\xA0"),q=se*A-V.get(He,te.isBold(),te.isItalic()),L){if(D&&(qe&&j||!qe&&!j&&te.bg===G)&&(qe&&j&&C.selectionForeground||te.fg===$)&&te.extended.ext===Y&&Me===H&&q===k&&!le&&!he&&!st){te.isInvisible()?N+=d.WHITESPACE_CELL_CHAR:N+=He,D++;continue}D&&(L.textContent=N),L=this._document.createElement("span"),D=0,N=""}else L=this._document.createElement("span");if(G=te.bg,$=te.fg,Y=te.extended.ext,H=Me,k=q,j=qe,he&&P>=Z&&P<=fe&&(P=Z),!this._coreService.isCursorHidden&&le&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&U.push("xterm-cursor-blink"),U.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline")}}if(te.isBold()&&U.push("xterm-bold"),te.isItalic()&&U.push("xterm-italic"),te.isDim()&&U.push("xterm-dim"),N=te.isInvisible()?d.WHITESPACE_CELL_CHAR:te.getChars()||d.WHITESPACE_CELL_CHAR,te.isUnderline()&&(U.push(`xterm-underline-${te.extended.underlineStyle}`),N===" "&&(N="\xA0"),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let we=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&we<8&&(we+=8),L.style.textDecorationColor=C.ansi[we].css}te.isOverline()&&(U.push("xterm-overline"),N===" "&&(N="\xA0")),te.isStrikethrough()&&U.push("xterm-strikethrough"),Me&&(L.style.textDecoration="underline");let ee=te.getFgColor(),ne=te.getFgColorMode(),ge=te.getBgColor(),be=te.getBgColorMode(),je=!!te.isInverse();if(je){let we=ee;ee=ge,ge=we;let _t=ne;ne=be,be=_t}let Oe,ze,Re,We=!1;switch(this._decorationService.forEachDecorationAtCell(Z,x,void 0,(we=>{we.options.layer!=="top"&&We||(we.backgroundColorRGB&&(be=50331648,ge=we.backgroundColorRGB.rgba>>8&16777215,Oe=we.backgroundColorRGB),we.foregroundColorRGB&&(ne=50331648,ee=we.foregroundColorRGB.rgba>>8&16777215,ze=we.foregroundColorRGB),We=we.options.layer==="top")})),!We&&qe&&(Oe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ge=Oe.rgba>>8&16777215,be=50331648,We=!0,C.selectionForeground&&(ne=50331648,ee=C.selectionForeground.rgba>>8&16777215,ze=C.selectionForeground)),We&&U.push("xterm-decoration-top"),be){case 16777216:case 33554432:Re=C.ansi[ge],U.push(`xterm-bg-${ge}`);break;case 50331648:Re=_.channels.toColor(ge>>16,ge>>8&255,255&ge),this._addStyle(L,`background-color:#${S((ge>>>0).toString(16),"0",6)}`);break;default:je?(Re=C.foreground,U.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):Re=C.background}switch(Oe||te.isDim()&&(Oe=_.color.multiplyOpacity(Re,.5)),ne){case 16777216:case 33554432:te.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(L,Re,C.ansi[ee],te,Oe,void 0)||U.push(`xterm-fg-${ee}`);break;case 50331648:let we=_.channels.toColor(ee>>16&255,ee>>8&255,255&ee);this._applyMinimumContrast(L,Re,we,te,Oe,ze)||this._addStyle(L,`color:#${S(ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Re,C.foreground,te,Oe,ze)||je&&U.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}U.length&&(L.className=U.join(" "),U.length=0),le||he||st?L.textContent=N:D++,q!==this.defaultSpacing&&(L.style.letterSpacing=`${q}px`),F.push(L),Z=fe}return L&&D&&(L.textContent=N),F}_applyMinimumContrast(b,x,w,E,B,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.treatGlyphAsBackgroundColor)(E.getCode()))return!1;let W=this._getContrastCache(E),A;if(B||P||(A=W.getColor(x.rgba,w.rgba)),A===void 0){let V=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);A=_.color.ensureContrastRatio(B||x,P||w,V),W.setColor((B||x).rgba,(P||w).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,x){b.setAttribute("style",`${b.getAttribute("style")||""}${x};`)}_isCellInSelection(b,x){let w=this._selectionStart,E=this._selectionEnd;return!(!w||!E)&&(this._columnSelectMode?w[0]<=E[0]?b>=w[0]&&x>=w[1]&&b<E[0]&&x<=E[1]:b<w[0]&&x>=w[1]&&b>=E[0]&&x<=E[1]:x>w[1]&&x<E[1]||w[1]===E[1]&&x===w[1]&&b>=w[0]&&b<E[0]||w[1]<E[1]&&x===E[1]&&b<E[0]||w[1]<E[1]&&x===w[1]&&b>=w[0])}};function S(b,x,w){for(;b.length<w;)b=x+b;return b}s.DomRendererRowFactory=v=a([u(1,c.ICharacterJoinerService),u(2,y.IOptionsService),u(3,c.ICoreBrowserService),u(4,y.ICoreService),u(5,y.IDecorationService),u(6,c.IThemeService)],v)},2550:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(n,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=n.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let u=n.createElement("span");u.classList.add("xterm-char-measure-element");let l=n.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let d=n.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";let m=n.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[u,l,d,m],this._container.appendChild(u),this._container.appendChild(l),this._container.appendChild(d),this._container.appendChild(m),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(n,a,u,l){n===this._font&&a===this._fontSize&&u===this._weight&&l===this._weightBold||(this._font=n,this._fontSize=a,this._weight=u,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(n,a,u){let l=0;if(!a&&!u&&n.length===1&&(l=n.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let y=this._measure(n,0);return y>0&&(this._flat[l]=y),y}let d=n;a&&(d+="B"),u&&(d+="I");let m=this._holey.get(d);if(m===void 0){let y=0;a&&(y|=1),u&&(y|=2),m=this._measure(n,y),m>0&&this._holey.set(d,m)}return m}_measure(n,a){let u=this._measureElements[a];return u.textContent=n.repeat(32),u.offsetWidth/32}}},2223:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let a=n(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(o,s)=>{function n(u){return 57508<=u&&u<=57558}function a(u){return u>=128512&&u<=128591||u>=127744&&u<=128511||u>=128640&&u<=128767||u>=9728&&u<=9983||u>=9984&&u<=10175||u>=65024&&u<=65039||u>=129280&&u<=129535||u>=127462&&u<=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(u){if(!u)throw new Error("value must not be falsy");return u},s.isPowerlineGlyph=n,s.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},s.isEmoji=a,s.allowRescaling=function(u,l,d,m){return l===1&&d>Math.ceil(1.5*m)&&u!==void 0&&u>255&&!a(u)&&!n(u)&&!(function(y){return 57344<=y&&y<=63743})(u)},s.treatGlyphAsBackgroundColor=function(u){return n(u)||(function(l){return 9472<=l&&l<=9631})(u)},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(u,l,d=0){return(u-(2*Math.round(l)-d))%(2*Math.round(l))}},6052:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(u,l,d,m=!1){if(this.selectionStart=l,this.selectionEnd=d,!l||!d||l[0]===d[0]&&l[1]===d[1])return void this.clear();let y=u.buffers.active.ydisp,_=l[1]-y,c=d[1]-y,f=Math.max(_,0),h=Math.min(c,u.rows-1);f>=u.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=_,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=h,this.startCol=l[0],this.endCol=d[0])}isCellSelected(u,l,d){return!!this.hasSelection&&(d-=u.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&d>=this.viewportCappedStartRow&&l<this.endCol&&d<=this.viewportCappedEndRow:l<this.startCol&&d>=this.viewportCappedStartRow&&l>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol)}}s.createSelectionRenderModel=function(){return new n}},456:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(n){this._bufferService=n,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?n%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)-1]:[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[n,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[Math.max(n,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let n=this.selectionStart,a=this.selectionEnd;return!(!n||!a)&&(n[1]>a[1]||n[1]===a[1]&&n[0]>a[0])}handleTrim(n){return this.selectionStart&&(this.selectionStart[1]-=n),this.selectionEnd&&(this.selectionEnd[1]-=n),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let l=n(2585),d=n(8460),m=n(844),y=s.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(h,p,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new c(h,p,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let h=this._measureStrategy.measure();h.width===this.width&&h.height===this.height||(this.width=h.width,this.height=h.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=a([u(2,l.IOptionsService)],y);class _ extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(p,v){p!==void 0&&p>0&&v!==void 0&&v>0&&(this._result.width=p,this._result.height=v)}}class c extends _{constructor(p,v,S){super(),this._document=p,this._parentElement=v,this._optionsService=S,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 f extends _{constructor(p){super(),this._optionsService=p,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let v=this._ctx.measureText("W");if(!("width"in v&&"fontBoundingBoxAscent"in v&&"fontBoundingBoxDescent"in v))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let p=this._ctx.measureText("W");return this._validateAndSet(p.width,p.fontBoundingBoxAscent+p.fontBoundingBoxDescent),this._result}}},4269:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,v){var S,b=arguments.length,x=b<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,v);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,v){h(p,v,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let l=n(3734),d=n(643),m=n(511),y=n(2585);class _ extends l.AttributeData{constructor(h,p,v){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=p,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(h){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=_;let c=s.CharacterJoinerService=class Aa{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(h){let p={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(p),p.id}deregister(h){for(let p=0;p<this._characterJoiners.length;p++)if(this._characterJoiners[p].id===h)return this._characterJoiners.splice(p,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];let p=this._bufferService.buffer.lines.get(h);if(!p||p.length===0)return[];let v=[],S=p.translateToString(!0),b=0,x=0,w=0,E=p.getFg(0),B=p.getBg(0);for(let P=0;P<p.getTrimmedLength();P++)if(p.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==B){if(P-b>1){let W=this._getJoinedRanges(S,w,x,p,b);for(let A=0;A<W.length;A++)v.push(W[A])}b=P,w=x,E=this._workCell.fg,B=this._workCell.bg}x+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){let P=this._getJoinedRanges(S,w,x,p,b);for(let W=0;W<P.length;W++)v.push(P[W])}return v}_getJoinedRanges(h,p,v,S,b){let x=h.substring(p,v),w=[];try{w=this._characterJoiners[0].handler(x)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{let B=this._characterJoiners[E].handler(x);for(let P=0;P<B.length;P++)Aa._mergeRanges(w,B[P])}catch(B){console.error(B)}return this._stringRangesToCellRanges(w,S,b),w}_stringRangesToCellRanges(h,p,v){let S=0,b=!1,x=0,w=h[S];if(w){for(let E=v;E<this._bufferService.cols;E++){let B=p.getWidth(E),P=p.getString(E).length||d.WHITESPACE_CELL_CHAR.length;if(B!==0){if(!b&&w[0]<=x&&(w[0]=E,b=!0),w[1]<=x){if(w[1]=E,w=h[++S],!w)break;w[0]<=x?(w[0]=E,b=!0):b=!1}x+=P}}w&&(w[1]=this._bufferService.cols)}}static _mergeRanges(h,p){let v=!1;for(let S=0;S<h.length;S++){let b=h[S];if(v){if(p[1]<=b[0])return h[S-1][1]=p[1],h;if(p[1]<=b[1])return h[S-1][1]=Math.max(p[1],b[1]),h.splice(S,1),h;h.splice(S,1),S--}else{if(p[1]<=b[0])return h.splice(S,0,p),h;if(p[1]<=b[1])return b[0]=Math.min(p[0],b[0]),h;p[0]<b[1]&&(b[0]=Math.min(p[0],b[0]),v=!0)}}return v?h[h.length-1][1]=p[1]:h.push(p),h}};s.CharacterJoinerService=c=a([u(0,y.IBufferService)],c)},5114:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let a=n(844),u=n(8460),l=n(3656);class d extends a.Disposable{constructor(_,c,f){super(),this._textarea=_,this._window=c,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new u.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((h=>this._screenDprMonitor.setWindow(h)))),this.register((0,u.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(_){this._window!==_&&(this._window=_,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=d;class m extends a.Disposable{constructor(_){super(),this._parentWindow=_,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new u.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(_){this._parentWindow=_,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,l.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:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let a=n(844);class u extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{let m=this.linkProviders.indexOf(d);m!==-1&&this.linkProviders.splice(m,1)}}}}s.LinkProviderService=u},8934:function(o,s,n){var a=this&&this.__decorate||function(y,_,c,f){var h,p=arguments.length,v=p<3?_:f===null?f=Object.getOwnPropertyDescriptor(_,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(y,_,c,f);else for(var S=y.length-1;S>=0;S--)(h=y[S])&&(v=(p<3?h(v):p>3?h(_,c,v):h(_,c))||v);return p>3&&v&&Object.defineProperty(_,c,v),v},u=this&&this.__param||function(y,_){return function(c,f){_(c,f,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let l=n(4725),d=n(9806),m=s.MouseService=class{constructor(y,_){this._renderService=y,this._charSizeService=_}getCoords(y,_,c,f,h){return(0,d.getCoords)(window,y,_,c,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(y,_){let c=(0,d.getCoordsRelativeToElement)(window,y,_);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=m=a([u(0,l.IRenderService),u(1,l.ICharSizeService)],m)},3230:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let l=n(6193),d=n(4725),m=n(8460),y=n(844),_=n(7226),c=n(2585),f=s.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(h,p,v,S,b,x,w,E){super(),this._rowCount=h,this._charSizeService=S,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new _.DebouncedIdleTask,this._observerDisposable=this.register(new y.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 m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new l.RenderDebouncer(((B,P)=>this._renderRows(B,P)),w),this.register(this._renderDebouncer),this.register(w.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(x.onResize((()=>this._fullRefresh()))),this.register(x.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(v.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(b.onDecorationRegistered((()=>this._fullRefresh()))),this.register(b.onDecorationRemoved((()=>this._fullRefresh()))),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(x.cols,x.rows),this._fullRefresh()}))),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(x.buffer.y,x.buffer.y,!0)))),this.register(E.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(w.window,p),this.register(w.onWindowChange((B=>this._registerIntersectionObserver(B,p))))}_registerIntersectionObserver(h,p){if("IntersectionObserver"in h){let v=new h.IntersectionObserver((S=>this._handleIntersectionChange(S[S.length-1])),{threshold:0});v.observe(p),this._observerDisposable.value=(0,y.toDisposable)((()=>v.disconnect()))}}_handleIntersectionChange(h){this._isPaused=h.isIntersecting===void 0?h.intersectionRatio===0:!h.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(h,p,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(h,p,this._rowCount))}_renderRows(h,p){this._renderer.value&&(h=Math.min(h,this._rowCount-1),p=Math.min(p,this._rowCount-1),this._renderer.value.renderRows(h,p),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:h,end:p}),this._onRender.fire({start:h,end:p}),this._isNextRenderRedrawOnly=!0)}resize(h,p){this._rowCount=p,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(h){this._renderer.value=h,this._renderer.value&&(this._renderer.value.onRequestRedraw((p=>this.refreshRows(p.start,p.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(h){return this._renderDebouncer.addRefreshCallback(h)}_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(h,p){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(h,p))):this._renderer.value.handleResize(h,p),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(h,p,v){this._selectionState.start=h,this._selectionState.end=p,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(h,p,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=f=a([u(2,c.IOptionsService),u(3,d.ICharSizeService),u(4,c.IDecorationService),u(5,c.IBufferService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],f)},9312:function(o,s,n){var a=this&&this.__decorate||function(w,E,B,P){var W,A=arguments.length,V=A<3?E:P===null?P=Object.getOwnPropertyDescriptor(E,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(w,E,B,P);else for(var O=w.length-1;O>=0;O--)(W=w[O])&&(V=(A<3?W(V):A>3?W(E,B,V):W(E,B))||V);return A>3&&V&&Object.defineProperty(E,B,V),V},u=this&&this.__param||function(w,E){return function(B,P){E(B,P,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let l=n(9806),d=n(9504),m=n(456),y=n(4725),_=n(8460),c=n(844),f=n(6114),h=n(4841),p=n(511),v=n(2585),S="\xA0",b=new RegExp(S,"g"),x=s.SelectionService=class extends c.Disposable{constructor(w,E,B,P,W,A,V,O,R){super(),this._element=w,this._screenElement=E,this._linkifier=B,this._bufferService=P,this._coreService=W,this._mouseService=A,this._optionsService=V,this._renderService=O,this._coreBrowserService=R,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=F=>this._handleMouseMove(F),this._mouseUpListener=F=>this._handleMouseUp(F),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((F=>this._handleTrim(F))),this.register(this._bufferService.buffers.onBufferActivate((F=>this._handleBufferActivate(F)))),this.enable(),this._model=new m.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 w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!w||!E||w[0]===E[0]&&w[1]===E[1])}get selectionText(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!w||!E)return"";let B=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(w[0]===E[0])return"";let W=w[0]<E[0]?w[0]:E[0],A=w[0]<E[0]?E[0]:w[0];for(let V=w[1];V<=E[1];V++){let O=B.translateBufferLineToString(V,!0,W,A);P.push(O)}}else{let W=w[1]===E[1]?E[0]:void 0;P.push(B.translateBufferLineToString(w[1],!0,w[0],W));for(let A=w[1]+1;A<=E[1]-1;A++){let V=B.lines.get(A),O=B.translateBufferLineToString(A,!0);V?.isWrapped?P[P.length-1]+=O:P.push(O)}if(w[1]!==E[1]){let A=B.lines.get(E[1]),V=B.translateBufferLineToString(E[1],!0,0,E[0]);A&&A.isWrapped?P[P.length-1]+=V:P.push(V)}}return P.map((W=>W.replace(b," "))).join(f.isWindows?`\r
6
6
  `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(w){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&w&&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(w){let E=this._getMouseBufferCoords(w),B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(B&&P&&E)&&this._areCoordsInSelection(E,B,P)}isCellInSelection(w,E){let B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!B||!P)&&this._areCoordsInSelection([w,E],B,P)}_areCoordsInSelection(w,E,B){return w[1]>E[1]&&w[1]<B[1]||E[1]===B[1]&&w[1]===E[1]&&w[0]>=E[0]&&w[0]<B[0]||E[1]<B[1]&&w[1]===B[1]&&w[0]<B[0]||E[1]<B[1]&&w[1]===E[1]&&w[0]>=E[0]}_selectWordAtCursor(w,E){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,h.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let P=this._getMouseBufferCoords(w);return!!P&&(this._selectWordAt(P,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(w,E){this._model.clearSelection(),w=Math.max(w,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,w],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(w){this._model.handleTrim(w)&&this.refresh()}_getMouseBufferCoords(w){let E=this._mouseService.getCoords(w,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(w){let E=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,w,this._screenElement)[1],B=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=B?0:(E>B&&(E-=B),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(w){return f.isMac?w.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:w.shiftKey}handleMouseDown(w){if(this._mouseDownTimeStamp=w.timeStamp,(w.button!==2||!this.hasSelection)&&w.button===0){if(!this._enabled){if(!this.shouldForceSelection(w))return;w.stopPropagation()}w.preventDefault(),this._dragScrollAmount=0,this._enabled&&w.shiftKey?this._handleIncrementalClick(w):w.detail===1?this._handleSingleClick(w):w.detail===2?this._handleDoubleClick(w):w.detail===3&&this._handleTripleClick(w),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(w){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(w))}_handleSingleClick(w){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(w)?3:0,this._model.selectionStart=this._getMouseBufferCoords(w),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(w){this._selectWordAtCursor(w,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(w){let E=this._getMouseBufferCoords(w);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(w){return w.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(w){if(w.stopImmediatePropagation(),!this._model.selectionStart)return;let E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(w),!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(w),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]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let w=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(w.ydisp+this._bufferService.rows,w.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=w.ydisp),this.refresh()}}_handleMouseUp(w){let E=w.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&w.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let B=this._mouseService.getCoords(w,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){let P=(0,d.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,B=!(!w||!E||w[0]===E[0]&&w[1]===E[1]);B?w&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&w[0]===this._oldSelectionStart[0]&&w[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(w,E,B)):this._oldHasSelection&&this._fireOnSelectionChange(w,E,B)}_fireOnSelectionChange(w,E,B){this._oldSelectionStart=w,this._oldSelectionEnd=E,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(w){this.clearSelection(),this._trimListener.dispose(),this._trimListener=w.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(w,E){let B=E;for(let P=0;E>=P;P++){let W=w.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:W>1&&E!==P&&(B+=W-1)}return B}setSelection(w,E,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[w,E],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(w){this._isClickInSelection(w)||(this._selectWordAtCursor(w,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(w,E,B=!0,P=!0){if(w[0]>=this._bufferService.cols)return;let W=this._bufferService.buffer,A=W.lines.get(w[1]);if(!A)return;let V=W.translateBufferLineToString(w[1],!1),O=this._convertViewportColToCharacterIndex(A,w[0]),R=O,F=w[0]-O,I=0,C=0,L=0,T=0;if(V.charAt(O)===" "){for(;O>0&&V.charAt(O-1)===" ";)O--;for(;R<V.length&&V.charAt(R+1)===" ";)R++}else{let G=w[0],$=w[0];A.getWidth(G)===0&&(I++,G--),A.getWidth($)===2&&(C++,$++);let Y=A.getString($).length;for(Y>1&&(T+=Y-1,R+=Y-1);G>0&&O>0&&!this._isCharWordSeparator(A.loadCell(G-1,this._workCell));){A.loadCell(G-1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,G--):H>1&&(L+=H-1,O-=H-1),O--,G--}for(;$<A.length&&R+1<V.length&&!this._isCharWordSeparator(A.loadCell($+1,this._workCell));){A.loadCell($+1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,$++):H>1&&(T+=H-1,R+=H-1),R++,$++}}R++;let D=O+F-I+L,N=Math.min(this._bufferService.cols,R-O+I+C-L-T);if(E||V.slice(O,R).trim()!==""){if(B&&D===0&&A.getCodePoint(0)!==32){let G=W.lines.get(w[1]-1);if(G&&A.isWrapped&&G.getCodePoint(this._bufferService.cols-1)!==32){let $=this._getWordAt([this._bufferService.cols-1,w[1]-1],!1,!0,!1);if($){let Y=this._bufferService.cols-$.start;D-=Y,N+=Y}}}if(P&&D+N===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let G=W.lines.get(w[1]+1);if(G?.isWrapped&&G.getCodePoint(0)!==32){let $=this._getWordAt([0,w[1]+1],!1,!1,!0);$&&(N+=$.length)}}return{start:D,length:N}}}_selectWordAt(w,E){let B=this._getWordAt(w,E);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,w[1]--;this._model.selectionStart=[B.start,w[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(w){let E=this._getWordAt(w,!0);if(E){let B=w[1];for(;E.start<0;)E.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,B]}}_isCharWordSeparator(w){return w.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(w.getChars())>=0}_selectLineAt(w){let E=this._bufferService.buffer.getWrappedRangeForLine(w),B={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(B,this._bufferService.cols)}};s.SelectionService=x=a([u(3,g.IBufferService),u(4,g.ICoreService),u(5,y.IMouseService),u(6,g.IOptionsService),u(7,y.IRenderService),u(8,y.ICoreBrowserService)],x)},4725:(o,s,n)=>{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 a=n(8343);s.ICharSizeService=(0,a.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),s.IMouseService=(0,a.createDecorator)("MouseService"),s.IRenderService=(0,a.createDecorator)("RenderService"),s.ISelectionService=(0,a.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,a.createDecorator)("ThemeService"),s.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(o,s,n){var a=this&&this.__decorate||function(x,w,E,B){var P,W=arguments.length,A=W<3?w:B===null?B=Object.getOwnPropertyDescriptor(w,E):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,w,E,B);else for(var V=x.length-1;V>=0;V--)(P=x[V])&&(A=(W<3?P(A):W>3?P(w,E,A):P(w,E))||A);return W>3&&A&&Object.defineProperty(w,E,A),A},u=this&&this.__param||function(x,w){return function(E,B){w(E,B,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let l=n(7239),d=n(8055),m=n(8460),y=n(844),_=n(2585),c=d.css.toColor("#ffffff"),f=d.css.toColor("#000000"),h=d.css.toColor("#ffffff"),p=d.css.toColor("#000000"),g={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let x=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],w=[0,95,135,175,215,255];for(let E=0;E<216;E++){let B=w[E/36%6|0],P=w[E/6%6|0],W=w[E%6];x.push({css:d.channels.toCss(B,P,W),rgba:d.channels.toRgba(B,P,W)})}for(let E=0;E<24;E++){let B=8+10*E;x.push({css:d.channels.toCss(B,B,B),rgba:d.channels.toRgba(B,B,B)})}return x})());let S=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(x){super(),this._optionsService=x,this._contrastCache=new l.ColorContrastCache,this._halfContrastCache=new l.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:f,cursor:h,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:g,selectionBackgroundOpaque:d.color.blend(f,g),selectionInactiveBackgroundTransparent:g,selectionInactiveBackgroundOpaque:d.color.blend(f,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(x={}){let w=this._colors;if(w.foreground=b(x.foreground,c),w.background=b(x.background,f),w.cursor=b(x.cursor,h),w.cursorAccent=b(x.cursorAccent,p),w.selectionBackgroundTransparent=b(x.selectionBackground,g),w.selectionBackgroundOpaque=d.color.blend(w.background,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundTransparent=b(x.selectionInactiveBackground,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundOpaque=d.color.blend(w.background,w.selectionInactiveBackgroundTransparent),w.selectionForeground=x.selectionForeground?b(x.selectionForeground,d.NULL_COLOR):void 0,w.selectionForeground===d.NULL_COLOR&&(w.selectionForeground=void 0),d.color.isOpaque(w.selectionBackgroundTransparent)&&(w.selectionBackgroundTransparent=d.color.opacity(w.selectionBackgroundTransparent,.3)),d.color.isOpaque(w.selectionInactiveBackgroundTransparent)&&(w.selectionInactiveBackgroundTransparent=d.color.opacity(w.selectionInactiveBackgroundTransparent,.3)),w.ansi=s.DEFAULT_ANSI_COLORS.slice(),w.ansi[0]=b(x.black,s.DEFAULT_ANSI_COLORS[0]),w.ansi[1]=b(x.red,s.DEFAULT_ANSI_COLORS[1]),w.ansi[2]=b(x.green,s.DEFAULT_ANSI_COLORS[2]),w.ansi[3]=b(x.yellow,s.DEFAULT_ANSI_COLORS[3]),w.ansi[4]=b(x.blue,s.DEFAULT_ANSI_COLORS[4]),w.ansi[5]=b(x.magenta,s.DEFAULT_ANSI_COLORS[5]),w.ansi[6]=b(x.cyan,s.DEFAULT_ANSI_COLORS[6]),w.ansi[7]=b(x.white,s.DEFAULT_ANSI_COLORS[7]),w.ansi[8]=b(x.brightBlack,s.DEFAULT_ANSI_COLORS[8]),w.ansi[9]=b(x.brightRed,s.DEFAULT_ANSI_COLORS[9]),w.ansi[10]=b(x.brightGreen,s.DEFAULT_ANSI_COLORS[10]),w.ansi[11]=b(x.brightYellow,s.DEFAULT_ANSI_COLORS[11]),w.ansi[12]=b(x.brightBlue,s.DEFAULT_ANSI_COLORS[12]),w.ansi[13]=b(x.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),w.ansi[14]=b(x.brightCyan,s.DEFAULT_ANSI_COLORS[14]),w.ansi[15]=b(x.brightWhite,s.DEFAULT_ANSI_COLORS[15]),x.extendedAnsi){let E=Math.min(w.ansi.length-16,x.extendedAnsi.length);for(let B=0;B<E;B++)w.ansi[B+16]=b(x.extendedAnsi[B],s.DEFAULT_ANSI_COLORS[B+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(x){this._restoreColor(x),this._onChangeColors.fire(this.colors)}_restoreColor(x){if(x!==void 0)switch(x){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[x]=this._restoreColors.ansi[x]}else for(let w=0;w<this._restoreColors.ansi.length;++w)this._colors.ansi[w]=this._restoreColors.ansi[w]}modifyColors(x){x(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(x,w){if(x!==void 0)try{return d.css.toColor(x)}catch{}return w}s.ThemeService=S=a([u(0,_.IOptionsService)],S)},6349:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let a=n(8460),u=n(844);class l extends u.Disposable{constructor(m){super(),this._maxLength=m,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(m){if(this._maxLength===m)return;let y=new Array(m);for(let _=0;_<Math.min(m,this.length);_++)y[_]=this._array[this._getCyclicIndex(_)];this._array=y,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let y=this._length;y<m;y++)this._array[y]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,y){this._array[this._getCyclicIndex(m)]=y}push(m){this._array[this._getCyclicIndex(this._length)]=m,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(m,y,..._){if(y){for(let c=m;c<this._length-y;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+y)];this._length-=y,this.onDeleteEmitter.fire({index:m,amount:y})}for(let c=this._length-1;c>=m;c--)this._array[this._getCyclicIndex(c+_.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<_.length;c++)this._array[this._getCyclicIndex(m+c)]=_[c];if(_.length&&this.onInsertEmitter.fire({index:m,amount:_.length}),this._length+_.length>this._maxLength){let c=this._length+_.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=_.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,_){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let f=y-1;f>=0;f--)this.set(m+f+_,this.get(m+f));let c=m+y+_-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<y;c++)this.set(m+c+_,this.get(m+c))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}s.CircularList=l},1439:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function n(a,u=5){if(typeof a!="object")return a;let l=Array.isArray(a)?[]:{};for(let d in a)l[d]=u<=1?a[d]:a[d]&&n(a[d],u-1);return l}},8055:(o,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 n=0,a=0,u=0,l=0;var d,m,y,_,c;function f(p){let g=p.toString(16);return g.length<2?"0"+g:g}function h(p,g){return p<g?(g+.05)/(p+.05):(p+.05)/(g+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(g,S,b,x){return x!==void 0?`#${f(g)}${f(S)}${f(b)}${f(x)}`:`#${f(g)}${f(S)}${f(b)}`},p.toRgba=function(g,S,b,x=255){return(g<<24|S<<16|b<<8|x)>>>0},p.toColor=function(g,S,b,x){return{css:p.toCss(g,S,b,x),rgba:p.toRgba(g,S,b,x)}}})(d||(s.channels=d={})),(function(p){function g(S,b){return l=Math.round(255*b),[n,a,u]=c.toChannels(S.rgba),{css:d.toCss(n,a,u,l),rgba:d.toRgba(n,a,u,l)}}p.blend=function(S,b){if(l=(255&b.rgba)/255,l===1)return{css:b.css,rgba:b.rgba};let x=b.rgba>>24&255,w=b.rgba>>16&255,E=b.rgba>>8&255,B=S.rgba>>24&255,P=S.rgba>>16&255,W=S.rgba>>8&255;return n=B+Math.round((x-B)*l),a=P+Math.round((w-P)*l),u=W+Math.round((E-W)*l),{css:d.toCss(n,a,u),rgba:d.toRgba(n,a,u)}},p.isOpaque=function(S){return(255&S.rgba)==255},p.ensureContrastRatio=function(S,b,x){let w=c.ensureContrastRatio(S.rgba,b.rgba,x);if(w)return d.toColor(w>>24&255,w>>16&255,w>>8&255)},p.opaque=function(S){let b=(255|S.rgba)>>>0;return[n,a,u]=c.toChannels(b),{css:d.toCss(n,a,u),rgba:b}},p.opacity=g,p.multiplyOpacity=function(S,b){return l=255&S.rgba,g(S,l*b/255)},p.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(m||(s.color=m={})),(function(p){let g,S;try{let b=document.createElement("canvas");b.width=1,b.height=1;let x=b.getContext("2d",{willReadFrequently:!0});x&&(g=x,g.globalCompositeOperation="copy",S=g.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return n=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),u=parseInt(b.slice(3,4).repeat(2),16),d.toColor(n,a,u);case 5:return n=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),u=parseInt(b.slice(3,4).repeat(2),16),l=parseInt(b.slice(4,5).repeat(2),16),d.toColor(n,a,u,l);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 x=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(x)return n=parseInt(x[1]),a=parseInt(x[2]),u=parseInt(x[3]),l=Math.round(255*(x[5]===void 0?1:parseFloat(x[5]))),d.toColor(n,a,u,l);if(!g||!S)throw new Error("css.toColor: Unsupported css format");if(g.fillStyle=S,g.fillStyle=b,typeof g.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(g.fillRect(0,0,1,1),[n,a,u,l]=g.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(n,a,u,l),css:b}}})(y||(s.css=y={})),(function(p){function g(S,b,x){let w=S/255,E=b/255,B=x/255;return .2126*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}p.relativeLuminance=function(S){return g(S>>16&255,S>>8&255,255&S)},p.relativeLuminance2=g})(_||(s.rgb=_={})),(function(p){function g(b,x,w){let E=b>>24&255,B=b>>16&255,P=b>>8&255,W=x>>24&255,A=x>>16&255,V=x>>8&255,O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));for(;O<w&&(W>0||A>0||V>0);)W-=Math.max(0,Math.ceil(.1*W)),A-=Math.max(0,Math.ceil(.1*A)),V-=Math.max(0,Math.ceil(.1*V)),O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));return(W<<24|A<<16|V<<8|255)>>>0}function S(b,x,w){let E=b>>24&255,B=b>>16&255,P=b>>8&255,W=x>>24&255,A=x>>16&255,V=x>>8&255,O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));for(;O<w&&(W<255||A<255||V<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),A=Math.min(255,A+Math.ceil(.1*(255-A))),V=Math.min(255,V+Math.ceil(.1*(255-V))),O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));return(W<<24|A<<16|V<<8|255)>>>0}p.blend=function(b,x){if(l=(255&x)/255,l===1)return x;let w=x>>24&255,E=x>>16&255,B=x>>8&255,P=b>>24&255,W=b>>16&255,A=b>>8&255;return n=P+Math.round((w-P)*l),a=W+Math.round((E-W)*l),u=A+Math.round((B-A)*l),d.toRgba(n,a,u)},p.ensureContrastRatio=function(b,x,w){let E=_.relativeLuminance(b>>8),B=_.relativeLuminance(x>>8);if(h(E,B)<w){if(B<E){let A=g(b,x,w),V=h(E,_.relativeLuminance(A>>8));if(V<w){let O=S(b,x,w);return V>h(E,_.relativeLuminance(O>>8))?A:O}return A}let P=S(b,x,w),W=h(E,_.relativeLuminance(P>>8));if(W<w){let A=g(b,x,w);return W>h(E,_.relativeLuminance(A>>8))?P:A}return P}},p.reduceLuminance=g,p.increaseLuminance=S,p.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}})(c||(s.rgba=c={})),s.toPaddedHex=f,s.contrastRatio=h},8969:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let a=n(844),u=n(2585),l=n(4348),d=n(7866),m=n(744),y=n(7302),_=n(6975),c=n(8460),f=n(1753),h=n(1480),p=n(7994),g=n(9282),S=n(5435),b=n(5981),x=n(2660),w=!1;class E extends a.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 W in P)this.optionsService.options[W]=P[W]}constructor(P){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 l.InstantiationService,this.optionsService=this.register(new y.OptionsService(P)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(_.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(x.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.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((W=>{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((W=>{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(((W,A)=>this._inputHandler.parse(W,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,W){this._writeBuffer.write(P,W)}writeSync(P,W){this._logService.logLevel<=u.LogLevelEnum.WARN&&!w&&(this._logService.warn("writeSync is unreliable and will be removed soon."),w=!0),this._writeBuffer.writeSync(P,W)}input(P,W=!0){this.coreService.triggerDataEvent(P,W)}resize(P,W){isNaN(P)||isNaN(W)||(P=Math.max(P,m.MINIMUM_COLS),W=Math.max(W,m.MINIMUM_ROWS),this._bufferService.resize(P,W))}scroll(P,W=!1){this._bufferService.scroll(P,W)}scrollLines(P,W,A){this._bufferService.scrollLines(P,W,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 W=P-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(P,W){return this._inputHandler.registerEscHandler(P,W)}registerDcsHandler(P,W){return this._inputHandler.registerDcsHandler(P,W)}registerCsiHandler(P,W){return this._inputHandler.registerCsiHandler(P,W)}registerOscHandler(P,W){return this._inputHandler.registerOscHandler(P,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1,W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?P=W.backend==="conpty"&&W.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,a.toDisposable)((()=>{for(let W of P)W.dispose()}))}}}s.CoreTerminal=E},8460:(o,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=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===n)return void this._listeners.splice(a,1)}}})),this._event}fire(n,a){let u=[];for(let l=0;l<this._listeners.length;l++)u.push(this._listeners[l]);for(let l=0;l<u.length;l++)u[l].call(void 0,n,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(n,a){return n((u=>a.fire(u)))},s.runAndSubscribe=function(n,a){return a(void 0),n((u=>a(u)))}},5435:function(o,s,n){var a=this&&this.__decorate||function(I,C,L,T){var D,N=arguments.length,G=N<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,L):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(I,C,L,T);else for(var $=I.length-1;$>=0;$--)(D=I[$])&&(G=(N<3?D(G):N>3?D(C,L,G):D(C,L))||G);return N>3&&G&&Object.defineProperty(C,L,G),G},u=this&&this.__param||function(I,C){return function(L,T){C(L,T,I)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let l=n(2584),d=n(7116),m=n(2015),y=n(844),_=n(482),c=n(8437),f=n(8460),h=n(643),p=n(511),g=n(3734),S=n(2585),b=n(1480),x=n(6242),w=n(6351),E=n(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function W(I,C){if(I>24)return C.setWinLines||!1;switch(I){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var A;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(s.WindowsOptionsReportType=A={}));let V=0;class O extends y.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,T,D,N,G,$,Y,H=new m.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=T,this._logService=D,this._optionsService=N,this._oscLinkService=G,this._coreMouseService=$,this._unicodeService=Y,this._parser=H,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _.StringToUtf32,this._utf8Decoder=new _.Utf8ToUtf32,this._workCell=new p.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 f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new R(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:j.toArray()})})),this._parser.setEscHandlerFallback((k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})})),this._parser.setExecuteHandlerFallback((k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})})),this._parser.setOscHandlerFallback(((k,j,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:j,data:q})})),this._parser.setDcsHandlerFallback(((k,j,q)=>{j==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:j,payload:q})})),this._parser.setPrintHandler(((k,j,q)=>this.print(k,j,q))),this._parser.registerCsiHandler({final:"@"},(k=>this.insertChars(k))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(k=>this.scrollLeft(k))),this._parser.registerCsiHandler({final:"A"},(k=>this.cursorUp(k))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(k=>this.scrollRight(k))),this._parser.registerCsiHandler({final:"B"},(k=>this.cursorDown(k))),this._parser.registerCsiHandler({final:"C"},(k=>this.cursorForward(k))),this._parser.registerCsiHandler({final:"D"},(k=>this.cursorBackward(k))),this._parser.registerCsiHandler({final:"E"},(k=>this.cursorNextLine(k))),this._parser.registerCsiHandler({final:"F"},(k=>this.cursorPrecedingLine(k))),this._parser.registerCsiHandler({final:"G"},(k=>this.cursorCharAbsolute(k))),this._parser.registerCsiHandler({final:"H"},(k=>this.cursorPosition(k))),this._parser.registerCsiHandler({final:"I"},(k=>this.cursorForwardTab(k))),this._parser.registerCsiHandler({final:"J"},(k=>this.eraseInDisplay(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(k=>this.eraseInDisplay(k,!0))),this._parser.registerCsiHandler({final:"K"},(k=>this.eraseInLine(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(k=>this.eraseInLine(k,!0))),this._parser.registerCsiHandler({final:"L"},(k=>this.insertLines(k))),this._parser.registerCsiHandler({final:"M"},(k=>this.deleteLines(k))),this._parser.registerCsiHandler({final:"P"},(k=>this.deleteChars(k))),this._parser.registerCsiHandler({final:"S"},(k=>this.scrollUp(k))),this._parser.registerCsiHandler({final:"T"},(k=>this.scrollDown(k))),this._parser.registerCsiHandler({final:"X"},(k=>this.eraseChars(k))),this._parser.registerCsiHandler({final:"Z"},(k=>this.cursorBackwardTab(k))),this._parser.registerCsiHandler({final:"`"},(k=>this.charPosAbsolute(k))),this._parser.registerCsiHandler({final:"a"},(k=>this.hPositionRelative(k))),this._parser.registerCsiHandler({final:"b"},(k=>this.repeatPrecedingCharacter(k))),this._parser.registerCsiHandler({final:"c"},(k=>this.sendDeviceAttributesPrimary(k))),this._parser.registerCsiHandler({prefix:">",final:"c"},(k=>this.sendDeviceAttributesSecondary(k))),this._parser.registerCsiHandler({final:"d"},(k=>this.linePosAbsolute(k))),this._parser.registerCsiHandler({final:"e"},(k=>this.vPositionRelative(k))),this._parser.registerCsiHandler({final:"f"},(k=>this.hVPosition(k))),this._parser.registerCsiHandler({final:"g"},(k=>this.tabClear(k))),this._parser.registerCsiHandler({final:"h"},(k=>this.setMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(k=>this.setModePrivate(k))),this._parser.registerCsiHandler({final:"l"},(k=>this.resetMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(k=>this.resetModePrivate(k))),this._parser.registerCsiHandler({final:"m"},(k=>this.charAttributes(k))),this._parser.registerCsiHandler({final:"n"},(k=>this.deviceStatus(k))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(k=>this.deviceStatusPrivate(k))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(k=>this.softReset(k))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(k=>this.setCursorStyle(k))),this._parser.registerCsiHandler({final:"r"},(k=>this.setScrollRegion(k))),this._parser.registerCsiHandler({final:"s"},(k=>this.saveCursor(k))),this._parser.registerCsiHandler({final:"t"},(k=>this.windowOptions(k))),this._parser.registerCsiHandler({final:"u"},(k=>this.restoreCursor(k))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(k=>this.insertColumns(k))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(k=>this.deleteColumns(k))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(k=>this.selectProtected(k))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(k=>this.requestMode(k,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(k=>this.requestMode(k,!1))),this._parser.setExecuteHandler(l.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(l.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(l.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(l.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(l.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(l.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(l.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(l.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(l.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new x.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new x.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new x.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new x.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new x.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new x.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new x.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new x.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new x.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new x.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new x.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new x.OscHandler((k=>this.restoreCursorColor(k)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let k in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},(()=>this.selectCharset("("+k))),this._parser.registerEscHandler({intermediates:")",final:k},(()=>this.selectCharset(")"+k))),this._parser.registerEscHandler({intermediates:"*",final:k},(()=>this.selectCharset("*"+k))),this._parser.registerEscHandler({intermediates:"+",final:k},(()=>this.selectCharset("+"+k))),this._parser.registerEscHandler({intermediates:"-",final:k},(()=>this.selectCharset("-"+k))),this._parser.registerEscHandler({intermediates:".",final:k},(()=>this.selectCharset("."+k))),this._parser.registerEscHandler({intermediates:"/",final:k},(()=>this.selectCharset("/"+k)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((k=>(this._logService.error("Parsing error: ",k),k))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new w.DcsHandler(((k,j)=>this.requestStatusString(k,j))))}_preserveStack(C,L,T,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=T,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,T)=>setTimeout((()=>T("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let T,D=this._activeBuffer.x,N=this._activeBuffer.y,G=0,$=this._parseStack.paused;if($){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(T),T;D=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>P&&(G=this._parseStack.position+P)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(k=>String.fromCharCode(k))).join("")}"`),typeof C=="string"?C.split("").map((k=>k.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<P&&(this._parseBuffer=new Uint32Array(Math.min(C.length,P))),$||this._dirtyRowTracker.clearRange(),C.length>P)for(let k=G;k<C.length;k+=P){let j=k+P<C.length?k+P:C.length,q=typeof C=="string"?this._stringDecoder.decode(C.substring(k,j),this._parseBuffer):this._utf8Decoder.decode(C.subarray(k,j),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,q))return this._preserveStack(D,N,q,k),this._logSlowResolvingAsync(T),T}else if(!$){let k=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,k))return this._preserveStack(D,N,k,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===D&&this._activeBuffer.y===N||this._onCursorMove.fire();let Y=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),H=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);H<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(H,this._bufferService.rows-1),Math.min(Y,this._bufferService.rows-1))}print(C,L,T){let D,N,G=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,H=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,j=this._curAttrData,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-L>0&&q.getWidth(this._activeBuffer.x-1)===2&&q.setCellFromCodepoint(this._activeBuffer.x-1,0,1,j);let U=this._parser.precedingJoinState;for(let J=L;J<T;++J){if(D=C[J],D<127&&G){let fe=G[String.fromCharCode(D)];fe&&(D=fe.charCodeAt(0))}let Z=this._unicodeService.charProperties(D,U);N=b.UnicodeService.extractWidth(Z);let se=b.UnicodeService.extractShouldJoin(Z),he=se?b.UnicodeService.extractWidth(U):0;if(U=Z,$&&this._onA11yChar.fire((0,_.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-he>Y){if(H){let fe=q,te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,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),q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&q instanceof c.BufferLine&&q.copyCellsFrom(fe,te,0,he,!1);te<Y;)fe.setCellFromCodepoint(te++,0,1,j)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(se&&this._activeBuffer.x){let fe=q.getWidth(this._activeBuffer.x-1)?1:2;q.addCodepointToCell(this._activeBuffer.x-fe,D,N);for(let te=N-he;--te>=0;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}else if(k&&(q.insertCells(this._activeBuffer.x,N-he,this._activeBuffer.getNullCell(j)),q.getWidth(Y-1)===2&&q.setCellFromCodepoint(Y-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,j)),q.setCellFromCodepoint(this._activeBuffer.x++,D,N,j),N>0)for(;--N;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}this._parser.precedingJoinState=U,this._activeBuffer.x<Y&&T-L>0&&q.getWidth(this._activeBuffer.x)===0&&!q.hasContent(this._activeBuffer.x)&&q.setCellFromCodepoint(this._activeBuffer.x,0,1,j),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(T=>!W(T.params[0],this._optionsService.rawOptions.windowOptions)||L(T)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new w.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new x.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){let L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){let L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){let L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){let L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,T,D=!1,N=!1){let G=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);G.replaceCells(L,T,this._activeBuffer.getNullCell(this._eraseAttrData()),N),D&&(G.isWrapped=!1)}_resetBufferLine(C,L=!1){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),T.isWrapped=!1)}eraseInDisplay(C,L=!1){let T;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);T<this._bufferService.rows;T++)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 3:let D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;L--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;L--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(c.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){let L=this._parser.precedingJoinState;if(!L)return!0;let T=C.params[0]||1,D=b.UnicodeService.extractWidth(L),N=this._activeBuffer.x-D,G=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),$=new Uint32Array(G.length*T),Y=0;for(let k=0;k<G.length;){let j=G.codePointAt(k)||0;$[Y++]=j,k+=j>65535?2:1}let H=Y;for(let k=1;k<T;++k)$.copyWithin(H,0,Y),H+=Y;return this.print($,0,H),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,L){let T=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,G=this._coreService,{buffers:$,cols:Y}=this._bufferService,{active:H,alt:k}=$,j=this._optionsService.rawOptions,q=se=>se?1:2,U=C.params[0];return J=U,Z=L?U===2?4:U===4?q(G.modes.insertMode):U===12?3:U===20?q(j.convertEol):0:U===1?q(T.applicationCursorKeys):U===3?j.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:U===6?q(T.origin):U===7?q(T.wraparound):U===8?3:U===9?q(D==="X10"):U===12?q(j.cursorBlink):U===25?q(!G.isCursorHidden):U===45?q(T.reverseWraparound):U===66?q(T.applicationKeypad):U===67?4:U===1e3?q(D==="VT200"):U===1002?q(D==="DRAG"):U===1003?q(D==="ANY"):U===1004?q(T.sendFocus):U===1005?4:U===1006?q(N==="SGR"):U===1015?4:U===1016?q(N==="SGR_PIXELS"):U===1048?1:U===47||U===1047||U===1049?q(H===k):U===2004?q(T.bracketedPasteMode):0,G.triggerDataEvent(`${l.C0.ESC}[${L?"":"?"}${J};${Z}$y`),!0;var J,Z}_updateAttrColor(C,L,T,D,N){return L===2?(C|=50331648,C&=-16777216,C|=g.AttributeData.fromColorRGB([T,D,N])):L===5&&(C&=-50331904,C|=33554432|255&T),C}_extractColor(C,L,T){let D=[0,0,-1,0,0,0],N=0,G=0;do{if(D[G+N]=C.params[L+G],C.hasSubParams(L+G)){let $=C.getSubParams(L+G),Y=0;do D[1]===5&&(N=1),D[G+Y+1+N]=$[Y];while(++Y<$.length&&Y+G+1+N<D.length);break}if(D[1]===5&&G+N>=2||D[1]===2&&G+N>=5)break;D[1]&&(N=1)}while(++G+L<C.length&&G+N<D.length);for(let $=2;$<D.length;++$)D[$]===-1&&(D[$]=0);switch(D[0]){case 38:T.fg=this._updateAttrColor(T.fg,D[1],D[3],D[4],D[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,D[1],D[3],D[4],D[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,D[1],D[3],D[4],D[5])}return G}_processUnderline(C,L){L.extended=L.extended.clone(),(!~C||C>5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(C){C.fg=c.DEFAULT_ATTR_DATA.fg,C.bg=c.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;let L=C.length,T,D=this._curAttrData;for(let N=0;N<L;N++)T=C.params[N],T>=30&&T<=37?(D.fg&=-50331904,D.fg|=16777216|T-30):T>=40&&T<=47?(D.bg&=-50331904,D.bg|=16777216|T-40):T>=90&&T<=97?(D.fg&=-50331904,D.fg|=16777224|T-90):T>=100&&T<=107?(D.bg&=-50331904,D.bg|=16777224|T-100):T===0?this._processSGR0(D):T===1?D.fg|=134217728:T===3?D.bg|=67108864:T===4?(D.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,D)):T===5?D.fg|=536870912:T===7?D.fg|=67108864:T===8?D.fg|=1073741824:T===9?D.fg|=2147483648:T===2?D.bg|=134217728:T===21?this._processUnderline(2,D):T===22?(D.fg&=-134217729,D.bg&=-134217729):T===23?D.bg&=-67108865:T===24?(D.fg&=-268435457,this._processUnderline(0,D)):T===25?D.fg&=-536870913:T===27?D.fg&=-67108865:T===28?D.fg&=-1073741825:T===29?D.fg&=2147483647:T===39?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):T===49?(D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?N+=this._extractColor(C,N,D):T===53?D.bg|=1073741824:T===55?D.bg&=-1073741825:T===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):T===100?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${L};${T}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${L};${T}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(C){let L=C.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let T=L%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(C){let L=C.params[0]||1,T;return(C.length<2||(T=C.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(C){if(!W(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;let L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==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(`${l.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){let L=[],T=C.split(";");for(;T.length>1;){let D=T.shift(),N=T.shift();if(/^\d+$/.exec(D)){let G=parseInt(D);if(F(G))if(N==="?")L.push({type:0,index:G});else{let $=(0,E.parseColor)(N);$&&L.push({type:1,index:G,color:$})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){let L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();let T=C.split(":"),D,N=T.findIndex((G=>G.startsWith("id=")));return N!==-1&&(D=T[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){let T=C.split(";");for(let D=0;D<T.length&&!(L>=this._specialColors.length);++D,++L)if(T[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{let N=(0,E.parseColor)(T[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[L],color:N}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;let L=[],T=C.split(";");for(let D=0;D<T.length;++D)if(/^\d+$/.exec(T[D])){let N=parseInt(T[D]);F(N)&&L.push({type:2,index:N})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(B[C[0]],d.CHARSETS[C[1]]||d.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){let C=new p.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){let T=this._activeBuffer.ybase+this._activeBuffer.y+L,D=this._activeBuffer.lines.get(T);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,L){let T=this._bufferService.buffer,D=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${N}${l.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}s.InputHandler=O;let R=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,C){I>C&&(V=I,I=C,C=V),I<this.start&&(this.start=I),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(I){return 0<=I&&I<256}R=a([u(0,S.IBufferService)],R)},844:(o,s)=>{function n(a){for(let u of a)u.dispose();a.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 a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let u=this._disposables.indexOf(a);u!==-1&&this._disposables.splice(u,1)}},s.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}},s.toDisposable=function(a){return{dispose:a}},s.disposeArray=n,s.getDisposeArrayDisposable=function(a){return{dispose:()=>n(a)}}},1505:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(u,l,d){this._data[u]||(this._data[u]={}),this._data[u][l]=d}get(u,l){return this._data[u]?this._data[u][l]:void 0}clear(){this._data={}}}s.TwoKeyMap=n,s.FourKeyMap=class{constructor(){this._data=new n}set(a,u,l,d,m){this._data.get(a,u)||this._data.set(a,u,new n),this._data.get(a,u).set(l,d,m)}get(a,u,l,d){return this._data.get(a,u)?.get(l,d)}clear(){this._data.clear()}}},6114:(o,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 n=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=n.includes("Firefox"),s.isLegacyEdge=n.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(n),s.getSafariVersion=function(){if(!s.isSafari)return 0;let u=n.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),s.isIpad=a==="iPad",s.isIphone=a==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),s.isLinux=a.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(n)},6106:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let n=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(n=this._search(this._getKey(a)),this._array.splice(n,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let u=this._getKey(a);if(u===void 0||(n=this._search(u),n===-1)||this._getKey(this._array[n])!==u)return!1;do if(this._array[n]===a)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===u);return!1}*getKeyIterator(a){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===a)}forEachByKey(a,u){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do u(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===a)}values(){return[...this._array].values()}_search(a){let u=0,l=this._array.length-1;for(;l>=u;){let d=u+l>>1,m=this._getKey(this._array[d]);if(m>a)l=d-1;else{if(!(m<a)){for(;d>0&&this._getKey(this._array[d-1])===a;)d--;return d}u=d+1}}return u}}},7226:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let a=n(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),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(m){this._idleCallback=void 0;let y=0,_=0,c=m.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),_=Math.max(y,_),f=m.timeRemaining(),1.5*_>f)return c-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-y))}ms`),void this._start();c=f}this.clear()}}class l extends u{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){let y=Date.now()+m;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=l,s.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:l,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let a=n(643);s.updateWindowsModeWrappedState=function(u){let l=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),d=l?.get(u.cols-1),m=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);m&&d&&(m.isWrapped=d[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&d[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){let l=new n;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}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=n;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){let l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,d=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=d}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let a=n(6349),u=n(7226),l=n(3734),d=n(8437),m=n(4634),y=n(511),_=n(643),c=n(4863),f=n(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(h,p,g){this._hasScrollback=h,this._optionsService=p,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=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.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(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,p){return new d.BufferLine(this._bufferService.cols,this.getNullCell(h),p)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;let p=h+this._optionsService.rawOptions.scrollback;return p>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:p}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=d.DEFAULT_ATTR_DATA);let p=this._rows;for(;p--;)this.lines.push(this.getBlankLine(h))}}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(h,p){let g=this.getNullCell(d.DEFAULT_ATTR_DATA),S=0,b=this._getCorrectBufferLength(p);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<h)for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(h,g);let x=0;if(this._rows<p)for(let w=this._rows;w<p;w++)this.lines.length<p+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(h,g)):this.ybase>0&&this.lines.length<=this.ybase+this.y+x+1?(this.ybase--,x++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(h,g)));else for(let w=this._rows;w>p;w--)this.lines.length>p+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b<this.lines.maxLength){let w=this.lines.length-b;w>0&&(this.lines.trimStart(w),this.ybase=Math.max(this.ybase-w,0),this.ydisp=Math.max(this.ydisp-w,0),this.savedY=Math.max(this.savedY-w,0)),this.lines.maxLength=b}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,p-1),x&&(this.y+=x),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=p-1,this._isReflowEnabled&&(this._reflow(h,p),this._cols>h))for(let x=0;x<this.lines.length;x++)S+=+this.lines.get(x).resize(h,g);this._cols=h,this._rows=p,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let p=0;for(;this._memoryCleanupPosition<this.lines.length;)if(p+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),p>100)return!0;return h}get _isReflowEnabled(){let h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,p){this._cols!==h&&(h>this._cols?this._reflowLarger(h,p):this._reflowSmaller(h,p))}_reflowLarger(h,p){let g=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(g.length>0){let S=(0,m.reflowLargerCreateNewLayout)(this.lines,g);(0,m.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(h,p,S.countRemoved)}}_reflowLargerAdjustViewport(h,p,g){let S=this.getNullCell(d.DEFAULT_ATTR_DATA),b=g;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<p&&this.lines.push(new d.BufferLine(h,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-g,0)}_reflowSmaller(h,p){let g=this.getNullCell(d.DEFAULT_ATTR_DATA),S=[],b=0;for(let x=this.lines.length-1;x>=0;x--){let w=this.lines.get(x);if(!w||!w.isWrapped&&w.getTrimmedLength()<=h)continue;let E=[w];for(;w.isWrapped&&x>0;)w=this.lines.get(--x),E.unshift(w);let B=this.ybase+this.y;if(B>=x&&B<x+E.length)continue;let P=E[E.length-1].getTrimmedLength(),W=(0,m.reflowSmallerGetNewLineLengths)(E,this._cols,h),A=W.length-E.length,V;V=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 T=0;T<A;T++){let D=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);O.push(D)}O.length>0&&(S.push({start:x+E.length+b,newLines:O}),b+=O.length),E.push(...O);let R=W.length-1,F=W[R];F===0&&(R--,F=W[R]);let I=E.length-A-1,C=P;for(;I>=0;){let T=Math.min(C,F);if(E[R]===void 0)break;if(E[R].copyCellsFrom(E[I],C-T,F-T,T,!0),F-=T,F===0&&(R--,F=W[R]),C-=T,C===0){I--;let D=Math.max(I,0);C=(0,m.getWrappedLineTrimmedLength)(E,D,this._cols)}}for(let T=0;T<E.length;T++)W[T]<h&&E[T].setCell(W[T],g);let L=A-V;for(;L-- >0;)this.ybase===0?this.y<p-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-p&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+p-1)}if(S.length>0){let x=[],w=[];for(let R=0;R<this.lines.length;R++)w.push(this.lines.get(R));let E=this.lines.length,B=E-1,P=0,W=S[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let A=0;for(let R=Math.min(this.lines.maxLength-1,E+b-1);R>=0;R--)if(W&&W.start>B+A){for(let F=W.newLines.length-1;F>=0;F--)this.lines.set(R--,W.newLines[F]);R++,x.push({index:B+1,amount:W.newLines.length}),A+=W.newLines.length,W=S[++P]}else this.lines.set(R,w[B--]);let V=0;for(let R=x.length-1;R>=0;R--)x[R].index+=V,this.lines.onInsertEmitter.fire(x[R]),V+=x[R].amount;let O=Math.max(0,E+b-this.lines.maxLength);O>0&&this.lines.onTrimEmitter.fire(O)}}translateBufferLineToString(h,p,g=0,S){let b=this.lines.get(h);return b?b.translateToString(p,g,S):""}getWrappedRangeForLine(h){let p=h,g=h;for(;p>0&&this.lines.get(p).isWrapped;)p--;for(;g+1<this.lines.length&&this.lines.get(g+1).isWrapped;)g++;return{first:p,last:g}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].line===h&&(this.markers[p].dispose(),this.markers.splice(p--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose(),this.markers.splice(h--,1);this._isClearing=!1}addMarker(h){let p=new c.Marker(h);return this.markers.push(p),p.register(this.lines.onTrim((g=>{p.line-=g,p.line<0&&p.dispose()}))),p.register(this.lines.onInsert((g=>{p.line>=g.index&&(p.line+=g.amount)}))),p.register(this.lines.onDelete((g=>{p.line>=g.index&&p.line<g.index+g.amount&&p.dispose(),p.line>g.index&&(p.line-=g.amount)}))),p.register(p.onDispose((()=>this._removeMarker(p)))),p}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let a=n(3734),u=n(511),l=n(643),d=n(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let m=0;class y{constructor(c,f,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let p=f||u.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let g=0;g<c;++g)this.setCell(g,p);this.length=c}get(c){let f=this._data[3*c+0],h=2097151&f;return[this._data[3*c+1],2097152&f?this._combined[c]:h?(0,d.stringFromCodePoint)(h):"",f>>22,2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):h]}set(c,f){this._data[3*c+1]=f[l.CHAR_DATA_ATTR_INDEX],f[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=f[1],this._data[3*c+0]=2097152|c|f[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.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 f=this._data[3*c+0];return 2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&f}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let f=this._data[3*c+0];return 2097152&f?this._combined[c]:2097151&f?(0,d.stringFromCodePoint)(2097151&f):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,f){return m=3*c,f.content=this._data[m+0],f.fg=this._data[m+1],f.bg=this._data[m+2],2097152&f.content&&(f.combinedData=this._combined[c]),268435456&f.bg&&(f.extended=this._extendedAttrs[c]),f}setCell(c,f){2097152&f.content&&(this._combined[c]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[c]=f.extended),this._data[3*c+0]=f.content,this._data[3*c+1]=f.fg,this._data[3*c+2]=f.bg}setCellFromCodepoint(c,f,h,p){268435456&p.bg&&(this._extendedAttrs[c]=p.extended),this._data[3*c+0]=f|h<<22,this._data[3*c+1]=p.fg,this._data[3*c+2]=p.bg}addCodepointToCell(c,f,h){let p=this._data[3*c+0];2097152&p?this._combined[c]+=(0,d.stringFromCodePoint)(f):2097151&p?(this._combined[c]=(0,d.stringFromCodePoint)(2097151&p)+(0,d.stringFromCodePoint)(f),p&=-2097152,p|=2097152):p=f|4194304,h&&(p&=-12582913,p|=h<<22),this._data[3*c+0]=p}insertCells(c,f,h){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length-c){let p=new u.CellData;for(let g=this.length-c-f-1;g>=0;--g)this.setCell(c+f+g,this.loadCell(c+g,p));for(let g=0;g<f;++g)this.setCell(c+g,h)}else for(let p=c;p<this.length;++p)this.setCell(p,h);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,h)}deleteCells(c,f,h){if(c%=this.length,f<this.length-c){let p=new u.CellData;for(let g=0;g<this.length-c-f;++g)this.setCell(c+g,this.loadCell(c+f+g,p));for(let g=this.length-f;g<this.length;++g)this.setCell(g,h)}else for(let p=c;p<this.length;++p)this.setCell(p,h);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,h)}replaceCells(c,f,h,p=!1){if(p)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,h);c<f&&c<this.length;)this.isProtected(c)||this.setCell(c,h),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,h);c<f&&c<this.length;)this.setCell(c++,h)}resize(c,f){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let h=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*h)this._data=new Uint32Array(this._data.buffer,0,h);else{let p=new Uint32Array(h);p.set(this._data),this._data=p}for(let p=this.length;p<c;++p)this.setCell(p,f)}else{this._data=this._data.subarray(0,h);let p=Object.keys(this._combined);for(let S=0;S<p.length;S++){let b=parseInt(p[S],10);b>=c&&delete this._combined[b]}let g=Object.keys(this._extendedAttrs);for(let S=0;S<g.length;S++){let b=parseInt(g[S],10);b>=c&&delete this._extendedAttrs[b]}}return this.length=c,4*h*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,f=!1){if(f)for(let h=0;h<this.length;++h)this.isProtected(h)||this.setCell(h,c);else{this._combined={},this._extendedAttrs={};for(let h=0;h<this.length;++h)this.setCell(h,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 f in c._combined)this._combined[f]=c._combined[f];this._extendedAttrs={};for(let f in c._extendedAttrs)this._extendedAttrs[f]=c._extendedAttrs[f];this.isWrapped=c.isWrapped}clone(){let c=new y(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let f in this._combined)c._combined[f]=this._combined[f];for(let f in this._extendedAttrs)c._extendedAttrs[f]=this._extendedAttrs[f];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,f,h,p,g){let S=c._data;if(g)for(let x=p-1;x>=0;x--){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(f+x)+w];268435456&S[3*(f+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[f+x])}else for(let x=0;x<p;x++){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(f+x)+w];268435456&S[3*(f+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[f+x])}let b=Object.keys(c._combined);for(let x=0;x<b.length;x++){let w=parseInt(b[x],10);w>=f&&(this._combined[w-f+h]=c._combined[w])}}translateToString(c,f,h,p){f=f??0,h=h??this.length,c&&(h=Math.min(h,this.getTrimmedLength())),p&&(p.length=0);let g="";for(;f<h;){let S=this._data[3*f+0],b=2097151&S,x=2097152&S?this._combined[f]:b?(0,d.stringFromCodePoint)(b):l.WHITESPACE_CELL_CHAR;if(g+=x,p)for(let w=0;w<x.length;++w)p.push(f);f+=S>>22||1}return p&&p.push(f),g}}s.BufferLine=y},4841:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(n,a){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return a*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(o,s)=>{function n(a,u,l){if(u===a.length-1)return a[u].getTrimmedLength();let d=!a[u].hasContent(l-1)&&a[u].getWidth(l-1)===1,m=a[u+1].getWidth(0)===2;return d&&m?l-1:l}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(a,u,l,d,m){let y=[];for(let _=0;_<a.length-1;_++){let c=_,f=a.get(++c);if(!f.isWrapped)continue;let h=[a.get(_)];for(;c<a.length&&f.isWrapped;)h.push(f),f=a.get(++c);if(d>=_&&d<c){_+=h.length-1;continue}let p=0,g=n(h,p,u),S=1,b=0;for(;S<h.length;){let w=n(h,S,u),E=w-b,B=l-g,P=Math.min(E,B);h[p].copyCellsFrom(h[S],b,g,P,!1),g+=P,g===l&&(p++,g=0),b+=P,b===w&&(S++,b=0),g===0&&p!==0&&h[p-1].getWidth(l-1)===2&&(h[p].copyCellsFrom(h[p-1],l-1,g++,1,!1),h[p-1].setCell(l-1,m))}h[p].replaceCells(g,l,m);let x=0;for(let w=h.length-1;w>0&&(w>p||h[w].getTrimmedLength()===0);w--)x++;x>0&&(y.push(_+h.length-x),y.push(x)),_+=h.length-1}return y},s.reflowLargerCreateNewLayout=function(a,u){let l=[],d=0,m=u[d],y=0;for(let _=0;_<a.length;_++)if(m===_){let c=u[++d];a.onDeleteEmitter.fire({index:_-y,amount:c}),_+=c-1,y+=c,m=u[++d]}else l.push(_);return{layout:l,countRemoved:y}},s.reflowLargerApplyNewLayout=function(a,u){let l=[];for(let d=0;d<u.length;d++)l.push(a.get(u[d]));for(let d=0;d<l.length;d++)a.set(d,l[d]);a.length=u.length},s.reflowSmallerGetNewLineLengths=function(a,u,l){let d=[],m=a.map(((f,h)=>n(a,h,u))).reduce(((f,h)=>f+h)),y=0,_=0,c=0;for(;c<m;){if(m-c<l){d.push(m-c);break}y+=l;let f=n(a,_,u);y>f&&(y-=f,_++);let h=a[_].getWidth(y-1)===2;h&&y--;let p=h?l-1:l;d.push(p),c+=p}return d},s.getWrappedLineTrimmedLength=n},5295:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let a=n(8460),u=n(844),l=n(9092);class d extends u.Disposable{constructor(y,_){super(),this._optionsService=y,this._bufferService=_,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 l.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new l.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,_){this._normal.resize(y,_),this._alt.resize(y,_),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=d},511:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let a=n(482),u=n(643),l=n(3734);class d extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(y){let _=new d;return _.setFromCharData(y),_}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(y){this.fg=y[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let _=!1;if(y[u.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(y[u.CHAR_DATA_CHAR_INDEX].length===2){let c=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let f=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(c-55296)+f-56320+65536|y[u.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[u.CHAR_DATA_WIDTH_INDEX]<<22;_&&(this.combinedData=y[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=d},643:(o,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:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let a=n(8460),u=n(844);class l{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=l._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,u.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}s.Marker=l,l._nextId=1},7116:(o,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:(o,s)=>{var n,a,u;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(l){l.NUL="\0",l.SOH="",l.STX="",l.ETX="",l.EOT="",l.ENQ="",l.ACK="",l.BEL="\x07",l.BS="\b",l.HT=" ",l.LF=`
8
- `,l.VT="\v",l.FF="\f",l.CR="\r",l.SO="",l.SI="",l.DLE="",l.DC1="",l.DC2="",l.DC3="",l.DC4="",l.NAK="",l.SYN="",l.ETB="",l.CAN="",l.EM="",l.SUB="",l.ESC="\x1B",l.FS="",l.GS="",l.RS="",l.US="",l.SP=" ",l.DEL="\x7F"})(n||(s.C0=n={})),(function(l){l.PAD="\x80",l.HOP="\x81",l.BPH="\x82",l.NBH="\x83",l.IND="\x84",l.NEL="\x85",l.SSA="\x86",l.ESA="\x87",l.HTS="\x88",l.HTJ="\x89",l.VTS="\x8A",l.PLD="\x8B",l.PLU="\x8C",l.RI="\x8D",l.SS2="\x8E",l.SS3="\x8F",l.DCS="\x90",l.PU1="\x91",l.PU2="\x92",l.STS="\x93",l.CCH="\x94",l.MW="\x95",l.SPA="\x96",l.EPA="\x97",l.SOS="\x98",l.SGCI="\x99",l.SCI="\x9A",l.CSI="\x9B",l.ST="\x9C",l.OSC="\x9D",l.PM="\x9E",l.APC="\x9F"})(a||(s.C1=a={})),(function(l){l.ST=`${n.ESC}\\`})(u||(s.C1_ESCAPED=u={}))},7399:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let a=n(2584),u={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(l,d,m,y){let _={type:0,cancel:!1,key:void 0},c=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?_.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?_.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?_.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(_.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:_.key=l.ctrlKey?"\b":a.C0.DEL,l.altKey&&(_.key=a.C0.ESC+_.key);break;case 9:if(l.shiftKey){_.key=a.C0.ESC+"[Z";break}_.key=a.C0.HT,_.cancel=!0;break;case 13:_.key=l.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,_.cancel=!0;break;case 27:_.key=a.C0.ESC,l.altKey&&(_.key=a.C0.ESC+a.C0.ESC),_.cancel=!0;break;case 37:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"D",_.key===a.C0.ESC+"[1;3D"&&(_.key=a.C0.ESC+(m?"b":"[1;5D"))):_.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"C",_.key===a.C0.ESC+"[1;3C"&&(_.key=a.C0.ESC+(m?"f":"[1;5C"))):_.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"A",m||_.key!==a.C0.ESC+"[1;3A"||(_.key=a.C0.ESC+"[1;5A")):_.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"B",m||_.key!==a.C0.ESC+"[1;3B"||(_.key=a.C0.ESC+"[1;5B")):_.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(_.key=a.C0.ESC+"[2~");break;case 46:_.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:_.key=c?a.C0.ESC+"[1;"+(c+1)+"H":d?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:_.key=c?a.C0.ESC+"[1;"+(c+1)+"F":d?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:l.shiftKey?_.type=2:l.ctrlKey?_.key=a.C0.ESC+"[5;"+(c+1)+"~":_.key=a.C0.ESC+"[5~";break;case 34:l.shiftKey?_.type=3:l.ctrlKey?_.key=a.C0.ESC+"[6;"+(c+1)+"~":_.key=a.C0.ESC+"[6~";break;case 112:_.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:_.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:_.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:_.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:_.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:_.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:_.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:_.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:_.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:_.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:_.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:_.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(m&&!y||!l.altKey||l.metaKey)!m||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?_.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(_.key=a.C0.US),l.key==="@"&&(_.key=a.C0.NUL)):l.keyCode===65&&(_.type=1);else{let f=u[l.keyCode],h=f?.[l.shiftKey?1:0];if(h)_.key=a.C0.ESC+h;else if(l.keyCode>=65&&l.keyCode<=90){let p=l.ctrlKey?l.keyCode-64:l.keyCode+32,g=String.fromCharCode(p);l.shiftKey&&(g=g.toUpperCase()),_.key=a.C0.ESC+g}else if(l.keyCode===32)_.key=a.C0.ESC+(l.ctrlKey?a.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let p=l.code.slice(3,4);l.shiftKey||(p=p.toLowerCase()),_.key=a.C0.ESC+p,_.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?_.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?_.key=a.C0.NUL:l.keyCode>=51&&l.keyCode<=55?_.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?_.key=a.C0.DEL:l.keyCode===219?_.key=a.C0.ESC:l.keyCode===220?_.key=a.C0.FS:l.keyCode===221&&(_.key=a.C0.GS)}return _}},482:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},s.utf32ToString=function(n,a=0,u=n.length){let l="";for(let d=a;d<u;++d){let m=n[d];m>65535?(m-=65536,l+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):l+=String.fromCharCode(m)}return l},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,a){let u=n.length;if(!u)return 0;let l=0,d=0;if(this._interim){let m=n.charCodeAt(d++);56320<=m&&m<=57343?a[l++]=1024*(this._interim-55296)+m-56320+65536:(a[l++]=this._interim,a[l++]=m),this._interim=0}for(let m=d;m<u;++m){let y=n.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=u)return this._interim=y,l;let _=n.charCodeAt(m);56320<=_&&_<=57343?a[l++]=1024*(y-55296)+_-56320+65536:(a[l++]=y,a[l++]=_)}else y!==65279&&(a[l++]=y)}return l}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,a){let u=n.length;if(!u)return 0;let l,d,m,y,_=0,c=0,f=0;if(this.interim[0]){let g=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let b,x=0;for(;(b=63&this.interim[++x])&&x<4;)S<<=6,S|=b;let w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=w-x;for(;f<E;){if(f>=u)return 0;if(b=n[f++],(192&b)!=128){f--,g=!0;break}this.interim[x++]=b,S<<=6,S|=63&b}g||(w===2?S<128?f--:a[_++]=S:w===3?S<2048||S>=55296&&S<=57343||S===65279||(a[_++]=S):S<65536||S>1114111||(a[_++]=S)),this.interim.fill(0)}let h=u-4,p=f;for(;p<u;){for(;!(!(p<h)||128&(l=n[p])||128&(d=n[p+1])||128&(m=n[p+2])||128&(y=n[p+3]));)a[_++]=l,a[_++]=d,a[_++]=m,a[_++]=y,p+=4;if(l=n[p++],l<128)a[_++]=l;else if((224&l)==192){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(c=(31&l)<<6|63&d,c<128){p--;continue}a[_++]=c}else if((240&l)==224){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,_;if(m=n[p++],(192&m)!=128){p--;continue}if(c=(15&l)<<12|(63&d)<<6|63&m,c<2048||c>=55296&&c<=57343||c===65279)continue;a[_++]=c}else if((248&l)==240){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,_;if(m=n[p++],(192&m)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,this.interim[2]=m,_;if(y=n[p++],(192&y)!=128){p--;continue}if(c=(7&l)<<18|(63&d)<<12|(63&m)<<6|63&y,c<65536||c>1114111)continue;a[_++]=c}}return _}}},225:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let a=n(1480),u=[[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]],l=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],d;s.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let m=0;m<u.length;++m)d.fill(0,u[m][0],u[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?d[m]:(function(y,_){let c,f=0,h=_.length-1;if(y<_[0][0]||y>_[h][1])return!1;for(;h>=f;)if(c=f+h>>1,y>_[c][1])f=c+1;else{if(!(y<_[c][0]))return!0;h=c-1}return!1})(m,l)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,y){let _=this.wcwidth(m),c=_===0&&y!==0;if(c){let f=a.UnicodeService.extractWidth(y);f===0?c=!1:f>_&&(_=f)}return a.UnicodeService.createPropertyValue(0,_,c)}}},5981:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let a=n(8460),u=n(844);class l extends u.Disposable{constructor(m){super(),this._action=m,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(m,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let _;for(this._isSyncWriting=!0;_=this._writeBuffer.shift();){this._action(_);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,y){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+=m.length,this._writeBuffer.push(m),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y)}_innerWrite(m=0,y=!0){let _=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],f=this._action(c,y);if(f){let p=g=>Date.now()-_>=12?setTimeout((()=>this._innerWrite(0,g))):this._innerWrite(_,g);return void f.catch((g=>(queueMicrotask((()=>{throw g})),Promise.resolve(!1)))).then(p)}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-_>=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=l},5941:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,a=/^[\da-f]+$/;function u(l,d){let m=l.toString(16),y=m.length<2?"0"+m:m;switch(d){case 4:return m[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}s.parseColor=function(l){if(!l)return;let d=l.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);let m=n.exec(d);if(m){let y=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/y*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/y*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/y*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),a.exec(d)&&[3,6,9,12].includes(d.length))){let m=d.length/3,y=[0,0,0];for(let _=0;_<3;++_){let c=parseInt(d.slice(m*_,m*_+m),16);y[_]=m===1?c<<4:m===2?c:m===3?c>>4:c>>8}return y}},s.toRgbString=function(l,d=16){let[m,y,_]=l;return`rgb:${u(m,d)}/${u(y,d)}/${u(_,d)}`}},5770:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let a=n(482),u=n(8742),l=n(5770),d=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(y,_){this._handlers[y]===void 0&&(this._handlers[y]=[]);let c=this._handlers[y];return c.push(_),{dispose:()=>{let f=c.indexOf(_);f!==-1&&c.splice(f,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(y,_){if(this.reset(),this._ident=y,this._active=this._handlers[y]||d,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(_);else this._handlerFb(this._ident,"HOOK",_)}put(y,_,c){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(y,_,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(y,_,c))}unhook(y,_=!0){if(this._active.length){let c=!1,f=this._active.length-1,h=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,c=_,h=this._stack.fallThrough,this._stack.paused=!1),!h&&c===!1){for(;f>=0&&(c=this._active[f].unhook(y),c!==!0);f--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,c;f--}for(;f>=0;f--)if(c=this._active[f].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",y);this._active=d,this._ident=0}};let m=new u.Params;m.addParam(0),s.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=m,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():m,this._data="",this._hitLimit=!1}put(y,_,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(y,_,c),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let _=!1;if(this._hitLimit)_=!1;else if(y&&(_=this._handler(this._data,this._params),_ instanceof Promise))return _.then((c=>(this._params=m,this._data="",this._hitLimit=!1,c)));return this._params=m,this._data="",this._hitLimit=!1,_}}},2015:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let a=n(844),u=n(8742),l=n(6242),d=n(6351);class m{constructor(f){this.table=new Uint8Array(f)}setDefault(f,h){this.table.fill(f<<4|h)}add(f,h,p,g){this.table[h<<8|f]=p<<4|g}addMany(f,h,p,g){for(let S=0;S<f.length;S++)this.table[h<<8|f[S]]=p<<4|g}}s.TransitionTable=m;let y=160;s.VT500_TRANSITION_TABLE=(function(){let c=new m(4095),f=Array.apply(null,Array(256)).map(((x,w)=>w)),h=(x,w)=>f.slice(x,w),p=h(32,127),g=h(0,24);g.push(25),g.push.apply(g,h(28,32));let S=h(0,14),b;for(b in c.setDefault(1,0),c.addMany(p,0,2,0),S)c.addMany([24,26,153,154],b,3,0),c.addMany(h(128,144),b,3,0),c.addMany(h(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(p,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(h(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(p,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(h(64,127),3,7,0),c.addMany(h(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(h(48,60),4,8,4),c.addMany(h(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(h(32,64),6,0,6),c.add(127,6,0,6),c.addMany(h(64,127),6,0,0),c.addMany(h(32,48),3,9,5),c.addMany(h(32,48),5,9,5),c.addMany(h(48,64),5,0,6),c.addMany(h(64,127),5,7,0),c.addMany(h(32,48),4,9,5),c.addMany(h(32,48),1,9,2),c.addMany(h(32,48),2,9,2),c.addMany(h(48,127),2,10,0),c.addMany(h(48,80),1,10,0),c.addMany(h(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(h(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(h(28,32),9,0,9),c.addMany(h(32,48),9,9,12),c.addMany(h(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(g,11,0,11),c.addMany(h(32,128),11,0,11),c.addMany(h(28,32),11,0,11),c.addMany(g,10,0,10),c.add(127,10,0,10),c.addMany(h(28,32),10,0,10),c.addMany(h(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(h(32,48),10,9,12),c.addMany(g,12,0,12),c.add(127,12,0,12),c.addMany(h(28,32),12,0,12),c.addMany(h(32,48),12,9,12),c.addMany(h(48,64),12,0,11),c.addMany(h(64,127),12,12,13),c.addMany(h(64,127),10,12,13),c.addMany(h(64,127),9,12,13),c.addMany(g,13,13,13),c.addMany(p,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(y,0,2,0),c.add(y,8,5,8),c.add(y,6,0,6),c.add(y,11,0,11),c.add(y,13,13,13),c})();class _ extends a.Disposable{constructor(f=s.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(h,p,g)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,p)=>{},this._escHandlerFb=h=>{},this._errorHandlerFb=h=>h,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 l.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(f,h=[64,126]){let p=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(p=f.prefix.charCodeAt(0),p&&60>p||p>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<f.intermediates.length;++S){let b=f.intermediates.charCodeAt(S);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");p<<=8,p|=b}}if(f.final.length!==1)throw new Error("final must be a single byte");let g=f.final.charCodeAt(0);if(h[0]>g||g>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return p<<=8,p|=g,p}identToString(f){let h=[];for(;f;)h.push(String.fromCharCode(255&f)),f>>=8;return h.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,h){let p=this._identifier(f,[48,126]);this._escHandlers[p]===void 0&&(this._escHandlers[p]=[]);let g=this._escHandlers[p];return g.push(h),{dispose:()=>{let S=g.indexOf(h);S!==-1&&g.splice(S,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,h){this._executeHandlers[f.charCodeAt(0)]=h}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,h){let p=this._identifier(f);this._csiHandlers[p]===void 0&&(this._csiHandlers[p]=[]);let g=this._csiHandlers[p];return g.push(h),{dispose:()=>{let S=g.indexOf(h);S!==-1&&g.splice(S,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,h){return this._dcsParser.registerHandler(this._identifier(f),h)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,h){return this._oscParser.registerHandler(f,h)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,h,p,g,S){this._parseStack.state=f,this._parseStack.handlers=h,this._parseStack.handlerPos=p,this._parseStack.transition=g,this._parseStack.chunkPos=S}parse(f,h,p){let g,S=0,b=0,x=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,x=this._parseStack.chunkPos+1;else{if(p===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let w=this._parseStack.handlers,E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(p===!1&&E>-1){for(;E>=0&&(g=w[E](this._params),g!==!0);E--)if(g instanceof Promise)return this._parseStack.handlerPos=E,g}this._parseStack.handlers=[];break;case 4:if(p===!1&&E>-1){for(;E>=0&&(g=w[E](),g!==!0);E--)if(g instanceof Promise)return this._parseStack.handlerPos=E,g}this._parseStack.handlers=[];break;case 6:if(S=f[this._parseStack.chunkPos],g=this._dcsParser.unhook(S!==24&&S!==26,p),g)return g;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=f[this._parseStack.chunkPos],g=this._oscParser.end(S!==24&&S!==26,p),g)return g;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,x=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let w=x;w<h;++w){switch(S=f[w],b=this._transitions.table[this.currentState<<8|(S<160?S:y)],b>>4){case 2:for(let A=w+1;;++A){if(A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:w,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let E=this._csiHandlers[this._collect<<8|S],B=E?E.length-1:-1;for(;B>=0&&(g=E[B](this._params),g!==!0);B--)if(g instanceof Promise)return this._preserveStack(3,E,B,b,w),g;B<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++w<h&&(S=f[w])>47&&S<60);w--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:let P=this._escHandlers[this._collect<<8|S],W=P?P.length-1:-1;for(;W>=0&&(g=P[W](),g!==!0);W--)if(g instanceof Promise)return this._preserveStack(4,P,W,b,w),g;W<0&&this._escHandlerFb(this._collect<<8|S),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|S,this._params);break;case 13:for(let A=w+1;;++A)if(A>=h||(S=f[A])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(f,w,A),w=A-1;break}break;case 14:if(g=this._dcsParser.unhook(S!==24&&S!==26),g)return this._preserveStack(6,[],0,b,w),g;S===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=w+1;;A++)if(A>=h||(S=f[A])<32||S>127&&S<y){this._oscParser.put(f,w,A),w=A-1;break}break;case 6:if(g=this._oscParser.end(S!==24&&S!==26),g)return this._preserveStack(5,[],0,b,w),g;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}s.EscapeSequenceParser=_},6242:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let a=n(5770),u=n(482),l=[];s.OscParser=class{constructor(){this._state=0,this._active=l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,m){this._handlers[d]===void 0&&(this._handlers[d]=[]);let y=this._handlers[d];return y.push(m),{dispose:()=>{let _=y.indexOf(m);_!==-1&&y.splice(_,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,m,y){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(d,m,y);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(d,m,y))}start(){this.reset(),this._state=1}put(d,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){let _=d[m++];if(_===59){this._state=2,this._start();break}if(_<48||57<_)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+_-48}this._state===2&&y-m>0&&this._put(d,m,y)}}end(d,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,_=this._active.length-1,c=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,y=m,c=this._stack.fallThrough,this._stack.paused=!1),!c&&y===!1){for(;_>=0&&(y=this._active[_].end(d),y!==!0);_--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,y;_--}for(;_>=0;_--)if(y=this._active[_].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",d);this._active=l,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,m,y){this._hitLimit||(this._data+=(0,u.utf32ToString)(d,m,y),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let m=!1;if(this._hitLimit)m=!1;else if(d&&(m=this._handler(this._data),m instanceof Promise))return m.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,m}}},8742:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let n=2147483647;class a{static fromArray(l){let d=new a;if(!l.length)return d;for(let m=Array.isArray(l[0])?1:0;m<l.length;++m){let y=l[m];if(Array.isArray(y))for(let _=0;_<y.length;++_)d.addSubParam(y[_]);else d.addParam(y)}return d}constructor(l=32,d=32){if(this.maxLength=l,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let l=new a(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l}toArray(){let l=[];for(let d=0;d<this.length;++d){l.push(this.params[d]);let m=this._subParamsIdx[d]>>8,y=255&this._subParamsIdx[d];y-m>0&&l.push(Array.prototype.slice.call(this._subParams,m,y))}return l}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>n?n:l}}addSubParam(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>n?n:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){let d=this._subParamsIdx[l]>>8,m=255&this._subParamsIdx[l];return m-d>0?this._subParams.subarray(d,m):null}getSubParamsAll(){let l={};for(let d=0;d<this.length;++d){let m=this._subParamsIdx[d]>>8,y=255&this._subParamsIdx[d];y-m>0&&(l[d]=this._subParams.slice(m,y))}return l}addDigit(l){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let m=this._digitIsSub?this._subParams:this.params,y=m[d-1];m[d-1]=~y?Math.min(10*y+l,n):l}}s.Params=a},5741:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,a){let u={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(u),a.dispose=()=>this._wrappedAddonDispose(u),a.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let a=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===n){a=u;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(a,1)}}},8771:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let a=n(3785),u=n(511);s.BufferApiView=class{constructor(l,d){this._buffer=l,this.type=d}init(l){return this._buffer=l,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(l){let d=this._buffer.lines.get(l);if(d)return new a.BufferLineApiView(d)}getNullCell(){return new u.CellData}}},3785:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let a=n(511);s.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,l){if(!(u<0||u>=this._line.length))return l?(this._line.loadCell(u,l),l):this._line.loadCell(u,new a.CellData)}translateToString(u,l,d){return this._line.translateToString(u,l,d)}}},8285:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let a=n(8771),u=n(8460),l=n(844);class d extends l.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new u.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)}}s.BufferNamespaceApi=d},7975:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,a){return this._core.registerCsiHandler(n,(u=>a(u.toArray())))}addCsiHandler(n,a){return this.registerCsiHandler(n,a)}registerDcsHandler(n,a){return this._core.registerDcsHandler(n,((u,l)=>a(u,l.toArray())))}addDcsHandler(n,a){return this.registerDcsHandler(n,a)}registerEscHandler(n,a){return this._core.registerEscHandler(n,a)}addEscHandler(n,a){return this.registerEscHandler(n,a)}registerOscHandler(n,a){return this._core.registerOscHandler(n,a)}addOscHandler(n,a){return this.registerOscHandler(n,a)}}},7090:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(o,s,n){var a=this&&this.__decorate||function(c,f,h,p){var g,S=arguments.length,b=S<3?f:p===null?p=Object.getOwnPropertyDescriptor(f,h):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,f,h,p);else for(var x=c.length-1;x>=0;x--)(g=c[x])&&(b=(S<3?g(b):S>3?g(f,h,b):g(f,h))||b);return S>3&&b&&Object.defineProperty(f,h,b),b},u=this&&this.__param||function(c,f){return function(h,p){f(h,p,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let l=n(8460),d=n(844),m=n(5295),y=n(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let _=s.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(c){super(),this.isUserScrolling=!1,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new l.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 m.BufferSet(c,this))}resize(c,f){this.cols=c,this.rows=f,this.buffers.resize(c,f),this._onResize.fire({cols:c,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,f=!1){let h=this.buffer,p;p=this._cachedBlankLine,p&&p.length===this.cols&&p.getFg(0)===c.fg&&p.getBg(0)===c.bg||(p=h.getBlankLine(c,f),this._cachedBlankLine=p),p.isWrapped=f;let g=h.ybase+h.scrollTop,S=h.ybase+h.scrollBottom;if(h.scrollTop===0){let b=h.lines.isFull;S===h.lines.length-1?b?h.lines.recycle().copyFrom(p):h.lines.push(p.clone()):h.lines.splice(S+1,0,p.clone()),b?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{let b=S-g+1;h.lines.shiftElements(g+1,b-1,-1),h.lines.set(S,p.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(c,f,h){let p=this.buffer;if(c<0){if(p.ydisp===0)return;this.isUserScrolling=!0}else c+p.ydisp>=p.ybase&&(this.isUserScrolling=!1);let g=p.ydisp;p.ydisp=Math.max(Math.min(p.ydisp+c,p.ybase),0),g!==p.ydisp&&(f||this._onScroll.fire(p.ydisp))}};s.BufferService=_=a([u(0,y.IOptionsService)],_)},7994:(o,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(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,a){this._charsets[n]=a,this.glevel===n&&(this.charset=a)}}},1753:function(o,s,n){var a=this&&this.__decorate||function(p,g,S,b){var x,w=arguments.length,E=w<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(p,g,S,b);else for(var B=p.length-1;B>=0;B--)(x=p[B])&&(E=(w<3?x(E):w>3?x(g,S,E):x(g,S))||E);return w>3&&E&&Object.defineProperty(g,S,E),E},u=this&&this.__param||function(p,g){return function(S,b){g(S,b,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let l=n(2585),d=n(8460),m=n(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:p=>p.button!==4&&p.action===1&&(p.ctrl=!1,p.alt=!1,p.shift=!1,!0)},VT200:{events:19,restrict:p=>p.action!==32},DRAG:{events:23,restrict:p=>p.action!==32||p.button!==3},ANY:{events:31,restrict:p=>!0}};function _(p,g){let S=(p.ctrl?16:0)|(p.shift?4:0)|(p.alt?8:0);return p.button===4?(S|=64,S|=p.action):(S|=3&p.button,4&p.button&&(S|=64),8&p.button&&(S|=128),p.action===32?S|=32:p.action!==0||g||(S|=3)),S}let c=String.fromCharCode,f={DEFAULT:p=>{let g=[_(p,!1)+32,p.col+32,p.row+32];return g[0]>255||g[1]>255||g[2]>255?"":`\x1B[M${c(g[0])}${c(g[1])}${c(g[2])}`},SGR:p=>{let g=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${_(p,!0)};${p.col};${p.row}${g}`},SGR_PIXELS:p=>{let g=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${_(p,!0)};${p.x};${p.y}${g}`}},h=s.CoreMouseService=class extends m.Disposable{constructor(p,g){super(),this._bufferService=p,this._coreService=g,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let S of Object.keys(y))this.addProtocol(S,y[S]);for(let S of Object.keys(f))this.addEncoding(S,f[S]);this.reset()}addProtocol(p,g){this._protocols[p]=g}addEncoding(p,g){this._encodings[p]=g}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(p){if(!this._protocols[p])throw new Error(`unknown protocol "${p}"`);this._activeProtocol=p,this._onProtocolChange.fire(this._protocols[p].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(p){if(!this._encodings[p])throw new Error(`unknown encoding "${p}"`);this._activeEncoding=p}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(p){if(p.col<0||p.col>=this._bufferService.cols||p.row<0||p.row>=this._bufferService.rows||p.button===4&&p.action===32||p.button===3&&p.action!==32||p.button!==4&&(p.action===2||p.action===3)||(p.col++,p.row++,p.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,p,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(p))return!1;let g=this._encodings[this._activeEncoding](p);return g&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(g):this._coreService.triggerDataEvent(g,!0)),this._lastEvent=p,!0}explainEvents(p){return{down:!!(1&p),up:!!(2&p),drag:!!(4&p),move:!!(8&p),wheel:!!(16&p)}}_equalEvents(p,g,S){if(S){if(p.x!==g.x||p.y!==g.y)return!1}else if(p.col!==g.col||p.row!==g.row)return!1;return p.button===g.button&&p.action===g.action&&p.ctrl===g.ctrl&&p.alt===g.alt&&p.shift===g.shift}};s.CoreMouseService=h=a([u(0,l.IBufferService),u(1,l.ICoreService)],h)},6975:function(o,s,n){var a=this&&this.__decorate||function(h,p,g,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,g,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,g,w):b(p,g))||w);return x>3&&w&&Object.defineProperty(p,g,w),w},u=this&&this.__param||function(h,p){return function(g,S){p(g,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let l=n(1439),d=n(8460),m=n(844),y=n(2585),_=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),f=s.CoreService=class extends m.Disposable{constructor(h,p,g){super(),this._bufferService=h,this._logService=p,this._optionsService=g,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(c)}reset(){this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(c)}triggerDataEvent(h,p=!1){if(this._optionsService.rawOptions.disableStdin)return;let g=this._bufferService.buffer;p&&this._optionsService.rawOptions.scrollOnUserInput&&g.ybase!==g.ydisp&&this._onRequestScrollToBottom.fire(),p&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((S=>S.charCodeAt(0))))),this._onData.fire(h)}triggerBinaryEvent(h){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${h}"`,(()=>h.split("").map((p=>p.charCodeAt(0))))),this._onBinary.fire(h))}};s.CoreService=f=a([u(0,y.IBufferService),u(1,y.ILogService),u(2,y.IOptionsService)],f)},9074:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let a=n(8055),u=n(8460),l=n(844),d=n(6106),m=0,y=0;class _ extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((h=>h?.marker.line)),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;let p=new c(h);if(p){let g=p.marker.onDispose((()=>p.dispose()));p.onDispose((()=>{p&&(this._decorations.delete(p)&&this._onDecorationRemoved.fire(p),g.dispose())})),this._decorations.insert(p),this._onDecorationRegistered.fire(p)}return p}reset(){for(let h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,p,g){let S=0,b=0;for(let x of this._decorations.getKeyIterator(p))S=x.options.x??0,b=S+(x.options.width??1),h>=S&&h<b&&(!g||(x.options.layer??"bottom")===g)&&(yield x)}forEachDecorationAtCell(h,p,g,S){this._decorations.forEachByKey(p,(b=>{m=b.options.x??0,y=m+(b.options.width??1),h>=m&&h<y&&(!g||(b.options.layer??"bottom")===g)&&S(b)}))}}s.DecorationService=_;class c extends l.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(h){super(),this.options=h,this.onRenderEmitter=this.register(new u.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=h.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let a=n(2585),u=n(8343);class l{constructor(...m){this._entries=new Map;for(let[y,_]of m)this.set(y,_)}set(m,y){let _=this._entries.get(m);return this._entries.set(m,y),_}forEach(m){for(let[y,_]of this._entries.entries())m(y,_)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}s.ServiceCollection=l,s.InstantiationService=class{constructor(){this._services=new l,this._services.set(a.IInstantiationService,this)}setService(d,m){this._services.set(d,m)}getService(d){return this._services.get(d)}createInstance(d,...m){let y=(0,u.getServiceDependencies)(d).sort(((f,h)=>f.index-h.index)),_=[];for(let f of y){let h=this._services.get(f.id);if(!h)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${f.id}.`);_.push(h)}let c=y.length>0?y[0].index:m.length;if(m.length!==c)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${c+1} conflicts with ${m.length} static arguments`);return new d(...m,..._)}}},7866:function(o,s,n){var a=this&&this.__decorate||function(c,f,h,p){var g,S=arguments.length,b=S<3?f:p===null?p=Object.getOwnPropertyDescriptor(f,h):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,f,h,p);else for(var x=c.length-1;x>=0;x--)(g=c[x])&&(b=(S<3?g(b):S>3?g(f,h,b):g(f,h))||b);return S>3&&b&&Object.defineProperty(f,h,b),b},u=this&&this.__param||function(c,f){return function(h,p){f(h,p,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let l=n(844),d=n(2585),m={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF},y,_=s.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let f=0;f<c.length;f++)typeof c[f]=="function"&&(c[f]=c[f]())}_log(c,f,h){this._evalLazyOptionalParams(h),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...h)}trace(c,...f){this._logLevel<=d.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,f)}debug(c,...f){this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,f)}info(c,...f){this._logLevel<=d.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,f)}warn(c,...f){this._logLevel<=d.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,f)}error(c,...f){this._logLevel<=d.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,f)}};s.LogService=_=a([u(0,d.IOptionsService)],_),s.setTraceLogger=function(c){y=c},s.traceCall=function(c,f,h){if(typeof h.value!="function")throw new Error("not supported");let p=h.value;h.value=function(...g){if(y.logLevel!==d.LogLevelEnum.TRACE)return p.apply(this,g);y.trace(`GlyphRenderer#${p.name}(${g.map((b=>JSON.stringify(b))).join(", ")})`);let S=p.apply(this,g);return y.trace(`GlyphRenderer#${p.name} return`,S),S}}},7302:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let a=n(8460),u=n(844),l=n(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:l.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let d=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends u.Disposable{constructor(_){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let f in _)if(f in c)try{let h=_[f];c[f]=this._sanitizeAndValidateOption(f,h)}catch(h){console.error(h)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,u.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(_,c){return this.onOptionChange((f=>{f===_&&c(this.rawOptions[_])}))}onMultipleOptionChange(_,c){return this.onOptionChange((f=>{_.indexOf(f)!==-1&&c()}))}_setupOptions(){let _=f=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},c=(f,h)=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);h=this._sanitizeAndValidateOption(f,h),this.rawOptions[f]!==h&&(this.rawOptions[f]=h,this._onOptionChange.fire(f))};for(let f in this.rawOptions){let h={get:_.bind(this,f),set:c.bind(this,f)};Object.defineProperty(this.options,f,h)}}_sanitizeAndValidateOption(_,c){switch(_){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[_]),!(function(f){return f==="block"||f==="underline"||f==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${_}`);break;case"wordSeparator":c||(c=s.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=d.includes(c)?c:s.DEFAULT_OPTIONS[_];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${_} 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(`${_} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${_} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}s.OptionsService=m},2660:function(o,s,n){var a=this&&this.__decorate||function(m,y,_,c){var f,h=arguments.length,p=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,_):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(m,y,_,c);else for(var g=m.length-1;g>=0;g--)(f=m[g])&&(p=(h<3?f(p):h>3?f(y,_,p):f(y,_))||p);return h>3&&p&&Object.defineProperty(y,_,p),p},u=this&&this.__param||function(m,y){return function(_,c){y(_,c,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let l=n(2585),d=s.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){let y=this._bufferService.buffer;if(m.id===void 0){let g=y.addMarker(y.ybase+y.y),S={data:m,id:this._nextId++,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(S,g))),this._dataByLinkId.set(S.id,S),S.id}let _=m,c=this._getEntryIdKey(_),f=this._entriesWithId.get(c);if(f)return this.addLineToLink(f.id,y.ybase+y.y),f.id;let h=y.addMarker(y.ybase+y.y),p={id:this._nextId++,key:this._getEntryIdKey(_),data:_,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(p,h))),this._entriesWithId.set(p.key,p),this._dataByLinkId.set(p.id,p),p.id}addLineToLink(m,y){let _=this._dataByLinkId.get(m);if(_&&_.lines.every((c=>c.line!==y))){let c=this._bufferService.buffer.addMarker(y);_.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(_,c)))}}getLinkData(m){return this._dataByLinkId.get(m)?.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){let _=m.lines.indexOf(y);_!==-1&&(m.lines.splice(_,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};s.OscLinkService=d=a([u(0,l.IBufferService)],d)},8343:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let n="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(u){return u[a]||[]},s.createDecorator=function(u){if(s.serviceRegistry.has(u))return s.serviceRegistry.get(u);let l=function(d,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,c,f){c[n]===c?c[a].push({id:_,index:f}):(c[a]=[{id:_,index:f}],c[n]=c)})(l,d,y)};return l.toString=()=>u,s.serviceRegistry.set(u,l),l}},2585:(o,s,n)=>{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 a=n(8343);var u;s.IBufferService=(0,a.createDecorator)("BufferService"),s.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),s.ICoreService=(0,a.createDecorator)("CoreService"),s.ICharsetService=(0,a.createDecorator)("CharsetService"),s.IInstantiationService=(0,a.createDecorator)("InstantiationService"),(function(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.OFF=5]="OFF"})(u||(s.LogLevelEnum=u={})),s.ILogService=(0,a.createDecorator)("LogService"),s.IOptionsService=(0,a.createDecorator)("OptionsService"),s.IOscLinkService=(0,a.createDecorator)("OscLinkService"),s.IUnicodeService=(0,a.createDecorator)("UnicodeService"),s.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let a=n(8460),u=n(225);class l{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,y,_=!1){return(16777215&m)<<3|(3&y)<<1|(_?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let m=new u.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let y=0,_=0,c=m.length;for(let f=0;f<c;++f){let h=m.charCodeAt(f);if(55296<=h&&h<=56319){if(++f>=c)return y+this.wcwidth(h);let S=m.charCodeAt(f);56320<=S&&S<=57343?h=1024*(h-55296)+S-56320+65536:y+=this.wcwidth(S)}let p=this.charProperties(h,_),g=l.extractWidth(p);l.extractShouldJoin(p)&&(g-=l.extractWidth(_)),y+=g,_=p}return y}charProperties(m,y){return this._activeProvider.charProperties(m,y)}}s.UnicodeService=l}},t={};function r(o){var s=t[o];if(s!==void 0)return s.exports;var n=t[o]={exports:{}};return e[o].call(n.exports,n,n.exports,r),n.exports}var i={};return(()=>{var o=i;Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;let s=r(9042),n=r(3236),a=r(844),u=r(5741),l=r(8285),d=r(7975),m=r(7090),y=["cols","rows"];class _ extends a.Disposable{constructor(f){super(),this._core=this.register(new n.Terminal(f)),this._addonManager=this.register(new u.AddonManager),this._publicOptions={...this._core.options};let h=g=>this._core.options[g],p=(g,S)=>{this._checkReadonlyOptions(g),this._core.options[g]=S};for(let g in this._core.options){let S={get:h.bind(this,g),set:p.bind(this,g)};Object.defineProperty(this._publicOptions,g,S)}}_checkReadonlyOptions(f){if(y.includes(f))throw new Error(`Option "${f}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.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 l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let f=this._core.coreService.decPrivateModes,h="none";switch(this._core.coreMouseService.activeProtocol){case"X10":h="x10";break;case"VT200":h="vt200";break;case"DRAG":h="drag";break;case"ANY":h="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(let h in f)this._publicOptions[h]=f[h]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,h=!0){this._core.input(f,h)}resize(f,h){this._verifyIntegers(f,h),this._core.resize(f,h)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,h,p){this._verifyIntegers(f,h,p),this._core.select(f,h,p)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,h){this._verifyIntegers(f,h),this._core.selectLines(f,h)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,h){this._core.write(f,h)}writeln(f,h){this._core.write(f),this._core.write(`\r
9
- `,h)}paste(f){this._core.paste(f)}refresh(f,h){this._verifyIntegers(f,h),this._core.refresh(f,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return s}_verifyIntegers(...f){for(let h of f)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(let h of f)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}o.Terminal=_})(),i})()))});var Da=Ta((hs,Ln)=>{(function(e,t){typeof hs=="object"&&typeof Ln=="object"?Ln.exports=t():typeof define=="function"&&define.amd?define([],t):typeof hs=="object"?hs.FitAddon=t():e.FitAddon=t()})(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(r){this._terminal=r}dispose(){}fit(){let r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;let i=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(i._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let r=this._terminal._core,i=r._renderService.dimensions;if(i.css.cell.width===0||i.css.cell.height===0)return;let o=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),l=n-(parseInt(u.getPropertyValue("padding-top"))+parseInt(u.getPropertyValue("padding-bottom"))),d=a-(parseInt(u.getPropertyValue("padding-right"))+parseInt(u.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(d/i.css.cell.width)),rows:Math.max(1,Math.floor(l/i.css.cell.height))}}}})(),e})()))});var yh=Ma(Aa(),1),Sh=Ma(Da(),1);var hu=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Pa.isErrorNoTelemetry(e)?new Pa(e.message+`
7
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(w){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&w&&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(w){let E=this._getMouseBufferCoords(w),B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(B&&P&&E)&&this._areCoordsInSelection(E,B,P)}isCellInSelection(w,E){let B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!B||!P)&&this._areCoordsInSelection([w,E],B,P)}_areCoordsInSelection(w,E,B){return w[1]>E[1]&&w[1]<B[1]||E[1]===B[1]&&w[1]===E[1]&&w[0]>=E[0]&&w[0]<B[0]||E[1]<B[1]&&w[1]===B[1]&&w[0]<B[0]||E[1]<B[1]&&w[1]===E[1]&&w[0]>=E[0]}_selectWordAtCursor(w,E){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,h.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let P=this._getMouseBufferCoords(w);return!!P&&(this._selectWordAt(P,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(w,E){this._model.clearSelection(),w=Math.max(w,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,w],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(w){this._model.handleTrim(w)&&this.refresh()}_getMouseBufferCoords(w){let E=this._mouseService.getCoords(w,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(w){let E=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,w,this._screenElement)[1],B=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=B?0:(E>B&&(E-=B),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(w){return f.isMac?w.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:w.shiftKey}handleMouseDown(w){if(this._mouseDownTimeStamp=w.timeStamp,(w.button!==2||!this.hasSelection)&&w.button===0){if(!this._enabled){if(!this.shouldForceSelection(w))return;w.stopPropagation()}w.preventDefault(),this._dragScrollAmount=0,this._enabled&&w.shiftKey?this._handleIncrementalClick(w):w.detail===1?this._handleSingleClick(w):w.detail===2?this._handleDoubleClick(w):w.detail===3&&this._handleTripleClick(w),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(w){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(w))}_handleSingleClick(w){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(w)?3:0,this._model.selectionStart=this._getMouseBufferCoords(w),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(w){this._selectWordAtCursor(w,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(w){let E=this._getMouseBufferCoords(w);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(w){return w.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(w){if(w.stopImmediatePropagation(),!this._model.selectionStart)return;let E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(w),!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(w),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]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let w=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(w.ydisp+this._bufferService.rows,w.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=w.ydisp),this.refresh()}}_handleMouseUp(w){let E=w.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&w.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let B=this._mouseService.getCoords(w,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){let P=(0,d.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,B=!(!w||!E||w[0]===E[0]&&w[1]===E[1]);B?w&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&w[0]===this._oldSelectionStart[0]&&w[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(w,E,B)):this._oldHasSelection&&this._fireOnSelectionChange(w,E,B)}_fireOnSelectionChange(w,E,B){this._oldSelectionStart=w,this._oldSelectionEnd=E,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(w){this.clearSelection(),this._trimListener.dispose(),this._trimListener=w.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(w,E){let B=E;for(let P=0;E>=P;P++){let W=w.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:W>1&&E!==P&&(B+=W-1)}return B}setSelection(w,E,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[w,E],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(w){this._isClickInSelection(w)||(this._selectWordAtCursor(w,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(w,E,B=!0,P=!0){if(w[0]>=this._bufferService.cols)return;let W=this._bufferService.buffer,A=W.lines.get(w[1]);if(!A)return;let V=W.translateBufferLineToString(w[1],!1),O=this._convertViewportColToCharacterIndex(A,w[0]),R=O,F=w[0]-O,I=0,C=0,L=0,T=0;if(V.charAt(O)===" "){for(;O>0&&V.charAt(O-1)===" ";)O--;for(;R<V.length&&V.charAt(R+1)===" ";)R++}else{let G=w[0],$=w[0];A.getWidth(G)===0&&(I++,G--),A.getWidth($)===2&&(C++,$++);let Y=A.getString($).length;for(Y>1&&(T+=Y-1,R+=Y-1);G>0&&O>0&&!this._isCharWordSeparator(A.loadCell(G-1,this._workCell));){A.loadCell(G-1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,G--):H>1&&(L+=H-1,O-=H-1),O--,G--}for(;$<A.length&&R+1<V.length&&!this._isCharWordSeparator(A.loadCell($+1,this._workCell));){A.loadCell($+1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,$++):H>1&&(T+=H-1,R+=H-1),R++,$++}}R++;let D=O+F-I+L,N=Math.min(this._bufferService.cols,R-O+I+C-L-T);if(E||V.slice(O,R).trim()!==""){if(B&&D===0&&A.getCodePoint(0)!==32){let G=W.lines.get(w[1]-1);if(G&&A.isWrapped&&G.getCodePoint(this._bufferService.cols-1)!==32){let $=this._getWordAt([this._bufferService.cols-1,w[1]-1],!1,!0,!1);if($){let Y=this._bufferService.cols-$.start;D-=Y,N+=Y}}}if(P&&D+N===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let G=W.lines.get(w[1]+1);if(G?.isWrapped&&G.getCodePoint(0)!==32){let $=this._getWordAt([0,w[1]+1],!1,!1,!0);$&&(N+=$.length)}}return{start:D,length:N}}}_selectWordAt(w,E){let B=this._getWordAt(w,E);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,w[1]--;this._model.selectionStart=[B.start,w[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(w){let E=this._getWordAt(w,!0);if(E){let B=w[1];for(;E.start<0;)E.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,B]}}_isCharWordSeparator(w){return w.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(w.getChars())>=0}_selectLineAt(w){let E=this._bufferService.buffer.getWrappedRangeForLine(w),B={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(B,this._bufferService.cols)}};s.SelectionService=x=a([u(3,v.IBufferService),u(4,v.ICoreService),u(5,y.IMouseService),u(6,v.IOptionsService),u(7,y.IRenderService),u(8,y.ICoreBrowserService)],x)},4725:(o,s,n)=>{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 a=n(8343);s.ICharSizeService=(0,a.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),s.IMouseService=(0,a.createDecorator)("MouseService"),s.IRenderService=(0,a.createDecorator)("RenderService"),s.ISelectionService=(0,a.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,a.createDecorator)("ThemeService"),s.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(o,s,n){var a=this&&this.__decorate||function(x,w,E,B){var P,W=arguments.length,A=W<3?w:B===null?B=Object.getOwnPropertyDescriptor(w,E):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,w,E,B);else for(var V=x.length-1;V>=0;V--)(P=x[V])&&(A=(W<3?P(A):W>3?P(w,E,A):P(w,E))||A);return W>3&&A&&Object.defineProperty(w,E,A),A},u=this&&this.__param||function(x,w){return function(E,B){w(E,B,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let l=n(7239),d=n(8055),m=n(8460),y=n(844),_=n(2585),c=d.css.toColor("#ffffff"),f=d.css.toColor("#000000"),h=d.css.toColor("#ffffff"),p=d.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let x=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],w=[0,95,135,175,215,255];for(let E=0;E<216;E++){let B=w[E/36%6|0],P=w[E/6%6|0],W=w[E%6];x.push({css:d.channels.toCss(B,P,W),rgba:d.channels.toRgba(B,P,W)})}for(let E=0;E<24;E++){let B=8+10*E;x.push({css:d.channels.toCss(B,B,B),rgba:d.channels.toRgba(B,B,B)})}return x})());let S=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(x){super(),this._optionsService=x,this._contrastCache=new l.ColorContrastCache,this._halfContrastCache=new l.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:f,cursor:h,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:d.color.blend(f,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:d.color.blend(f,v),ansi:s.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(x={}){let w=this._colors;if(w.foreground=b(x.foreground,c),w.background=b(x.background,f),w.cursor=b(x.cursor,h),w.cursorAccent=b(x.cursorAccent,p),w.selectionBackgroundTransparent=b(x.selectionBackground,v),w.selectionBackgroundOpaque=d.color.blend(w.background,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundTransparent=b(x.selectionInactiveBackground,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundOpaque=d.color.blend(w.background,w.selectionInactiveBackgroundTransparent),w.selectionForeground=x.selectionForeground?b(x.selectionForeground,d.NULL_COLOR):void 0,w.selectionForeground===d.NULL_COLOR&&(w.selectionForeground=void 0),d.color.isOpaque(w.selectionBackgroundTransparent)&&(w.selectionBackgroundTransparent=d.color.opacity(w.selectionBackgroundTransparent,.3)),d.color.isOpaque(w.selectionInactiveBackgroundTransparent)&&(w.selectionInactiveBackgroundTransparent=d.color.opacity(w.selectionInactiveBackgroundTransparent,.3)),w.ansi=s.DEFAULT_ANSI_COLORS.slice(),w.ansi[0]=b(x.black,s.DEFAULT_ANSI_COLORS[0]),w.ansi[1]=b(x.red,s.DEFAULT_ANSI_COLORS[1]),w.ansi[2]=b(x.green,s.DEFAULT_ANSI_COLORS[2]),w.ansi[3]=b(x.yellow,s.DEFAULT_ANSI_COLORS[3]),w.ansi[4]=b(x.blue,s.DEFAULT_ANSI_COLORS[4]),w.ansi[5]=b(x.magenta,s.DEFAULT_ANSI_COLORS[5]),w.ansi[6]=b(x.cyan,s.DEFAULT_ANSI_COLORS[6]),w.ansi[7]=b(x.white,s.DEFAULT_ANSI_COLORS[7]),w.ansi[8]=b(x.brightBlack,s.DEFAULT_ANSI_COLORS[8]),w.ansi[9]=b(x.brightRed,s.DEFAULT_ANSI_COLORS[9]),w.ansi[10]=b(x.brightGreen,s.DEFAULT_ANSI_COLORS[10]),w.ansi[11]=b(x.brightYellow,s.DEFAULT_ANSI_COLORS[11]),w.ansi[12]=b(x.brightBlue,s.DEFAULT_ANSI_COLORS[12]),w.ansi[13]=b(x.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),w.ansi[14]=b(x.brightCyan,s.DEFAULT_ANSI_COLORS[14]),w.ansi[15]=b(x.brightWhite,s.DEFAULT_ANSI_COLORS[15]),x.extendedAnsi){let E=Math.min(w.ansi.length-16,x.extendedAnsi.length);for(let B=0;B<E;B++)w.ansi[B+16]=b(x.extendedAnsi[B],s.DEFAULT_ANSI_COLORS[B+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(x){this._restoreColor(x),this._onChangeColors.fire(this.colors)}_restoreColor(x){if(x!==void 0)switch(x){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[x]=this._restoreColors.ansi[x]}else for(let w=0;w<this._restoreColors.ansi.length;++w)this._colors.ansi[w]=this._restoreColors.ansi[w]}modifyColors(x){x(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(x,w){if(x!==void 0)try{return d.css.toColor(x)}catch{}return w}s.ThemeService=S=a([u(0,_.IOptionsService)],S)},6349:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let a=n(8460),u=n(844);class l extends u.Disposable{constructor(m){super(),this._maxLength=m,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(m){if(this._maxLength===m)return;let y=new Array(m);for(let _=0;_<Math.min(m,this.length);_++)y[_]=this._array[this._getCyclicIndex(_)];this._array=y,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let y=this._length;y<m;y++)this._array[y]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,y){this._array[this._getCyclicIndex(m)]=y}push(m){this._array[this._getCyclicIndex(this._length)]=m,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(m,y,..._){if(y){for(let c=m;c<this._length-y;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+y)];this._length-=y,this.onDeleteEmitter.fire({index:m,amount:y})}for(let c=this._length-1;c>=m;c--)this._array[this._getCyclicIndex(c+_.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<_.length;c++)this._array[this._getCyclicIndex(m+c)]=_[c];if(_.length&&this.onInsertEmitter.fire({index:m,amount:_.length}),this._length+_.length>this._maxLength){let c=this._length+_.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=_.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,_){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let f=y-1;f>=0;f--)this.set(m+f+_,this.get(m+f));let c=m+y+_-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<y;c++)this.set(m+c+_,this.get(m+c))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}s.CircularList=l},1439:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function n(a,u=5){if(typeof a!="object")return a;let l=Array.isArray(a)?[]:{};for(let d in a)l[d]=u<=1?a[d]:a[d]&&n(a[d],u-1);return l}},8055:(o,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 n=0,a=0,u=0,l=0;var d,m,y,_,c;function f(p){let v=p.toString(16);return v.length<2?"0"+v:v}function h(p,v){return p<v?(v+.05)/(p+.05):(p+.05)/(v+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(v,S,b,x){return x!==void 0?`#${f(v)}${f(S)}${f(b)}${f(x)}`:`#${f(v)}${f(S)}${f(b)}`},p.toRgba=function(v,S,b,x=255){return(v<<24|S<<16|b<<8|x)>>>0},p.toColor=function(v,S,b,x){return{css:p.toCss(v,S,b,x),rgba:p.toRgba(v,S,b,x)}}})(d||(s.channels=d={})),(function(p){function v(S,b){return l=Math.round(255*b),[n,a,u]=c.toChannels(S.rgba),{css:d.toCss(n,a,u,l),rgba:d.toRgba(n,a,u,l)}}p.blend=function(S,b){if(l=(255&b.rgba)/255,l===1)return{css:b.css,rgba:b.rgba};let x=b.rgba>>24&255,w=b.rgba>>16&255,E=b.rgba>>8&255,B=S.rgba>>24&255,P=S.rgba>>16&255,W=S.rgba>>8&255;return n=B+Math.round((x-B)*l),a=P+Math.round((w-P)*l),u=W+Math.round((E-W)*l),{css:d.toCss(n,a,u),rgba:d.toRgba(n,a,u)}},p.isOpaque=function(S){return(255&S.rgba)==255},p.ensureContrastRatio=function(S,b,x){let w=c.ensureContrastRatio(S.rgba,b.rgba,x);if(w)return d.toColor(w>>24&255,w>>16&255,w>>8&255)},p.opaque=function(S){let b=(255|S.rgba)>>>0;return[n,a,u]=c.toChannels(b),{css:d.toCss(n,a,u),rgba:b}},p.opacity=v,p.multiplyOpacity=function(S,b){return l=255&S.rgba,v(S,l*b/255)},p.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(m||(s.color=m={})),(function(p){let v,S;try{let b=document.createElement("canvas");b.width=1,b.height=1;let x=b.getContext("2d",{willReadFrequently:!0});x&&(v=x,v.globalCompositeOperation="copy",S=v.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return n=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),u=parseInt(b.slice(3,4).repeat(2),16),d.toColor(n,a,u);case 5:return n=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),u=parseInt(b.slice(3,4).repeat(2),16),l=parseInt(b.slice(4,5).repeat(2),16),d.toColor(n,a,u,l);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 x=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(x)return n=parseInt(x[1]),a=parseInt(x[2]),u=parseInt(x[3]),l=Math.round(255*(x[5]===void 0?1:parseFloat(x[5]))),d.toColor(n,a,u,l);if(!v||!S)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=S,v.fillStyle=b,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[n,a,u,l]=v.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(n,a,u,l),css:b}}})(y||(s.css=y={})),(function(p){function v(S,b,x){let w=S/255,E=b/255,B=x/255;return .2126*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}p.relativeLuminance=function(S){return v(S>>16&255,S>>8&255,255&S)},p.relativeLuminance2=v})(_||(s.rgb=_={})),(function(p){function v(b,x,w){let E=b>>24&255,B=b>>16&255,P=b>>8&255,W=x>>24&255,A=x>>16&255,V=x>>8&255,O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));for(;O<w&&(W>0||A>0||V>0);)W-=Math.max(0,Math.ceil(.1*W)),A-=Math.max(0,Math.ceil(.1*A)),V-=Math.max(0,Math.ceil(.1*V)),O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));return(W<<24|A<<16|V<<8|255)>>>0}function S(b,x,w){let E=b>>24&255,B=b>>16&255,P=b>>8&255,W=x>>24&255,A=x>>16&255,V=x>>8&255,O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));for(;O<w&&(W<255||A<255||V<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),A=Math.min(255,A+Math.ceil(.1*(255-A))),V=Math.min(255,V+Math.ceil(.1*(255-V))),O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));return(W<<24|A<<16|V<<8|255)>>>0}p.blend=function(b,x){if(l=(255&x)/255,l===1)return x;let w=x>>24&255,E=x>>16&255,B=x>>8&255,P=b>>24&255,W=b>>16&255,A=b>>8&255;return n=P+Math.round((w-P)*l),a=W+Math.round((E-W)*l),u=A+Math.round((B-A)*l),d.toRgba(n,a,u)},p.ensureContrastRatio=function(b,x,w){let E=_.relativeLuminance(b>>8),B=_.relativeLuminance(x>>8);if(h(E,B)<w){if(B<E){let A=v(b,x,w),V=h(E,_.relativeLuminance(A>>8));if(V<w){let O=S(b,x,w);return V>h(E,_.relativeLuminance(O>>8))?A:O}return A}let P=S(b,x,w),W=h(E,_.relativeLuminance(P>>8));if(W<w){let A=v(b,x,w);return W>h(E,_.relativeLuminance(A>>8))?P:A}return P}},p.reduceLuminance=v,p.increaseLuminance=S,p.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}})(c||(s.rgba=c={})),s.toPaddedHex=f,s.contrastRatio=h},8969:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let a=n(844),u=n(2585),l=n(4348),d=n(7866),m=n(744),y=n(7302),_=n(6975),c=n(8460),f=n(1753),h=n(1480),p=n(7994),v=n(9282),S=n(5435),b=n(5981),x=n(2660),w=!1;class E extends a.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 W in P)this.optionsService.options[W]=P[W]}constructor(P){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 l.InstantiationService,this.optionsService=this.register(new y.OptionsService(P)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(_.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(x.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.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((W=>{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((W=>{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(((W,A)=>this._inputHandler.parse(W,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,W){this._writeBuffer.write(P,W)}writeSync(P,W){this._logService.logLevel<=u.LogLevelEnum.WARN&&!w&&(this._logService.warn("writeSync is unreliable and will be removed soon."),w=!0),this._writeBuffer.writeSync(P,W)}input(P,W=!0){this.coreService.triggerDataEvent(P,W)}resize(P,W){isNaN(P)||isNaN(W)||(P=Math.max(P,m.MINIMUM_COLS),W=Math.max(W,m.MINIMUM_ROWS),this._bufferService.resize(P,W))}scroll(P,W=!1){this._bufferService.scroll(P,W)}scrollLines(P,W,A){this._bufferService.scrollLines(P,W,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 W=P-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(P,W){return this._inputHandler.registerEscHandler(P,W)}registerDcsHandler(P,W){return this._inputHandler.registerDcsHandler(P,W)}registerCsiHandler(P,W){return this._inputHandler.registerCsiHandler(P,W)}registerOscHandler(P,W){return this._inputHandler.registerOscHandler(P,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1,W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?P=W.backend==="conpty"&&W.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(P=!0),P?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let P=[];P.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),P.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let W of P)W.dispose()}))}}}s.CoreTerminal=E},8460:(o,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=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===n)return void this._listeners.splice(a,1)}}})),this._event}fire(n,a){let u=[];for(let l=0;l<this._listeners.length;l++)u.push(this._listeners[l]);for(let l=0;l<u.length;l++)u[l].call(void 0,n,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(n,a){return n((u=>a.fire(u)))},s.runAndSubscribe=function(n,a){return a(void 0),n((u=>a(u)))}},5435:function(o,s,n){var a=this&&this.__decorate||function(I,C,L,T){var D,N=arguments.length,G=N<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,L):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(I,C,L,T);else for(var $=I.length-1;$>=0;$--)(D=I[$])&&(G=(N<3?D(G):N>3?D(C,L,G):D(C,L))||G);return N>3&&G&&Object.defineProperty(C,L,G),G},u=this&&this.__param||function(I,C){return function(L,T){C(L,T,I)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let l=n(2584),d=n(7116),m=n(2015),y=n(844),_=n(482),c=n(8437),f=n(8460),h=n(643),p=n(511),v=n(3734),S=n(2585),b=n(1480),x=n(6242),w=n(6351),E=n(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function W(I,C){if(I>24)return C.setWinLines||!1;switch(I){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var A;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(s.WindowsOptionsReportType=A={}));let V=0;class O extends y.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,T,D,N,G,$,Y,H=new m.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=T,this._logService=D,this._optionsService=N,this._oscLinkService=G,this._coreMouseService=$,this._unicodeService=Y,this._parser=H,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _.StringToUtf32,this._utf8Decoder=new _.Utf8ToUtf32,this._workCell=new p.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 f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new R(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:j.toArray()})})),this._parser.setEscHandlerFallback((k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})})),this._parser.setExecuteHandlerFallback((k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})})),this._parser.setOscHandlerFallback(((k,j,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:j,data:q})})),this._parser.setDcsHandlerFallback(((k,j,q)=>{j==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:j,payload:q})})),this._parser.setPrintHandler(((k,j,q)=>this.print(k,j,q))),this._parser.registerCsiHandler({final:"@"},(k=>this.insertChars(k))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(k=>this.scrollLeft(k))),this._parser.registerCsiHandler({final:"A"},(k=>this.cursorUp(k))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(k=>this.scrollRight(k))),this._parser.registerCsiHandler({final:"B"},(k=>this.cursorDown(k))),this._parser.registerCsiHandler({final:"C"},(k=>this.cursorForward(k))),this._parser.registerCsiHandler({final:"D"},(k=>this.cursorBackward(k))),this._parser.registerCsiHandler({final:"E"},(k=>this.cursorNextLine(k))),this._parser.registerCsiHandler({final:"F"},(k=>this.cursorPrecedingLine(k))),this._parser.registerCsiHandler({final:"G"},(k=>this.cursorCharAbsolute(k))),this._parser.registerCsiHandler({final:"H"},(k=>this.cursorPosition(k))),this._parser.registerCsiHandler({final:"I"},(k=>this.cursorForwardTab(k))),this._parser.registerCsiHandler({final:"J"},(k=>this.eraseInDisplay(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(k=>this.eraseInDisplay(k,!0))),this._parser.registerCsiHandler({final:"K"},(k=>this.eraseInLine(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(k=>this.eraseInLine(k,!0))),this._parser.registerCsiHandler({final:"L"},(k=>this.insertLines(k))),this._parser.registerCsiHandler({final:"M"},(k=>this.deleteLines(k))),this._parser.registerCsiHandler({final:"P"},(k=>this.deleteChars(k))),this._parser.registerCsiHandler({final:"S"},(k=>this.scrollUp(k))),this._parser.registerCsiHandler({final:"T"},(k=>this.scrollDown(k))),this._parser.registerCsiHandler({final:"X"},(k=>this.eraseChars(k))),this._parser.registerCsiHandler({final:"Z"},(k=>this.cursorBackwardTab(k))),this._parser.registerCsiHandler({final:"`"},(k=>this.charPosAbsolute(k))),this._parser.registerCsiHandler({final:"a"},(k=>this.hPositionRelative(k))),this._parser.registerCsiHandler({final:"b"},(k=>this.repeatPrecedingCharacter(k))),this._parser.registerCsiHandler({final:"c"},(k=>this.sendDeviceAttributesPrimary(k))),this._parser.registerCsiHandler({prefix:">",final:"c"},(k=>this.sendDeviceAttributesSecondary(k))),this._parser.registerCsiHandler({final:"d"},(k=>this.linePosAbsolute(k))),this._parser.registerCsiHandler({final:"e"},(k=>this.vPositionRelative(k))),this._parser.registerCsiHandler({final:"f"},(k=>this.hVPosition(k))),this._parser.registerCsiHandler({final:"g"},(k=>this.tabClear(k))),this._parser.registerCsiHandler({final:"h"},(k=>this.setMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(k=>this.setModePrivate(k))),this._parser.registerCsiHandler({final:"l"},(k=>this.resetMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(k=>this.resetModePrivate(k))),this._parser.registerCsiHandler({final:"m"},(k=>this.charAttributes(k))),this._parser.registerCsiHandler({final:"n"},(k=>this.deviceStatus(k))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(k=>this.deviceStatusPrivate(k))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(k=>this.softReset(k))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(k=>this.setCursorStyle(k))),this._parser.registerCsiHandler({final:"r"},(k=>this.setScrollRegion(k))),this._parser.registerCsiHandler({final:"s"},(k=>this.saveCursor(k))),this._parser.registerCsiHandler({final:"t"},(k=>this.windowOptions(k))),this._parser.registerCsiHandler({final:"u"},(k=>this.restoreCursor(k))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(k=>this.insertColumns(k))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(k=>this.deleteColumns(k))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(k=>this.selectProtected(k))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(k=>this.requestMode(k,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(k=>this.requestMode(k,!1))),this._parser.setExecuteHandler(l.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(l.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(l.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(l.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(l.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(l.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(l.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(l.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(l.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new x.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new x.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new x.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new x.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new x.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new x.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new x.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new x.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new x.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new x.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new x.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new x.OscHandler((k=>this.restoreCursorColor(k)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let k in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},(()=>this.selectCharset("("+k))),this._parser.registerEscHandler({intermediates:")",final:k},(()=>this.selectCharset(")"+k))),this._parser.registerEscHandler({intermediates:"*",final:k},(()=>this.selectCharset("*"+k))),this._parser.registerEscHandler({intermediates:"+",final:k},(()=>this.selectCharset("+"+k))),this._parser.registerEscHandler({intermediates:"-",final:k},(()=>this.selectCharset("-"+k))),this._parser.registerEscHandler({intermediates:".",final:k},(()=>this.selectCharset("."+k))),this._parser.registerEscHandler({intermediates:"/",final:k},(()=>this.selectCharset("/"+k)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((k=>(this._logService.error("Parsing error: ",k),k))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new w.DcsHandler(((k,j)=>this.requestStatusString(k,j))))}_preserveStack(C,L,T,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=T,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,T)=>setTimeout((()=>T("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let T,D=this._activeBuffer.x,N=this._activeBuffer.y,G=0,$=this._parseStack.paused;if($){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(T),T;D=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>P&&(G=this._parseStack.position+P)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(k=>String.fromCharCode(k))).join("")}"`),typeof C=="string"?C.split("").map((k=>k.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<P&&(this._parseBuffer=new Uint32Array(Math.min(C.length,P))),$||this._dirtyRowTracker.clearRange(),C.length>P)for(let k=G;k<C.length;k+=P){let j=k+P<C.length?k+P:C.length,q=typeof C=="string"?this._stringDecoder.decode(C.substring(k,j),this._parseBuffer):this._utf8Decoder.decode(C.subarray(k,j),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,q))return this._preserveStack(D,N,q,k),this._logSlowResolvingAsync(T),T}else if(!$){let k=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,k))return this._preserveStack(D,N,k,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===D&&this._activeBuffer.y===N||this._onCursorMove.fire();let Y=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),H=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);H<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(H,this._bufferService.rows-1),Math.min(Y,this._bufferService.rows-1))}print(C,L,T){let D,N,G=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,H=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,j=this._curAttrData,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-L>0&&q.getWidth(this._activeBuffer.x-1)===2&&q.setCellFromCodepoint(this._activeBuffer.x-1,0,1,j);let U=this._parser.precedingJoinState;for(let J=L;J<T;++J){if(D=C[J],D<127&&G){let fe=G[String.fromCharCode(D)];fe&&(D=fe.charCodeAt(0))}let Z=this._unicodeService.charProperties(D,U);N=b.UnicodeService.extractWidth(Z);let se=b.UnicodeService.extractShouldJoin(Z),he=se?b.UnicodeService.extractWidth(U):0;if(U=Z,$&&this._onA11yChar.fire((0,_.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-he>Y){if(H){let fe=q,te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,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),q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&q instanceof c.BufferLine&&q.copyCellsFrom(fe,te,0,he,!1);te<Y;)fe.setCellFromCodepoint(te++,0,1,j)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(se&&this._activeBuffer.x){let fe=q.getWidth(this._activeBuffer.x-1)?1:2;q.addCodepointToCell(this._activeBuffer.x-fe,D,N);for(let te=N-he;--te>=0;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}else if(k&&(q.insertCells(this._activeBuffer.x,N-he,this._activeBuffer.getNullCell(j)),q.getWidth(Y-1)===2&&q.setCellFromCodepoint(Y-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,j)),q.setCellFromCodepoint(this._activeBuffer.x++,D,N,j),N>0)for(;--N;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}this._parser.precedingJoinState=U,this._activeBuffer.x<Y&&T-L>0&&q.getWidth(this._activeBuffer.x)===0&&!q.hasContent(this._activeBuffer.x)&&q.setCellFromCodepoint(this._activeBuffer.x,0,1,j),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(T=>!W(T.params[0],this._optionsService.rawOptions.windowOptions)||L(T)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new w.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new x.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){let L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){let L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){let L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){let L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,T,D=!1,N=!1){let G=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);G.replaceCells(L,T,this._activeBuffer.getNullCell(this._eraseAttrData()),N),D&&(G.isWrapped=!1)}_resetBufferLine(C,L=!1){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),T.isWrapped=!1)}eraseInDisplay(C,L=!1){let T;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);T<this._bufferService.rows;T++)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 3:let D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;L--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;L--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(c.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){let L=this._parser.precedingJoinState;if(!L)return!0;let T=C.params[0]||1,D=b.UnicodeService.extractWidth(L),N=this._activeBuffer.x-D,G=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),$=new Uint32Array(G.length*T),Y=0;for(let k=0;k<G.length;){let j=G.codePointAt(k)||0;$[Y++]=j,k+=j>65535?2:1}let H=Y;for(let k=1;k<T;++k)$.copyWithin(H,0,Y),H+=Y;return this.print($,0,H),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,L){let T=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,G=this._coreService,{buffers:$,cols:Y}=this._bufferService,{active:H,alt:k}=$,j=this._optionsService.rawOptions,q=se=>se?1:2,U=C.params[0];return J=U,Z=L?U===2?4:U===4?q(G.modes.insertMode):U===12?3:U===20?q(j.convertEol):0:U===1?q(T.applicationCursorKeys):U===3?j.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:U===6?q(T.origin):U===7?q(T.wraparound):U===8?3:U===9?q(D==="X10"):U===12?q(j.cursorBlink):U===25?q(!G.isCursorHidden):U===45?q(T.reverseWraparound):U===66?q(T.applicationKeypad):U===67?4:U===1e3?q(D==="VT200"):U===1002?q(D==="DRAG"):U===1003?q(D==="ANY"):U===1004?q(T.sendFocus):U===1005?4:U===1006?q(N==="SGR"):U===1015?4:U===1016?q(N==="SGR_PIXELS"):U===1048?1:U===47||U===1047||U===1049?q(H===k):U===2004?q(T.bracketedPasteMode):0,G.triggerDataEvent(`${l.C0.ESC}[${L?"":"?"}${J};${Z}$y`),!0;var J,Z}_updateAttrColor(C,L,T,D,N){return L===2?(C|=50331648,C&=-16777216,C|=v.AttributeData.fromColorRGB([T,D,N])):L===5&&(C&=-50331904,C|=33554432|255&T),C}_extractColor(C,L,T){let D=[0,0,-1,0,0,0],N=0,G=0;do{if(D[G+N]=C.params[L+G],C.hasSubParams(L+G)){let $=C.getSubParams(L+G),Y=0;do D[1]===5&&(N=1),D[G+Y+1+N]=$[Y];while(++Y<$.length&&Y+G+1+N<D.length);break}if(D[1]===5&&G+N>=2||D[1]===2&&G+N>=5)break;D[1]&&(N=1)}while(++G+L<C.length&&G+N<D.length);for(let $=2;$<D.length;++$)D[$]===-1&&(D[$]=0);switch(D[0]){case 38:T.fg=this._updateAttrColor(T.fg,D[1],D[3],D[4],D[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,D[1],D[3],D[4],D[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,D[1],D[3],D[4],D[5])}return G}_processUnderline(C,L){L.extended=L.extended.clone(),(!~C||C>5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(C){C.fg=c.DEFAULT_ATTR_DATA.fg,C.bg=c.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;let L=C.length,T,D=this._curAttrData;for(let N=0;N<L;N++)T=C.params[N],T>=30&&T<=37?(D.fg&=-50331904,D.fg|=16777216|T-30):T>=40&&T<=47?(D.bg&=-50331904,D.bg|=16777216|T-40):T>=90&&T<=97?(D.fg&=-50331904,D.fg|=16777224|T-90):T>=100&&T<=107?(D.bg&=-50331904,D.bg|=16777224|T-100):T===0?this._processSGR0(D):T===1?D.fg|=134217728:T===3?D.bg|=67108864:T===4?(D.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,D)):T===5?D.fg|=536870912:T===7?D.fg|=67108864:T===8?D.fg|=1073741824:T===9?D.fg|=2147483648:T===2?D.bg|=134217728:T===21?this._processUnderline(2,D):T===22?(D.fg&=-134217729,D.bg&=-134217729):T===23?D.bg&=-67108865:T===24?(D.fg&=-268435457,this._processUnderline(0,D)):T===25?D.fg&=-536870913:T===27?D.fg&=-67108865:T===28?D.fg&=-1073741825:T===29?D.fg&=2147483647:T===39?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):T===49?(D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?N+=this._extractColor(C,N,D):T===53?D.bg|=1073741824:T===55?D.bg&=-1073741825:T===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):T===100?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${L};${T}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${L};${T}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(C){let L=C.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let T=L%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(C){let L=C.params[0]||1,T;return(C.length<2||(T=C.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(C){if(!W(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;let L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==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(`${l.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){let L=[],T=C.split(";");for(;T.length>1;){let D=T.shift(),N=T.shift();if(/^\d+$/.exec(D)){let G=parseInt(D);if(F(G))if(N==="?")L.push({type:0,index:G});else{let $=(0,E.parseColor)(N);$&&L.push({type:1,index:G,color:$})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){let L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();let T=C.split(":"),D,N=T.findIndex((G=>G.startsWith("id=")));return N!==-1&&(D=T[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){let T=C.split(";");for(let D=0;D<T.length&&!(L>=this._specialColors.length);++D,++L)if(T[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{let N=(0,E.parseColor)(T[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[L],color:N}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;let L=[],T=C.split(";");for(let D=0;D<T.length;++D)if(/^\d+$/.exec(T[D])){let N=parseInt(T[D]);F(N)&&L.push({type:2,index:N})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(B[C[0]],d.CHARSETS[C[1]]||d.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){let C=new p.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){let T=this._activeBuffer.ybase+this._activeBuffer.y+L,D=this._activeBuffer.lines.get(T);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,L){let T=this._bufferService.buffer,D=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${N}${l.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}s.InputHandler=O;let R=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,C){I>C&&(V=I,I=C,C=V),I<this.start&&(this.start=I),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(I){return 0<=I&&I<256}R=a([u(0,S.IBufferService)],R)},844:(o,s)=>{function n(a){for(let u of a)u.dispose();a.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 a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let u=this._disposables.indexOf(a);u!==-1&&this._disposables.splice(u,1)}},s.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}},s.toDisposable=function(a){return{dispose:a}},s.disposeArray=n,s.getDisposeArrayDisposable=function(a){return{dispose:()=>n(a)}}},1505:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(u,l,d){this._data[u]||(this._data[u]={}),this._data[u][l]=d}get(u,l){return this._data[u]?this._data[u][l]:void 0}clear(){this._data={}}}s.TwoKeyMap=n,s.FourKeyMap=class{constructor(){this._data=new n}set(a,u,l,d,m){this._data.get(a,u)||this._data.set(a,u,new n),this._data.get(a,u).set(l,d,m)}get(a,u,l,d){return this._data.get(a,u)?.get(l,d)}clear(){this._data.clear()}}},6114:(o,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 n=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=n.includes("Firefox"),s.isLegacyEdge=n.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(n),s.getSafariVersion=function(){if(!s.isSafari)return 0;let u=n.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),s.isIpad=a==="iPad",s.isIphone=a==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),s.isLinux=a.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(n)},6106:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let n=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(n=this._search(this._getKey(a)),this._array.splice(n,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let u=this._getKey(a);if(u===void 0||(n=this._search(u),n===-1)||this._getKey(this._array[n])!==u)return!1;do if(this._array[n]===a)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===u);return!1}*getKeyIterator(a){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===a)}forEachByKey(a,u){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do u(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===a)}values(){return[...this._array].values()}_search(a){let u=0,l=this._array.length-1;for(;l>=u;){let d=u+l>>1,m=this._getKey(this._array[d]);if(m>a)l=d-1;else{if(!(m<a)){for(;d>0&&this._getKey(this._array[d-1])===a;)d--;return d}u=d+1}}return u}}},7226:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let a=n(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),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(m){this._idleCallback=void 0;let y=0,_=0,c=m.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),_=Math.max(y,_),f=m.timeRemaining(),1.5*_>f)return c-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-y))}ms`),void this._start();c=f}this.clear()}}class l extends u{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){let y=Date.now()+m;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=l,s.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:l,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let a=n(643);s.updateWindowsModeWrappedState=function(u){let l=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),d=l?.get(u.cols-1),m=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);m&&d&&(m.isWrapped=d[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&d[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){let l=new n;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}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=n;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){let l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,d=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=d}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let a=n(6349),u=n(7226),l=n(3734),d=n(8437),m=n(4634),y=n(511),_=n(643),c=n(4863),f=n(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(h,p,v){this._hasScrollback=h,this._optionsService=p,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.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(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,p){return new d.BufferLine(this._bufferService.cols,this.getNullCell(h),p)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;let p=h+this._optionsService.rawOptions.scrollback;return p>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:p}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=d.DEFAULT_ATTR_DATA);let p=this._rows;for(;p--;)this.lines.push(this.getBlankLine(h))}}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(h,p){let v=this.getNullCell(d.DEFAULT_ATTR_DATA),S=0,b=this._getCorrectBufferLength(p);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<h)for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(h,v);let x=0;if(this._rows<p)for(let w=this._rows;w<p;w++)this.lines.length<p+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(h,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+x+1?(this.ybase--,x++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(h,v)));else for(let w=this._rows;w>p;w--)this.lines.length>p+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b<this.lines.maxLength){let w=this.lines.length-b;w>0&&(this.lines.trimStart(w),this.ybase=Math.max(this.ybase-w,0),this.ydisp=Math.max(this.ydisp-w,0),this.savedY=Math.max(this.savedY-w,0)),this.lines.maxLength=b}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,p-1),x&&(this.y+=x),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=p-1,this._isReflowEnabled&&(this._reflow(h,p),this._cols>h))for(let x=0;x<this.lines.length;x++)S+=+this.lines.get(x).resize(h,v);this._cols=h,this._rows=p,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let p=0;for(;this._memoryCleanupPosition<this.lines.length;)if(p+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),p>100)return!0;return h}get _isReflowEnabled(){let h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,p){this._cols!==h&&(h>this._cols?this._reflowLarger(h,p):this._reflowSmaller(h,p))}_reflowLarger(h,p){let v=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(v.length>0){let S=(0,m.reflowLargerCreateNewLayout)(this.lines,v);(0,m.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(h,p,S.countRemoved)}}_reflowLargerAdjustViewport(h,p,v){let S=this.getNullCell(d.DEFAULT_ATTR_DATA),b=v;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<p&&this.lines.push(new d.BufferLine(h,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(h,p){let v=this.getNullCell(d.DEFAULT_ATTR_DATA),S=[],b=0;for(let x=this.lines.length-1;x>=0;x--){let w=this.lines.get(x);if(!w||!w.isWrapped&&w.getTrimmedLength()<=h)continue;let E=[w];for(;w.isWrapped&&x>0;)w=this.lines.get(--x),E.unshift(w);let B=this.ybase+this.y;if(B>=x&&B<x+E.length)continue;let P=E[E.length-1].getTrimmedLength(),W=(0,m.reflowSmallerGetNewLineLengths)(E,this._cols,h),A=W.length-E.length,V;V=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 T=0;T<A;T++){let D=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);O.push(D)}O.length>0&&(S.push({start:x+E.length+b,newLines:O}),b+=O.length),E.push(...O);let R=W.length-1,F=W[R];F===0&&(R--,F=W[R]);let I=E.length-A-1,C=P;for(;I>=0;){let T=Math.min(C,F);if(E[R]===void 0)break;if(E[R].copyCellsFrom(E[I],C-T,F-T,T,!0),F-=T,F===0&&(R--,F=W[R]),C-=T,C===0){I--;let D=Math.max(I,0);C=(0,m.getWrappedLineTrimmedLength)(E,D,this._cols)}}for(let T=0;T<E.length;T++)W[T]<h&&E[T].setCell(W[T],v);let L=A-V;for(;L-- >0;)this.ybase===0?this.y<p-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-p&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+p-1)}if(S.length>0){let x=[],w=[];for(let R=0;R<this.lines.length;R++)w.push(this.lines.get(R));let E=this.lines.length,B=E-1,P=0,W=S[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let A=0;for(let R=Math.min(this.lines.maxLength-1,E+b-1);R>=0;R--)if(W&&W.start>B+A){for(let F=W.newLines.length-1;F>=0;F--)this.lines.set(R--,W.newLines[F]);R++,x.push({index:B+1,amount:W.newLines.length}),A+=W.newLines.length,W=S[++P]}else this.lines.set(R,w[B--]);let V=0;for(let R=x.length-1;R>=0;R--)x[R].index+=V,this.lines.onInsertEmitter.fire(x[R]),V+=x[R].amount;let O=Math.max(0,E+b-this.lines.maxLength);O>0&&this.lines.onTrimEmitter.fire(O)}}translateBufferLineToString(h,p,v=0,S){let b=this.lines.get(h);return b?b.translateToString(p,v,S):""}getWrappedRangeForLine(h){let p=h,v=h;for(;p>0&&this.lines.get(p).isWrapped;)p--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:p,last:v}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].line===h&&(this.markers[p].dispose(),this.markers.splice(p--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose(),this.markers.splice(h--,1);this._isClearing=!1}addMarker(h){let p=new c.Marker(h);return this.markers.push(p),p.register(this.lines.onTrim((v=>{p.line-=v,p.line<0&&p.dispose()}))),p.register(this.lines.onInsert((v=>{p.line>=v.index&&(p.line+=v.amount)}))),p.register(this.lines.onDelete((v=>{p.line>=v.index&&p.line<v.index+v.amount&&p.dispose(),p.line>v.index&&(p.line-=v.amount)}))),p.register(p.onDispose((()=>this._removeMarker(p)))),p}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let a=n(3734),u=n(511),l=n(643),d=n(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let m=0;class y{constructor(c,f,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let p=f||u.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let v=0;v<c;++v)this.setCell(v,p);this.length=c}get(c){let f=this._data[3*c+0],h=2097151&f;return[this._data[3*c+1],2097152&f?this._combined[c]:h?(0,d.stringFromCodePoint)(h):"",f>>22,2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):h]}set(c,f){this._data[3*c+1]=f[l.CHAR_DATA_ATTR_INDEX],f[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=f[1],this._data[3*c+0]=2097152|c|f[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.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 f=this._data[3*c+0];return 2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&f}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let f=this._data[3*c+0];return 2097152&f?this._combined[c]:2097151&f?(0,d.stringFromCodePoint)(2097151&f):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,f){return m=3*c,f.content=this._data[m+0],f.fg=this._data[m+1],f.bg=this._data[m+2],2097152&f.content&&(f.combinedData=this._combined[c]),268435456&f.bg&&(f.extended=this._extendedAttrs[c]),f}setCell(c,f){2097152&f.content&&(this._combined[c]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[c]=f.extended),this._data[3*c+0]=f.content,this._data[3*c+1]=f.fg,this._data[3*c+2]=f.bg}setCellFromCodepoint(c,f,h,p){268435456&p.bg&&(this._extendedAttrs[c]=p.extended),this._data[3*c+0]=f|h<<22,this._data[3*c+1]=p.fg,this._data[3*c+2]=p.bg}addCodepointToCell(c,f,h){let p=this._data[3*c+0];2097152&p?this._combined[c]+=(0,d.stringFromCodePoint)(f):2097151&p?(this._combined[c]=(0,d.stringFromCodePoint)(2097151&p)+(0,d.stringFromCodePoint)(f),p&=-2097152,p|=2097152):p=f|4194304,h&&(p&=-12582913,p|=h<<22),this._data[3*c+0]=p}insertCells(c,f,h){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length-c){let p=new u.CellData;for(let v=this.length-c-f-1;v>=0;--v)this.setCell(c+f+v,this.loadCell(c+v,p));for(let v=0;v<f;++v)this.setCell(c+v,h)}else for(let p=c;p<this.length;++p)this.setCell(p,h);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,h)}deleteCells(c,f,h){if(c%=this.length,f<this.length-c){let p=new u.CellData;for(let v=0;v<this.length-c-f;++v)this.setCell(c+v,this.loadCell(c+f+v,p));for(let v=this.length-f;v<this.length;++v)this.setCell(v,h)}else for(let p=c;p<this.length;++p)this.setCell(p,h);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,h)}replaceCells(c,f,h,p=!1){if(p)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,h);c<f&&c<this.length;)this.isProtected(c)||this.setCell(c,h),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,h);c<f&&c<this.length;)this.setCell(c++,h)}resize(c,f){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let h=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*h)this._data=new Uint32Array(this._data.buffer,0,h);else{let p=new Uint32Array(h);p.set(this._data),this._data=p}for(let p=this.length;p<c;++p)this.setCell(p,f)}else{this._data=this._data.subarray(0,h);let p=Object.keys(this._combined);for(let S=0;S<p.length;S++){let b=parseInt(p[S],10);b>=c&&delete this._combined[b]}let v=Object.keys(this._extendedAttrs);for(let S=0;S<v.length;S++){let b=parseInt(v[S],10);b>=c&&delete this._extendedAttrs[b]}}return this.length=c,4*h*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,f=!1){if(f)for(let h=0;h<this.length;++h)this.isProtected(h)||this.setCell(h,c);else{this._combined={},this._extendedAttrs={};for(let h=0;h<this.length;++h)this.setCell(h,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 f in c._combined)this._combined[f]=c._combined[f];this._extendedAttrs={};for(let f in c._extendedAttrs)this._extendedAttrs[f]=c._extendedAttrs[f];this.isWrapped=c.isWrapped}clone(){let c=new y(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let f in this._combined)c._combined[f]=this._combined[f];for(let f in this._extendedAttrs)c._extendedAttrs[f]=this._extendedAttrs[f];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,f,h,p,v){let S=c._data;if(v)for(let x=p-1;x>=0;x--){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(f+x)+w];268435456&S[3*(f+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[f+x])}else for(let x=0;x<p;x++){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(f+x)+w];268435456&S[3*(f+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[f+x])}let b=Object.keys(c._combined);for(let x=0;x<b.length;x++){let w=parseInt(b[x],10);w>=f&&(this._combined[w-f+h]=c._combined[w])}}translateToString(c,f,h,p){f=f??0,h=h??this.length,c&&(h=Math.min(h,this.getTrimmedLength())),p&&(p.length=0);let v="";for(;f<h;){let S=this._data[3*f+0],b=2097151&S,x=2097152&S?this._combined[f]:b?(0,d.stringFromCodePoint)(b):l.WHITESPACE_CELL_CHAR;if(v+=x,p)for(let w=0;w<x.length;++w)p.push(f);f+=S>>22||1}return p&&p.push(f),v}}s.BufferLine=y},4841:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(n,a){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return a*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(o,s)=>{function n(a,u,l){if(u===a.length-1)return a[u].getTrimmedLength();let d=!a[u].hasContent(l-1)&&a[u].getWidth(l-1)===1,m=a[u+1].getWidth(0)===2;return d&&m?l-1:l}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(a,u,l,d,m){let y=[];for(let _=0;_<a.length-1;_++){let c=_,f=a.get(++c);if(!f.isWrapped)continue;let h=[a.get(_)];for(;c<a.length&&f.isWrapped;)h.push(f),f=a.get(++c);if(d>=_&&d<c){_+=h.length-1;continue}let p=0,v=n(h,p,u),S=1,b=0;for(;S<h.length;){let w=n(h,S,u),E=w-b,B=l-v,P=Math.min(E,B);h[p].copyCellsFrom(h[S],b,v,P,!1),v+=P,v===l&&(p++,v=0),b+=P,b===w&&(S++,b=0),v===0&&p!==0&&h[p-1].getWidth(l-1)===2&&(h[p].copyCellsFrom(h[p-1],l-1,v++,1,!1),h[p-1].setCell(l-1,m))}h[p].replaceCells(v,l,m);let x=0;for(let w=h.length-1;w>0&&(w>p||h[w].getTrimmedLength()===0);w--)x++;x>0&&(y.push(_+h.length-x),y.push(x)),_+=h.length-1}return y},s.reflowLargerCreateNewLayout=function(a,u){let l=[],d=0,m=u[d],y=0;for(let _=0;_<a.length;_++)if(m===_){let c=u[++d];a.onDeleteEmitter.fire({index:_-y,amount:c}),_+=c-1,y+=c,m=u[++d]}else l.push(_);return{layout:l,countRemoved:y}},s.reflowLargerApplyNewLayout=function(a,u){let l=[];for(let d=0;d<u.length;d++)l.push(a.get(u[d]));for(let d=0;d<l.length;d++)a.set(d,l[d]);a.length=u.length},s.reflowSmallerGetNewLineLengths=function(a,u,l){let d=[],m=a.map(((f,h)=>n(a,h,u))).reduce(((f,h)=>f+h)),y=0,_=0,c=0;for(;c<m;){if(m-c<l){d.push(m-c);break}y+=l;let f=n(a,_,u);y>f&&(y-=f,_++);let h=a[_].getWidth(y-1)===2;h&&y--;let p=h?l-1:l;d.push(p),c+=p}return d},s.getWrappedLineTrimmedLength=n},5295:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let a=n(8460),u=n(844),l=n(9092);class d extends u.Disposable{constructor(y,_){super(),this._optionsService=y,this._bufferService=_,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 l.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new l.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,_){this._normal.resize(y,_),this._alt.resize(y,_),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=d},511:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let a=n(482),u=n(643),l=n(3734);class d extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(y){let _=new d;return _.setFromCharData(y),_}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(y){this.fg=y[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let _=!1;if(y[u.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(y[u.CHAR_DATA_CHAR_INDEX].length===2){let c=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let f=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(c-55296)+f-56320+65536|y[u.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[u.CHAR_DATA_WIDTH_INDEX]<<22;_&&(this.combinedData=y[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=d},643:(o,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:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let a=n(8460),u=n(844);class l{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=l._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,u.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}s.Marker=l,l._nextId=1},7116:(o,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:(o,s)=>{var n,a,u;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(l){l.NUL="\0",l.SOH="",l.STX="",l.ETX="",l.EOT="",l.ENQ="",l.ACK="",l.BEL="\x07",l.BS="\b",l.HT=" ",l.LF=`
8
+ `,l.VT="\v",l.FF="\f",l.CR="\r",l.SO="",l.SI="",l.DLE="",l.DC1="",l.DC2="",l.DC3="",l.DC4="",l.NAK="",l.SYN="",l.ETB="",l.CAN="",l.EM="",l.SUB="",l.ESC="\x1B",l.FS="",l.GS="",l.RS="",l.US="",l.SP=" ",l.DEL="\x7F"})(n||(s.C0=n={})),(function(l){l.PAD="\x80",l.HOP="\x81",l.BPH="\x82",l.NBH="\x83",l.IND="\x84",l.NEL="\x85",l.SSA="\x86",l.ESA="\x87",l.HTS="\x88",l.HTJ="\x89",l.VTS="\x8A",l.PLD="\x8B",l.PLU="\x8C",l.RI="\x8D",l.SS2="\x8E",l.SS3="\x8F",l.DCS="\x90",l.PU1="\x91",l.PU2="\x92",l.STS="\x93",l.CCH="\x94",l.MW="\x95",l.SPA="\x96",l.EPA="\x97",l.SOS="\x98",l.SGCI="\x99",l.SCI="\x9A",l.CSI="\x9B",l.ST="\x9C",l.OSC="\x9D",l.PM="\x9E",l.APC="\x9F"})(a||(s.C1=a={})),(function(l){l.ST=`${n.ESC}\\`})(u||(s.C1_ESCAPED=u={}))},7399:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let a=n(2584),u={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(l,d,m,y){let _={type:0,cancel:!1,key:void 0},c=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?_.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?_.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?_.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(_.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:_.key=l.ctrlKey?"\b":a.C0.DEL,l.altKey&&(_.key=a.C0.ESC+_.key);break;case 9:if(l.shiftKey){_.key=a.C0.ESC+"[Z";break}_.key=a.C0.HT,_.cancel=!0;break;case 13:_.key=l.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,_.cancel=!0;break;case 27:_.key=a.C0.ESC,l.altKey&&(_.key=a.C0.ESC+a.C0.ESC),_.cancel=!0;break;case 37:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"D",_.key===a.C0.ESC+"[1;3D"&&(_.key=a.C0.ESC+(m?"b":"[1;5D"))):_.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"C",_.key===a.C0.ESC+"[1;3C"&&(_.key=a.C0.ESC+(m?"f":"[1;5C"))):_.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"A",m||_.key!==a.C0.ESC+"[1;3A"||(_.key=a.C0.ESC+"[1;5A")):_.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"B",m||_.key!==a.C0.ESC+"[1;3B"||(_.key=a.C0.ESC+"[1;5B")):_.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(_.key=a.C0.ESC+"[2~");break;case 46:_.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:_.key=c?a.C0.ESC+"[1;"+(c+1)+"H":d?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:_.key=c?a.C0.ESC+"[1;"+(c+1)+"F":d?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:l.shiftKey?_.type=2:l.ctrlKey?_.key=a.C0.ESC+"[5;"+(c+1)+"~":_.key=a.C0.ESC+"[5~";break;case 34:l.shiftKey?_.type=3:l.ctrlKey?_.key=a.C0.ESC+"[6;"+(c+1)+"~":_.key=a.C0.ESC+"[6~";break;case 112:_.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:_.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:_.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:_.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:_.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:_.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:_.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:_.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:_.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:_.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:_.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:_.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(m&&!y||!l.altKey||l.metaKey)!m||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?_.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(_.key=a.C0.US),l.key==="@"&&(_.key=a.C0.NUL)):l.keyCode===65&&(_.type=1);else{let f=u[l.keyCode],h=f?.[l.shiftKey?1:0];if(h)_.key=a.C0.ESC+h;else if(l.keyCode>=65&&l.keyCode<=90){let p=l.ctrlKey?l.keyCode-64:l.keyCode+32,v=String.fromCharCode(p);l.shiftKey&&(v=v.toUpperCase()),_.key=a.C0.ESC+v}else if(l.keyCode===32)_.key=a.C0.ESC+(l.ctrlKey?a.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let p=l.code.slice(3,4);l.shiftKey||(p=p.toLowerCase()),_.key=a.C0.ESC+p,_.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?_.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?_.key=a.C0.NUL:l.keyCode>=51&&l.keyCode<=55?_.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?_.key=a.C0.DEL:l.keyCode===219?_.key=a.C0.ESC:l.keyCode===220?_.key=a.C0.FS:l.keyCode===221&&(_.key=a.C0.GS)}return _}},482:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},s.utf32ToString=function(n,a=0,u=n.length){let l="";for(let d=a;d<u;++d){let m=n[d];m>65535?(m-=65536,l+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):l+=String.fromCharCode(m)}return l},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,a){let u=n.length;if(!u)return 0;let l=0,d=0;if(this._interim){let m=n.charCodeAt(d++);56320<=m&&m<=57343?a[l++]=1024*(this._interim-55296)+m-56320+65536:(a[l++]=this._interim,a[l++]=m),this._interim=0}for(let m=d;m<u;++m){let y=n.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=u)return this._interim=y,l;let _=n.charCodeAt(m);56320<=_&&_<=57343?a[l++]=1024*(y-55296)+_-56320+65536:(a[l++]=y,a[l++]=_)}else y!==65279&&(a[l++]=y)}return l}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,a){let u=n.length;if(!u)return 0;let l,d,m,y,_=0,c=0,f=0;if(this.interim[0]){let v=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let b,x=0;for(;(b=63&this.interim[++x])&&x<4;)S<<=6,S|=b;let w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=w-x;for(;f<E;){if(f>=u)return 0;if(b=n[f++],(192&b)!=128){f--,v=!0;break}this.interim[x++]=b,S<<=6,S|=63&b}v||(w===2?S<128?f--:a[_++]=S:w===3?S<2048||S>=55296&&S<=57343||S===65279||(a[_++]=S):S<65536||S>1114111||(a[_++]=S)),this.interim.fill(0)}let h=u-4,p=f;for(;p<u;){for(;!(!(p<h)||128&(l=n[p])||128&(d=n[p+1])||128&(m=n[p+2])||128&(y=n[p+3]));)a[_++]=l,a[_++]=d,a[_++]=m,a[_++]=y,p+=4;if(l=n[p++],l<128)a[_++]=l;else if((224&l)==192){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(c=(31&l)<<6|63&d,c<128){p--;continue}a[_++]=c}else if((240&l)==224){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,_;if(m=n[p++],(192&m)!=128){p--;continue}if(c=(15&l)<<12|(63&d)<<6|63&m,c<2048||c>=55296&&c<=57343||c===65279)continue;a[_++]=c}else if((248&l)==240){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,_;if(m=n[p++],(192&m)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,this.interim[2]=m,_;if(y=n[p++],(192&y)!=128){p--;continue}if(c=(7&l)<<18|(63&d)<<12|(63&m)<<6|63&y,c<65536||c>1114111)continue;a[_++]=c}}return _}}},225:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let a=n(1480),u=[[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]],l=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],d;s.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let m=0;m<u.length;++m)d.fill(0,u[m][0],u[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?d[m]:(function(y,_){let c,f=0,h=_.length-1;if(y<_[0][0]||y>_[h][1])return!1;for(;h>=f;)if(c=f+h>>1,y>_[c][1])f=c+1;else{if(!(y<_[c][0]))return!0;h=c-1}return!1})(m,l)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,y){let _=this.wcwidth(m),c=_===0&&y!==0;if(c){let f=a.UnicodeService.extractWidth(y);f===0?c=!1:f>_&&(_=f)}return a.UnicodeService.createPropertyValue(0,_,c)}}},5981:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let a=n(8460),u=n(844);class l extends u.Disposable{constructor(m){super(),this._action=m,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(m,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let _;for(this._isSyncWriting=!0;_=this._writeBuffer.shift();){this._action(_);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,y){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+=m.length,this._writeBuffer.push(m),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y)}_innerWrite(m=0,y=!0){let _=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],f=this._action(c,y);if(f){let p=v=>Date.now()-_>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(_,v);return void f.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(p)}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-_>=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=l},5941:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,a=/^[\da-f]+$/;function u(l,d){let m=l.toString(16),y=m.length<2?"0"+m:m;switch(d){case 4:return m[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}s.parseColor=function(l){if(!l)return;let d=l.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);let m=n.exec(d);if(m){let y=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/y*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/y*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/y*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),a.exec(d)&&[3,6,9,12].includes(d.length))){let m=d.length/3,y=[0,0,0];for(let _=0;_<3;++_){let c=parseInt(d.slice(m*_,m*_+m),16);y[_]=m===1?c<<4:m===2?c:m===3?c>>4:c>>8}return y}},s.toRgbString=function(l,d=16){let[m,y,_]=l;return`rgb:${u(m,d)}/${u(y,d)}/${u(_,d)}`}},5770:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let a=n(482),u=n(8742),l=n(5770),d=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(y,_){this._handlers[y]===void 0&&(this._handlers[y]=[]);let c=this._handlers[y];return c.push(_),{dispose:()=>{let f=c.indexOf(_);f!==-1&&c.splice(f,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(y,_){if(this.reset(),this._ident=y,this._active=this._handlers[y]||d,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(_);else this._handlerFb(this._ident,"HOOK",_)}put(y,_,c){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(y,_,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(y,_,c))}unhook(y,_=!0){if(this._active.length){let c=!1,f=this._active.length-1,h=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,c=_,h=this._stack.fallThrough,this._stack.paused=!1),!h&&c===!1){for(;f>=0&&(c=this._active[f].unhook(y),c!==!0);f--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,c;f--}for(;f>=0;f--)if(c=this._active[f].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",y);this._active=d,this._ident=0}};let m=new u.Params;m.addParam(0),s.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=m,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():m,this._data="",this._hitLimit=!1}put(y,_,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(y,_,c),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let _=!1;if(this._hitLimit)_=!1;else if(y&&(_=this._handler(this._data,this._params),_ instanceof Promise))return _.then((c=>(this._params=m,this._data="",this._hitLimit=!1,c)));return this._params=m,this._data="",this._hitLimit=!1,_}}},2015:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let a=n(844),u=n(8742),l=n(6242),d=n(6351);class m{constructor(f){this.table=new Uint8Array(f)}setDefault(f,h){this.table.fill(f<<4|h)}add(f,h,p,v){this.table[h<<8|f]=p<<4|v}addMany(f,h,p,v){for(let S=0;S<f.length;S++)this.table[h<<8|f[S]]=p<<4|v}}s.TransitionTable=m;let y=160;s.VT500_TRANSITION_TABLE=(function(){let c=new m(4095),f=Array.apply(null,Array(256)).map(((x,w)=>w)),h=(x,w)=>f.slice(x,w),p=h(32,127),v=h(0,24);v.push(25),v.push.apply(v,h(28,32));let S=h(0,14),b;for(b in c.setDefault(1,0),c.addMany(p,0,2,0),S)c.addMany([24,26,153,154],b,3,0),c.addMany(h(128,144),b,3,0),c.addMany(h(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(v,0,3,0),c.addMany(v,1,3,1),c.add(127,1,0,1),c.addMany(v,8,0,8),c.addMany(v,3,3,3),c.add(127,3,0,3),c.addMany(v,4,3,4),c.add(127,4,0,4),c.addMany(v,6,3,6),c.addMany(v,5,3,5),c.add(127,5,0,5),c.addMany(v,2,3,2),c.add(127,2,0,2),c.add(93,1,4,8),c.addMany(p,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(h(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(p,7,0,7),c.addMany(v,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(h(64,127),3,7,0),c.addMany(h(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(h(48,60),4,8,4),c.addMany(h(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(h(32,64),6,0,6),c.add(127,6,0,6),c.addMany(h(64,127),6,0,0),c.addMany(h(32,48),3,9,5),c.addMany(h(32,48),5,9,5),c.addMany(h(48,64),5,0,6),c.addMany(h(64,127),5,7,0),c.addMany(h(32,48),4,9,5),c.addMany(h(32,48),1,9,2),c.addMany(h(32,48),2,9,2),c.addMany(h(48,127),2,10,0),c.addMany(h(48,80),1,10,0),c.addMany(h(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(h(96,127),1,10,0),c.add(80,1,11,9),c.addMany(v,9,0,9),c.add(127,9,0,9),c.addMany(h(28,32),9,0,9),c.addMany(h(32,48),9,9,12),c.addMany(h(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(v,11,0,11),c.addMany(h(32,128),11,0,11),c.addMany(h(28,32),11,0,11),c.addMany(v,10,0,10),c.add(127,10,0,10),c.addMany(h(28,32),10,0,10),c.addMany(h(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(h(32,48),10,9,12),c.addMany(v,12,0,12),c.add(127,12,0,12),c.addMany(h(28,32),12,0,12),c.addMany(h(32,48),12,9,12),c.addMany(h(48,64),12,0,11),c.addMany(h(64,127),12,12,13),c.addMany(h(64,127),10,12,13),c.addMany(h(64,127),9,12,13),c.addMany(v,13,13,13),c.addMany(p,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(y,0,2,0),c.add(y,8,5,8),c.add(y,6,0,6),c.add(y,11,0,11),c.add(y,13,13,13),c})();class _ extends a.Disposable{constructor(f=s.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(h,p,v)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,p)=>{},this._escHandlerFb=h=>{},this._errorHandlerFb=h=>h,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 l.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(f,h=[64,126]){let p=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(p=f.prefix.charCodeAt(0),p&&60>p||p>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<f.intermediates.length;++S){let b=f.intermediates.charCodeAt(S);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");p<<=8,p|=b}}if(f.final.length!==1)throw new Error("final must be a single byte");let v=f.final.charCodeAt(0);if(h[0]>v||v>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return p<<=8,p|=v,p}identToString(f){let h=[];for(;f;)h.push(String.fromCharCode(255&f)),f>>=8;return h.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,h){let p=this._identifier(f,[48,126]);this._escHandlers[p]===void 0&&(this._escHandlers[p]=[]);let v=this._escHandlers[p];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,h){this._executeHandlers[f.charCodeAt(0)]=h}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,h){let p=this._identifier(f);this._csiHandlers[p]===void 0&&(this._csiHandlers[p]=[]);let v=this._csiHandlers[p];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,h){return this._dcsParser.registerHandler(this._identifier(f),h)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,h){return this._oscParser.registerHandler(f,h)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,h,p,v,S){this._parseStack.state=f,this._parseStack.handlers=h,this._parseStack.handlerPos=p,this._parseStack.transition=v,this._parseStack.chunkPos=S}parse(f,h,p){let v,S=0,b=0,x=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,x=this._parseStack.chunkPos+1;else{if(p===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let w=this._parseStack.handlers,E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(p===!1&&E>-1){for(;E>=0&&(v=w[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(p===!1&&E>-1){for(;E>=0&&(v=w[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(S=f[this._parseStack.chunkPos],v=this._dcsParser.unhook(S!==24&&S!==26,p),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=f[this._parseStack.chunkPos],v=this._oscParser.end(S!==24&&S!==26,p),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,x=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let w=x;w<h;++w){switch(S=f[w],b=this._transitions.table[this.currentState<<8|(S<160?S:y)],b>>4){case 2:for(let A=w+1;;++A){if(A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:w,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let E=this._csiHandlers[this._collect<<8|S],B=E?E.length-1:-1;for(;B>=0&&(v=E[B](this._params),v!==!0);B--)if(v instanceof Promise)return this._preserveStack(3,E,B,b,w),v;B<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++w<h&&(S=f[w])>47&&S<60);w--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:let P=this._escHandlers[this._collect<<8|S],W=P?P.length-1:-1;for(;W>=0&&(v=P[W](),v!==!0);W--)if(v instanceof Promise)return this._preserveStack(4,P,W,b,w),v;W<0&&this._escHandlerFb(this._collect<<8|S),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|S,this._params);break;case 13:for(let A=w+1;;++A)if(A>=h||(S=f[A])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(f,w,A),w=A-1;break}break;case 14:if(v=this._dcsParser.unhook(S!==24&&S!==26),v)return this._preserveStack(6,[],0,b,w),v;S===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=w+1;;A++)if(A>=h||(S=f[A])<32||S>127&&S<y){this._oscParser.put(f,w,A),w=A-1;break}break;case 6:if(v=this._oscParser.end(S!==24&&S!==26),v)return this._preserveStack(5,[],0,b,w),v;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}s.EscapeSequenceParser=_},6242:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let a=n(5770),u=n(482),l=[];s.OscParser=class{constructor(){this._state=0,this._active=l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,m){this._handlers[d]===void 0&&(this._handlers[d]=[]);let y=this._handlers[d];return y.push(m),{dispose:()=>{let _=y.indexOf(m);_!==-1&&y.splice(_,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,m,y){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(d,m,y);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(d,m,y))}start(){this.reset(),this._state=1}put(d,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){let _=d[m++];if(_===59){this._state=2,this._start();break}if(_<48||57<_)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+_-48}this._state===2&&y-m>0&&this._put(d,m,y)}}end(d,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,_=this._active.length-1,c=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,y=m,c=this._stack.fallThrough,this._stack.paused=!1),!c&&y===!1){for(;_>=0&&(y=this._active[_].end(d),y!==!0);_--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,y;_--}for(;_>=0;_--)if(y=this._active[_].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",d);this._active=l,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,m,y){this._hitLimit||(this._data+=(0,u.utf32ToString)(d,m,y),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let m=!1;if(this._hitLimit)m=!1;else if(d&&(m=this._handler(this._data),m instanceof Promise))return m.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,m}}},8742:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let n=2147483647;class a{static fromArray(l){let d=new a;if(!l.length)return d;for(let m=Array.isArray(l[0])?1:0;m<l.length;++m){let y=l[m];if(Array.isArray(y))for(let _=0;_<y.length;++_)d.addSubParam(y[_]);else d.addParam(y)}return d}constructor(l=32,d=32){if(this.maxLength=l,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let l=new a(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l}toArray(){let l=[];for(let d=0;d<this.length;++d){l.push(this.params[d]);let m=this._subParamsIdx[d]>>8,y=255&this._subParamsIdx[d];y-m>0&&l.push(Array.prototype.slice.call(this._subParams,m,y))}return l}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>n?n:l}}addSubParam(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>n?n:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){let d=this._subParamsIdx[l]>>8,m=255&this._subParamsIdx[l];return m-d>0?this._subParams.subarray(d,m):null}getSubParamsAll(){let l={};for(let d=0;d<this.length;++d){let m=this._subParamsIdx[d]>>8,y=255&this._subParamsIdx[d];y-m>0&&(l[d]=this._subParams.slice(m,y))}return l}addDigit(l){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let m=this._digitIsSub?this._subParams:this.params,y=m[d-1];m[d-1]=~y?Math.min(10*y+l,n):l}}s.Params=a},5741:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,a){let u={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(u),a.dispose=()=>this._wrappedAddonDispose(u),a.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let a=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===n){a=u;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(a,1)}}},8771:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let a=n(3785),u=n(511);s.BufferApiView=class{constructor(l,d){this._buffer=l,this.type=d}init(l){return this._buffer=l,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(l){let d=this._buffer.lines.get(l);if(d)return new a.BufferLineApiView(d)}getNullCell(){return new u.CellData}}},3785:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let a=n(511);s.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,l){if(!(u<0||u>=this._line.length))return l?(this._line.loadCell(u,l),l):this._line.loadCell(u,new a.CellData)}translateToString(u,l,d){return this._line.translateToString(u,l,d)}}},8285:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let a=n(8771),u=n(8460),l=n(844);class d extends l.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new u.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)}}s.BufferNamespaceApi=d},7975:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,a){return this._core.registerCsiHandler(n,(u=>a(u.toArray())))}addCsiHandler(n,a){return this.registerCsiHandler(n,a)}registerDcsHandler(n,a){return this._core.registerDcsHandler(n,((u,l)=>a(u,l.toArray())))}addDcsHandler(n,a){return this.registerDcsHandler(n,a)}registerEscHandler(n,a){return this._core.registerEscHandler(n,a)}addEscHandler(n,a){return this.registerEscHandler(n,a)}registerOscHandler(n,a){return this._core.registerOscHandler(n,a)}addOscHandler(n,a){return this.registerOscHandler(n,a)}}},7090:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(o,s,n){var a=this&&this.__decorate||function(c,f,h,p){var v,S=arguments.length,b=S<3?f:p===null?p=Object.getOwnPropertyDescriptor(f,h):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,f,h,p);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(b=(S<3?v(b):S>3?v(f,h,b):v(f,h))||b);return S>3&&b&&Object.defineProperty(f,h,b),b},u=this&&this.__param||function(c,f){return function(h,p){f(h,p,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let l=n(8460),d=n(844),m=n(5295),y=n(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let _=s.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(c){super(),this.isUserScrolling=!1,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new l.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 m.BufferSet(c,this))}resize(c,f){this.cols=c,this.rows=f,this.buffers.resize(c,f),this._onResize.fire({cols:c,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,f=!1){let h=this.buffer,p;p=this._cachedBlankLine,p&&p.length===this.cols&&p.getFg(0)===c.fg&&p.getBg(0)===c.bg||(p=h.getBlankLine(c,f),this._cachedBlankLine=p),p.isWrapped=f;let v=h.ybase+h.scrollTop,S=h.ybase+h.scrollBottom;if(h.scrollTop===0){let b=h.lines.isFull;S===h.lines.length-1?b?h.lines.recycle().copyFrom(p):h.lines.push(p.clone()):h.lines.splice(S+1,0,p.clone()),b?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{let b=S-v+1;h.lines.shiftElements(v+1,b-1,-1),h.lines.set(S,p.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(c,f,h){let p=this.buffer;if(c<0){if(p.ydisp===0)return;this.isUserScrolling=!0}else c+p.ydisp>=p.ybase&&(this.isUserScrolling=!1);let v=p.ydisp;p.ydisp=Math.max(Math.min(p.ydisp+c,p.ybase),0),v!==p.ydisp&&(f||this._onScroll.fire(p.ydisp))}};s.BufferService=_=a([u(0,y.IOptionsService)],_)},7994:(o,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(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,a){this._charsets[n]=a,this.glevel===n&&(this.charset=a)}}},1753:function(o,s,n){var a=this&&this.__decorate||function(p,v,S,b){var x,w=arguments.length,E=w<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(p,v,S,b);else for(var B=p.length-1;B>=0;B--)(x=p[B])&&(E=(w<3?x(E):w>3?x(v,S,E):x(v,S))||E);return w>3&&E&&Object.defineProperty(v,S,E),E},u=this&&this.__param||function(p,v){return function(S,b){v(S,b,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let l=n(2585),d=n(8460),m=n(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:p=>p.button!==4&&p.action===1&&(p.ctrl=!1,p.alt=!1,p.shift=!1,!0)},VT200:{events:19,restrict:p=>p.action!==32},DRAG:{events:23,restrict:p=>p.action!==32||p.button!==3},ANY:{events:31,restrict:p=>!0}};function _(p,v){let S=(p.ctrl?16:0)|(p.shift?4:0)|(p.alt?8:0);return p.button===4?(S|=64,S|=p.action):(S|=3&p.button,4&p.button&&(S|=64),8&p.button&&(S|=128),p.action===32?S|=32:p.action!==0||v||(S|=3)),S}let c=String.fromCharCode,f={DEFAULT:p=>{let v=[_(p,!1)+32,p.col+32,p.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${c(v[0])}${c(v[1])}${c(v[2])}`},SGR:p=>{let v=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${_(p,!0)};${p.col};${p.row}${v}`},SGR_PIXELS:p=>{let v=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${_(p,!0)};${p.x};${p.y}${v}`}},h=s.CoreMouseService=class extends m.Disposable{constructor(p,v){super(),this._bufferService=p,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let S of Object.keys(y))this.addProtocol(S,y[S]);for(let S of Object.keys(f))this.addEncoding(S,f[S]);this.reset()}addProtocol(p,v){this._protocols[p]=v}addEncoding(p,v){this._encodings[p]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(p){if(!this._protocols[p])throw new Error(`unknown protocol "${p}"`);this._activeProtocol=p,this._onProtocolChange.fire(this._protocols[p].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(p){if(!this._encodings[p])throw new Error(`unknown encoding "${p}"`);this._activeEncoding=p}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(p){if(p.col<0||p.col>=this._bufferService.cols||p.row<0||p.row>=this._bufferService.rows||p.button===4&&p.action===32||p.button===3&&p.action!==32||p.button!==4&&(p.action===2||p.action===3)||(p.col++,p.row++,p.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,p,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(p))return!1;let v=this._encodings[this._activeEncoding](p);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=p,!0}explainEvents(p){return{down:!!(1&p),up:!!(2&p),drag:!!(4&p),move:!!(8&p),wheel:!!(16&p)}}_equalEvents(p,v,S){if(S){if(p.x!==v.x||p.y!==v.y)return!1}else if(p.col!==v.col||p.row!==v.row)return!1;return p.button===v.button&&p.action===v.action&&p.ctrl===v.ctrl&&p.alt===v.alt&&p.shift===v.shift}};s.CoreMouseService=h=a([u(0,l.IBufferService),u(1,l.ICoreService)],h)},6975:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let l=n(1439),d=n(8460),m=n(844),y=n(2585),_=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),f=s.CoreService=class extends m.Disposable{constructor(h,p,v){super(),this._bufferService=h,this._logService=p,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(c)}reset(){this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(c)}triggerDataEvent(h,p=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;p&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),p&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((S=>S.charCodeAt(0))))),this._onData.fire(h)}triggerBinaryEvent(h){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${h}"`,(()=>h.split("").map((p=>p.charCodeAt(0))))),this._onBinary.fire(h))}};s.CoreService=f=a([u(0,y.IBufferService),u(1,y.ILogService),u(2,y.IOptionsService)],f)},9074:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let a=n(8055),u=n(8460),l=n(844),d=n(6106),m=0,y=0;class _ extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((h=>h?.marker.line)),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;let p=new c(h);if(p){let v=p.marker.onDispose((()=>p.dispose()));p.onDispose((()=>{p&&(this._decorations.delete(p)&&this._onDecorationRemoved.fire(p),v.dispose())})),this._decorations.insert(p),this._onDecorationRegistered.fire(p)}return p}reset(){for(let h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,p,v){let S=0,b=0;for(let x of this._decorations.getKeyIterator(p))S=x.options.x??0,b=S+(x.options.width??1),h>=S&&h<b&&(!v||(x.options.layer??"bottom")===v)&&(yield x)}forEachDecorationAtCell(h,p,v,S){this._decorations.forEachByKey(p,(b=>{m=b.options.x??0,y=m+(b.options.width??1),h>=m&&h<y&&(!v||(b.options.layer??"bottom")===v)&&S(b)}))}}s.DecorationService=_;class c extends l.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(h){super(),this.options=h,this.onRenderEmitter=this.register(new u.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=h.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let a=n(2585),u=n(8343);class l{constructor(...m){this._entries=new Map;for(let[y,_]of m)this.set(y,_)}set(m,y){let _=this._entries.get(m);return this._entries.set(m,y),_}forEach(m){for(let[y,_]of this._entries.entries())m(y,_)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}s.ServiceCollection=l,s.InstantiationService=class{constructor(){this._services=new l,this._services.set(a.IInstantiationService,this)}setService(d,m){this._services.set(d,m)}getService(d){return this._services.get(d)}createInstance(d,...m){let y=(0,u.getServiceDependencies)(d).sort(((f,h)=>f.index-h.index)),_=[];for(let f of y){let h=this._services.get(f.id);if(!h)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${f.id}.`);_.push(h)}let c=y.length>0?y[0].index:m.length;if(m.length!==c)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${c+1} conflicts with ${m.length} static arguments`);return new d(...m,..._)}}},7866:function(o,s,n){var a=this&&this.__decorate||function(c,f,h,p){var v,S=arguments.length,b=S<3?f:p===null?p=Object.getOwnPropertyDescriptor(f,h):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,f,h,p);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(b=(S<3?v(b):S>3?v(f,h,b):v(f,h))||b);return S>3&&b&&Object.defineProperty(f,h,b),b},u=this&&this.__param||function(c,f){return function(h,p){f(h,p,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let l=n(844),d=n(2585),m={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF},y,_=s.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let f=0;f<c.length;f++)typeof c[f]=="function"&&(c[f]=c[f]())}_log(c,f,h){this._evalLazyOptionalParams(h),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...h)}trace(c,...f){this._logLevel<=d.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,f)}debug(c,...f){this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,f)}info(c,...f){this._logLevel<=d.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,f)}warn(c,...f){this._logLevel<=d.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,f)}error(c,...f){this._logLevel<=d.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,f)}};s.LogService=_=a([u(0,d.IOptionsService)],_),s.setTraceLogger=function(c){y=c},s.traceCall=function(c,f,h){if(typeof h.value!="function")throw new Error("not supported");let p=h.value;h.value=function(...v){if(y.logLevel!==d.LogLevelEnum.TRACE)return p.apply(this,v);y.trace(`GlyphRenderer#${p.name}(${v.map((b=>JSON.stringify(b))).join(", ")})`);let S=p.apply(this,v);return y.trace(`GlyphRenderer#${p.name} return`,S),S}}},7302:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let a=n(8460),u=n(844),l=n(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:l.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let d=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends u.Disposable{constructor(_){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let f in _)if(f in c)try{let h=_[f];c[f]=this._sanitizeAndValidateOption(f,h)}catch(h){console.error(h)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,u.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(_,c){return this.onOptionChange((f=>{f===_&&c(this.rawOptions[_])}))}onMultipleOptionChange(_,c){return this.onOptionChange((f=>{_.indexOf(f)!==-1&&c()}))}_setupOptions(){let _=f=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},c=(f,h)=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);h=this._sanitizeAndValidateOption(f,h),this.rawOptions[f]!==h&&(this.rawOptions[f]=h,this._onOptionChange.fire(f))};for(let f in this.rawOptions){let h={get:_.bind(this,f),set:c.bind(this,f)};Object.defineProperty(this.options,f,h)}}_sanitizeAndValidateOption(_,c){switch(_){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[_]),!(function(f){return f==="block"||f==="underline"||f==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${_}`);break;case"wordSeparator":c||(c=s.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=d.includes(c)?c:s.DEFAULT_OPTIONS[_];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${_} 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(`${_} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${_} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}s.OptionsService=m},2660:function(o,s,n){var a=this&&this.__decorate||function(m,y,_,c){var f,h=arguments.length,p=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,_):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(m,y,_,c);else for(var v=m.length-1;v>=0;v--)(f=m[v])&&(p=(h<3?f(p):h>3?f(y,_,p):f(y,_))||p);return h>3&&p&&Object.defineProperty(y,_,p),p},u=this&&this.__param||function(m,y){return function(_,c){y(_,c,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let l=n(2585),d=s.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){let y=this._bufferService.buffer;if(m.id===void 0){let v=y.addMarker(y.ybase+y.y),S={data:m,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(S,v))),this._dataByLinkId.set(S.id,S),S.id}let _=m,c=this._getEntryIdKey(_),f=this._entriesWithId.get(c);if(f)return this.addLineToLink(f.id,y.ybase+y.y),f.id;let h=y.addMarker(y.ybase+y.y),p={id:this._nextId++,key:this._getEntryIdKey(_),data:_,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(p,h))),this._entriesWithId.set(p.key,p),this._dataByLinkId.set(p.id,p),p.id}addLineToLink(m,y){let _=this._dataByLinkId.get(m);if(_&&_.lines.every((c=>c.line!==y))){let c=this._bufferService.buffer.addMarker(y);_.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(_,c)))}}getLinkData(m){return this._dataByLinkId.get(m)?.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){let _=m.lines.indexOf(y);_!==-1&&(m.lines.splice(_,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};s.OscLinkService=d=a([u(0,l.IBufferService)],d)},8343:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let n="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(u){return u[a]||[]},s.createDecorator=function(u){if(s.serviceRegistry.has(u))return s.serviceRegistry.get(u);let l=function(d,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,c,f){c[n]===c?c[a].push({id:_,index:f}):(c[a]=[{id:_,index:f}],c[n]=c)})(l,d,y)};return l.toString=()=>u,s.serviceRegistry.set(u,l),l}},2585:(o,s,n)=>{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 a=n(8343);var u;s.IBufferService=(0,a.createDecorator)("BufferService"),s.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),s.ICoreService=(0,a.createDecorator)("CoreService"),s.ICharsetService=(0,a.createDecorator)("CharsetService"),s.IInstantiationService=(0,a.createDecorator)("InstantiationService"),(function(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.OFF=5]="OFF"})(u||(s.LogLevelEnum=u={})),s.ILogService=(0,a.createDecorator)("LogService"),s.IOptionsService=(0,a.createDecorator)("OptionsService"),s.IOscLinkService=(0,a.createDecorator)("OscLinkService"),s.IUnicodeService=(0,a.createDecorator)("UnicodeService"),s.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let a=n(8460),u=n(225);class l{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,y,_=!1){return(16777215&m)<<3|(3&y)<<1|(_?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let m=new u.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let y=0,_=0,c=m.length;for(let f=0;f<c;++f){let h=m.charCodeAt(f);if(55296<=h&&h<=56319){if(++f>=c)return y+this.wcwidth(h);let S=m.charCodeAt(f);56320<=S&&S<=57343?h=1024*(h-55296)+S-56320+65536:y+=this.wcwidth(S)}let p=this.charProperties(h,_),v=l.extractWidth(p);l.extractShouldJoin(p)&&(v-=l.extractWidth(_)),y+=v,_=p}return y}charProperties(m,y){return this._activeProvider.charProperties(m,y)}}s.UnicodeService=l}},t={};function r(o){var s=t[o];if(s!==void 0)return s.exports;var n=t[o]={exports:{}};return e[o].call(n.exports,n,n.exports,r),n.exports}var i={};return(()=>{var o=i;Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;let s=r(9042),n=r(3236),a=r(844),u=r(5741),l=r(8285),d=r(7975),m=r(7090),y=["cols","rows"];class _ extends a.Disposable{constructor(f){super(),this._core=this.register(new n.Terminal(f)),this._addonManager=this.register(new u.AddonManager),this._publicOptions={...this._core.options};let h=v=>this._core.options[v],p=(v,S)=>{this._checkReadonlyOptions(v),this._core.options[v]=S};for(let v in this._core.options){let S={get:h.bind(this,v),set:p.bind(this,v)};Object.defineProperty(this._publicOptions,v,S)}}_checkReadonlyOptions(f){if(y.includes(f))throw new Error(`Option "${f}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.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 l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let f=this._core.coreService.decPrivateModes,h="none";switch(this._core.coreMouseService.activeProtocol){case"X10":h="x10";break;case"VT200":h="vt200";break;case"DRAG":h="drag";break;case"ANY":h="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(let h in f)this._publicOptions[h]=f[h]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,h=!0){this._core.input(f,h)}resize(f,h){this._verifyIntegers(f,h),this._core.resize(f,h)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,h,p){this._verifyIntegers(f,h,p),this._core.select(f,h,p)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,h){this._verifyIntegers(f,h),this._core.selectLines(f,h)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,h){this._core.write(f,h)}writeln(f,h){this._core.write(f),this._core.write(`\r
9
+ `,h)}paste(f){this._core.paste(f)}refresh(f,h){this._verifyIntegers(f,h),this._core.refresh(f,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return s}_verifyIntegers(...f){for(let h of f)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(let h of f)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}o.Terminal=_})(),i})()))});var Pa=Ma((hs,Tn)=>{(function(e,t){typeof hs=="object"&&typeof Tn=="object"?Tn.exports=t():typeof define=="function"&&define.amd?define([],t):typeof hs=="object"?hs.FitAddon=t():e.FitAddon=t()})(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(r){this._terminal=r}dispose(){}fit(){let r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;let i=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(i._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let r=this._terminal._core,i=r._renderService.dimensions;if(i.css.cell.width===0||i.css.cell.height===0)return;let o=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),l=n-(parseInt(u.getPropertyValue("padding-top"))+parseInt(u.getPropertyValue("padding-bottom"))),d=a-(parseInt(u.getPropertyValue("padding-right"))+parseInt(u.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(d/i.css.cell.width)),rows:Math.max(1,Math.floor(l/i.css.cell.height))}}}})(),e})()))});var Sh=Ra(Da(),1),Ch=Ra(Pa(),1);var du=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ba.isErrorNoTelemetry(e)?new Ba(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)}},du=new hu;function Tn(e){uu(e)||du.onUnexpectedError(e)}var An="Canceled";function uu(e){return e instanceof fu?!0:e instanceof Error&&e.name===An&&e.message===An}var fu=class extends Error{constructor(){super(An),this.name=this.message}},Pa=class Dn extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Dn)return t;let r=new Dn;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function pu(e,t,r=0,i=e.length){let o=r,s=i;for(;o<s;){let n=Math.floor((o+s)/2);t(e[n])?o=n+1:s=n}return o-1}var _u=class qa{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(qa.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=pu(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};_u.assertInvariants=!1;var Pn;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function o(s){return s===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Pn||(Pn={}));function mu(e,t){return(r,i)=>t(e(r),e(i))}var gu=(e,t)=>e-t,Ba=class Bn{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new Bn(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new Bn(r=>this.iterate(i=>r(t(i))))}some(t){let r=!1;return this.iterate(i=>(r=t(i),!r)),r}findFirst(t){let r;return this.iterate(i=>t(i)?(r=i,!1):!0),r}findLast(t){let r;return this.iterate(i=>(t(i)&&(r=i),!0)),r}findLastMaxBy(t){let r,i=!0;return this.iterate(o=>((i||Pn.isGreaterThan(t(o,r)))&&(i=!1,r=o),!0)),r}};Ba.empty=new Ba(e=>{});function vu(e,t){let r=Object.create(null);for(let i of e){let o=t(i),s=r[o];s||(s=r[o]=[]),s.push(i)}return r}var Oa,Ia,vv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Oa]="SetWithKey";for(let r of e)this.add(r)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(r=>e.call(t,r,r,this))}[(Ia=Symbol.iterator,Oa=Symbol.toStringTag,Ia)](){return this.values()}},bu=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function wu(e,t){let r=this,i=!1,o;return function(){if(i)return o;if(i=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var On;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*o(b){yield b}e.single=o;function s(b){return t(b)?b:o(b)}e.wrap=s;function n(b){return b||r}e.from=n;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function u(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=u;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let w=0;for(let E of b)if(x(E,w++))return!0;return!1}e.some=d;function m(b,x){for(let w of b)if(x(w))return w}e.find=m;function*y(b,x){for(let w of b)x(w)&&(yield w)}e.filter=y;function*_(b,x){let w=0;for(let E of b)yield x(E,w++)}e.map=_;function*c(b,x){let w=0;for(let E of b)yield*x(E,w++)}e.flatMap=c;function*f(...b){for(let x of b)yield*x}e.concat=f;function h(b,x,w){let E=w;for(let B of b)E=x(E,B);return E}e.reduce=h;function*p(b,x,w=b.length){for(x<0&&(x+=b.length),w<0?w+=b.length:w>b.length&&(w=b.length);x<w;x++)yield b[x]}e.slice=p;function g(b,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,b];let E=b[Symbol.iterator]();for(let B=0;B<x;B++){let P=E.next();if(P.done)return[w,e.empty()];w.push(P.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=g;async function S(b){let x=[];for await(let w of b)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(On||(On={}));var yu=!1,Ur=null,Su=class Ka{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:Ka.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let i=this.getDisposableData(t);i.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let i=r.get(t);if(i)return i;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let i;if(r)i=r;else{let u=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,u).isSingleton);if(l.length===0)return;let d=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&d.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(u){function l(m,y){for(;m.length>0&&y.some(_=>typeof _=="string"?_===m[0]:m[0].match(_));)m.shift()}let d=u.source.split(`
14
- `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let s=new bu;for(let u of i){let l=o(u);for(let d=0;d<=l.length;d++)s.add(l.slice(0,d).join(`
15
- `),u)}i.sort(mu(u=>u.idx,gu));let n="",a=0;for(let u of i.slice(0,t)){a++;let l=o(u),d=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${s.get(l.slice(0,m+1).join(`
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)}},uu=new du;function Mn(e){fu(e)||uu.onUnexpectedError(e)}var Dn="Canceled";function fu(e){return e instanceof pu?!0:e instanceof Error&&e.name===Dn&&e.message===Dn}var pu=class extends Error{constructor(){super(Dn),this.name=this.message}},Ba=class Pn extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Pn)return t;let r=new Pn;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function _u(e,t,r=0,i=e.length){let o=r,s=i;for(;o<s;){let n=Math.floor((o+s)/2);t(e[n])?o=n+1:s=n}return o-1}var mu=class Ka{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Ka.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=_u(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};mu.assertInvariants=!1;var Bn;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function o(s){return s===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Bn||(Bn={}));function gu(e,t){return(r,i)=>t(e(r),e(i))}var vu=(e,t)=>e-t,Oa=class On{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new On(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new On(r=>this.iterate(i=>r(t(i))))}some(t){let r=!1;return this.iterate(i=>(r=t(i),!r)),r}findFirst(t){let r;return this.iterate(i=>t(i)?(r=i,!1):!0),r}findLast(t){let r;return this.iterate(i=>(t(i)&&(r=i),!0)),r}findLastMaxBy(t){let r,i=!0;return this.iterate(o=>((i||Bn.isGreaterThan(t(o,r)))&&(i=!1,r=o),!0)),r}};Oa.empty=new Oa(e=>{});function bu(e,t){let r=Object.create(null);for(let i of e){let o=t(i),s=r[o];s||(s=r[o]=[]),s.push(i)}return r}var Ia,Na,bv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Ia]="SetWithKey";for(let r of e)this.add(r)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(r=>e.call(t,r,r,this))}[(Na=Symbol.iterator,Ia=Symbol.toStringTag,Na)](){return this.values()}},wu=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function yu(e,t){let r=this,i=!1,o;return function(){if(i)return o;if(i=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var In;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*o(b){yield b}e.single=o;function s(b){return t(b)?b:o(b)}e.wrap=s;function n(b){return b||r}e.from=n;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function u(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=u;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let w=0;for(let E of b)if(x(E,w++))return!0;return!1}e.some=d;function m(b,x){for(let w of b)if(x(w))return w}e.find=m;function*y(b,x){for(let w of b)x(w)&&(yield w)}e.filter=y;function*_(b,x){let w=0;for(let E of b)yield x(E,w++)}e.map=_;function*c(b,x){let w=0;for(let E of b)yield*x(E,w++)}e.flatMap=c;function*f(...b){for(let x of b)yield*x}e.concat=f;function h(b,x,w){let E=w;for(let B of b)E=x(E,B);return E}e.reduce=h;function*p(b,x,w=b.length){for(x<0&&(x+=b.length),w<0?w+=b.length:w>b.length&&(w=b.length);x<w;x++)yield b[x]}e.slice=p;function v(b,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,b];let E=b[Symbol.iterator]();for(let B=0;B<x;B++){let P=E.next();if(P.done)return[w,e.empty()];w.push(P.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(b){let x=[];for await(let w of b)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(In||(In={}));var Su=!1,Ur=null,Cu=class Ga{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:Ga.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let i=this.getDisposableData(t);i.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let i=r.get(t);if(i)return i;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let i;if(r)i=r;else{let u=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,u).isSingleton);if(l.length===0)return;let d=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&d.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(u){function l(m,y){for(;m.length>0&&y.some(_=>typeof _=="string"?_===m[0]:m[0].match(_));)m.shift()}let d=u.source.split(`
14
+ `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let s=new wu;for(let u of i){let l=o(u);for(let d=0;d<=l.length;d++)s.add(l.slice(0,d).join(`
15
+ `),u)}i.sort(gu(u=>u.idx,vu));let n="",a=0;for(let u of i.slice(0,t)){a++;let l=o(u),d=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${s.get(l.slice(0,m+1).join(`
16
16
  `)).size}/${i.length} leaks) at ${y}`;let _=s.get(l.slice(0,m).join(`
17
- `)),c=vu([..._].map(f=>o(f)[m]),f=>f);delete c[l[m]];for(let[f,h]of Object.entries(c))d.unshift(` - stacktraces of ${h.length} other leaks continue with ${f}`);d.unshift(y)}n+=`
17
+ `)),c=bu([..._].map(f=>o(f)[m]),f=>f);delete c[l[m]];for(let[f,h]of Object.entries(c))d.unshift(` - stacktraces of ${h.length} other leaks continue with ${f}`);d.unshift(y)}n+=`
18
18
 
19
19
 
20
20
  ==================== Leaking disposable ${a}/${i.length}: ${u.value.constructor.name} ====================
@@ -27,20 +27,20 @@ ${d.join(`
27
27
 
28
28
  ... and ${i.length-t} more leaking disposables
29
29
 
30
- `),{leaks:i,details:n}}};Su.idx=0;function Cu(e){Ur=e}if(yu){let e="__is_disposable_tracked__";Cu(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==It.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==It.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function vs(e){return Ur?.trackDisposable(e),e}function bs(e){Ur?.markAsDisposed(e)}function Ci(e,t){Ur?.setParent(e,t)}function xu(e,t){if(Ur)for(let r of e)Ur.setParent(r,t)}function Si(e){if(On.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}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 Ga(...e){let t=$r(()=>Si(e));return xu(e,t),t}function $r(e){let t=vs({dispose:wu(()=>{bs(t),e()})});return t}var Va=class Ya{constructor(){this._toDispose=new Set,this._isDisposed=!1,vs(this)}dispose(){this._isDisposed||(bs(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Si(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 Ci(t,this),this._isDisposed?Ya.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),Ci(t,null))}};Va.DISABLE_DISPOSED_WARNING=!1;var zn=Va,It=class{constructor(){this._store=new zn,vs(this),Ci(this._store,this)}dispose(){bs(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};It.None=Object.freeze({dispose(){}});var ms=class{constructor(){this._isDisposed=!1,vs(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ci(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,bs(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ci(e,null),e}},Na=class In{constructor(t){this.element=t,this.next=In.Undefined,this.prev=In.Undefined}};Na.Undefined=new Na(void 0);var ku=globalThis.performance&&typeof globalThis.performance.now=="function",Eu=class Ja{static create(t){return new Ja(t)}constructor(t){this._now=ku&&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}},Lu=!1,Ha=!1,Tu=!1,gs;(e=>{e.None=()=>It.None;function t(O){if(Tu){let{onDidAddListener:R}=O,F=Fn.create(),I=0;O.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),F.print()),R?.()}}}function r(O,R){return y(O,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(O){return(R,F=null,I)=>{let C=!1,L;return L=O(T=>{if(!C)return L?L.dispose():C=!0,R.call(F,T)},null,I),C&&L.dispose(),L}}e.once=i;function o(O,R,F){return d((I,C=null,L)=>O(T=>I.call(C,R(T)),null,L),F)}e.map=o;function s(O,R,F){return d((I,C=null,L)=>O(T=>{R(T),I.call(C,T)},null,L),F)}e.forEach=s;function n(O,R,F){return d((I,C=null,L)=>O(T=>R(T)&&I.call(C,T),null,L),F)}e.filter=n;function a(O){return O}e.signal=a;function u(...O){return(R,F=null,I)=>{let C=Ga(...O.map(L=>L(T=>R.call(F,T))));return m(C,I)}}e.any=u;function l(O,R,F,I){let C=F;return o(O,L=>(C=R(C,L),C),I)}e.reduce=l;function d(O,R){let F,I={onWillAddFirstListener(){F=O(C.fire,C)},onDidRemoveLastListener(){F?.dispose()}};R||t(I);let C=new Ot(I);return R?.add(C),C.event}function m(O,R){return R instanceof Array?R.push(O):R&&R.add(O),O}function y(O,R,F=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=O(j=>{$++,N=R(N,j),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||$>1)&&k.fire(q),$=0},typeof F=="number"?(clearTimeout(G),G=setTimeout(Y,F)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Ot(H);return T?.add(k),k.event}e.debounce=y;function _(O,R=0,F){return e.debounce(O,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,F)}e.accumulate=_;function c(O,R=(I,C)=>I===C,F){let I=!0,C;return n(O,L=>{let T=I||!R(L,C);return I=!1,C=L,T},F)}e.latch=c;function f(O,R,F){return[e.filter(O,R,F),e.filter(O,I=>!R(I),F)]}e.split=f;function h(O,R=!1,F=[],I){let C=F.slice(),L=O(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Ot({onWillAddFirstListener(){L||(L=O(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(R?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function p(O,R){return(F,I,C)=>{let L=R(new S);return O(function(T){let D=L.evaluate(T);D!==g&&F.call(I,D)},void 0,C)}}e.chain=p;let g=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(F=>(R(F),F)),this}filter(R){return this.steps.push(F=>R(F)?F:g),this}reduce(R,F){let I=F;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(F,I)=>F===I){let F=!0,I;return this.steps.push(C=>{let L=F||!R(C,I);return F=!1,I=C,L?C:g}),this}evaluate(R){for(let F of this.steps)if(R=F(R),R===g)break;return R}}function b(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.on(R,I),L=()=>O.removeListener(R,I),T=new Ot({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=b;function x(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.addEventListener(R,I),L=()=>O.removeEventListener(R,I),T=new Ot({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(O){return new Promise(R=>i(O)(R))}e.toPromise=w;function E(O){let R=new Ot;return O.then(F=>{R.fire(F)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function B(O,R){return O(F=>R.fire(F))}e.forward=B;function P(O,R,F){return R(F),O(I=>R(I))}e.runAndSubscribe=P;class W{constructor(R,F){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};F||t(I),this.emitter=new Ot(I),F&&F.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,F){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,R){return new W(O,R).emitter.event}e.fromObservable=A;function V(O){return(R,F,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(O.reportChanges(),L&&(L=!1,R.call(F)))},handlePossibleChange(){},handleChange(){L=!0}};O.addObserver(T),O.reportChanges();let D={dispose(){O.removeObserver(T)}};return I instanceof zn?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(gs||(gs={}));var Nn=class Hn{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Hn._idPool++}`,Hn.all.add(this)}start(t){this._stopWatch=new Eu,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}}};Nn.all=new Set,Nn._idPool=0;var Mu=Nn,Fa=-1,Xa=class Za{constructor(t,r,i=(Za._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(s);let u=new Au(a,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,o]of this._stacks)(!t||r<o)&&(t=[i,o],r=o);return t}};Xa._idPool=1;var Ru=Xa,Fn=class Qa{constructor(t){this.value=t}static create(){let t=new Error;return new Qa(t.stack??"")}print(){console.warn(this.value.split(`
30
+ `),{leaks:i,details:n}}};Cu.idx=0;function xu(e){Ur=e}if(Su){let e="__is_disposable_tracked__";xu(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==It.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==It.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function vs(e){return Ur?.trackDisposable(e),e}function bs(e){Ur?.markAsDisposed(e)}function Ci(e,t){Ur?.setParent(e,t)}function ku(e,t){if(Ur)for(let r of e)Ur.setParent(r,t)}function Si(e){if(In.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}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 Va(...e){let t=$r(()=>Si(e));return ku(e,t),t}function $r(e){let t=vs({dispose:yu(()=>{bs(t),e()})});return t}var Ya=class Ja{constructor(){this._toDispose=new Set,this._isDisposed=!1,vs(this)}dispose(){this._isDisposed||(bs(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Si(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 Ci(t,this),this._isDisposed?Ja.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),Ci(t,null))}};Ya.DISABLE_DISPOSED_WARNING=!1;var Un=Ya,It=class{constructor(){this._store=new Un,vs(this),Ci(this._store,this)}dispose(){bs(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};It.None=Object.freeze({dispose(){}});var ms=class{constructor(){this._isDisposed=!1,vs(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ci(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,bs(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ci(e,null),e}},Ha=class Nn{constructor(t){this.element=t,this.next=Nn.Undefined,this.prev=Nn.Undefined}};Ha.Undefined=new Ha(void 0);var Eu=globalThis.performance&&typeof globalThis.performance.now=="function",Lu=class Xa{static create(t){return new Xa(t)}constructor(t){this._now=Eu&&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}},Tu=!1,Fa=!1,Mu=!1,gs;(e=>{e.None=()=>It.None;function t(O){if(Mu){let{onDidAddListener:R}=O,F=Wn.create(),I=0;O.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),F.print()),R?.()}}}function r(O,R){return y(O,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(O){return(R,F=null,I)=>{let C=!1,L;return L=O(T=>{if(!C)return L?L.dispose():C=!0,R.call(F,T)},null,I),C&&L.dispose(),L}}e.once=i;function o(O,R,F){return d((I,C=null,L)=>O(T=>I.call(C,R(T)),null,L),F)}e.map=o;function s(O,R,F){return d((I,C=null,L)=>O(T=>{R(T),I.call(C,T)},null,L),F)}e.forEach=s;function n(O,R,F){return d((I,C=null,L)=>O(T=>R(T)&&I.call(C,T),null,L),F)}e.filter=n;function a(O){return O}e.signal=a;function u(...O){return(R,F=null,I)=>{let C=Va(...O.map(L=>L(T=>R.call(F,T))));return m(C,I)}}e.any=u;function l(O,R,F,I){let C=F;return o(O,L=>(C=R(C,L),C),I)}e.reduce=l;function d(O,R){let F,I={onWillAddFirstListener(){F=O(C.fire,C)},onDidRemoveLastListener(){F?.dispose()}};R||t(I);let C=new Ot(I);return R?.add(C),C.event}function m(O,R){return R instanceof Array?R.push(O):R&&R.add(O),O}function y(O,R,F=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=O(j=>{$++,N=R(N,j),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||$>1)&&k.fire(q),$=0},typeof F=="number"?(clearTimeout(G),G=setTimeout(Y,F)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Ot(H);return T?.add(k),k.event}e.debounce=y;function _(O,R=0,F){return e.debounce(O,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,F)}e.accumulate=_;function c(O,R=(I,C)=>I===C,F){let I=!0,C;return n(O,L=>{let T=I||!R(L,C);return I=!1,C=L,T},F)}e.latch=c;function f(O,R,F){return[e.filter(O,R,F),e.filter(O,I=>!R(I),F)]}e.split=f;function h(O,R=!1,F=[],I){let C=F.slice(),L=O(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Ot({onWillAddFirstListener(){L||(L=O(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(R?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function p(O,R){return(F,I,C)=>{let L=R(new S);return O(function(T){let D=L.evaluate(T);D!==v&&F.call(I,D)},void 0,C)}}e.chain=p;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(F=>(R(F),F)),this}filter(R){return this.steps.push(F=>R(F)?F:v),this}reduce(R,F){let I=F;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(F,I)=>F===I){let F=!0,I;return this.steps.push(C=>{let L=F||!R(C,I);return F=!1,I=C,L?C:v}),this}evaluate(R){for(let F of this.steps)if(R=F(R),R===v)break;return R}}function b(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.on(R,I),L=()=>O.removeListener(R,I),T=new Ot({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=b;function x(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.addEventListener(R,I),L=()=>O.removeEventListener(R,I),T=new Ot({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(O){return new Promise(R=>i(O)(R))}e.toPromise=w;function E(O){let R=new Ot;return O.then(F=>{R.fire(F)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function B(O,R){return O(F=>R.fire(F))}e.forward=B;function P(O,R,F){return R(F),O(I=>R(I))}e.runAndSubscribe=P;class W{constructor(R,F){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};F||t(I),this.emitter=new Ot(I),F&&F.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,F){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,R){return new W(O,R).emitter.event}e.fromObservable=A;function V(O){return(R,F,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(O.reportChanges(),L&&(L=!1,R.call(F)))},handlePossibleChange(){},handleChange(){L=!0}};O.addObserver(T),O.reportChanges();let D={dispose(){O.removeObserver(T)}};return I instanceof Un?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(gs||(gs={}));var Hn=class Fn{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Fn._idPool++}`,Fn.all.add(this)}start(t){this._stopWatch=new Lu,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}}};Hn.all=new Set,Hn._idPool=0;var Ru=Hn,Wa=-1,Za=class Qa{constructor(t,r,i=(Qa._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(s);let u=new Du(a,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,o]of this._stacks)(!t||r<o)&&(t=[i,o],r=o);return t}};Za._idPool=1;var Au=Za,Wn=class el{constructor(t){this.value=t}static create(){let t=new Error;return new el(t.stack??"")}print(){console.warn(this.value.split(`
31
31
  `).slice(2).join(`
32
- `))}},Au=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Du=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Pu=0,us=class{constructor(e){this.value=e,this.id=Pu++}},Bu=2,Ou=(e,t)=>{if(e instanceof us)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},fs;if(Lu){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),fs=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Ot=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Fa>0||this._options?.leakWarningThreshold?new Ru(e?.onListenerError??Tn,this._options?.leakWarningThreshold??Fa):void 0,this._perfMon=this._options?._profName?new Mu(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(Ha){let e=this._listeners;queueMicrotask(()=>{Ou(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let 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 u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Du(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||Tn)(l),It.None}if(this._disposed)return It.None;t&&(e=e.bind(t));let i=new us(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Fn.create(),o=this._leakageMon.check(i.stack,this._size+1)),Ha&&(i.stack=s??Fn.create()),this._listeners?this._listeners instanceof us?(this._deliveryQueue??(this._deliveryQueue=new Iu),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=$r(()=>{fs?.unregister(n),o?.(),this._removeListener(i)});if(r instanceof zn?r.add(n):Array.isArray(r)&&r.push(n),fs){let a=new Error().stack.split(`
32
+ `))}},Du=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Pu=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Bu=0,us=class{constructor(e){this.value=e,this.id=Bu++}},Ou=2,Iu=(e,t)=>{if(e instanceof us)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},fs;if(Tu){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),fs=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Ot=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Wa>0||this._options?.leakWarningThreshold?new Au(e?.onListenerError??Mn,this._options?.leakWarningThreshold??Wa):void 0,this._perfMon=this._options?._profName?new Ru(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(Fa){let e=this._listeners;queueMicrotask(()=>{Iu(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let 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 u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Pu(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||Mn)(l),It.None}if(this._disposed)return It.None;t&&(e=e.bind(t));let i=new us(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Wn.create(),o=this._leakageMon.check(i.stack,this._size+1)),Fa&&(i.stack=s??Wn.create()),this._listeners?this._listeners instanceof us?(this._deliveryQueue??(this._deliveryQueue=new Nu),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=$r(()=>{fs?.unregister(n),o?.(),this._removeListener(i)});if(r instanceof Un?r.add(n):Array.isArray(r)&&r.push(n),fs){let a=new Error().stack.split(`
34
34
  `).slice(2,3).join(`
35
- `).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);fs.register(n,u?.[2]??a,n)}return n}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Bu<=t.length){let o=0;for(let s=0;s<t.length;s++)t[s]?t[o++]=t[s]:i&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||Tn;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 us)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}},Iu=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},el=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Wa;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Nu?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:gs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:el})})(Wa||(Wa={}));var Nu=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?el:(this._emitter||(this._emitter=new Ot),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zr="en",Wn=!1,jn=!1,ps=!1,Hu=!1,Fu=!1,tl=!1,Wu=!1,ju=!1,zu=!1,Uu=!1,ds,_s=zr,ja=zr,$u,Vt,Yt=globalThis,mt;typeof Yt.vscode<"u"&&typeof Yt.vscode.process<"u"?mt=Yt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(mt=process);var rl=typeof mt?.versions?.electron=="string",qu=rl&&mt?.type==="renderer";if(typeof mt=="object"){Wn=mt.platform==="win32",jn=mt.platform==="darwin",ps=mt.platform==="linux",Hu=ps&&!!mt.env.SNAP&&!!mt.env.SNAP_REVISION,Wu=rl,zu=!!mt.env.CI||!!mt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ds=zr,_s=zr;let e=mt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ds=t.userLocale,ja=t.osLocale,_s=t.resolvedLanguage||zr,$u=t.languagePack?.translationsConfigFile}catch{}Fu=!0}else typeof navigator=="object"&&!qu?(Vt=navigator.userAgent,Wn=Vt.indexOf("Windows")>=0,jn=Vt.indexOf("Macintosh")>=0,ju=(Vt.indexOf("Macintosh")>=0||Vt.indexOf("iPad")>=0||Vt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ps=Vt.indexOf("Linux")>=0,Uu=Vt?.indexOf("Mobi")>=0,tl=!0,_s=globalThis._VSCODE_NLS_LANGUAGE||zr,ds=navigator.language.toLowerCase(),ja=ds):console.error("Unable to resolve platform.");var Mn=0;jn?Mn=1:Wn?Mn=3:ps&&(Mn=2);var Ku=tl&&typeof Yt.importScripts=="function",bv=Ku?Yt.origin:void 0,Nt=Vt,dr=_s,za;(e=>{function t(){return dr}e.value=t;function r(){return dr.length===2?dr==="en":dr.length>=3?dr[0]==="e"&&dr[1]==="n"&&dr[2]==="-":!1}e.isDefaultVariant=r;function i(){return dr==="en"}e.isDefault=i})(za||(za={}));var Gu=typeof Yt.postMessage=="function"&&!Yt.importScripts,Vu=(()=>{if(Gu){let e=[];Yt.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,o=e.length;i<o;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Yt.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),Yu=!!(Nt&&Nt.indexOf("Chrome")>=0),wv=!!(Nt&&Nt.indexOf("Firefox")>=0),yv=!!(!Yu&&Nt&&Nt.indexOf("Safari")>=0),Sv=!!(Nt&&Nt.indexOf("Edg/")>=0),Cv=!!(Nt&&Nt.indexOf("Android")>=0);function il(e,t=0,r){let i=setTimeout(()=>{e(),r&&o.dispose()},t),o=$r(()=>{clearTimeout(i),r?.deleteAndLeak(o)});return r?.add(o),o}var Ju,Rn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Rn=(e,t)=>{Vu(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:Rn=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Ju=e=>Rn(globalThis,e)})();var Ua;(e=>{async function t(i){let o,s=await Promise.all(i.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return s}e.settled=t;function r(i){return new Promise(async(o,s)=>{try{await i(o,s)}catch(n){s(n)}})}e.withAsyncBody=r})(Ua||(Ua={}));var $a=class bt{static fromArray(t){return new bt(r=>{r.emitMany(t)})}static fromPromise(t){return new bt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new bt(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new bt(async r=>{await Promise.all(t.map(async i=>{for await(let o of i)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Ot,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 gs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new bt(async i=>{for await(let o of t)i.emitOne(r(o))})}map(t){return bt.map(this,t)}static filter(t,r){return new bt(async i=>{for await(let o of t)r(o)&&i.emitOne(o)})}filter(t){return bt.filter(this,t)}static coalesce(t){return bt.filter(t,r=>!!r)}coalesce(){return bt.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return bt.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())}};$a.EMPTY=$a.fromArray([]);var Xu=class extends It{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ms),this._linesCacheDisposables=this._register(new ms),this._register($r(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ga(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=il(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],i=[0],o=this._terminal.buffer.active.getLine(e);for(;o;){let s=this._terminal.buffer.active.getLine(e+1),n=s?s.isWrapped:!1,a=o.translateToString(!n&&t);if(n&&s){let u=o.getCell(o.length-1);u&&u.getCode()===0&&u.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(r.push(a),n)i.push(i[i.length-1]+a.length);else break;e++,o=s}return[r.join(""),i]}},Zu=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}},Qu=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,r,i){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let o={startRow:t,startCol:r},s=this._findInLine(e,o,i);if(!s)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,i),!s);n++);return s}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=0,s=0;i&&(r===e?(o=i.end.x,s=i.end.y):(o=i.start.x,s=i.start.y)),this._lineCache.initLinesCache();let n={startRow:s,startCol:o},a=this._findInLine(e,n,t);if(!a)for(let u=s+1;u<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=u,n.startCol=0,a=this._findInLine(e,n,t),!a);u++);if(!a&&s!==0)for(let u=0;u<s&&(n.startRow=u,n.startCol=0,a=this._findInLine(e,n,t),!a);u++);return!a&&i&&(n.startRow=i.start.y,n.startCol=0,a=this._findInLine(e,n,t)),a}findPreviousWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let a={startRow:o,startCol:s},u;if(i&&(a.startRow=o=i.start.y,a.startCol=s=i.start.x,r!==e&&(u=this._findInLine(e,a,t,!1),u||(a.startRow=o=i.end.y,a.startCol=s=i.end.x))),u||(u=this._findInLine(e,a,t,n)),!u){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=o-1;l>=0&&(a.startRow=l,u=this._findInLine(e,a,t,n),!u);l--);}if(!u&&o!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=o&&(a.startRow=l,u=this._findInLine(e,a,t,n),!u);l--);return u}_isWholeWord(e,t,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+r.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+r.length]))}_findInLine(e,t,r={},i=!1){let o=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(o)?.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,r)}let n=this._lineCache.getLineFromCache(o);n||(n=this._lineCache.translateBufferLineToStringWithWrap(o,!0),this._lineCache.setLineInCache(o,n));let[a,u]=n,l=this._bufferColsToStringOffset(o,s),d=e,m=a;r.regex||(d=r.caseSensitive?e:e.toLowerCase(),m=r.caseSensitive?a:a.toLowerCase());let y=-1;if(r.regex){let _=RegExp(d,r.caseSensitive?"g":"gi"),c;if(i)for(;c=_.exec(m.slice(0,l));)y=_.lastIndex-c[0].length,e=c[0],_.lastIndex-=e.length-1;else c=_.exec(m.slice(l)),c&&c[0].length>0&&(y=l+(_.lastIndex-c[0].length),e=c[0])}else i?l-d.length>=0&&(y=m.lastIndexOf(d,l-d.length)):y=m.indexOf(d,l);if(y>=0){if(r.wholeWord&&!this._isWholeWord(y,m,e))return;let _=0;for(;_<u.length-1&&y>=u[_+1];)_++;let c=_;for(;c<u.length-1&&y+e.length>=u[c+1];)c++;let f=y-u[_],h=y+e.length-u[c],p=this._stringLengthToBufferSize(o+_,f),g=this._stringLengthToBufferSize(o+c,h)-p+this._terminal.cols*(c-_);return{term:e,col:p,row:o+_,size:g}}}_stringLengthToBufferSize(e,t){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let i=0;i<t;i++){let o=r.getCell(i);if(!o)break;let s=o.getChars();s.length>1&&(t-=s.length-1);let n=r.getCell(i+1);n&&n.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,i=0,o=this._terminal.buffer.active.getLine(r);for(;t>0&&o;){for(let s=0;s<t&&s<this._terminal.cols;s++){let n=o.getCell(s);if(!n)break;n.getWidth()&&(i+=n.getCode()===0?1:n.getChars().length)}if(r++,o=this._terminal.buffer.active.getLine(r),o&&!o.isWrapped)break;t-=this._terminal.cols}return i}},ef=class extends It{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register($r(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let i=this._createResultDecorations(r,t,!1);if(i)for(let o of i)this._storeDecoration(o,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){Si(r)}}}clearHighlightDecorations(){Si(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,r){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),r&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,r){let i=[],o=e.col,s=e.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let u=Math.min(this._terminal.cols-o,s);i.push([n,o,u]),o=0,s-=u,n++}let a=[];for(let u of i){let l=this._terminal.registerMarker(u[0]),d=this._terminal.registerDecoration({marker:l,x:u[1],width:u[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(d){let m=[];m.push(l),m.push(d.onRender(y=>this._applyStyles(y,r?t.activeMatchBorder:t.matchBorder,!1))),m.push(d.onDispose(()=>Si(m))),a.push(d)}}return a.length===0?void 0:a}},tf=class extends It{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Ot)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let r=this._searchResults[t];if(r.row===e.row&&r.col===e.col&&r.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},sl=class extends It{constructor(e){super(),this._highlightTimeout=this._register(new ms),this._lineCache=this._register(new ms),this._state=new Zu,this._resultTracker=this._register(new tf),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Xu(e),this._engine=new Qu(e,this._lineCache.value),this._decorationManager=new ef(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register($r(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=il(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let i=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let r=[],i,o=this._engine.find(e,0,0,t);for(;o&&(i?.row!==o.row||i?.col!==o.col)&&!(r.length>=this._highlightLimit);)i=o,r.push(i),o=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}findPrevious(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let i=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}_selectResult(e,t,r){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let i=e.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var rf=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=nf.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:o}=t;this._options.hover(r,i,o)}},t))}};function sf(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var nf=class ws{static computeLink(t,r,i,o){let s=new RegExp(r.source,(r.flags||"")+"g"),[n,a]=ws._getWindowedLineStrings(t-1,i),u=n.join(""),l,d=[];for(;l=s.exec(u);){let m=l[0];if(!sf(m))continue;let[y,_]=ws._mapStrIdx(i,a,0,l.index),[c,f]=ws._mapStrIdx(i,y,_,m.length);if(y===-1||_===-1||c===-1||f===-1)continue;let h={start:{x:_+1,y:y+1},end:{x:f,y:c+1}};d.push({range:h,text:m,activate:o})}return d}static _getWindowedLineStrings(t,r){let i,o=t,s=t,n=0,a="",u=[];if(i=r.buffer.active.getLine(t)){let l=i.translateToString(!0);if(i.isWrapped&&l[0]!==" "){for(n=0;(i=r.buffer.active.getLine(--o))&&n<2048&&(a=i.translateToString(!0),n+=a.length,u.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););u.reverse()}for(u.push(l),n=0;(i=r.buffer.active.getLine(++s))&&i.isWrapped&&n<2048&&(a=i.translateToString(!0),n+=a.length,u.push(a),a.indexOf(" ")===-1););}return[u,o]}static _mapStrIdx(t,r,i,o){let s=t.buffer.active,n=s.getNullCell(),a=i;for(;o;){let u=s.getLine(r);if(!u)return[-1,-1];for(let l=a;l<u.length;++l){u.getCell(l,n);let d=n.getChars();if(n.getWidth()&&(o-=d.length||1,l===u.length-1&&d==="")){let m=s.getLine(r+1);m&&m.isWrapped&&(m.getCell(0,n),n.getWidth()===2&&(o+=1))}if(o<0)return[r,l]}r++,a=0}return[r,a]}},of=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function af(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var nl=class{constructor(e=af,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||of;this._linkProvider=this._terminal.registerLinkProvider(new rf(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var lf=Object.defineProperty,cf=Object.getOwnPropertyDescriptor,hf=(e,t,r,i)=>{for(var o=i>1?void 0:i?cf(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&lf(t,r,o),o},df=(e,t)=>(r,i)=>t(r,i,e),uf=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ol.isErrorNoTelemetry(e)?new ol(e.message+`
35
+ `).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);fs.register(n,u?.[2]??a,n)}return n}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Ou<=t.length){let o=0;for(let s=0;s<t.length;s++)t[s]?t[o++]=t[s]:i&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||Mn;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 us)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}},Nu=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},tl=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),ja;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Hu?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:gs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:tl})})(ja||(ja={}));var Hu=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?tl:(this._emitter||(this._emitter=new Ot),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zr="en",jn=!1,zn=!1,ps=!1,Fu=!1,Wu=!1,rl=!1,ju=!1,zu=!1,Uu=!1,$u=!1,ds,_s=zr,za=zr,qu,Vt,Yt=globalThis,mt;typeof Yt.vscode<"u"&&typeof Yt.vscode.process<"u"?mt=Yt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(mt=process);var il=typeof mt?.versions?.electron=="string",Ku=il&&mt?.type==="renderer";if(typeof mt=="object"){jn=mt.platform==="win32",zn=mt.platform==="darwin",ps=mt.platform==="linux",Fu=ps&&!!mt.env.SNAP&&!!mt.env.SNAP_REVISION,ju=il,Uu=!!mt.env.CI||!!mt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ds=zr,_s=zr;let e=mt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ds=t.userLocale,za=t.osLocale,_s=t.resolvedLanguage||zr,qu=t.languagePack?.translationsConfigFile}catch{}Wu=!0}else typeof navigator=="object"&&!Ku?(Vt=navigator.userAgent,jn=Vt.indexOf("Windows")>=0,zn=Vt.indexOf("Macintosh")>=0,zu=(Vt.indexOf("Macintosh")>=0||Vt.indexOf("iPad")>=0||Vt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ps=Vt.indexOf("Linux")>=0,$u=Vt?.indexOf("Mobi")>=0,rl=!0,_s=globalThis._VSCODE_NLS_LANGUAGE||zr,ds=navigator.language.toLowerCase(),za=ds):console.error("Unable to resolve platform.");var Rn=0;zn?Rn=1:jn?Rn=3:ps&&(Rn=2);var Gu=rl&&typeof Yt.importScripts=="function",wv=Gu?Yt.origin:void 0,Nt=Vt,dr=_s,Ua;(e=>{function t(){return dr}e.value=t;function r(){return dr.length===2?dr==="en":dr.length>=3?dr[0]==="e"&&dr[1]==="n"&&dr[2]==="-":!1}e.isDefaultVariant=r;function i(){return dr==="en"}e.isDefault=i})(Ua||(Ua={}));var Vu=typeof Yt.postMessage=="function"&&!Yt.importScripts,Yu=(()=>{if(Vu){let e=[];Yt.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,o=e.length;i<o;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Yt.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),Ju=!!(Nt&&Nt.indexOf("Chrome")>=0),yv=!!(Nt&&Nt.indexOf("Firefox")>=0),Sv=!!(!Ju&&Nt&&Nt.indexOf("Safari")>=0),Cv=!!(Nt&&Nt.indexOf("Edg/")>=0),xv=!!(Nt&&Nt.indexOf("Android")>=0);function sl(e,t=0,r){let i=setTimeout(()=>{e(),r&&o.dispose()},t),o=$r(()=>{clearTimeout(i),r?.deleteAndLeak(o)});return r?.add(o),o}var Xu,An;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?An=(e,t)=>{Yu(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:An=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Xu=e=>An(globalThis,e)})();var $a;(e=>{async function t(i){let o,s=await Promise.all(i.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return s}e.settled=t;function r(i){return new Promise(async(o,s)=>{try{await i(o,s)}catch(n){s(n)}})}e.withAsyncBody=r})($a||($a={}));var qa=class bt{static fromArray(t){return new bt(r=>{r.emitMany(t)})}static fromPromise(t){return new bt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new bt(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new bt(async r=>{await Promise.all(t.map(async i=>{for await(let o of i)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Ot,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 gs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new bt(async i=>{for await(let o of t)i.emitOne(r(o))})}map(t){return bt.map(this,t)}static filter(t,r){return new bt(async i=>{for await(let o of t)r(o)&&i.emitOne(o)})}filter(t){return bt.filter(this,t)}static coalesce(t){return bt.filter(t,r=>!!r)}coalesce(){return bt.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return bt.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())}};qa.EMPTY=qa.fromArray([]);var Zu=class extends It{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ms),this._linesCacheDisposables=this._register(new ms),this._register($r(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Va(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=sl(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],i=[0],o=this._terminal.buffer.active.getLine(e);for(;o;){let s=this._terminal.buffer.active.getLine(e+1),n=s?s.isWrapped:!1,a=o.translateToString(!n&&t);if(n&&s){let u=o.getCell(o.length-1);u&&u.getCode()===0&&u.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(r.push(a),n)i.push(i[i.length-1]+a.length);else break;e++,o=s}return[r.join(""),i]}},Qu=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}},ef=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,r,i){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let o={startRow:t,startCol:r},s=this._findInLine(e,o,i);if(!s)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,i),!s);n++);return s}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=0,s=0;i&&(r===e?(o=i.end.x,s=i.end.y):(o=i.start.x,s=i.start.y)),this._lineCache.initLinesCache();let n={startRow:s,startCol:o},a=this._findInLine(e,n,t);if(!a)for(let u=s+1;u<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=u,n.startCol=0,a=this._findInLine(e,n,t),!a);u++);if(!a&&s!==0)for(let u=0;u<s&&(n.startRow=u,n.startCol=0,a=this._findInLine(e,n,t),!a);u++);return!a&&i&&(n.startRow=i.start.y,n.startCol=0,a=this._findInLine(e,n,t)),a}findPreviousWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let a={startRow:o,startCol:s},u;if(i&&(a.startRow=o=i.start.y,a.startCol=s=i.start.x,r!==e&&(u=this._findInLine(e,a,t,!1),u||(a.startRow=o=i.end.y,a.startCol=s=i.end.x))),u||(u=this._findInLine(e,a,t,n)),!u){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=o-1;l>=0&&(a.startRow=l,u=this._findInLine(e,a,t,n),!u);l--);}if(!u&&o!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=o&&(a.startRow=l,u=this._findInLine(e,a,t,n),!u);l--);return u}_isWholeWord(e,t,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+r.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+r.length]))}_findInLine(e,t,r={},i=!1){let o=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(o)?.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,r)}let n=this._lineCache.getLineFromCache(o);n||(n=this._lineCache.translateBufferLineToStringWithWrap(o,!0),this._lineCache.setLineInCache(o,n));let[a,u]=n,l=this._bufferColsToStringOffset(o,s),d=e,m=a;r.regex||(d=r.caseSensitive?e:e.toLowerCase(),m=r.caseSensitive?a:a.toLowerCase());let y=-1;if(r.regex){let _=RegExp(d,r.caseSensitive?"g":"gi"),c;if(i)for(;c=_.exec(m.slice(0,l));)y=_.lastIndex-c[0].length,e=c[0],_.lastIndex-=e.length-1;else c=_.exec(m.slice(l)),c&&c[0].length>0&&(y=l+(_.lastIndex-c[0].length),e=c[0])}else i?l-d.length>=0&&(y=m.lastIndexOf(d,l-d.length)):y=m.indexOf(d,l);if(y>=0){if(r.wholeWord&&!this._isWholeWord(y,m,e))return;let _=0;for(;_<u.length-1&&y>=u[_+1];)_++;let c=_;for(;c<u.length-1&&y+e.length>=u[c+1];)c++;let f=y-u[_],h=y+e.length-u[c],p=this._stringLengthToBufferSize(o+_,f),v=this._stringLengthToBufferSize(o+c,h)-p+this._terminal.cols*(c-_);return{term:e,col:p,row:o+_,size:v}}}_stringLengthToBufferSize(e,t){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let i=0;i<t;i++){let o=r.getCell(i);if(!o)break;let s=o.getChars();s.length>1&&(t-=s.length-1);let n=r.getCell(i+1);n&&n.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,i=0,o=this._terminal.buffer.active.getLine(r);for(;t>0&&o;){for(let s=0;s<t&&s<this._terminal.cols;s++){let n=o.getCell(s);if(!n)break;n.getWidth()&&(i+=n.getCode()===0?1:n.getChars().length)}if(r++,o=this._terminal.buffer.active.getLine(r),o&&!o.isWrapped)break;t-=this._terminal.cols}return i}},tf=class extends It{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register($r(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let i=this._createResultDecorations(r,t,!1);if(i)for(let o of i)this._storeDecoration(o,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){Si(r)}}}clearHighlightDecorations(){Si(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,r){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),r&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,r){let i=[],o=e.col,s=e.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let u=Math.min(this._terminal.cols-o,s);i.push([n,o,u]),o=0,s-=u,n++}let a=[];for(let u of i){let l=this._terminal.registerMarker(u[0]),d=this._terminal.registerDecoration({marker:l,x:u[1],width:u[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(d){let m=[];m.push(l),m.push(d.onRender(y=>this._applyStyles(y,r?t.activeMatchBorder:t.matchBorder,!1))),m.push(d.onDispose(()=>Si(m))),a.push(d)}}return a.length===0?void 0:a}},rf=class extends It{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Ot)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let r=this._searchResults[t];if(r.row===e.row&&r.col===e.col&&r.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},nl=class extends It{constructor(e){super(),this._highlightTimeout=this._register(new ms),this._lineCache=this._register(new ms),this._state=new Qu,this._resultTracker=this._register(new rf),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Zu(e),this._engine=new ef(e,this._lineCache.value),this._decorationManager=new tf(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register($r(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=sl(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let i=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let r=[],i,o=this._engine.find(e,0,0,t);for(;o&&(i?.row!==o.row||i?.col!==o.col)&&!(r.length>=this._highlightLimit);)i=o,r.push(i),o=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}findPrevious(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let i=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}_selectResult(e,t,r){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let i=e.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var sf=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=of.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:o}=t;this._options.hover(r,i,o)}},t))}};function nf(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var of=class ws{static computeLink(t,r,i,o){let s=new RegExp(r.source,(r.flags||"")+"g"),[n,a]=ws._getWindowedLineStrings(t-1,i),u=n.join(""),l,d=[];for(;l=s.exec(u);){let m=l[0];if(!nf(m))continue;let[y,_]=ws._mapStrIdx(i,a,0,l.index),[c,f]=ws._mapStrIdx(i,y,_,m.length);if(y===-1||_===-1||c===-1||f===-1)continue;let h={start:{x:_+1,y:y+1},end:{x:f,y:c+1}};d.push({range:h,text:m,activate:o})}return d}static _getWindowedLineStrings(t,r){let i,o=t,s=t,n=0,a="",u=[];if(i=r.buffer.active.getLine(t)){let l=i.translateToString(!0);if(i.isWrapped&&l[0]!==" "){for(n=0;(i=r.buffer.active.getLine(--o))&&n<2048&&(a=i.translateToString(!0),n+=a.length,u.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););u.reverse()}for(u.push(l),n=0;(i=r.buffer.active.getLine(++s))&&i.isWrapped&&n<2048&&(a=i.translateToString(!0),n+=a.length,u.push(a),a.indexOf(" ")===-1););}return[u,o]}static _mapStrIdx(t,r,i,o){let s=t.buffer.active,n=s.getNullCell(),a=i;for(;o;){let u=s.getLine(r);if(!u)return[-1,-1];for(let l=a;l<u.length;++l){u.getCell(l,n);let d=n.getChars();if(n.getWidth()&&(o-=d.length||1,l===u.length-1&&d==="")){let m=s.getLine(r+1);m&&m.isWrapped&&(m.getCell(0,n),n.getWidth()===2&&(o+=1))}if(o<0)return[r,l]}r++,a=0}return[r,a]}},af=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function lf(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var ol=class{constructor(e=lf,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||af;this._linkProvider=this._terminal.registerLinkProvider(new sf(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var cf=Object.defineProperty,hf=Object.getOwnPropertyDescriptor,df=(e,t,r,i)=>{for(var o=i>1?void 0:i?hf(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&cf(t,r,o),o},uf=(e,t)=>(r,i)=>t(r,i,e),ff=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?al.isErrorNoTelemetry(e)?new al(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)}},ff=new uf;function ks(e){pf(e)||ff.onUnexpectedError(e)}var io="Canceled";function pf(e){return e instanceof _f?!0:e instanceof Error&&e.name===io&&e.message===io}var _f=class extends Error{constructor(){super(io),this.name=this.message}},ol=class so extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof so)return t;let r=new so;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function mf(e,t,r=0,i=e.length){let o=r,s=i;for(;o<s;){let n=Math.floor((o+s)/2);t(e[n])?o=n+1:s=n}return o-1}var gf=class Vl{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Vl.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=mf(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};gf.assertInvariants=!1;var no;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function o(s){return s===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(no||(no={}));function vf(e,t){return(r,i)=>t(e(r),e(i))}var bf=(e,t)=>e-t,al=class oo{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new oo(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new oo(r=>this.iterate(i=>r(t(i))))}some(t){let r=!1;return this.iterate(i=>(r=t(i),!r)),r}findFirst(t){let r;return this.iterate(i=>t(i)?(r=i,!1):!0),r}findLast(t){let r;return this.iterate(i=>(t(i)&&(r=i),!0)),r}findLastMaxBy(t){let r,i=!0;return this.iterate(o=>((i||no.isGreaterThan(t(o,r)))&&(i=!1,r=o),!0)),r}};al.empty=new al(e=>{});function wf(e,t){let r=Object.create(null);for(let i of e){let o=t(i),s=r[o];s||(s=r[o]=[]),s.push(i)}return r}var ll,cl,Gv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[ll]="SetWithKey";for(let r of e)this.add(r)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(r=>e.call(t,r,r,this))}[(cl=Symbol.iterator,ll=Symbol.toStringTag,cl)](){return this.values()}},yf=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function Sf(e,t){let r=this,i=!1,o;return function(){if(i)return o;if(i=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var ao;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*o(b){yield b}e.single=o;function s(b){return t(b)?b:o(b)}e.wrap=s;function n(b){return b||r}e.from=n;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function u(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=u;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let w=0;for(let E of b)if(x(E,w++))return!0;return!1}e.some=d;function m(b,x){for(let w of b)if(x(w))return w}e.find=m;function*y(b,x){for(let w of b)x(w)&&(yield w)}e.filter=y;function*_(b,x){let w=0;for(let E of b)yield x(E,w++)}e.map=_;function*c(b,x){let w=0;for(let E of b)yield*x(E,w++)}e.flatMap=c;function*f(...b){for(let x of b)yield*x}e.concat=f;function h(b,x,w){let E=w;for(let B of b)E=x(E,B);return E}e.reduce=h;function*p(b,x,w=b.length){for(x<0&&(x+=b.length),w<0?w+=b.length:w>b.length&&(w=b.length);x<w;x++)yield b[x]}e.slice=p;function g(b,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,b];let E=b[Symbol.iterator]();for(let B=0;B<x;B++){let P=E.next();if(P.done)return[w,e.empty()];w.push(P.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=g;async function S(b){let x=[];for await(let w of b)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(ao||(ao={}));var Cf=!1,Xr=null,xf=class Yl{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:Yl.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let i=this.getDisposableData(t);i.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let i=r.get(t);if(i)return i;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let i;if(r)i=r;else{let u=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,u).isSingleton);if(l.length===0)return;let d=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&d.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(u){function l(m,y){for(;m.length>0&&y.some(_=>typeof _=="string"?_===m[0]:m[0].match(_));)m.shift()}let d=u.source.split(`
40
- `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let s=new yf;for(let u of i){let l=o(u);for(let d=0;d<=l.length;d++)s.add(l.slice(0,d).join(`
41
- `),u)}i.sort(vf(u=>u.idx,bf));let n="",a=0;for(let u of i.slice(0,t)){a++;let l=o(u),d=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${s.get(l.slice(0,m+1).join(`
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)}},pf=new ff;function ks(e){_f(e)||pf.onUnexpectedError(e)}var so="Canceled";function _f(e){return e instanceof mf?!0:e instanceof Error&&e.name===so&&e.message===so}var mf=class extends Error{constructor(){super(so),this.name=this.message}},al=class no extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof no)return t;let r=new no;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function gf(e,t,r=0,i=e.length){let o=r,s=i;for(;o<s;){let n=Math.floor((o+s)/2);t(e[n])?o=n+1:s=n}return o-1}var vf=class Yl{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Yl.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=gf(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};vf.assertInvariants=!1;var oo;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function o(s){return s===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(oo||(oo={}));function bf(e,t){return(r,i)=>t(e(r),e(i))}var wf=(e,t)=>e-t,ll=class ao{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new ao(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new ao(r=>this.iterate(i=>r(t(i))))}some(t){let r=!1;return this.iterate(i=>(r=t(i),!r)),r}findFirst(t){let r;return this.iterate(i=>t(i)?(r=i,!1):!0),r}findLast(t){let r;return this.iterate(i=>(t(i)&&(r=i),!0)),r}findLastMaxBy(t){let r,i=!0;return this.iterate(o=>((i||oo.isGreaterThan(t(o,r)))&&(i=!1,r=o),!0)),r}};ll.empty=new ll(e=>{});function yf(e,t){let r=Object.create(null);for(let i of e){let o=t(i),s=r[o];s||(s=r[o]=[]),s.push(i)}return r}var cl,hl,Vv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[cl]="SetWithKey";for(let r of e)this.add(r)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(r=>e.call(t,r,r,this))}[(hl=Symbol.iterator,cl=Symbol.toStringTag,hl)](){return this.values()}},Sf=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function Cf(e,t){let r=this,i=!1,o;return function(){if(i)return o;if(i=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var lo;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*o(b){yield b}e.single=o;function s(b){return t(b)?b:o(b)}e.wrap=s;function n(b){return b||r}e.from=n;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function u(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=u;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let w=0;for(let E of b)if(x(E,w++))return!0;return!1}e.some=d;function m(b,x){for(let w of b)if(x(w))return w}e.find=m;function*y(b,x){for(let w of b)x(w)&&(yield w)}e.filter=y;function*_(b,x){let w=0;for(let E of b)yield x(E,w++)}e.map=_;function*c(b,x){let w=0;for(let E of b)yield*x(E,w++)}e.flatMap=c;function*f(...b){for(let x of b)yield*x}e.concat=f;function h(b,x,w){let E=w;for(let B of b)E=x(E,B);return E}e.reduce=h;function*p(b,x,w=b.length){for(x<0&&(x+=b.length),w<0?w+=b.length:w>b.length&&(w=b.length);x<w;x++)yield b[x]}e.slice=p;function v(b,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,b];let E=b[Symbol.iterator]();for(let B=0;B<x;B++){let P=E.next();if(P.done)return[w,e.empty()];w.push(P.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(b){let x=[];for await(let w of b)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(lo||(lo={}));var xf=!1,Xr=null,kf=class Jl{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:Jl.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let i=this.getDisposableData(t);i.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let i=r.get(t);if(i)return i;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let i;if(r)i=r;else{let u=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,u).isSingleton);if(l.length===0)return;let d=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&d.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(u){function l(m,y){for(;m.length>0&&y.some(_=>typeof _=="string"?_===m[0]:m[0].match(_));)m.shift()}let d=u.source.split(`
40
+ `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let s=new Sf;for(let u of i){let l=o(u);for(let d=0;d<=l.length;d++)s.add(l.slice(0,d).join(`
41
+ `),u)}i.sort(bf(u=>u.idx,wf));let n="",a=0;for(let u of i.slice(0,t)){a++;let l=o(u),d=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${s.get(l.slice(0,m+1).join(`
42
42
  `)).size}/${i.length} leaks) at ${y}`;let _=s.get(l.slice(0,m).join(`
43
- `)),c=wf([..._].map(f=>o(f)[m]),f=>f);delete c[l[m]];for(let[f,h]of Object.entries(c))d.unshift(` - stacktraces of ${h.length} other leaks continue with ${f}`);d.unshift(y)}n+=`
43
+ `)),c=yf([..._].map(f=>o(f)[m]),f=>f);delete c[l[m]];for(let[f,h]of Object.entries(c))d.unshift(` - stacktraces of ${h.length} other leaks continue with ${f}`);d.unshift(y)}n+=`
44
44
 
45
45
 
46
46
  ==================== Leaking disposable ${a}/${i.length}: ${u.value.constructor.name} ====================
@@ -53,12 +53,12 @@ ${d.join(`
53
53
 
54
54
  ... and ${i.length-t} more leaking disposables
55
55
 
56
- `),{leaks:i,details:n}}};xf.idx=0;function kf(e){Xr=e}if(Cf){let e="__is_disposable_tracked__";kf(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==vt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==vt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Os(e){return Xr?.trackDisposable(e),e}function Is(e){Xr?.markAsDisposed(e)}function Mi(e,t){Xr?.setParent(e,t)}function Ef(e,t){if(Xr)for(let r of e)Xr.setParent(r,t)}function Jl(e){if(ao.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}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 Xl(...e){let t=tt(()=>Jl(e));return Ef(e,t),t}function tt(e){let t=Os({dispose:Sf(()=>{Is(t),e()})});return t}var Zl=class Ql{constructor(){this._toDispose=new Set,this._isDisposed=!1,Os(this)}dispose(){this._isDisposed||(Is(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Jl(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 Mi(t,this),this._isDisposed?Ql.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),Mi(t,null))}};Zl.DISABLE_DISPOSED_WARNING=!1;var Jr=Zl,vt=class{constructor(){this._store=new Jr,Os(this),Mi(this._store,this)}dispose(){Is(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};vt.None=Object.freeze({dispose(){}});var xi=class{constructor(){this._isDisposed=!1,Os(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Mi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Is(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Mi(e,null),e}},go=typeof process<"u"&&"title"in process,Ai=go?"node":navigator.userAgent,vo=go?"node":navigator.platform,Lf=Ai.includes("Firefox"),Tf=Ai.includes("Edge"),ec=/^((?!chrome|android).)*safari/i.test(Ai);function Mf(){if(!ec)return 0;let e=Ai.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Vv=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(vo),Yv=["Windows","Win16","Win32","WinCE"].includes(vo),Jv=vo.indexOf("Linux")>=0,Xv=/\bCrOS\b/.test(Ai),Rf="",Ve=0,Ye=0,Je=0,$e=0,wt={css:"#00000000",rgba:0},lt;(e=>{function t(o,s,n,a){return a!==void 0?`#${Cr(o)}${Cr(s)}${Cr(n)}${Cr(a)}`:`#${Cr(o)}${Cr(s)}${Cr(n)}`}e.toCss=t;function r(o,s,n,a=255){return(o<<24|s<<16|n<<8|a)>>>0}e.toRgba=r;function i(o,s,n,a){return{css:e.toCss(o,s,n,a),rgba:e.toRgba(o,s,n,a)}}e.toColor=i})(lt||(lt={}));var Gr;(e=>{function t(u,l){if($e=(l.rgba&255)/255,$e===1)return{css:l.css,rgba:l.rgba};let d=l.rgba>>24&255,m=l.rgba>>16&255,y=l.rgba>>8&255,_=u.rgba>>24&255,c=u.rgba>>16&255,f=u.rgba>>8&255;Ve=_+Math.round((d-_)*$e),Ye=c+Math.round((m-c)*$e),Je=f+Math.round((y-f)*$e);let h=lt.toCss(Ve,Ye,Je),p=lt.toRgba(Ve,Ye,Je);return{css:h,rgba:p}}e.blend=t;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function i(u,l,d){let m=mr.ensureContrastRatio(u.rgba,l.rgba,d);if(m)return lt.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=i;function o(u){let l=(u.rgba|255)>>>0;return[Ve,Ye,Je]=mr.toChannels(l),{css:lt.toCss(Ve,Ye,Je),rgba:l}}e.opaque=o;function s(u,l){return $e=Math.round(l*255),[Ve,Ye,Je]=mr.toChannels(u.rgba),{css:lt.toCss(Ve,Ye,Je,$e),rgba:lt.toRgba(Ve,Ye,Je,$e)}}e.opacity=s;function n(u,l){return $e=u.rgba&255,s(u,$e*l/255)}e.multiplyOpacity=n;function a(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=a})(Gr||(Gr={}));var hl;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let s=o.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Ve=parseInt(o.slice(1,2).repeat(2),16),Ye=parseInt(o.slice(2,3).repeat(2),16),Je=parseInt(o.slice(3,4).repeat(2),16),lt.toColor(Ve,Ye,Je);case 5:return Ve=parseInt(o.slice(1,2).repeat(2),16),Ye=parseInt(o.slice(2,3).repeat(2),16),Je=parseInt(o.slice(3,4).repeat(2),16),$e=parseInt(o.slice(4,5).repeat(2),16),lt.toColor(Ve,Ye,Je,$e);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let s=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Ve=parseInt(s[1]),Ye=parseInt(s[2]),Je=parseInt(s[3]),$e=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),lt.toColor(Ve,Ye,Je,$e);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ve,Ye,Je,$e]=t.getImageData(0,0,1,1).data,$e!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:lt.toRgba(Ve,Ye,Je,$e),css:o}}e.toColor=i})(hl||(hl={}));var at;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,o,s){let n=i/255,a=o/255,u=s/255,l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),m=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return l*.2126+d*.7152+m*.0722}e.relativeLuminance2=r})(at||(at={}));var mr;(e=>{function t(n,a){if($e=(a&255)/255,$e===1)return a;let u=a>>24&255,l=a>>16&255,d=a>>8&255,m=n>>24&255,y=n>>16&255,_=n>>8&255;return Ve=m+Math.round((u-m)*$e),Ye=y+Math.round((l-y)*$e),Je=_+Math.round((d-_)*$e),lt.toRgba(Ve,Ye,Je)}e.blend=t;function r(n,a,u){let l=at.relativeLuminance(n>>8),d=at.relativeLuminance(a>>8);if(Jt(l,d)<u){if(d<l){let _=i(n,a,u),c=Jt(l,at.relativeLuminance(_>>8));if(c<u){let f=o(n,a,u),h=Jt(l,at.relativeLuminance(f>>8));return c>h?_:f}return _}let m=o(n,a,u),y=Jt(l,at.relativeLuminance(m>>8));if(y<u){let _=i(n,a,u),c=Jt(l,at.relativeLuminance(_>>8));return y>c?m:_}return m}}e.ensureContrastRatio=r;function i(n,a,u){let l=n>>24&255,d=n>>16&255,m=n>>8&255,y=a>>24&255,_=a>>16&255,c=a>>8&255,f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));for(;f<u&&(y>0||_>0||c>0);)y-=Math.max(0,Math.ceil(y*.1)),_-=Math.max(0,Math.ceil(_*.1)),c-=Math.max(0,Math.ceil(c*.1)),f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));return(y<<24|_<<16|c<<8|255)>>>0}e.reduceLuminance=i;function o(n,a,u){let l=n>>24&255,d=n>>16&255,m=n>>8&255,y=a>>24&255,_=a>>16&255,c=a>>8&255,f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));for(;f<u&&(y<255||_<255||c<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));return(y<<24|_<<16|c<<8|255)>>>0}e.increaseLuminance=o;function s(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=s})(mr||(mr={}));function Cr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Jt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ke(e){if(!e)throw new Error("value must not be falsy");return e}function bo(e){return 57508<=e&&e<=57558}function Af(e){return 57520<=e&&e<=57527}function Df(e){return 57344<=e&&e<=63743}function Pf(e){return 9472<=e&&e<=9631}function Bf(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 Of(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Bf(e)&&!bo(e)&&!Df(e)}function tc(e){return bo(e)||Pf(e)}function If(){return{css:{canvas:ys(),cell:ys()},device:{canvas:ys(),cell:ys(),char:{width:0,height:0,left:0,top:0}}}}function ys(){return{width:0,height:0}}function Nf(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var et=0,Ge=0,Ht=!1,Xt=!1,Ss=!1,ft,Un=0,Hf=class{constructor(e,t,r,i,o,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=o,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Ge=0,et=0,Xt=!1,Ht=!1,Ss=!1,ft=this._themeService.colors,Un=0,e.getCode()!==0&&e.extended.underlineStyle===4){let o=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Un=t*i%(Math.round(o)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",o=>{o.backgroundColorRGB&&(Ge=o.backgroundColorRGB.rgba>>8&16777215,Xt=!0),o.foregroundColorRGB&&(et=o.foregroundColorRGB.rgba>>8&16777215,Ht=!0)}),Ss=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Ss){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ge=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ge=(this.result.fg&16777215)<<8|255;break;default:Ge=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ge=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ge=(this.result.bg&16777215)<<8|255;break}Ge=mr.blend(Ge,(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ge=(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Xt=!0,ft.selectionForeground&&(et=ft.selectionForeground.rgba>>8&16777215,Ht=!0),tc(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)et=(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:et=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:et=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:et=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:et=(this.result.fg&16777215)<<8|255;break;default:et=this._themeService.colors.foreground.rgba}et=mr.blend(et,(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ht=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",o=>{o.backgroundColorRGB&&(Ge=o.backgroundColorRGB.rgba>>8&16777215,Xt=!0),o.foregroundColorRGB&&(et=o.foregroundColorRGB.rgba>>8&16777215,Ht=!0)}),Xt&&(Ss?Ge=e.bg&-16777216&-134217729|Ge|50331648:Ge=e.bg&-16777216|Ge|50331648),Ht&&(et=e.fg&-16777216&-67108865|et|50331648),this.result.fg&67108864&&(Xt&&!Ht&&((this.result.bg&50331648)===0?et=this.result.fg&-134217728|ft.background.rgba>>8&16777215&16777215|50331648:et=this.result.fg&-134217728|this.result.bg&67108863,Ht=!0),!Xt&&Ht&&((this.result.fg&50331648)===0?Ge=this.result.bg&-67108864|ft.foreground.rgba>>8&16777215&16777215|50331648:Ge=this.result.bg&-67108864|this.result.fg&67108863,Xt=!0)),ft=void 0,this.result.bg=Xt?Ge:this.result.bg,this.result.fg=Ht?et:this.result.fg,this.result.ext&=536870911,this.result.ext|=Un<<29&3758096384}},Ff=.5,rc=Lf||Tf?"bottom":"ideographic",Wf={"\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}]},jf={"\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]]},zf={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2551":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2552":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u2553":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"\u2554":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2555":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"\u2556":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"\u2557":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"\u2558":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"\u2559":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u255A":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"\u255B":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"\u255C":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"\u255D":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"\u255E":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u255F":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"\u2560":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2561":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"\u2562":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2563":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"\u2564":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"\u2565":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"\u2566":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2567":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2568":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u2569":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u256A":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u256B":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u256C":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"\u256E":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"\u256F":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"\u2570":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Ri={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Ri["\uE0BB"]=Ri["\uE0BD"];Ri["\uE0BF"]=Ri["\uE0B9"];function Uf(e,t,r,i,o,s,n,a){let u=Wf[t];if(u)return $f(e,u,r,i,o,s),!0;let l=jf[t];if(l)return qf(e,l,r,i,o,s),!0;let d=zf[t];if(d)return Kf(e,d,r,i,o,s,a),!0;let m=Ri[t];return m?(Gf(e,m,r,i,o,s,n,a),!0):!1}function $f(e,t,r,i,o,s){for(let n=0;n<t.length;n++){let a=t[n],u=o/8,l=s/8;e.fillRect(r+a.x*u,i+a.y*l,a.w*u,a.h*l)}}var dl=new Map;function qf(e,t,r,i,o,s){let n=dl.get(t);n||(n=new Map,dl.set(t,n));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let u=n.get(a);if(!u){let l=t[0].length,d=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=l,m.height=d;let y=Ke(m.getContext("2d")),_=new ImageData(l,d),c,f,h,p;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),f=parseInt(a.slice(3,5),16),h=parseInt(a.slice(5,7),16),p=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,f,h,p]=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<d;g++)for(let S=0;S<l;S++)_.data[(g*l+S)*4]=c,_.data[(g*l+S)*4+1]=f,_.data[(g*l+S)*4+2]=h,_.data[(g*l+S)*4+3]=t[g][S]*(p*255);y.putImageData(_,0,0),u=Ke(e.createPattern(m,null)),n.set(a,u)}e.fillStyle=u,e.fillRect(r,i,o,s)}function Kf(e,t,r,i,o,s,n){e.strokeStyle=e.fillStyle;for(let[a,u]of Object.entries(t)){e.beginPath(),e.lineWidth=n*Number.parseInt(a);let l;if(typeof u=="function"){let d=.15/s*o;l=u(.15,d)}else l=u;for(let d of l.split(" ")){let m=d[0],y=ic[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||y(e,sc(_,o,s,r,i,!0,n))}e.stroke(),e.closePath()}}function Gf(e,t,r,i,o,s,n,a){let u=new Path2D;u.rect(r,i,o,s),e.clip(u),e.beginPath();let l=n/12;e.lineWidth=a*l;for(let d of t.d.split(" ")){let m=d[0],y=ic[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||y(e,sc(_,o,s,r,i,!1,a,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function ul(e,t,r=0){return Math.max(Math.min(e,t),r)}var ic={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 sc(e,t,r,i,o,s,n,a=0,u=0){let l=e.map(d=>parseFloat(d)||parseInt(d));if(l.length<2)throw new Error("Too few arguments for instruction");for(let d=0;d<l.length;d+=2)l[d]*=t-a*n-u*n,s&&l[d]!==0&&(l[d]=ul(Math.round(l[d]+.5)-.5,t,0)),l[d]+=i+a*n;for(let d=1;d<l.length;d+=2)l[d]*=r,s&&l[d]!==0&&(l[d]=ul(Math.round(l[d]+.5)-.5,r,0)),l[d]+=o;return l}var fl=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},pl=class{constructor(){this._data=new fl}set(e,t,r,i,o){this._data.get(e,t)||this._data.set(e,t,new fl),this._data.get(e,t).set(r,i,o)}get(e,t,r,i){return this._data.get(e,t)?.get(r,i)}clear(){this._data.clear()}},nc=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=o}this.clear()}},Vf=class extends nc{_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())}}},Yf=class extends nc{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Jf=!go&&"requestIdleCallback"in window?Yf:Vf,Vr=class oc{constructor(){this.fg=0,this.bg=0,this.extended=new ac}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 oc;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}},ac=class lc{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new lc(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},_l=class lo{constructor(t){this.element=t,this.next=lo.Undefined,this.prev=lo.Undefined}};_l.Undefined=new _l(void 0);var Xf=globalThis.performance&&typeof globalThis.performance.now=="function",Zf=class cc{static create(t){return new cc(t)}constructor(t){this._now=Xf&&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}},Qf=!1,ml=!1,ep=!1,Ft;(e=>{e.None=()=>vt.None;function t(O){if(ep){let{onDidAddListener:R}=O,F=uo.create(),I=0;O.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),F.print()),R?.()}}}function r(O,R){return y(O,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(O){return(R,F=null,I)=>{let C=!1,L;return L=O(T=>{if(!C)return L?L.dispose():C=!0,R.call(F,T)},null,I),C&&L.dispose(),L}}e.once=i;function o(O,R,F){return d((I,C=null,L)=>O(T=>I.call(C,R(T)),null,L),F)}e.map=o;function s(O,R,F){return d((I,C=null,L)=>O(T=>{R(T),I.call(C,T)},null,L),F)}e.forEach=s;function n(O,R,F){return d((I,C=null,L)=>O(T=>R(T)&&I.call(C,T),null,L),F)}e.filter=n;function a(O){return O}e.signal=a;function u(...O){return(R,F=null,I)=>{let C=Xl(...O.map(L=>L(T=>R.call(F,T))));return m(C,I)}}e.any=u;function l(O,R,F,I){let C=F;return o(O,L=>(C=R(C,L),C),I)}e.reduce=l;function d(O,R){let F,I={onWillAddFirstListener(){F=O(C.fire,C)},onDidRemoveLastListener(){F?.dispose()}};R||t(I);let C=new Pe(I);return R?.add(C),C.event}function m(O,R){return R instanceof Array?R.push(O):R&&R.add(O),O}function y(O,R,F=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=O(j=>{$++,N=R(N,j),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||$>1)&&k.fire(q),$=0},typeof F=="number"?(clearTimeout(G),G=setTimeout(Y,F)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Pe(H);return T?.add(k),k.event}e.debounce=y;function _(O,R=0,F){return e.debounce(O,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,F)}e.accumulate=_;function c(O,R=(I,C)=>I===C,F){let I=!0,C;return n(O,L=>{let T=I||!R(L,C);return I=!1,C=L,T},F)}e.latch=c;function f(O,R,F){return[e.filter(O,R,F),e.filter(O,I=>!R(I),F)]}e.split=f;function h(O,R=!1,F=[],I){let C=F.slice(),L=O(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Pe({onWillAddFirstListener(){L||(L=O(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(R?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function p(O,R){return(F,I,C)=>{let L=R(new S);return O(function(T){let D=L.evaluate(T);D!==g&&F.call(I,D)},void 0,C)}}e.chain=p;let g=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(F=>(R(F),F)),this}filter(R){return this.steps.push(F=>R(F)?F:g),this}reduce(R,F){let I=F;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(F,I)=>F===I){let F=!0,I;return this.steps.push(C=>{let L=F||!R(C,I);return F=!1,I=C,L?C:g}),this}evaluate(R){for(let F of this.steps)if(R=F(R),R===g)break;return R}}function b(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.on(R,I),L=()=>O.removeListener(R,I),T=new Pe({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=b;function x(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.addEventListener(R,I),L=()=>O.removeEventListener(R,I),T=new Pe({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(O){return new Promise(R=>i(O)(R))}e.toPromise=w;function E(O){let R=new Pe;return O.then(F=>{R.fire(F)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function B(O,R){return O(F=>R.fire(F))}e.forward=B;function P(O,R,F){return R(F),O(I=>R(I))}e.runAndSubscribe=P;class W{constructor(R,F){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};F||t(I),this.emitter=new Pe(I),F&&F.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,F){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,R){return new W(O,R).emitter.event}e.fromObservable=A;function V(O){return(R,F,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(O.reportChanges(),L&&(L=!1,R.call(F)))},handlePossibleChange(){},handleChange(){L=!0}};O.addObserver(T),O.reportChanges();let D={dispose(){O.removeObserver(T)}};return I instanceof Jr?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(Ft||(Ft={}));var co=class ho{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ho._idPool++}`,ho.all.add(this)}start(t){this._stopWatch=new Zf,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}}};co.all=new Set,co._idPool=0;var tp=co,gl=-1,hc=class dc{constructor(t,r,i=(dc._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(s);let u=new ip(a,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,o]of this._stacks)(!t||r<o)&&(t=[i,o],r=o);return t}};hc._idPool=1;var rp=hc,uo=class uc{constructor(t){this.value=t}static create(){let t=new Error;return new uc(t.stack??"")}print(){console.warn(this.value.split(`
56
+ `),{leaks:i,details:n}}};kf.idx=0;function Ef(e){Xr=e}if(xf){let e="__is_disposable_tracked__";Ef(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==vt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==vt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Os(e){return Xr?.trackDisposable(e),e}function Is(e){Xr?.markAsDisposed(e)}function Mi(e,t){Xr?.setParent(e,t)}function Lf(e,t){if(Xr)for(let r of e)Xr.setParent(r,t)}function Xl(e){if(lo.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}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 Zl(...e){let t=tt(()=>Xl(e));return Lf(e,t),t}function tt(e){let t=Os({dispose:Cf(()=>{Is(t),e()})});return t}var Ql=class ec{constructor(){this._toDispose=new Set,this._isDisposed=!1,Os(this)}dispose(){this._isDisposed||(Is(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Xl(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 Mi(t,this),this._isDisposed?ec.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),Mi(t,null))}};Ql.DISABLE_DISPOSED_WARNING=!1;var Jr=Ql,vt=class{constructor(){this._store=new Jr,Os(this),Mi(this._store,this)}dispose(){Is(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};vt.None=Object.freeze({dispose(){}});var xi=class{constructor(){this._isDisposed=!1,Os(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Mi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Is(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Mi(e,null),e}},vo=typeof process<"u"&&"title"in process,Ai=vo?"node":navigator.userAgent,bo=vo?"node":navigator.platform,Tf=Ai.includes("Firefox"),Mf=Ai.includes("Edge"),tc=/^((?!chrome|android).)*safari/i.test(Ai);function Rf(){if(!tc)return 0;let e=Ai.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Yv=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(bo),Jv=["Windows","Win16","Win32","WinCE"].includes(bo),Xv=bo.indexOf("Linux")>=0,Zv=/\bCrOS\b/.test(Ai),Af="",Ve=0,Ye=0,Je=0,$e=0,wt={css:"#00000000",rgba:0},lt;(e=>{function t(o,s,n,a){return a!==void 0?`#${Cr(o)}${Cr(s)}${Cr(n)}${Cr(a)}`:`#${Cr(o)}${Cr(s)}${Cr(n)}`}e.toCss=t;function r(o,s,n,a=255){return(o<<24|s<<16|n<<8|a)>>>0}e.toRgba=r;function i(o,s,n,a){return{css:e.toCss(o,s,n,a),rgba:e.toRgba(o,s,n,a)}}e.toColor=i})(lt||(lt={}));var Gr;(e=>{function t(u,l){if($e=(l.rgba&255)/255,$e===1)return{css:l.css,rgba:l.rgba};let d=l.rgba>>24&255,m=l.rgba>>16&255,y=l.rgba>>8&255,_=u.rgba>>24&255,c=u.rgba>>16&255,f=u.rgba>>8&255;Ve=_+Math.round((d-_)*$e),Ye=c+Math.round((m-c)*$e),Je=f+Math.round((y-f)*$e);let h=lt.toCss(Ve,Ye,Je),p=lt.toRgba(Ve,Ye,Je);return{css:h,rgba:p}}e.blend=t;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function i(u,l,d){let m=mr.ensureContrastRatio(u.rgba,l.rgba,d);if(m)return lt.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=i;function o(u){let l=(u.rgba|255)>>>0;return[Ve,Ye,Je]=mr.toChannels(l),{css:lt.toCss(Ve,Ye,Je),rgba:l}}e.opaque=o;function s(u,l){return $e=Math.round(l*255),[Ve,Ye,Je]=mr.toChannels(u.rgba),{css:lt.toCss(Ve,Ye,Je,$e),rgba:lt.toRgba(Ve,Ye,Je,$e)}}e.opacity=s;function n(u,l){return $e=u.rgba&255,s(u,$e*l/255)}e.multiplyOpacity=n;function a(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=a})(Gr||(Gr={}));var dl;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let s=o.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Ve=parseInt(o.slice(1,2).repeat(2),16),Ye=parseInt(o.slice(2,3).repeat(2),16),Je=parseInt(o.slice(3,4).repeat(2),16),lt.toColor(Ve,Ye,Je);case 5:return Ve=parseInt(o.slice(1,2).repeat(2),16),Ye=parseInt(o.slice(2,3).repeat(2),16),Je=parseInt(o.slice(3,4).repeat(2),16),$e=parseInt(o.slice(4,5).repeat(2),16),lt.toColor(Ve,Ye,Je,$e);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let s=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Ve=parseInt(s[1]),Ye=parseInt(s[2]),Je=parseInt(s[3]),$e=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),lt.toColor(Ve,Ye,Je,$e);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ve,Ye,Je,$e]=t.getImageData(0,0,1,1).data,$e!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:lt.toRgba(Ve,Ye,Je,$e),css:o}}e.toColor=i})(dl||(dl={}));var at;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,o,s){let n=i/255,a=o/255,u=s/255,l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),m=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return l*.2126+d*.7152+m*.0722}e.relativeLuminance2=r})(at||(at={}));var mr;(e=>{function t(n,a){if($e=(a&255)/255,$e===1)return a;let u=a>>24&255,l=a>>16&255,d=a>>8&255,m=n>>24&255,y=n>>16&255,_=n>>8&255;return Ve=m+Math.round((u-m)*$e),Ye=y+Math.round((l-y)*$e),Je=_+Math.round((d-_)*$e),lt.toRgba(Ve,Ye,Je)}e.blend=t;function r(n,a,u){let l=at.relativeLuminance(n>>8),d=at.relativeLuminance(a>>8);if(Jt(l,d)<u){if(d<l){let _=i(n,a,u),c=Jt(l,at.relativeLuminance(_>>8));if(c<u){let f=o(n,a,u),h=Jt(l,at.relativeLuminance(f>>8));return c>h?_:f}return _}let m=o(n,a,u),y=Jt(l,at.relativeLuminance(m>>8));if(y<u){let _=i(n,a,u),c=Jt(l,at.relativeLuminance(_>>8));return y>c?m:_}return m}}e.ensureContrastRatio=r;function i(n,a,u){let l=n>>24&255,d=n>>16&255,m=n>>8&255,y=a>>24&255,_=a>>16&255,c=a>>8&255,f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));for(;f<u&&(y>0||_>0||c>0);)y-=Math.max(0,Math.ceil(y*.1)),_-=Math.max(0,Math.ceil(_*.1)),c-=Math.max(0,Math.ceil(c*.1)),f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));return(y<<24|_<<16|c<<8|255)>>>0}e.reduceLuminance=i;function o(n,a,u){let l=n>>24&255,d=n>>16&255,m=n>>8&255,y=a>>24&255,_=a>>16&255,c=a>>8&255,f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));for(;f<u&&(y<255||_<255||c<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));return(y<<24|_<<16|c<<8|255)>>>0}e.increaseLuminance=o;function s(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=s})(mr||(mr={}));function Cr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Jt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ke(e){if(!e)throw new Error("value must not be falsy");return e}function wo(e){return 57508<=e&&e<=57558}function Df(e){return 57520<=e&&e<=57527}function Pf(e){return 57344<=e&&e<=63743}function Bf(e){return 9472<=e&&e<=9631}function Of(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 If(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Of(e)&&!wo(e)&&!Pf(e)}function rc(e){return wo(e)||Bf(e)}function Nf(){return{css:{canvas:ys(),cell:ys()},device:{canvas:ys(),cell:ys(),char:{width:0,height:0,left:0,top:0}}}}function ys(){return{width:0,height:0}}function Hf(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var et=0,Ge=0,Ht=!1,Xt=!1,Ss=!1,ft,$n=0,Ff=class{constructor(e,t,r,i,o,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=o,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Ge=0,et=0,Xt=!1,Ht=!1,Ss=!1,ft=this._themeService.colors,$n=0,e.getCode()!==0&&e.extended.underlineStyle===4){let o=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));$n=t*i%(Math.round(o)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",o=>{o.backgroundColorRGB&&(Ge=o.backgroundColorRGB.rgba>>8&16777215,Xt=!0),o.foregroundColorRGB&&(et=o.foregroundColorRGB.rgba>>8&16777215,Ht=!0)}),Ss=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Ss){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ge=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ge=(this.result.fg&16777215)<<8|255;break;default:Ge=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ge=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ge=(this.result.bg&16777215)<<8|255;break}Ge=mr.blend(Ge,(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ge=(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Xt=!0,ft.selectionForeground&&(et=ft.selectionForeground.rgba>>8&16777215,Ht=!0),rc(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)et=(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:et=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:et=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:et=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:et=(this.result.fg&16777215)<<8|255;break;default:et=this._themeService.colors.foreground.rgba}et=mr.blend(et,(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ht=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",o=>{o.backgroundColorRGB&&(Ge=o.backgroundColorRGB.rgba>>8&16777215,Xt=!0),o.foregroundColorRGB&&(et=o.foregroundColorRGB.rgba>>8&16777215,Ht=!0)}),Xt&&(Ss?Ge=e.bg&-16777216&-134217729|Ge|50331648:Ge=e.bg&-16777216|Ge|50331648),Ht&&(et=e.fg&-16777216&-67108865|et|50331648),this.result.fg&67108864&&(Xt&&!Ht&&((this.result.bg&50331648)===0?et=this.result.fg&-134217728|ft.background.rgba>>8&16777215&16777215|50331648:et=this.result.fg&-134217728|this.result.bg&67108863,Ht=!0),!Xt&&Ht&&((this.result.fg&50331648)===0?Ge=this.result.bg&-67108864|ft.foreground.rgba>>8&16777215&16777215|50331648:Ge=this.result.bg&-67108864|this.result.fg&67108863,Xt=!0)),ft=void 0,this.result.bg=Xt?Ge:this.result.bg,this.result.fg=Ht?et:this.result.fg,this.result.ext&=536870911,this.result.ext|=$n<<29&3758096384}},Wf=.5,ic=Tf||Mf?"bottom":"ideographic",jf={"\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}]},zf={"\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]]},Uf={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2551":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2552":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u2553":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"\u2554":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2555":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"\u2556":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"\u2557":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"\u2558":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"\u2559":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u255A":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"\u255B":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"\u255C":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"\u255D":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"\u255E":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u255F":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"\u2560":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2561":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"\u2562":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2563":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"\u2564":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"\u2565":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"\u2566":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2567":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2568":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u2569":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u256A":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u256B":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u256C":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"\u256E":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"\u256F":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"\u2570":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Ri={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Ri["\uE0BB"]=Ri["\uE0BD"];Ri["\uE0BF"]=Ri["\uE0B9"];function $f(e,t,r,i,o,s,n,a){let u=jf[t];if(u)return qf(e,u,r,i,o,s),!0;let l=zf[t];if(l)return Kf(e,l,r,i,o,s),!0;let d=Uf[t];if(d)return Gf(e,d,r,i,o,s,a),!0;let m=Ri[t];return m?(Vf(e,m,r,i,o,s,n,a),!0):!1}function qf(e,t,r,i,o,s){for(let n=0;n<t.length;n++){let a=t[n],u=o/8,l=s/8;e.fillRect(r+a.x*u,i+a.y*l,a.w*u,a.h*l)}}var ul=new Map;function Kf(e,t,r,i,o,s){let n=ul.get(t);n||(n=new Map,ul.set(t,n));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let u=n.get(a);if(!u){let l=t[0].length,d=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=l,m.height=d;let y=Ke(m.getContext("2d")),_=new ImageData(l,d),c,f,h,p;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),f=parseInt(a.slice(3,5),16),h=parseInt(a.slice(5,7),16),p=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,f,h,p]=a.substring(5,a.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let v=0;v<d;v++)for(let S=0;S<l;S++)_.data[(v*l+S)*4]=c,_.data[(v*l+S)*4+1]=f,_.data[(v*l+S)*4+2]=h,_.data[(v*l+S)*4+3]=t[v][S]*(p*255);y.putImageData(_,0,0),u=Ke(e.createPattern(m,null)),n.set(a,u)}e.fillStyle=u,e.fillRect(r,i,o,s)}function Gf(e,t,r,i,o,s,n){e.strokeStyle=e.fillStyle;for(let[a,u]of Object.entries(t)){e.beginPath(),e.lineWidth=n*Number.parseInt(a);let l;if(typeof u=="function"){let d=.15/s*o;l=u(.15,d)}else l=u;for(let d of l.split(" ")){let m=d[0],y=sc[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||y(e,nc(_,o,s,r,i,!0,n))}e.stroke(),e.closePath()}}function Vf(e,t,r,i,o,s,n,a){let u=new Path2D;u.rect(r,i,o,s),e.clip(u),e.beginPath();let l=n/12;e.lineWidth=a*l;for(let d of t.d.split(" ")){let m=d[0],y=sc[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||y(e,nc(_,o,s,r,i,!1,a,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function fl(e,t,r=0){return Math.max(Math.min(e,t),r)}var sc={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 nc(e,t,r,i,o,s,n,a=0,u=0){let l=e.map(d=>parseFloat(d)||parseInt(d));if(l.length<2)throw new Error("Too few arguments for instruction");for(let d=0;d<l.length;d+=2)l[d]*=t-a*n-u*n,s&&l[d]!==0&&(l[d]=fl(Math.round(l[d]+.5)-.5,t,0)),l[d]+=i+a*n;for(let d=1;d<l.length;d+=2)l[d]*=r,s&&l[d]!==0&&(l[d]=fl(Math.round(l[d]+.5)-.5,r,0)),l[d]+=o;return l}var pl=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},_l=class{constructor(){this._data=new pl}set(e,t,r,i,o){this._data.get(e,t)||this._data.set(e,t,new pl),this._data.get(e,t).set(r,i,o)}get(e,t,r,i){return this._data.get(e,t)?.get(r,i)}clear(){this._data.clear()}},oc=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=o}this.clear()}},Yf=class extends oc{_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())}}},Jf=class extends oc{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Xf=!vo&&"requestIdleCallback"in window?Jf:Yf,Vr=class ac{constructor(){this.fg=0,this.bg=0,this.extended=new lc}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 ac;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}},lc=class cc{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new cc(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ml=class co{constructor(t){this.element=t,this.next=co.Undefined,this.prev=co.Undefined}};ml.Undefined=new ml(void 0);var Zf=globalThis.performance&&typeof globalThis.performance.now=="function",Qf=class hc{static create(t){return new hc(t)}constructor(t){this._now=Zf&&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}},ep=!1,gl=!1,tp=!1,Ft;(e=>{e.None=()=>vt.None;function t(O){if(tp){let{onDidAddListener:R}=O,F=fo.create(),I=0;O.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),F.print()),R?.()}}}function r(O,R){return y(O,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(O){return(R,F=null,I)=>{let C=!1,L;return L=O(T=>{if(!C)return L?L.dispose():C=!0,R.call(F,T)},null,I),C&&L.dispose(),L}}e.once=i;function o(O,R,F){return d((I,C=null,L)=>O(T=>I.call(C,R(T)),null,L),F)}e.map=o;function s(O,R,F){return d((I,C=null,L)=>O(T=>{R(T),I.call(C,T)},null,L),F)}e.forEach=s;function n(O,R,F){return d((I,C=null,L)=>O(T=>R(T)&&I.call(C,T),null,L),F)}e.filter=n;function a(O){return O}e.signal=a;function u(...O){return(R,F=null,I)=>{let C=Zl(...O.map(L=>L(T=>R.call(F,T))));return m(C,I)}}e.any=u;function l(O,R,F,I){let C=F;return o(O,L=>(C=R(C,L),C),I)}e.reduce=l;function d(O,R){let F,I={onWillAddFirstListener(){F=O(C.fire,C)},onDidRemoveLastListener(){F?.dispose()}};R||t(I);let C=new Pe(I);return R?.add(C),C.event}function m(O,R){return R instanceof Array?R.push(O):R&&R.add(O),O}function y(O,R,F=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=O(j=>{$++,N=R(N,j),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||$>1)&&k.fire(q),$=0},typeof F=="number"?(clearTimeout(G),G=setTimeout(Y,F)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Pe(H);return T?.add(k),k.event}e.debounce=y;function _(O,R=0,F){return e.debounce(O,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,F)}e.accumulate=_;function c(O,R=(I,C)=>I===C,F){let I=!0,C;return n(O,L=>{let T=I||!R(L,C);return I=!1,C=L,T},F)}e.latch=c;function f(O,R,F){return[e.filter(O,R,F),e.filter(O,I=>!R(I),F)]}e.split=f;function h(O,R=!1,F=[],I){let C=F.slice(),L=O(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Pe({onWillAddFirstListener(){L||(L=O(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(R?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function p(O,R){return(F,I,C)=>{let L=R(new S);return O(function(T){let D=L.evaluate(T);D!==v&&F.call(I,D)},void 0,C)}}e.chain=p;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(F=>(R(F),F)),this}filter(R){return this.steps.push(F=>R(F)?F:v),this}reduce(R,F){let I=F;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(F,I)=>F===I){let F=!0,I;return this.steps.push(C=>{let L=F||!R(C,I);return F=!1,I=C,L?C:v}),this}evaluate(R){for(let F of this.steps)if(R=F(R),R===v)break;return R}}function b(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.on(R,I),L=()=>O.removeListener(R,I),T=new Pe({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=b;function x(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.addEventListener(R,I),L=()=>O.removeEventListener(R,I),T=new Pe({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(O){return new Promise(R=>i(O)(R))}e.toPromise=w;function E(O){let R=new Pe;return O.then(F=>{R.fire(F)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function B(O,R){return O(F=>R.fire(F))}e.forward=B;function P(O,R,F){return R(F),O(I=>R(I))}e.runAndSubscribe=P;class W{constructor(R,F){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};F||t(I),this.emitter=new Pe(I),F&&F.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,F){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,R){return new W(O,R).emitter.event}e.fromObservable=A;function V(O){return(R,F,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(O.reportChanges(),L&&(L=!1,R.call(F)))},handlePossibleChange(){},handleChange(){L=!0}};O.addObserver(T),O.reportChanges();let D={dispose(){O.removeObserver(T)}};return I instanceof Jr?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(Ft||(Ft={}));var ho=class uo{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${uo._idPool++}`,uo.all.add(this)}start(t){this._stopWatch=new Qf,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}}};ho.all=new Set,ho._idPool=0;var rp=ho,vl=-1,dc=class uc{constructor(t,r,i=(uc._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(s);let u=new sp(a,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,o]of this._stacks)(!t||r<o)&&(t=[i,o],r=o);return t}};dc._idPool=1;var ip=dc,fo=class fc{constructor(t){this.value=t}static create(){let t=new Error;return new fc(t.stack??"")}print(){console.warn(this.value.split(`
57
57
  `).slice(2).join(`
58
- `))}},ip=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},sp=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},np=0,Es=class{constructor(e){this.value=e,this.id=np++}},op=2,ap=(e,t)=>{if(e instanceof Es)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},Ls;if(Qf){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),Ls=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Pe=class{constructor(e){this._size=0,this._options=e,this._leakageMon=gl>0||this._options?.leakWarningThreshold?new rp(e?.onListenerError??ks,this._options?.leakWarningThreshold??gl):void 0,this._perfMon=this._options?._profName?new tp(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(ml){let e=this._listeners;queueMicrotask(()=>{ap(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let 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 u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new sp(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||ks)(l),vt.None}if(this._disposed)return vt.None;t&&(e=e.bind(t));let i=new Es(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=uo.create(),o=this._leakageMon.check(i.stack,this._size+1)),ml&&(i.stack=s??uo.create()),this._listeners?this._listeners instanceof Es?(this._deliveryQueue??(this._deliveryQueue=new lp),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=tt(()=>{Ls?.unregister(n),o?.(),this._removeListener(i)});if(r instanceof Jr?r.add(n):Array.isArray(r)&&r.push(n),Ls){let a=new Error().stack.split(`
58
+ `))}},sp=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},np=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},op=0,Es=class{constructor(e){this.value=e,this.id=op++}},ap=2,lp=(e,t)=>{if(e instanceof Es)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},Ls;if(ep){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),Ls=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Pe=class{constructor(e){this._size=0,this._options=e,this._leakageMon=vl>0||this._options?.leakWarningThreshold?new ip(e?.onListenerError??ks,this._options?.leakWarningThreshold??vl):void 0,this._perfMon=this._options?._profName?new rp(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(gl){let e=this._listeners;queueMicrotask(()=>{lp(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let 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 u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new np(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||ks)(l),vt.None}if(this._disposed)return vt.None;t&&(e=e.bind(t));let i=new Es(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=fo.create(),o=this._leakageMon.check(i.stack,this._size+1)),gl&&(i.stack=s??fo.create()),this._listeners?this._listeners instanceof Es?(this._deliveryQueue??(this._deliveryQueue=new cp),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=tt(()=>{Ls?.unregister(n),o?.(),this._removeListener(i)});if(r instanceof Jr?r.add(n):Array.isArray(r)&&r.push(n),Ls){let a=new Error().stack.split(`
60
60
  `).slice(2,3).join(`
61
- `).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Ls.register(n,u?.[2]??a,n)}return n}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*op<=t.length){let o=0;for(let s=0;s<t.length;s++)t[s]?t[o++]=t[s]:i&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||ks;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 Es)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}},lp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},vl={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}},ki=2,Ei,pr=class Kr{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new pl,this._cacheMapCombined=new pl,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Vr,this._textureSize=512,this._onAddTextureAtlasCanvas=new Pe,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Pe,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=fc(t,this._config.deviceCellWidth*4+ki*2,this._config.deviceCellHeight+ki*2),this._tmpCtx=Ke(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 Jf;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let i=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,i)}})}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(Kr.maxAtlasPages&&this._pages.length>=Math.max(4,Kr.maxAtlasPages)){let r=this._pages.filter(l=>l.canvas.width*2<=(Kr.maxTextureSize||4096)).sort((l,d)=>d.canvas.width!==l.canvas.width?d.canvas.width-l.canvas.width:d.percentageUsed-l.percentageUsed),i=-1,o=0;for(let l=0;l<r.length;l++)if(r[l].canvas.width!==o)i=l,o=r[l].canvas.width;else if(l-i===3)break;let s=r.slice(i,i+4),n=s.map(l=>l.glyphs[0].texturePage).sort((l,d)=>l>d?1:-1),a=this.pages.length-s.length,u=this._mergePages(s,a);u.version++;for(let l=n.length-1;l>=0;l--)this._deletePage(n[l]);this.pages.push(u),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(u.canvas)}let t=new $n(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let i=t[0].canvas.width*2,o=new $n(this._document,i,t);for(let[s,n]of t.entries()){let a=s*n.canvas.width%i,u=Math.floor(s/2)*n.canvas.height;o.ctx.drawImage(n.canvas,a,u);for(let d of n.glyphs)d.texturePage=r,d.sizeClipSpace.x=d.size.x/i,d.sizeClipSpace.y=d.size.y/i,d.texturePosition.x+=a,d.texturePosition.y+=u,d.texturePositionClipSpace.x=d.texturePosition.x/i,d.texturePositionClipSpace.y=d.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let l=this._activePages.indexOf(n);l!==-1&&this._activePages.splice(l,1)}return o}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let o of i.glyphs)o.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,o,s,n){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,o,s,n)}getRasterizedGlyph(t,r,i,o,s,n){return this._getFromCacheMap(this._cacheMap,t,r,i,o,s,n)}_getFromCacheMap(t,r,i,o,s,n,a){return Ei=t.get(r,i,o,s),Ei||(Ei=this._drawToCache(r,i,o,s,n,a),t.set(r,i,o,s,Ei)),Ei}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,i,o){if(this._config.allowTransparency)return wt;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(r);break;case 50331648:let n=Vr.toColorRGB(r);s=lt.toColor(n[0],n[1],n[2]);break;default:i?s=Gr.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=Gr.opaque(s)),s}_getForegroundColor(t,r,i,o,s,n,a,u,l,d){let m=this._getMinimumContrastColor(t,r,i,o,s,n,a,l,u,d);if(m)return m;let y;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&n<8&&(n+=8),y=this._getColorFromAnsiIndex(n);break;case 50331648:let _=Vr.toColorRGB(n);y=lt.toColor(_[0],_[1],_[2]);break;default:a?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=Gr.opaque(y)),u&&(y=Gr.multiplyOpacity(y,Ff)),y}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,o){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&o&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,i,o,s,n,a,u,l,d){if(this._config.minimumContrastRatio===1||d)return;let m=this._getContrastCache(l),y=m.getColor(t,o);if(y!==void 0)return y||void 0;let _=this._resolveBackgroundRgba(r,i,a),c=this._resolveForegroundRgba(s,n,a,u),f=mr.ensureContrastRatio(_,c,this._config.minimumContrastRatio/(l?2:1));if(!f){m.setColor(t,o,null);return}let h=lt.toColor(f>>24&255,f>>16&255,f>>8&255);return m.setColor(t,o,h),h}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,o,s,n){let a=typeof t=="number"?String.fromCharCode(t):t;n&&this._tmpCanvas.parentElement!==n&&(this._tmpCanvas.style.display="none",n.append(this._tmpCanvas));let u=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+ki*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<u&&(this._tmpCanvas.width=u);let l=Math.min(this._config.deviceCellHeight+ki*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=o,!!this._workAttributeData.isInvisible())return vl;let d=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),f=!!this._workAttributeData.isStrikethrough(),h=!!this._workAttributeData.isOverline(),p=this._workAttributeData.getFgColor(),g=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(m){let D=p;p=S,S=D;let N=g;g=b,b=N}let x=this._getBackgroundColor(b,S,m,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let w=d?this._config.fontWeightBold:this._config.fontWeight,E=_?"italic":"";this._tmpCtx.font=`${E} ${w} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=rc;let B=a.length===1&&bo(a.charCodeAt(0)),P=a.length===1&&Af(a.charCodeAt(0)),W=this._getForegroundColor(r,b,S,i,g,p,m,y,d,tc(a.charCodeAt(0)));this._tmpCtx.fillStyle=W.css;let A=P?0:ki*2,V=!1;this._config.customGlyphs!==!1&&(V=Uf(this._tmpCtx,a,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let O=!B,R;if(typeof t=="number"?R=this._unicodeService.wcwidth(t):R=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())O=!1,this._tmpCtx.strokeStyle=`rgb(${Vr.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{O=!1;let j=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&j<8&&(j+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(j).css}this._tmpCtx.beginPath();let G=A,$=Math.ceil(A+this._config.deviceCharHeight)-N-(s?D*2:0),Y=$+D,H=$+D*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let j=0;j<R;j++){this._tmpCtx.save();let q=G+j*this._config.deviceCellWidth,U=G+(j+1)*this._config.deviceCellWidth,J=q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$),this._tmpCtx.moveTo(q,H),this._tmpCtx.lineTo(U,H);break;case 3:let Z=D<=1?H:Math.ceil(A+this._config.deviceCharHeight-D/2)-N,se=D<=1?$:Math.ceil(A+this._config.deviceCharHeight+D/2)-N,he=new Path2D;he.rect(q,$,this._config.deviceCellWidth,H-$),this._tmpCtx.clip(he),this._tmpCtx.moveTo(q-this._config.deviceCellWidth/2,Y),this._tmpCtx.bezierCurveTo(q-this._config.deviceCellWidth/2,se,q,se,q,Y),this._tmpCtx.bezierCurveTo(q,Z,J,Z,J,Y),this._tmpCtx.bezierCurveTo(J,se,U,se,U,Y),this._tmpCtx.bezierCurveTo(U,Z,U+this._config.deviceCellWidth/2,Z,U+this._config.deviceCellWidth/2,Y);break;case 4:let fe=k===0?0:k>=D?D*2-k:D-k;k>=D||fe===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q+fe,$),this._tmpCtx.lineTo(U,$)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(q+fe,$),this._tmpCtx.moveTo(q+fe+D,$),this._tmpCtx.lineTo(U,$)),k=Nf(U-q,D,k);break;case 5:let te=.6,qe=.3,le=U-q,Me=Math.floor(te*le),st=Math.floor(qe*le),He=le-Me-st;this._tmpCtx.setLineDash([Me,st,He]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$);break;default:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!V&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let j=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in j&&j.actualBoundingBoxDescent>0){this._tmpCtx.save();let q=new Path2D;q.rect(G,$-Math.ceil(D/2),this._config.deviceCellWidth*R,H-$+Math.ceil(D/2)),this._tmpCtx.clip(q),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(a,A,A+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(h){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+N),this._tmpCtx.stroke()}if(V||this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let D=qn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,W,O);if(D)for(let N=1;N<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight-N),D=qn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,W,O),!!D);N++);}if(f){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),N=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.stroke()}this._tmpCtx.restore();let F=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),I;if(this._config.allowTransparency?I=cp(F):I=qn(F,x,W,O),I)return vl;let C=this._findGlyphBoundingBox(F,this._workBoundingBox,u,P,V,A),L,T;for(;;){if(this._activePages.length===0){let D=this._createNewPage();L=D,T=D.currentRow,T.height=C.size.y;break}L=this._activePages[this._activePages.length-1],T=L.currentRow;for(let D of this._activePages)C.size.y<=D.currentRow.height&&(L=D,T=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let N of this._activePages[D].fixedRows)N.height<=T.height&&C.size.y<=N.height&&(L=this._activePages[D],T=N);if(C.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new $n(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),L=this._overflowSizePage,T=this._overflowSizePage.currentRow,T.x+C.size.x>=L.canvas.width&&(T.x=0,T.y+=T.height,T.height=0);break}if(T.y+C.size.y>=L.canvas.height||T.height>C.size.y+2){let D=!1;if(L.currentRow.y+L.currentRow.height+C.size.y>=L.canvas.height){let N;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+C.size.y<G.canvas.height){N=G;break}if(N)L=N;else if(Kr.maxAtlasPages&&this._pages.length>=Kr.maxAtlasPages&&T.y+C.size.y<=L.canvas.height&&T.height>=C.size.y&&T.x+C.size.x<=L.canvas.width)D=!0;else{let G=this._createNewPage();L=G,T=G.currentRow,T.height=C.size.y,D=!0}}D||(L.currentRow.height>0&&L.fixedRows.push(L.currentRow),T={x:0,y:L.currentRow.y+L.currentRow.height,height:C.size.y},L.fixedRows.push(T),L.currentRow={x:0,y:T.y+T.height,height:0})}if(T.x+C.size.x<=L.canvas.width)break;T===L.currentRow?(T.x=0,T.y+=T.height,T.height=0):L.fixedRows.splice(L.fixedRows.indexOf(T),1)}return C.texturePage=this._pages.indexOf(L),C.texturePosition.x=T.x,C.texturePosition.y=T.y,C.texturePositionClipSpace.x=T.x/L.canvas.width,C.texturePositionClipSpace.y=T.y/L.canvas.height,C.sizeClipSpace.x/=L.canvas.width,C.sizeClipSpace.y/=L.canvas.height,T.height=Math.max(T.height,C.size.y),T.x+=C.size.x,L.ctx.putImageData(F,C.texturePosition.x-this._workBoundingBox.left,C.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,C.size.x,C.size.y),L.addGlyph(C),L.version++,C}_findGlyphBoundingBox(t,r,i,o,s,n){r.top=0;let a=o?this._config.deviceCellHeight:this._tmpCanvas.height,u=o?this._config.deviceCellWidth:i,l=!1;for(let d=0;d<a;d++){for(let m=0;m<u;m++){let y=d*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.top=d,l=!0;break}}if(l)break}r.left=0,l=!1;for(let d=0;d<n+u;d++){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+d*4+3;if(t.data[y]!==0){r.left=d,l=!0;break}}if(l)break}r.right=u,l=!1;for(let d=n+u-1;d>=n;d--){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+d*4+3;if(t.data[y]!==0){r.right=d,l=!0;break}}if(l)break}r.bottom=a,l=!1;for(let d=a-1;d>=0;d--){for(let m=0;m<u;m++){let y=d*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.bottom=d,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+n+(o||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+n+(o||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},$n=class{constructor(e,t,r){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],r)for(let i of r)this._glyphs.push(...i.glyphs),this._usedPixels+=i._usedPixels;this.canvas=fc(e,t,t),this.ctx=Ke(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 qn(e,t,r,i){let o=t.rgba>>>24,s=t.rgba>>>16&255,n=t.rgba>>>8&255,a=r.rgba>>>24,u=r.rgba>>>16&255,l=r.rgba>>>8&255,d=Math.floor((Math.abs(o-a)+Math.abs(s-u)+Math.abs(n-l))/12),m=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===o&&e.data[y+1]===s&&e.data[y+2]===n||i&&Math.abs(e.data[y]-o)+Math.abs(e.data[y+1]-s)+Math.abs(e.data[y+2]-n)<d?e.data[y+3]=0:m=!1;return m}function cp(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function fc(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function hp(e,t,r,i,o,s,n,a){let u={foreground:s.foreground,background:s.background,cursor:wt,cursorAccent:wt,selectionForeground:wt,selectionBackgroundTransparent:wt,selectionBackgroundOpaque:wt,selectionInactiveBackgroundTransparent:wt,selectionInactiveBackgroundOpaque:wt,overviewRulerBorder:wt,scrollbarSliderBackground:wt,scrollbarSliderHoverBackground:wt,scrollbarSliderActiveBackground:wt,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:o.customGlyphs,devicePixelRatio:n,deviceMaxTextureSize:a,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:u}}function bl(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function dp(e){return(e&50331648)===16777216||(e&50331648)===33554432}var St=[];function pc(e,t,r,i,o,s,n,a,u){let l=hp(i,o,s,n,t,r,a,u);for(let y=0;y<St.length;y++){let _=St[y],c=_.ownedBy.indexOf(e);if(c>=0){if(bl(_.config,l))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),St.splice(y,1)):_.ownedBy.splice(c,1);break}}for(let y=0;y<St.length;y++){let _=St[y];if(bl(_.config,l))return _.ownedBy.push(e),_.atlas}let d=e._core,m={atlas:new pr(document,l,d.unicodeService),config:l,ownedBy:[e]};return St.push(m),m.atlas}function wl(e){for(let t=0;t<St.length;t++){let r=St[t].ownedBy.indexOf(e);if(r!==-1){St[t].ownedBy.length===1?(St[t].atlas.dispose(),St.splice(t,1)):St[t].ownedBy.splice(r,1);break}}}var Cs=600,up=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=Cs){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Cs-(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=Cs-(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})},Cs)},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 yl(e,t,r){let i=new t.ResizeObserver(o=>{let s=o.find(u=>u.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){i?.disconnect(),i=void 0;return}let n=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;n>0&&a>0&&r(n,a)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return tt(()=>i?.disconnect())}function fp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Sl=class _c extends Vr{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ac,this.combinedData=""}static fromCharData(t){let r=new _c;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?fp(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(i-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mc=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function gc(e,t,r){let i=Ke(e.createProgram());if(e.attachShader(i,Ke(Cl(e,e.VERTEX_SHADER,t))),e.attachShader(i,Ke(Cl(e,e.FRAGMENT_SHADER,r))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function Cl(e,t,r){let i=Ke(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function pp(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let o=0;o<e.length;o++)i[o]=e[o];return i}var _p=class{constructor(e){this.texture=e,this.version=-1}},mp=`#version 300 es
61
+ `).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Ls.register(n,u?.[2]??a,n)}return n}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*ap<=t.length){let o=0;for(let s=0;s<t.length;s++)t[s]?t[o++]=t[s]:i&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||ks;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 Es)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}},cp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},bl={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}},ki=2,Ei,pr=class Kr{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new _l,this._cacheMapCombined=new _l,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Vr,this._textureSize=512,this._onAddTextureAtlasCanvas=new Pe,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Pe,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=pc(t,this._config.deviceCellWidth*4+ki*2,this._config.deviceCellHeight+ki*2),this._tmpCtx=Ke(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 Xf;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let i=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,i)}})}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(Kr.maxAtlasPages&&this._pages.length>=Math.max(4,Kr.maxAtlasPages)){let r=this._pages.filter(l=>l.canvas.width*2<=(Kr.maxTextureSize||4096)).sort((l,d)=>d.canvas.width!==l.canvas.width?d.canvas.width-l.canvas.width:d.percentageUsed-l.percentageUsed),i=-1,o=0;for(let l=0;l<r.length;l++)if(r[l].canvas.width!==o)i=l,o=r[l].canvas.width;else if(l-i===3)break;let s=r.slice(i,i+4),n=s.map(l=>l.glyphs[0].texturePage).sort((l,d)=>l>d?1:-1),a=this.pages.length-s.length,u=this._mergePages(s,a);u.version++;for(let l=n.length-1;l>=0;l--)this._deletePage(n[l]);this.pages.push(u),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(u.canvas)}let t=new qn(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let i=t[0].canvas.width*2,o=new qn(this._document,i,t);for(let[s,n]of t.entries()){let a=s*n.canvas.width%i,u=Math.floor(s/2)*n.canvas.height;o.ctx.drawImage(n.canvas,a,u);for(let d of n.glyphs)d.texturePage=r,d.sizeClipSpace.x=d.size.x/i,d.sizeClipSpace.y=d.size.y/i,d.texturePosition.x+=a,d.texturePosition.y+=u,d.texturePositionClipSpace.x=d.texturePosition.x/i,d.texturePositionClipSpace.y=d.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let l=this._activePages.indexOf(n);l!==-1&&this._activePages.splice(l,1)}return o}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let o of i.glyphs)o.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,o,s,n){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,o,s,n)}getRasterizedGlyph(t,r,i,o,s,n){return this._getFromCacheMap(this._cacheMap,t,r,i,o,s,n)}_getFromCacheMap(t,r,i,o,s,n,a){return Ei=t.get(r,i,o,s),Ei||(Ei=this._drawToCache(r,i,o,s,n,a),t.set(r,i,o,s,Ei)),Ei}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,i,o){if(this._config.allowTransparency)return wt;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(r);break;case 50331648:let n=Vr.toColorRGB(r);s=lt.toColor(n[0],n[1],n[2]);break;default:i?s=Gr.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=Gr.opaque(s)),s}_getForegroundColor(t,r,i,o,s,n,a,u,l,d){let m=this._getMinimumContrastColor(t,r,i,o,s,n,a,l,u,d);if(m)return m;let y;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&n<8&&(n+=8),y=this._getColorFromAnsiIndex(n);break;case 50331648:let _=Vr.toColorRGB(n);y=lt.toColor(_[0],_[1],_[2]);break;default:a?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=Gr.opaque(y)),u&&(y=Gr.multiplyOpacity(y,Wf)),y}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,o){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&o&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,i,o,s,n,a,u,l,d){if(this._config.minimumContrastRatio===1||d)return;let m=this._getContrastCache(l),y=m.getColor(t,o);if(y!==void 0)return y||void 0;let _=this._resolveBackgroundRgba(r,i,a),c=this._resolveForegroundRgba(s,n,a,u),f=mr.ensureContrastRatio(_,c,this._config.minimumContrastRatio/(l?2:1));if(!f){m.setColor(t,o,null);return}let h=lt.toColor(f>>24&255,f>>16&255,f>>8&255);return m.setColor(t,o,h),h}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,o,s,n){let a=typeof t=="number"?String.fromCharCode(t):t;n&&this._tmpCanvas.parentElement!==n&&(this._tmpCanvas.style.display="none",n.append(this._tmpCanvas));let u=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+ki*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<u&&(this._tmpCanvas.width=u);let l=Math.min(this._config.deviceCellHeight+ki*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=o,!!this._workAttributeData.isInvisible())return bl;let d=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),f=!!this._workAttributeData.isStrikethrough(),h=!!this._workAttributeData.isOverline(),p=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(m){let D=p;p=S,S=D;let N=v;v=b,b=N}let x=this._getBackgroundColor(b,S,m,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let w=d?this._config.fontWeightBold:this._config.fontWeight,E=_?"italic":"";this._tmpCtx.font=`${E} ${w} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ic;let B=a.length===1&&wo(a.charCodeAt(0)),P=a.length===1&&Df(a.charCodeAt(0)),W=this._getForegroundColor(r,b,S,i,v,p,m,y,d,rc(a.charCodeAt(0)));this._tmpCtx.fillStyle=W.css;let A=P?0:ki*2,V=!1;this._config.customGlyphs!==!1&&(V=$f(this._tmpCtx,a,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let O=!B,R;if(typeof t=="number"?R=this._unicodeService.wcwidth(t):R=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())O=!1,this._tmpCtx.strokeStyle=`rgb(${Vr.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{O=!1;let j=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&j<8&&(j+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(j).css}this._tmpCtx.beginPath();let G=A,$=Math.ceil(A+this._config.deviceCharHeight)-N-(s?D*2:0),Y=$+D,H=$+D*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let j=0;j<R;j++){this._tmpCtx.save();let q=G+j*this._config.deviceCellWidth,U=G+(j+1)*this._config.deviceCellWidth,J=q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$),this._tmpCtx.moveTo(q,H),this._tmpCtx.lineTo(U,H);break;case 3:let Z=D<=1?H:Math.ceil(A+this._config.deviceCharHeight-D/2)-N,se=D<=1?$:Math.ceil(A+this._config.deviceCharHeight+D/2)-N,he=new Path2D;he.rect(q,$,this._config.deviceCellWidth,H-$),this._tmpCtx.clip(he),this._tmpCtx.moveTo(q-this._config.deviceCellWidth/2,Y),this._tmpCtx.bezierCurveTo(q-this._config.deviceCellWidth/2,se,q,se,q,Y),this._tmpCtx.bezierCurveTo(q,Z,J,Z,J,Y),this._tmpCtx.bezierCurveTo(J,se,U,se,U,Y),this._tmpCtx.bezierCurveTo(U,Z,U+this._config.deviceCellWidth/2,Z,U+this._config.deviceCellWidth/2,Y);break;case 4:let fe=k===0?0:k>=D?D*2-k:D-k;k>=D||fe===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q+fe,$),this._tmpCtx.lineTo(U,$)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(q+fe,$),this._tmpCtx.moveTo(q+fe+D,$),this._tmpCtx.lineTo(U,$)),k=Hf(U-q,D,k);break;case 5:let te=.6,qe=.3,le=U-q,Me=Math.floor(te*le),st=Math.floor(qe*le),He=le-Me-st;this._tmpCtx.setLineDash([Me,st,He]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$);break;default:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!V&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let j=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in j&&j.actualBoundingBoxDescent>0){this._tmpCtx.save();let q=new Path2D;q.rect(G,$-Math.ceil(D/2),this._config.deviceCellWidth*R,H-$+Math.ceil(D/2)),this._tmpCtx.clip(q),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(a,A,A+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(h){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+N),this._tmpCtx.stroke()}if(V||this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let D=Kn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,W,O);if(D)for(let N=1;N<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight-N),D=Kn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,W,O),!!D);N++);}if(f){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),N=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.stroke()}this._tmpCtx.restore();let F=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),I;if(this._config.allowTransparency?I=hp(F):I=Kn(F,x,W,O),I)return bl;let C=this._findGlyphBoundingBox(F,this._workBoundingBox,u,P,V,A),L,T;for(;;){if(this._activePages.length===0){let D=this._createNewPage();L=D,T=D.currentRow,T.height=C.size.y;break}L=this._activePages[this._activePages.length-1],T=L.currentRow;for(let D of this._activePages)C.size.y<=D.currentRow.height&&(L=D,T=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let N of this._activePages[D].fixedRows)N.height<=T.height&&C.size.y<=N.height&&(L=this._activePages[D],T=N);if(C.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new qn(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),L=this._overflowSizePage,T=this._overflowSizePage.currentRow,T.x+C.size.x>=L.canvas.width&&(T.x=0,T.y+=T.height,T.height=0);break}if(T.y+C.size.y>=L.canvas.height||T.height>C.size.y+2){let D=!1;if(L.currentRow.y+L.currentRow.height+C.size.y>=L.canvas.height){let N;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+C.size.y<G.canvas.height){N=G;break}if(N)L=N;else if(Kr.maxAtlasPages&&this._pages.length>=Kr.maxAtlasPages&&T.y+C.size.y<=L.canvas.height&&T.height>=C.size.y&&T.x+C.size.x<=L.canvas.width)D=!0;else{let G=this._createNewPage();L=G,T=G.currentRow,T.height=C.size.y,D=!0}}D||(L.currentRow.height>0&&L.fixedRows.push(L.currentRow),T={x:0,y:L.currentRow.y+L.currentRow.height,height:C.size.y},L.fixedRows.push(T),L.currentRow={x:0,y:T.y+T.height,height:0})}if(T.x+C.size.x<=L.canvas.width)break;T===L.currentRow?(T.x=0,T.y+=T.height,T.height=0):L.fixedRows.splice(L.fixedRows.indexOf(T),1)}return C.texturePage=this._pages.indexOf(L),C.texturePosition.x=T.x,C.texturePosition.y=T.y,C.texturePositionClipSpace.x=T.x/L.canvas.width,C.texturePositionClipSpace.y=T.y/L.canvas.height,C.sizeClipSpace.x/=L.canvas.width,C.sizeClipSpace.y/=L.canvas.height,T.height=Math.max(T.height,C.size.y),T.x+=C.size.x,L.ctx.putImageData(F,C.texturePosition.x-this._workBoundingBox.left,C.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,C.size.x,C.size.y),L.addGlyph(C),L.version++,C}_findGlyphBoundingBox(t,r,i,o,s,n){r.top=0;let a=o?this._config.deviceCellHeight:this._tmpCanvas.height,u=o?this._config.deviceCellWidth:i,l=!1;for(let d=0;d<a;d++){for(let m=0;m<u;m++){let y=d*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.top=d,l=!0;break}}if(l)break}r.left=0,l=!1;for(let d=0;d<n+u;d++){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+d*4+3;if(t.data[y]!==0){r.left=d,l=!0;break}}if(l)break}r.right=u,l=!1;for(let d=n+u-1;d>=n;d--){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+d*4+3;if(t.data[y]!==0){r.right=d,l=!0;break}}if(l)break}r.bottom=a,l=!1;for(let d=a-1;d>=0;d--){for(let m=0;m<u;m++){let y=d*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.bottom=d,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+n+(o||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+n+(o||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},qn=class{constructor(e,t,r){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],r)for(let i of r)this._glyphs.push(...i.glyphs),this._usedPixels+=i._usedPixels;this.canvas=pc(e,t,t),this.ctx=Ke(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 Kn(e,t,r,i){let o=t.rgba>>>24,s=t.rgba>>>16&255,n=t.rgba>>>8&255,a=r.rgba>>>24,u=r.rgba>>>16&255,l=r.rgba>>>8&255,d=Math.floor((Math.abs(o-a)+Math.abs(s-u)+Math.abs(n-l))/12),m=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===o&&e.data[y+1]===s&&e.data[y+2]===n||i&&Math.abs(e.data[y]-o)+Math.abs(e.data[y+1]-s)+Math.abs(e.data[y+2]-n)<d?e.data[y+3]=0:m=!1;return m}function hp(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function pc(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function dp(e,t,r,i,o,s,n,a){let u={foreground:s.foreground,background:s.background,cursor:wt,cursorAccent:wt,selectionForeground:wt,selectionBackgroundTransparent:wt,selectionBackgroundOpaque:wt,selectionInactiveBackgroundTransparent:wt,selectionInactiveBackgroundOpaque:wt,overviewRulerBorder:wt,scrollbarSliderBackground:wt,scrollbarSliderHoverBackground:wt,scrollbarSliderActiveBackground:wt,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:o.customGlyphs,devicePixelRatio:n,deviceMaxTextureSize:a,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:u}}function wl(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function up(e){return(e&50331648)===16777216||(e&50331648)===33554432}var St=[];function _c(e,t,r,i,o,s,n,a,u){let l=dp(i,o,s,n,t,r,a,u);for(let y=0;y<St.length;y++){let _=St[y],c=_.ownedBy.indexOf(e);if(c>=0){if(wl(_.config,l))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),St.splice(y,1)):_.ownedBy.splice(c,1);break}}for(let y=0;y<St.length;y++){let _=St[y];if(wl(_.config,l))return _.ownedBy.push(e),_.atlas}let d=e._core,m={atlas:new pr(document,l,d.unicodeService),config:l,ownedBy:[e]};return St.push(m),m.atlas}function yl(e){for(let t=0;t<St.length;t++){let r=St[t].ownedBy.indexOf(e);if(r!==-1){St[t].ownedBy.length===1?(St[t].atlas.dispose(),St.splice(t,1)):St[t].ownedBy.splice(r,1);break}}}var Cs=600,fp=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=Cs){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Cs-(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=Cs-(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})},Cs)},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 Sl(e,t,r){let i=new t.ResizeObserver(o=>{let s=o.find(u=>u.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){i?.disconnect(),i=void 0;return}let n=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;n>0&&a>0&&r(n,a)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return tt(()=>i?.disconnect())}function pp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Cl=class mc extends Vr{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new lc,this.combinedData=""}static fromCharData(t){let r=new mc;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?pp(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(i-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gc=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function vc(e,t,r){let i=Ke(e.createProgram());if(e.attachShader(i,Ke(xl(e,e.VERTEX_SHADER,t))),e.attachShader(i,Ke(xl(e,e.FRAGMENT_SHADER,r))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function xl(e,t,r){let i=Ke(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function _p(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let o=0;o<e.length;o++)i[o]=e[o];return i}var mp=class{constructor(e){this.texture=e,this.version=-1}},gp=`#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 gp(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
81
+ }`;function vp(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
82
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 _r=11,qr=_r*Float32Array.BYTES_PER_ELEMENT,vp=2,Ue=0,Ie,Kn=0,Li=0,bp=class extends vt{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._optionsService=i,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;pr.maxAtlasPages===void 0&&(pr.maxAtlasPages=Math.min(32,Ke(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),pr.maxTextureSize=Ke(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=Ke(gc(o,mp,gp(pr.maxAtlasPages))),this._register(tt(()=>o.deleteProgram(this._program))),this._projectionLocation=Ke(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ke(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ke(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(tt(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,s,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=o.createBuffer();this._register(tt(()=>o.deleteBuffer(u))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=Ke(o.createBuffer()),this._register(tt(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,qr,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,qr,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,qr,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,qr,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,qr,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,qr,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let l=new Int32Array(pr.maxAtlasPages);for(let d=0;d<pr.maxAtlasPages;d++)l[d]=d;o.uniform1iv(this._textureLocation,l),o.uniformMatrix4fv(this._projectionLocation,!1,mc),this._atlasTextures=[];for(let d=0;d<pr.maxAtlasPages;d++){let m=new _p(Ke(o.createTexture()));this._register(tt(()=>o.deleteTexture(m.texture))),o.activeTexture(o.TEXTURE0+d),o.bindTexture(o.TEXTURE_2D,m.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[d]=m}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,r,i,o,s,n,a,u){this._updateCell(this._vertices.attributes,e,t,r,i,o,s,n,a,u)}_updateCell(e,t,r,i,o,s,n,a,u,l){if(Ue=(r*this._terminal.cols+t)*_r,i===0||i===void 0){e.fill(0,Ue,Ue+_r-1-vp);return}this._atlas&&(a&&a.length>1?Ie=this._atlas.getRasterizedGlyphCombinedChar(a,o,s,n,!1,this._terminal.element):Ie=this._atlas.getRasterizedGlyph(i,o,s,n,!1,this._terminal.element),Kn=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==l&&Ie.offset.x>Kn?(Li=Ie.offset.x-Kn,e[Ue]=-(Ie.offset.x-Li)+this._dimensions.device.char.left,e[Ue+1]=-Ie.offset.y+this._dimensions.device.char.top,e[Ue+2]=(Ie.size.x-Li)/this._dimensions.device.canvas.width,e[Ue+3]=Ie.size.y/this._dimensions.device.canvas.height,e[Ue+4]=Ie.texturePage,e[Ue+5]=Ie.texturePositionClipSpace.x+Li/this._atlas.pages[Ie.texturePage].canvas.width,e[Ue+6]=Ie.texturePositionClipSpace.y,e[Ue+7]=Ie.sizeClipSpace.x-Li/this._atlas.pages[Ie.texturePage].canvas.width,e[Ue+8]=Ie.sizeClipSpace.y):(e[Ue]=-Ie.offset.x+this._dimensions.device.char.left,e[Ue+1]=-Ie.offset.y+this._dimensions.device.char.top,e[Ue+2]=Ie.size.x/this._dimensions.device.canvas.width,e[Ue+3]=Ie.size.y/this._dimensions.device.canvas.height,e[Ue+4]=Ie.texturePage,e[Ue+5]=Ie.texturePositionClipSpace.x,e[Ue+6]=Ie.texturePositionClipSpace.y,e[Ue+7]=Ie.sizeClipSpace.x,e[Ue+8]=Ie.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Of(i,u,Ie.size.x,this._dimensions.device.cell.width)&&(e[Ue+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*_r;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let r=0;for(;r<this._vertices.attributesBuffers.length;r++)this._vertices.count!==t?this._vertices.attributesBuffers[r]=new Float32Array(t):this._vertices.attributesBuffers[r].fill(0);this._vertices.count=t,r=0;for(let i=0;i<e.rows;i++)for(let o=0;o<e.cols;o++)this._vertices.attributes[r+9]=o/e.cols,this._vertices.attributes[r+10]=i/e.rows,r+=_r}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let r=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let o=0;o<e.lineLengths.length;o++){let s=o*this._terminal.cols*_r,n=this._vertices.attributes.subarray(s,s+e.lineLengths[o]*_r);r.set(n,i),i+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,r.subarray(0,i),t.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(t,this._atlas,o);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,i/_r)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,r){e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[r].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[r].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[r].version=t.pages[r].version}setDimensions(e){this._dimensions=e}},wp=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,s=t[1]-o,n=r[1]-o,a=Math.max(s,0),u=Math.min(n,e.rows-1);if(a>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=s,this.viewportEndRow=n,this.viewportCappedStartRow=a,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function yp(){return new wp}var Bs=4,Ts=1,Ms=2,Gn=3,Sp=2147483648,Cp=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=yp()}resize(e,t){let r=e*t*Bs;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},xp=`#version 300 es
95
+ }`}var _r=11,qr=_r*Float32Array.BYTES_PER_ELEMENT,bp=2,Ue=0,Ie,Gn=0,Li=0,wp=class extends vt{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._optionsService=i,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;pr.maxAtlasPages===void 0&&(pr.maxAtlasPages=Math.min(32,Ke(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),pr.maxTextureSize=Ke(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=Ke(vc(o,gp,vp(pr.maxAtlasPages))),this._register(tt(()=>o.deleteProgram(this._program))),this._projectionLocation=Ke(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ke(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ke(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(tt(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,s,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=o.createBuffer();this._register(tt(()=>o.deleteBuffer(u))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=Ke(o.createBuffer()),this._register(tt(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,qr,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,qr,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,qr,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,qr,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,qr,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,qr,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let l=new Int32Array(pr.maxAtlasPages);for(let d=0;d<pr.maxAtlasPages;d++)l[d]=d;o.uniform1iv(this._textureLocation,l),o.uniformMatrix4fv(this._projectionLocation,!1,gc),this._atlasTextures=[];for(let d=0;d<pr.maxAtlasPages;d++){let m=new mp(Ke(o.createTexture()));this._register(tt(()=>o.deleteTexture(m.texture))),o.activeTexture(o.TEXTURE0+d),o.bindTexture(o.TEXTURE_2D,m.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[d]=m}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,r,i,o,s,n,a,u){this._updateCell(this._vertices.attributes,e,t,r,i,o,s,n,a,u)}_updateCell(e,t,r,i,o,s,n,a,u,l){if(Ue=(r*this._terminal.cols+t)*_r,i===0||i===void 0){e.fill(0,Ue,Ue+_r-1-bp);return}this._atlas&&(a&&a.length>1?Ie=this._atlas.getRasterizedGlyphCombinedChar(a,o,s,n,!1,this._terminal.element):Ie=this._atlas.getRasterizedGlyph(i,o,s,n,!1,this._terminal.element),Gn=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==l&&Ie.offset.x>Gn?(Li=Ie.offset.x-Gn,e[Ue]=-(Ie.offset.x-Li)+this._dimensions.device.char.left,e[Ue+1]=-Ie.offset.y+this._dimensions.device.char.top,e[Ue+2]=(Ie.size.x-Li)/this._dimensions.device.canvas.width,e[Ue+3]=Ie.size.y/this._dimensions.device.canvas.height,e[Ue+4]=Ie.texturePage,e[Ue+5]=Ie.texturePositionClipSpace.x+Li/this._atlas.pages[Ie.texturePage].canvas.width,e[Ue+6]=Ie.texturePositionClipSpace.y,e[Ue+7]=Ie.sizeClipSpace.x-Li/this._atlas.pages[Ie.texturePage].canvas.width,e[Ue+8]=Ie.sizeClipSpace.y):(e[Ue]=-Ie.offset.x+this._dimensions.device.char.left,e[Ue+1]=-Ie.offset.y+this._dimensions.device.char.top,e[Ue+2]=Ie.size.x/this._dimensions.device.canvas.width,e[Ue+3]=Ie.size.y/this._dimensions.device.canvas.height,e[Ue+4]=Ie.texturePage,e[Ue+5]=Ie.texturePositionClipSpace.x,e[Ue+6]=Ie.texturePositionClipSpace.y,e[Ue+7]=Ie.sizeClipSpace.x,e[Ue+8]=Ie.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&If(i,u,Ie.size.x,this._dimensions.device.cell.width)&&(e[Ue+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*_r;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let r=0;for(;r<this._vertices.attributesBuffers.length;r++)this._vertices.count!==t?this._vertices.attributesBuffers[r]=new Float32Array(t):this._vertices.attributesBuffers[r].fill(0);this._vertices.count=t,r=0;for(let i=0;i<e.rows;i++)for(let o=0;o<e.cols;o++)this._vertices.attributes[r+9]=o/e.cols,this._vertices.attributes[r+10]=i/e.rows,r+=_r}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let r=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let o=0;o<e.lineLengths.length;o++){let s=o*this._terminal.cols*_r,n=this._vertices.attributes.subarray(s,s+e.lineLengths[o]*_r);r.set(n,i),i+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,r.subarray(0,i),t.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(t,this._atlas,o);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,i/_r)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,r){e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[r].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[r].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[r].version=t.pages[r].version}setDimensions(e){this._dimensions=e}},yp=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,s=t[1]-o,n=r[1]-o,a=Math.max(s,0),u=Math.min(n,e.rows-1);if(a>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=s,this.viewportEndRow=n,this.viewportCappedStartRow=a,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function Sp(){return new yp}var Bs=4,Ts=1,Ms=2,Vn=3,Cp=2147483648,xp=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Sp()}resize(e,t){let r=e*t*Bs;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},kp=`#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
- }`,kp=`#version 300 es
109
+ }`,Ep=`#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
- }`,er=8,Vn=er*Float32Array.BYTES_PER_ELEMENT,Ep=20*er,xl=class{constructor(){this.attributes=new Float32Array(Ep),this.count=0}},Zt=0,kl=0,El=0,Ll=0,Tl=0,Ml=0,Rl=0,Lp=class extends vt{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new xl,this._verticesCursor=new xl;let o=this._gl;this._program=Ke(gc(o,xp,kp)),this._register(tt(()=>o.deleteProgram(this._program))),this._projectionLocation=Ke(o.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(tt(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,s,o.STATIC_DRAW),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=o.createBuffer();this._register(tt(()=>o.deleteBuffer(u))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=Ke(o.createBuffer()),this._register(tt(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,Vn,0),o.vertexAttribDivisor(0,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Vn,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,Vn,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(l=>{this._updateCachedColors(l),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,mc),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,i=1,o,s,n,a,u,l,d,m,y,_,c;for(o=0;o<t.rows;o++){for(n=-1,a=0,u=0,l=!1,s=0;s<t.cols;s++)d=(o*t.cols+s)*Bs,m=e.cells[d+Ts],y=e.cells[d+Ms],_=!!(y&67108864),(m!==a||y!==u&&(l||_))&&((a!==0||l&&u!==0)&&(c=i++*er,this._updateRectangle(r,c,u,a,n,s,o)),n=s,a=m,u=y,l=_);(a!==0||l&&u!==0)&&(c=i++*er,this._updateRectangle(r,c,u,a,n,t.cols,o))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,o=0;(r.style==="bar"||r.style==="outline")&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),i=o++*er,this._addRectangleFloat(t.attributes,i,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=o}_updateRectangle(e,t,r,i,o,s,n){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:Zt=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Zt=(r&16777215)<<8;break;default:Zt=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Zt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Zt=(i&16777215)<<8;break;default:Zt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=pp(e.attributes,this._terminal.rows*this._terminal.cols*er)),kl=o*this._dimensions.device.cell.width,El=n*this._dimensions.device.cell.height,Ll=(Zt>>24&255)/255,Tl=(Zt>>16&255)/255,Ml=(Zt>>8&255)/255,Rl=1,this._addRectangle(e.attributes,t,kl,El,(s-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Ll,Tl,Ml,Rl)}_addRectangle(e,t,r,i,o,s,n,a,u,l){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=n,e[t+5]=a,e[t+6]=u,e[t+7]=l}_addRectangleFloat(e,t,r,i,o,s,n){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=n[0],e[t+5]=n[1],e[t+6]=n[2],e[t+7]=n[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])}},Tp=class extends vt{constructor(e,t,r,i,o,s,n,a){super(),this._container=t,this._alpha=o,this._coreBrowserService=s,this._optionsService=n,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-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(u=>{this._refreshCharAtlas(e,u),this.reset(e)})),this._register(tt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ke(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,i=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=pc(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,r,i){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,i){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=rc,this._clipCell(r,i,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let i=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${i} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Mp=class extends Tp{constructor(e,t,r,i,o,s,n){super(r,e,"link",t,!0,o,s,n),this._register(i.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(i.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&&dp(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()}},Mt=typeof window=="object"?window:globalThis,fo=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Pe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Pe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};fo.INSTANCE=new fo;var vc=fo;function Rp(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}var Qv=vc.INSTANCE.onDidChangeZoomLevel,e0=vc.INSTANCE.onDidChangeFullscreen,Zr=typeof navigator=="object"?navigator.userAgent:"",t0=Zr.indexOf("Firefox")>=0,Yn=Zr.indexOf("AppleWebKit")>=0,Ap=Zr.indexOf("Chrome")>=0,Dp=!Ap&&Zr.indexOf("Safari")>=0,r0=Zr.indexOf("Electron/")>=0,i0=Zr.indexOf("Android")>=0,Rs=!1;if(typeof Mt.matchMedia=="function"){let e=Mt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Mt.matchMedia("(display-mode: fullscreen)");Rs=e.matches,Rp(Mt,e,({matches:r})=>{Rs&&t.matches||(Rs=r)})}function Pp(){return Rs}var Yr="en",po=!1,_o=!1,As=!1,Bp=!1,bc=!1,wc=!1,Op=!1,Ip=!1,Np=!1,Hp=!1,xs,Ds=Yr,Al=Yr,Fp,Qt,rr=globalThis,gt;typeof rr.vscode<"u"&&typeof rr.vscode.process<"u"?gt=rr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(gt=process);var yc=typeof gt?.versions?.electron=="string",Wp=yc&&gt?.type==="renderer";if(typeof gt=="object"){po=gt.platform==="win32",_o=gt.platform==="darwin",As=gt.platform==="linux",Bp=As&&!!gt.env.SNAP&&!!gt.env.SNAP_REVISION,Op=yc,Np=!!gt.env.CI||!!gt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,xs=Yr,Ds=Yr;let e=gt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);xs=t.userLocale,Al=t.osLocale,Ds=t.resolvedLanguage||Yr,Fp=t.languagePack?.translationsConfigFile}catch{}bc=!0}else typeof navigator=="object"&&!Wp?(Qt=navigator.userAgent,po=Qt.indexOf("Windows")>=0,_o=Qt.indexOf("Macintosh")>=0,Ip=(Qt.indexOf("Macintosh")>=0||Qt.indexOf("iPad")>=0||Qt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,As=Qt.indexOf("Linux")>=0,Hp=Qt?.indexOf("Mobi")>=0,wc=!0,Ds=globalThis._VSCODE_NLS_LANGUAGE||Yr,xs=navigator.language.toLowerCase(),Al=xs):console.error("Unable to resolve platform.");var Jn=0;_o?Jn=1:po?Jn=3:As&&(Jn=2);var Xn=bc,jp=wc&&typeof rr.importScripts=="function",s0=jp?rr.origin:void 0,Wt=Qt,ur=Ds,Dl;(e=>{function t(){return ur}e.value=t;function r(){return ur.length===2?ur==="en":ur.length>=3?ur[0]==="e"&&ur[1]==="n"&&ur[2]==="-":!1}e.isDefaultVariant=r;function i(){return ur==="en"}e.isDefault=i})(Dl||(Dl={}));var zp=typeof rr.postMessage=="function"&&!rr.importScripts,Up=(()=>{if(zp){let e=[];rr.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,o=e.length;i<o;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),rr.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),$p=!!(Wt&&Wt.indexOf("Chrome")>=0),n0=!!(Wt&&Wt.indexOf("Firefox")>=0),o0=!!(!$p&&Wt&&Wt.indexOf("Safari")>=0),a0=!!(Wt&&Wt.indexOf("Edg/")>=0),l0=!!(Wt&&Wt.indexOf("Android")>=0),fr=typeof navigator=="object"?navigator:{},c0={clipboard:{writeText:Xn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(fr&&fr.clipboard&&fr.clipboard.writeText),readText:Xn||!!(fr&&fr.clipboard&&fr.clipboard.readText)},keyboard:Xn||Pp()?0:fr.keyboard||Dp?1:2,touch:"ontouchstart"in Mt||fr.maxTouchPoints>0,pointerEvents:Mt.PointerEvent&&("ontouchstart"in Mt||navigator.maxTouchPoints>0)},wo=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}},Zn=new wo,Pl=new wo,Bl=new wo,h0=new Array(230),Ol;(e=>{function t(a){return Zn.keyCodeToStr(a)}e.toString=t;function r(a){return Zn.strToKeyCode(a)}e.fromString=r;function i(a){return Pl.keyCodeToStr(a)}e.toUserSettingsUS=i;function o(a){return Bl.keyCodeToStr(a)}e.toUserSettingsGeneral=o;function s(a){return Pl.strToKeyCode(a)||Bl.strToKeyCode(a)}e.fromUserSettings=s;function n(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 Zn.keyCodeToStr(a)}e.toElectronAccelerator=n})(Ol||(Ol={}));var Sc=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Il;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof qp?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ft.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Sc})})(Il||(Il={}));var qp=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?Sc:(this._emitter||(this._emitter=new Pe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Kp,Qn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Qn=(e,t)=>{Up(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:Qn=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Kp=e=>Qn(globalThis,e)})();var Nl;(e=>{async function t(i){let o,s=await Promise.all(i.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return s}e.settled=t;function r(i){return new Promise(async(o,s)=>{try{await i(o,s)}catch(n){s(n)}})}e.withAsyncBody=r})(Nl||(Nl={}));var Hl=class yt{static fromArray(t){return new yt(r=>{r.emitMany(t)})}static fromPromise(t){return new yt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new yt(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new yt(async r=>{await Promise.all(t.map(async i=>{for await(let o of i)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Pe,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 Ft.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new yt(async i=>{for await(let o of t)i.emitOne(r(o))})}map(t){return yt.map(this,t)}static filter(t,r){return new yt(async i=>{for await(let o of t)r(o)&&i.emitOne(o)})}filter(t){return yt.filter(this,t)}static coalesce(t){return yt.filter(t,r=>!!r)}coalesce(){return yt.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return yt.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())}};Hl.EMPTY=Hl.fromArray([]);function Gp(e){return 55296<=e&&e<=56319}function Fl(e){return 56320<=e&&e<=57343}function Vp(e,t){return(e-55296<<10)+(t-56320)+65536}function Yp(e){return yo(e,0)}function yo(e,t){switch(typeof e){case"object":return e===null?tr(349,t):Array.isArray(e)?Xp(e,t):Zp(e,t);case"string":return Cc(e,t);case"boolean":return Jp(e,t);case"number":return tr(e,t);case"undefined":return tr(937,t);default:return tr(617,t)}}function tr(e,t){return(t<<5)-t+e|0}function Jp(e,t){return tr(e?433:863,t)}function Cc(e,t){t=tr(149417,t);for(let r=0,i=e.length;r<i;r++)t=tr(e.charCodeAt(r),t);return t}function Xp(e,t){return t=tr(104579,t),e.reduce((r,i)=>yo(i,r),t)}function Zp(e,t){return t=tr(181387,t),Object.keys(e).sort().reduce((r,i)=>(r=Cc(i,r),yo(e[i],r)),t)}function eo(e,t,r=32){let i=r-t,o=~((1<<i)-1);return(e<<t|(o&e)>>>i)>>>0}function Wl(e,t=0,r=e.byteLength,i=0){for(let o=0;o<r;o++)e[t+o]=i}function Qp(e,t,r="0"){for(;e.length<t;)e=r+e;return e}function Ti(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""):Qp((e>>>0).toString(16),t/4)}var e_=class xc{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let r=t.length;if(r===0)return;let i=this._buff,o=this._buffLen,s=this._leftoverHighSurrogate,n,a;for(s!==0?(n=s,a=-1,s=0):(n=t.charCodeAt(0),a=0);;){let u=n;if(Gp(n))if(a+1<r){let l=t.charCodeAt(a+1);Fl(l)?(a++,u=Vp(n,l)):u=65533}else{s=n;break}else Fl(n)&&(u=65533);if(o=this._push(i,o,u),a++,a<r)n=t.charCodeAt(a);else break}this._buffLen=o,this._leftoverHighSurrogate=s}_push(t,r,i){return i<128?t[r++]=i:i<2048?(t[r++]=192|(i&1984)>>>6,t[r++]=128|(i&63)>>>0):i<65536?(t[r++]=224|(i&61440)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0):(t[r++]=240|(i&1835008)>>>18,t[r++]=128|(i&258048)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0),r>=64&&(this._step(),r-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),r}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Ti(this._h0)+Ti(this._h1)+Ti(this._h2)+Ti(this._h3)+Ti(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Wl(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Wl(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=xc._bigBlock32,r=this._buffDV;for(let m=0;m<64;m+=4)t.setUint32(m,r.getUint32(m,!1),!1);for(let m=64;m<320;m+=4)t.setUint32(m,eo(t.getUint32(m-12,!1)^t.getUint32(m-32,!1)^t.getUint32(m-56,!1)^t.getUint32(m-64,!1),1),!1);let i=this._h0,o=this._h1,s=this._h2,n=this._h3,a=this._h4,u,l,d;for(let m=0;m<80;m++)m<20?(u=o&s|~o&n,l=1518500249):m<40?(u=o^s^n,l=1859775393):m<60?(u=o&s|o&n|s&n,l=2400959708):(u=o^s^n,l=3395469782),d=eo(i,5)+u+a+l+t.getUint32(m*4,!1)&4294967295,a=n,n=s,s=eo(o,30),o=i,i=d;this._h0=this._h0+i&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+n&4294967295,this._h4=this._h4+a&4294967295}};e_._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:d0,getWindow:t_,getDocument:u0,getWindows:f0,getWindowsCount:p0,getWindowId:jl,getWindowById:_0,hasWindow:m0,onDidRegisterWindow:g0,onWillUnregisterWindow:v0,onDidUnregisterWindow:b0}=(function(){let e=new Map,t={window:Mt,disposables:new Jr};e.set(Mt.vscodeWindowId,t);let r=new Pe,i=new Pe,o=new Pe;function s(n,a){return(typeof n=="number"?e.get(n):void 0)??(a?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:i.event,registerWindow(n){if(e.has(n.vscodeWindowId))return vt.None;let a=new Jr,u={window:n,disposables:a.add(new Jr)};return e.set(n.vscodeWindowId,u),a.add(tt(()=>{e.delete(n.vscodeWindowId),i.fire(n)})),a.add(mo(n,s_.BEFORE_UNLOAD,()=>{o.fire(n)})),r.fire(u),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:s,getWindow(n){let a=n;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let u=n;return u?.view?u.view.window:Mt},getDocument(n){return t_(n).document}}})(),r_=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!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 mo(e,t,r,i){return new r_(e,t,r,i)}var i_,zl,to=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){ks(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,o=s=>{r.set(s,!1);let n=e.get(s)??[];for(t.set(s,n),e.set(s,[]),i.set(s,!0);n.length>0;)n.sort(to.sort),n.shift().execute();i.set(s,!1)};zl=(s,n,a=0)=>{let u=jl(s),l=new to(n,a),d=e.get(u);return d||(d=[],e.set(u,d)),d.push(l),r.get(u)||(r.set(u,!0),s.requestAnimationFrame(()=>o(u))),l},i_=(s,n,a)=>{let u=jl(s);if(i.get(u)){let l=new to(n,a),d=t.get(u);return d||(d=[],t.set(u,d)),d.push(l),l}else return zl(s,n,a)}})();var Ul=class Ps{constructor(t,r){this.width=t,this.height=r}with(t=this.width,r=this.height){return t!==this.width||r!==this.height?new Ps(t,r):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Ps?t:new Ps(t.width,t.height)}static equals(t,r){return t===r?!0:!t||!r?!1:t.width===r.width&&t.height===r.height}};Ul.None=new Ul(0,0);var w0=new class{constructor(){this.mutationObservers=new Map}observe(e,t,r){let i=this.mutationObservers.get(e);i||(i=new Map,this.mutationObservers.set(e,i));let o=Yp(r),s=i.get(o);if(s)s.users+=1;else{let n=new Pe,a=new MutationObserver(l=>n.fire(l));a.observe(e,r);let u=s={users:1,observer:a,onDidMutate:n.event};t.add(tt(()=>{u.users-=1,u.users===0&&(n.dispose(),a.disconnect(),i?.delete(o),i?.size===0&&this.mutationObservers.delete(e))})),i.set(o,s)}return s.onDidMutate}},s_={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:Yn?"webkitAnimationStart":"animationstart",ANIMATION_END:Yn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Yn?"webkitAnimationIteration":"animationiteration"},n_=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function kc(e,t,r,...i){let o=n_.exec(t);if(!o)throw new Error("Bad use of emmet");let s=o[1]||"div",n;return e!=="http://www.w3.org/1999/xhtml"?n=document.createElementNS(e,s):n=document.createElement(s),o[3]&&(n.id=o[3]),o[4]&&(n.className=o[4].replace(/\./g," ").trim()),r&&Object.entries(r).forEach(([a,u])=>{typeof u>"u"||(/^on\w+$/.test(a)?n[a]=u:a==="selected"?u&&n.setAttribute(a,"true"):n.setAttribute(a,u))}),n.append(...i),n}function o_(e,t,...r){return kc("http://www.w3.org/1999/xhtml",e,t,...r)}o_.SVG=function(e,t,...r){return kc("http://www.w3.org/2000/svg",e,t,...r)};var a_=class extends vt{constructor(e,t,r,i,o,s,n,a,u){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=i,this._coreService=o,this._decorationService=s,this._optionsService=n,this._themeService=a,this._cursorBlinkStateManager=new xi,this._charAtlasDisposable=this._register(new xi),this._observerDisposable=this._register(new xi),this._model=new Cp,this._workCell=new Sl,this._workCell2=new Sl,this._rectangleRenderer=this._register(new xi),this._glyphRenderer=this._register(new xi),this._onChangeTextureAtlas=this._register(new Pe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Pe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Pe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Pe),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Pe),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:u};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Hf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Mp(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,n,this._themeService)],this.dimensions=If(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(n.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(mo(this._canvas,"webglcontextlost",d=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3e3)})),this._register(mo(this._canvas,"webglcontextrestored",d=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,wl(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=yl(this._canvas,this._coreBrowserService.window,(d,m)=>this._setCanvasDevicePixelDimensions(d,m)),this._register(this._coreBrowserService.onWindowChange(d=>{this._observerDisposable.value=yl(this._canvas,d,(m,y)=>this._setCanvasDevicePixelDimensions(m,y))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(tt(()=>{for(let d of this._renderLayers)d.dispose();this._canvas.parentElement?.removeChild(this._canvas),wl(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let r of this._renderLayers)r.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,r){for(let i of this._renderLayers)i.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Lp(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new bp(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=pc(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=Xl(Ft.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ft.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let r of this._renderLayers)r.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new up(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,i=this._workCell,o,s,n,a,u,l,d=0,m=!0,y,_,c,f,h,p,g,S,b;e=$l(e,r.rows-1,0),t=$l(t,r.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",w=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,E=w-r.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),P=-1,W=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(n=s+r.buffer.ydisp,a=r.buffer.lines.get(n),this._model.lineLengths[s]=0,c=w===n,d=0,u=this._characterJoinerService.getJoinedCharacters(n),S=0;S<r.cols;S++){if(o=this._cellColorResolver.result.bg,a.loadCell(S,i),S===0&&(o=this._cellColorResolver.result.bg),l=!1,m=S>=d,y=S,u.length>0&&S===u[0][0]&&m){_=u.shift();let V=this._model.selection.isCellSelected(this._terminal,_[0],n);for(g=_[0]+1;g<_[1];g++)m&&(m=V===this._model.selection.isCellSelected(this._terminal,g,n));m&&(m=!c||B<_[0]||B>=_[1]),m?(l=!0,i=new l_(i,a.translateToString(!0,_[0],_[1]),_[1]-_[0]),y=_[1]-1):d=_[1]}if(f=i.getChars(),h=i.getCode(),g=(s*r.cols+S)*Bs,this._cellColorResolver.resolve(i,S,n,this.dimensions.device.cell.width),W&&n===w&&(S===B&&(this._model.cursor={x:B,y:E,width:i.getWidth(),style:this._coreBrowserService.isFocused?x:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},P=B+i.getWidth()-1),S>=B&&S<=P&&(this._coreBrowserService.isFocused&&x==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),h!==0&&(this._model.lineLengths[s]=S+1),!(this._model.cells[g]===h&&this._model.cells[g+Ts]===this._cellColorResolver.result.bg&&this._model.cells[g+Ms]===this._cellColorResolver.result.fg&&this._model.cells[g+Gn]===this._cellColorResolver.result.ext)&&(A=!0,f.length>1&&(h|=Sp),this._model.cells[g]=h,this._model.cells[g+Ts]=this._cellColorResolver.result.bg,this._model.cells[g+Ms]=this._cellColorResolver.result.fg,this._model.cells[g+Gn]=this._cellColorResolver.result.ext,p=i.getWidth(),this._glyphRenderer.value.updateCell(S,s,h,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,f,p,o),l)){for(i=this._workCell,S++;S<=y;S++)b=(s*r.cols+S)*Bs,this._glyphRenderer.value.updateCell(S,s,0,0,0,0,Rf,0,0),this._model.cells[b]=0,this._model.cells[b+Ts]=this._cellColorResolver.result.bg,this._model.cells[b+Ms]=this._cellColorResolver.result.fg,this._model.cells[b+Gn]=this._cellColorResolver.result.ext;S--}}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})}},l_=class extends Vr{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function $l(e,t,r=0){return Math.max(Math.min(e,t),r)}var ql="di$target",Kl="di$dependencies",ro=new Map;function jt(e){if(ro.has(e))return ro.get(e);let t=function(r,i,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");c_(t,r,o)};return t._id=e,ro.set(e,t),t}function c_(e,t,r){t[ql]===t?t[Kl].push({id:e,index:r}):(t[Kl]=[{id:e,index:r}],t[ql]=t)}var y0=jt("BufferService"),S0=jt("CoreMouseService"),C0=jt("CoreService"),x0=jt("CharsetService"),k0=jt("InstantiationService"),E0=jt("LogService"),h_=jt("OptionsService"),L0=jt("OscLinkService"),T0=jt("UnicodeService"),M0=jt("DecorationService"),d_={trace:0,debug:1,info:2,warn:3,error:4,off:5},u_="xterm.js: ",Gl=class extends vt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Ec=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=d_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":u_)+t,...r)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Gl=hf([df(0,h_)],Gl);var Ec;function f_(e){Ec=e}var Lc=class extends vt{constructor(e){if(ec&&Mf()<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 Pe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Pe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Pe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Pe),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,i=t.optionsService,o=t,s=o._renderService,n=o._characterJoinerService,a=o._charSizeService,u=o._coreBrowserService,l=o._decorationService,d=o._logService,m=o._themeService;f_(d),this._renderer=this._register(new a_(e,n,a,u,r,l,i,m,this._preserveDrawingBuffer)),this._register(Ft.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ft.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ft.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ft.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(tt(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Tc=`/**
118
+ }`,er=8,Yn=er*Float32Array.BYTES_PER_ELEMENT,Lp=20*er,kl=class{constructor(){this.attributes=new Float32Array(Lp),this.count=0}},Zt=0,El=0,Ll=0,Tl=0,Ml=0,Rl=0,Al=0,Tp=class extends vt{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new kl,this._verticesCursor=new kl;let o=this._gl;this._program=Ke(vc(o,kp,Ep)),this._register(tt(()=>o.deleteProgram(this._program))),this._projectionLocation=Ke(o.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(tt(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,s,o.STATIC_DRAW),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=o.createBuffer();this._register(tt(()=>o.deleteBuffer(u))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=Ke(o.createBuffer()),this._register(tt(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,Yn,0),o.vertexAttribDivisor(0,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Yn,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,Yn,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(l=>{this._updateCachedColors(l),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,gc),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,i=1,o,s,n,a,u,l,d,m,y,_,c;for(o=0;o<t.rows;o++){for(n=-1,a=0,u=0,l=!1,s=0;s<t.cols;s++)d=(o*t.cols+s)*Bs,m=e.cells[d+Ts],y=e.cells[d+Ms],_=!!(y&67108864),(m!==a||y!==u&&(l||_))&&((a!==0||l&&u!==0)&&(c=i++*er,this._updateRectangle(r,c,u,a,n,s,o)),n=s,a=m,u=y,l=_);(a!==0||l&&u!==0)&&(c=i++*er,this._updateRectangle(r,c,u,a,n,t.cols,o))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,o=0;(r.style==="bar"||r.style==="outline")&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),i=o++*er,this._addRectangleFloat(t.attributes,i,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=o}_updateRectangle(e,t,r,i,o,s,n){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:Zt=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Zt=(r&16777215)<<8;break;default:Zt=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Zt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Zt=(i&16777215)<<8;break;default:Zt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=_p(e.attributes,this._terminal.rows*this._terminal.cols*er)),El=o*this._dimensions.device.cell.width,Ll=n*this._dimensions.device.cell.height,Tl=(Zt>>24&255)/255,Ml=(Zt>>16&255)/255,Rl=(Zt>>8&255)/255,Al=1,this._addRectangle(e.attributes,t,El,Ll,(s-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Tl,Ml,Rl,Al)}_addRectangle(e,t,r,i,o,s,n,a,u,l){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=n,e[t+5]=a,e[t+6]=u,e[t+7]=l}_addRectangleFloat(e,t,r,i,o,s,n){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=n[0],e[t+5]=n[1],e[t+6]=n[2],e[t+7]=n[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])}},Mp=class extends vt{constructor(e,t,r,i,o,s,n,a){super(),this._container=t,this._alpha=o,this._coreBrowserService=s,this._optionsService=n,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-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(u=>{this._refreshCharAtlas(e,u),this.reset(e)})),this._register(tt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ke(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,i=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=_c(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,r,i){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,i){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ic,this._clipCell(r,i,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let i=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${i} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Rp=class extends Mp{constructor(e,t,r,i,o,s,n){super(r,e,"link",t,!0,o,s,n),this._register(i.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(i.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&&up(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()}},Mt=typeof window=="object"?window:globalThis,po=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Pe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Pe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};po.INSTANCE=new po;var bc=po;function Ap(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}var e0=bc.INSTANCE.onDidChangeZoomLevel,t0=bc.INSTANCE.onDidChangeFullscreen,Zr=typeof navigator=="object"?navigator.userAgent:"",r0=Zr.indexOf("Firefox")>=0,Jn=Zr.indexOf("AppleWebKit")>=0,Dp=Zr.indexOf("Chrome")>=0,Pp=!Dp&&Zr.indexOf("Safari")>=0,i0=Zr.indexOf("Electron/")>=0,s0=Zr.indexOf("Android")>=0,Rs=!1;if(typeof Mt.matchMedia=="function"){let e=Mt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Mt.matchMedia("(display-mode: fullscreen)");Rs=e.matches,Ap(Mt,e,({matches:r})=>{Rs&&t.matches||(Rs=r)})}function Bp(){return Rs}var Yr="en",_o=!1,mo=!1,As=!1,Op=!1,wc=!1,yc=!1,Ip=!1,Np=!1,Hp=!1,Fp=!1,xs,Ds=Yr,Dl=Yr,Wp,Qt,rr=globalThis,gt;typeof rr.vscode<"u"&&typeof rr.vscode.process<"u"?gt=rr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(gt=process);var Sc=typeof gt?.versions?.electron=="string",jp=Sc&&gt?.type==="renderer";if(typeof gt=="object"){_o=gt.platform==="win32",mo=gt.platform==="darwin",As=gt.platform==="linux",Op=As&&!!gt.env.SNAP&&!!gt.env.SNAP_REVISION,Ip=Sc,Hp=!!gt.env.CI||!!gt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,xs=Yr,Ds=Yr;let e=gt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);xs=t.userLocale,Dl=t.osLocale,Ds=t.resolvedLanguage||Yr,Wp=t.languagePack?.translationsConfigFile}catch{}wc=!0}else typeof navigator=="object"&&!jp?(Qt=navigator.userAgent,_o=Qt.indexOf("Windows")>=0,mo=Qt.indexOf("Macintosh")>=0,Np=(Qt.indexOf("Macintosh")>=0||Qt.indexOf("iPad")>=0||Qt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,As=Qt.indexOf("Linux")>=0,Fp=Qt?.indexOf("Mobi")>=0,yc=!0,Ds=globalThis._VSCODE_NLS_LANGUAGE||Yr,xs=navigator.language.toLowerCase(),Dl=xs):console.error("Unable to resolve platform.");var Xn=0;mo?Xn=1:_o?Xn=3:As&&(Xn=2);var Zn=wc,zp=yc&&typeof rr.importScripts=="function",n0=zp?rr.origin:void 0,Wt=Qt,ur=Ds,Pl;(e=>{function t(){return ur}e.value=t;function r(){return ur.length===2?ur==="en":ur.length>=3?ur[0]==="e"&&ur[1]==="n"&&ur[2]==="-":!1}e.isDefaultVariant=r;function i(){return ur==="en"}e.isDefault=i})(Pl||(Pl={}));var Up=typeof rr.postMessage=="function"&&!rr.importScripts,$p=(()=>{if(Up){let e=[];rr.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,o=e.length;i<o;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),rr.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),qp=!!(Wt&&Wt.indexOf("Chrome")>=0),o0=!!(Wt&&Wt.indexOf("Firefox")>=0),a0=!!(!qp&&Wt&&Wt.indexOf("Safari")>=0),l0=!!(Wt&&Wt.indexOf("Edg/")>=0),c0=!!(Wt&&Wt.indexOf("Android")>=0),fr=typeof navigator=="object"?navigator:{},h0={clipboard:{writeText:Zn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(fr&&fr.clipboard&&fr.clipboard.writeText),readText:Zn||!!(fr&&fr.clipboard&&fr.clipboard.readText)},keyboard:Zn||Bp()?0:fr.keyboard||Pp?1:2,touch:"ontouchstart"in Mt||fr.maxTouchPoints>0,pointerEvents:Mt.PointerEvent&&("ontouchstart"in Mt||navigator.maxTouchPoints>0)},yo=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}},Qn=new yo,Bl=new yo,Ol=new yo,d0=new Array(230),Il;(e=>{function t(a){return Qn.keyCodeToStr(a)}e.toString=t;function r(a){return Qn.strToKeyCode(a)}e.fromString=r;function i(a){return Bl.keyCodeToStr(a)}e.toUserSettingsUS=i;function o(a){return Ol.keyCodeToStr(a)}e.toUserSettingsGeneral=o;function s(a){return Bl.strToKeyCode(a)||Ol.strToKeyCode(a)}e.fromUserSettings=s;function n(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 Qn.keyCodeToStr(a)}e.toElectronAccelerator=n})(Il||(Il={}));var Cc=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Nl;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Kp?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ft.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Cc})})(Nl||(Nl={}));var Kp=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?Cc:(this._emitter||(this._emitter=new Pe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Gp,eo;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?eo=(e,t)=>{$p(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:eo=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Gp=e=>eo(globalThis,e)})();var Hl;(e=>{async function t(i){let o,s=await Promise.all(i.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return s}e.settled=t;function r(i){return new Promise(async(o,s)=>{try{await i(o,s)}catch(n){s(n)}})}e.withAsyncBody=r})(Hl||(Hl={}));var Fl=class yt{static fromArray(t){return new yt(r=>{r.emitMany(t)})}static fromPromise(t){return new yt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new yt(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new yt(async r=>{await Promise.all(t.map(async i=>{for await(let o of i)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Pe,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 Ft.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new yt(async i=>{for await(let o of t)i.emitOne(r(o))})}map(t){return yt.map(this,t)}static filter(t,r){return new yt(async i=>{for await(let o of t)r(o)&&i.emitOne(o)})}filter(t){return yt.filter(this,t)}static coalesce(t){return yt.filter(t,r=>!!r)}coalesce(){return yt.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return yt.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())}};Fl.EMPTY=Fl.fromArray([]);function Vp(e){return 55296<=e&&e<=56319}function Wl(e){return 56320<=e&&e<=57343}function Yp(e,t){return(e-55296<<10)+(t-56320)+65536}function Jp(e){return So(e,0)}function So(e,t){switch(typeof e){case"object":return e===null?tr(349,t):Array.isArray(e)?Zp(e,t):Qp(e,t);case"string":return xc(e,t);case"boolean":return Xp(e,t);case"number":return tr(e,t);case"undefined":return tr(937,t);default:return tr(617,t)}}function tr(e,t){return(t<<5)-t+e|0}function Xp(e,t){return tr(e?433:863,t)}function xc(e,t){t=tr(149417,t);for(let r=0,i=e.length;r<i;r++)t=tr(e.charCodeAt(r),t);return t}function Zp(e,t){return t=tr(104579,t),e.reduce((r,i)=>So(i,r),t)}function Qp(e,t){return t=tr(181387,t),Object.keys(e).sort().reduce((r,i)=>(r=xc(i,r),So(e[i],r)),t)}function to(e,t,r=32){let i=r-t,o=~((1<<i)-1);return(e<<t|(o&e)>>>i)>>>0}function jl(e,t=0,r=e.byteLength,i=0){for(let o=0;o<r;o++)e[t+o]=i}function e_(e,t,r="0"){for(;e.length<t;)e=r+e;return e}function Ti(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""):e_((e>>>0).toString(16),t/4)}var t_=class kc{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let r=t.length;if(r===0)return;let i=this._buff,o=this._buffLen,s=this._leftoverHighSurrogate,n,a;for(s!==0?(n=s,a=-1,s=0):(n=t.charCodeAt(0),a=0);;){let u=n;if(Vp(n))if(a+1<r){let l=t.charCodeAt(a+1);Wl(l)?(a++,u=Yp(n,l)):u=65533}else{s=n;break}else Wl(n)&&(u=65533);if(o=this._push(i,o,u),a++,a<r)n=t.charCodeAt(a);else break}this._buffLen=o,this._leftoverHighSurrogate=s}_push(t,r,i){return i<128?t[r++]=i:i<2048?(t[r++]=192|(i&1984)>>>6,t[r++]=128|(i&63)>>>0):i<65536?(t[r++]=224|(i&61440)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0):(t[r++]=240|(i&1835008)>>>18,t[r++]=128|(i&258048)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0),r>=64&&(this._step(),r-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),r}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Ti(this._h0)+Ti(this._h1)+Ti(this._h2)+Ti(this._h3)+Ti(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,jl(this._buff,this._buffLen),this._buffLen>56&&(this._step(),jl(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=kc._bigBlock32,r=this._buffDV;for(let m=0;m<64;m+=4)t.setUint32(m,r.getUint32(m,!1),!1);for(let m=64;m<320;m+=4)t.setUint32(m,to(t.getUint32(m-12,!1)^t.getUint32(m-32,!1)^t.getUint32(m-56,!1)^t.getUint32(m-64,!1),1),!1);let i=this._h0,o=this._h1,s=this._h2,n=this._h3,a=this._h4,u,l,d;for(let m=0;m<80;m++)m<20?(u=o&s|~o&n,l=1518500249):m<40?(u=o^s^n,l=1859775393):m<60?(u=o&s|o&n|s&n,l=2400959708):(u=o^s^n,l=3395469782),d=to(i,5)+u+a+l+t.getUint32(m*4,!1)&4294967295,a=n,n=s,s=to(o,30),o=i,i=d;this._h0=this._h0+i&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+n&4294967295,this._h4=this._h4+a&4294967295}};t_._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:u0,getWindow:r_,getDocument:f0,getWindows:p0,getWindowsCount:_0,getWindowId:zl,getWindowById:m0,hasWindow:g0,onDidRegisterWindow:v0,onWillUnregisterWindow:b0,onDidUnregisterWindow:w0}=(function(){let e=new Map,t={window:Mt,disposables:new Jr};e.set(Mt.vscodeWindowId,t);let r=new Pe,i=new Pe,o=new Pe;function s(n,a){return(typeof n=="number"?e.get(n):void 0)??(a?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:i.event,registerWindow(n){if(e.has(n.vscodeWindowId))return vt.None;let a=new Jr,u={window:n,disposables:a.add(new Jr)};return e.set(n.vscodeWindowId,u),a.add(tt(()=>{e.delete(n.vscodeWindowId),i.fire(n)})),a.add(go(n,n_.BEFORE_UNLOAD,()=>{o.fire(n)})),r.fire(u),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:s,getWindow(n){let a=n;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let u=n;return u?.view?u.view.window:Mt},getDocument(n){return r_(n).document}}})(),i_=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!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 go(e,t,r,i){return new i_(e,t,r,i)}var s_,Ul,ro=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){ks(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,o=s=>{r.set(s,!1);let n=e.get(s)??[];for(t.set(s,n),e.set(s,[]),i.set(s,!0);n.length>0;)n.sort(ro.sort),n.shift().execute();i.set(s,!1)};Ul=(s,n,a=0)=>{let u=zl(s),l=new ro(n,a),d=e.get(u);return d||(d=[],e.set(u,d)),d.push(l),r.get(u)||(r.set(u,!0),s.requestAnimationFrame(()=>o(u))),l},s_=(s,n,a)=>{let u=zl(s);if(i.get(u)){let l=new ro(n,a),d=t.get(u);return d||(d=[],t.set(u,d)),d.push(l),l}else return Ul(s,n,a)}})();var $l=class Ps{constructor(t,r){this.width=t,this.height=r}with(t=this.width,r=this.height){return t!==this.width||r!==this.height?new Ps(t,r):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Ps?t:new Ps(t.width,t.height)}static equals(t,r){return t===r?!0:!t||!r?!1:t.width===r.width&&t.height===r.height}};$l.None=new $l(0,0);var y0=new class{constructor(){this.mutationObservers=new Map}observe(e,t,r){let i=this.mutationObservers.get(e);i||(i=new Map,this.mutationObservers.set(e,i));let o=Jp(r),s=i.get(o);if(s)s.users+=1;else{let n=new Pe,a=new MutationObserver(l=>n.fire(l));a.observe(e,r);let u=s={users:1,observer:a,onDidMutate:n.event};t.add(tt(()=>{u.users-=1,u.users===0&&(n.dispose(),a.disconnect(),i?.delete(o),i?.size===0&&this.mutationObservers.delete(e))})),i.set(o,s)}return s.onDidMutate}},n_={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:Jn?"webkitAnimationStart":"animationstart",ANIMATION_END:Jn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Jn?"webkitAnimationIteration":"animationiteration"},o_=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Ec(e,t,r,...i){let o=o_.exec(t);if(!o)throw new Error("Bad use of emmet");let s=o[1]||"div",n;return e!=="http://www.w3.org/1999/xhtml"?n=document.createElementNS(e,s):n=document.createElement(s),o[3]&&(n.id=o[3]),o[4]&&(n.className=o[4].replace(/\./g," ").trim()),r&&Object.entries(r).forEach(([a,u])=>{typeof u>"u"||(/^on\w+$/.test(a)?n[a]=u:a==="selected"?u&&n.setAttribute(a,"true"):n.setAttribute(a,u))}),n.append(...i),n}function a_(e,t,...r){return Ec("http://www.w3.org/1999/xhtml",e,t,...r)}a_.SVG=function(e,t,...r){return Ec("http://www.w3.org/2000/svg",e,t,...r)};var l_=class extends vt{constructor(e,t,r,i,o,s,n,a,u){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=i,this._coreService=o,this._decorationService=s,this._optionsService=n,this._themeService=a,this._cursorBlinkStateManager=new xi,this._charAtlasDisposable=this._register(new xi),this._observerDisposable=this._register(new xi),this._model=new xp,this._workCell=new Cl,this._workCell2=new Cl,this._rectangleRenderer=this._register(new xi),this._glyphRenderer=this._register(new xi),this._onChangeTextureAtlas=this._register(new Pe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Pe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Pe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Pe),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Pe),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:u};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Ff(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Rp(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,n,this._themeService)],this.dimensions=Nf(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(n.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(go(this._canvas,"webglcontextlost",d=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3e3)})),this._register(go(this._canvas,"webglcontextrestored",d=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,yl(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Sl(this._canvas,this._coreBrowserService.window,(d,m)=>this._setCanvasDevicePixelDimensions(d,m)),this._register(this._coreBrowserService.onWindowChange(d=>{this._observerDisposable.value=Sl(this._canvas,d,(m,y)=>this._setCanvasDevicePixelDimensions(m,y))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(tt(()=>{for(let d of this._renderLayers)d.dispose();this._canvas.parentElement?.removeChild(this._canvas),yl(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let r of this._renderLayers)r.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,r){for(let i of this._renderLayers)i.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Tp(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new wp(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=_c(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=Zl(Ft.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ft.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let r of this._renderLayers)r.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new fp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,i=this._workCell,o,s,n,a,u,l,d=0,m=!0,y,_,c,f,h,p,v,S,b;e=ql(e,r.rows-1,0),t=ql(t,r.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",w=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,E=w-r.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),P=-1,W=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(n=s+r.buffer.ydisp,a=r.buffer.lines.get(n),this._model.lineLengths[s]=0,c=w===n,d=0,u=this._characterJoinerService.getJoinedCharacters(n),S=0;S<r.cols;S++){if(o=this._cellColorResolver.result.bg,a.loadCell(S,i),S===0&&(o=this._cellColorResolver.result.bg),l=!1,m=S>=d,y=S,u.length>0&&S===u[0][0]&&m){_=u.shift();let V=this._model.selection.isCellSelected(this._terminal,_[0],n);for(v=_[0]+1;v<_[1];v++)m&&(m=V===this._model.selection.isCellSelected(this._terminal,v,n));m&&(m=!c||B<_[0]||B>=_[1]),m?(l=!0,i=new c_(i,a.translateToString(!0,_[0],_[1]),_[1]-_[0]),y=_[1]-1):d=_[1]}if(f=i.getChars(),h=i.getCode(),v=(s*r.cols+S)*Bs,this._cellColorResolver.resolve(i,S,n,this.dimensions.device.cell.width),W&&n===w&&(S===B&&(this._model.cursor={x:B,y:E,width:i.getWidth(),style:this._coreBrowserService.isFocused?x:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},P=B+i.getWidth()-1),S>=B&&S<=P&&(this._coreBrowserService.isFocused&&x==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),h!==0&&(this._model.lineLengths[s]=S+1),!(this._model.cells[v]===h&&this._model.cells[v+Ts]===this._cellColorResolver.result.bg&&this._model.cells[v+Ms]===this._cellColorResolver.result.fg&&this._model.cells[v+Vn]===this._cellColorResolver.result.ext)&&(A=!0,f.length>1&&(h|=Cp),this._model.cells[v]=h,this._model.cells[v+Ts]=this._cellColorResolver.result.bg,this._model.cells[v+Ms]=this._cellColorResolver.result.fg,this._model.cells[v+Vn]=this._cellColorResolver.result.ext,p=i.getWidth(),this._glyphRenderer.value.updateCell(S,s,h,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,f,p,o),l)){for(i=this._workCell,S++;S<=y;S++)b=(s*r.cols+S)*Bs,this._glyphRenderer.value.updateCell(S,s,0,0,0,0,Af,0,0),this._model.cells[b]=0,this._model.cells[b+Ts]=this._cellColorResolver.result.bg,this._model.cells[b+Ms]=this._cellColorResolver.result.fg,this._model.cells[b+Vn]=this._cellColorResolver.result.ext;S--}}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})}},c_=class extends Vr{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function ql(e,t,r=0){return Math.max(Math.min(e,t),r)}var Kl="di$target",Gl="di$dependencies",io=new Map;function jt(e){if(io.has(e))return io.get(e);let t=function(r,i,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");h_(t,r,o)};return t._id=e,io.set(e,t),t}function h_(e,t,r){t[Kl]===t?t[Gl].push({id:e,index:r}):(t[Gl]=[{id:e,index:r}],t[Kl]=t)}var S0=jt("BufferService"),C0=jt("CoreMouseService"),x0=jt("CoreService"),k0=jt("CharsetService"),E0=jt("InstantiationService"),L0=jt("LogService"),d_=jt("OptionsService"),T0=jt("OscLinkService"),M0=jt("UnicodeService"),R0=jt("DecorationService"),u_={trace:0,debug:1,info:2,warn:3,error:4,off:5},f_="xterm.js: ",Vl=class extends vt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Lc=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=u_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":f_)+t,...r)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Vl=df([uf(0,d_)],Vl);var Lc;function p_(e){Lc=e}var Tc=class extends vt{constructor(e){if(tc&&Rf()<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 Pe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Pe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Pe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Pe),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,i=t.optionsService,o=t,s=o._renderService,n=o._characterJoinerService,a=o._charSizeService,u=o._coreBrowserService,l=o._decorationService,d=o._logService,m=o._themeService;p_(d),this._renderer=this._register(new l_(e,n,a,u,r,l,i,m,this._preserveDrawingBuffer)),this._register(Ft.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ft.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ft.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ft.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(tt(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Mc=`/**
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 Mc=`/* eslint-disable */
336
+ `;var Rc=`/* eslint-disable */
337
337
  /**
338
338
  * @hyzyn/dsh-tty \u2014 \u9762\u677F\u6837\u5F0F\u8868\u3002
339
339
  *
@@ -3762,8 +3762,8 @@ void main() {
3762
3762
  transition: none !important;
3763
3763
  }
3764
3764
  }
3765
- `;function Ns(e){let t=typeof e=="string"?e.trim():"";if(t==="")return;let r=t,i="",o=r.lastIndexOf("@");o>0&&(i=r.slice(0,o).trim(),r=r.slice(o+1).trim());let s=r,n=22,a=/^\[([^\]]+)\](?::(\d+))?$/.exec(r)??/^([^:]+):(\d+)$/.exec(r);if(a!==null){s=a[1];let l=Number(a[2]);Number.isInteger(l)&&l>=1&&l<=65535&&(n=l)}if(s==="")return;let u={host:s,port:n};return i!==""&&(u.username=i),u}function So(e){if(e===null||typeof e!="object")return"";let t=e,r=typeof t.host=="string"?t.host.trim():"";if(r==="")return"";let i=Number.isInteger(t.port)&&Number(t.port)>=1&&Number(t.port)<=65535?Number(t.port):22,o=typeof t.username=="string"&&t.username.trim()!==""?t.username.trim()+"@":"",s=r.includes(":")&&!r.startsWith("[")?`[${r}]`:r;return`${o}${s}${i===22?"":":"+String(i)}`}function Rc(e){return String(e??"").trim()!==""}function Ac(e){return Rc(e)}function Dc(e,t,r){return e!==!0?"":Rc(t)?String(t):String(r??"").trim()}var Co="\0global";function Qr(e,t){return e===null?Co:typeof e=="string"&&e!==""?e:typeof t=="string"&&t!==""?t:Co}function xo(e,t){return e===Co?!0:typeof t=="string"&&t!==""&&e===t}var m_="/api/dsh-tty/ws";function Pc(e,t){let r=new URL(t??e,e);return(r.protocol==="https:"?"wss:":"ws:")+"//"+r.host+m_}function ko(e){return String(e??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Bc(e,t,r,i){let o=ko(r),s=ko(e);if(o===""||s==="")return"";let n=ko(t),a=["DSH_TTY",o,s];return n!==""&&n!=="22"&&a.push(n),a.push(i),a.join("_")}function Hs(e){let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=65535?t:0}function Oc(e,t,r){return`${e}-${t==="remote"?"R":"L"}${String(r)}`}function Ic(e,t=[],r=i=>i){let i=e??{},o=String(i.bookName??"")||String(t[0]??"")||"";if(o==="")return{ok:!1,error:r("error.tunnelNoBook")};if(i.direction==="remote"){let u=Hs(i.remotePort),l=Hs(i.localTargetPort);return u<1||l<1?{ok:!1,error:r("error.tunnelRemotePortRequired")}:{ok:!0,tunnel:{name:Oc(o,"remote",u),bookName:o,direction:"remote",remotePort:u,localTargetHost:"",localTargetPort:l,enabled:!0}}}let s=Hs(i.localPort),n=String(i.remoteHost??"").trim(),a=Hs(i.remotePort);return s<1||n===""||a<1?{ok:!1,error:r("error.tunnelLocalRequired")}:{ok:!0,tunnel:{name:Oc(o,"local",s),bookName:o,direction:"local",localPort:s,remoteHost:n,remotePort:a,enabled:!0}}}function Nc(e,t){return(Array.isArray(e)?e:[]).find(r=>String(r?.name??"")===String(t))}function g_(e,t,r){return(Array.isArray(e)?e:[]).find(i=>String(i?.name??"")!==String(t)&&String(i?.name??"")===String(r))}function Hc(e,t,r,i){let o=Array.isArray(e)?e:[],s=o.find(u=>String(u?.name??"")===String(t));if(s===void 0)return{ok:!1,reason:"missing",error:i("error.tunnelMissing",{name:String(t)})};if(g_(o,t,r.name)!==void 0)return{ok:!1,reason:"clash",error:i("error.tunnelClash",{name:String(r.name)})};let a={...r,enabled:s.enabled!==!1};return{ok:!0,tunnels:o.map(u=>String(u?.name??"")===String(t)?a:u)}}function v_(e){let t=e?.byId;if(!(t===null||typeof t!="object"))for(let r of Object.keys(t)){let i=t[r]?.retainedBy?.mainView??0;if(typeof i=="number"&&i>0)return r}}function b_(e){let t=e?.current;return typeof t=="string"&&t!==""?t:v_(e)}function Fc(e){let t=b_(e);if(t===void 0)return;let r=e?.byId?.[t]?.cwd;return typeof r=="string"&&r!==""?r:void 0}function w_(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0}function Wc(e,t){if(e==null)return;let r=Math.floor(Number(e.cols)),i=Math.floor(Number(e.rows));if(!(!Number.isFinite(r)||!Number.isFinite(i))&&!(r<20||i<3)&&!(t==null||!w_(Number(t.width),Number(t.height))))return{cols:Math.min(500,r),rows:Math.min(200,i)}}function jc(e){return e!==null&&typeof e=="object"&&e.exited!==!0}function zc(e){if(!Array.isArray(e))return 0;let t=0;for(let r of e)jc(r)&&(t+=1);return t}function Eo(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)jc(r)&&typeof r.sid=="string"&&r.sid!==""&&t.add(r.sid);return t}function Uc(e){let t=new Set,r=new Set,i=new Set;if(!Array.isArray(e))return{present:t,retained:r,live:i};for(let o of e){if(o===null||typeof o!="object")continue;let s=typeof o.sid=="string"?o.sid:"";s!==""&&(t.add(s),o.exited===!0?r.add(s):i.add(s))}return{present:t,retained:r,live:i}}function $c(e,t){if(e===null||typeof e!="object"||e.agentOwned!==!0||e.embedded===!0)return"keep";let r=typeof e.sid=="string"?e.sid:"";return r===""||t===null||typeof t!="object"?"keep":t.present.has(r)?t.retained.has(r)?"mark-exited":"keep":"remove"}function qc(e){let t={live:0,agentLive:0,confirm:!1};if(e==null||typeof e[Symbol.iterator]!="function")return t;let r=0,i=0;for(let o of e)o===null||typeof o!="object"||o.embedded!==!0&&o.exited!==!0&&(r+=1,o.agentOwned===!0&&(i+=1));return{live:r,agentLive:i,confirm:r>0}}var Fs=Object.freeze({sids:[],live:0,agentLive:0,confirm:!1});function Kc(e){let t=[];if(e==null||typeof e[Symbol.iterator]!="function")return t;for(let r of e){if(r===null||typeof r!="object"||r.embedded===!0)continue;let i=r.sid;typeof i!="string"||i===""||t.push({sid:i,exited:r.exited===!0,agentOwned:r.agentOwned===!0})}return t}function Gc(e){return Kc(e).length}function Ws(e){let t=e.map(i=>i.sid),r=e.filter(i=>i.exited!==!0);return{sids:t,live:r.length,agentLive:r.filter(i=>i.agentOwned===!0).length,confirm:r.length>=2}}function Vc(e,t){let r=Kc(e);if(r.length===0)return{others:Fs,left:Fs,right:Fs,exited:Fs};let i=typeof t=="string"?t:"",o=r.findIndex(s=>s.sid===i);return{others:Ws(o<0?r:r.filter(s=>s.sid!==i)),left:Ws(o<0?[]:r.slice(0,o)),right:Ws(o<0?[]:r.slice(o+1)),exited:Ws(r.filter(s=>s.exited===!0))}}function xr(e){return e!==null&&typeof e=="object"&&e.hidden===!0}function Lo(e){return!(e===null||typeof e!="object"||e.agentOwned===!0||e.embedded===!0)}function To(e,t){let r=e!==null&&typeof e=="object"?{...e}:{};return t===!0?(r.hidden=!0,r):(delete r.hidden,r)}function Yc(e){return e===!0?"btn.showToAgent":"btn.hideFromAgent"}function Jc(e){let t=Number(e?.received),r=Number(e?.attempt),i=Number.isInteger(e?.maxAttempts)?e.maxAttempts:3,o=e?.total===null||e?.total===void 0?null:Number(e.total);return e?.canceled===!0?{resume:!1,reason:"canceled"}:!Number.isFinite(t)||t<=0?{resume:!1,reason:"noProgress"}:!Number.isInteger(r)||r<1?{resume:!1,reason:"badAttempt"}:r>i?{resume:!1,reason:"attemptsExhausted"}:o!==null&&Number.isFinite(o)&&o>0&&t>=o?{resume:!1,reason:"complete"}:{resume:!0,offset:t}}function y_(e){return typeof e!="string"||e===""||e==="."||e===".."?!1:e.startsWith(".")}function js(e,t){let i=(Array.isArray(e)?e:[]).filter(o=>o!==null&&typeof o=="object"&&typeof o.name=="string"&&o.name!=="");return t===!0?i:i.filter(o=>!y_(o.name))}function Xc(e,t){return e!=="remote"?{accept:!1,reason:"wrongPane"}:(Array.isArray(t?.types)?t.types:[]).includes("Files")?Number(t?.files?.length??0)>0?{accept:!0}:{accept:!1,reason:"empty"}:{accept:!1,reason:"notFiles"}}function Zc(e){let t=new Set;for(let r of Array.isArray(e)?e:[]){let i=typeof r?.relPath=="string"?r.relPath:"",o=i.lastIndexOf("/");o<=0||t.add(i.slice(0,o))}return[...t].sort((r,i)=>r.split("/").length-i.split("/").length||r.localeCompare(i))}function Qc(e,t){return e==null?{text:"",state:""}:e.exited===!0?{text:e.statusText??t("status.exited"),state:e.statusState??""}:e.live===!0?{text:e.statusText??t("status.connected"),state:e.statusState??"connected"}:e.errored===!0?{text:e.statusText??t("status.errored"),state:e.statusState??"error"}:{text:e.statusText??t("status.connectingEllipsis"),state:e.statusState??""}}function eh(e,t){return typeof e!="string"||e===""?!0:e===t}function th(e,t){return e===null?!1:e!==t}var rh="block",Mo="none";function S_(e){return e===rh}function ih(e){return e===!0?rh:Mo}function sh(e){return!S_(e)}function ct(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]}function Di(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]+"/s"}function oh(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function nh(e,t){return!Number.isFinite(e)||e<0?t("list.none"):e<1024?Math.round(e)+" B/s":Di(e)||t("list.none")}function C_(e,t){if(!Number.isFinite(e)||e<0)return t("list.none");let r=Math.floor(e),i=Math.floor(r/604800),o=Math.floor(r%604800/86400),s=Math.floor(r%86400/3600),n=Math.floor(r%3600/60),a=[];return i>0&&a.push(i+"w"),(i>0||o>0)&&a.push(o+"d"),(i>0||o>0||s>0)&&a.push(s+"h"),(i>0||o>0||s>0||n>0)&&a.push(n+"m"),a.length>0?a.join(""):r+"s"}function x_(e,t,r){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?r("list.none"):(ct(e)||"0 B")+"/"+(ct(t)||"0 B")}function ah(e,t){let r=e[t];return Number.isFinite(r)?t==="tempC"?r>-100&&r<200?r:null:t==="cores"?r>=1&&r<=4096?r:null:t==="cpuPct"||t==="memPct"||t==="diskPct"?r>=0&&r<=100?r:null:t==="uptimeSec"?r>=0&&r<=100*365*24*3600?r:null:t==="tcpConns"?r>=0&&r<=1e7?r:null:t==="rxRate"||t==="txRate"?r>=0&&r<=2**40?r:null:r>=0&&r<=2**50?r:null:null}var k_=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function lh(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:k_.some(t=>ah(e,t)!==null)}var E_=8e3;function ch(e,t=Date.now()){return t-(e||0)<=E_}var hh=23;function Ro(e){return[{key:"cpuPct",label:"CPU",kind:"pct",slot:4},{key:"memPct",label:e("meta.mem"),kind:"pct",slot:4},{key:"diskPct",label:e("meta.disk"),kind:"pct",slot:4},{key:"cores",label:e("meta.cores"),kind:"count",slot:4},{key:"mem",label:e("meta.mem"),kind:"pair",slot:17,used:"memUsed",total:"memTotal"},{key:"uptimeSec",label:e("meta.uptime"),kind:"uptime",slot:13},{key:"tcpConns",label:"TCP",kind:"count",slot:6},{key:"disk",label:e("meta.disk"),kind:"pair",slot:17,used:"diskUsed",total:"diskTotal"},{key:"tempC",label:e("meta.temp"),kind:"temp",slot:8},{key:"net",label:e("meta.net"),kind:"net",slot:hh}]}function dh(e,t){let r=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{},i=s=>ah(r,s),o=(s,n,a,u=s.slot)=>({key:s.key,label:s.label,kind:s.kind,slot:u,pct:a??null,value:n,title:s.label+": "+n});return Ro(t).map(s=>{if(s.kind==="pct"){let a=i(s.key);return o(s,a===null?t("list.none"):Math.round(a)+"%",a)}if(s.kind==="pair")return o(s,x_(i(s.used),i(s.total),t),null);if(s.kind==="uptime")return o(s,C_(i(s.key),t),null);if(s.kind==="temp"){let a=i(s.key);return o(s,a===null?t("list.none"):a.toFixed(1)+"\xB0C",null)}if(s.kind==="net"){let a=i("rxRate"),u=i("txRate");return a===null&&u===null?o(s,t("list.none"),null,0):o(s,"\u2193"+nh(a,t)+" \u2191"+nh(u,t),null,hh)}let n=i(s.key);return o(s,n===null?t("list.none"):String(n),null)})}var Ao="tty",Xs={"error.credServiceMissing":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09","error.credServiceIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574","error.credStoreUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u5B58\u5165","error.credStoreFailed":"\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u5931\u8D25\uFF1A{error}","error.credClearUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u6E05\u9664","error.credClearFailed":"\u6E05\u9664\u5931\u8D25\uFF1A{error}","error.credRefNeedsHost":"\u5148\u586B\u300C\u4E3B\u673A\u300D\u548C\u300C\u7528\u6237\u540D\u300D\u518D\u5B58\u5165\u2014\u2014\u5F15\u7528\u540D\u7531\u8FD9\u4E24\u8005\u6D3E\u751F","btn.reopen":"\u91CD\u65B0\u6253\u5F00","btn.reopenTitle":"\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD","btn.sftpTitle":"\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09","btn.tunnels":"\u96A7\u9053 {count}","btn.tunnelsTitle":"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053","btn.more":"\u66F4\u591A","btn.moreTitle":"\u66F4\u591A\u64CD\u4F5C\uFF08\u7AEF\u53E3\u8F6C\u53D1\u2026\uFF09","btn.reopenSession":"\u91CD\u65B0\u6253\u5F00\u4F1A\u8BDD","status.exited":"\u4F1A\u8BDD\u5DF2\u9000\u51FA","status.ended":"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","btn.clickRerun":"\u70B9\u51FB\u91CD\u65B0\u6267\u884C","status.aiEnded":"AI \u5DF2\u7ED3\u675F\u8FD9\u4E2A\u4F1A\u8BDD","hint.aiEndedTab":"\u5185\u5BB9\u5148\u7559\u7740\uFF1A\u5207\u8D70\u6216\u70B9\u300C\u6536\u8D77\u300D\u5373\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E","btn.dismiss":"\u6536\u8D77","btn.dismissTitle":"\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E\uFF08\u4F1A\u8BDD\u5DF2\u7ECF\u7ED3\u675F\u4E86\uFF09","hint.reopenWithSpec":"\u6309\u539F\u89C4\u683C\u91CD\u5F00\u4E00\u6761\u4F1A\u8BDD\uFF08\u6301\u4E45\u6807\u7B7E\u63A5\u56DE tmux\uFF0C\u547D\u4EE4\u6807\u7B7E\u91CD\u8DD1\u4E00\u6B21\uFF09","btn.newLocalTerminal":"\u65B0\u5F00\u672C\u5730\u7EC8\u7AEF","hint.reopenAgentLocal":"\u8FD9\u6761\u4F1A\u8BDD\u662F AI \u5F00\u7684\u3001\u5DF2\u7ECF\u7ED3\u675F\uFF1A\u70B9\u4E86\u4F1A\u65B0\u5F00\u4E00\u4E2A\u672C\u5730\u7EC8\u7AEF\uFF0C\u4E0D\u4F1A\u63A5\u56DE\u539F\u6765\u90A3\u6761","msg.passwordNotStored":"\u51FA\u4E8E\u5B89\u5168\u8003\u8651\uFF0C\u660E\u6587\u5BC6\u7801/\u53E3\u4EE4\u4E0D\u968F\u6D4F\u89C8\u5668\u5B58\u50A8\u4FDD\u7559\uFF0C\u672C\u6B21\u8FDE\u63A5\u9700\u8981\u91CD\u65B0\u8F93\u5165\uFF1A\u91CD\u5F00\u6807\u7B7E\u65F6\u518D\u586B\u4E00\u6B21\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u628A\u51ED\u636E\u6362\u6210 env: \u5F15\u7528\uFF08\u503C\u5B58\u5BBF\u4E3B\u51ED\u636E\u5B58\u50A8\uFF09\u3002","error.terminalNeedsCommand":"ttyTerminal \u9700\u8981 command","error.terminalCommandSingleLine":"command \u5FC5\u987B\u662F\u5355\u884C","error.terminalNeedsHost":"ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9","error.panelNotReady":"ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA","panel.dragHeight":"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6","panel.dragWidth":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6","btn.closePane":"\u5173\u95ED\u4FA7\u680F","btn.expandPane":"\u5C55\u5F00\u4FA7\u680F","btn.collapsePane":"\u6536\u8D77\u4FA7\u680F","panel.tabLabel":"\u7EC8\u7AEF {n}","btn.close":"\u5173\u95ED","btn.closeTabAria":"\u5173\u95ED\u6807\u7B7E\uFF1A{label}","btn.newTab":"\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09","btn.tabList":"\u6807\u7B7E\u5217\u8868","btn.tabListTitle":"\u6807\u7B7E\u5217\u8868\uFF08{n} \u4E2A\uFF09","list.tabsAllVisible":"\u6CA1\u6709\u85CF\u5728\u89C6\u91CE\u5916\u7684\u6807\u7B7E","list.cleanExited":"\u6E05\u7406\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\uFF08{n}\uFF09","btn.closeTab":"\u5173\u95ED\u6B64\u6807\u7B7E","btn.hideFromAgent":"\u5BF9 AI \u9690\u85CF\u6B64\u6807\u7B7E","btn.showToAgent":"\u53D6\u6D88\u9690\u85CF\uFF08\u8BA9 AI \u53EF\u7528\uFF09","btn.hiddenMark":"\u5BF9 AI \u4E0D\u53EF\u89C1","btn.closeLeft":"\u5173\u95ED\u5DE6\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","btn.closeOthers":"\u5173\u95ED\u5176\u4ED6\u6807\u7B7E\uFF08{n}\uFF09","btn.closeRight":"\u5173\u95ED\u53F3\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","list.subLive":"\u5176\u4E2D {n} \u4E2A\u8FD8\u5F00\u7740","meta.tunnelRemote":"\u8FDC\u7A0B:{host}:{port} \u2192 \u672C\u673A:{local}","meta.tunnelLocal":"\u672C\u673A:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A","status.notPersisted":"\u672A\u6301\u4E45\u5316","status.tmuxUnavailableTitle":"\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD","status.connected":"\u5DF2\u8FDE\u63A5","status.connecting":"\u8FDE\u63A5\u4E2D","status.errored":"\u8FDE\u63A5\u51FA\u9519","panel.tunnels":"\u7AEF\u53E3\u8F6C\u53D1","hint.tunnelsSettings":"\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u91CC\u914D\u7F6E","panel.tunnelsFor":"\u7AEF\u53E3\u8F6C\u53D1 \u2014 {name}","list.loading":"\u52A0\u8F7D\u4E2D\u2026","hint.tunnelsCard":"\u589E\u5220/\u542F\u505C\u5728 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4","list.noActiveTunnels":"\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053","status.fatalSuffix":"\uFF08\u4E0D\u91CD\u8BD5\uFF0C\u9700\u4FEE\u914D\u7F6E\uFF09","msg.maxSessions":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 {live} \u4E2A / \u4E0A\u9650 {max}\uFF1A\u672C\u7A97\u53E3 {own} \u4E2A{others}\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","msg.maxSessionsOthers":" + \u5176\u4ED6\u7A97\u53E3 {count} \u4E2A","error.probeHttp":"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP {status}\uFF09","msg.probing":"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026","meta.reachable":"\u901A","meta.unreachable":"\u4E0D\u901A","meta.probeBanner":"banner \u6B63\u5E38","meta.hostKeyMatched":"\u4E3B\u673A\u5BC6\u94A5\u5339\u914D","meta.hostKeyRecorded":"\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09","meta.hostKeyMismatch":"\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01","meta.authOkMs":"\u8BA4\u8BC1\u901A\u8FC7\uFF08{ms}ms\uFF09","meta.authOk":"\u8BA4\u8BC1\u901A\u8FC7","meta.probeOk":"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A{detail}","error.unknown":"\u672A\u77E5\u9519\u8BEF","btn.maxSessionsTitle":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E","option.localTerminal":"\u672C\u5730\u7EC8\u7AEF","hint.tmuxHosted":"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D","hint.openInSessionCwd":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00","panel.sshBook":"SSH \u8FDE\u63A5\u7C3F","btn.sftpFileBrowse":"SFTP \u6587\u4EF6\u6D4F\u89C8","btn.editConnection":"\u7F16\u8F91\u8FDE\u63A5","list.emptySshBook":"\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09","option.sshConnect":"SSH \u8FDE\u63A5\u2026","hint.sshConnect":"\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F","panel.editConnection":"\u7F16\u8F91\u8FDE\u63A5 \xB7 {name}","panel.sshConnect":"SSH \u8FDE\u63A5","section.jump":"\u8DF3\u677F\u673A","field.jumpHost":"\u8DF3\u677F\u673A\uFF08[\u7528\u6237@]\u4E3B\u673A[:\u7AEF\u53E3]\uFF0C\u7559\u7A7A = \u76F4\u8FDE\uFF09","placeholder.jumpHost":"\u4F8B\u5982 bastion.corp:2222","check.jumpOwnCred":"\u8DF3\u677F\u673A\u4F7F\u7528\u72EC\u7ACB\u51ED\u636E","field.jumpUsername":"\u8DF3\u677F\u673A\u7528\u6237\u540D\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","field.jumpAuth":"\u8DF3\u677F\u673A\u8BA4\u8BC1\u65B9\u5F0F\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","hint.jumpInherit":"\u7559\u7A7A\u51ED\u636E = \u6CBF\u7528\u76EE\u6807\u90A3\u53F0\u4E3B\u673A\u7684\u8BA4\u8BC1\u65B9\u5F0F\u4E0E\u94A5\u5319\u3002","hint.jumpInheritFull":"\u7559\u7A7A\u51ED\u636E = \u6CBF\u7528\u4E0A\u9762\u90A3\u53F0\u4E3B\u673A\u7684\u8BA4\u8BC1\u65B9\u5F0F\u4E0E\u94A5\u5319\uFF1B\u8DF3\u677F\u673A\u8FDE\u4E0D\u4E0A\u65F6\u9519\u8BEF\u6587\u6848\u4F1A\u70B9\u540D\u5B83\uFF08\u4E0D\u4F1A\u4F2A\u88C5\u6210\u76EE\u6807\u8D85\u65F6\uFF09\u3002","meta.jumpStage":"\u8DF3\u677F\u673A {label}","meta.viaJump":"\u21E2 \u7ECF {label}","meta.viaProxy":"\u21E2 \u7ECF\u4EE3\u7406\u547D\u4EE4","section.proxyCommand":"\u4EE3\u7406\u547D\u4EE4","field.proxyCommand":"\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF0C\u7559\u7A7A = \u4E0D\u7528\uFF09","placeholder.proxyCommand":"\u4F8B\u5982 ssh -W %h:%p bastion","hint.proxyCommand":"\u672C\u673A\u547D\u4EE4\uFF0Cstdin/stdout \u5373\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF1B\u4E0E\u8DF3\u677F\u673A\u540C\u586B\u65F6\u8DF3\u677F\u673A\u4F18\u5148\u3002","hint.proxyCommandFull":"\u672C\u673A\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u5B83\u7684 stdin/stdout \u5C31\u662F\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u652F\u6301 %h \u76EE\u6807\u4E3B\u673A\u3001%p \u7AEF\u53E3\u3001%r \u7528\u6237\u540D\u3001%n \u4E3B\u673A\u3001%% \u5B57\u9762 %\uFF1B\u5176\u4F59\u5199\u6CD5\u539F\u6837\u4FDD\u7559\u3002\u4E0E\u8DF3\u677F\u673A\u540C\u65F6\u586B\u65F6\u8DF3\u677F\u673A\u4F18\u5148\uFF08OpenSSH \u8BED\u4E49\uFF09\u3002\u9700\u8981\u4E0B\u9762\u90A3\u4E2A\u5F00\u5173\uFF0C~/.ssh/config \u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\u5B83\u3002","hint.proxyCommandDisabled":"\u26A0 \u5F53\u524D\u300C\u5141\u8BB8 ProxyCommand\u300D\u672A\u6253\u5F00\uFF1A\u8FD9\u6761\u547D\u4EE4\u4E0D\u4F1A\u6267\u884C\uFF0C\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002\u5230 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u6253\u5F00\u5F00\u5173\u540E\u751F\u6548\u3002","hint.proxyCommandNotGranted":"\u26A0 \u8FD9\u6761\u80FD\u529B\u672A\u83B7\u5BBF\u4E3B\u6388\u6743\uFF1A\u70B9\u8FD9\u4E2A\u5F00\u5173\u4F1A\u5C31\u5730\u53D1\u8D77\u4E00\u6B21\u6388\u6743\uFF08\u9762\u677F\u7ED9\u4E00\u6761\u5728\u5BBF\u4E3B\u7EC8\u7AEF\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u514D\u91CD\u542F\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u8D70\u6700\u4E25\u7684\u90A3\u6761\u2014\u2014\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export DSH_TTY_ALLOW_PROXY_COMMAND=1 \u540E\u91CD\u542F\u5BBF\u4E3B\uFF08\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u4E0D\u7B97\u6388\u6743\uFF09\u3002\u8FD9\u6837\u5B89\u6392\u662F\u56E0\u4E3A\u8DE8\u7AD9\u9875\u9762\u4E0E\u9875\u5185\u811A\u672C\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\u2014\u2014\u82E5\u914D\u7F6E\u754C\u9762\u80FD\u51ED\u7A7A\u63D0\u6743\uFF0C\u8FD9\u9053\u95F8\u95E8\u7B49\u4E8E\u6CA1\u6709\uFF1B\u5173\u6389\u5B83\u5219\u968F\u65F6\u53EF\u7528\u3002","badge.notEffective":"\u672A\u751F\u6548\uFF1A\u672A\u83B7\u5BBF\u4E3B\u6388\u6743","elev.title":"\u5C31\u5730\u6388\u6743\uFF08\u514D\u91CD\u542F\uFF09","elev.lockedWhy":"\u672C\u673A\u4EFB\u610F\u8FDB\u7A0B\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\uFF0C\u6240\u4EE5\u300C\u6253\u5F00\u5371\u9669\u80FD\u529B\u300D\u8FD9\u4EF6\u4E8B\u4E0D\u80FD\u7531\u8FD9\u4E2A\u9875\u9762\u81EA\u5DF1\u8BF4\u4E86\u7B97\u2014\u2014\u5FC5\u987B\u5728\u5BBF\u4E3B\u7684\u6587\u4EF6\u7CFB\u7EDF\u4E0A\u786E\u8BA4\u4E00\u6B21\u3002","elev.step":"\u5728\u5BBF\u4E3B\u7684\u7EC8\u7AEF\u91CC\u6267\u884C\u4E0B\u4E00\u6761\u547D\u4EE4\uFF0C\u5F00\u5173\u4F1A\u81EA\u52A8\u89E3\u9501\uFF1A","elev.copy":"\u590D\u5236\u547D\u4EE4","elev.copied":"\u5DF2\u590D\u5236","elev.copyManual":"\u5F53\u524D\u73AF\u5883\u62FF\u4E0D\u5230\u526A\u8D34\u677F\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u4E0A\u9762\u90A3\u6761\u547D\u4EE4\u590D\u5236\u3002","elev.expiresIn":"{sec} \u79D2\u540E\u5931\u6548","elev.expired":"\u672C\u6B21\u786E\u8BA4\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002","elev.waiting":"\u7B49\u5F85\u786E\u8BA4\u2026\u6267\u884C\u5B8C\u547D\u4EE4\u8FD9\u91CC\u4F1A\u81EA\u52A8\u53D8\u6210\u5DF2\u6388\u6743\u3002","elev.regenerate":"\u91CD\u65B0\u751F\u6210","elev.loading":"\u6B63\u5728\u751F\u6210\u786E\u8BA4\u547D\u4EE4\u2026","elev.granted":"\u5DF2\u6388\u6743\u5E76\u751F\u6548\u3002","elev.grantedNeedSave":"\u5DF2\u6388\u6743\u3002\u70B9\u300C\u4FDD\u5B58\u300D\u540E\u751F\u6548\u3002","elev.grantedAt":"\u5DF2\u6388\u6743 \xB7 {time}","elev.revoke":"\u64A4\u9500\u5BBF\u4E3B\u6388\u6743","elev.revoked":"\u5DF2\u64A4\u9500\u5BBF\u4E3B\u6388\u6743\uFF08\u914D\u7F6E\u5F00\u5173\u4FDD\u6301\u4E0D\u53D8\uFF0C\u91CD\u65B0\u6388\u6743\u540E\u4F1A\u7ACB\u523B\u751F\u6548\uFF09\u3002","elev.viaEnv":"\u7531\u542F\u52A8\u73AF\u5883\u53D8\u91CF\u6388\u6743\uFF1B\u8981\u64A4\u9500\u9700\u5728\u542F\u52A8\u73AF\u5883\u91CC\u53BB\u6389\u5B83\u5E76\u91CD\u542F\u5BBF\u4E3B\u3002","elev.close":"\u6536\u8D77","elev.disableFirst":"\u5148\u5173\u6389\u8FD9\u4E2A\u914D\u7F6E\u5F00\u5173","elev.otherWay":"\u53E6\u4E00\u79CD\u65B9\u5F0F\uFF08\u6700\u5F3A\uFF0C\u9700\u8981\u91CD\u542F\u5BBF\u4E3B\uFF09","elev.envHow":"\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export {env}=1\uFF0C\u7136\u540E\u91CD\u542F\u5BBF\u4E3B\u3002\u6CE8\u610F\uFF1A\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u3001\u6216\u5199\u8FDB\u522B\u7684\u914D\u7F6E\u6587\u4EF6\u90FD\u4E0D\u7B97\u6388\u6743\u2014\u2014\u8FD9\u9053\u95F8\u95E8\u9632\u7684\u5C31\u662F\u300C\u8FD0\u884C\u671F\u80FD\u6539\u7684\u4E1C\u897F\u5192\u5145\u6388\u6743\u300D\u3002","elev.error":"\u5C31\u5730\u6388\u6743\u6CA1\u6210\u529F\uFF1A","meta.probeProxy":"\u4EE3\u7406\u547D\u4EE4","meta.probeProxyOff":"\u4EE3\u7406\u547D\u4EE4\uFF08\u672A\u542F\u7528\uFF09","meta.probeTcpSkipped":"\u76F4\u8FDE\u9884\u68C0\u5DF2\u8DF3\u8FC7\uFF08\u8D70\u4EE3\u7406\u547D\u4EE4\uFF09","section.connection":"\u8FDE\u63A5","field.host":"\u4E3B\u673A","placeholder.host":"example.com \u6216 IP","field.port":"\u7AEF\u53E3","field.username":"\u7528\u6237\u540D","section.auth":"\u8BA4\u8BC1","field.authMethod":"\u8BA4\u8BC1\u65B9\u5F0F","option.authInherit":"\uFF08\u6CBF\u7528\u76EE\u6807\uFF09","option.authAgent":"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent","option.authKey":"key \u2014 \u79C1\u94A5\u6587\u4EF6","option.authPassword":"password \u2014 \u5BC6\u7801","field.keyPath":"\u79C1\u94A5\u8DEF\u5F84","field.hostKeyAlias":"\u4E3B\u673A\u5BC6\u94A5\u522B\u540D","field.passphrase":"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09","field.password":"\u5BC6\u7801","placeholder.credRef":"\u6216\uFF1A\u9009\u62E9\u51ED\u636E\u5B58\u50A8\u91CC\u7684\u5F15\u7528\u540D","hint.credRefCandidates":"\u5019\u9009 = \u51ED\u636E\u5B58\u50A8\u91CC\u5DF2\u6709\u7684\u5F15\u7528\u540D + \u672C\u673A\u8FDE\u63A5\u7C3F\u91CC\u5728\u7528\u7684\u5F15\u7528\u540D","list.credOverwrite":"{name}\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09","list.moreMatches":"\u8FD8\u6709 {count} \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009","list.noCredRef":"\u6CA1\u6709\u5339\u914D\u7684\u5F15\u7528","check.rememberCredential":"\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.rememberCredential":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u4FDD\u5B58\u4FEE\u6539\u300D\u6216\u300C\u8FDE\u63A5\uFF08\u5E76\u4FDD\u5B58\uFF09\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","btn.clearCredential":"\u6E05\u9664\u5DF2\u5B58\u51ED\u636E","error.credPlainUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","error.credPlainIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","status.credUnreported":"\u5F15\u7528 {ref}\uFF1A\u5BBF\u4E3B\u672A\u62A5\u544A\u72B6\u6001","error.credStatusFailed":"\u8BFB\u53D6\u51ED\u636E\u72B6\u6001\u5931\u8D25\uFF1A{error}","status.credStored":"\u5DF2\u5B58\u5165{source} \xB7 {ref}","meta.credSource":"\uFF08\u6765\u6E90 {source}\uFF09","status.credUnknown":"\u5F15\u7528 {ref}\uFF1A\u5B58\u50A8\u91CC\u8FD8\u6CA1\u6709\u8FD9\u4E2A\u503C","hint.noCredRefPassphrase":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u53EF\u5728\u79C1\u94A5\u53E3\u4EE4\u6846\u76F4\u63A5\u624B\u8F93 env:NAME","hint.noCredRefPassword":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","section.options":"\u9009\u9879","section.advanced":"\u9AD8\u7EA7","hint.advanced":"\u8DF3\u677F\u673A \xB7 \u4EE3\u7406\u547D\u4EE4 \xB7 \u4E3B\u673A\u5BC6\u94A5\u522B\u540D","meta.advancedConfigured":"\u5DF2\u914D\u7F6E\uFF1A{items}","check.agentForward":"agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09","hint.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740\uFF1B\u540C\u4E00\u4E3B\u673A\u7ECF\u591A\u5730\u5740\u89E6\u8FBE\u65F6\u586B\u522B\u540D\u53EF\u5171\u7528\u6307\u7EB9\u8BB0\u5F55\u3002","hint.hostKeyAliasFull":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740\u8BB0\u4F4F\u6307\u7EB9\u3002\u540C\u4E00\u53F0\u4E3B\u673A\u7ECF\u4E0D\u540C\u5730\u5740\uFF08\u8DF3\u677F\u673A\u540E / \u7AEF\u53E3\u8F6C\u53D1\uFF09\u89E6\u8FBE\u65F6\uFF0C\u586B\u540C\u4E00\u4E2A\u522B\u540D\u53EF\u8BA9\u5B83\u4EEC\u5171\u7528\u4E00\u6761\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF0C\u907F\u514D\u6BCF\u6B21\u5207\u6362\u5730\u5740\u90FD\u62A5\u300C\u6307\u7EB9\u53D8\u66F4\u300D\uFF1B\u53EA\u5F71\u54CD\u6307\u7EB9\u8BB0\u5728\u54EA\uFF0C\u4E0D\u6539\u8FDE\u63A5\u5730\u5740","placeholder.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740","check.persist":"\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","check.saveToBook":"\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09","field.bookName":"\u8FDE\u63A5\u7C3F\u540D\u79F0","placeholder.bookName":"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D","error.hostUserRequired":"\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B","error.keyPathRequired":"auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84","error.passwordRequired":"auth=password \u9700\u8981\u5BC6\u7801","btn.cancel":"\u53D6\u6D88","btn.connect":"\u8FDE\u63A5","btn.fileBrowse":"\u6587\u4EF6\u6D4F\u89C8","btn.browseTitle":"\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8","btn.probe":"\u8BD5\u8FDE","btn.probeTitle":"\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","error.saveCredFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","btn.saveEdit":"\u4FDD\u5B58\u4FEE\u6539","error.saveBookFailed":"\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A{error}","error.bookNameTaken":"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: {name}","panel.sftpDual":"SFTP \u53CC\u680F \xB7 {label}","status.failed":"\u5931\u8D25","status.done":"\u5B8C\u6210","placeholder.localPath":"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","placeholder.remotePath":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","btn.refresh":"\u5237\u65B0","btn.mkdir":"\u65B0\u5EFA\u76EE\u5F55","btn.hiddenFiles":"\u9690\u85CF\u6587\u4EF6","btn.hiddenFilesTitle":"\u663E\u793A / \u9690\u85CF\u4EE5 . \u5F00\u5934\u7684\u6587\u4EF6\uFF08.env\u3001.gitignore \u7B49\uFF09","error.dirNotReady":"\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210","meta.dir":"\u76EE\u5F55","btn.transferTo":"\u4F20\u8F93\u5230{target}\uFF1A{path}","meta.local":"\u672C\u673A","meta.remote":"\u8FDC\u7A0B","error.transferDirsNotReady":"\u4E24\u4FA7\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210\uFF0C\u7B49\u5217\u8868\u52A0\u8F7D\u540E\u518D\u4F20\u8F93","msg.transferring":"\u4F20\u8F93 {name}\u2026","error.transferFailed":"\u4F20\u8F93\u5931\u8D25","error.noTaskId":"\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id","msg.transferCanceled":"\u5DF2\u53D6\u6D88\u4F20\u8F93 {name}","msg.transferred":"\u5DF2\u4F20\u8F93 {name}","btn.download":"\u4E0B\u8F7D {name}","btn.rename":"\u91CD\u547D\u540D {name}","placeholder.newName":"\u65B0\u540D\u79F0","btn.deleteEntry":"\u5220\u9664 {name}","btn.deleteEntryDir":"\u5220\u9664 {name}\uFF08\u542B\u5185\u5BB9\uFF09","msg.deleted":"\u5DF2\u5220\u9664 {name}","list.parentDir":"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","list.emptyDir":"\uFF08\u7A7A\u76EE\u5F55\uFF09","list.hiddenOnly":"\uFF08\u8FD9\u91CC\u53EA\u6709\u9690\u85CF\u6587\u4EF6 \u2014 \u70B9\u680F\u4E0A\u7684\u300C\u9690\u85CF\u6587\u4EF6\u300D\u663E\u793A\uFF09","error.dropOnLocalPane":"\u62D6\u5230\u672C\u673A\u680F\u6CA1\u6709\u53EF\u6267\u884C\u7684\u52A8\u4F5C\uFF1A\u672C\u673A\u6587\u4EF6\u8981\u4F20\u5230\u5BF9\u9762\uFF0C\u8BF7\u62D6\u5230\u53F3\u4FA7\u300C\u8FDC\u7A0B\u300D\u680F","list.truncated":"\u2026\u5176\u4F59 {rest} \u9879\u672A\u6E32\u67D3\uFF08\u5171 {total} \u9879\uFF09\u2014\u2014\u7528\u4E0A\u65B9\u8DEF\u5F84\u6846\u8DF3\u8F6C\u5230\u5B50\u76EE\u5F55\u5B9A\u4F4D","list.itemCount":"{count} \u9879","placeholder.newDirName":"\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09","msg.creatingDir":"\u521B\u5EFA\u76EE\u5F55 {name}\u2026","btn.ok":"\u786E\u5B9A","btn.confirm":"\u786E\u8BA4?","btn.cancelTransfer":"\u53D6\u6D88\u4F20\u8F93","msg.downloadCanceled":"\u5DF2\u53D6\u6D88\u4E0B\u8F7D {name}","msg.downloadResuming":"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u4ECE {offset} \u5904\u7EED\u4F20 {name}\u2026","error.downloadFailed":"\u4E0B\u8F7D\u5931\u8D25","msg.downloaded":"\u5DF2\u4E0B\u8F7D {name}\uFF08{size}\uFF09","error.downloadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08{size}\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","msg.canceled":"\u5DF2\u53D6\u6D88","btn.upload":"\u4E0A\u4F20","btn.uploadTitle":"\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868","msg.uploading":"\u4E0A\u4F20\u4E2D\u2026","msg.uploadDone":"\u4E0A\u4F20\u5B8C\u6210","error.uploadFailed":"\u4E0A\u4F20\u5931\u8D25","error.networkError":"\u7F51\u7EDC\u9519\u8BEF","error.uploadCountExceeded":"\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08{max}\uFF09\uFF1A\u672C\u6B21 {count} \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","status.overLimit":"\u8D85\u9650","error.uploadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08{size}\uFF09\uFF1A{name}\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error.uploadTotalTooBig":"\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","msg.uploadCanceled":"\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 {done}/{total} \u4E2A\uFF09","status.allDone":"\u5168\u90E8\u5B8C\u6210","msg.uploadDoneCount":"\u4E0A\u4F20\u5B8C\u6210 {count} \u4E2A\u6587\u4EF6","error.connectFailed":"\u8FDE\u63A5\u5931\u8D25\uFF1A{error}","status.connectingEllipsis":"\u8FDE\u63A5\u4E2D\u2026","status.connectedPid":"\u5DF2\u8FDE\u63A5 pid={pid}","status.connectedSsh":"SSH {target}\u5DF2\u8FDE\u63A5","status.exitedWith":"\u5DF2\u9000\u51FA {detail}","status.error":"\u9519\u8BEF\uFF1A{message}","status.retryHint":"{message} \xB7 \u70B9\u51FB\u91CD\u8BD5","btn.clickRetry":"\u70B9\u51FB\u91CD\u8BD5","status.disconnectedReconnecting":"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","status.disconnected":"\u8FDE\u63A5\u65AD\u5F00","status.reconnecting":"\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","error.copyFailed":"\u590D\u5236\u5931\u8D25\uFF1A\u5F53\u524D\u73AF\u5883\u4E0D\u5141\u8BB8\u8BBF\u95EE\u526A\u8D34\u677F\uFF08http \u8BBF\u95EE\u65F6\u8BF7\u6539\u7528 localhost \u6216\u7EC8\u7AEF\u5185\u5FEB\u6377\u952E\uFF09","status.initializing":"\u521D\u59CB\u5316\u2026","placeholder.search":"\u641C\u7D22 (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"\u641C\u7D22 (Ctrl+F)\uFF1AEnter \u4E0B\u4E00\u4E2A / Shift+Enter \u4E0A\u4E00\u4E2A","btn.clearTitle":"\u6E05\u5C4F","btn.minimizeTitle":"\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09","btn.minimize":"\u6700\u5C0F\u5316","btn.closePanelTitle":"\u5173\u95ED\u9762\u677F\u5E76\u7ED3\u675F\u5168\u90E8\u4F1A\u8BDD\uFF08\u6709\u4F1A\u8BDD\u8FD8\u5F00\u7740\u65F6\u4F1A\u5148\u786E\u8BA4\uFF1B\u53EA\u662F\u60F3\u6536\u8D77\u5C31\u70B9\u300C\u2014\u300D\uFF0C\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09","confirm.closeTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED\u9762\u677F\uFF1F","confirm.closeText":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF08\u9762\u677F\u91CC\u7684\u6807\u7B7E\u4F1A\u8DDF\u7740\u5173\u6389\uFF09\u3002","confirm.closeTextAgent":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.closeHint":"\u53EA\u662F\u60F3\u7ED9\u522B\u7684\u7A97\u53E3\u817E\u5730\u65B9\uFF1F\u70B9\u300C\u6700\u5C0F\u5316\u300D\u2014\u2014 \u4F1A\u8BDD\u4E0E\u8F93\u51FA\u90FD\u4FDD\u6301\u8FD0\u884C\u3002","confirm.closeOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED","confirm.tabsTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u6389\u8FD9\u4E9B\u6807\u7B7E\uFF1F","confirm.tabsText":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF0C\u5B83\u4EEC\u7684\u6807\u7B7E\u4E5F\u8DDF\u7740\u5173\u6389\u3002","confirm.tabsTextAgent":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.tabsHint":"\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\u53EA\u662F\u53EA\u8BFB\u4FDD\u7559\uFF0C\u6E05\u6389\u5B83\u4EEC\u4E0D\u4E22\u4EFB\u4F55\u4E1C\u897F\u3002","confirm.tabsOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD","btn.restoreDock":"\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3","panel.title":"\u7EC8\u7AEF","status.minimized":"\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D","error.configLoadFailed":"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25","error.saveTunnelFailed":"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25","error.tunnelNameTaken":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u540C\u4E00\u300C\u8FDE\u63A5\u7C3F\u6761\u76EE + \u65B9\u5411 + \u7AEF\u53E3\u300D\u53EA\u80FD\u6709\u4E00\u6761\u3002\u6539\u7AEF\u53E3\u4F1A\u5F97\u5230\u65B0\u540D\u5B57\uFF0C\u6216\u5148\u5220\u6389\u65E7\u7684\u90A3\u6761\u3002","msg.tunnelApplied":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u751F\u6548","msg.tunnelUpdated":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u66F4\u65B0","error.nameHostUserRequired":"\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B","msg.hostEdited":"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C{name}\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.probeFailed":"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A{error}","error.hostKeyDeleteFailed":"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25","msg.hostKeyDeleted":"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09","error.sshConfigReadFailed":"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25","msg.proxySkipped":"{count} \u6761\u7528\u4E86\u8DF3\u677F\u673A\u4F46\u89E3\u6790\u4E0D\u51FA\u8DF3\u677F\u673A\uFF08\u522B\u540D\u7F3A\u5931 / \u522B\u540D\u81EA\u5DF1\u8FD8\u4F9D\u8D56\u8DF3\u677F\u673A\uFF09\u672A\u5BFC\u5165\uFF1A{names}","msg.proxyCommandSkipped":"{count} \u6761\u53EA\u914D\u4E86\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF09\u672A\u5BFC\u5165\uFF1A{names} \u2014\u2014 \u4EE3\u7406\u547D\u4EE4\u662F\u300C\u672C\u673A\u6267\u884C\u4E00\u6761\u547D\u4EE4\u300D\u90A3\u4E00\u6863\uFF0C\u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\uFF1B\u9700\u8981\u65F6\u5728\u8FDE\u63A5\u7C3F\u91CC\u624B\u586B\u5E76\u6253\u5F00\u300C\u5141\u8BB8 ProxyCommand\u300D","msg.skippedNotConcrete":"{count} \u6761\u4E0D\u662F\u5177\u4F53\u4E3B\u673A\uFF08\u901A\u914D / \u65E0 User\uFF09","list.separator":"\u3001","meta.etc":" \u7B49","msg.importOverflow":"\u8D85\u8FC7\u5BFC\u5165\u4E0A\u9650\u7684 {count} \u6761\u672A\u5BFC\u5165","list.separatorFull":"\uFF1B","msg.noNewEntries":"\u6CA1\u6709\u65B0\u6761\u76EE\uFF08{count} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09","msg.noImportableHosts":"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","msg.importedHosts":"\u5DF2\u5BFC\u5165 {added} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 {skipped} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.knownHostsReadFailed":"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25","msg.noNewFingerprints":"\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08{count} \u6761\u5DF2\u5B58\u5728\uFF09","msg.noImportableKnownHosts":"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","error.saveHostKeysFailed":"\u4FDD\u5B58 hostKeys \u5931\u8D25","msg.importedFingerprints":"\u5DF2\u5BFC\u5165 {added} \u6761\u4E3B\u673A\u7684\u6307\u7EB9\uFF08\u8DF3\u8FC7 {skipped} \u6761\u5DF2\u5B58\u5728\uFF09","hint.knownHostsTruncated":"\uFF1B\u6CE8\u610F\uFF1Aknown_hosts \u8D85\u8FC7 500 \u6761\u4E3B\u673A\uFF0C\u672C\u6B21\u4EC5\u5BFC\u5165\u524D 500 \u6761","error.saveFailed":"\u4FDD\u5B58\u5931\u8D25","msg.saved":"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548","check.rememberCredentialApply":"\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.appliedOnSave":"\u968F\u5361\u7247\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","card.name":"\u7EC8\u7AEF\u9762\u677F","card.desc":"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\u3002","card.descFull":"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","list.loadingConfig":"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026","section.basic":"\u57FA\u7840","check.enabled":"\u542F\u7528\u63D2\u4EF6\uFF08\u4FDD\u5B58\u5373\u70ED\u751F\u6548\uFF1A\u5DE5\u5177\u4E0E\u9762\u677F\u5165\u53E3\u7ACB\u523B\u6536\u8D77\uFF0C\u4F1A\u8BDD\u8F6C\u4FDD\u6D3B\uFF09","check.announce":"\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","check.shellIntegration":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF09","check.shellIntegrationWindows":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","hint.shellIntegrationWindows":"Windows \u5BBF\u4E3B\u4E0A\u4E0D\u9002\u7528\uFF1A\u6CE8\u5165\u8D70\u7684\u662F POSIX \u7684 `-c` \u5305\u88C5\u5C42\u4E0E rc \u6869\uFF0Ccmd / PowerShell \u4E0A\u90FD\u4E0D\u6210\u7ACB\uFF08\u5B9E\u6D4B cmd \u5FFD\u7565 `-c` \u7A7A\u8DD1\u3001PowerShell \u62A5 export \u4E0D\u5B58\u5728\uFF09\u3002\u56E0\u6B64\u300C\u672C\u5730\u300D\u6807\u7B7E\u7684 cwd \u8DDF\u968F\u4E0E tty_capture{last} \u4E0D\u53EF\u7528\uFF1B\u8FDC\u7A0B Linux / macOS \u4E3B\u673A\u7167\u65E7\u652F\u6301\u3002","section.sftp":"SFTP \u6587\u4EF6\u4F20\u8F93","field.sftpStyle":"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C","option.sftpDialog":"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD","option.sftpDual":"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20","hint.sftpDual":"\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","field.sftpLimits":"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09","field.downloadLimit":"\u4E0B\u8F7D\u4E0A\u9650 (MB)","field.uploadLimit":"\u4E0A\u4F20\u4E0A\u9650 (MB)","field.uploadCountLimit":"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650","hint.sftpLimits":"\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","section.session":"\u4F1A\u8BDD","field.persistence":"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09","option.persistOff":"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09","option.persistTmux":"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316","hint.persistence":"\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","hint.persistenceWindows":"\uFF1BWindows \u5BBF\u4E3B\u4E0A tmux \u4E0D\u53EF\u7528\uFF0C\u672C\u5730\u6807\u7B7E\u4F1A\u7167\u5E38\u6253\u5F00\u4F46\u4E0D\u53D7\u6258\u7BA1","check.endOnPageClose":"\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","check.statsEnabled":"\u670D\u52A1\u5668\u72B6\u6001\u6761\uFF08CPU / \u5185\u5B58 / \u78C1\u76D8 / \u5728\u7EBF / TCP / \u7F51\u901F\uFF1B\u91C7\u4E0D\u5230\u7684\u9879\u663E\u793A\u300C\u65E0\u300D\uFF09","hint.statsEnabled":"\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","check.allowProxyCommand":"\u5141\u8BB8 ProxyCommand\uFF08\u672C\u673A\u6267\u884C\u547D\u4EE4\uFF1B\u9ED8\u8BA4\u5173\uFF09","hint.allowProxyCommand":"\u6253\u5F00\u540E\uFF0C\u8FDE\u63A5\u7C3F\u6761\u76EE\u91CC\u586B\u7684\u4EE3\u7406\u547D\u4EE4\u4F1A\u5728\u8FD9\u53F0\u673A\u5668\u4E0A\u6267\u884C\uFF0C\u5B83\u7684 stdin/stdout \u5F53\u4F5C\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u8FD9\u662F\u672C\u63D2\u4EF6\u552F\u4E00\u300C\u914D\u7F6E\u91CC\u5199\u4E00\u884C\u5C31\u5728\u672C\u673A\u8DD1\u547D\u4EE4\u300D\u7684\u5F00\u5173\uFF0C\u6240\u4EE5\u9ED8\u8BA4\u5173\uFF1A\u5173\u7740\u65F6\u643A\u5E26\u4EE3\u7406\u547D\u4EE4\u7684\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002~/.ssh/config \u5BFC\u5165\u6C38\u4E0D\u81EA\u52A8\u5E26\u5165\u4EE3\u7406\u547D\u4EE4\u3002","field.maxSessions":"\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","hint.maxSessions":"\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548","field.shell":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","field.shellWindows":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 %COMSPEC%\uFF09","placeholder.shell":"\u7559\u7A7A\u4F7F\u7528 $SHELL","placeholder.shellWindows":"\u7559\u7A7A\u4F7F\u7528 %COMSPEC%\uFF08\u4E5F\u53EF\u586B powershell.exe / pwsh.exe \u5B8C\u6574\u8DEF\u5F84\uFF09","list.noShellCandidate":"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF","hint.shellCandidatesWindows":"Windows \u5BBF\u4E3B\uFF1A\u5019\u9009\u6765\u81EA %COMSPEC% \u4E0E\u5DF2\u5B89\u88C5\u7684 PowerShell\uFF08Windows PowerShell 5.1 / PowerShell 7\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bcmd / PowerShell \u6CA1\u6709 POSIX \u7684\u547D\u4EE4\u8FB9\u754C\u94A9\u5B50\uFF0C\u6240\u4EE5\u8FD9\u4E24\u8005\u4E0D\u652F\u6301 shell \u96C6\u6210","hint.shellCandidates":"\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","hint.term":"TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C","field.cwd":"\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","placeholder.cwd":"\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55","field.grace":"\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","hint.grace":"\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","section.assist":"AI \u8F85\u52A9","check.assistEnabled":"\u5931\u8D25\u5373\u89E3\u91CA\uFF08\u547D\u4EE4\u975E\u96F6\u9000\u51FA\u65F6\u95EE\u6A21\u578B\u300C\u4E3A\u4EC0\u4E48 / \u4E0B\u4E00\u6B65\u300D\uFF09","hint.assistEnabled":"\u9ED8\u8BA4\u5173\u3002\u5F00\u542F\u540E\uFF0C\u547D\u4EE4\u4EE5\u975E\u96F6\u72B6\u6001\u7ED3\u675F\u65F6\u7EC8\u7AEF\u53F3\u4E0B\u89D2\u4F1A\u51FA\u73B0\u4E00\u679A\u5FBD\u6807\uFF1B\u70B9\u5B83\u624D\u628A\u90A3\u6761\u547D\u4EE4\u7684\u300C\u8F93\u51FA\u5C3E\u90E8\u300D\uFF08\u5265\u79BB\u989C\u8272\u4E0E\u8FDB\u5EA6\u6761\u3001\u6298\u6389\u91CD\u590D\u884C\u3001\u5BC6\u94A5/token \u5DF2\u906E\u76D6\uFF09\u8FDE\u540C\u5F53\u524D\u5C4F\u5E55\u53D1\u7ED9\u6A21\u578B\uFF0C\u4E0D\u53D1 scrollback\u3002\u6A21\u578B\u7ED9\u7684\u547D\u4EE4\u53EA\u4F1A\u300C\u586B\u5165\u300D\u547D\u4EE4\u884C\uFF0C\u6C38\u4E0D\u66FF\u4F60\u56DE\u8F66\u3002","field.assistRoute":"\u6A21\u578B\u8DEF\u7531\uFF08\u53EF\u9009\uFF09","hint.assistRoute":"\u7559\u7A7A\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","option.followHostModel":"\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","list.modelLoading":"\u6B63\u5728\u53D6\u5019\u9009\u2026","list.noModelCandidate":"\u5BBF\u4E3B\u6CA1\u6709\u53EF\u7528\u7684\u6A21\u578B","list.modelCatalogFailed":"\u62FF\u4E0D\u5230\u5019\u9009\uFF1A\u5BBF\u4E3B\u53EF\u80FD\u8FD8\u6CA1\u91CD\u542F\uFF0C\u6216\u6CA1\u6709\u63D0\u4F9B\u6A21\u578B\u76EE\u5F55\uFF08\u624B\u8F93\u8BF7\u6309 provider/model\uFF09","badge.assistFailed":"\u547D\u4EE4\u5931\u8D25\uFF08{code}\uFF09\xB7 \u89E3\u91CA\u4E00\u4E0B","panel.assistTitle":"\u8FD9\u6761\u547D\u4EE4\u4E3A\u4EC0\u4E48\u5931\u8D25","panel.assistCommand":"\u5EFA\u8BAE\u547D\u4EE4","status.assistThinking":"\u6B63\u5728\u95EE\u6A21\u578B\u2026","error.assistRequest":"\u89E3\u91CA\u5931\u8D25\uFF1A{message}","btn.assistFill":"\u586B\u5165\u547D\u4EE4\u884C","btn.assistCopy":"\u590D\u5236\u7B54\u6848","btn.assistCopyError":"\u590D\u5236\u62A5\u9519","btn.assistClose":"\u5173\u95ED","hint.assistFillNoEnter":"\u53EA\u5199\u8FDB\u547D\u4EE4\u884C\uFF0C\u4E0D\u4F1A\u66FF\u4F60\u56DE\u8F66","hint.assistNoCommand":"\u6A21\u578B\u6CA1\u7ED9\u51FA\u53EF\u76F4\u63A5\u586B\u7684\u547D\u4EE4 \u2014 \u7528\u300C\u590D\u5236\u300D\u81EA\u5DF1\u6311","section.ssh":"SSH \u8FDE\u63A5","btn.probeRowTitle":"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD","msg.testing":"\u6D4B\u8BD5\u4E2D\u2026","btn.test":"\u6D4B\u8BD5","btn.edit":"\u7F16\u8F91","btn.delete":"\u5220\u9664","list.emptySshHosts":"\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","btn.importSshConfig":"\u4ECE ~/.ssh/config \u5BFC\u5165","hint.importSshConfig":"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","hint.sshBook":"\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","check.tunnelEnabled":"\u542F\u7528","list.emptyTunnels":"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3","field.direction":"\u8F6C\u53D1\u65B9\u5411","option.localForwardTitle":"\u672C\u5730\u8F6C\u53D1 -L\uFF1A\u672C\u673A\u76D1\u542C\uFF0C\u8FDE\u5230 SSH \u670D\u52A1\u5668\u4FA7\u7684\u76EE\u6807","option.localForward":"\u672C\u5730 -L","option.remoteForwardTitle":"\u8FDC\u7A0B\u8F6C\u53D1 -R\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C\uFF0C\u62E8\u56DE\u672C\u673A\u670D\u52A1","option.remoteForward":"\u8FDC\u7A0B -R","option.selectBook":"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelViaBook":"\u7ECF {book} \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelBookEmpty":"\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","hint.localListenFixed":"\u672C\u673A\u76D1\u542C\u5730\u5740\u56FA\u5B9A 127.0.0.1\uFF08\u4E0D\u66B4\u9732\u5230\u5C40\u57DF\u7F51\uFF09","placeholder.localPort":"\u672C\u673A\u7AEF\u53E3","field.localListenPort":"\u672C\u673A\u76D1\u542C\u7AEF\u53E3","hint.flowLocalToRemote":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2192 SSH \u670D\u52A1\u5668\u4FA7","placeholder.remoteHost":"\u670D\u52A1\u5668\u4FA7\u4E3B\u673A","hint.remoteHostTitle":"\u76EE\u6807\u4E3B\u673A\u540D\u6216 IP\uFF08\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF1B127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09","field.remoteHost":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u4E3B\u673A","placeholder.port":"\u7AEF\u53E3","field.remotePort":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u7AEF\u53E3","placeholder.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","hint.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740\uFF08\u7F3A\u7701 127.0.0.1\uFF1B\u7559\u7A7A\u5373\u53EA\u8BA9\u670D\u52A1\u5668\u81EA\u5DF1\u8BBF\u95EE\uFF09","field.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","placeholder.listenPort":"\u76D1\u542C\u7AEF\u53E3","field.remoteListenPort":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u7AEF\u53E3","hint.flowRemoteToLocal":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2190 SSH \u670D\u52A1\u5668\u4FA7","hint.localDialFixed":"\u672C\u673A\u62E8\u53F7\u5730\u5740\u56FA\u5B9A 127.0.0.1","placeholder.localTargetPort":"\u672C\u673A\u670D\u52A1\u7AEF\u53E3","field.localTargetPort":"\u672C\u673A\u76EE\u6807\u7AEF\u53E3","hint.tunnelLocalSummary":"\u5DE6\uFF1A\u672C\u673A\u76D1\u542C\uFF08\u56FA\u5B9A 127.0.0.1\uFF09\u2192 \u53F3\uFF1A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\u7684\u76EE\u6807","hint.tunnelRemoteSummary":"\u5DE6\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C \u2192 \u53F3\uFF1A\u672C\u673A\u88AB\u8BBF\u95EE\u7684\u670D\u52A1\uFF08\u56FA\u5B9A 127.0.0.1\uFF09","btn.addTunnel":"\u6DFB\u52A0\u96A7\u9053","hint.tunnelAdd":"\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","hint.tunnelEditing":"\u6B63\u5728\u7F16\u8F91\u300C{name}\u300D\u2014\u2014\u6539\u7AEF\u53E3/\u6761\u76EE\u4F1A\u6309\u89C4\u5219\u751F\u6210\u65B0\u540D\u5B57\uFF1B\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548","panel.hostKeys":"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09","btn.importKnownHosts":"\u4ECE known_hosts \u5BFC\u5165","list.emptyHostKeys":"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9","hint.hostKeys":"\u4E00\u673A\u591A\u628A\u94A5\u5319\uFF08\u5982 rsa + ed25519\uFF09\u5404\u8BB0\u4E00\u6761\u6307\u7EB9\uFF0C\u4EFB\u4E00\u5339\u914D\u5373\u653E\u884C\uFF1B\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF0C\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE","msg.saving":"\u4FDD\u5B58\u4E2D\u2026","btn.save":"\u4FDD\u5B58","list.none":"\u65E0","meta.mem":"\u5185\u5B58","meta.disk":"\u78C1\u76D8","meta.cores":"\u6838\u5FC3","meta.uptime":"\u5728\u7EBF","meta.temp":"CPU\u6E29\u5EA6","meta.net":"\u7F51\u7EDC","error.tunnelNoBook":"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE","error.tunnelRemotePortRequired":"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09","error.tunnelLocalRequired":"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B","error.tunnelMissing":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u4E0D\u5B58\u5728\uFF08\u53EF\u80FD\u88AB\u53E6\u4E00\u4E2A\u7A97\u53E3\u5220\u9664\uFF09","error.tunnelClash":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u8BF7\u5148\u5904\u7406\u90A3\u6761\u540C\u540D\u7684\u3002","msg.renaming":"\u91CD\u547D\u540D {name}\u2026","msg.deleting":"\u5220\u9664 {name}\u2026","msg.downloading":"\u4E0B\u8F7D {name}\u2026","msg.uploadingName":"\u4E0A\u4F20 {name}","error.invalidTaskState":"\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001","hint.rememberCredentialApply":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u5E94\u7528\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","hint.noCredRefPasswordApply":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","hint.bookNameConflict":"\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD","btn.apply":"\u5E94\u7528"},M_={"error.credServiceMissing":"The host does not provide the credential service (remote.credentials)","error.credServiceIncomplete":"The credential service is incomplete","error.credStoreUnavailable":"The host does not provide the credential service (remote.credentials); cannot store","error.credStoreFailed":"Failed to store the credential: {error}","error.credClearUnavailable":"The host does not provide the credential service (remote.credentials); cannot clear","error.credClearFailed":"Failed to clear: {error}","error.credRefNeedsHost":"Fill in host and username first \u2014 the reference name is derived from them","btn.reopen":"Reopen","btn.reopenTitle":"Reopen the session with the original connection settings","btn.sftpTitle":"Open the SFTP file browser for this connection","btn.tunnels":"Tunnels {count}","btn.tunnelsTitle":"View the port-forwarding tunnels of this connection","btn.more":"More","btn.moreTitle":"More actions (port forwarding\u2026)","btn.reopenSession":"Reopen session","status.exited":"Session exited","status.ended":"Session ended","btn.clickRerun":"Click to run again","status.aiEnded":"The AI finished this session","hint.aiEndedTab":"The content stays for now: switch away or hit \u201CDismiss\u201D to close this tab","btn.dismiss":"Dismiss","btn.dismissTitle":"Close this tab (the session has already ended)","hint.reopenWithSpec":"Open a session again from the same spec (persistent tabs reattach to tmux, command tabs run again)","btn.newLocalTerminal":"New local terminal","hint.reopenAgentLocal":"This session was opened by the AI and has ended: this opens a new local terminal, it does not reattach to the original one","msg.passwordNotStored":"For security, plaintext passwords/passphrases are not kept in browser storage, so this connection needs them again: re-enter them when reopening the tab, or switch the credential to an env: reference in the settings card (the value lives in the host credential store).","error.terminalNeedsCommand":"ttyTerminal requires a command","error.terminalCommandSingleLine":"command must be a single line","error.terminalNeedsHost":"ttyTerminal.mount requires an HTMLElement as the mount point","error.panelNotReady":"ttyPanel.mountPane: the terminal panel is not ready","panel.dragHeight":"Drag to resize height","panel.dragWidth":"Drag to resize width","btn.closePane":"Close the side pane","btn.expandPane":"Expand the side pane","btn.collapsePane":"Collapse the side pane","panel.tabLabel":"Terminal {n}","btn.close":"Close","btn.closeTabAria":"Close tab: {label}","btn.newTab":"New (local / SSH)","btn.tabList":"Tab list","btn.tabListTitle":"Tab list ({n})","list.tabsAllVisible":"No tabs are out of view","list.cleanExited":"Clean up exited tabs ({n})","btn.closeTab":"Close this tab","btn.hideFromAgent":"Hide this tab from the AI","btn.showToAgent":"Unhide (make it available to the AI)","btn.hiddenMark":"Hidden from AI","btn.closeLeft":"Close tabs to the left ({n})","btn.closeOthers":"Close other tabs ({n})","btn.closeRight":"Close tabs to the right ({n})","list.subLive":"{n} of them are still open","meta.tunnelRemote":"remote:{host}:{port} \u2192 local:{local}","meta.tunnelLocal":"local:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"Hosted by tmux \u2014 the session is reattached by name after a disconnect or host restart","status.notPersisted":"Not persisted","status.tmuxUnavailableTitle":"A persistent session was requested but tmux is unavailable \u2014 this is a plain session","status.connected":"Connected","status.connecting":"Connecting","status.errored":"Connection error","panel.tunnels":"Port forwarding","hint.tunnelsSettings":"Configure in Settings \u2192 Plugins \u2192 Terminal panel","panel.tunnelsFor":"Port forwarding \u2014 {name}","list.loading":"Loading\u2026","hint.tunnelsCard":"Add, remove, enable, or disable tunnels in the port-forwarding section of Settings \u2192 Plugins \u2192 Terminal panel","list.noActiveTunnels":"No enabled tunnels for this connection","status.fatalSuffix":" (no retry; fix the config)","msg.maxSessions":"Session limit reached ({live} total / max {max}: {own} in this window{others}) \u2014 close unused windows or tabs, or raise \u201CConcurrent session limit\u201D in the settings card","msg.maxSessionsOthers":" + {count} in other windows","error.probeHttp":"Connection test failed (HTTP {status})","msg.probing":"Testing the connection\u2026","meta.reachable":"reachable","meta.unreachable":"unreachable","meta.probeBanner":"banner ok","meta.hostKeyMatched":"Host key matched","meta.hostKeyRecorded":"Host key recorded (TOFU)","meta.hostKeyMismatch":"Host key mismatch!","meta.authOkMs":"Authenticated ({ms}ms)","meta.authOk":"Authenticated","meta.probeOk":"\u2705 Connected: {detail}","error.unknown":"Unknown error","btn.maxSessionsTitle":"Session limit reached \u2014 click to see what to do","option.localTerminal":"Local terminal","hint.tmuxHosted":"Hosted by tmux \xB7 recoverable after a host restart","hint.openInSessionCwd":"Open in the current session working directory","panel.sshBook":"SSH host book","btn.sftpFileBrowse":"SFTP file browser","btn.editConnection":"Edit connection","list.emptySshBook":"(empty \u2014 save one in the settings card or via \u201CSSH connection\u2026\u201D)","option.sshConnect":"SSH connection\u2026","hint.sshConnect":"Fill in host, user, and authentication manually","panel.editConnection":"Edit connection \xB7 {name}","panel.sshConnect":"SSH connection","section.jump":"Jump host","field.jumpHost":"Jump host ([user@]host[:port]; empty = direct)","placeholder.jumpHost":"e.g. bastion.corp:2222","check.jumpOwnCred":"Use separate credentials for the jump host","field.jumpUsername":"Jump host user (empty = same as the target)","field.jumpAuth":"Jump host auth (empty = same as the target)","hint.jumpInherit":"Empty credentials reuse the target host\u2019s auth method and keys.","hint.jumpInheritFull":"Empty credentials reuse the target host\u2019s auth method and keys. When the jump host itself is unreachable the error names it (it will not masquerade as a target timeout).","meta.jumpStage":"Jump host {label}","meta.viaJump":"\u21E2 via {label}","meta.viaProxy":"\u21E2 via proxy command","section.proxyCommand":"Proxy command","field.proxyCommand":"Proxy command (ProxyCommand; empty = unused)","placeholder.proxyCommand":"e.g. ssh -W %h:%p bastion","hint.proxyCommand":"A command on this machine whose stdin/stdout become the SSH transport; a jump host wins if both are set.","hint.proxyCommandFull":"A command run on this machine whose stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). Supports %h host, %p port, %r user, %n host and %% for a literal %; anything else is left as written. If a jump host is set too, the jump host wins (OpenSSH semantics). It needs the switch below, and importing ~/.ssh/config never fills it in.","hint.proxyCommandDisabled":"\u26A0 \u201CAllow ProxyCommand\u201D is off right now: this command will not run and the connection fails explicitly (it does not fall back to a direct connection). Turn it on in Plugin settings \u2192 Terminal panel.","hint.proxyCommandNotGranted":"\u26A0 Not granted by the host: clicking this switch starts a grant in place (the panel shows one command to run in a terminal on the host \u2014 no restart), or use the strictest route \u2014 export DSH_TTY_ALLOW_PROXY_COMMAND=1 in the environment that launched dsh and restart the host (setting it after launch does not count). The reason: cross-site pages and in-page scripts can both send loopback requests, so if the settings UI could raise it out of thin air this gate would be pointless. Turning it off always works.","badge.notEffective":"Not effective: not granted by the host","elev.title":"Grant in place (no restart)","elev.lockedWhy":"Any local process can send loopback requests, so \u201Cturn on a dangerous capability\u201D cannot be decided by this page alone \u2014 it has to be confirmed on the host\u2019s filesystem once.","elev.step":"Run the command below in a terminal on the host and the switch unlocks by itself:","elev.copy":"Copy command","elev.copied":"Copied","elev.copyManual":"The clipboard is unavailable here \u2014 select the command above and copy it manually.","elev.expiresIn":"expires in {sec}s","elev.expired":"This confirmation has expired \u2014 generate a new one.","elev.waiting":"Waiting for confirmation\u2026 once you run the command this turns into \u201Cgranted\u201D automatically.","elev.regenerate":"Generate a new one","elev.loading":"Generating the confirmation command\u2026","elev.granted":"Granted and now in effect.","elev.grantedNeedSave":"Granted. Press \u201CSave\u201D to apply.","elev.grantedAt":"Granted \xB7 {time}","elev.revoke":"Revoke host grant","elev.revoked":"Host grant revoked (the config switch is left untouched; granting again takes effect immediately).","elev.viaEnv":"Granted by a launch environment variable; to revoke, remove it from the launch environment and restart the host.","elev.close":"Collapse","elev.disableFirst":"Turn this config switch off first","elev.otherWay":"The other way (strongest, needs a host restart)","elev.envHow":"In the environment that launched dsh: export {env}=1, then restart the host. Setting it after launch \u2014 or writing it into some other config file \u2014 does not count as a grant; that is exactly what this gate guards against.","elev.error":"In-place grant failed: ","meta.probeProxy":"Proxy command","meta.probeProxyOff":"Proxy command (disabled)","meta.probeTcpSkipped":"Direct TCP check skipped (using the proxy command)","section.connection":"Connection","field.host":"Host","placeholder.host":"example.com or IP","field.port":"Port","field.username":"Username","section.auth":"Authentication","field.authMethod":"Auth method","option.authInherit":"(same as the target)","option.authAgent":"agent \u2014 use the local ssh-agent","option.authKey":"key \u2014 private key file","option.authPassword":"password \u2014 password","field.keyPath":"Private key path","field.hostKeyAlias":"Host key alias","field.passphrase":"Key passphrase (optional)","field.password":"Password","placeholder.credRef":"Or: pick a reference name from the credential store","hint.credRefCandidates":"Candidates = reference names already in the credential store + those in use by the local host book","list.credOverwrite":"{name} (click again to overwrite)","list.moreMatches":"{count} more \u2014 keep typing to filter","list.noCredRef":"No matching reference","check.rememberCredential":"Store in the credential store on save","hint.rememberCredential":"When checked, \u201CSave changes\u201D or \u201CConnect (and save)\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","btn.clearCredential":"Clear stored credential","error.credPlainUnavailable":"The host does not provide the credential service (remote.credentials); plaintext save only","error.credPlainIncomplete":"The credential service is incomplete; plaintext save only","status.credUnreported":"Reference {ref}: the host reported no status","error.credStatusFailed":"Failed to read the credential status: {error}","status.credStored":"Stored{source} \xB7 {ref}","meta.credSource":" (source: {source})","status.credUnknown":"Reference {ref}: the store does not have this value yet","hint.noCredRefPassphrase":"No other connection uses a credential reference yet \u2014 you can type env:NAME straight into the passphrase box","hint.noCredRefPassword":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on save\u201D above to create one, or type env:NAME straight into the password box","section.options":"Options","section.advanced":"Advanced","hint.advanced":"Jump host \xB7 Proxy command \xB7 Host key alias","meta.advancedConfigured":"Configured: {items}","check.agentForward":"agent forwarding (the remote side can use local ssh-agent keys, e.g. remote git clone)","hint.hostKeyAlias":"Empty = pin by host address; one alias shares a fingerprint record across addresses.","hint.hostKeyAliasFull":"Empty = pin the fingerprint by host address. When one host is reached through different addresses (behind a bastion / via port forwarding), give them the same alias so they share one host-key record instead of reporting a fingerprint change on every switch; it only decides where the fingerprint is stored, never the connection address","placeholder.hostKeyAlias":"Empty = by host address","check.persist":"Persistent session (hosted by tmux, survives a disconnect/restart; tmux must be installed on the remote)","check.saveToBook":"Save to the host book (overwrite the same name)","field.bookName":"Host book name","placeholder.bookName":"Leave empty to use the host name","error.hostUserRequired":"Host and username are required","error.keyPathRequired":"auth=key requires a private key path","error.passwordRequired":"auth=password requires a password","btn.cancel":"Cancel","btn.connect":"Connect","btn.fileBrowse":"File browser","btn.browseTitle":"Open the SFTP file browser with the values currently filled in, without touching a terminal","btn.probe":"Test","btn.probeTitle":"Diagnose the connection with the values currently filled in (TCP \u2192 host key \u2192 authentication); no session is created and no host fingerprint is recorded","error.saveCredFailed":"Save failed: {error}","btn.saveEdit":"Save changes","error.saveBookFailed":"Failed to save the host book: {error}","error.bookNameTaken":"The host book already has an entry named: {name}","panel.sftpDual":"SFTP dual pane \xB7 {label}","status.failed":"Failed","status.done":"Done","placeholder.localPath":"Local path (Enter to go)","placeholder.remotePath":"Remote path (Enter to go)","btn.refresh":"Refresh","btn.mkdir":"New folder","btn.hiddenFiles":"Hidden files","btn.hiddenFilesTitle":"Show / hide dot-files (.env, .gitignore, \u2026)","error.dirNotReady":"The directory is not resolved yet","meta.dir":"folder","btn.transferTo":"Transfer to {target}: {path}","meta.local":"local","meta.remote":"remote","error.transferDirsNotReady":"Both directories are not resolved yet; wait for the lists to load before transferring","msg.transferring":"Transferring {name}\u2026","error.transferFailed":"Transfer failed","error.noTaskId":"The server returned no task id","msg.transferCanceled":"Transfer canceled: {name}","msg.transferred":"Transferred {name}","btn.download":"Download {name}","btn.rename":"Rename {name}","placeholder.newName":"New name","btn.deleteEntry":"Delete {name}","btn.deleteEntryDir":"Delete {name} (with contents)","msg.deleted":"Deleted {name}","list.parentDir":".. (parent folder)","list.emptyDir":"(empty folder)","list.hiddenOnly":"(only hidden files here \u2014 click \u201CHidden files\u201D on the pane header to show them)","error.dropOnLocalPane":"Dropping onto the local pane has no action: to send local files to the other side, drop them on the right-hand \u201CRemote\u201D pane","list.truncated":"\u2026{rest} more not rendered ({total} total) \u2014 use the path box above to jump to a subfolder","list.itemCount":"{count} items","placeholder.newDirName":"New folder name (relative to the current folder)","msg.creatingDir":"Creating folder {name}\u2026","btn.ok":"OK","btn.confirm":"Confirm?","btn.cancelTransfer":"Cancel transfer","msg.downloadCanceled":"Download canceled: {name}","msg.downloadResuming":"Connection dropped \u2014 resuming {name} from {offset}\u2026","error.downloadFailed":"Download failed","msg.downloaded":"Downloaded {name} ({size})","error.downloadTooBig":"The file exceeds the download limit ({size}); use dual-pane \u21E6 direct transfer or scp/rsync in the terminal","msg.canceled":"Canceled","btn.upload":"Upload","btn.uploadTitle":"Pick files to upload, or drag files/folders straight into the list","msg.uploading":"Uploading\u2026","msg.uploadDone":"Upload finished","error.uploadFailed":"Upload failed","error.networkError":"Network error","error.uploadCountExceeded":"Too many files (limit {max}): {count} this time \u2014 upload in batches","status.overLimit":"Over the limit","error.uploadTooBig":"The file exceeds the upload limit ({size}): {name} \u2014 use dual-pane \u21E8 direct transfer or scp/rsync in the terminal","error.uploadTotalTooBig":"The total size exceeds the upload limit: upload in batches (or use dual-pane \u21E8 direct transfer)","msg.uploadCanceled":"Upload canceled ({done}/{total} done)","status.allDone":"All done","msg.uploadDoneCount":"Uploaded {count} files","error.connectFailed":"Connection failed: {error}","status.connectingEllipsis":"Connecting\u2026","status.connectedPid":"Connected pid={pid}","status.connectedSsh":"SSH {target}connected","status.exitedWith":"Exited {detail}","status.error":"Error: {message}","status.retryHint":"{message} \xB7 click to retry","btn.clickRetry":"Click to retry","status.disconnectedReconnecting":"Disconnected \u2014 reconnecting","status.disconnected":"Disconnected","status.reconnecting":"Reconnecting\u2026","error.copyFailed":"Copy failed: this environment does not allow clipboard access (over http, use localhost or the terminal's own shortcuts)","status.initializing":"Initializing\u2026","placeholder.search":"Search (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"Search (Ctrl+F) \u2014 Enter next / Shift+Enter previous","btn.clearTitle":"Clear","btn.minimizeTitle":"Minimize (sessions keep running; the status moves into the sidebar entry)","btn.minimize":"Minimize","btn.closePanelTitle":"Close the panel and end every session (you are asked first when sessions are still open; to just put it away hit \u201C\u2014\u201D, sessions keep running)","confirm.closeTitle":"End {n} sessions and close the panel?","confirm.closeText":"Closing the panel ends these {n} sessions that are still open (the tabs go with them).","confirm.closeTextAgent":"Closing the panel ends these {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.closeHint":"Only need room for other windows? Hit \u201CMinimize\u201D \u2014 sessions and output keep running.","confirm.closeOk":"End {n} sessions and close","confirm.tabsTitle":"End {n} sessions and close those tabs?","confirm.tabsText":"This ends {n} sessions that are still open, and their tabs go with them.","confirm.tabsTextAgent":"This ends {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.tabsHint":"Already-exited tabs are read-only leftovers \u2014 cleaning those loses nothing.","confirm.tabsOk":"End {n} sessions","btn.restoreDock":"Click to restore the terminal window","panel.title":"Terminal","status.minimized":"Terminal minimized \u2014 click to restore","error.configLoadFailed":"Failed to load the config","error.saveTunnelFailed":"Failed to save the tunnel","error.tunnelNameTaken":"A tunnel named \u201C{name}\u201D already exists \u2014 each \u201Chost book entry + direction + port\u201D combination can appear once. Change the port to get a new name, or delete the old one first.","msg.tunnelApplied":"Tunnel \u201C{name}\u201D is active","msg.tunnelUpdated":"Tunnel \u201C{name}\u201D updated","error.nameHostUserRequired":"Name, host, and username are required","msg.hostEdited":"Entry \u201C{name}\u201D updated \u2014 written to the config on \u201CSave\u201D","error.probeFailed":"\u274C Connection failed: {error}","error.hostKeyDeleteFailed":"Failed to delete the host key record","msg.hostKeyDeleted":"Host key record deleted (the fingerprint is recorded again on the next connection)","error.sshConfigReadFailed":"Failed to read ~/.ssh/config","msg.proxySkipped":"{count} entries use a jump host that could not be resolved (missing alias, or the alias itself needs a jump host) and were not imported: {names}","msg.proxyCommandSkipped":"{count} entries only set a proxy command (ProxyCommand) and were not imported: {names} \u2014 a proxy command is local command execution, so importing never fills it in; add it by hand on the connection-book entry and turn on \u201CAllow ProxyCommand\u201D","msg.skippedNotConcrete":"{count} entries are not a concrete host (wildcard / no User)","list.separator":", ","meta.etc":" etc.","msg.importOverflow":"{count} entries beyond the import limit were not imported","list.separatorFull":"; ","msg.noNewEntries":"No new entries ({count} skipped as duplicates)","msg.noImportableHosts":"~/.ssh/config has no concrete hosts to import","msg.importedHosts":"Imported {added} (skipped {skipped} duplicates); written to the config on \u201CSave\u201D","error.knownHostsReadFailed":"Failed to read ~/.ssh/known_hosts","msg.noNewFingerprints":"No new fingerprints ({count} already exist)","msg.noImportableKnownHosts":"known_hosts has no concrete hosts to import","error.saveHostKeysFailed":"Failed to save hostKeys","msg.importedFingerprints":"Imported fingerprints for {added} hosts (skipped {skipped} that already existed)","hint.knownHostsTruncated":"; note: known_hosts has more than 500 hosts \u2014 only the first 500 were imported","error.saveFailed":"Save failed","msg.saved":"Saved and applied live","check.rememberCredentialApply":"Store in the credential store on apply","hint.appliedOnSave":"Written to the config with the card's \u201CSave\u201D","card.name":"Terminal panel","card.desc":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence.","card.descFull":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence; shell / TERM / concurrency limits apply live on save.","list.loadingConfig":"Loading the config\u2026","section.basic":"Basics","check.enabled":"Enable the plugin (applies live on save: tools and the panel entry are withdrawn immediately, sessions move to keepalive)","check.announce":"Announce the terminal panel capabilities to the agent","check.shellIntegration":"Shell integration (OSC 133/7 injection)","check.shellIntegrationWindows":"Shell integration (OSC 133/7 injection; tty_capture{last} and cwd following depend on it)","hint.shellIntegrationWindows":"Not applicable on Windows hosts: injection relies on the POSIX `-c` wrapper and rc stubs, which do not hold for cmd / PowerShell (cmd ignores `-c` and exits, PowerShell reports that export does not exist). So cwd following and tty_capture{last} are unavailable for \u201Clocal\u201D tabs; remote Linux / macOS hosts are unaffected.","section.sftp":"SFTP file transfer","field.sftpStyle":"SFTP file browser style","option.sftpDialog":"Single pane \u2014 remote directory + upload/download/drag","option.sftpDual":"Dual pane \u2014 local on the left, remote on the right, direct transfer on selection","hint.sftpDual":"Dual pane copies files between local and remote (recursive, overwriting same names); takes effect after reopening SFTP","field.sftpLimits":"SFTP transfer limits (0 = unlimited)","field.downloadLimit":"Download limit (MB)","field.uploadLimit":"Upload limit (MB)","field.uploadCountLimit":"Batch file count limit","hint.sftpLimits":"Browser-side guard: a single file over the limit aborts the download/upload (for large files use dual-pane \u21E8/\u21E6 direct transfer or scp/rsync in the terminal; they do not consume browser memory); the file count limit applies to one batch/drag upload; applies live on save","section.session":"Sessions","field.persistence":"Session persistence (tmux)","option.persistOff":"Off \u2014 sessions end with the panel/host (default)","option.persistTmux":"tmux \u2014 new terminal/SSH tabs are persistent by default","hint.persistence":"When on, all new tabs (local / SSH host book / SSH connection dialog) are hosted by tmux by default and survive a host restart; tmux must be installed locally/remotely; the SSH dialog can opt out per connection; existing tabs are unaffected","hint.persistenceWindows":"; tmux is unavailable on Windows hosts, so local tabs still open but are not hosted","check.endOnPageClose":"End persistent sessions when the page closes (no keepalive)","check.statsEnabled":"Server stats bar (CPU / memory / disk / uptime / TCP / network; items that cannot be sampled show \u201CN/A\u201D)","hint.statsEnabled":"Off by default: persistent sessions survive closing the whole page (recoverable after the keepalive window); when on, they end together with the tmux session once the page disconnects and the keepalive window expires \u2014 note that refreshing the page within the keepalive window is unaffected","check.allowProxyCommand":"Allow ProxyCommand (runs a command on this machine; off by default)","hint.allowProxyCommand":"When on, a proxy command set on a connection-book entry runs on this machine, and its stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). This is the only switch in this plugin that turns a settings field into local command execution, so it is off by default: while off, a connection carrying a proxy command fails explicitly (it does not fall back to a direct connection). Importing ~/.ssh/config never fills one in.","field.maxSessions":"Concurrent session limit (1\u201316)","hint.maxSessions":"New tabs beyond the limit are rejected; applies live on save","field.shell":"Shell path (defaults to $SHELL)","field.shellWindows":"Shell path (defaults to %COMSPEC%)","placeholder.shell":"Leave empty to use $SHELL","placeholder.shellWindows":"Leave empty to use %COMSPEC% (or enter the full path to powershell.exe / pwsh.exe)","list.noShellCandidate":"No matching candidate \u2014 just type any path","hint.shellCandidatesWindows":"Windows host: candidates come from %COMSPEC% and the installed PowerShell (Windows PowerShell 5.1 / PowerShell 7), and you can type any path; cmd / PowerShell have no POSIX command-boundary hooks, so shell integration is unsupported for them","hint.shellCandidates":"Pick an installed shell from the list ($SHELL first) or type any path; zsh / bash support shell integration","hint.term":"TUI programs depend on this value","field.cwd":"Fallback working directory (the client's current session cwd wins)","placeholder.cwd":"Leave empty to use the host process start directory","field.grace":"Disconnect keepalive (seconds, 0 = end immediately)","hint.grace":"Sessions are kept alive for reconnect after a page refresh or network hiccup and end on timeout; applies live on save","section.assist":"AI assist","check.assistEnabled":'Explain failures (ask the model "why / what next" when a command exits non-zero)',"hint.assistEnabled":"Off by default. When on, a chip appears in the corner of the terminal after a command exits non-zero; clicking it sends that command's output tail (colors and progress bars stripped, repeated lines collapsed, keys/tokens masked) together with the current screen to the model \u2014 never the scrollback. A suggested command is only ever typed into the prompt line, never submitted for you.","field.assistRoute":"Model route (optional)","hint.assistRoute":"Empty follows the host default model","option.followHostModel":"Follow the host default model","list.modelLoading":"Loading candidates\u2026","list.noModelCandidate":"The host advertises no models","list.modelCatalogFailed":"Candidates unavailable \u2014 the host may not have restarted, or serves no model catalog (type provider/model to enter one manually)","badge.assistFailed":"Command failed ({code}) \xB7 explain","panel.assistTitle":"Why this command failed","panel.assistCommand":"Suggested command","status.assistThinking":"Asking the model\u2026","error.assistRequest":"Explanation failed: {message}","btn.assistFill":"Insert command","btn.assistCopy":"Copy answer","btn.assistCopyError":"Copy error","btn.assistClose":"Close","hint.assistFillNoEnter":"Types it into the prompt line; never submits","hint.assistNoCommand":"The model gave no directly-insertable command \u2014 use Copy and pick one yourself","section.ssh":"SSH connections","btn.probeRowTitle":"Test this entry: per-stage diagnosis of TCP \u2192 host key \u2192 authentication","msg.testing":"Testing\u2026","btn.test":"Test","btn.edit":"Edit","btn.delete":"Delete","list.emptySshHosts":"No entries \u2014 add one via the terminal panel's \u201C+\u201D \u2192 SSH connection\u2026 and check \u201CSave to the host book\u201D","btn.importSshConfig":"Import from ~/.ssh/config","hint.importSshConfig":"Same names are skipped; written to the config on \u201CSave\u201D","hint.sshBook":"Written to the config together with \u201CSave\u201D; passwords/passphrases support env:VAR references to avoid plaintext storage","check.tunnelEnabled":"Enable","list.emptyTunnels":"No tunnels \u2014 map a remote database or internal service to a local port","field.direction":"Forwarding direction","option.localForwardTitle":"Local forward -L: listen locally and connect to a target on the SSH server side","option.localForward":"Local -L","option.remoteForwardTitle":"Remote forward -R: listen on the SSH server side and dial back to a local service","option.remoteForward":"Remote -R","option.selectBook":"Pick a host book entry","hint.tunnelViaBook":"Connects via {book} \u2014 the tunnel's host and credentials come from that host book entry","hint.tunnelBookEmpty":"Pick which SSH connection this tunnel uses (host and credentials come from the host book)","hint.localListenFixed":"The local listen address is fixed to 127.0.0.1 (not exposed to the LAN)","placeholder.localPort":"Local port","field.localListenPort":"Local listen port","hint.flowLocalToRemote":"Traffic flow: local \u2192 SSH server side","placeholder.remoteHost":"Server-side host","hint.remoteHostTitle":"Target host name or IP (reached from the SSH server side; 127.0.0.1 = the server itself)","field.remoteHost":"Server-side target host","placeholder.port":"Port","field.remotePort":"Server-side target port","placeholder.remoteListenHost":"Server-side listen address","hint.remoteListenHost":"Server-side listen address (defaults to 127.0.0.1; leave empty to allow only the server itself)","field.remoteListenHost":"Server-side listen address","placeholder.listenPort":"Listen port","field.remoteListenPort":"Server-side listen port","hint.flowRemoteToLocal":"Traffic flow: local \u2190 SSH server side","hint.localDialFixed":"The local dial address is fixed to 127.0.0.1","placeholder.localTargetPort":"Local service port","field.localTargetPort":"Local target port","hint.tunnelLocalSummary":"Left: local listener (fixed 127.0.0.1) \u2192 Right: target reached from the SSH server side","hint.tunnelRemoteSummary":"Left: SSH server-side listener \u2192 Right: local service being reached (fixed 127.0.0.1)","btn.addTunnel":"Add tunnel","hint.tunnelAdd":"Takes effect immediately; reconnects automatically after a drop; prefer local ports above 1024; remote hosts are reached from the SSH server side (127.0.0.1 = the server itself)","hint.tunnelEditing":"Editing \u201C{name}\u201D \u2014 changing the port/entry derives a new name by rule; takes effect immediately on save","panel.hostKeys":"SSH host key records (TOFU)","btn.importKnownHosts":"Import from known_hosts","list.emptyHostKeys":"No records \u2014 the host fingerprint is recorded automatically after the first successful SSH connection","hint.hostKeys":"A host with several keys (e.g. rsa + ed25519) gets one fingerprint each and any match is accepted; a changed fingerprint rejects the connection (MITM protection) \u2014 delete that record once you are sure it is safe, then reconnect","msg.saving":"Saving\u2026","btn.save":"Save","list.none":"N/A","meta.mem":"Memory","meta.disk":"Disk","meta.cores":"Cores","meta.uptime":"Uptime","meta.temp":"CPU temp","meta.net":"Network","error.tunnelNoBook":"Add an SSH entry to the host book first","error.tunnelRemotePortRequired":"A remote listen port and a local target port are required (1\u201365535)","error.tunnelLocalRequired":"Local port, remote host, and remote port are required","error.tunnelMissing":"Tunnel \u201C{name}\u201D no longer exists (it may have been deleted by another window)","error.tunnelClash":"A tunnel named \u201C{name}\u201D already exists \u2014 handle that one first.","msg.renaming":"Renaming {name}\u2026","msg.deleting":"Deleting {name}\u2026","msg.downloading":"Downloading {name}\u2026","msg.uploadingName":"Uploading {name}","error.invalidTaskState":"The server returned an invalid task state","hint.rememberCredentialApply":"When checked, \u201CApply\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","hint.noCredRefPasswordApply":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on apply\u201D above to create one, or type env:NAME straight into the password box","hint.bookNameConflict":"A same-name conflict is rejected","btn.apply":"Apply"};function R_(e,t){return t===void 0?e:String(e).replace(/\{(\w+)\}/g,(r,i)=>t[i]===void 0?"":String(t[i]))}function Ch(e,t){return R_(Xs[e]!==void 0?Xs[e]:e,t)}var v=Ch;function A_(e){e.inject(["locale"],t=>{let r=t.locale.register(Ao,"zh",Xs),i=t.locale.register(Ao,"en",M_);return v=t.locale.bind(Ao),()=>{i(),r(),v=Ch}})}function D_(){return Pc(document.baseURI,globalThis.__DSH_TRANSPORT__?.streamBaseUrl)}function ui(){return Ut!==null&&typeof Ut.describe=="function"?Ut:null}function ii(e){let t=String(e??"").trim();return t.startsWith("env:")?t.slice(4).trim():""}function P_(){let e=new Set;for(let t of nr)for(let r of[t?.password,t?.passphrase]){let i=ii(r);i!==""&&e.add(i)}return[...e]}async function B_(){try{let t=await(await fetch("/api/dsh-tty/credential-refs",{cache:"no-store"})).json();if(t.ok&&Array.isArray(t.names))return t.names.filter(r=>typeof r=="string"&&r!=="")}catch{}return[]}async function xh(){return[...new Set([...P_(),...await B_()])].sort()}async function kh(e){let t=ui();if(t===null)return{error:v(Ut===null?"error.credServiceMissing":"error.credServiceIncomplete")};try{let r=await t.describe([e]),i=r?.ok===!0?r.value?.[e]:void 0;return i===void 0?{unreported:!0}:{view:{configured:i.configured===!0,writable:i.writable===!0,source:typeof i.source=="string"?i.source:""}}}catch(r){return{error:r instanceof Error?r.message:String(r)}}}async function O_(e,t){let r=ui();if(r===null||typeof r.set!="function")return{error:v("error.credStoreUnavailable")};try{return await r.set(e,t),{value:"env:"+e}}catch(i){return{error:v("error.credStoreFailed",{error:i instanceof Error?i.message:String(i)})}}}async function Eh(e){let t=ui();if(t===null||typeof t.unset!="function")return{error:v("error.credClearUnavailable")};try{return await t.unset(e),{}}catch(r){return{error:v("error.credClearFailed",{error:r instanceof Error?r.message:String(r)})}}}async function Lh(e,t,r,i,o,s){if(e!==!0)return{};let n=String(t??"").trim();if(n===""||n.startsWith("env:"))return{};let a=Bc(r,i,o,s);return a===""?{error:v("error.credRefNeedsHost")}:O_(a,n)}function fn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var zs;function es(){document.getElementById("dsh-tty-style")||(zs=document.createElement("style"),zs.id="dsh-tty-style",zs.textContent=Mc+`
3766
- `+Tc,document.head.appendChild(zs))}var pn='<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>',I_='<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>',Th='<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>',N_='<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>',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="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>',Mh='<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>',Rh='<svg viewBox="0 0 16 16" width="13" height="13" fill="currentColor" stroke="none" aria-hidden="true"><circle cx="3.4" cy="8" r="1.35"/><circle cx="8" cy="8" r="1.35"/><circle cx="12.6" cy="8" r="1.35"/></svg>',F_='<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>',_n='<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>',ts='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>',W_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/></svg>',j_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/><path d="M3 13L13 3"/></svg>',z_='<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>',$i='<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>',Ah='<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>',Dh='<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>',ta='<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>',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 3v7.2"/><path d="M5 7.4L8 10.4l3-3"/><path d="M3.4 12.8h9.2"/></svg>',U_='<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>',ra='<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>',Tr='<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>',ia='<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>',Bh='<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>',sa='<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>',na='<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>',$_='<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="M8 3.4v9"/><path d="M4.8 9.2L8 12.4l3.2-3.2"/></svg>',uh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><path d="M6 12L9.29289 8.70711C9.68342 8.31658 9.68342 7.68342 9.29289 7.29289L6 4"/></svg>',q_='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><path d="M4 6L7.29289 9.29289C7.68342 9.68342 8.31658 9.68342 8.70711 9.29289L12 6"/></svg>',K_='<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>',G_='<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>',V_='<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>',Oh='<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>',Y_='<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>',Ih='<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>',Nh=null,Be=null,ce=null,Zs=null,qi=null,Ut=null,Mr=null,Br=null,Te=null,zt=null,Oi=null,Ii=null,Qs=null,Ct=null,Ni=null,it=null,kt=null,ir=null,si=null,Ki=!1,Hi=null,Xe=!1,rt=null,Gi=null,fi=null,Or=null,en=null,Rr=null,Fi=1e3,tn="dsh-tty:tabs",ie=new Map,rs=new Set,oa=()=>rs.size>0,Io=new Set,xe=null,is=0,Us=!1,Et=null,rn=!1,yr=new Map,Ar=null,Ir=null,ni=null,gr=null,sn=null,pt=null,oi=null,nr=[],nn=!0,Rt=null,$t=null,Vi="",ai=null,No=null,At=null,Wi=null,Bi=null,Ho=null,Fo=new Set;function mn(e){return Fo.add(e),()=>Fo.delete(e)}mn(({tab:e,addAction:t})=>{Pr&&e.exited&&t(N_,v("btn.reopen"),v("btn.reopenTitle"),()=>Ji(e.sid))});mn(({tab:e,addAction:t})=>{Pr&&t(H_,"SFTP",v("btn.sftpTitle"),()=>yn(e.spawnSpec,e.sid))});mn(({bookName:e,addAction:t})=>{if(!Pr)return;let r=e!==""?nd(e):0;if(r>0){t(Mh,v("btn.tunnels",{count:r}),v("btn.tunnelsTitle"),i=>Zh(i.currentTarget,e));return}e!==""&&t(Rh,v("btn.more"),v("btn.moreTitle"),i=>Mm(i.currentTarget,e))});function gn(e,t){if(Mr===null)return;Mr.textContent=e.split("\u2014\u2014")[0],Mr.title=e,Br.dataset.state=t,Zs!==null&&(Zs.style.display=t==="connected"?"none":""),fi!==null&&(fi.textContent=e),Or!==null&&(Or.dataset.state=t);let r=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");r!==null&&(r.dataset.state=t)}function Do(e,t,r){let i=typeof e=="string"&&e!==""?e:null;if(i!==null){let o=ie.get(i);o!==void 0&&(o.statusText=t,o.statusState=r)}eh(i,xe)&&(qi=i,gn(t,r))}function $s(e,t){qi=null,gn(e,t)}function aa(){if(!th(qi,xe))return;let e=xe===null?void 0:ie.get(xe);qi=e===void 0?null:xe;let t=Qc(e,v);gn(t.text,t.state)}function Ne(e){Be!==null&&Be.readyState===WebSocket.OPEN&&Be.send(JSON.stringify(e))}function J_(){let e=[],t=document.createDocumentFragment();for(let r of Ro(v)){let i=document.createElement("span");i.className="tt_statsItem";let o=document.createElement("span");o.className="tt_statsLabel",o.textContent=r.label,i.appendChild(o);let s=null,n=null;r.kind==="pct"&&(s=document.createElement("span"),s.className="tt_statsMeter",n=document.createElement("span"),n.className="tt_statsMeterFill",s.appendChild(n),i.appendChild(s));let a=document.createElement("span");a.className="tt_statsValue",i.appendChild(a),t.appendChild(i),e.push({item:i,value:a,meter:s,fill:n,slot:null})}return Rt!==null&&Rt.appendChild(t),e}function X_(e,t){let r=dh(t!==void 0?t.stats:null,v);for(let i=0;i<e.length;i+=1){let o=e[i],s=r[i];if(s!==void 0&&(o.slot!==s.slot&&(o.slot=s.slot,o.value.style.minWidth=s.slot>0?s.slot+"ch":""),o.value.textContent!==s.value&&(o.value.textContent=s.value),o.item.getAttribute("title")!==s.title&&o.item.setAttribute("title",s.title),o.fill!==null&&o.meter!==null)){let n=s.pct===null?"0%":Math.max(0,Math.min(100,s.pct)).toFixed(1)+"%";o.fill.style.width!==n&&(o.fill.style.width=n);let a=oh(s.pct);o.meter.dataset.level!==a&&(o.meter.dataset.level=a)}}}function vn(){Bi=null,Ho=null}function Z_(){if(ce===null||Xe||!nn)return!1;let e=Pt();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:ch(e.statsAt)}function on(){if(Xe)return;let e=Pt();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&vi(e)}catch{}}}function Nr(){try{Q_()}catch(e){console.warn("[dsh-tty] \u72B6\u6001\u6761\u6E32\u67D3\u5931\u8D25\uFF08\u5DF2\u6536\u8D77\uFF09: "+(e instanceof Error?e.message:String(e)));try{Rt!==null&&(Rt.hidden=!0,Rt.textContent=""),vn(),it!==null&&delete it.dataset.stats}catch{}}}function Q_(){if(it===null||Rt===null)return;let e=Z_(),t=it.dataset.stats!==void 0!==e;if(!e){t&&delete it.dataset.stats,Rt.hidden=!0,Bi!==null&&(Rt.textContent="",vn()),t&&on();return}Rt.hidden=!1,Bi===null&&(Bi=J_());let r=Pt(),i=r===void 0?"":r.sid+":"+String(r.statsAt||0);i!==Ho&&(Ho=i,X_(Bi,r)),t&&(it.dataset.stats="",on())}function Hh(){Wi===null&&(Wi=setInterval(()=>Nr(),1e3))}function Fh(){Wi!==null&&(clearInterval(Wi),Wi=null)}function Wh(){if(ce===null||Xe||!nn)return null;let e=Pt();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function ss(){let e=Wh();e!==At&&(At!==null&&Ne({t:"statsOff",sid:At}),At=e,e!==null&&Ne({t:"statsOn",sid:e}))}function em(e){if(e!==Wh()){ss();return}At!==null&&At!==e&&Ne({t:"statsOff",sid:At}),At=e,Ne({t:"statsOn",sid:e})}function tm(){let e=Pt();return e===void 0||e.embedded===!0?null:e.releasePending===!0?{kind:"released",tab:e}:e.exited===!0?{kind:"exited",tab:e}:null}function ns(){if(it===null||$t===null)return;let e=tm(),t=e!==null,r=it.dataset.exited!==void 0!==t;if(!t){$t.hidden=!0,$t.textContent="",Vi="",r&&(delete it.dataset.exited,on());return}$t.hidden=!1,rm(e),r&&(it.dataset.exited="",on())}function rm(e){let{kind:t,tab:r}=e,i=typeof r.exitDetail=="string"?r.exitDetail:"",o=t+":"+r.sid+":"+i;if(o===Vi)return;Vi=o,$t.textContent="";let s=document.createElement("span");s.className="tt_exitBarText",s.textContent=t==="released"?v("status.aiEnded"):i===""?v("status.exited"):v("status.exitedWith",{detail:i}),t==="released"&&(s.title=v("hint.aiEndedTab")),$t.appendChild(s);let n=document.createElement("span");if(n.className="tt_exitBarSpacer",$t.appendChild(n),t==="released"){fh(v("btn.dismiss"),v("btn.dismissTitle"),()=>{Gt(r.sid,{silent:!0})});return}if(r.spawnSpec===null||typeof r.spawnSpec!="object")return;let a=r.agentOwned===!0;fh(v(a?"btn.newLocalTerminal":"btn.reopenSession"),v(a?"hint.reopenAgentLocal":"hint.reopenWithSpec"),()=>Ji(r.sid))}function fh(e,t,r){let i=document.createElement("button");i.type="button",i.className="tt_toolBtn tt_exitBarBtn",i.textContent=e,typeof t=="string"&&t!==""&&(i.title=t),i.addEventListener("click",r),$t.appendChild(i)}function Pt(){return xe!==null?ie.get(xe):void 0}function Wo(){try{return Fc(Nh?.list?.getSnapshot?.())}catch{return}}function im(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Ne({t:"refresh",sid:e.sid})}}var qs=null;function jh(e){qs!==null&&clearTimeout(qs),qs=setTimeout(()=>{qs=null;let t=Pt();t!==void 0&&im(t)},e??200)}var sm=["password","passphrase"];function ph(e){if(e===null||typeof e!="object"||e.t!=="ssh")return e;let t=e.credsStripped===!0,r={...e};for(let i of sm){let o=r[i];typeof o=="string"&&o!==""&&!o.startsWith("env:")&&(delete r[i],t=!0)}return t&&(r.credsStripped=!0),r}var zh=1;function Kt(){try{let e=[...ie.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:ph(t.spawnSpec),label:t.label}));e.length===0||ce===null?sessionStorage.removeItem(tn):sessionStorage.setItem(tn,JSON.stringify({v:zh,tabs:e})),nm([...ie.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:ph(t.spawnSpec),label:t.label})))}catch(e){console.warn("[dsh-tty] \u6807\u7B7E\u6301\u4E45\u5316\u5931\u8D25\uFF08\u672C\u6B21\u5237\u65B0\u540E\u6807\u7B7E\u5217\u8868\u53EF\u80FD\u4E22\u5931\uFF09: "+(e instanceof Error?e.message:String(e)))}}var jo="dsh-tty:persist-specs";function nm(e){try{let t=e.filter(r=>as(r.spawnSpec)).map(r=>({spawnSpec:r.spawnSpec,label:r.label}));t.length===0?localStorage.removeItem(jo):localStorage.setItem(jo,JSON.stringify(t))}catch{}}function om(){try{let e=localStorage.getItem(jo);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&as(r.spawnSpec)):[]}catch{return[]}}function am(){try{let e=sessionStorage.getItem(tn);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):t!==null&&typeof t=="object"&&t.v===zh&&Array.isArray(t.tabs)?t.tabs.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):[]}catch{return[]}}function an(e,t){let r=Be;return new Promise(i=>{let o=null,s=n=>{let a;try{a=JSON.parse(n.data)}catch{return}a.t===e&&(o!==null&&clearTimeout(o),r.removeEventListener("message",s),i(r===Be?a:null))};o=setTimeout(()=>{r.removeEventListener("message",s),i(null)},t),r.addEventListener("message",s)})}function lm(e){return e===void 0?null:e.embedded===!0?e.controller!==void 0&&e.controller!==null?e.controller.hostEl:null:e.termEl}function Uh(e){if(e===void 0||e.fit===null||e.fit===void 0)return;let t;try{t=e.fit.proposeDimensions()}catch{return}let r=lm(e);return Wc(t,r==null?null:{width:r.clientWidth,height:r.clientHeight})}function vi(e){if(e===void 0||e.fit===void 0)return;let t=Uh(e);t!==void 0&&(e.lastDims=t,Ne({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows}))}function cm(e){if(e===void 0||e.fit===void 0)return;let t=e.term,r=t!==null&&t.buffer!==void 0?t.buffer.active:null,i=r==null?null:{atBottom:r.viewportY>=r.baseY,line:r.viewportY};try{e.fit.fit()}catch{return}if(i!==null)try{i.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(i.line,t.buffer.active.baseY))}catch{}e.exited||vi(e)}function ei(e,t,r,i){if(e.overlayEl===null||e.overlayEl===void 0)return;let o=e.overlayEl,s=i==="error"||i==="info"?i:"exited";if(s==="exited"&&e.embedded!==!0){o.textContent="";return}if(t===""||t===void 0){o.textContent="";return}o.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?Oh:s==="info"?ia:Y_)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(r===void 0||r===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",o.querySelector(".tt_overlayMain").textContent=t,r!==void 0&&r!==""&&(o.querySelector(".tt_overlayHint").textContent=r)}function Ae(e,t=""){try{let r=getComputedStyle(document.body).getPropertyValue(e).trim();return r!==""?r:t}catch{return t}}function bi(e){let t=Ae("--tt-accent"),r={};r.background=Ae("--tt-term-bg"),r.foreground=Ae("--tt-term-fg"),r.cursor=t,r.cursorAccent=Ae("--tt-term-cursor-accent"),r.selectionBackground=Ae("--tt-term-selection"),r.black=Ae("--tt-an-black"),r.red=Ae("--tt-an-red"),r.green=Ae("--tt-an-green"),r.yellow=Ae("--tt-an-yellow"),r.blue=Ae("--tt-an-blue"),r.magenta=Ae("--tt-an-magenta"),r.cyan=Ae("--tt-an-cyan"),r.white=Ae("--tt-an-white"),r.brightBlack=Ae("--tt-an-bright-black"),r.brightRed=Ae("--tt-an-bright-red"),r.brightGreen=Ae("--tt-an-bright-green"),r.brightYellow=Ae("--tt-an-bright-yellow"),r.brightBlue=Ae("--tt-an-bright-blue"),r.brightMagenta=Ae("--tt-an-bright-magenta"),r.brightCyan=Ae("--tt-an-bright-cyan"),r.brightWhite=Ae("--tt-an-bright-white");let i=new yh.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:r}),o=new Sh.FitAddon,s=new sl;i.loadAddon(o),i.loadAddon(s),i.loadAddon(new nl);let n=document.createElement("div");n.className="tt_term";let a=document.createElement("div");a.className="tt_overlay",a.addEventListener("click",()=>{a.textContent="",Ji(e.sid)}),a.setAttribute("role","button"),a.setAttribute("aria-label",v("btn.reopenSession")),a.tabIndex=0,a.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" "||u.key==="Spacebar")&&(u.preventDefault(),a.textContent="",Ji(e.sid))}),n.appendChild(a),i.open(n);try{o.fit()}catch{}try{let u=new Lc;u.onContextLoss(()=>{try{u.dispose()}catch{}}),i.loadAddon(u)}catch{}i.onData(u=>{Ne({t:"input",sid:e.sid,d:u}),yr.delete(e.sid)&&Fr()}),i.onResize(()=>{as(e.spawnSpec)&&jh(200)}),i.attachCustomKeyEventHandler(u=>e.embedded===!0?!0:(u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="f"?(u.preventDefault(),Ed(),!1):!0),e.term=i,e.fit=o,e.search=s,e.termEl=n,e.overlayEl=a}function _h(e){return e===null||typeof e!="object"?"":["t","name","host","port","username","command","cwd","persist","persistName","hidden"].map(r=>r+"="+String(e[r]??"")).join("\0")}function hm(e){let t=_h(e);if(t==="")return null;for(let r of ie.values())if(r.exited!==!0&&r.embedded!==!0&&_h(r.spawnSpec)===t)return r;return null}function Yi(e,t){let r=fn(),i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??cg(),label:t};return bi(i),ie.set(r,i),is+=1,ut(),lr(r,{user:!0}),bn(i),Kt(),i}function dm(e){if(Array.isArray(e))for(let t of e){if(t===null||typeof t!="object"||t.owner!=="agent"||t.exited===!0)continue;let r=typeof t.sid=="string"?t.sid:"";if(r===""||ie.has(r))continue;let i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,agentOwned:!0,spawnSpec:{t:"spawn",cwd:typeof t.cwd=="string"?t.cwd:Wo()},label:"agent"+(t.kind==="ssh"&&typeof t.target=="string"&&t.target!==""?" \xB7 "+t.target:"")};bi(i),ie.set(r,i),is+=1,ut(),$h()&&i.termEl!==null&&it!==null&&xe===null&&lr(r),Ne({t:"attach",sid:r}),um()}}function $h(){return ce!==null&&Xe!==!0}function um(){try{Kt()}catch{}}function fm(e){if(dm(e),!Array.isArray(e))return;for(let i of e){if(i===null||typeof i!="object"||i.owner!=="agent")continue;let o=typeof i.sid=="string"?ie.get(i.sid):void 0;o!==void 0&&o.embedded!==!0&&o.agentOwned!==!0&&(o.agentOwned=!0)}let t=Uc(e),r=!1;for(let[i,o]of[...ie]){let s=$c(o,t);if(s!=="keep"){if(s==="mark-exited"){o.exited!==!0&&(o.exited=!0,o.live=!1,r=!0);continue}pm(o)||Gt(i,{silent:!0})}}r&&(ut(),Sn())}function pm(e){return!$h()||e.watched!==!0||e.sid!==xe?!1:(e.releasePending===!0||(e.releasePending=!0,ns()),!0)}function _m(e){if(ie.has(e.sid))return ie.get(e.sid);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};bi(t),ie.set(t.sid,t),is+=1,ut(),lr(t.sid),Ne({t:"attach",sid:t.sid})}function mm(e){if(!(e?.spawnSpec?.credsStripped!==!0||e.term===null))try{e.term.writeln("\x1B[2m[dsh-tty] "+v("msg.passwordNotStored")+"\x1B[0m")}catch{}}function bn(e){mm(e);let t=Uh(e);t!==void 0&&(e.lastDims=t);let r=t!==void 0?t:e.lastDims!==void 0?e.lastDims:{cols:80,rows:24},i={...e.spawnSpec,sid:e.sid,cols:r.cols,rows:r.rows};if(Be===null||Be.readyState!==WebSocket.OPEN){Io.add({tab:e,frame:i});return}Ne(i)}function gm(e,t){let r=ie.get(e);if(r===void 0||r.embedded===!0||t===!0&&!Lo(r))return;let i=t===!0;xr(r.spawnSpec)!==i&&(r.spawnSpec=To(r.spawnSpec,i),Ne({t:"hidden",sid:e,hidden:i}),Kt(),ut(),pi())}var vm="\u{1F648}";function qh(e){let t=ie.get(e),r=t===void 0?"":t.label||v("panel.tabLabel",{n:wn(e)});return t===void 0||!xr(t.spawnSpec)?r:`${vm} ${r}`}function mh(e){let t={sid:fn(),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};bi(t),ie.set(t.sid,t),is+=1,ut(),lr(t.sid),bn(t)}function Ji(e){let t=ie.get(e);if(t===void 0)return;if(t.embedded===!0){Yh(t);return}let r=t.spawnSpec,i=t.label;if(Ne({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),ie.delete(e);let o={sid:fn(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:r,label:i};bi(o),ie.set(o.sid,o),ut(),lr(o.sid,{user:!0}),bn(o),Kt()}function Gt(e,t){let r=ie.get(e);if(r===void 0)return;let i=t?.silent===!0;if(Dt!==null&&Dt.ownerKey===e&&zi(!0),i||Ne({t:"kill",sid:e}),ie.delete(e),or(),Ir===e&&Bt(),yr.delete(e),Fr(),rs.delete(e),r.term!==null)try{r.term.dispose()}catch{}if(r.termEl!==null&&r.termEl.remove(),xe===e){xe=null;let o=[...ie.entries()].filter(([,s])=>s.embedded!==!0).map(([s])=>s).pop()??null;o!==null&&lr(o)}ut(),aa(),ns(),gi(),rt!==null&&Sn(),[...ie.values()].some(o=>o.embedded!==!0)?Kt():Qi()}function Kh(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error(v("error.terminalNeedsCommand"));if(/[\r\n\0]/.test(t))throw new Error(v("error.terminalCommandSingleLine"));return t}function Gh(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 bm(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&&vi(e)}}),t.observer.observe(t.hostEl))}function Vh(e,t,r){let i={sid:fn(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:r};return bi(i),ie.set(i.sid,i),rs.add(i.sid),e.hostEl.appendChild(i.termEl),bm(i),bn(i),i}function Yh(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||Ne({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),ie.delete(e.sid),rs.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=Vh(t,e.spawnSpec,e.label),xe===e.sid&&(xe=t.tab.sid,aa()),t.tab}}function wm(e,t){if(!(e instanceof HTMLElement))throw new Error(v("error.terminalNeedsHost"));let r=Kh(t),i=Gh(t,r),o=typeof t?.label=="string"&&t.label!==""?t.label:void 0;es();let s={hostEl:e,tab:null,observer:null,disposed:!1};return s.tab=Vh(s,i,o),dg(),()=>ym(s)}function ym(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||Ne({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),ie.delete(t.sid),rs.delete(t.sid),e.tab=null}if(ce===null&&!oa()&&Be!==null){Ki=!0;try{Be.close()}catch{}Be=null}}var Sm=460,Cm=280,xm=320,km=160,Dt=null,ti=Sm,ri=xm;function la(){let e=ce!==null?ce.querySelector(".tt_modal"):null,t=e!==null?e:ce;return t!==null?t.getBoundingClientRect():null}var ca=e=>e==="bottom"?km:Cm;function Em(e){let t=la();if(t===null)return 900;let r=e==="bottom"?t.height:t.width;return Math.max(ca(e),Math.round(r*.72))}function ji(e,t){return Math.min(Em(e),Math.max(ca(e),Math.round(t)))}function Gs(){let e=Dt;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){ri=ji("bottom",ri),e.el.style.width="",e.el.style.height=String(ri)+"px",e.el.style.flexBasis=String(ri)+"px";return}ti=ji("right",ti),e.el.style.height="",e.el.style.width=String(ti)+"px",e.el.style.flexBasis=String(ti)+"px"}}function zi(e){let t=Dt;if(t!==null){if(Dt=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(r){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(r instanceof Error?r.message:String(r)))}try{t.el.remove()}catch{}kt!==null&&delete kt.dataset.side}}function Jh(e){if(Qo(),kt===null)throw new Error(v("error.panelNotReady"));Dt!==null&&zi(!0),es();let t=Qr(e?.ownerSid,xe),r=e?.side==="bottom"?"bottom":"right",i=Math.max(r==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:ca(r)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let c=ji(r,e.size);r==="bottom"?ri=c:ti=c}let o=document.createElement("div");o.className="tt_dockPane",o.dataset.side=r,kt.dataset.side=r,o.innerHTML='<div class="tt_dockPaneResize" title="'+v(r==="bottom"?"panel.dragHeight":"panel.dragWidth")+'"></div><div class="tt_dockPaneHead"><span class="tt_dockPaneTitle"></span><span class="tt_dockPaneHint"></span><span class="tt_dockPaneSpacer"></span><button class="tt_dockPaneFold" type="button"></button><button class="tt_dockPaneClose" type="button" title="'+v("btn.closePane")+'">'+_n+'</button></div><div class="tt_dockPaneBody"></div>',kt.appendChild(o);let s=o.querySelector(".tt_dockPaneTitle"),n=o.querySelector(".tt_dockPaneHint"),a=o.querySelector(".tt_dockPaneBody"),u=o.querySelector(".tt_dockPaneFold"),l=o.querySelector(".tt_dockPaneClose"),d=o.querySelector(".tt_dockPaneResize"),m={el:o,element:a,disposed:!1,collapsed:!1,side:r,minSize:i,ownerKey:t,onClose:typeof e?.onClose=="function"?e.onClose:null},y=()=>r==="bottom"?m.collapsed?ta:$_:m.collapsed?na:sa,_=c=>{m.collapsed=c===!0,m.collapsed?o.dataset.collapsed="1":delete o.dataset.collapsed,u.innerHTML=y(),u.title=m.collapsed?v("btn.expandPane"):v("btn.collapsePane"),u.setAttribute("aria-label",u.title),Gs()};return m.setTitle=c=>{s.textContent=typeof c=="string"?c:""},m.setHint=c=>{n.textContent=typeof c=="string"?c:""},m.isCollapsed=()=>m.collapsed===!0,m.collapse=()=>_(!0),m.expand=()=>_(!1),m.toggle=()=>_(!m.collapsed),m.dispose=()=>{m.disposed||Dt!==m||zi(!1)},d.addEventListener("mousedown",c=>{if(c.button!==0||m.collapsed)return;c.preventDefault();let f=c.clientX,h=c.clientY,p=o.getBoundingClientRect(),g=b=>{r==="bottom"?ri=ji("bottom",Math.max(i,p.height+(h-b.clientY))):ti=ji("right",Math.max(i,p.width+(f-b.clientX))),Gs()},S=()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",S),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",g),document.addEventListener("mouseup",S)}),d.addEventListener("dblclick",()=>_(!m.collapsed)),u.addEventListener("click",()=>_(!m.collapsed)),l.addEventListener("click",()=>zi(!0)),m.setTitle(typeof e?.title=="string"?e.title:""),m.setHint(typeof e?.hint=="string"?e.hint:""),_(e?.collapsed===!0),Dt=m,Gs(),Xh(),m}function Xh(){let e=Dt;if(e!==null){if(xo(e.ownerKey,xe)){delete e.el.dataset.dockHidden,kt!==null&&(kt.dataset.side=e.side);return}e.el.dataset.dockHidden="1",kt!==null&&delete kt.dataset.side}}function lr(e,t){let r=ie.get(e);if(r===void 0||r.embedded===!0)return;t?.user===!0&&(r.watched=!0);let i=xe!==null?ie.get(xe):void 0;if(!(i!==void 0&&i.releasePending===!0&&i.sid!==e&&ie.size>1&&(Gt(i.sid,{silent:!0}),ie.get(e)===void 0))){xe=e,Bt(),Fr();for(let[o,s]of ie)s.embedded!==!0&&s.termEl!==null&&(s.termEl.style.display=o===e?"":"none");r.embedded!==!0&&it!==null&&r.termEl!==null&&r.termEl.parentElement!==it&&it.appendChild(r.termEl),ss(),Nr(),ut(),Dr(),Xh();try{r.fit.fit()}catch{}r.spawned&&!r.exited&&vi(r),ei(r,""),ns(),aa()}}function Po(e){if(Te===null)return;let t=ie.get(e);if(t===void 0)return;let i=Te.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");if(i==null)return;i.dataset.state=ln(t);let o=pt===null?null:pt.querySelector('[data-sid="'+e+'"] .tt_tabDot');o!==null&&(o.dataset.state=ln(t))}var Bo=!1;function ut(){if(Te===null)return;if(Te.querySelector(".tt_tabRename")!==null){Bo||(Bo=!0,setTimeout(()=>{Bo=!1,ut()},1e3));return}Te.textContent="";for(let[t,r]of ie){if(r.embedded===!0)continue;let i=document.createElement("button");i.className="tt_tab",i.dataset.sid=t,t===xe&&(i.dataset.active="");let o=document.createElement("span");o.className="tt_tabDot",o.dataset.state=ln(r),i.appendChild(o);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=qh(t),s.addEventListener("dblclick",a=>{a.stopPropagation(),Rm(t,i)});let n=document.createElement("span");n.className="tt_tabClose",n.title=v("btn.close"),n.innerHTML=ts,n.setAttribute("role","button"),n.setAttribute("aria-label",v("btn.closeTabAria",{label:r.label||""})),n.tabIndex=0,n.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" "||a.key==="Spacebar")&&(a.preventDefault(),a.stopPropagation(),Gt(t))}),i.title=xr(r.spawnSpec)?`${s.textContent} \u2014 ${v("btn.hiddenMark")}`:s.textContent,i.appendChild(s),i.appendChild(n),i.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),Gt(t);return}lr(t,{user:!0})}),Te.appendChild(i)}let e=Te.querySelector("[data-active]");e!==null&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest",inline:"nearest"}),pi(),pt!==null&&ie.size===0&&Lt()}function pi(){if(Te===null)return;let e=Te.scrollWidth-Te.clientWidth,t=e>1,r=Gc(hd()),i=t||_d().length>0||r>=2;if(zt!==null&&(zt.hidden=!i,i?zt.title=v("btn.tabListTitle",{n:String(r)}):pt!==null&&Lt()),!t){delete Te.dataset.edge,pt!==null&&Go();return}let o=Te.scrollLeft>1,s=Te.scrollLeft<e-1;Te.dataset.edge=o&&s?"both":s?"end":"start",pt!==null&&Go()}function ln(e){return e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting"}function Lm(e){if(Te===null||Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let t=Te.scrollWidth-Te.clientWidth;if(t<=1)return;let r=Math.max(0,Math.min(t,Te.scrollLeft+e.deltaY));r!==Te.scrollLeft&&(e.preventDefault(),Te.scrollLeft=r)}function Tm(e){return e?.direction==="remote"?v("meta.tunnelRemote",{host:e.remoteHost||"127.0.0.1",port:String(e.remotePort??0),local:String(e.localTargetPort??0)}):v("meta.tunnelLocal",{local:String(e?.localPort??0),host:e?.remoteHost??"?",port:String(e?.remotePort??0)})}function Dr(){if(Oi===null||Qs===null||Ni===null||Ii===null)return;Ni.textContent="";let e=Pt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){Oi.dataset.hidden="";return}delete Oi.dataset.hidden;let r=Number(t.port);Qs.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(r)&&r!==22?":"+r:""),Ct!==null&&(e.persistTmux===!0?(Ct.textContent="tmux",Ct.dataset.state="ok",Ct.title=v("status.tmuxPersistedTitle")):t.persist===!0&&e.spawned===!0?(Ct.textContent=v("status.notPersisted"),Ct.dataset.state="warn",Ct.title=v("status.tmuxUnavailableTitle")):(Ct.textContent="",delete Ct.dataset.state,Ct.removeAttribute("title")));let i=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";Ii.dataset.state=i,Ii.title=v(i==="connected"?"status.connected":i==="connecting"?"status.connecting":i==="error"?"status.errored":"status.exited");let o=(n,a,u,l)=>{let d=document.createElement("button");d.type="button",d.className="tt_toolBtn tt_connAct",d.title=u,d.innerHTML=n+"<span></span>",d.lastElementChild.textContent=a,d.addEventListener("click",l),Ni.appendChild(d)};if(typeof t.command=="string"&&t.command!=="")return;let s=typeof t.name=="string"?t.name:"";for(let n of Fo)try{n({tab:e,spec:t,bookName:s,addAction:o})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}function Mm(e,t){if(li!==null){Vs();return}let r=document.createElement("div");r.className="tt_addMenu tt_connMore",li=r,Hr(r,v("panel.tunnels"),v("hint.tunnelsSettings"),()=>{Vs(),Zh(e,t)},void 0,Mh),document.body.appendChild(r);let i=e.getBoundingClientRect(),o=r.offsetWidth,n=i.left+o>window.innerWidth-8?i.right-o:i.left;r.style.left=Math.max(8,Math.min(n,window.innerWidth-o-8))+"px",r.style.top=i.bottom+6+"px";let a=u=>{li===r&&(r.contains(u.target)||e.contains(u.target)||Vs())};Js=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0)}function Vs(){Js!==null&&(document.removeEventListener("mousedown",Js,!0),Js=null),li!==null&&(li.remove(),li=null)}var Er=null,Ys=null,li=null,Js=null;function cn(){Ys!==null&&(document.removeEventListener("mousedown",Ys,!0),Ys=null),Er!==null&&(Er.remove(),Er=null)}function Zh(e,t){if(Er!==null){cn();return}let r=document.createElement("div");r.className="tt_tunnelPop";let i=document.createElement("div");i.className="tt_tunnelPopTitle",i.textContent=v("panel.tunnelsFor",{name:t}),r.appendChild(i);let o=document.createElement("div");o.textContent=v("list.loading"),r.appendChild(o);let s=document.createElement("span");s.className="tt_cardHint",s.textContent=v("hint.tunnelsCard"),r.appendChild(s),document.body.appendChild(r),Er=r;let n=e.getBoundingClientRect();r.style.top=String(n.bottom+6)+"px",r.style.left=String(Math.max(8,n.right-340))+"px";let a=u=>{Er===r&&(r.contains(u.target)||e.contains(u.target)||cn())};Ys=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let u=[];try{let m=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();m.ok&&Array.isArray(m.tunnels)&&(u=m.tunnels)}catch{}if(Er!==r)return;o.textContent="";let l=ha.filter(d=>d?.bookName===t&&d?.enabled!==!1);if(l.length===0){let d=document.createElement("span");d.className="tt_cardHint",d.textContent=v("list.noActiveTunnels"),o.appendChild(d);return}for(let d of l){let m=u.find(h=>h?.name===d?.name),y=m?.state??"stopped",_=document.createElement("div");_.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=y==="active"?"connected":y==="error"?"error":"connecting";let f=document.createElement("span");f.className="tt_connTarget",f.title=String(m?.error??m?.lastForwardError??""),f.textContent=Tm(d)+" \xB7 "+y+(m?.fatal===!0?v("status.fatalSuffix"):""),_.appendChild(c),_.appendChild(f),o.appendChild(_)}})()}function wn(e){let t=1;for(let r of ie.keys()){if(r===e)return String(t);t+=1}return String(t)}function Rm(e,t){let r=ie.get(e);if(r===void 0||t.querySelector(".tt_tabRename")!==null)return;let i=t.querySelector(".tt_tabLabel");if(i===null)return;let o=document.createElement("input");o.className="tt_tabRename",o.value=r.label||v("panel.tabLabel",{n:wn(e)}),i.replaceWith(o),o.focus(),o.select();let s=!1,n=()=>{if(s)return;s=!0;let u=o.value.trim();r.label=u!==""?u:void 0,ut(),Kt()},a=()=>{s||(s=!0,ut())};o.addEventListener("keydown",u=>{u.stopPropagation(),u.key==="Enter"?n():u.key==="Escape"&&a()}),o.addEventListener("blur",n),o.addEventListener("click",u=>u.stopPropagation())}var ha=[],Qh="dialog",wr="off",sr={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},ed="dsh-tty:show-hidden",Lr=(()=>{try{return localStorage.getItem(ed)==="1"}catch{return!1}})();function Am(e){Lr=e===!0;try{localStorage.setItem(ed,Lr?"1":"0")}catch{}for(let t of zo)try{t(Lr)}catch{}}var zo=new Set,Uo=null,ci=null,td=!1,rd=!1,br=null,hn=null,Pr=!1;function id(e){Pr=e,hn!==null&&hn.set(e)}function Dm(e){id(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==nn&&(nn=e.statsEnabled,ss(),Nr())}function Xi(e){Dm(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(nr=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(ha=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(Qh=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(wr=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(sr={...sr,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(ci=e.maxSessions),e!==null&&typeof e=="object"&&typeof e.allowProxyCommand=="boolean"&&(td=e.allowProxyCommand),e!==null&&typeof e=="object"&&typeof e.assistEnabled=="boolean"&&(rn=e.assistEnabled,rn||Bt(),Fr()),e!==null&&typeof e=="object"&&typeof e.allowProxyCommandGranted=="boolean"&&(rd=e.allowProxyCommandGranted)}function Pm(e,t){let r=t==="error"||t==="info"?t:"warn",i=document.createElement("div");i.className="tt_toast",i.dataset.kind=r,i.innerHTML='<span class="tt_toastIcon">'+(r==="error"?Oh:r==="info"?V_:G_)+'</span><span class="tt_toastText"></span>',i.lastElementChild.textContent=e,document.body.appendChild(i),setTimeout(()=>i.remove(),4e3)}async function sd(){try{Ne({t:"sessions"});let e=await an("sessions",3e3);if(e!==null&&Array.isArray(e.list))return br=zc(e.list),br}catch{}return null}async function dn(){if(await sd(),ci===null||br===null||br<ci)return null;let e=[...ie.values()].filter(o=>!o.exited).length,t=Math.max(0,br-e),r=t>0?v("msg.maxSessionsOthers",{count:t}):"",i=v("msg.maxSessions",{live:br,max:ci,own:e,others:r});return Pm(i),i}function Bm(){return ci!==null&&br!==null&&br>=ci}function da(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function nd(e){return ha.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function $o(e){let t=Number(e?.port),r=Number.isInteger(t)&&t!==22?":"+t:"",i=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",o=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+r+" \xB7 "+i+o}async function qo(e,t){let r=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),i=await r.json().catch(()=>({}));return i&&i.ok===!1&&i.error?{error:String(i.error)}:i&&i.result?{result:i.result}:{error:String(i&&i.error?i.error:v("error.probeHttp",{status:r.status}))}}function Ko(e,t){if(!e)return v("msg.probing");let r=e,i=typeof r.tcp?.ms=="number"?r.tcp.ms:null,o=typeof r.auth?.ms=="number"?r.auth.ms:null,s=[];if(r.jump!==null&&typeof r.jump=="object"&&typeof r.jump.label=="string"&&r.jump.label!==""){let d=typeof r.jump.tcp?.ms=="number"?r.jump.tcp.ms:null,m=r.jump.tcp?.ok?d!==null?d+"ms":v("meta.reachable"):v("meta.unreachable");s.push(v("meta.jumpStage",{label:r.jump.label})+" "+m)}r.proxy!==null&&typeof r.proxy=="object"&&s.push(r.proxy.active===!0?v("meta.probeProxy"):v("meta.probeProxyOff")),r.tcp?.ok?s.push("TCP "+(i!==null?i+"ms":v("meta.reachable"))):r.tcp?.skipped===!0&&s.push(v("meta.probeTcpSkipped")),r.banner?.ok&&s.push(v("meta.probeBanner"));let n=r.hostkey?.state;if(n==="matched"?s.push(v("meta.hostKeyMatched")):n==="recorded"?s.push(v("meta.hostKeyRecorded")):n==="mismatch"&&s.push(v("meta.hostKeyMismatch")),r.auth?.ok){let d=o!==null?v("meta.authOkMs",{ms:o}):v("meta.authOk");return v("meta.probeOk",{detail:d+(s.length?" \xB7 "+s.join(" \xB7 "):"")})}let a=r.tcp?.skipped===!0?"":r.tcp?.error,l=(r.auth?.error||a||v("error.unknown"))+(s.length?" \xB7 "+s.join(" \xB7 "):"");return t?.prefix!==void 0?t.prefix+l:v("error.probeFailed",{detail:l})}async function ua(){try{let t=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(t.ok&&typeof t.config=="object"&&t.config!==null){let r=nr;Xi(t.config),Et!==null&&nr!==r&&Xo(Et)}}catch{}}function od(e){Et!==null&&(e.target instanceof Element&&(Et.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||xt())}function os(e,t){ad(e,t.getBoundingClientRect())}function ad(e,t){let r=e.offsetWidth,i=e.offsetHeight,s=t.left+r>window.innerWidth-8?t.right-r:t.left;e.style.left=Math.max(8,Math.min(s,window.innerWidth-r-8))+"px";let n=t.bottom+6,a=t.top-i-6;e.style.top=(n+i>window.innerHeight-8&&a>=8?a:Math.min(n,Math.max(8,window.innerHeight-i-8)))+"px"}function Om(e){if(Et!==null){xt();return}Lt(),ua(),sd().then(()=>{Et!==null&&Xo(Et)});let t=document.createElement("div");t.className="tt_addMenu",Et=t,Xo(t),document.body.appendChild(t),os(t,e),document.addEventListener("mousedown",od,!0)}function xt(){Et!==null&&(document.removeEventListener("mousedown",od,!0),Et.remove(),Et=null)}function Im(e){if(pt!==null){Lt();return}xt();let t=document.createElement("div");t.className="tt_addMenu tt_tabMenu",pt=t,Go(),document.body.appendChild(t),os(t,e),document.addEventListener("mousedown",ld,!0),document.addEventListener("keydown",cd,!0)}function Lt(){pt!==null&&(document.removeEventListener("mousedown",ld,!0),document.removeEventListener("keydown",cd,!0),pt.remove(),pt=null)}function ld(e){pt!==null&&(e.target instanceof Element&&(pt.contains(e.target)||e.target.closest(".tt_tabMore")!==null)||Lt())}function cd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Lt())}function Go(){let e=pt;if(e===null)return;e.textContent="";let t=$m();if(t.length===0){let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=v("list.tabsAllVisible"),e.appendChild(i),Vo(e,xe),Yo(e);return}for(let[i,o]of t){let s=qh(i)||o.label||v("panel.tabLabel",{n:wn(i)}),n=qm(o),a=document.createElement("div");a.className="tt_addMenuRow tt_tabMenuRow",a.dataset.sid=i;let u=document.createElement("button");u.type="button",u.className="tt_addMenuItem tt_tabMenuItem",i===xe&&(u.dataset.active="");let l=document.createElement("span");l.className="tt_tabDot",l.dataset.state=ln(o),u.appendChild(l);let d=document.createElement("span");d.className="tt_addMenuText tt_tabMenuText";let m=document.createElement("span");if(m.className="tt_addMenuMain",m.textContent=s,d.appendChild(m),n!==""){let _=document.createElement("span");_.className="tt_tabMenuMeta",_.textContent=n,d.appendChild(_)}u.appendChild(d),u.title=n===""?s:s+" \xB7 "+n,u.addEventListener("click",()=>{lr(i,{user:!0}),Lt()}),a.appendChild(u);let y=document.createElement("button");y.type="button",y.className="tt_addMenuEdit",y.innerHTML=ts,y.title=v("btn.close"),y.setAttribute("aria-label",v("btn.closeTabAria",{label:s})),y.addEventListener("click",()=>{Gt(i)}),a.appendChild(y),e.appendChild(a)}let r=e.querySelector(".tt_tabMenuItem[data-active]");r!==null&&typeof r.scrollIntoView=="function"&&r.scrollIntoView({block:"nearest"}),Vo(e,xe),Yo(e)}function hd(){return[...ie].map(([e,t])=>({sid:e,embedded:t.embedded===!0,exited:t.exited===!0,agentOwned:t.agentOwned===!0}))}function Vo(e,t){let r=Vc(hd(),t),i=[[v("btn.closeOthers",{n:String(r.others.sids.length)}),r.others,Tr],[v("btn.closeLeft",{n:String(r.left.sids.length)}),r.left,na],[v("btn.closeRight",{n:String(r.right.sids.length)}),r.right,sa]].filter(([,s])=>s.sids.length>0);if(i.length===0)return;let o=document.createElement("div");o.className="tt_addMenuSep",e.appendChild(o);for(let[s,n,a]of i)Hr(e,s,n.live>0?v("list.subLive",{n:String(n.live)}):"",()=>{Nm(n)},void 0,a)}function Nm(e){if(or(),Lt(),e.sids.length===0)return;let t=e.sids.slice(),r=()=>{for(let i of t)Gt(i)};if(e.confirm!==!0){r();return}Rd({title:v("confirm.tabsTitle",{n:String(e.live)}),text:e.agentLive>0?v("confirm.tabsTextAgent",{n:String(e.live),agent:String(e.agentLive)}):v("confirm.tabsText",{n:String(e.live)}),hint:v("confirm.tabsHint"),okLabel:v("confirm.tabsOk",{n:String(e.live)}),onOk:r})}var hi=null,dd=null;function Hm(e,t,r){if(ie.get(e)===void 0)return;or(),xt(),Lt();let i=document.createElement("div");i.className="tt_addMenu tt_tabCtxMenu",hi=i,dd=e,Fm(i,e),document.body.appendChild(i),ad(i,{left:t,right:t,top:r,bottom:r}),document.addEventListener("mousedown",ud,!0),document.addEventListener("keydown",fd,!0)}function or(){hi!==null&&(document.removeEventListener("mousedown",ud,!0),document.removeEventListener("keydown",fd,!0),hi.remove(),hi=null,dd=null)}function ud(e){hi!==null&&(e.target instanceof Element&&hi.contains(e.target)||or())}function fd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),or())}function Fm(e,t){let r=ie.get(t);if(r===void 0)return;let i=r.label||v("panel.tabLabel",{n:wn(t)});if(Hr(e,v("btn.closeTab"),i,()=>{or(),Gt(t)},void 0,ts),Lo(r)){let o=xr(r.spawnSpec);Hr(e,v(Yc(o)),i,()=>{or(),gm(t,!o)},void 0,o?j_:W_)}Vo(e,t),Yo(e)}function Wm(e){let t=pd(e.target);if(t===null)return;e.preventDefault();let r=e.clientX,i=e.clientY;if(r===0&&i===0){let o=e.target instanceof Element?e.target.closest(".tt_tab"):null;if(o!==null){let s=o.getBoundingClientRect();r=s.left,i=s.bottom}}Hm(t,r,i)}function jm(e){if(e.button!==1)return;let t=pd(e.target);t!==null&&(e.preventDefault(),Gt(t))}function pd(e){if(!(e instanceof Element))return null;let t=e.closest(".tt_tab");if(t===null)return null;let r=t.dataset.sid;return r===void 0||r===""||!ie.has(r)?null:r}function _d(){return[...ie.values()].filter(e=>e.embedded!==!0&&e.exited===!0)}function Yo(e){let t=_d();if(t.length===0)return;let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r),Hr(e,v("list.cleanExited",{n:String(t.length)}),"",()=>{Lt(),or();for(let i of t)Gt(i.sid)},void 0,Th)}var zm=40;function Um(e,t){let r=e.getBoundingClientRect();return Math.max(0,Math.min(r.right,t.right)-Math.max(r.left,t.left))}function $m(){let e=[];if(Te===null)return e;let t=Te.getBoundingClientRect();for(let[r,i]of ie){if(i.embedded===!0)continue;let o=Te.querySelector('[data-sid="'+r+'"]');o!==null&&Um(o,t)<zm&&e.push([r,i])}return e}function qm(e){return typeof e.target=="string"?e.target:""}function Km(){return v("panel.assistTitle")===Xs["panel.assistTitle"]?"zh":"en"}function Gm(e){let t=e!=null&&typeof e.exitCode=="number"?String(e.exitCode):"?";return v("badge.assistFailed",{code:t})}function Fr(){if(gr===null)return;let e=xe===null?void 0:yr.get(xe),t=rn&&e!==void 0&&e.dismissed!==!0;if(gr.hidden=!t,t){let r=gr.querySelector(".tt_assistBadgeText");r!==null&&(r.textContent=Gm(e))}}function Bt(){ni!==null&&(ni.abort(),ni=null),Ar!==null&&(Ar.remove(),Ar=null),Ir=null,sn=null}function Vm(e){Ar!==null&&(e.target instanceof Element&&(Ar.contains(e.target)||e.target.closest(".tt_assistBadge")!==null)||Bt())}function Ym(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Bt())}function Jm(e){let t=xe;if(t===null)return;Bt();let r=document.createElement("div");r.className="tt_addMenu tt_assistMenu",Ar=r,Ir=t,sn=e,document.body.appendChild(r),document.addEventListener("mousedown",Vm,!0),document.addEventListener("keydown",Ym,!0),Jo(),os(r,e),Xm(t)}async function Xm(e){let t=yr.get(e);if(t===void 0||t.busy===!0||(t.error===null||t.error===void 0)&&t.answer!==null&&t.answer!==void 0)return;t.busy=!0,t.answer=null,t.command="",t.error=null,Jo();let r=new AbortController;ni=r;try{let i=await fetch("/api/dsh-tty/assist",{method:"POST",cache:"no-store",headers:{"content-type":"application/json"},body:JSON.stringify({sid:e,kind:"failure",lang:Km()}),signal:r.signal}),o=await i.json().catch(()=>null);if(Ir!==e)return;t.busy=!1,i.ok&&o!==null&&o.ok===!0?(t.answer=String(o.answer!==void 0?o.answer:""),t.command=String(o.command!==void 0?o.command:"")):t.error=o!==null&&o.error!==void 0?String(o.error):"HTTP "+String(i.status)}catch(i){if(r.signal.aborted||Ir!==e)return;t.busy=!1,t.error=i instanceof Error?i.message:String(i)}finally{ni===r&&(ni=null),t.busy=!1,Jo()}}function Jo(){let e=Ar;if(e===null)return;let t=Ir,r=t===null?void 0:yr.get(t);e.textContent="";let i=document.createElement("div");i.className="tt_assistHead";let o=document.createElement("span");if(o.className="tt_assistTitle",o.textContent=v("panel.assistTitle"),i.appendChild(o),r!==void 0&&typeof r.exitCode=="number"){let m=document.createElement("span");m.className="tt_assistCode",m.textContent="exit="+String(r.exitCode),i.appendChild(m)}e.appendChild(i);let s=r!==void 0&&typeof r.error=="string"&&r.error!=="",n=document.createElement("div");if(n.className="tt_assistBody",r===void 0||r.busy===!0){n.classList.add("tt_assistMuted","tt_assistBusy");let m=document.createElement("span");m.className="tt_assistSpin",n.appendChild(m),n.appendChild(document.createTextNode(v("status.assistThinking")))}else if(s)n.textContent=v("error.assistRequest",{message:r.error}),n.classList.add("tt_assistError");else{let m=r.answer!==null&&r.answer!==void 0?r.answer:"";n.textContent=m,n.classList.add("tt_assistAnswer"),m===""&&(n.hidden=!0)}if(e.appendChild(n),r===void 0||r.busy===!0)return;let a=r.command!=="";if(a){let m=document.createElement("div");m.className="tt_assistCmdWrap";let y=document.createElement("span");y.className="tt_assistCmdLabel",y.textContent=v("panel.assistCommand"),m.appendChild(y);let _=document.createElement("div");_.className="tt_assistCmd",_.textContent=r.command,m.appendChild(_),e.appendChild(m)}let u=document.createElement("div");if(u.className="tt_assistFoot",a){let m=document.createElement("button");m.type="button",m.className="tt_toolBtn tt_assistFill",m.textContent=v("btn.assistFill"),m.title=v("hint.assistFillNoEnter"),m.addEventListener("click",Zm),u.appendChild(m)}let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent=v(s?"btn.assistCopyError":"btn.assistCopy"),l.addEventListener("click",()=>{if(s){bh(v("error.assistRequest",{message:r.error}));return}bh(r.answer!==null&&r.answer!==void 0?r.answer:"")}),u.appendChild(l);let d=document.createElement("button");if(d.type="button",d.className="tt_toolBtn tt_assistClose",d.textContent=v("btn.assistClose"),d.addEventListener("click",()=>{Bt()}),u.appendChild(d),e.appendChild(u),!s){let m=document.createElement("span");m.className="tt_assistNote",m.textContent=v(a?"hint.assistFillNoEnter":"hint.assistNoCommand"),e.appendChild(m)}sn!==null&&os(e,sn)}function Zm(){let e=Ir,t=e===null?void 0:yr.get(e);if(e===null||t===void 0||t.command==="")return;Ne({t:"input",sid:e,d:""+t.command});let r=ie.get(e);Bt(),Qm(e),r!==void 0&&r.term!==null&&r.term.focus()}function Qm(e){let t=yr.get(e);t!==void 0&&(t.dismissed=!0),Fr()}function Hr(e,t,r,i,o,s){let n=document.createElement("button");if(n.type="button",n.className="tt_addMenuItem",o===!0&&(n.setAttribute("data-soldout",""),n.title=v("btn.maxSessionsTitle")),s!==void 0){let l=document.createElement("span");l.className="tt_addMenuIcon",l.innerHTML=s,n.appendChild(l)}let a=document.createElement("span");a.className="tt_addMenuText";let u=document.createElement("span");if(u.className="tt_addMenuMain",u.textContent=t,a.appendChild(u),r!==""){let l=document.createElement("span");l.className="tt_addMenuSub",l.textContent=r,a.appendChild(l)}n.appendChild(a),n.addEventListener("click",i),e.appendChild(n)}function Xo(e){e.textContent="";let t=Bm();Hr(e,v("option.localTerminal"),v(wr==="tmux"?"hint.tmuxHosted":"hint.openInSessionCwd"),async()=>{await dn()||(xt(),Yi())},t,pn);let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r);let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=v("panel.sshBook"),e.appendChild(i);for(let s of nr){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let n=document.createElement("div");n.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title=v("btn.maxSessionsTitle"));let u=document.createElement("span");u.className="tt_addMenuIcon",u.innerHTML=K_;let l=document.createElement("span");l.className="tt_addMenuText";let d=document.createElement("span");d.className="tt_addMenuMain",d.textContent=s.name;let m=document.createElement("span");m.className="tt_addMenuSub";let y=nd(s.name),_=So(s.jump);m.textContent=$o(s)+(_===""?"":" "+v("meta.viaJump",{label:_}))+(typeof s.proxyCommand=="string"&&s.proxyCommand.trim()!==""?" "+v("meta.viaProxy"):"")+(y>0?" \xB7 \u21C4"+String(y):""),l.appendChild(d),l.appendChild(m),a.appendChild(u),a.appendChild(l),a.addEventListener("click",async()=>{if(await dn())return;xt();let h=wr==="tmux"&&s.persist!==!1?{persist:!0,persistName:da()}:{};Yi({t:"ssh",name:s.name,...h},s.name)});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title=v("btn.sftpFileBrowse"),c.innerHTML=$i,c.addEventListener("click",()=>{xt(),yn({name:s.name})});let f=document.createElement("button");f.type="button",f.className="tt_addMenuEdit",f.title=v("btn.editConnection"),f.innerHTML=ra,f.addEventListener("click",()=>{xt(),gh(s)}),n.appendChild(a),n.appendChild(c),n.appendChild(f),e.appendChild(n)}if(nr.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent=v("list.emptySshBook"),e.appendChild(s)}let o=document.createElement("div");o.className="tt_addMenuSep",e.appendChild(o),Hr(e,v("option.sshConnect"),v("hint.sshConnect"),()=>{xt(),gh()},!1,Ih)}function gh(e){if(oi!==null)return;let t=e!==null&&typeof e=="object"?e:null,r=t!==null,i=document.createElement("div");i.className="tt_sshBackdrop";let o=document.createElement("div");o.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshHead";let n=document.createElement("div");n.className="tt_sshBody";let a=document.createElement("div");a.className="tt_sshFoot";let u=document.createElement("div");u.className="tt_sshTitle",u.innerHTML=Ih+"<span></span>",u.lastElementChild.textContent=r?v("panel.editConnection",{name:String(t.name??"")}):v("panel.sshConnect"),s.appendChild(u);let l=Q=>{let oe=document.createElement("div");return oe.className="tt_sshSection",oe.textContent=Q,oe},d={},m=(Q,oe,de)=>{let ae=document.createElement("label");ae.className="tt_sshRow";let pe=document.createElement("span");pe.className="tt_cardLabel",pe.textContent=oe,ae.appendChild(pe);let ue;if(de?.select!==void 0){ue=document.createElement("select");for(let Ce of de.select){let ve=document.createElement("option");ve.value=Ce.value,ve.textContent=Ce.label,ue.appendChild(ve)}}else ue=document.createElement("input"),ue.type=de?.type??"text",ue.placeholder=de?.placeholder??"";return ue.className="tt_cardInput",ue.autocomplete="off",ue.spellcheck=!1,ae.appendChild(ue),d[Q]=ue,ae};n.appendChild(l(v("section.connection")));let y=document.createElement("div");y.className="tt_sshGrid",y.appendChild(m("host",v("field.host"),{placeholder:v("placeholder.host")})),y.appendChild(m("port",v("field.port"),{placeholder:"22"})),n.appendChild(y),n.appendChild(m("username",v("field.username"),{placeholder:"root"})),n.appendChild(l(v("section.auth"))),n.appendChild(m("auth",v("field.authMethod"),{select:[{value:"agent",label:v("option.authAgent")},{value:"key",label:v("option.authKey")},{value:"password",label:v("option.authPassword")}]}));let _=m("keyPath",v("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),c=m("passphrase",v("field.passphrase"),{type:"password"}),f=m("password",v("field.password"),{type:"password"}),h=(Q,oe)=>{let de=document.createElement("div");de.className="tt_sshRow tt_envRow";let ae=document.createElement("input");ae.type="text",ae.className="tt_cardInput",ae.placeholder=v("placeholder.credRef"),ae.title=v("hint.credRefCandidates"),ae.autocomplete="off",ae.spellcheck=!1;let pe=document.createElement("span");pe.className="tt_cardHint tt_envEmpty",pe.textContent=oe,pe.hidden=!0,ae.hidden=!0;let ue=document.createElement("div");ue.className="tt_envList",ue.dataset.hidden="";let Ce=[],ve=()=>{if(ue.textContent="",Ce.length===0){let Le=document.createElement("span");Le.className="tt_cardHint",Le.textContent=oe,ue.appendChild(Le);return}let ye=ae.value.trim().toUpperCase(),Ee=ye===""?Ce:Ce.filter(Le=>Le.toUpperCase().includes(ye));for(let Le of Ee.slice(0,30)){let Se=document.createElement("button");Se.type="button",Se.className="tt_envItem",Se.textContent=Le;let De="env:"+Le,Qe=null,ht=()=>{Qe!==null&&(clearTimeout(Qe),Qe=null),Se.textContent=Le,delete Se.dataset.danger};Se.addEventListener("mousedown",cr=>cr.preventDefault()),Se.addEventListener("click",()=>{let cr=Q.value;if(cr===""||cr.startsWith("env:")||Qe!==null){ht(),Q.value=De,Q.focus(),Q.dispatchEvent(new Event("change"));return}Se.textContent=v("list.credOverwrite",{name:Le}),Se.dataset.danger="",Qe=setTimeout(ht,4e3)}),ue.appendChild(Se)}if(Ee.length>30){let Le=document.createElement("span");Le.className="tt_envMore",Le.textContent=v("list.moreMatches",{count:Ee.length-30}),ue.appendChild(Le)}else if(Ee.length===0){let Le=document.createElement("span");Le.className="tt_envMore",Le.textContent=v("list.noCredRef"),ue.appendChild(Le)}};return ae.addEventListener("input",ve),ae.addEventListener("focus",()=>{Ce.length>0&&delete ue.dataset.hidden}),ae.addEventListener("blur",()=>{ae.value.trim()===""&&(ue.dataset.hidden="")}),de.appendChild(ae),de.appendChild(pe),de.appendChild(ue),{row:de,setNames(ye){Ce=Array.isArray(ye)?ye:[];let Ee=Ce.length>0;ae.hidden=!Ee,pe.hidden=Ee,ve()}}},p=(Q,oe)=>{let de=document.createElement("div");de.className="tt_sshRow tt_credRow";let ae=document.createElement("label");ae.className="tt_credToggle";let pe=document.createElement("input");pe.type="checkbox",pe.className="tt_cardCheckbox";let ue=document.createElement("span");ue.textContent=v("check.rememberCredential"),ae.appendChild(pe),ae.appendChild(ue),pe.checked=Ut!==null,ae.title=v("hint.rememberCredential");let Ce=document.createElement("button");Ce.type="button",Ce.className="tt_toolBtn tt_credClear",Ce.textContent=v("btn.clearCredential"),Ce.dataset.hidden="";let ve=document.createElement("span");ve.className="tt_credStatus",de.appendChild(ae),de.appendChild(Ce),de.appendChild(ve);let ye=(Se,De)=>{ve.textContent=Se,ve.dataset.kind=De},Ee=async()=>{let Se=ii(Q.value),De=Se!=="";if(ae.hidden=De,Ce.hidden=!De,ve.hidden=!1,ui()===null){pe.disabled=!0,pe.checked=!1,Ce.disabled=!0,ye(v(Ut===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),"muted");return}if(pe.disabled=!1,!De){ve.hidden=!0,ye("","plain");return}let Qe=await kh(Se);if(Qe.unreported===!0){ye(v("status.credUnreported",{ref:Se}),"plain");return}if(Qe.error!==void 0){ye(v("error.credStatusFailed",{error:Qe.error}),"error");return}let ht=Qe.view;ye(ht.configured?v("status.credStored",{ref:Se,source:ht.source!==""?v("meta.credSource",{source:ht.source}):""}):v("status.credUnknown",{ref:Se}),ht.configured?"ok":"plain"),Ce.disabled=ht.configured!==!0||ht.writable!==!0};Ce.addEventListener("click",()=>{(async()=>{let Se=ii(Q.value);if(Se==="")return;let De=await Eh(Se);if(De.error!==void 0){ye(De.error,"error");return}Q.value="",await Ee()})()});let Le=async()=>{let Se=await Lh(pe.checked===!0,Q.value,d.host.value,d.port.value,d.username.value,oe);return Se.value!==void 0&&(Q.value=Se.value,await Ee()),Se};return Q.addEventListener("change",()=>{Ee()}),{row:de,refresh:Ee,storeIfRequested:Le}},g=h(d.passphrase,v("hint.noCredRefPassphrase")),S=h(d.password,v("hint.noCredRefPassword")),b=p(d.password,"PASSWORD");(async()=>{let Q=await xh();g.setNames(Q),S.setNames(Q)})(),n.appendChild(_),n.appendChild(c),n.appendChild(g.row),n.appendChild(f),n.appendChild(b.row),n.appendChild(S.row);let x=document.createElement("button");x.type="button",x.className="tt_sshAdvToggle",x.title=v("hint.advanced");let w=document.createElement("span");w.className="tt_sshAdvChevron",w.innerHTML=uh;let E=document.createElement("span");E.className="tt_sshAdvText",E.textContent=v("section.advanced");let B=document.createElement("span");B.className="tt_sshAdvMeta",x.appendChild(w),x.appendChild(E),x.appendChild(B);let P=document.createElement("div");P.className="tt_sshAdvBody";let W=()=>{let Q=[];return Ns(d.jumpHost.value)!==void 0&&Q.push(v("section.jump")),d.proxyCommand.value.trim()!==""&&Q.push(v("section.proxyCommand")),d.hostKeyAlias.value.trim()!==""&&Q.push(v("field.hostKeyAlias")),Q},A=()=>{let Q=P.hidden===!1;x.setAttribute("aria-expanded",Q?"true":"false"),w.innerHTML=Q?q_:uh;let oe=W();B.textContent=oe.length>0?v("meta.advancedConfigured",{items:oe.join(" \xB7 ")}):v("hint.advanced")},V=Q=>{P.hidden=!Q,A()};x.addEventListener("click",()=>V(P.hidden===!0)),P.hidden=!0,x.setAttribute("aria-expanded","false"),P.appendChild(l(v("section.jump")));let O=m("jumpHost",v("field.jumpHost"),{placeholder:v("placeholder.jumpHost")});P.appendChild(O);let R=document.createElement("label");R.className="tt_sshRow";let F=document.createElement("input");F.type="checkbox",F.className="tt_cardCheckbox";let I=document.createElement("span");I.className="tt_cardLabel",I.textContent=v("check.jumpOwnCred"),R.appendChild(F),R.appendChild(I),P.appendChild(R);let C=m("jumpUsername",v("field.jumpUsername"),{placeholder:"root"}),L=m("jumpAuth",v("field.jumpAuth"),{select:[{value:"",label:v("option.authInherit")},{value:"agent",label:v("option.authAgent")},{value:"key",label:v("option.authKey")},{value:"password",label:v("option.authPassword")}]}),T=m("jumpKeyPath",v("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),D=m("jumpPassphrase",v("field.passphrase"),{type:"password"}),N=m("jumpPassword",v("field.password"),{type:"password"});for(let Q of[C,L,T,D,N])P.appendChild(Q);let G=document.createElement("div");G.className="tt_cardHint",G.textContent=v("hint.jumpInherit"),G.title=v("hint.jumpInheritFull"),P.appendChild(G),P.appendChild(l(v("section.proxyCommand")));let $=m("proxyCommand",v("field.proxyCommand"),{placeholder:v("placeholder.proxyCommand")});P.appendChild($);let Y=document.createElement("div");Y.className="tt_cardHint",Y.textContent=v("hint.proxyCommand"),Y.title=v("hint.proxyCommandFull"),P.appendChild(Y);let H=document.createElement("div");H.className="tt_cardHint tt_sshProbeWarn",H.textContent=v("hint.proxyCommandDisabled"),P.appendChild(H),P.appendChild(m("hostKeyAlias",v("field.hostKeyAlias"),{placeholder:v("placeholder.hostKeyAlias")}));let k=document.createElement("span");k.className="tt_cardHint",k.textContent=v("hint.hostKeyAlias"),k.title=v("hint.hostKeyAliasFull"),P.appendChild(k);let j=()=>{let Q=d.proxyCommand.value.trim()!=="",oe=rd,de=oe&&td;H.textContent=v(oe?"hint.proxyCommandDisabled":"hint.proxyCommandNotGranted"),H.style.display=Q&&!de?"":"none"};d.proxyCommand.addEventListener("input",j),j();let q=()=>{let Q=Ns(d.jumpHost.value);if(Q===void 0)return;if(F.checked!==!0)return Q;let oe={...Q},de=d.jumpUsername.value.trim();de!==""&&(oe.username=de);let ae=d.jumpAuth.value;(ae==="agent"||ae==="key"||ae==="password")&&(oe.auth=ae);let pe=d.jumpKeyPath.value.trim();return pe!==""&&(oe.keyPath=pe),d.jumpPassphrase.value!==""&&(oe.passphrase=d.jumpPassphrase.value),d.jumpPassword.value!==""&&(oe.password=d.jumpPassword.value),oe},U=()=>{let Q=d.proxyCommand.value.trim();return Q===""?void 0:Q},J=()=>{let Q=Ns(d.jumpHost.value)!==void 0,oe=Q&&F.checked===!0;R.style.display=Q?"":"none";for(let de of[C,L,T,D,N])de.style.display=oe?"":"none";T.style.display=oe&&d.jumpAuth.value==="key"?"":"none",D.style.display=oe&&d.jumpAuth.value==="key"?"":"none",N.style.display=oe&&d.jumpAuth.value==="password"?"":"none",G.style.display=Q?"":"none"};d.jumpHost.addEventListener("input",J),d.jumpAuth.addEventListener("change",J),F.addEventListener("change",J),n.appendChild(l(v("section.options")));let Z=document.createElement("label");Z.className="tt_cardRow";let se=document.createElement("input");se.type="checkbox",se.className="tt_cardCheckbox";let he=document.createElement("span");he.className="tt_cardLabel",he.textContent=v("check.agentForward"),Z.appendChild(se),Z.appendChild(he),n.appendChild(Z);let fe=document.createElement("label");fe.className="tt_cardRow";let te=document.createElement("input");te.type="checkbox",te.className="tt_cardCheckbox";let qe=document.createElement("span");qe.className="tt_cardLabel",qe.textContent=v("check.persist"),fe.appendChild(te),fe.appendChild(qe),te.checked=wr==="tmux",wr==="tmux"&&n.appendChild(fe);let le=document.createElement("label");le.className="tt_cardRow";let Me=document.createElement("input");Me.type="checkbox",Me.className="tt_cardCheckbox";let st=document.createElement("span");st.className="tt_cardLabel",st.textContent=v("check.saveToBook"),le.appendChild(Me),le.appendChild(st),n.appendChild(le);let He=m("name",v("field.bookName"),{placeholder:v("placeholder.bookName")});if(n.appendChild(He),n.appendChild(x),n.appendChild(P),Me.addEventListener("change",()=>{d.name.value=Dc(Me.checked,d.name.value,d.host.value),Me.checked&&d.name.focus()}),r||d.name.addEventListener("input",()=>{Me.checked=Ac(d.name.value)}),r){le.style.display="none",d.name.value=String(t.name??""),d.host.value=String(t.host??""),d.port.value=String(t.port??22),d.username.value=String(t.username??""),d.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",d.keyPath.value=String(t.keyPath??""),d.passphrase.value=String(t.passphrase??""),d.password.value=String(t.password??"");let Q=t.jump!==null&&typeof t.jump=="object"?t.jump:null;if(d.jumpHost.value=So(Q),Q!==null){let oe=Q.auth!==void 0||Q.keyPath!==void 0||Q.password!==void 0||Q.passphrase!==void 0;F.checked=oe,oe&&(d.jumpUsername.value=String(Q.username??""),d.jumpAuth.value=Q.auth==="key"||Q.auth==="password"?String(Q.auth):"",d.jumpKeyPath.value=String(Q.keyPath??""),d.jumpPassphrase.value=String(Q.passphrase??""),d.jumpPassword.value=String(Q.password??""))}se.checked=t.agentForward===!0,d.hostKeyAlias.value=String(t.hostKeyAlias??""),d.proxyCommand.value=String(t.proxyCommand??""),j(),te.checked=wr==="tmux"}let ee=document.createElement("div");ee.className="tt_sshStatus";let ne=document.createElement("div");ne.className="tt_sshError";let ge=document.createElement("div");ge.className="tt_sshProbeResult",ee.appendChild(ne),ee.appendChild(ge),a.appendChild(ee),J(),V(W().length>0);for(let Q of[d.jumpHost,d.proxyCommand,d.hostKeyAlias])Q.addEventListener("input",A);let be=()=>d.hostKeyAlias.value.trim(),je=()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim(),de=Number(d.port.value);if((!Number.isInteger(de)||de<1||de>65535)&&(de=22),Q===""||oe==="")return ne.textContent=v("error.hostUserRequired"),null;let ae=d.auth.value,pe={host:Q,port:de,username:oe,auth:ae},ue=q();ue!==void 0&&(pe.jump=ue);let Ce=U();if(Ce!==void 0&&(pe.proxyCommand=Ce),ae==="key"){let ye=d.keyPath.value.trim();if(ye==="")return ne.textContent=v("error.keyPathRequired"),null;pe.keyPath=ye;let Ee=d.passphrase.value;Ee!==""&&(pe.passphrase=Ee)}if(ae==="password"){let ye=d.password.value;if(ye==="")return ne.textContent=v("error.passwordRequired"),null;pe.password=ye}se.checked&&(pe.agentForward=!0);let ve=be();return ve!==""&&(pe.hostKeyAlias=ve),pe},Oe=document.createElement("div");Oe.className="tt_sshActions";let ze=document.createElement("div");ze.className="tt_sshActionsGroup";let Re=document.createElement("div");Re.className="tt_sshActionsGroup",Oe.appendChild(ze),Oe.appendChild(Re);let We=document.createElement("button");We.type="button",We.className="tt_toolBtn",We.textContent=v("btn.cancel");let we=document.createElement("button");we.type="button",we.className="tt_cardSave",we.textContent=v("btn.connect"),ze.appendChild(We);let _t=document.createElement("button");_t.type="button",_t.className="tt_toolBtn",_t.textContent=v("btn.fileBrowse"),_t.title=v("btn.browseTitle"),_t.addEventListener("click",()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim(),de=Number(d.port.value);if((!Number.isInteger(de)||de<1||de>65535)&&(de=22),Q===""||oe===""){ne.textContent=v("error.hostUserRequired");return}let ae=d.auth.value,pe={host:Q,port:de,username:oe,auth:ae},ue=q();ue!==void 0&&(pe.jump=ue);let Ce=U();if(Ce!==void 0&&(pe.proxyCommand=Ce),ae==="key"){let ye=d.keyPath.value.trim();if(ye===""){ne.textContent=v("error.keyPathRequired");return}pe.keyPath=ye;let Ee=d.passphrase.value;Ee!==""&&(pe.passphrase=Ee)}if(ae==="password"){let ye=d.password.value;if(ye===""){ne.textContent=v("error.passwordRequired");return}pe.password=ye}se.checked&&(pe.agentForward=!0);let ve=be();ve!==""&&(pe.hostKeyAlias=ve),vr(),yn(pe)}),ze.appendChild(_t);let Ze=null;r&&(Ze=document.createElement("button"),Ze.type="button",Ze.className="tt_toolBtn",Ze.textContent=v("btn.saveEdit"),Ze.addEventListener("click",()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim();if(Q===""||oe===""){ne.textContent=v("error.hostUserRequired");return}let de=Number(d.port.value);(!Number.isInteger(de)||de<1||de>65535)&&(de=22);let ae=d.auth.value,ue={name:d.name.value.trim()||Q,host:Q,port:de,username:oe,auth:ae,keyPath:ae==="key"?d.keyPath.value.trim():"",passphrase:d.passphrase.value,password:d.password.value,agentForward:se.checked,hostKeyAlias:be(),persist:te.checked},Ce=q();if(Ce!==void 0&&(ue.jump=Ce),ue.proxyCommand=d.proxyCommand.value.trim(),ae==="key"&&ue.keyPath===""){ne.textContent=v("error.keyPathRequired");return}Ze!==null&&(Ze.disabled=!0),(async()=>{let ve=await b.storeIfRequested();if(ve.error!==void 0){ne.textContent=ve.error,Ze!==null&&(Ze.disabled=!1);return}ve.value!==void 0&&(ue.password=ve.value);let ye=await tg(String(t.name??""),ue);if(Ze!==null&&(Ze.disabled=!1),ye!==void 0){ne.textContent=v("error.saveCredFailed",{error:ye});return}vr()})()}),ze.appendChild(Ze));let nt=document.createElement("button");nt.type="button",nt.className="tt_toolBtn",nt.textContent=v("btn.probe"),nt.title=v("btn.probeTitle"),nt.addEventListener("click",()=>{let Q=je();Q!==null&&(ge.className="tt_sshProbeResult",ge.textContent=v("msg.probing"),nt.disabled=!0,qo(Q,!1).then(oe=>{nt.disabled=!1,oe.result?(ge.className="tt_sshProbeResult"+(oe.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),ge.textContent=Ko(oe.result)):(ge.className="tt_sshProbeResult tt_sshProbeBad",ge.textContent=v("error.probeFailed",{detail:String(oe.error||v("error.unknown"))}))}))}),ze.appendChild(nt),Re.appendChild(we),a.appendChild(Oe);let ls=()=>{_.style.display=d.auth.value==="key"?"":"none",c.style.display=d.auth.value==="key"?"":"none",g.row.style.display=d.auth.value==="key"?"":"none",f.style.display=d.auth.value==="password"?"":"none",S.row.style.display=d.auth.value==="password"?"":"none",b.row.style.display=d.auth.value==="password"?"":"none"};d.auth.addEventListener("change",ls),ls(),b.refresh(),We.addEventListener("click",()=>vr()),i.addEventListener("mousedown",Q=>{Q.target===i&&vr()}),we.addEventListener("click",async()=>{ne.textContent="";let Q=await dn();if(Q!==null){ne.textContent=Q;return}let oe=d.host.value.trim(),de=d.username.value.trim(),ae=Number(d.port.value);if((!Number.isInteger(ae)||ae<1||ae>65535)&&(ae=22),oe===""||de===""){ne.textContent=v("error.hostUserRequired");return}let pe=d.auth.value,ue={t:"ssh",host:oe,port:ae,username:de,auth:pe},Ce=q();Ce!==void 0&&(ue.jump=Ce);let ve=U();if(ve!==void 0&&(ue.proxyCommand=ve),pe==="key"){let De=d.keyPath.value.trim();De!==""&&(ue.keyPath=De);let Qe=d.passphrase.value;Qe!==""&&(ue.passphrase=Qe)}if(pe==="password"){let De=d.password.value;De!==""&&(ue.password=De)}se.checked&&(ue.agentForward=!0);let ye=be();ye!==""&&(ue.hostKeyAlias=ye),te.checked&&(ue.persist=!0,ue.persistName=da());let Ee=ae!==22?de+"@"+oe+":"+ae:de+"@"+oe,Le=De=>{vr(),ce!==null&&Yi(ue,De!==""?De:Ee)};if(!Me.checked){Le("");return}let Se=d.name.value.trim()||oe;we.disabled=!0,(async()=>{let De=await b.storeIfRequested();if(De.error!==void 0){ne.textContent=De.error,we.disabled=!1;return}let Qe=De.value??ue.password??"",ht=await eg({name:Se,host:oe,port:ae,username:de,auth:pe,keyPath:ue.keyPath??"",passphrase:ue.passphrase??"",password:Qe,agentForward:se.checked,hostKeyAlias:be(),persist:te.checked,...Ce!==void 0?{jump:Ce}:{},proxyCommand:d.proxyCommand.value.trim()});if(we.disabled=!1,ht!==void 0){ne.textContent=v("error.saveBookFailed",{error:ht});return}Le(Se)})()}),o.appendChild(s),o.appendChild(n),o.appendChild(a),i.appendChild(o),document.body.appendChild(i),oi=i,d.host.focus()}function vr(){oi!==null&&(oi.remove(),oi=null)}async function eg(e){let t=[...nr.filter(r=>r?.name!==e.name),e];try{let r=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),i=await r.json().catch(()=>({}));if(!r.ok||!i.ok)return String(i.error||"HTTP "+r.status);Xi(i.config);return}catch(r){return String(r&&r.message?r.message:r)}}async function tg(e,t){if(t.name!==e&&nr.some(i=>i?.name===t.name))return v("error.bookNameTaken",{name:t.name});let r=nr.map(i=>i?.name===e?t:i);try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:r})}),o=await i.json().catch(()=>({}));if(!i.ok||!o.ok)return String(o.error||"HTTP "+i.status);Xi(o.config);return}catch(i){return String(i&&i.message?i.message:i)}}function rg(e,t,r){let i=Qr(r,xe);if(gd(i))return;let o=document.createElement("div");o.className="tt_sftpDualCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let n=document.createElement("div");n.className="tt_sshTitle",n.innerHTML=$i+"<span></span>",n.lastElementChild.textContent=v("panel.sftpDual",{label:t});let a=document.createElement("button");a.type="button",a.className="tt_close",a.title=v("btn.close"),a.innerHTML=_n,a.addEventListener("click",()=>mi(i)),s.appendChild(n),s.appendChild(a),o.appendChild(s);let u=document.createElement("div");u.className="tt_sftpStatus";let l=(N,G)=>{u.textContent=N,G===void 0?delete u.dataset.state:u.dataset.state=G},d=!1,m=(N,G)=>{if(!(d||_.local.busy||_.remote.busy)){d=!0;for(let $ of[_.local,_.remote])$.setBusy(!0);l(N,"busy"),Promise.resolve().then(G).catch($=>{($===null||typeof $!="object"||$.name!=="TransferCanceledError")&&R.fail(v("status.failed")),l(String($&&$.message?$.message:$),"error")}).finally(()=>{d=!1;for(let $ of[_.local,_.remote])$.setBusy(!1)})}},y=N=>{_[N].bar.after(h),h.style.display="",p.focus(),p.select()},_={},c=(N,G)=>{if(N===void 0||N==="")throw new Error(v("error.dirNotReady"));return N.endsWith("/")||N.endsWith("\\")?N+G:N+"/"+G},f=(N,G)=>{let $={kind:N,path:"",busy:!1},Y=document.createElement("div");Y.className="tt_sftpPane";let H=document.createElement("div");H.className="tt_sftpPaneHead";let k=document.createElement("span");k.textContent=G;let j=document.createElement("span");j.className="tt_sftpPaneMeta",H.appendChild(k),H.appendChild(j),Y.appendChild(H);let q=document.createElement("div");q.className="tt_sftpBar";let U=document.createElement("input");U.type="text",U.className="tt_sftpPath",U.placeholder=v(N==="local"?"placeholder.localPath":"placeholder.remotePath"),U.spellcheck=!1,U.autocomplete="off";let J=document.createElement("button");J.type="button",J.className="tt_toolBtn",J.innerHTML=ia+"<span>"+v("btn.refresh")+"</span>";let Z=document.createElement("button");Z.type="button",Z.className="tt_toolBtn",Z.innerHTML=Bh+"<span>"+v("btn.mkdir")+"</span>";let se=document.createElement("button");se.type="button",se.className="tt_toolBtn tt_toolToggle",se.textContent=v("btn.hiddenFiles"),se.title=v("btn.hiddenFilesTitle"),Lr&&(se.dataset.on=""),q.appendChild(U),q.appendChild(J),q.appendChild(Z),q.appendChild(se),Y.appendChild(q);let he=document.createElement("div");he.className="tt_sftpList",Y.appendChild(he),$.bar=q;let fe=ee=>{$.busy=ee;for(let ne of[J,Z])ne.disabled=ee;U.disabled=ee},te=async(ee,ne)=>{let ge=N==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",be=N==="local"?ne:{...e,...ne},je=await fetch(ge+ee,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(be)}),Oe=await je.json().catch(()=>({}));if(!je.ok||Oe.ok!==!0)throw new Error(String(Oe.error||"HTTP "+je.status));return Oe},qe=(ee,ne)=>{if(!($.busy||d))return fe(!0),l(ee,"busy"),Promise.resolve().then(ne).catch(ge=>l(String(ge&&ge.message?ge.message:ge),"error")).finally(()=>fe(!1))},le=(ee,ne)=>{if(ee===void 0||ee==="")throw new Error(v("error.dirNotReady"));return ee.endsWith("/")||ee.endsWith("\\")?ee+ne:ee+"/"+ne},Me=ee=>{let ne=le($.path,ee.name),ge=[];ee.isDir===!0?ge.push(v("meta.dir")):ge.push(ct(Number(ee.size))||"\u2014");let be=wd(Number(ee.mtime));be!==""&&ge.push(be);let je=w(ee.isDir?$i:ee.isSymlink?Dh:Ah,ee.name,ge.join(" \xB7 "),ee.isDir===!0?"dir":ee.isSymlink===!0?"link":"file"),Oe=()=>$.loadDir($.path),ze=N==="local"?_.remote:_.local;return ee.isDir===!0&&je.addEventListener("click",Re=>{Re.target instanceof Element&&Re.target.closest(".tt_sftpAct")!==null||$.loadDir(ne)}),E(je,N==="local"?sa:na,v("btn.transferTo",{target:v(N==="local"?"meta.remote":"meta.local"),path:ze.path}),()=>{if($.path===""||ze.path===""){l(v("error.transferDirsNotReady"),"error");return}R.reset(),R.pulse(0),m(v("msg.transferring",{name:ee.name}),async()=>{let Re=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:N==="local"?"up":"down",...e,localPath:N==="local"?ne:le(ze.path,ee.name),remotePath:N==="local"?le(ze.path,ee.name):ne})}),We=await Re.json().catch(()=>({}));if(!Re.ok||We.ok!==!0)throw R.fail(v("error.transferFailed")),new Error(String(We.error||"HTTP "+Re.status));let we=We.job?.id;if(typeof we!="string"||we==="")throw R.fail(v("error.transferFailed")),new Error(v("error.noTaskId"));await F(we,ee.name)==="canceled"?(R.reset(),l(v("msg.transferCanceled",{name:ee.name}))):(R.done(v("status.done")),setTimeout(()=>R.reset(),1500),l(v("msg.transferred",{name:ee.name}))),await ze.loadDir(ze.path)})}),N!=="local"&&ee.isDir!==!0&&E(je,Ph,v("btn.download",{name:ee.name}),()=>{P(ee,ne)}),E(je,ra,v("btn.rename",{name:ee.name}),()=>{p.placeholder=v("placeholder.newName"),p.value=ee.name,y(N),b=async()=>{let Re=p.value.trim();Re===""||Re===ee.name||(x(),await $.runTask(v("msg.renaming",{name:ee.name}),async()=>{await te("rename",{from:ne,to:le($.path,Re)}),await Oe()}))}}),B(je,()=>$.runTask(v("msg.deleting",{name:ee.name}),async()=>{await te("remove",{path:ne,recursive:ee.isDir===!0}),await Oe(),l(v("msg.deleted",{name:ee.name}))}),ee),je},st=ee=>{if(he.textContent="",$.path!==""&&$.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test($.path)===!1){let be=w(ta,v("list.parentDir"),"","up");be.addEventListener("click",()=>{let je=N==="local"?ng($.path):yd($.path);je!==null&&$.loadDir(je)}),he.appendChild(be)}let ne=js(ee,Lr);if(ne.length===0){let be=document.createElement("div");be.className="tt_addMenuTitle",be.textContent=ee.length>0?v("list.hiddenOnly"):v("list.emptyDir"),he.appendChild(be);return}let ge=500;for(let be of ne.slice(0,ge))be===null||typeof be!="object"||typeof be.name!="string"||be.name===""||he.appendChild(Me(be));if(ne.length>ge){let be=document.createElement("div");be.className="tt_addMenuTitle",be.textContent=v("list.truncated",{rest:ne.length-ge,total:ne.length}),he.appendChild(be)}};$.loadDir=async ee=>{try{let ne=await te("list",{path:ee??$.path});$.path=typeof ne.path=="string"&&ne.path!==""?ne.path:$.path,U.value=$.path;let ge=Array.isArray(ne.entries)?ne.entries:[];$.rawEntries=ge,st(ge),j.textContent=v("list.itemCount",{count:js(ge,Lr).length}),l($.path)}catch(ne){l(String(ne&&ne.message?ne.message:ne),"error")}},$.runTask=qe,$.setBusy=fe,_[N]=$,se.addEventListener("click",()=>{Am(!Lr)});let He=ee=>{se!==null&&(ee?se.dataset.on="":delete se.dataset.on),$.rawEntries=$.rawEntries??[],st($.rawEntries),j.textContent=v("list.itemCount",{count:js($.rawEntries,ee).length})};return zo.add(He),$.onShowHidden=He,J.addEventListener("click",()=>{$.runTask(v("list.loading"),()=>$.loadDir($.path))}),Z.addEventListener("click",()=>{$.busy||d||(p.placeholder=v("placeholder.newDirName"),p.value="",y(N),b=async()=>{let ee=p.value.trim();ee!==""&&(x(),await $.runTask(v("msg.creatingDir",{name:ee}),async()=>{await te("mkdir",{path:le($.path,ee),parents:!0}),await $.loadDir($.path)}))})}),U.addEventListener("keydown",ee=>{if(ee.key!=="Enter"||(ee.preventDefault(),$.busy||d))return;let ne=U.value.trim();ne!==""&&$.runTask(v("list.loading"),()=>$.loadDir(ne))}),Y},h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let p=document.createElement("input");p.type="text",p.className="tt_cardInput",p.spellcheck=!1,p.autocomplete="off";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.textContent=v("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=v("btn.cancel"),h.appendChild(p),h.appendChild(g),h.appendChild(S);let b=null,x=()=>{h.style.display="none",p.value="",b=null};g.addEventListener("click",()=>{b?.()}),S.addEventListener("click",x),p.addEventListener("keydown",N=>{N.key==="Enter"?(N.preventDefault(),b?.()):N.key==="Escape"&&(N.stopPropagation(),x())});let w=(N,G,$,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let k=document.createElement("span");k.className="tt_sftpIcon",k.innerHTML=N,Y!==void 0&&(k.dataset.kind=Y);let j=document.createElement("span");if(j.className="tt_sftpName",j.textContent=G,j.title=G,H.appendChild(k),H.appendChild(j),$!==""){let q=document.createElement("span");q.className="tt_sftpMeta",q.textContent=$,H.appendChild(q)}return H},E=(N,G,$,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=G,H.title=$,H.addEventListener("click",k=>{k.stopPropagation(),Y()}),N.appendChild(H)},B=(N,G,$)=>{let Y=document.createElement("button");Y.type="button",Y.className="tt_sftpAct",Y.innerHTML=Tr,Y.title=$.isDir?v("btn.deleteEntryDir",{name:$.name}):v("btn.deleteEntry",{name:$.name});let H=null;Y.addEventListener("click",k=>{if(k.stopPropagation(),H!==null){clearTimeout(H),H=null,Y.innerHTML=Tr,delete Y.dataset.danger,G();return}Y.textContent=v("btn.confirm"),Y.dataset.danger="",H=setTimeout(()=>{H=null,Y.innerHTML=Tr,delete Y.dataset.danger},4e3)}),N.appendChild(Y)},P=(N,G)=>_.remote.runTask(v("msg.downloading",{name:N.name}),async()=>{R.reset();let $;try{$=await Cd({makeBody:Y=>({...e,path:G,...Y>0?{offset:Y}:{}}),onProgress:(Y,H)=>R.set(Y,H),maxMb:sr.maxDownloadMb,registerCancel:Y=>R.setCancel(Y),onResume:Y=>l(v("msg.downloadResuming",{name:N.name,offset:ct(Y)||String(Y)+" B"}),"busy")})}catch(Y){if(di(Y)){R.reset(),l(v("msg.downloadCanceled",{name:N.name}));return}throw R.fail(v("error.downloadFailed")),Y}R.done(v("status.done")),xd($,N.name),setTimeout(()=>R.reset(),1500),l(v("msg.downloaded",{name:N.name,size:ct($.size)||String($.size)+" B"}))}),W=f("local",v("meta.local")),A=f("remote",v("meta.remote"));_.local.wrap=W,_.remote.wrap=A;let V=document.createElement("div");V.className="tt_sftpDual",V.appendChild(W),V.appendChild(A),o.appendChild(V),o.appendChild(h);let O=document.createElement("div");O.className="tt_sftpFoot";let R=Sd();O.appendChild(R.el),O.appendChild(u),o.appendChild(O);let F=async(N,G)=>{let $=!1;R.setCancel(()=>{$||($=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:N})}).catch(()=>{}))});try{for(;;){await new Promise(j=>setTimeout(j,400));let Y=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:N})}),H=await Y.json().catch(()=>({}));if(!Y.ok||H.ok!==!0){if($)return"canceled";throw new Error(String(H.error||"HTTP "+Y.status))}let k=H.job;if(k===null||typeof k!="object")throw new Error(v("error.invalidTaskState"));if(k.state==="running"){let j=typeof k.current=="string"&&k.current!==""?k.current:G;l(v("msg.transferring",{name:j}),"busy"),Number.isFinite(k.total)&&k.total>0?R.set(Number(k.bytes)||0,k.total):R.pulse(Number(k.bytes)||0);continue}if(k.state==="canceled")return"canceled";if(k.state!=="done")throw new Error(String(k.error||v("error.transferFailed")));return"done"}}finally{R.setCancel(null)}},I=(N,G)=>{G?N.wrap.dataset.drag="":delete N.wrap.dataset.drag},C=N=>Array.isArray(N?.types)&&N.types.includes("Files");for(let N of[_.local,_.remote]){let G=N.wrap,$=0;G.addEventListener("dragenter",Y=>{N.kind!=="remote"||!C(Y.dataTransfer)||(Y.preventDefault(),$+=1,I(N,!0))}),G.addEventListener("dragover",Y=>{N.kind==="remote"&&(Y.preventDefault(),Y.dataTransfer!==null&&(Y.dataTransfer.dropEffect="copy"))}),G.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&I(N,!1)}),G.addEventListener("drop",Y=>{$=0,I(N,!1);let H=Xc(N.kind,Y.dataTransfer);if(!H.accept){H.reason==="wrongPane"&&(Y.preventDefault(),l(v("error.dropOnLocalPane"),"error"));return}Y.preventDefault(),!(d||_.remote.busy)&&kd(Y.dataTransfer).then(k=>{(k.length>0||k._limitExceeded===!0)&&L(_.remote,k)})})}let L=async(N,G)=>{let $=sr;if($.maxUploadFiles>0&&G.length>$.maxUploadFiles){l(v("error.uploadCountExceeded",{max:$.maxUploadFiles,count:G.length}),"error");return}let Y=$.maxUploadMb>0?$.maxUploadMb*1024*1024:0,H=G.find(k=>Y>0&&(k.file?.size??0)>Y);if(H!==void 0){l(v("error.uploadTooBig",{size:ct(Y),name:String(H.relPath??"")}),"error");return}if(G._limitExceeded===!0){l(v("error.uploadTotalTooBig"),"error");return}await m(v("msg.uploading"),async()=>{if(N.path===""){l(v("error.transferDirsNotReady"),"error");return}for(let q of Zc(G))await fetch("/api/dsh-tty/sftp/mkdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:c(N.path,q),parents:!0})}).catch(()=>{});R.reset();let k={stopped:!1,abort:null};R.setCancel(()=>k.abort?.());let j=0;try{let q=0;for(let U of G){if(k.stopped)break;q+=1,k.abort=null;try{await bd(U.file,c(N.path,U.relPath),{spec:e,label:`${String(q)}/${String(G.length)} ${U.relPath}`,cancelRef:k,onProgress:(J,Z)=>Number.isFinite(Z)&&Z>0?R.set(J,Z):R.pulse(J),onLabel:J=>l(v("msg.uploadingName",{name:J}),"busy")}),j+=1}catch(J){if(di(J)||k.stopped)break;throw J}}}finally{R.setCancel(null)}k.stopped?(R.reset(),l(v("msg.uploadCanceled",{done:j,total:G.length}))):(R.done(v("status.allDone")),setTimeout(()=>R.reset(),1500),l(v("msg.uploadDoneCount",{count:G.length}))),await N.loadDir(N.path)})},T=la(),D=T===null?420:Math.round(T.height*.56);vd(o,v("panel.sftpDual",{label:t}),D,i),_.local.loadDir(""),_.remote.loadDir(""),Uo=()=>{for(let N of[_.local,_.remote])N!==void 0&&typeof N.onShowHidden=="function"&&zo.delete(N.onShowHidden)}}var ar=null,qt=null;function md(){return qt!==null&&xo(qt.ownerKey,xe)?qt.ownerKey:Qr(void 0,xe)}var gd=(e=md())=>ar!==null||qt!==null&&qt.ownerKey===e;function vd(e,t,r,i){let o=Qr(i,xe),s=Dt!==null&&Dt.ownerKey===o;if(ce!==null&&!Xe&&kt!==null&&!s)try{let a=Jh({title:t,side:"bottom",size:r,min:200,ownerSid:o,onClose:()=>mi(o)});a.element.appendChild(e),qt=a;return}catch(a){console.warn("[dsh-tty] SFTP \u6302\u5230\u7EC8\u7AEF\u6302\u8F7D\u4F4D\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(a instanceof Error?a.message:String(a)))}let n=document.createElement("div");n.className="tt_sshBackdrop",n.appendChild(e),n.addEventListener("mousedown",a=>{a.target===n&&mi()}),document.body.appendChild(n),ar=n}var Ui=null;function ig(){let e=Ui;if(Ui=null,e!==null)try{e.click()}catch{}}function sg(e){let t=new TextEncoder().encode(e),r="";for(let i of t)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function bd(e,t,r){let{spec:i,label:o="",cancelRef:s,onProgress:n,onLabel:a,onDone:u}=r;return o!==""&&typeof a=="function"&&a(o),new Promise((l,d)=>{let m=sg(JSON.stringify({...i,path:t})),y=new XMLHttpRequest;s.abort=()=>{s.stopped=!0,y.abort()},y.open("POST","/api/dsh-tty/sftp/upload"),y.setRequestHeader("x-dsh-sftp-meta",m),y.upload.addEventListener("progress",f=>{f.lengthComputable?n(f.loaded,f.total):n(0,NaN)});let _=!1,c=f=>{_||(_=!0,f===null?l():d(f))};y.addEventListener("load",()=>{if(y.status===200){u?.(),c(null);return}if(s.stopped)return;let f="HTTP "+y.status;try{let h=JSON.parse(y.responseText);h!==null&&typeof h=="object"&&typeof h.error=="string"&&(f=h.error)}catch{}c(new Error(f))}),y.addEventListener("error",()=>{if(s.stopped){c(new _i);return}c(new Error(v("error.networkError")))}),y.addEventListener("abort",()=>{c(new _i)}),y.send(e)})}function wd(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=i=>String(i).padStart(2,"0");return t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())+" "+r(t.getHours())+":"+r(t.getMinutes())}function yd(e){let t=String(e).replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function ng(e){let t=String(e).trim();if(t===""||(t=t.replace(/[\\/]+$/,""),t===""))return null;let r=t.match(/^([A-Za-z]:)(.*)$/);if(r!==null){let o=r[2];if(o==="")return null;let s=Math.max(o.lastIndexOf("\\"),o.lastIndexOf("/"));return s<=0?r[1]+"\\":r[1]+o.slice(0,s)}if(t.startsWith("\\\\")||t.startsWith("//")){let o=t.slice(2);if(o.split(/[\\/]/).filter(a=>a!=="").length<=2)return null;let n=Math.max(o.lastIndexOf("\\"),o.lastIndexOf("/"));return t.slice(0,2)+o.slice(0,n)}let i=t.lastIndexOf("/");return i<=0?i===0?"/":null:t.slice(0,i)}function Pi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function Sd(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let r=document.createElement("div");r.className="tt_sftpFill",t.appendChild(r);let i=document.createElement("span");i.className="tt_sftpPct",i.textContent="";let o=document.createElement("button");o.type="button",o.className="tt_sftpCancel",o.title=v("btn.cancelTransfer"),o.innerHTML=ts,o.style.display="none";let s=null;o.addEventListener("click",_=>{_.stopPropagation();let c=s;c!==null&&(o.disabled=!0,c())}),e.appendChild(t),e.appendChild(i),e.appendChild(o);let n=_=>{i.textContent=_},a="",u=-1,l=_=>{_!==a&&(a=_,i.textContent=_)},d=_=>{let c=Math.round(_);c!==u&&(u=c,r.style.width=c+"%")},m=()=>{s=null,Ui===o&&(Ui=null),o.style.display="none",o.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",u=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,r.style.width="0%",i.textContent="",m()},setCancel(_){if(_==null){m();return}s=_,Ui=o,o.disabled=!1,o.style.display=""},set(_,c){e.dataset.active="",delete e.dataset.state;let f=Date.now();if(this._last!==void 0&&f>this._lastAt){let h=(_-this._last)/((f-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}if(this._last=_,this._lastAt=f,Number.isFinite(c)&&c>0){let h=Math.min(100,Math.max(0,_/c*100));d(h);let p=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l(Math.round(h)+"%"+(p!==""?" \xB7 "+p:""))}else{r.style.width="";let h=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l(ct(_)+(h!==""?" \xB7 "+h:""))}},pulse(_){e.dataset.active="",delete e.dataset.state,r.style.width="45%",r.style.transition="none",setTimeout(()=>{r.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let h=(_-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}this._last=_,this._lastAt=c;let f=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l((Number.isFinite(_)?ct(_):"\u2026")+(f!==""?" \xB7 "+f:""))},done(_){e.dataset.active="",e.dataset.state="done",r.style.width="100%",u=100,m(),l(_!==void 0&&_!==""?_:v("status.done"))},fail(_){e.dataset.active="",e.dataset.state="error",m(),l(_!==void 0&&_!==""?_:v("status.failed"))},text(_){delete e.dataset.state,_===void 0||_===""?(e.dataset.active="",a="",i.textContent=""):(e.dataset.active="",r.style.width="",u=-1,l(_))}}}async function og(e,t,r,i=0,o=null,s=0){let n=i>0?i*1024*1024:0,a=Number.isFinite(s)&&s>0?s:0,u=typeof AbortController=="function"?new AbortController:null,l=!1;u!==null&&(t={...t,signal:u.signal},typeof o=="function"&&o(()=>{l=!0,u.abort()}));let d=a,m=null,y;try{if(y=await fetch(e,t),!y.ok){let S="HTTP "+y.status;try{let b=await y.json();b!==null&&typeof b=="object"&&typeof b.error=="string"&&(S=b.error)}catch{}throw new Error(S)}let _=Number(y.headers.get("content-length")),c=y.headers.get("content-range")??"",f=Number(/\/(\d+)\s*$/.exec(c)?.[1]);Number.isFinite(f)&&f>0?m=f:Number.isFinite(_)&&_>0&&(m=a+_);let h=y.body;if(h===null||typeof h.getReader!="function"){let S=await y.blob();if(n>0&&a+S.size>n)throw new Error(v("error.downloadTooBig",{size:ct(n)}));return m!==null&&r(m,m),S}if(n>0&&m!==null&&m>n){try{await h.cancel()}catch{}throw new Error(v("error.downloadTooBig",{size:ct(n)}))}let p=h.getReader(),g=[];for(;;){let{done:S,value:b}=await p.read();if(S)break;if(b!==void 0&&b.byteLength>0){if(d+=b.byteLength,n>0&&d>n){try{await p.cancel()}catch{}throw new Error(v("error.downloadTooBig",{size:ct(n)}))}g.push(b),r(d,m!==null?m:NaN)}}return new Blob(g,{type:"application/octet-stream"})}catch(_){if(l||_!==null&&typeof _=="object"&&_.name==="AbortError")throw new _i;if(_!==null&&typeof _=="object")throw _.received=d,_.total=m,_;let c=new Error(String(_));throw c.received=d,c.total=m,c}}async function Cd({url:e="/api/dsh-tty/sftp/download",makeBody:t,onProgress:r,maxMb:i=0,registerCancel:o=null,onResume:s=null}){let n=0,a=0;for(;;)try{return await og(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t(n))},r,i,o,n)}catch(u){if(di(u))throw u;a+=1;let l=Jc({received:u?.received??0,total:u?.total??null,attempt:a});if(!l.resume)throw u;n=l.offset,typeof s=="function"&&s(n)}}var _i=class extends Error{constructor(){super(v("msg.canceled")),this.name="TransferCanceledError"}};function di(e){return e instanceof _i}function xd(e,t){let r=URL.createObjectURL(e),i=document.createElement("a");i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}async function kd(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],r=[];for(let l of t){let d=typeof l.webkitGetAsEntry=="function"?l.webkitGetAsEntry():null;d!==null&&r.push(d)}if(r.length===0)return[...e.files??[]].map(l=>({relPath:l.name,file:l}));let i=[],o=sr.maxUploadFiles,s=sr.maxUploadMb>0?sr.maxUploadMb*1024*1024:0,n=()=>o>0&&i.length>=o,a=0,u=(l,d)=>new Promise(m=>{if(n()){m();return}if(l.isFile===!0){l.file(c=>{s>0&&a+(c.size??0)>s?i._limitExceeded=!0:(i.push({relPath:d+l.name,file:c}),a+=c.size??0),m()},()=>m());return}if(l.isDirectory!==!0){m();return}let y=l.createReader(),_=()=>{y.readEntries(async c=>{if(c.length===0){m();return}for(let f of c){if(n())break;await u(f,d+l.name+"/")}if(n()){m();return}_()},()=>m())};_()});for(let l of r)await u(l,"");return i}function yn(e,t){let r=Qr(t,xe);if(gd(r))return;let i=e!==null&&typeof e=="object"?e:{},o={};if(typeof i.name=="string"&&i.name!=="")o.name=i.name;else{for(let j of["host","username","auth","keyPath","passphrase","password"])typeof i[j]=="string"&&i[j]!==""&&(o[j]=i[j]);let k=Number(i.port);Number.isInteger(k)&&k>=1&&k<=65535&&(o.port=k),i.agentForward===!0&&(o.agentForward=!0)}let s=o.name??(o.username!==void 0?o.username+"@"+String(o.host??""):String(o.host??""));if(Qh==="dual"){rg(o,s,r);return}let n=document.createElement("div");n.className="tt_sftpCard";let a=document.createElement("div");a.className="tt_sftpTitleRow";let u=document.createElement("div");u.className="tt_sshTitle",u.innerHTML=$i+"<span></span>",u.lastElementChild.textContent="SFTP \xB7 "+s;let l=document.createElement("button");l.type="button",l.className="tt_close",l.title=v("btn.close"),l.innerHTML=_n,l.addEventListener("click",()=>mi(r)),a.appendChild(u),a.appendChild(l),n.appendChild(a);let d=document.createElement("div");d.className="tt_sftpBar";let m=document.createElement("input");m.type="text",m.className="tt_sftpPath",m.placeholder=v("placeholder.remotePath"),m.spellcheck=!1,m.autocomplete="off";let y=document.createElement("button");y.type="button",y.className="tt_toolBtn",y.innerHTML=ia+"<span>"+v("btn.refresh")+"</span>";let _=document.createElement("button");_.type="button",_.className="tt_toolBtn",_.innerHTML=Bh+"<span>"+v("btn.mkdir")+"</span>";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.innerHTML=U_+"<span>"+v("btn.upload")+"</span>",c.title=v("btn.uploadTitle");let f=document.createElement("input");f.type="file",f.multiple=!0,f.style.display="none",d.appendChild(m),d.appendChild(y),d.appendChild(_),d.appendChild(c),n.appendChild(d),n.appendChild(f);let h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let p=document.createElement("input");p.type="text",p.className="tt_cardInput",p.spellcheck=!1,p.autocomplete="off";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.textContent=v("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=v("btn.cancel"),h.appendChild(p),h.appendChild(g),h.appendChild(S),n.appendChild(h);let b=null,x=()=>{h.style.display="none",b=null};g.addEventListener("click",()=>{b?.()}),S.addEventListener("click",x),p.addEventListener("keydown",k=>{k.key==="Enter"?(k.preventDefault(),b?.()):k.key==="Escape"&&(k.stopPropagation(),x())});let w=document.createElement("div");w.className="tt_sftpList",n.appendChild(w);let E=document.createElement("div");E.className="tt_sftpFoot";let B=document.createElement("div");B.className="tt_sftpStatus";let P=Sd();E.appendChild(P.el),E.appendChild(B),n.appendChild(E);let W={path:"",busy:!1},A=(k,j)=>{B.textContent=k,j===void 0?delete B.dataset.state:B.dataset.state=j},V=k=>{W.busy=k;for(let j of[y,_,c])j.disabled=k;m.disabled=k},O=async(k,j)=>{let q=await fetch("/api/dsh-tty/sftp/"+k,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...o,...j})}),U=await q.json().catch(()=>({}));if(!q.ok||U.ok!==!0)throw new Error(String(U.error||"HTTP "+q.status));return U},R=async(k,j)=>{if(!W.busy){V(!0),A(k,"busy");try{await j()}catch(q){A(String(q&&q.message?q.message:q),"error")}finally{V(!1)}}},F=(k,j,q,U)=>{let J=document.createElement("button");J.type="button",J.className="tt_sftpRow";let Z=document.createElement("span");Z.className="tt_sftpIcon",Z.innerHTML=k,U!==void 0&&(Z.dataset.kind=U);let se=document.createElement("span");if(se.className="tt_sftpName",se.textContent=j,se.title=j,J.appendChild(Z),J.appendChild(se),q!==""){let he=document.createElement("span");he.className="tt_sftpMeta",he.textContent=q,J.appendChild(he)}return J},I=(k,j,q,U)=>{let J=document.createElement("button");J.type="button",J.className="tt_sftpAct",J.innerHTML=j,J.title=q,J.addEventListener("click",Z=>{Z.stopPropagation(),U()}),k.appendChild(J)},C=(k,j,q)=>{let U=document.createElement("button");U.type="button",U.className="tt_sftpAct",U.innerHTML=Tr,U.title=j.isDir?v("btn.deleteEntryDir",{name:j.name}):v("btn.deleteEntry",{name:j.name});let J=null;U.addEventListener("click",Z=>{if(Z.stopPropagation(),!W.busy){if(J!==null){clearTimeout(J),J=null,U.innerHTML=Tr,delete U.dataset.danger,R(v("msg.deleting",{name:j.name}),async()=>{await O("remove",{path:q,recursive:j.isDir===!0}),await T(W.path),A(v("msg.deleted",{name:j.name}))});return}U.textContent=v("btn.confirm"),U.dataset.danger="",J=setTimeout(()=>{J=null,U.innerHTML=Tr,delete U.dataset.danger},4e3)}}),k.appendChild(U)},L=k=>{if(w.textContent="",W.path!==""&&W.path!=="/"){let U=F(ta,v("list.parentDir"),"","up");U.addEventListener("click",()=>{R(v("list.loading"),()=>T(yd(W.path)))}),w.appendChild(U)}let j=Array.isArray(k)?k:[];if(j.length===0){let U=document.createElement("div");U.className="tt_addMenuTitle",U.textContent=v("list.emptyDir"),w.appendChild(U);return}let q=500;for(let U of j.slice(0,q)){if(U===null||typeof U!="object"||typeof U.name!="string"||U.name==="")continue;let J=Pi(W.path,U.name),Z=[];U.isDir===!0?Z.push(v("meta.dir")):Z.push(ct(Number(U.size))||"\u2014");let se=wd(Number(U.mtime));se!==""&&Z.push(se);let he=F(U.isDir?$i:U.isSymlink?Dh:Ah,U.name,Z.join(" \xB7 "),U.isDir===!0?"dir":U.isSymlink===!0?"link":"file");U.isDir===!0?he.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||R(v("list.loading"),()=>T(J))}):(he.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||D(U,J)}),I(he,Ph,v("btn.download",{name:U.name}),()=>{D(U,J)})),I(he,ra,v("btn.rename",{name:U.name}),()=>{p.placeholder=v("placeholder.newName"),p.value=U.name,h.style.display="",p.focus(),p.select(),b=async()=>{let fe=p.value.trim();fe===""||fe===U.name||(x(),await R(v("msg.renaming",{name:U.name}),async()=>{await O("rename",{from:J,to:Pi(W.path,fe)}),await T(W.path)}))}}),C(he,U,J),w.appendChild(he)}if(j.length>q){let U=document.createElement("div");U.className="tt_addMenuTitle",U.textContent=v("list.truncated",{rest:j.length-q,total:j.length}),w.appendChild(U)}},T=async k=>{try{let j=await O("list",{path:k??W.path});W.path=typeof j.path=="string"&&j.path!==""?j.path:"/",m.value=W.path;let q=Array.isArray(j.entries)?j.entries.length:0;L(j.entries),A(W.path+" \u2014 "+v("list.itemCount",{count:q}))}catch(j){A(String(j&&j.message?j.message:j),"error")}},D=(k,j)=>R(v("msg.downloading",{name:k.name}),async()=>{P.reset();let q;try{q=await Cd({makeBody:U=>({...o,path:j,...U>0?{offset:U}:{}}),onProgress:(U,J)=>P.set(U,J),maxMb:sr.maxDownloadMb,registerCancel:U=>P.setCancel(U),onResume:U=>A(v("msg.downloadResuming",{name:k.name,offset:ct(U)||String(U)+" B"}),"busy")})}catch(U){if(di(U)){P.reset(),A(v("msg.downloadCanceled",{name:k.name}));return}throw P.fail(v("error.downloadFailed")),U}P.done(v("status.done")),xd(q,k.name),setTimeout(()=>P.reset(),1500),A(v("msg.downloaded",{name:k.name,size:ct(q.size)||String(q.size)+" B"}))}),N=(k,j,q,U,J)=>bd(k,Pi(W.path,j),{spec:o,label:(U>1?String(q)+"/"+String(U)+" ":"")+j,cancelRef:J,onProgress:(Z,se)=>{Number.isFinite(se)&&se>0?P.set(Z,se):P.pulse(Z)},onLabel:Z=>A(v("msg.uploadingName",{name:Z}),"busy"),onDone:()=>{U===1&&P.done(v("msg.uploadDone"))}}).catch(Z=>{throw di(Z)||P.fail(v("error.uploadFailed")),Z}),G=async k=>R(v("msg.uploading"),async()=>{let j=sr;if(j.maxUploadFiles>0&&k.length>j.maxUploadFiles){A(v("error.uploadCountExceeded",{max:j.maxUploadFiles,count:k.length}),"error"),P.fail(v("status.overLimit"));return}let q=j.maxUploadMb>0?j.maxUploadMb*1024*1024:0,U=k.find(fe=>q>0&&(fe.file?.size??0)>q);if(U!==void 0){A(v("error.uploadTooBig",{size:ct(q),name:String(U.relPath??"")}),"error"),P.fail(v("status.overLimit"));return}if(k._limitExceeded===!0){A(v("error.uploadTotalTooBig"),"error"),P.fail(v("status.overLimit"));return}let J=new Set;for(let fe of k){let te=fe.relPath.lastIndexOf("/");if(te<=0)continue;let qe=fe.relPath.slice(0,te);J.has(qe)||(J.add(qe),await O("mkdir",{path:Pi(W.path,qe),parents:!0}).catch(()=>{}))}P.reset();let Z={stopped:!1,abort:null};P.setCancel(()=>Z.abort?.());let se=0,he=0;try{for(let fe of k){if(Z.stopped)break;se+=1,Z.abort=null;try{await N(fe.file,fe.relPath,se,k.length,Z),he+=1}catch(te){if(di(te)||Z.stopped)break;throw te}}}finally{P.setCancel(null)}if(Z.stopped){P.reset(),A(v("msg.uploadCanceled",{done:he,total:k.length})),await T(W.path);return}P.done(v("status.allDone")),setTimeout(()=>P.reset(),1500),A(v("msg.uploadDoneCount",{count:k.length})),await T(W.path)});y.addEventListener("click",()=>{R(v("list.loading"),()=>T(W.path))}),_.addEventListener("click",()=>{W.busy||(p.placeholder=v("placeholder.newDirName"),p.value="",h.style.display="",p.focus(),b=async()=>{let k=p.value.trim();k!==""&&(x(),await R(v("msg.creatingDir",{name:k}),async()=>{await O("mkdir",{path:Pi(W.path,k)}),await T(W.path)}))})}),c.addEventListener("click",()=>{W.busy===!1&&f.click()}),f.addEventListener("change",()=>{let k=[...f.files??[]].map(j=>({relPath:j.name,file:j}));f.value="",k.length>0&&G(k)});let $=0,Y=k=>{k?w.dataset.drag="":delete w.dataset.drag};n.addEventListener("dragenter",k=>{k.preventDefault(),$+=1,Y(!0)}),n.addEventListener("dragover",k=>{k.preventDefault()}),n.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&Y(!1)}),n.addEventListener("drop",k=>{k.preventDefault(),$=0,Y(!1),!W.busy&&kd(k.dataTransfer).then(j=>{(j.length>0||j._limitExceeded===!0)&&G(j)})}),m.addEventListener("keydown",k=>{if(k.key!=="Enter"||(k.preventDefault(),W.busy))return;let j=m.value.trim();j!==""&&R(v("list.loading"),()=>T(j))});let H=la();vd(n,"SFTP \xB7 "+s,H===null?340:Math.round(H.height*.46),r),R(v("status.connectingEllipsis"),()=>T(""))}function mi(e){let t=e===void 0?md():e,r=ar,i=qt!==null&&qt.ownerKey===t?qt:null;if(r===null&&i===null)return;ig();let o=Uo;Uo=null,o?.(),ar=null,i!==null&&(qt=null),r!==null&&r.remove(),i!==null&&i.dispose()}function fa(e){if(ir===null)return;ir.style.display=ih(e);let t=ce!==null?ce.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&ir.focus()}function Ed(){ir!==null&&fa(sh(ir.style.display))}function ag(){return{matchBackground:Ae("--tt-term-search-match"),matchBorder:Ae("--tt-term-search-match-border"),activeMatchBackground:Ae("--tt-term-search-active"),activeMatchBorder:Ae("--tt-term-search-active-border"),matchOverviewRuler:Ae("--tt-term-search-match-border"),activeMatchColorOverviewRuler:Ae("--tt-term-search-active-border")}}function lg(e){let t=Pt();if(t===void 0||t.search===void 0)return;let r=ir.value;if(r==="")return;let i={decorations:ag()};e?t.search.findPrevious(r,i):t.search.findNext(r,i)}function vh(){Ki||ce===null&&!oa()||Rr!==null||(Rr=setTimeout(()=>{Rr=null,un()},Fi),Fi=Math.min(Fi*2,5e3))}function as(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Zo(e){return as(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function cg(){return wr==="tmux"?{t:"spawn",cwd:Wo(),persist:!0,persistName:da()}:{t:"spawn",cwd:Wo()}}async function Ld(){if(!Oo){Oo=!0;try{await hg()}finally{Oo=!1}}}var Oo=!1;async function hg(){if(await ua(),ce===null){await ug();return}let e=am(),t=om();if(![...ie.values()].some(n=>n.embedded!==!0)){if(e.length>0||t.length>0){Ne({t:"sessions"});let n=await an("sessions",4e3),a=new Map;if(n!==null&&Array.isArray(n.list))for(let l of n.list)l!==null&&typeof l=="object"&&l.attachable===!0&&a.set(l.sid,l);let u=new Set;for(let l of e){if(a.has(l.sid))_m(l);else if(Zo(l.spawnSpec))mh(l);else continue;as(l.spawnSpec)&&u.add(l.spawnSpec.persistName)}for(let l of t){let d=l.spawnSpec.persistName;u.has(d)||(mh(l),u.add(d))}Kt()}if(![...ie.values()].some(n=>n.embedded!==!0)){if(await dn())return;Yi()}return}let r=[...ie.values()].filter(n=>!n.exited&&(n.embedded!==!0||n.spawned===!0)),i=r.filter(n=>Zo(n.spawnSpec)),o=null;if(i.length>0){Ne({t:"sessions"});let n=await an("sessions",4e3),a=Eo(n!==null?n.list:[]);o=i.filter(u=>!a.has(u.sid));for(let u of o)Ji(u.sid)}let s=o!==null?new Set(o.map(n=>n.sid)):new Set;for(let n of r)s.has(n.sid)||Ne({t:"attach",sid:n.sid})}function dg(){Be!==null&&(Be.readyState===WebSocket.OPEN||Be.readyState===WebSocket.CONNECTING)||un()}async function ug(){let e=[...ie.values()].filter(i=>i.embedded===!0&&!i.exited);if(e.length===0)return;Ne({t:"sessions"});let t=await an("sessions",4e3),r=Eo(t!==null?t.list:[]);for(let i of e)i.spawned===!0&&(r.has(i.sid)?Ne({t:"attach",sid:i.sid}):Zo(i.spawnSpec)?Yh(i):(i.exited=!0,i.live=!1,ei(i,v("status.ended"),v("btn.clickRerun"),"exited")))}function un(){if(Be!==null){try{Be.close()}catch{}Be=null}Ki=!1,clearTimeout(Rr),Rr=null,Us=!0,$s(v("status.connectingEllipsis"),"");try{Be=new WebSocket(D_())}catch(e){Us=!1,$s(v("error.connectFailed",{error:e.message}),"error"),vh();return}Be.onopen=()=>{Us=!1,Fi=1e3,At=null,$s(v("status.connected"),"connected");for(let e of[...Io])Io.delete(e),ie.has(e.tab.sid)&&Ne(e.frame);Ld()},Be.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=t.sid;if(t.t==="ready"){let i=typeof t.target=="string"?t.target:"";Do(r,t.kind==="ssh"?v("status.connectedSsh",{target:i!==""?i+" ":""}):v("status.connectedPid",{pid:t.pid}),"connected");let o=ie.get(r);if(o!==void 0){if(o.exited=!1,o.spawned=!0,o.live=!0,o.errored=!1,o.target=i,o.persistTmux=t.persist===!0,t.kind==="ssh"&&i!==""&&!o.label&&(o.label=i,ut()),Dr(),Po(r),ei(o,""),vi(o),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(n=>setTimeout(n,500))]).then(()=>jh(150))}gi(),em(r),xr(o.spawnSpec)&&Ne({t:"hidden",sid:r,hidden:!0}),Kt()}}else if(t.t==="hidden"){let i=ie.get(r);if(i!==void 0&&i.embedded!==!0){let o=t.hidden===!0;xr(i.spawnSpec)!==o&&(i.spawnSpec=To(i.spawnSpec,o),Kt(),ut(),pi())}}else if(t.t==="sessions")fm(t.list);else if(t.t==="data"){let i=ie.get(r);i!==void 0&&i.term!==null&&(i.term.write(String(t.d??"")),mg())}else if(t.t==="exit"){let i=ie.get(r);if(i!==void 0){i.exited=!0,i.live=!1,i.stats=null,r===xe&&Nr();let o=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";i.exitDetail=[o,s].filter(Boolean).join(" "),Do(r,v("status.exitedWith",{detail:i.exitDetail}),""),Dr(),Po(r),ei(i,""),ns(),pi(),gi(),Sn(),Kt()}}else if(t.t==="stats")try{let i=ie.get(r);if(i!==void 0){let o=t.stats;i.stats=lh(o)?o:null,i.statsAt=Date.now(),r===xe&&Nr()}}catch(i){console.warn("[dsh-tty] stats \u5E27\u5904\u7406\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: "+(i instanceof Error?i.message:String(i)))}else if(t.t==="hint"){if(!rn||t.kind!=="failure"||typeof r!="string"||r==="")return;yr.set(r,{exitCode:typeof t.exitCode=="number"?t.exitCode:null,at:typeof t.at=="number"?t.at:Date.now(),dismissed:!1,busy:!1,answer:null,command:"",error:null}),r===xe&&Fr()}else if(t.t==="error")if(Do(r,v("status.error",{message:String(t.m??"")}),"error"),typeof r=="string"){let i=ie.get(r);i!==void 0&&(i.live||(i.errored=!0),Dr(),Po(r),ei(i,v("status.errored"),v("status.retryHint",{message:String(t.m??"")}),"error"))}else fg(v("btn.clickRetry"))},Be.onclose=()=>{if(Us=!1,!Ki){$s(v("status.disconnectedReconnecting"),"error");for(let e of ie.values())e.exited||ei(e,v("status.disconnected"),v("status.reconnecting"),"info");vh()}},Be.onerror=()=>{}}function fg(e){si!==null&&(si.textContent=e)}function Qo(){(ce===null||Xe)&&ea()}var Ks="DSH_TTY_ALLOW_PROXY_COMMAND";function pg(e){let t=new Date(Number(e)*1e3);if(Number.isNaN(t.getTime()))return String(e);let r=i=>String(i).padStart(2,"0");return`${String(t.getFullYear())}-${r(t.getMonth()+1)}-${r(t.getDate())} ${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`}function Td(){return typeof navigator<"u"&&navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText=="function"}async function bh(e){if(Td())try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let r=!1;try{r=document.execCommand("copy")}catch{r=!1}return t.remove(),r||gn(v("error.copyFailed"),"error"),r}function ea(){if(ce!==null){Xe&&pa();return}es(),ce=document.createElement("div"),ce.className="tt_modalBackdrop",ce.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+pn+'</span><div class="tt_tabbar"><div class="tt_tabs"></div><button type="button" class="tt_tabMore" hidden></button><button type="button" class="tt_tabAdd"></button></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">'+v("status.initializing")+'</span></div><input class="tt_searchInput" style="display:'+Mo+'" placeholder="'+v("placeholder.search")+'" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="'+v("btn.searchTitle")+'">'+I_+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="'+v("btn.clearTitle")+'">'+Th+'</button></span><span class="tt_winGroup"><button class="tt_min" title="'+v("btn.minimizeTitle")+'">'+F_+'</button><button class="tt_close" title="'+v("btn.closePanelTitle")+'">'+_n+'</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_work"><div class="tt_body"><div class="tt_statsBar" hidden></div><div class="tt_exitBar" hidden></div><button type="button" class="tt_assistBadge" hidden><span class="tt_assistDot"></span><span class="tt_assistBadgeText"></span></button><div class="tt_overlay"></div></div></div></div>',document.body.appendChild(ce),Zs=ce.querySelector(".tt_status"),Mr=ce.querySelector(".tt_statusText"),Br=ce.querySelector(".tt_statusDot"),Te=ce.querySelector(".tt_tabs");let e=ce.querySelector(".tt_tabAdd");e!==null&&(e.title=v("btn.newTab"),e.innerHTML=z_,e.addEventListener("click",()=>{Om(e)})),zt=ce.querySelector(".tt_tabMore"),zt!==null&&(zt.innerHTML=Rh,zt.title=v("btn.tabList"),zt.addEventListener("click",()=>{Im(zt)})),Te.addEventListener("scroll",pi),Te.addEventListener("wheel",Lm,{passive:!1}),Te.addEventListener("contextmenu",Wm),Te.addEventListener("auxclick",jm),Oi=ce.querySelector(".tt_connbar"),Ii=ce.querySelector(".tt_connDot"),Qs=ce.querySelector(".tt_connTarget"),Ct=ce.querySelector(".tt_connBadge"),Ni=ce.querySelector(".tt_connActions"),kt=ce.querySelector(".tt_work"),it=ce.querySelector(".tt_body"),Rt=ce.querySelector(".tt_statsBar"),$t=ce.querySelector(".tt_exitBar"),Vi="",vn(),At=null,Hh(),si=ce.querySelector(".tt_body > .tt_overlay"),gr=ce.querySelector(".tt_assistBadge"),gr!==null&&gr.addEventListener("click",()=>{gr!==null&&Jm(gr)}),Bt(),Fr(),ir=ce.querySelector(".tt_searchInput"),si.addEventListener("click",()=>{si.textContent="",un()}),ce.querySelector("[data-act=search]").addEventListener("click",()=>{Ed()}),ir.addEventListener("keydown",r=>{r.key==="Enter"?(r.preventDefault(),lg(r.shiftKey)):r.key==="Escape"&&(r.stopPropagation(),fa(!1))}),ce.querySelector("[data-act=clear]").addEventListener("click",()=>{let r=Pt();r!==void 0&&r.term!==null&&r.term.clear()}),ce.querySelector(".tt_min").addEventListener("click",()=>{Zi()}),ce.querySelector(".tt_close").addEventListener("click",()=>{Md()}),ce.addEventListener("mousedown",r=>{ai===null&&r.target===ce&&Zi()}),document.addEventListener("keydown",Ad),Hi=new ResizeObserver(()=>{Xe||(Gs(),cm(Pt()),pi())}),Hi.observe(it),ut(),Dr(),Be!==null&&Be.readyState===WebSocket.OPEN?Ld():un()}function Sn(){if(Gi===null)return;let e=[...ie.values()].filter(t=>!t.exited).length;Gi.textContent=ie.size>0?"\xB7 "+e+"/"+ie.size:""}function _g(){rt=document.createElement("div"),rt.className="tt_dock",rt.title=v("btn.restoreDock"),rt.innerHTML='<span class="tt_dockTitle">'+pn+"<span>"+v("panel.title")+'</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="'+v("btn.closePanelTitle")+'">'+ts+"</button>",Gi=rt.querySelector(".tt_dockCount"),fi=rt.querySelector(".tt_dockStatus"),Or=rt.querySelector(".tt_dockDot"),Sn(),Mr!==null&&(fi.textContent=Mr.textContent),Br!==null&&(Or.dataset.state=Br.dataset.state??""),rt.addEventListener("click",e=>{if(e.target.closest(".tt_dockClose")!==null){e.stopPropagation(),Md();return}pa()}),document.body.appendChild(rt)}function Zi(){ce===null||Xe||(xt(),Lt(),Bt(),vr(),Xe=!0,ar!==null&&(ar.style.display="none"),fa(!1),ce.dataset.minimized="",Fh(),ss(),Nr(),document.querySelector("[data-dsh-tty-entry]")!==null?gi():(_g(),rt.classList.add("tt_dockCompact")))}function gi(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Xe){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=v("status.minimized");let r=[...ie.values()].filter(o=>!o.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=r+"/"+ie.size;let i=t.querySelector(".tt_sidebarBadgeDot");i!==null&&Br!==null&&(i.dataset.state=Br.dataset.state??"")}function mg(){if(!Xe)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Or;e!==null&&(e.dataset.active="",clearTimeout(en),en=setTimeout(()=>{delete e.dataset.active},900))}function pa(){if(ce===null||!Xe)return;Xe=!1,delete ce.dataset.minimized,ar!==null&&(ar.style.display=""),clearTimeout(en),rt!==null&&(rt.remove(),rt=null),Gi=null,fi=null,Or=null,gi(),Hh(),ss(),Nr(),ns();let e=Pt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&vi(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Md(){let e=qc(ie.values());if(!e.confirm){Qi();return}Xe&&pa(),gg(e)}function kr(){if(ai===null)return;ai.remove(),ai=null;let e=No;if(No=null,e!==null&&typeof e.focus=="function")try{e.focus()}catch{}}function Rd(e){if(ce===null)return;kr();let t=ce.querySelector(".tt_modal");if(t===null)return;let r=document.createElement("div");r.className="tt_confirmLayer",r.innerHTML='<div class="tt_confirmCard" role="dialog" aria-modal="true"><div class="tt_confirmTitle"></div><div class="tt_confirmText"></div><div class="tt_confirmHint"></div><div class="tt_confirmActions"><button type="button" class="tt_toolBtn tt_confirmCancel"></button>'+(e.minimize===!0?'<button type="button" class="tt_toolBtn tt_confirmMin"></button>':"")+'<button type="button" class="tt_toolBtn tt_btnDanger tt_confirmOk"></button></div></div>',r.querySelector(".tt_confirmTitle").textContent=e.title,r.querySelector(".tt_confirmText").textContent=e.text,r.querySelector(".tt_confirmHint").textContent=e.hint;let i=r.querySelector(".tt_confirmCancel");if(i.textContent=v("btn.cancel"),i.addEventListener("click",()=>kr()),e.minimize===!0){let s=r.querySelector(".tt_confirmMin");s.textContent=v("btn.minimize"),s.addEventListener("click",()=>{kr(),Zi()})}let o=r.querySelector(".tt_confirmOk");o.textContent=e.okLabel,o.addEventListener("click",()=>{kr(),e.onOk()}),r.addEventListener("mousedown",s=>{s.target===r&&kr()}),No=document.activeElement instanceof HTMLElement?document.activeElement:null,t.appendChild(r),ai=r;try{i.focus()}catch{}}function gg(e){Rd({title:v("confirm.closeTitle",{n:String(e.live)}),text:e.agentLive>0?v("confirm.closeTextAgent",{n:String(e.live),agent:String(e.agentLive)}):v("confirm.closeText",{n:String(e.live)}),hint:v("confirm.closeHint"),okLabel:v("confirm.closeOk",{n:String(e.live)}),onOk:Qi,minimize:!0})}function Qi(){if(ce===null)return;kr(),zi(!0);let e=oa();if(Ki=!e,Xe=!1,xt(),Lt(),or(),Bt(),Vs(),cn(),vr(),mi(),clearTimeout(en),clearTimeout(Rr),Rr=null,Fi=1e3,rt!==null&&(rt.remove(),rt=null),Gi=null,fi=null,Or=null,gi(),Be!==null){for(let t of ie.values())!t.exited&&t.embedded!==!0&&Ne({t:"kill",sid:t.sid});if(!e){try{Be.close()}catch{}Be=null}}Hi!==null&&(Hi.disconnect(),Hi=null);for(let[t,r]of[...ie])if(r.embedded!==!0){if(r.term!==null)try{r.term.dispose()}catch{}ie.delete(t)}xe=null,qi=null,document.removeEventListener("keydown",Ad),ce.remove(),ce=null,kt=null,Zs=null,Mr=null,Br=null,Te=null,zt=null,Oi=null,Ii=null,Qs=null,Ct=null,Ni=null,cn(),Fh(),Rt=null,vn(),At=null,$t=null,Vi="",it=null,si=null,ir=null,is=0;try{sessionStorage.removeItem(tn)}catch{}}function Ad(e){if(e.key==="Escape"&&ce!==null){if(e.preventDefault(),ai!==null){kr();return}if(ar!==null){mi();return}if(oi!==null){vr();return}if(Et!==null){xt();return}Zi()}}function vg(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function bg(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let r of e.children)if(r.tagName==="BUTTON")return r}function wg(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label",v("panel.title")),e.tabIndex=0,e.innerHTML='<span class="tt_sidebarEntryIcon">'+pn+'</span><span class="tt_sidebarEntryLabel">'+v("panel.title")+"</span>",e.addEventListener("click",t=>{t.preventDefault(),ea()}),e.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" "||t.key==="Spacebar")&&(t.preventDefault(),ea())}),e}function wh(e,t){let r=bg(e);if(r===void 0)return!1;if(t.parentElement!==e){let i=r.closest('[class*="logoRow"]'),o=i!==null&&i.parentElement===e?i:r,s=Array.from(e.children).filter(n=>n instanceof HTMLElement&&n.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(s.length>0){let n=s[s.length-1];e.insertBefore(t,n.nextSibling)}else e.insertBefore(t,o.nextElementSibling)}return!0}function yg(){if(es(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=wg(),t,r=!1,i=()=>{if(t!==void 0&&!t.isConnected&&(s.disconnect(),t=void 0,r=!1),r){if(document.body.contains(e))return;s.disconnect(),t=void 0,r=!1}t??(t=vg()),t!==void 0&&(r=wh(t,e),r&&s.observe(t,{childList:!0,subtree:!0}))},o=new MutationObserver(()=>{i()});o.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){r=!1,i();return}t.contains(e)||(r=wh(t,e))});return i(),()=>{o.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},r=e("react"),{jsx:i,jsxs:o}=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 n(u){let l=u&&u.view,d=l==="page",[m,y]=r.useState(d),[_,c]=r.useState(null),[f,h]=r.useState(!1),[p,g]=r.useState(!1),[S,b]=r.useState({kind:"",text:""}),[x,w]=r.useState(null),[E,B]=r.useState(""),[P,W]=r.useState(!1),[A,V]=r.useState(Date.now()),O=r.useRef(null),R=r.useRef(null),[F,I]=r.useState([]),[C,L]=r.useState(!1),[T,D]=r.useState({groups:[],loading:!1,failed:!1}),[N,G]=r.useState(!1),$=r.useRef(null),Y=r.useRef(null),H=r.useRef(0),k=M=>i("div",{className:"tt_cardSection",children:M}),j=async()=>{try{let z=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();z.ok&&typeof z.config=="object"&&z.config!==null?(O.current=z.config,R.current=JSON.stringify(he(z.config)),c(z.config),Xi(z.config)):b({kind:"error",text:String(z.error||v("error.configLoadFailed"))})}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},q=async()=>{try{let z=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();z.ok&&Array.isArray(z.shells)&&I(z.shells)}catch{}},U=(M,z)=>{let K=M.current,X=K===null||K.parentElement===null?null:K.parentElement.querySelector(z);K===null||X===null||(X.style.width=String(Math.round(K.getBoundingClientRect().width))+"px",os(X,K))};r.useLayoutEffect(()=>{if(!N&&!C)return;let M=()=>{N&&U($,".tt_routeList"),C&&U(Y,".tt_shellList")};return M(),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[N,C,T.loading,T.failed,T.groups,F,_?.shell]);let J=async()=>{let M=H.current+1;H.current=M,D(z=>({...z,loading:!0}));try{let K=await(await fetch("/api/dsh-tty/model-catalog",{cache:"no-store"})).json();if(K.ok===!0&&M===H.current){D({groups:Array.isArray(K.groups)?K.groups:[],loading:!1,failed:!1});return}}catch{}M===H.current&&D({groups:[],loading:!1,failed:!0})};r.useEffect(()=>{m&&!f&&(h(!0),j(),q(),J())},[m]);let Z=(M,z)=>c(K=>{let X={...K||{},[M]:z};return O.current=X,X}),se=new Set(["toolsRegistered","platform","allowProxyCommandGranted","allowProxyCommandGrantSource","allowProxyCommandGrantedAt"]),he=M=>{let z={};for(let[K,X]of Object.entries(M||{}))se.has(K)||X!==void 0&&(z[K]=X);return z.sshHosts=Array.isArray(M?.sshHosts)?M.sshHosts:[],z.tunnels=Array.isArray(M?.tunnels)?M.tunnels:[],M?.sftpLimits&&typeof M.sftpLimits=="object"&&(z.sftpLimits={maxDownloadMb:Number(M.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(M.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(M.sftpLimits.maxUploadFiles)||0}),z};O.current=_;let fe=(M,z)=>c(K=>({...K||{},sftpLimits:{...K?.sftpLimits??{},[M]:z}})),[te,qe]=r.useState(null),[le,Me]=r.useState(null),[st,He]=r.useState(""),[ee,ne]=r.useState(null),[ge,be]=r.useState(""),[je,Oe]=r.useState(""),[ze,Re]=r.useState(""),We=r.useRef(null),[we,_t]=r.useState(!1),[Ze,nt]=r.useState({text:"",kind:""}),[ls,Q]=r.useState(!1),[oe,de]=r.useState({running:!1,ok:!1,text:""}),[ae,pe]=r.useState({}),[ue,Ce]=r.useState([]),[ve,ye]=r.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""}),[Ee,Le]=r.useState(null);r.useEffect(()=>{if(!m)return;let M=!0,z=async()=>{try{let re=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();M&&re.ok&&Array.isArray(re.tunnels)&&Ce(re.tunnels)}catch{}};z();let K=setInterval(z,2e3);return()=>{M=!1,clearInterval(K)}},[m]);let Se=M=>z=>ye(K=>({...K||{},[M]:z.target.value})),De=(M,z)=>ye(K=>({...K||{},[M]:z})),Qe=M=>M?.direction==="remote"?v("meta.tunnelRemote",{host:M.remoteHost||"127.0.0.1",port:String(M.remotePort??0),local:String(M.localTargetPort??0)}):v("meta.tunnelLocal",{local:String(M?.localPort??0),host:M?.remoteHost??"?",port:String(M?.remotePort??0)}),ht=(_?.sshHosts??[]).find(M=>M?.name===ve?.bookName),cr=async M=>{try{let z=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:M})}),K=await z.json().catch(()=>({}));return!z.ok||!K.ok?(b({kind:"error",text:String(K.error||v("error.saveTunnelFailed"))}),{ok:!1,warnings:[]}):{ok:!0,warnings:Array.isArray(K.warnings)?K.warnings.map(re=>String(re)).filter(re=>re!==""):[]}}catch(z){return b({kind:"error",text:String(z&&z.message?z.message:z)}),{ok:!1,warnings:[]}}},_a=(M,z)=>{if(M.warnings.length>0){b({kind:"warn",text:M.warnings.join(" ")});return}b({kind:"ok",text:z})},ma=()=>Ic(ve,(Array.isArray(_?.sshHosts)?_.sshHosts:[]).map(M=>M?.name),v),Dd=M=>{b({kind:"",text:""}),Le(String(M?.name??"")),ye({direction:M?.direction==="remote"?"remote":"local",bookName:String(M?.bookName??""),localPort:M?.localPort?String(M.localPort):"",remoteHost:String(M?.remoteHost??""),remotePort:M?.remotePort?String(M.remotePort):"",localTargetPort:M?.localTargetPort?String(M.localTargetPort):""})},Pd=()=>{Le(null),b({kind:"",text:""}),ye(M=>({...M||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))},Bd=()=>{b({kind:"",text:""});let M=ma();if(!M.ok){b({kind:"error",text:M.error});return}let z=M.tunnel,K=Array.isArray(_?.tunnels)?_.tunnels:[];if(Nc(K,z.name)!==void 0){b({kind:"error",text:v("error.tunnelNameTaken",{name:z.name})});return}let X=[...K,z];c(re=>({...re||{},tunnels:X})),ye(re=>({...re||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),cr(X).then(re=>{re.ok&&_a(re,v("msg.tunnelApplied",{name:z.name}))})},Od=()=>{if(Ee===null)return;b({kind:"",text:""});let M=ma();if(!M.ok){b({kind:"error",text:M.error});return}let z=Array.isArray(_?.tunnels)?_.tunnels:[],K=Hc(z,Ee,M.tunnel,v);if(!K.ok){K.reason==="missing"&&Le(null),b({kind:"error",text:K.error});return}let X=K.tunnels;c(re=>({...re||{},tunnels:X})),cr(X).then(re=>{if(re.ok!==!0){c(_e=>({..._e||{},tunnels:z}));return}Le(null),ye(_e=>({..._e||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),_a(re,v("msg.tunnelUpdated",{name:M.tunnel.name}))})},ga=(M,z)=>{c(K=>({...K||{},tunnels:M})),cr(M).then(K=>{if(K.ok!==!0){c(X=>({...X||{},tunnels:z}));return}K.warnings.length>0&&b({kind:"warn",text:K.warnings.join(" ")})})},Id=M=>{let z=Array.isArray(_?.tunnels)?_.tunnels:[];Ee!==null&&String(M??"")===Ee&&(Le(null),ye(K=>({...K||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))),ga(z.filter(K=>K?.name!==M),z)},Nd=(M,z)=>{let K=Array.isArray(_?.tunnels)?_.tunnels:[];ga(K.map(X=>X?.name===M?{...X,enabled:z}:X),K)},Hd=M=>{qe(M?.name??null),He(""),de({running:!1,ok:!1,text:""}),be(""),Oe(""),xn(),_t(Ut!==null),Me({name:M?.name??"",host:M?.host??"",port:String(M?.port??22),username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:M?.hostKeyAlias??"",persist:M?.persist!==!1}),xh().then(z=>ne(z)),kn(M?.password??"")},va=()=>{qe(null),Me(null),He(""),de({running:!1,ok:!1,text:""}),be(""),Oe(""),xn()},Fd=async()=>{if(le===null)return;let M=le.name.trim(),z=le.host.trim(),K=le.username.trim();if(M===""||z===""||K===""){He(v("error.nameHostUserRequired"));return}let X=Number(le.port);if((!Number.isInteger(X)||X<1||X>65535)&&(X=22),(_?.sshHosts??[]).some(_e=>_e?.name===M&&M!==te)){He(v("error.bookNameTaken",{name:M}));return}if(le.auth==="key"&&le.keyPath.trim()===""){He(v("error.keyPathRequired"));return}He("");let re=le.password;if(le.auth==="password"){let _e=await Lh(we,le.password,z,X,K,"PASSWORD");if(_e.error!==void 0){He(_e.error);return}_e.value!==void 0&&(re=_e.value)}c(_e=>({..._e||{},sshHosts:(Array.isArray(_e?.sshHosts)?_e.sshHosts:[]).map(ke=>ke?.name===te?{name:M,host:z,port:X,username:K,auth:le.auth,keyPath:le.keyPath.trim(),passphrase:le.passphrase,password:re,agentForward:le.agentForward,hostKeyAlias:String(le.hostKeyAlias??"").trim(),persist:le.persist===!0}:ke)})),pe(_e=>{let ke={..._e};return delete ke[M],te!==M&&delete ke[te],ke}),qe(null),Me(null),de({running:!1,ok:!1,text:""}),b({kind:"ok",text:v("msg.hostEdited",{name:M})})},Wd=M=>{te===M&&va(),pe(z=>{let K={...z};return delete K[M],K}),c(z=>({...z||{},sshHosts:(Array.isArray(z?.sshHosts)?z.sshHosts:[]).filter(K=>K?.name!==M)}))},jd=async M=>{let z=M?.name??"";if(z==="")return;let K={host:M?.host??"",port:Number(M?.port)||22,username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:typeof M?.hostKeyAlias=="string"?M.hostKeyAlias:""};pe(re=>({...re,[z]:{running:!0,text:v("msg.probing")}}));let X=await qo(K,!0);pe(re=>{let _e=re[z]||{};if(X.result){let ke=X.result.auth?.ok===!0;return{...re,[z]:{running:!1,ok:ke,text:Ko(X.result)}}}return{...re,[z]:{running:!1,ok:!1,text:v("error.probeFailed",{detail:String(X.error||v("error.unknown"))})}}})},zd=async M=>{let z=(Array.isArray(_?.hostKeys)?_.hostKeys:[]).filter(K=>!(K?.host===M?.host&&Number(K?.port)===Number(M?.port)));c(K=>({...K||{},hostKeys:z}));try{let K=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:z})}),X=await K.json().catch(()=>({}));!K.ok||!X.ok?b({kind:"error",text:String(X.error||v("error.hostKeyDeleteFailed"))}):b({kind:"ok",text:v("msg.hostKeyDeleted")})}catch(K){b({kind:"error",text:String(K&&K.message?K.message:K)})}},Ud=async()=>{b({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!z.ok){b({kind:"error",text:String(z.error||v("error.sshConfigReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],X=[...Array.isArray(_?.sshHosts)?_.sshHosts:[]],re=new Set(X.map(Fe=>Fe?.name)),_e=0,ke=0;for(let Fe of K)if(!(Fe===null||typeof Fe!="object"||typeof Fe.name!="string")){if(re.has(Fe.name)){ke+=1;continue}re.add(Fe.name),X.push({name:Fe.name,host:String(Fe.host??Fe.name),port:Number(Fe.port)||22,username:String(Fe.username??""),auth:Fe.auth==="key"?"key":"agent",keyPath:String(Fe.keyPath??""),passphrase:"",password:"",agentForward:!1,hostKeyAlias:typeof Fe.hostKeyAlias=="string"?Fe.hostKeyAlias:""}),_e+=1}c(Fe=>({...Fe||{},sshHosts:X}));let me=Array.isArray(z.proxy)?z.proxy.filter(Fe=>typeof Fe=="string"):[],ot=Number.isInteger(z.proxyCount)?z.proxyCount:me.length,Sr=Array.isArray(z.proxyCommand)?z.proxyCommand.filter(Fe=>typeof Fe=="string"):[],dt=Number.isInteger(z.proxyCommandCount)?z.proxyCommandCount:Sr.length,jr=Number.isInteger(z.skippedOther)?z.skippedOther:0,hr=Number.isInteger(z.droppedOverflow)?z.droppedOverflow:0,Tt=[];ot>0&&Tt.push(v("msg.proxySkipped",{count:ot,names:me.slice(0,5).join(v("list.separator"))+(ot>5?v("meta.etc"):"")})),dt>0&&Tt.push(v("msg.proxyCommandSkipped",{count:dt,names:Sr.slice(0,5).join(v("list.separator"))+(dt>5?v("meta.etc"):"")})),jr>0&&Tt.push(v("msg.skippedNotConcrete",{count:jr})),hr>0&&Tt.push(v("msg.importOverflow",{count:hr}));let Ea=Tt.length>0?v("list.separatorFull")+Tt.join(v("list.separatorFull")):"";if(_e===0){let Fe=ke>0?v("msg.noNewEntries",{count:ke}):v("msg.noImportableHosts");b({kind:Tt.length>0?"error":"ok",text:Fe+Ea})}else b({kind:Tt.length>0?"error":"ok",text:v("msg.importedHosts",{added:_e,skipped:ke})+Ea})}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},ba=M=>M===null||typeof M!="object"?[]:Array.isArray(M.fingerprints)?M.fingerprints.filter(z=>typeof z=="string"&&z!==""):typeof M.fingerprint=="string"&&M.fingerprint!==""?[M.fingerprint]:[],$d=async()=>{b({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!z.ok){b({kind:"error",text:String(z.error||v("error.knownHostsReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],X=[...Array.isArray(_?.hostKeys)?_.hostKeys:[]],re=new Map;for(let me of X)me===null||typeof me!="object"||re.set(String(me.host??"")+":"+String(me.port??22),{record:me,fps:new Set(ba(me))});let _e=0,ke=0;for(let me of K){if(me===null||typeof me!="object"||typeof me.host!="string")continue;let ot=Array.isArray(me.fingerprints)?me.fingerprints.filter(hr=>typeof hr=="string"&&hr!==""):[];if(typeof me.fingerprint=="string"&&me.fingerprint!==""&&ot.push(me.fingerprint),ot.length===0)continue;let Sr=me.host+":"+String(me.port??22),dt=re.get(Sr);if(dt!==void 0){let hr=!1;for(let Tt of ot)dt.fps.has(Tt)||dt.fps.size>=8||(dt.fps.add(Tt),hr=!0);if(!hr){ke+=1;continue}delete dt.record.fingerprint,dt.record.fingerprints=[...dt.fps],_e+=1;continue}let jr={host:me.host,port:Number(me.port)||22,fingerprints:[...new Set(ot)].slice(0,8)};re.set(Sr,{record:jr,fps:new Set(jr.fingerprints)}),X.push(jr),_e+=1}if(_e===0){b({kind:"ok",text:ke>0?v("msg.noNewFingerprints",{count:ke}):v("msg.noImportableKnownHosts")});return}c(me=>({...me||{},hostKeys:X}));try{let me=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:X})}),ot=await me.json().catch(()=>({}));if(!me.ok||!ot.ok){b({kind:"error",text:String(ot.error||v("error.saveHostKeysFailed"))});return}b({kind:"ok",text:v("msg.importedFingerprints",{added:_e,skipped:ke})+(z.truncated===!0?v("hint.knownHostsTruncated"):"")})}catch(me){b({kind:"error",text:String(me&&me.message?me.message:me)})}}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},wa=async M=>{let z=M??O.current??_;g(!0),b({kind:"",text:""});let K=he(z);try{let X=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(K)}),re=await X.json();!X.ok||!re.ok?b({kind:"error",text:String(re.error||v("error.saveFailed"))}):(b({kind:"ok",text:v("msg.saved")}),R.current=JSON.stringify(K),re.config&&(O.current=re.config,c(re.config),Xi(re.config)))}catch(X){b({kind:"error",text:String(X&&X.message?X.message:X)})}g(!1)},Cn=M=>"/api/dsh-tty/elevate"+M,ya=async()=>{try{let z=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json(),K=z&&typeof z.config=="object"&&z.config!==null?z.config:null;if(K===null)return;c(X=>{if(X===null)return X;let re={...X,allowProxyCommandGranted:K.allowProxyCommandGranted===!0,allowProxyCommandGrantSource:K.allowProxyCommandGrantSource??null,allowProxyCommandGrantedAt:Number.isFinite(K.allowProxyCommandGrantedAt)?K.allowProxyCommandGrantedAt:null};return O.current=re,re})}catch{}},Sa=async()=>{w(null),W(!1);let M=O.current||{},z=R.current!==null&&JSON.stringify(he(M))===R.current,K={...M,allowProxyCommand:!0};O.current=K,c(K),await ya(),z?(await wa(K),B(v("elev.granted"))):B(v("elev.grantedNeedSave"))},Ca=async()=>{W(!1),B(""),w({phase:"loading"});try{let M=await fetch(Cn(""),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}),z=await M.json().catch(()=>({}));if(!M.ok){w({phase:"error",error:String(z.error||M.status)});return}if(z.status==="granted"){await Sa();return}w({phase:"pending",command:String(z.command??""),expiresAt:Number(z.expiresAt)||0})}catch(M){w({phase:"error",error:String(M&&M.message?M.message:M)})}},qd=async()=>{B("");try{let M=await fetch(Cn("/revoke"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}),z=await M.json().catch(()=>({}));if(!M.ok){B(v("elev.error")+String(z.error||M.status));return}await ya(),B(v("elev.revoked"))}catch(M){B(v("elev.error")+String(M&&M.message?M.message:M))}},Kd=async()=>{let M=x===null?"":String(x.command??"");if(M!==""){if(Td())try{await navigator.clipboard.writeText(M),W(!0);return}catch{}W(!1),B(v("elev.copyManual"))}};r.useEffect(()=>{if(x===null||x.phase!=="pending")return;let M=setInterval(()=>V(Date.now()),1e3),z=setInterval(()=>{fetch(Cn("/status"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}).then(K=>K.json()).then(K=>{K.status==="granted"&&Sa()}).catch(()=>{})},1500);return()=>{clearInterval(M),clearInterval(z)}},[x]);let Gd=()=>{if(_.allowProxyCommandGrantSource==="env")return i("span",{className:"tt_cardHint",children:v("elev.viaEnv")});let M=_.allowProxyCommandGrantedAt;return o("span",{className:"tt_capState",children:[Number.isFinite(M)?i("span",{children:v("elev.grantedAt",{time:pg(M)})}):null,i("button",{type:"button",className:"tt_toolBtn tt_capRevoke",onClick:()=>{qd()},children:v("elev.revoke")})]})},Vd=()=>{let M=String(x.command??""),z=x.expiresAt>0?Math.max(0,Math.ceil((x.expiresAt-A)/1e3)):0,K=x.phase==="pending"&&x.expiresAt>0&&z===0,X=()=>{w(null),W(!1)};return o("div",{className:"tt_elevPanel",children:[o("div",{className:"tt_elevHead",children:[i("span",{className:"tt_cardLabel",children:v("elev.title")}),i("button",{type:"button",className:"tt_toolBtn",onClick:X,children:v("elev.close")})]}),i("span",{className:"tt_cardHint",children:v("elev.lockedWhy")}),x.phase==="error"?i("span",{className:"tt_cardHint tt_sshProbeWarn",children:v("elev.error")+String(x.error??"")}):null,x.phase==="loading"?i("span",{className:"tt_cardHint",children:v("elev.loading")}):null,M===""?null:o("div",{className:"tt_elevSteps",children:[i("span",{className:"tt_cardHint",children:v("elev.step")}),i("div",{className:"tt_elevCommand",children:i("code",{children:M})}),o("div",{className:"tt_elevActions",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Kd()},children:v(P?"elev.copied":"elev.copy")}),K?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Ca()},children:v("elev.regenerate")}):i("span",{className:"tt_cardHint",children:v("elev.expiresIn",{sec:z})})]}),i("span",{className:"tt_cardHint",children:v(K?"elev.expired":"elev.waiting")})]}),_.allowProxyCommand===!0&&_.allowProxyCommandGranted!==!0?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Z("allowProxyCommand",!1),X()},children:v("elev.disableFirst")}):null,i("span",{className:"tt_cardHint",children:v("elev.otherWay")}),i("span",{className:"tt_cardHint",children:v("elev.envHow",{env:Ks})})]})},Yd=()=>{let M=_.allowProxyCommandGranted===!0,z=_.allowProxyCommand===!0;return o("div",{className:"tt_capBlock",children:[o("label",{className:"tt_cardField tt_cardRow tt_cardToggle tt_cardDanger",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z,onChange:K=>{if(!M){Ca();return}Z("allowProxyCommand",K.target.checked)}}),i("span",{className:"tt_cardLabel",children:v("check.allowProxyCommand")}),z&&!M?i("span",{className:"tt_badgeWarn",children:v("badge.notEffective")}):null]}),i("span",{className:"tt_cardHint",children:v("hint.allowProxyCommand")}),M?Gd():i("span",{className:"tt_cardHint tt_sshProbeWarn",children:v("hint.proxyCommandNotGranted")}),E===""?null:i("span",{className:"tt_cardHint",children:E}),x===null?null:Vd()]})},xn=()=>{We.current!==null&&(clearTimeout(We.current),We.current=null),Re("")},kn=async M=>{let z=ii(M);if(ui()===null){_t(!1),Q(!1),nt({text:v(Ut===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),kind:"muted"});return}if(z===""){Q(!1),nt({text:"",kind:""});return}let K=await kh(z);if(K.unreported===!0){Q(!1),nt({text:v("status.credUnreported",{ref:z}),kind:"plain"});return}if(K.error!==void 0){Q(!1),nt({text:v("error.credStatusFailed",{error:K.error}),kind:"error"});return}let X=K.view;nt({text:X.configured?v("status.credStored",{ref:z,source:X.source!==""?v("meta.credSource",{source:X.source}):""}):v("status.credUnknown",{ref:z}),kind:X.configured?"ok":"plain"}),Q(X.configured===!0&&X.writable===!0)},Jd=async()=>{let M=ii(le?.password??"");if(M==="")return;let z=await Eh(M);if(z.error!==void 0){nt({text:z.error,kind:"error"});return}Me(K=>({...K||{},password:""})),nt({text:"",kind:""}),Q(!1)},Xd=(M,z)=>{let K=String(le?.[M]??"");if(K===""||K.startsWith("env:")||ze===z){xn(),Me(X=>({...X||{},[M]:"env:"+z})),be(""),M==="password"&&kn("env:"+z);return}Re(z),We.current!==null&&clearTimeout(We.current),We.current=setTimeout(()=>{We.current=null,Re("")},4e3)},xa=(M,z)=>{if(ee===null)return null;if(ee.length===0)return i("span",{className:"tt_cardHint",children:z});let K=ge===M,X=je.trim().toUpperCase(),re=X===""?ee:ee.filter(_e=>_e.toUpperCase().includes(X));return o("div",{className:"tt_credPicker",children:[i("input",{className:"tt_cardInput",value:K?je:"",placeholder:v("placeholder.credRef"),title:v("hint.credRefCandidates"),autoComplete:"off",spellCheck:!1,onFocus:()=>{be(M),Oe("")},onBlur:_e=>{_e.currentTarget.parentElement.contains(_e.relatedTarget)||be("")},onChange:_e=>{Oe(_e.target.value),be(M)}}),...K?[i("div",{className:"tt_envList",children:[...re.length===0?[i("span",{className:"tt_envMore",children:v("list.noCredRef")})]:re.slice(0,30).map(_e=>i("button",{type:"button",className:"tt_envItem","data-danger":ze===_e?"":void 0,onMouseDown:ke=>ke.preventDefault(),onClick:()=>Xd(M,_e),children:ze===_e?v("list.credOverwrite",{name:_e}):_e},_e)),...re.length>30?[i("span",{className:"tt_envMore",children:v("list.moreMatches",{count:re.length-30})})]:[]]},"cred-list-"+M)]:[]]})},Zd=()=>{let z=ii(le?.password??"")!=="",K=ui()===null;return o("div",{className:"tt_sshRow tt_credRow",children:[z?i("button",{type:"button",className:"tt_toolBtn tt_credClear",disabled:ls!==!0,onClick:()=>{Jd()},children:v("btn.clearCredential")}):i("label",{className:"tt_credToggle",title:v("hint.rememberCredentialApply"),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:we,disabled:K,onChange:X=>_t(X.target.checked)}),i("span",{children:v("check.rememberCredentialApply")})]}),Ze.text===""?null:i("span",{className:"tt_credStatus","data-kind":Ze.kind,children:Ze.text}),K&&Ze.text===""?i("span",{className:"tt_credStatus","data-kind":"muted",children:v("error.credPlainUnavailable")}):null]})},ka=()=>{let M=String(le?.host??"").trim(),z=String(le?.username??"").trim(),K=Number(le?.port);if((!Number.isInteger(K)||K<1||K>65535)&&(K=22),M===""||z==="")return He(v("error.hostUserRequired")),null;let X=le?.auth,re={host:M,port:K,username:z,auth:X};if(X==="key"){let ke=String(le?.keyPath??"").trim();if(ke==="")return He(v("error.keyPathRequired")),null;re.keyPath=ke,le?.passphrase!==""&&(re.passphrase=le.passphrase)}if(X==="password"){let ke=String(le?.password??"");if(ke==="")return He(v("error.passwordRequired")),null;re.password=ke}le?.agentForward===!0&&(re.agentForward=!0);let _e=String(le?.hostKeyAlias??"").trim();return _e!==""&&(re.hostKeyAlias=_e),re},Qd=()=>{He("");let M=ka();M!==null&&(de({running:!0,ok:!1,text:v("msg.probing")}),qo(M,!1).then(z=>{if(z.result){let K=z.result.auth?.ok===!0;de({running:!1,ok:K,text:Ko(z.result)});return}de({running:!1,ok:!1,text:v("error.probeFailed",{detail:String(z.error||v("error.unknown"))})})}))},eu=()=>{He("");let M=ka();M!==null&&yn(M)},tu=()=>{if(le===null)return null;let M=(z,K,X,re,_e)=>o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:z}),i("input",{className:"tt_cardInput",type:re??"text",value:le[K]??"",placeholder:X??"",autoComplete:"off",spellCheck:!1,onChange:ke=>{let me=ke.target.value;Me(ot=>({...ot||{},[K]:me}))},..._e??{}})]});return o("div",{className:"tt_sshEdit",children:[i("div",{className:"tt_sshSection",children:v("section.connection")}),o("div",{className:"tt_sshGrid",children:[M(v("field.bookName"),"name",v("hint.bookNameConflict")),M(v("field.port"),"port","22")]}),M(v("field.host"),"host",v("placeholder.host")),M(v("field.username"),"username","root"),i("div",{className:"tt_sshSection",children:v("section.auth")}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:v("field.authMethod")}),o("select",{className:"tt_cardInput",value:le.auth,onChange:z=>Me(K=>({...K||{},auth:z.target.value})),children:[i("option",{value:"agent",children:v("option.authAgent")}),i("option",{value:"key",children:v("option.authKey")}),i("option",{value:"password",children:v("option.authPassword")})]})]}),...le.auth==="key"?[M(v("field.keyPath"),"keyPath","~/.ssh/id_ed25519"),M(v("field.passphrase"),"passphrase","","password"),xa("passphrase",v("hint.noCredRefPassphrase"))]:[],...le.auth==="password"?[M(v("field.password"),"password","","password",{onBlur:()=>{kn(le.password)}}),Zd(),xa("password",v("hint.noCredRefPasswordApply"))]:[],i("div",{className:"tt_sshSection",children:v("section.options")}),o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:le.agentForward===!0,onChange:z=>Me(K=>({...K||{},agentForward:z.target.checked}))}),i("span",{className:"tt_cardLabel",children:v("check.agentForward")})]}),M(v("field.hostKeyAlias"),"hostKeyAlias",v("placeholder.hostKeyAlias")),i("span",{className:"tt_cardHint",title:v("hint.hostKeyAliasFull"),children:v("hint.hostKeyAlias")}),wr==="tmux"?o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:le.persist===!0,onChange:z=>Me(K=>({...K||{},persist:z.target.checked}))}),i("span",{className:"tt_cardLabel",children:v("check.persist")})]}):null,oe.text!==""?i("div",{className:"tt_sshProbeResult"+(!oe.running&&oe.ok?" tt_sshProbeOk":"")+(!oe.running&&!oe.ok?" tt_sshProbeBad":""),children:oe.text}):null,st!==""?i("span",{className:"tt_cardMessage tt_cardMessageError",children:st}):null,o("div",{className:"tt_sshActions",children:[o("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:va,children:v("btn.cancel")}),i("button",{type:"button",className:"tt_toolBtn",title:v("btn.browseTitle"),onClick:eu,children:v("btn.fileBrowse")}),i("button",{type:"button",className:"tt_toolBtn",disabled:oe.running,title:v("btn.probeTitle"),onClick:Qd,children:oe.running?v("msg.probing"):v("btn.probe")})]}),o("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_cardSave",onClick:()=>{Fd()},children:v("btn.apply")}),i("span",{className:"tt_cardHint",children:v("hint.appliedOnSave")})]})]})]})},ru=M=>{let z=typeof M?.assistProvider=="string"?M.assistProvider.trim():"",K=typeof M?.assistModel=="string"?M.assistModel.trim():"";return z!==""&&K!==""?z+"/"+K:z!==""?z:K},iu=()=>{if(T.loading)return i("span",{className:"tt_envMore",children:v("list.modelLoading")});if(T.failed)return i("span",{className:"tt_envMore",children:v("list.modelCatalogFailed")});let M=[],z=(_?.assistProvider??"")===""&&(_?.assistModel??"")==="";M.push(i("button",{type:"button",className:"tt_envItem",...z?{"data-active":""}:{},onMouseDown:K=>K.preventDefault(),onClick:()=>{c(K=>({...K||{},assistProvider:"",assistModel:""})),G(!1)},children:v("option.followHostModel")},"assist-route-default"));for(let K of T.groups){let X=String(K.id??"");if(X==="")continue;let re=String(K.name??X),_e=Array.isArray(K.models)?K.models:[];if(_e.length!==0){M.push(i("span",{className:"tt_envMore",children:re},"group-"+X));for(let ke of _e){let me=String(ke.id??"");if(me==="")continue;let ot=String(ke.name??"")===""?me:String(ke.name),Sr=(_?.assistProvider??"")===X&&(_?.assistModel??"")===me;M.push(i("button",{type:"button",className:"tt_envItem",...Sr?{"data-active":""}:{},title:X+"/"+me,onMouseDown:dt=>dt.preventDefault(),onClick:()=>{c(dt=>({...dt||{},assistProvider:X,assistModel:me})),G(!1)},children:ot===me?me:ot},X+"/"+me))}}}return T.groups.length===0&&M.push(i("span",{className:"tt_envMore",children:v("list.noModelCandidate")},"assist-route-empty")),M},wi=(M,z,K,X)=>o("label",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:M}),i("input",{className:"tt_cardInput",value:_[z]??"",placeholder:K??"",onChange:re=>Z(z,re.target.value)}),X?i("span",{className:"tt_cardHint",children:X}):null]}),Wr=(M,z,K,X)=>o("label",{className:"tt_cardField tt_cardRow tt_cardToggle"+(typeof K=="string"&&K!==""?" "+K:""),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:_[z]===!0,disabled:X===!0&&_[z]!==!0,onChange:re=>Z(z,re.target.checked)}),i("span",{className:"tt_cardLabel",children:M})]}),yi=_?.platform==="win32";return l==="summary"?v("card.desc"):o(d?"div":"li",{className:d?"tt_pageHost":m?"tt_card tt_cardOpen":"tt_card",children:[d?null:o("button",{type:"button",className:"tt_cardHeader","aria-expanded":m,onClick:()=>y(M=>!M),children:[o("span",{className:"tt_cardHeadText",children:[i("span",{className:"tt_cardName",children:v("card.name")}),i("span",{className:"tt_cardDescription",children:v("card.descFull")})]}),i("span",{className:"dshkit_badge",children:"Kit"}),i("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:m?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:i("path",{d:s,fill:"currentColor"})})]}),d||m?o("div",{className:"tt_cardBody",children:[_===null?i("div",{className:"tt_cardMessage",children:v("list.loadingConfig")}):o("div",{children:[k(v("section.basic")),Wr(v("check.enabled"),"enabled"),Wr(v("check.announce"),"announceToAgent"),yi?o("div",{className:"tt_cardField",children:[o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:!1,disabled:!0}),i("span",{className:"tt_cardLabel",children:v("check.shellIntegration")})]}),i("span",{className:"tt_cardHint",children:v("hint.shellIntegrationWindows")})]}):Wr(v("check.shellIntegrationWindows"),"shellIntegration"),k(v("section.sftp")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:v("field.sftpStyle")}),o("select",{className:"tt_cardInput",value:_.sftpStyle==="dual"?"dual":"dialog",onChange:M=>Z("sftpStyle",M.target.value),children:[i("option",{value:"dialog",children:v("option.sftpDialog")}),i("option",{value:"dual",children:v("option.sftpDual")})]}),i("span",{className:"tt_cardHint",children:v("hint.sftpDual")})]}),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:v("field.sftpLimits")}),o("div",{className:"tt_limitGrid",children:[o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:v("field.downloadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxDownloadMb))?Number(_.sftpLimits.maxDownloadMb):1024),onChange:M=>fe("maxDownloadMb",Number(M.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:v("field.uploadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxUploadMb))?Number(_.sftpLimits.maxUploadMb):2048),onChange:M=>fe("maxUploadMb",Number(M.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:v("field.uploadCountLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxUploadFiles))?Number(_.sftpLimits.maxUploadFiles):1e3),onChange:M=>fe("maxUploadFiles",Number(M.target.value)||0)})]})]}),i("span",{className:"tt_cardHint",children:v("hint.sftpLimits")})]}),k(v("section.session")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:v("field.persistence")}),o("select",{className:"tt_cardInput",value:_.persistence==="tmux"?"tmux":"off",onChange:M=>Z("persistence",M.target.value),children:[i("option",{value:"off",children:v("option.persistOff")}),i("option",{value:"tmux",children:v("option.persistTmux")})]}),i("span",{className:"tt_cardHint",children:v("hint.persistence")+(yi?v("hint.persistenceWindows"):"")}),Wr(v("check.endOnPageClose"),"endOnPageClose"),Wr(v("check.statsEnabled"),"statsEnabled"),i("span",{className:"tt_cardHint",children:v("hint.statsEnabled")}),Yd()]}),k(v("section.assist")),Wr(v("check.assistEnabled"),"assistEnabled"),i("span",{className:"tt_cardHint",children:v("hint.assistEnabled")}),o("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||G(!1)},children:[i("span",{className:"tt_cardLabel",children:v("field.assistRoute")}),i("input",{className:"tt_cardInput tt_routeInput",ref:$,readOnly:!0,value:ru(_),autoComplete:"off",spellCheck:!1,onFocus:()=>{G(!0),T.groups.length===0&&!T.loading&&J()},onClick:()=>{G(!0),T.groups.length===0&&!T.loading&&J()},onKeyDown:M=>{M.key==="Escape"&&G(!1)}}),...N?[i("div",{className:"tt_envList tt_routeList",children:iu()},"assist-route-list")]:[],i("span",{className:"tt_cardHint",children:v("hint.assistRoute")})]},"assist-route-field"),wi(v("field.maxSessions"),"maxSessions","4",v("hint.maxSessions")),o("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||L(!1)},children:[i("span",{className:"tt_cardLabel",children:v(yi?"field.shellWindows":"field.shell")}),i("input",{className:"tt_cardInput",ref:Y,value:_.shell??"",placeholder:v(yi?"placeholder.shellWindows":"placeholder.shell"),autoComplete:"off",spellCheck:!1,onFocus:()=>L(!0),onClick:()=>L(!0),onKeyDown:M=>{M.key==="Escape"&&L(!1)},onChange:M=>{Z("shell",M.target.value),L(!0)}}),...C?[i("div",{className:"tt_envList tt_shellList",children:(()=>{let M=(_.shell??"").trim().toLowerCase(),z=M===""?F:F.filter(K=>K.toLowerCase().includes(M));return z.length===0?i("span",{className:"tt_envMore",children:v("list.noShellCandidate")}):z.map(K=>i("button",{type:"button",className:"tt_envItem",onMouseDown:X=>X.preventDefault(),onClick:()=>{Z("shell",K),L(!1)},children:K},K))})()},"shell-list")]:[],i("span",{className:"tt_cardHint",children:v(yi?"hint.shellCandidatesWindows":"hint.shellCandidates")})]},"shell-field"),wi("TERM","term","xterm-256color",v("hint.term")),wi("COLORTERM","colorTerm","truecolor",""),wi(v("field.cwd"),"cwd","",v("placeholder.cwd")),wi(v("field.grace"),"reconnectGraceSec","120",v("hint.grace")),k(v("section.ssh")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:v("panel.sshBook")}),...Array.isArray(_.sshHosts)&&_.sshHosts.length>0?[i("div",{className:"tt_hostList","data-editing":te!==null?"":void 0,children:_.sshHosts.map(M=>o("div",{children:[o("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:M?.name??""}),i("span",{className:"tt_sshHostTarget",children:$o(M??{})})]}),i("button",{type:"button",className:"tt_toolBtn",disabled:ae[M?.name]?.running===!0,onClick:()=>{jd(M)},title:v("btn.probeRowTitle"),children:ae[M?.name]?.running===!0?v("msg.testing"):v("btn.test")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Hd(M),children:v("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Wd(M?.name),children:v("btn.delete")})]}),ae[M?.name]&&ae[M?.name].text?i("div",{className:"tt_sshProbeResult"+(ae[M?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:ae[M?.name].text}):null,te===M?.name?tu():null]},String(M?.name??"")))})]:[i("span",{className:"tt_cardHint",children:v("list.emptySshHosts")})],o("div",{className:"tt_cardRow",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Ud()},children:v("btn.importSshConfig")}),i("span",{className:"tt_cardHint",children:v("hint.importSshConfig")})]}),i("span",{className:"tt_cardHint",children:v("hint.sshBook")})]}),o("div",{className:"tt_cardField",children:[o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:v("panel.tunnels")}),...Array.isArray(_.tunnels)&&_.tunnels.length>0?[i("div",{children:_.tunnels.map(M=>{let z=ue.find(re=>re.name===M?.name),K=z?.state??"stopped",X=Ee!==null&&String(M?.name??"")===Ee;return o("div",{className:"tt_sshHostRow","data-editing":X?"":void 0,children:[i("span",{className:"tt_tunnelDot","data-state":K,title:K}),i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:(M?.name??"")+" \xB7 "+Qe(M??{})}),i("span",{className:"tt_sshHostTarget",children:(M?.bookName??"")+(z?.error?" \xB7 "+z.error:"")+(z?.lastForwardError?" \xB7 "+z.lastForwardError:"")})]}),i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:M?.enabled!==!1,title:v("check.tunnelEnabled"),onChange:re=>Nd(M?.name,re.target.checked)}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Dd(M),children:v("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Id(M?.name),children:v("btn.delete")})]},String(M?.name??""))})})]:[i("span",{className:"tt_cardHint",children:v("list.emptyTunnels")})],o("div",{className:"tt_sshEdit",children:[o("div",{className:"tt_cardRow tt_tunnelHead",children:[o("div",{className:"tt_segmented",role:"group","aria-label":v("field.direction"),children:[i("button",{type:"button",className:"tt_segmentedBtn","data-active":ve.direction!=="remote"?"":void 0,title:v("option.localForwardTitle"),onClick:()=>De("direction","local"),children:v("option.localForward")}),i("button",{type:"button",className:"tt_segmentedBtn","data-active":ve.direction==="remote"?"":void 0,title:v("option.remoteForwardTitle"),onClick:()=>De("direction","remote"),children:v("option.remoteForward")})]}),o("select",{className:"tt_cardInput",value:ve.bookName,onChange:Se("bookName"),children:[i("option",{value:"",children:v("option.selectBook")}),...Array.isArray(_?.sshHosts)?_.sshHosts.map(M=>i("option",{value:M?.name??"",children:M?.name??""})):[]]})]}),i("span",{className:"tt_cardHint",children:ht!==void 0?v("hint.tunnelViaBook",{book:$o(ht)}):v("hint.tunnelBookEmpty")}),ve.direction==="local"?o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:v("hint.localListenFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:v("placeholder.localPort"),value:ve.localPort,autoComplete:"off",inputMode:"numeric","aria-label":v("field.localListenPort"),onChange:Se("localPort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"local",title:v("hint.flowLocalToRemote"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:v("placeholder.remoteHost"),title:v("hint.remoteHostTitle"),value:ve.remoteHost,autoComplete:"off","aria-label":v("field.remoteHost"),onChange:Se("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:v("placeholder.port"),value:ve.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":v("field.remotePort"),onChange:Se("remotePort")})]})]}):o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:v("placeholder.remoteListenHost"),title:v("hint.remoteListenHost"),value:ve.remoteHost,autoComplete:"off","aria-label":v("field.remoteListenHost"),onChange:Se("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:v("placeholder.listenPort"),value:ve.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":v("field.remoteListenPort"),onChange:Se("remotePort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"remote",title:v("hint.flowRemoteToLocal"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:v("hint.localDialFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:v("placeholder.localTargetPort"),value:ve.localTargetPort,autoComplete:"off",inputMode:"numeric","aria-label":v("field.localTargetPort"),onChange:Se("localTargetPort")})]})]}),i("div",{className:"tt_tunnelEndpoints",children:[i("span",{className:"tt_tunnelEndLabel",children:ve.direction==="local"?v("hint.tunnelLocalSummary"):v("hint.tunnelRemoteSummary")})]}),i("div",{className:"tt_cardRow tt_tunnelActions",children:[Ee===null?i("button",{type:"button",className:"tt_cardSave",onClick:Bd,children:v("btn.addTunnel")}):i("button",{type:"button",className:"tt_cardSave",onClick:Od,children:v("btn.saveEdit")}),Ee===null?null:i("button",{type:"button",className:"tt_toolBtn",onClick:Pd,children:v("btn.cancel")}),i("span",{className:"tt_cardHint",children:Ee===null?v("hint.tunnelAdd"):v("hint.tunnelEditing",{name:Ee})})]})]})]}),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:v("panel.hostKeys")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{$d()},children:v("btn.importKnownHosts")})]}),...Array.isArray(_.hostKeys)&&_.hostKeys.length>0?[i("div",{className:"tt_hostList",children:_.hostKeys.map((M,z)=>o("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:String(M?.host??"")+":"+String(M?.port??22)}),i("span",{className:"tt_sshHostTarget",children:ba(M).map(K=>"sha256:"+K).join(" / ")})]}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>{zd(M)},children:v("btn.delete")})]},String(M?.host??"")+":"+String(M?.port??22)+"#"+String(z)))})]:[i("span",{className:"tt_cardHint",children:v("list.emptyHostKeys")})],i("span",{className:"tt_cardHint",children:v("hint.hostKeys")})]}),o("div",{className:"tt_cardField tt_cardRow",children:[i("button",{className:"tt_cardSave",disabled:p,onClick:()=>{wa()},children:v(p?"msg.saving":"btn.save")}),i("span",{className:"tt_cardMessage"+(S.kind==="ok"?" tt_cardMessageOk":S.kind==="error"?" tt_cardMessageError":S.kind==="warn"?" tt_cardMessageWarn":""),children:S.text})]})]})]}):null]})}t.inject=["slots","sessions"];let a=["@hyzyn/dsh-tty#tty","@hyzyn/dsh-all#tty"];return t.apply=u=>{A_(u),Nh=u.sessions,u.inject(["remote","remote.credentials"],S=>(Ut=S.remote?.credentials??S["remote.credentials"]??null,()=>{Ut=null}));let l=!1,d=()=>{};hn={set(S){if(S!==l){if(l=S,S){d=yg();return}d(),d=()=>{},Qi(),Dr()}}},id(!0),ua();let m="@hyzyn/dsh-all",_=[...new Set(a.map(S=>S.split("#")[0]))].find(S=>S!==m),c=!1,f=[];_!==void 0&&u.slots.inject("plugins.bundle.config",()=>{for(c=!0;f.length>0;){let S=f.pop();typeof S=="function"&&S()}return u.slots.register({name:"plugins.bundle.config",key:_},n)});for(let S of a)u.slots.inject("plugins.row.config",()=>{let b=S.split("#")[0]===_;if(b&&c)return;let x=u.slots.register({name:"plugins.row.config",key:S},n);return b&&f.push(x),x});u.slots.inject("settings.kit.item",()=>u.slots.register({name:"settings.kit.item",id:"tty",order:80,label:()=>v("card.name")},n)),u.slots.inject("settings.plugin.item",()=>u.slots.register({name:"settings.plugin.item",key:"tty",order:100},n));let h=u.provide("ttyConnbar",{version:1,addAction:mn,requestRender(){Dr()}}),p=u.provide("ttyTerminal",{version:3,open(S){if(!Pr)return;let b=Kh(S),x=Gh(S,b),w=typeof S?.label=="string"&&S.label!==""?S.label:void 0;if(es(),S?.reuse!==!1){let E=hm(x);if(E!==null)return Qo(),lr(E.sid,{user:!0}),E}return Qo(),Yi(x,w)},mount(S,b){return Pr?wm(S,b):()=>{}}}),g=u.provide("ttyPanel",{version:2,isOpen(){return ce!==null&&!Xe},mountPane(S){return Jh(S)},minimize(){return Zi(),ce!==null&&Xe}});return()=>{hn=null,Pr=!1,d(),g(),p(),h(),Qi()}},t}});})();
3765
+ `;function Ns(e){let t=typeof e=="string"?e.trim():"";if(t==="")return;let r=t,i="",o=r.lastIndexOf("@");o>0&&(i=r.slice(0,o).trim(),r=r.slice(o+1).trim());let s=r,n=22,a=/^\[([^\]]+)\](?::(\d+))?$/.exec(r)??/^([^:]+):(\d+)$/.exec(r);if(a!==null){s=a[1];let l=Number(a[2]);Number.isInteger(l)&&l>=1&&l<=65535&&(n=l)}if(s==="")return;let u={host:s,port:n};return i!==""&&(u.username=i),u}function Co(e){if(e===null||typeof e!="object")return"";let t=e,r=typeof t.host=="string"?t.host.trim():"";if(r==="")return"";let i=Number.isInteger(t.port)&&Number(t.port)>=1&&Number(t.port)<=65535?Number(t.port):22,o=typeof t.username=="string"&&t.username.trim()!==""?t.username.trim()+"@":"",s=r.includes(":")&&!r.startsWith("[")?`[${r}]`:r;return`${o}${s}${i===22?"":":"+String(i)}`}function Ac(e){return String(e??"").trim()!==""}function Dc(e){return Ac(e)}function Pc(e,t,r){return e!==!0?"":Ac(t)?String(t):String(r??"").trim()}var xo="\0global";function Qr(e,t){return e===null?xo:typeof e=="string"&&e!==""?e:typeof t=="string"&&t!==""?t:xo}function ko(e,t){return e===xo?!0:typeof t=="string"&&t!==""&&e===t}var g_="/api/dsh-tty/ws";function Bc(e,t){let r=new URL(t??e,e);return(r.protocol==="https:"?"wss:":"ws:")+"//"+r.host+g_}function Eo(e){return String(e??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Oc(e,t,r,i){let o=Eo(r),s=Eo(e);if(o===""||s==="")return"";let n=Eo(t),a=["DSH_TTY",o,s];return n!==""&&n!=="22"&&a.push(n),a.push(i),a.join("_")}function Hs(e){let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=65535?t:0}function Ic(e,t,r){return`${e}-${t==="remote"?"R":"L"}${String(r)}`}function Nc(e,t=[],r=i=>i){let i=e??{},o=String(i.bookName??"")||String(t[0]??"")||"";if(o==="")return{ok:!1,error:r("error.tunnelNoBook")};if(i.direction==="remote"){let u=Hs(i.remotePort),l=Hs(i.localTargetPort);return u<1||l<1?{ok:!1,error:r("error.tunnelRemotePortRequired")}:{ok:!0,tunnel:{name:Ic(o,"remote",u),bookName:o,direction:"remote",remotePort:u,localTargetHost:"",localTargetPort:l,enabled:!0}}}let s=Hs(i.localPort),n=String(i.remoteHost??"").trim(),a=Hs(i.remotePort);return s<1||n===""||a<1?{ok:!1,error:r("error.tunnelLocalRequired")}:{ok:!0,tunnel:{name:Ic(o,"local",s),bookName:o,direction:"local",localPort:s,remoteHost:n,remotePort:a,enabled:!0}}}function Hc(e,t){return(Array.isArray(e)?e:[]).find(r=>String(r?.name??"")===String(t))}function v_(e,t,r){return(Array.isArray(e)?e:[]).find(i=>String(i?.name??"")!==String(t)&&String(i?.name??"")===String(r))}function Fc(e,t,r,i){let o=Array.isArray(e)?e:[],s=o.find(u=>String(u?.name??"")===String(t));if(s===void 0)return{ok:!1,reason:"missing",error:i("error.tunnelMissing",{name:String(t)})};if(v_(o,t,r.name)!==void 0)return{ok:!1,reason:"clash",error:i("error.tunnelClash",{name:String(r.name)})};let a={...r,enabled:s.enabled!==!1};return{ok:!0,tunnels:o.map(u=>String(u?.name??"")===String(t)?a:u)}}function b_(e){let t=e?.byId;if(!(t===null||typeof t!="object"))for(let r of Object.keys(t)){let i=t[r]?.retainedBy?.mainView??0;if(typeof i=="number"&&i>0)return r}}function w_(e){let t=e?.current;return typeof t=="string"&&t!==""?t:b_(e)}function Wc(e){let t=w_(e);if(t===void 0)return;let r=e?.byId?.[t]?.cwd;return typeof r=="string"&&r!==""?r:void 0}function y_(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0}function jc(e,t){if(e==null)return;let r=Math.floor(Number(e.cols)),i=Math.floor(Number(e.rows));if(!(!Number.isFinite(r)||!Number.isFinite(i))&&!(r<20||i<3)&&!(t==null||!y_(Number(t.width),Number(t.height))))return{cols:Math.min(500,r),rows:Math.min(200,i)}}function zc(e){return e!==null&&typeof e=="object"&&e.exited!==!0}function Uc(e){if(!Array.isArray(e))return 0;let t=0;for(let r of e)zc(r)&&(t+=1);return t}function Lo(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)zc(r)&&typeof r.sid=="string"&&r.sid!==""&&t.add(r.sid);return t}function $c(e){let t=new Set,r=new Set,i=new Set;if(!Array.isArray(e))return{present:t,retained:r,live:i};for(let o of e){if(o===null||typeof o!="object")continue;let s=typeof o.sid=="string"?o.sid:"";s!==""&&(t.add(s),o.exited===!0?r.add(s):i.add(s))}return{present:t,retained:r,live:i}}function qc(e,t){if(e===null||typeof e!="object"||e.agentOwned!==!0||e.embedded===!0)return"keep";let r=typeof e.sid=="string"?e.sid:"";return r===""||t===null||typeof t!="object"?"keep":t.present.has(r)?t.retained.has(r)?"mark-exited":"keep":"remove"}function Kc(e){let t={live:0,agentLive:0,confirm:!1};if(e==null||typeof e[Symbol.iterator]!="function")return t;let r=0,i=0;for(let o of e)o===null||typeof o!="object"||o.embedded!==!0&&o.exited!==!0&&(r+=1,o.agentOwned===!0&&(i+=1));return{live:r,agentLive:i,confirm:r>0}}var Fs=Object.freeze({sids:[],live:0,agentLive:0,confirm:!1});function Gc(e){let t=[];if(e==null||typeof e[Symbol.iterator]!="function")return t;for(let r of e){if(r===null||typeof r!="object"||r.embedded===!0)continue;let i=r.sid;typeof i!="string"||i===""||t.push({sid:i,exited:r.exited===!0,agentOwned:r.agentOwned===!0})}return t}function Vc(e){return Gc(e).length}function Ws(e){let t=e.map(i=>i.sid),r=e.filter(i=>i.exited!==!0);return{sids:t,live:r.length,agentLive:r.filter(i=>i.agentOwned===!0).length,confirm:r.length>=2}}function Yc(e,t){let r=Gc(e);if(r.length===0)return{others:Fs,left:Fs,right:Fs,exited:Fs};let i=typeof t=="string"?t:"",o=r.findIndex(s=>s.sid===i);return{others:Ws(o<0?r:r.filter(s=>s.sid!==i)),left:Ws(o<0?[]:r.slice(0,o)),right:Ws(o<0?[]:r.slice(o+1)),exited:Ws(r.filter(s=>s.exited===!0))}}function xr(e){return e!==null&&typeof e=="object"&&e.hidden===!0}function To(e){return!(e===null||typeof e!="object"||e.agentOwned===!0||e.embedded===!0)}function Mo(e,t){let r=e!==null&&typeof e=="object"?{...e}:{};return t===!0?(r.hidden=!0,r):(delete r.hidden,r)}function Jc(e){return e===!0?"btn.showToAgent":"btn.hideFromAgent"}function Xc(e){let t=Number(e?.received),r=Number(e?.attempt),i=Number.isInteger(e?.maxAttempts)?e.maxAttempts:3,o=e?.total===null||e?.total===void 0?null:Number(e.total);return e?.canceled===!0?{resume:!1,reason:"canceled"}:!Number.isFinite(t)||t<=0?{resume:!1,reason:"noProgress"}:!Number.isInteger(r)||r<1?{resume:!1,reason:"badAttempt"}:r>i?{resume:!1,reason:"attemptsExhausted"}:o!==null&&Number.isFinite(o)&&o>0&&t>=o?{resume:!1,reason:"complete"}:{resume:!0,offset:t}}function S_(e){return typeof e!="string"||e===""||e==="."||e===".."?!1:e.startsWith(".")}function js(e,t){let i=(Array.isArray(e)?e:[]).filter(o=>o!==null&&typeof o=="object"&&typeof o.name=="string"&&o.name!=="");return t===!0?i:i.filter(o=>!S_(o.name))}function Zc(e,t){return e!=="remote"?{accept:!1,reason:"wrongPane"}:(Array.isArray(t?.types)?t.types:[]).includes("Files")?Number(t?.files?.length??0)>0?{accept:!0}:{accept:!1,reason:"empty"}:{accept:!1,reason:"notFiles"}}function Qc(e){let t=new Set;for(let r of Array.isArray(e)?e:[]){let i=typeof r?.relPath=="string"?r.relPath:"",o=i.lastIndexOf("/");o<=0||t.add(i.slice(0,o))}return[...t].sort((r,i)=>r.split("/").length-i.split("/").length||r.localeCompare(i))}function eh(e,t){return e==null?{text:"",state:""}:e.exited===!0?{text:e.statusText??t("status.exited"),state:e.statusState??""}:e.live===!0?{text:e.statusText??t("status.connected"),state:e.statusState??"connected"}:e.errored===!0?{text:e.statusText??t("status.errored"),state:e.statusState??"error"}:{text:e.statusText??t("status.connectingEllipsis"),state:e.statusState??""}}function th(e,t){return typeof e!="string"||e===""?!0:e===t}function rh(e,t){return e===null?!1:e!==t}var ih="block",Ro="none";function C_(e){return e===ih}function sh(e){return e===!0?ih:Ro}function nh(e){return!C_(e)}function ct(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]}function Di(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]+"/s"}function ah(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function oh(e,t){return!Number.isFinite(e)||e<0?t("list.none"):e<1024?Math.round(e)+" B/s":Di(e)||t("list.none")}function x_(e,t){if(!Number.isFinite(e)||e<0)return t("list.none");let r=Math.floor(e),i=Math.floor(r/604800),o=Math.floor(r%604800/86400),s=Math.floor(r%86400/3600),n=Math.floor(r%3600/60),a=[];return i>0&&a.push(i+"w"),(i>0||o>0)&&a.push(o+"d"),(i>0||o>0||s>0)&&a.push(s+"h"),(i>0||o>0||s>0||n>0)&&a.push(n+"m"),a.length>0?a.join(""):r+"s"}function k_(e,t,r){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?r("list.none"):(ct(e)||"0 B")+"/"+(ct(t)||"0 B")}function lh(e,t){let r=e[t];return Number.isFinite(r)?t==="tempC"?r>-100&&r<200?r:null:t==="cores"?r>=1&&r<=4096?r:null:t==="cpuPct"||t==="memPct"||t==="diskPct"?r>=0&&r<=100?r:null:t==="uptimeSec"?r>=0&&r<=100*365*24*3600?r:null:t==="tcpConns"?r>=0&&r<=1e7?r:null:t==="rxRate"||t==="txRate"?r>=0&&r<=2**40?r:null:r>=0&&r<=2**50?r:null:null}var E_=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function ch(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:E_.some(t=>lh(e,t)!==null)}var L_=8e3;function hh(e,t=Date.now()){return t-(e||0)<=L_}var dh=23;function Ao(e){return[{key:"cpuPct",label:"CPU",kind:"pct",slot:4},{key:"memPct",label:e("meta.mem"),kind:"pct",slot:4},{key:"diskPct",label:e("meta.disk"),kind:"pct",slot:4},{key:"cores",label:e("meta.cores"),kind:"count",slot:4},{key:"mem",label:e("meta.mem"),kind:"pair",slot:17,used:"memUsed",total:"memTotal"},{key:"uptimeSec",label:e("meta.uptime"),kind:"uptime",slot:13},{key:"tcpConns",label:"TCP",kind:"count",slot:6},{key:"disk",label:e("meta.disk"),kind:"pair",slot:17,used:"diskUsed",total:"diskTotal"},{key:"tempC",label:e("meta.temp"),kind:"temp",slot:8},{key:"net",label:e("meta.net"),kind:"net",slot:dh}]}function uh(e,t){let r=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{},i=s=>lh(r,s),o=(s,n,a,u=s.slot)=>({key:s.key,label:s.label,kind:s.kind,slot:u,pct:a??null,value:n,title:s.label+": "+n});return Ao(t).map(s=>{if(s.kind==="pct"){let a=i(s.key);return o(s,a===null?t("list.none"):Math.round(a)+"%",a)}if(s.kind==="pair")return o(s,k_(i(s.used),i(s.total),t),null);if(s.kind==="uptime")return o(s,x_(i(s.key),t),null);if(s.kind==="temp"){let a=i(s.key);return o(s,a===null?t("list.none"):a.toFixed(1)+"\xB0C",null)}if(s.kind==="net"){let a=i("rxRate"),u=i("txRate");return a===null&&u===null?o(s,t("list.none"),null,0):o(s,"\u2193"+oh(a,t)+" \u2191"+oh(u,t),null,dh)}let n=i(s.key);return o(s,n===null?t("list.none"):String(n),null)})}var Do="tty",Xs={"error.credServiceMissing":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09","error.credServiceIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574","error.credStoreUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u5B58\u5165","error.credStoreFailed":"\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u5931\u8D25\uFF1A{error}","error.credClearUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u6E05\u9664","error.credClearFailed":"\u6E05\u9664\u5931\u8D25\uFF1A{error}","error.credRefNeedsHost":"\u5148\u586B\u300C\u4E3B\u673A\u300D\u548C\u300C\u7528\u6237\u540D\u300D\u518D\u5B58\u5165\u2014\u2014\u5F15\u7528\u540D\u7531\u8FD9\u4E24\u8005\u6D3E\u751F","btn.reopen":"\u91CD\u65B0\u6253\u5F00","btn.reopenTitle":"\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD","btn.sftpTitle":"\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09","btn.tunnels":"\u96A7\u9053 {count}","btn.tunnelsTitle":"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053","btn.more":"\u66F4\u591A","btn.moreTitle":"\u66F4\u591A\u64CD\u4F5C\uFF08\u7AEF\u53E3\u8F6C\u53D1\u2026\uFF09","btn.reopenSession":"\u91CD\u65B0\u6253\u5F00\u4F1A\u8BDD","status.exited":"\u4F1A\u8BDD\u5DF2\u9000\u51FA","status.ended":"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","btn.clickRerun":"\u70B9\u51FB\u91CD\u65B0\u6267\u884C","status.aiEnded":"AI \u5DF2\u7ED3\u675F\u8FD9\u4E2A\u4F1A\u8BDD","hint.aiEndedTab":"\u5185\u5BB9\u5148\u7559\u7740\uFF1A\u5207\u8D70\u6216\u70B9\u300C\u6536\u8D77\u300D\u5373\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E","btn.dismiss":"\u6536\u8D77","btn.dismissTitle":"\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E\uFF08\u4F1A\u8BDD\u5DF2\u7ECF\u7ED3\u675F\u4E86\uFF09","hint.reopenWithSpec":"\u6309\u539F\u89C4\u683C\u91CD\u5F00\u4E00\u6761\u4F1A\u8BDD\uFF08\u6301\u4E45\u6807\u7B7E\u63A5\u56DE tmux\uFF0C\u547D\u4EE4\u6807\u7B7E\u91CD\u8DD1\u4E00\u6B21\uFF09","btn.newLocalTerminal":"\u65B0\u5F00\u672C\u5730\u7EC8\u7AEF","hint.reopenAgentLocal":"\u8FD9\u6761\u4F1A\u8BDD\u662F AI \u5F00\u7684\u3001\u5DF2\u7ECF\u7ED3\u675F\uFF1A\u70B9\u4E86\u4F1A\u65B0\u5F00\u4E00\u4E2A\u672C\u5730\u7EC8\u7AEF\uFF0C\u4E0D\u4F1A\u63A5\u56DE\u539F\u6765\u90A3\u6761","msg.passwordNotStored":"\u51FA\u4E8E\u5B89\u5168\u8003\u8651\uFF0C\u660E\u6587\u5BC6\u7801/\u53E3\u4EE4\u4E0D\u968F\u6D4F\u89C8\u5668\u5B58\u50A8\u4FDD\u7559\uFF0C\u672C\u6B21\u8FDE\u63A5\u9700\u8981\u91CD\u65B0\u8F93\u5165\uFF1A\u91CD\u5F00\u6807\u7B7E\u65F6\u518D\u586B\u4E00\u6B21\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u628A\u51ED\u636E\u6362\u6210 env: \u5F15\u7528\uFF08\u503C\u5B58\u5BBF\u4E3B\u51ED\u636E\u5B58\u50A8\uFF09\u3002","error.terminalNeedsCommand":"ttyTerminal \u9700\u8981 command","error.terminalCommandSingleLine":"command \u5FC5\u987B\u662F\u5355\u884C","error.terminalNeedsHost":"ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9","error.panelNotReady":"ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA","panel.dragHeight":"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6","panel.dragWidth":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6","btn.closePane":"\u5173\u95ED\u4FA7\u680F","btn.expandPane":"\u5C55\u5F00\u4FA7\u680F","btn.collapsePane":"\u6536\u8D77\u4FA7\u680F","panel.tabLabel":"\u7EC8\u7AEF {n}","btn.close":"\u5173\u95ED","btn.closeTabAria":"\u5173\u95ED\u6807\u7B7E\uFF1A{label}","btn.newTab":"\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09","btn.tabList":"\u6807\u7B7E\u5217\u8868","btn.tabListTitle":"\u6807\u7B7E\u5217\u8868\uFF08{n} \u4E2A\uFF09","list.tabsAllVisible":"\u6CA1\u6709\u85CF\u5728\u89C6\u91CE\u5916\u7684\u6807\u7B7E","list.cleanExited":"\u6E05\u7406\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\uFF08{n}\uFF09","btn.closeTab":"\u5173\u95ED\u6B64\u6807\u7B7E","btn.hideFromAgent":"\u5BF9 AI \u9690\u85CF\u6B64\u6807\u7B7E","btn.showToAgent":"\u53D6\u6D88\u9690\u85CF\uFF08\u8BA9 AI \u53EF\u7528\uFF09","btn.hiddenMark":"\u5BF9 AI \u4E0D\u53EF\u89C1","btn.closeLeft":"\u5173\u95ED\u5DE6\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","btn.closeOthers":"\u5173\u95ED\u5176\u4ED6\u6807\u7B7E\uFF08{n}\uFF09","btn.closeRight":"\u5173\u95ED\u53F3\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","list.subLive":"\u5176\u4E2D {n} \u4E2A\u8FD8\u5F00\u7740","meta.tunnelRemote":"\u8FDC\u7A0B:{host}:{port} \u2192 \u672C\u673A:{local}","meta.tunnelLocal":"\u672C\u673A:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A","status.notPersisted":"\u672A\u6301\u4E45\u5316","status.tmuxUnavailableTitle":"\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD","status.connected":"\u5DF2\u8FDE\u63A5","status.connecting":"\u8FDE\u63A5\u4E2D","status.errored":"\u8FDE\u63A5\u51FA\u9519","panel.tunnels":"\u7AEF\u53E3\u8F6C\u53D1","hint.tunnelsSettings":"\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u91CC\u914D\u7F6E","panel.tunnelsFor":"\u7AEF\u53E3\u8F6C\u53D1 \u2014 {name}","list.loading":"\u52A0\u8F7D\u4E2D\u2026","hint.tunnelsCard":"\u589E\u5220/\u542F\u505C\u5728 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4","list.noActiveTunnels":"\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053","status.fatalSuffix":"\uFF08\u4E0D\u91CD\u8BD5\uFF0C\u9700\u4FEE\u914D\u7F6E\uFF09","msg.maxSessions":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 {live} \u4E2A / \u4E0A\u9650 {max}\uFF1A\u672C\u7A97\u53E3 {own} \u4E2A{others}\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","msg.maxSessionsOthers":" + \u5176\u4ED6\u7A97\u53E3 {count} \u4E2A","error.probeHttp":"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP {status}\uFF09","msg.probing":"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026","meta.reachable":"\u901A","meta.unreachable":"\u4E0D\u901A","meta.probeBanner":"banner \u6B63\u5E38","meta.hostKeyMatched":"\u4E3B\u673A\u5BC6\u94A5\u5339\u914D","meta.hostKeyRecorded":"\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09","meta.hostKeyMismatch":"\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01","meta.authOkMs":"\u8BA4\u8BC1\u901A\u8FC7\uFF08{ms}ms\uFF09","meta.authOk":"\u8BA4\u8BC1\u901A\u8FC7","meta.probeOk":"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A{detail}","error.unknown":"\u672A\u77E5\u9519\u8BEF","btn.maxSessionsTitle":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E","option.localTerminal":"\u672C\u5730\u7EC8\u7AEF","hint.tmuxHosted":"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D","hint.openInSessionCwd":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00","panel.sshBook":"SSH \u8FDE\u63A5\u7C3F","btn.sftpFileBrowse":"SFTP \u6587\u4EF6\u6D4F\u89C8","btn.editConnection":"\u7F16\u8F91\u8FDE\u63A5","list.emptySshBook":"\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09","option.sshConnect":"SSH \u8FDE\u63A5\u2026","hint.sshConnect":"\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F","panel.editConnection":"\u7F16\u8F91\u8FDE\u63A5 \xB7 {name}","panel.sshConnect":"SSH \u8FDE\u63A5","section.jump":"\u8DF3\u677F\u673A","field.jumpHost":"\u8DF3\u677F\u673A\uFF08[\u7528\u6237@]\u4E3B\u673A[:\u7AEF\u53E3]\uFF0C\u7559\u7A7A = \u76F4\u8FDE\uFF09","placeholder.jumpHost":"\u4F8B\u5982 bastion.corp:2222","check.jumpOwnCred":"\u8DF3\u677F\u673A\u4F7F\u7528\u72EC\u7ACB\u51ED\u636E","field.jumpUsername":"\u8DF3\u677F\u673A\u7528\u6237\u540D\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","field.jumpAuth":"\u8DF3\u677F\u673A\u8BA4\u8BC1\u65B9\u5F0F\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","hint.jumpInherit":"\u7559\u7A7A\u51ED\u636E = \u6CBF\u7528\u76EE\u6807\u90A3\u53F0\u4E3B\u673A\u7684\u8BA4\u8BC1\u65B9\u5F0F\u4E0E\u94A5\u5319\u3002","hint.jumpInheritFull":"\u7559\u7A7A\u51ED\u636E = \u6CBF\u7528\u4E0A\u9762\u90A3\u53F0\u4E3B\u673A\u7684\u8BA4\u8BC1\u65B9\u5F0F\u4E0E\u94A5\u5319\uFF1B\u8DF3\u677F\u673A\u8FDE\u4E0D\u4E0A\u65F6\u9519\u8BEF\u6587\u6848\u4F1A\u70B9\u540D\u5B83\uFF08\u4E0D\u4F1A\u4F2A\u88C5\u6210\u76EE\u6807\u8D85\u65F6\uFF09\u3002","meta.jumpStage":"\u8DF3\u677F\u673A {label}","meta.viaJump":"\u21E2 \u7ECF {label}","meta.viaProxy":"\u21E2 \u7ECF\u4EE3\u7406\u547D\u4EE4","section.proxyCommand":"\u4EE3\u7406\u547D\u4EE4","field.proxyCommand":"\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF0C\u7559\u7A7A = \u4E0D\u7528\uFF09","placeholder.proxyCommand":"\u4F8B\u5982 ssh -W %h:%p bastion","hint.proxyCommand":"\u672C\u673A\u547D\u4EE4\uFF0Cstdin/stdout \u5373\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF1B\u4E0E\u8DF3\u677F\u673A\u540C\u586B\u65F6\u8DF3\u677F\u673A\u4F18\u5148\u3002","hint.proxyCommandFull":"\u672C\u673A\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u5B83\u7684 stdin/stdout \u5C31\u662F\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u652F\u6301 %h \u76EE\u6807\u4E3B\u673A\u3001%p \u7AEF\u53E3\u3001%r \u7528\u6237\u540D\u3001%n \u4E3B\u673A\u3001%% \u5B57\u9762 %\uFF1B\u5176\u4F59\u5199\u6CD5\u539F\u6837\u4FDD\u7559\u3002\u4E0E\u8DF3\u677F\u673A\u540C\u65F6\u586B\u65F6\u8DF3\u677F\u673A\u4F18\u5148\uFF08OpenSSH \u8BED\u4E49\uFF09\u3002\u9700\u8981\u4E0B\u9762\u90A3\u4E2A\u5F00\u5173\uFF0C~/.ssh/config \u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\u5B83\u3002","hint.proxyCommandDisabled":"\u26A0 \u5F53\u524D\u300C\u5141\u8BB8 ProxyCommand\u300D\u672A\u6253\u5F00\uFF1A\u8FD9\u6761\u547D\u4EE4\u4E0D\u4F1A\u6267\u884C\uFF0C\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002\u5230 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u6253\u5F00\u5F00\u5173\u540E\u751F\u6548\u3002","hint.proxyCommandNotGranted":"\u26A0 \u8FD9\u6761\u80FD\u529B\u672A\u83B7\u5BBF\u4E3B\u6388\u6743\uFF1A\u70B9\u8FD9\u4E2A\u5F00\u5173\u4F1A\u5C31\u5730\u53D1\u8D77\u4E00\u6B21\u6388\u6743\uFF08\u9762\u677F\u7ED9\u4E00\u6761\u5728\u5BBF\u4E3B\u7EC8\u7AEF\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u514D\u91CD\u542F\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u8D70\u6700\u4E25\u7684\u90A3\u6761\u2014\u2014\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export DSH_TTY_ALLOW_PROXY_COMMAND=1 \u540E\u91CD\u542F\u5BBF\u4E3B\uFF08\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u4E0D\u7B97\u6388\u6743\uFF09\u3002\u8FD9\u6837\u5B89\u6392\u662F\u56E0\u4E3A\u8DE8\u7AD9\u9875\u9762\u4E0E\u9875\u5185\u811A\u672C\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\u2014\u2014\u82E5\u914D\u7F6E\u754C\u9762\u80FD\u51ED\u7A7A\u63D0\u6743\uFF0C\u8FD9\u9053\u95F8\u95E8\u7B49\u4E8E\u6CA1\u6709\uFF1B\u5173\u6389\u5B83\u5219\u968F\u65F6\u53EF\u7528\u3002","badge.notEffective":"\u672A\u751F\u6548\uFF1A\u672A\u83B7\u5BBF\u4E3B\u6388\u6743","elev.title":"\u5C31\u5730\u6388\u6743\uFF08\u514D\u91CD\u542F\uFF09","elev.lockedWhy":"\u672C\u673A\u4EFB\u610F\u8FDB\u7A0B\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\uFF0C\u6240\u4EE5\u300C\u6253\u5F00\u5371\u9669\u80FD\u529B\u300D\u8FD9\u4EF6\u4E8B\u4E0D\u80FD\u7531\u8FD9\u4E2A\u9875\u9762\u81EA\u5DF1\u8BF4\u4E86\u7B97\u2014\u2014\u5FC5\u987B\u5728\u5BBF\u4E3B\u7684\u6587\u4EF6\u7CFB\u7EDF\u4E0A\u786E\u8BA4\u4E00\u6B21\u3002","elev.step":"\u5728\u5BBF\u4E3B\u7684\u7EC8\u7AEF\u91CC\u6267\u884C\u4E0B\u4E00\u6761\u547D\u4EE4\uFF0C\u5F00\u5173\u4F1A\u81EA\u52A8\u89E3\u9501\uFF1A","elev.copy":"\u590D\u5236\u547D\u4EE4","elev.copied":"\u5DF2\u590D\u5236","elev.copyManual":"\u5F53\u524D\u73AF\u5883\u62FF\u4E0D\u5230\u526A\u8D34\u677F\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u4E0A\u9762\u90A3\u6761\u547D\u4EE4\u590D\u5236\u3002","elev.expiresIn":"{sec} \u79D2\u540E\u5931\u6548","elev.expired":"\u672C\u6B21\u786E\u8BA4\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002","elev.waiting":"\u7B49\u5F85\u786E\u8BA4\u2026\u6267\u884C\u5B8C\u547D\u4EE4\u8FD9\u91CC\u4F1A\u81EA\u52A8\u53D8\u6210\u5DF2\u6388\u6743\u3002","elev.regenerate":"\u91CD\u65B0\u751F\u6210","elev.loading":"\u6B63\u5728\u751F\u6210\u786E\u8BA4\u547D\u4EE4\u2026","elev.granted":"\u5DF2\u6388\u6743\u5E76\u751F\u6548\u3002","elev.grantedNeedSave":"\u5DF2\u6388\u6743\u3002\u70B9\u300C\u4FDD\u5B58\u300D\u540E\u751F\u6548\u3002","elev.grantedAt":"\u5DF2\u6388\u6743 \xB7 {time}","elev.revoke":"\u64A4\u9500\u5BBF\u4E3B\u6388\u6743","elev.revoked":"\u5DF2\u64A4\u9500\u5BBF\u4E3B\u6388\u6743\uFF08\u914D\u7F6E\u5F00\u5173\u4FDD\u6301\u4E0D\u53D8\uFF0C\u91CD\u65B0\u6388\u6743\u540E\u4F1A\u7ACB\u523B\u751F\u6548\uFF09\u3002","elev.viaEnv":"\u7531\u542F\u52A8\u73AF\u5883\u53D8\u91CF\u6388\u6743\uFF1B\u8981\u64A4\u9500\u9700\u5728\u542F\u52A8\u73AF\u5883\u91CC\u53BB\u6389\u5B83\u5E76\u91CD\u542F\u5BBF\u4E3B\u3002","elev.close":"\u6536\u8D77","elev.disableFirst":"\u5148\u5173\u6389\u8FD9\u4E2A\u914D\u7F6E\u5F00\u5173","elev.otherWay":"\u53E6\u4E00\u79CD\u65B9\u5F0F\uFF08\u6700\u5F3A\uFF0C\u9700\u8981\u91CD\u542F\u5BBF\u4E3B\uFF09","elev.envHow":"\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export {env}=1\uFF0C\u7136\u540E\u91CD\u542F\u5BBF\u4E3B\u3002\u6CE8\u610F\uFF1A\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u3001\u6216\u5199\u8FDB\u522B\u7684\u914D\u7F6E\u6587\u4EF6\u90FD\u4E0D\u7B97\u6388\u6743\u2014\u2014\u8FD9\u9053\u95F8\u95E8\u9632\u7684\u5C31\u662F\u300C\u8FD0\u884C\u671F\u80FD\u6539\u7684\u4E1C\u897F\u5192\u5145\u6388\u6743\u300D\u3002","elev.error":"\u5C31\u5730\u6388\u6743\u6CA1\u6210\u529F\uFF1A","meta.probeProxy":"\u4EE3\u7406\u547D\u4EE4","meta.probeProxyOff":"\u4EE3\u7406\u547D\u4EE4\uFF08\u672A\u542F\u7528\uFF09","meta.probeTcpSkipped":"\u76F4\u8FDE\u9884\u68C0\u5DF2\u8DF3\u8FC7\uFF08\u8D70\u4EE3\u7406\u547D\u4EE4\uFF09","section.connection":"\u8FDE\u63A5","field.host":"\u4E3B\u673A","placeholder.host":"example.com \u6216 IP","field.port":"\u7AEF\u53E3","field.username":"\u7528\u6237\u540D","section.auth":"\u8BA4\u8BC1","field.authMethod":"\u8BA4\u8BC1\u65B9\u5F0F","option.authInherit":"\uFF08\u6CBF\u7528\u76EE\u6807\uFF09","option.authAgent":"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent","option.authKey":"key \u2014 \u79C1\u94A5\u6587\u4EF6","option.authPassword":"password \u2014 \u5BC6\u7801","field.keyPath":"\u79C1\u94A5\u8DEF\u5F84","field.hostKeyAlias":"\u4E3B\u673A\u5BC6\u94A5\u522B\u540D","field.passphrase":"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09","field.password":"\u5BC6\u7801","placeholder.credRef":"\u6216\uFF1A\u9009\u62E9\u51ED\u636E\u5B58\u50A8\u91CC\u7684\u5F15\u7528\u540D","hint.credRefCandidates":"\u5019\u9009 = \u51ED\u636E\u5B58\u50A8\u91CC\u5DF2\u6709\u7684\u5F15\u7528\u540D + \u672C\u673A\u8FDE\u63A5\u7C3F\u91CC\u5728\u7528\u7684\u5F15\u7528\u540D","list.credOverwrite":"{name}\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09","list.moreMatches":"\u8FD8\u6709 {count} \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009","list.noCredRef":"\u6CA1\u6709\u5339\u914D\u7684\u5F15\u7528","check.rememberCredential":"\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.rememberCredential":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u4FDD\u5B58\u4FEE\u6539\u300D\u6216\u300C\u8FDE\u63A5\uFF08\u5E76\u4FDD\u5B58\uFF09\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","btn.clearCredential":"\u6E05\u9664\u5DF2\u5B58\u51ED\u636E","error.credPlainUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","error.credPlainIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","status.credUnreported":"\u5F15\u7528 {ref}\uFF1A\u5BBF\u4E3B\u672A\u62A5\u544A\u72B6\u6001","error.credStatusFailed":"\u8BFB\u53D6\u51ED\u636E\u72B6\u6001\u5931\u8D25\uFF1A{error}","status.credStored":"\u5DF2\u5B58\u5165{source} \xB7 {ref}","meta.credSource":"\uFF08\u6765\u6E90 {source}\uFF09","status.credUnknown":"\u5F15\u7528 {ref}\uFF1A\u5B58\u50A8\u91CC\u8FD8\u6CA1\u6709\u8FD9\u4E2A\u503C","hint.noCredRefPassphrase":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u53EF\u5728\u79C1\u94A5\u53E3\u4EE4\u6846\u76F4\u63A5\u624B\u8F93 env:NAME","hint.noCredRefPassword":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","section.options":"\u9009\u9879","section.advanced":"\u9AD8\u7EA7","hint.advanced":"\u8DF3\u677F\u673A \xB7 \u4EE3\u7406\u547D\u4EE4 \xB7 \u4E3B\u673A\u5BC6\u94A5\u522B\u540D","meta.advancedConfigured":"\u5DF2\u914D\u7F6E\uFF1A{items}","check.agentForward":"agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09","hint.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740\uFF1B\u540C\u4E00\u4E3B\u673A\u7ECF\u591A\u5730\u5740\u89E6\u8FBE\u65F6\u586B\u522B\u540D\u53EF\u5171\u7528\u6307\u7EB9\u8BB0\u5F55\u3002","hint.hostKeyAliasFull":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740\u8BB0\u4F4F\u6307\u7EB9\u3002\u540C\u4E00\u53F0\u4E3B\u673A\u7ECF\u4E0D\u540C\u5730\u5740\uFF08\u8DF3\u677F\u673A\u540E / \u7AEF\u53E3\u8F6C\u53D1\uFF09\u89E6\u8FBE\u65F6\uFF0C\u586B\u540C\u4E00\u4E2A\u522B\u540D\u53EF\u8BA9\u5B83\u4EEC\u5171\u7528\u4E00\u6761\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF0C\u907F\u514D\u6BCF\u6B21\u5207\u6362\u5730\u5740\u90FD\u62A5\u300C\u6307\u7EB9\u53D8\u66F4\u300D\uFF1B\u53EA\u5F71\u54CD\u6307\u7EB9\u8BB0\u5728\u54EA\uFF0C\u4E0D\u6539\u8FDE\u63A5\u5730\u5740","placeholder.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740","check.persist":"\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","check.saveToBook":"\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09","field.bookName":"\u8FDE\u63A5\u7C3F\u540D\u79F0","placeholder.bookName":"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D","error.hostUserRequired":"\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B","error.keyPathRequired":"auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84","error.passwordRequired":"auth=password \u9700\u8981\u5BC6\u7801","btn.cancel":"\u53D6\u6D88","btn.connect":"\u8FDE\u63A5","btn.fileBrowse":"\u6587\u4EF6\u6D4F\u89C8","btn.browseTitle":"\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8","btn.probe":"\u8BD5\u8FDE","btn.probeTitle":"\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","error.saveCredFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","btn.saveEdit":"\u4FDD\u5B58\u4FEE\u6539","error.saveBookFailed":"\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A{error}","error.bookNameTaken":"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: {name}","panel.sftpDual":"SFTP \u53CC\u680F \xB7 {label}","status.failed":"\u5931\u8D25","status.done":"\u5B8C\u6210","placeholder.localPath":"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","placeholder.remotePath":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","btn.refresh":"\u5237\u65B0","btn.mkdir":"\u65B0\u5EFA\u76EE\u5F55","btn.hiddenFiles":"\u9690\u85CF\u6587\u4EF6","btn.hiddenFilesTitle":"\u663E\u793A / \u9690\u85CF\u4EE5 . \u5F00\u5934\u7684\u6587\u4EF6\uFF08.env\u3001.gitignore \u7B49\uFF09","error.dirNotReady":"\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210","meta.dir":"\u76EE\u5F55","btn.transferTo":"\u4F20\u8F93\u5230{target}\uFF1A{path}","meta.local":"\u672C\u673A","meta.remote":"\u8FDC\u7A0B","error.transferDirsNotReady":"\u4E24\u4FA7\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210\uFF0C\u7B49\u5217\u8868\u52A0\u8F7D\u540E\u518D\u4F20\u8F93","msg.transferring":"\u4F20\u8F93 {name}\u2026","error.transferFailed":"\u4F20\u8F93\u5931\u8D25","error.noTaskId":"\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id","msg.transferCanceled":"\u5DF2\u53D6\u6D88\u4F20\u8F93 {name}","msg.transferred":"\u5DF2\u4F20\u8F93 {name}","btn.download":"\u4E0B\u8F7D {name}","btn.rename":"\u91CD\u547D\u540D {name}","placeholder.newName":"\u65B0\u540D\u79F0","btn.deleteEntry":"\u5220\u9664 {name}","btn.deleteEntryDir":"\u5220\u9664 {name}\uFF08\u542B\u5185\u5BB9\uFF09","msg.deleted":"\u5DF2\u5220\u9664 {name}","list.parentDir":"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","list.emptyDir":"\uFF08\u7A7A\u76EE\u5F55\uFF09","list.hiddenOnly":"\uFF08\u8FD9\u91CC\u53EA\u6709\u9690\u85CF\u6587\u4EF6 \u2014 \u70B9\u680F\u4E0A\u7684\u300C\u9690\u85CF\u6587\u4EF6\u300D\u663E\u793A\uFF09","error.dropOnLocalPane":"\u62D6\u5230\u672C\u673A\u680F\u6CA1\u6709\u53EF\u6267\u884C\u7684\u52A8\u4F5C\uFF1A\u672C\u673A\u6587\u4EF6\u8981\u4F20\u5230\u5BF9\u9762\uFF0C\u8BF7\u62D6\u5230\u53F3\u4FA7\u300C\u8FDC\u7A0B\u300D\u680F","list.truncated":"\u2026\u5176\u4F59 {rest} \u9879\u672A\u6E32\u67D3\uFF08\u5171 {total} \u9879\uFF09\u2014\u2014\u7528\u4E0A\u65B9\u8DEF\u5F84\u6846\u8DF3\u8F6C\u5230\u5B50\u76EE\u5F55\u5B9A\u4F4D","list.itemCount":"{count} \u9879","placeholder.newDirName":"\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09","msg.creatingDir":"\u521B\u5EFA\u76EE\u5F55 {name}\u2026","btn.ok":"\u786E\u5B9A","btn.confirm":"\u786E\u8BA4?","btn.cancelTransfer":"\u53D6\u6D88\u4F20\u8F93","msg.downloadCanceled":"\u5DF2\u53D6\u6D88\u4E0B\u8F7D {name}","msg.downloadResuming":"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u4ECE {offset} \u5904\u7EED\u4F20 {name}\u2026","error.downloadFailed":"\u4E0B\u8F7D\u5931\u8D25","msg.downloaded":"\u5DF2\u4E0B\u8F7D {name}\uFF08{size}\uFF09","error.downloadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08{size}\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","msg.canceled":"\u5DF2\u53D6\u6D88","btn.upload":"\u4E0A\u4F20","btn.uploadTitle":"\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868","msg.uploading":"\u4E0A\u4F20\u4E2D\u2026","msg.uploadDone":"\u4E0A\u4F20\u5B8C\u6210","error.uploadFailed":"\u4E0A\u4F20\u5931\u8D25","error.networkError":"\u7F51\u7EDC\u9519\u8BEF","error.uploadCountExceeded":"\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08{max}\uFF09\uFF1A\u672C\u6B21 {count} \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","status.overLimit":"\u8D85\u9650","error.uploadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08{size}\uFF09\uFF1A{name}\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error.uploadTotalTooBig":"\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","msg.uploadCanceled":"\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 {done}/{total} \u4E2A\uFF09","status.allDone":"\u5168\u90E8\u5B8C\u6210","msg.uploadDoneCount":"\u4E0A\u4F20\u5B8C\u6210 {count} \u4E2A\u6587\u4EF6","error.connectFailed":"\u8FDE\u63A5\u5931\u8D25\uFF1A{error}","status.connectingEllipsis":"\u8FDE\u63A5\u4E2D\u2026","status.connectedPid":"\u5DF2\u8FDE\u63A5 pid={pid}","status.connectedSsh":"SSH {target}\u5DF2\u8FDE\u63A5","status.exitedWith":"\u5DF2\u9000\u51FA {detail}","status.error":"\u9519\u8BEF\uFF1A{message}","status.retryHint":"{message} \xB7 \u70B9\u51FB\u91CD\u8BD5","btn.clickRetry":"\u70B9\u51FB\u91CD\u8BD5","status.disconnectedReconnecting":"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","status.disconnected":"\u8FDE\u63A5\u65AD\u5F00","status.reconnecting":"\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","error.copyFailed":"\u590D\u5236\u5931\u8D25\uFF1A\u5F53\u524D\u73AF\u5883\u4E0D\u5141\u8BB8\u8BBF\u95EE\u526A\u8D34\u677F\uFF08http \u8BBF\u95EE\u65F6\u8BF7\u6539\u7528 localhost \u6216\u7EC8\u7AEF\u5185\u5FEB\u6377\u952E\uFF09","status.initializing":"\u521D\u59CB\u5316\u2026","placeholder.search":"\u641C\u7D22 (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"\u641C\u7D22 (Ctrl+F)\uFF1AEnter \u4E0B\u4E00\u4E2A / Shift+Enter \u4E0A\u4E00\u4E2A","btn.clearTitle":"\u6E05\u5C4F","btn.minimizeTitle":"\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09","btn.minimize":"\u6700\u5C0F\u5316","btn.closePanelTitle":"\u5173\u95ED\u9762\u677F\u5E76\u7ED3\u675F\u5168\u90E8\u4F1A\u8BDD\uFF08\u6709\u4F1A\u8BDD\u8FD8\u5F00\u7740\u65F6\u4F1A\u5148\u786E\u8BA4\uFF1B\u53EA\u662F\u60F3\u6536\u8D77\u5C31\u70B9\u300C\u2014\u300D\uFF0C\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09","confirm.closeTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED\u9762\u677F\uFF1F","confirm.closeText":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF08\u9762\u677F\u91CC\u7684\u6807\u7B7E\u4F1A\u8DDF\u7740\u5173\u6389\uFF09\u3002","confirm.closeTextAgent":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.closeHint":"\u53EA\u662F\u60F3\u7ED9\u522B\u7684\u7A97\u53E3\u817E\u5730\u65B9\uFF1F\u70B9\u300C\u6700\u5C0F\u5316\u300D\u2014\u2014 \u4F1A\u8BDD\u4E0E\u8F93\u51FA\u90FD\u4FDD\u6301\u8FD0\u884C\u3002","confirm.closeOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED","confirm.tabsTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u6389\u8FD9\u4E9B\u6807\u7B7E\uFF1F","confirm.tabsText":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF0C\u5B83\u4EEC\u7684\u6807\u7B7E\u4E5F\u8DDF\u7740\u5173\u6389\u3002","confirm.tabsTextAgent":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.tabsHint":"\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\u53EA\u662F\u53EA\u8BFB\u4FDD\u7559\uFF0C\u6E05\u6389\u5B83\u4EEC\u4E0D\u4E22\u4EFB\u4F55\u4E1C\u897F\u3002","confirm.tabsOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD","btn.restoreDock":"\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3","panel.title":"\u7EC8\u7AEF","status.minimized":"\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D","error.configLoadFailed":"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25","error.saveTunnelFailed":"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25","error.tunnelNameTaken":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u540C\u4E00\u300C\u8FDE\u63A5\u7C3F\u6761\u76EE + \u65B9\u5411 + \u7AEF\u53E3\u300D\u53EA\u80FD\u6709\u4E00\u6761\u3002\u6539\u7AEF\u53E3\u4F1A\u5F97\u5230\u65B0\u540D\u5B57\uFF0C\u6216\u5148\u5220\u6389\u65E7\u7684\u90A3\u6761\u3002","msg.tunnelApplied":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u751F\u6548","msg.tunnelUpdated":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u66F4\u65B0","error.nameHostUserRequired":"\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B","msg.hostEdited":"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C{name}\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.probeFailed":"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A{error}","error.hostKeyDeleteFailed":"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25","msg.hostKeyDeleted":"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09","error.sshConfigReadFailed":"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25","msg.proxySkipped":"{count} \u6761\u7528\u4E86\u8DF3\u677F\u673A\u4F46\u89E3\u6790\u4E0D\u51FA\u8DF3\u677F\u673A\uFF08\u522B\u540D\u7F3A\u5931 / \u522B\u540D\u81EA\u5DF1\u8FD8\u4F9D\u8D56\u8DF3\u677F\u673A\uFF09\u672A\u5BFC\u5165\uFF1A{names}","msg.proxyCommandSkipped":"{count} \u6761\u53EA\u914D\u4E86\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF09\u672A\u5BFC\u5165\uFF1A{names} \u2014\u2014 \u4EE3\u7406\u547D\u4EE4\u662F\u300C\u672C\u673A\u6267\u884C\u4E00\u6761\u547D\u4EE4\u300D\u90A3\u4E00\u6863\uFF0C\u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\uFF1B\u9700\u8981\u65F6\u5728\u8FDE\u63A5\u7C3F\u91CC\u624B\u586B\u5E76\u6253\u5F00\u300C\u5141\u8BB8 ProxyCommand\u300D","msg.skippedNotConcrete":"{count} \u6761\u4E0D\u662F\u5177\u4F53\u4E3B\u673A\uFF08\u901A\u914D / \u65E0 User\uFF09","list.separator":"\u3001","meta.etc":" \u7B49","msg.importOverflow":"\u8D85\u8FC7\u5BFC\u5165\u4E0A\u9650\u7684 {count} \u6761\u672A\u5BFC\u5165","list.separatorFull":"\uFF1B","msg.noNewEntries":"\u6CA1\u6709\u65B0\u6761\u76EE\uFF08{count} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09","msg.noImportableHosts":"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","msg.importedHosts":"\u5DF2\u5BFC\u5165 {added} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 {skipped} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.knownHostsReadFailed":"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25","msg.noNewFingerprints":"\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08{count} \u6761\u5DF2\u5B58\u5728\uFF09","msg.noImportableKnownHosts":"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","error.saveHostKeysFailed":"\u4FDD\u5B58 hostKeys \u5931\u8D25","msg.importedFingerprints":"\u5DF2\u5BFC\u5165 {added} \u6761\u4E3B\u673A\u7684\u6307\u7EB9\uFF08\u8DF3\u8FC7 {skipped} \u6761\u5DF2\u5B58\u5728\uFF09","hint.knownHostsTruncated":"\uFF1B\u6CE8\u610F\uFF1Aknown_hosts \u8D85\u8FC7 500 \u6761\u4E3B\u673A\uFF0C\u672C\u6B21\u4EC5\u5BFC\u5165\u524D 500 \u6761","error.saveFailed":"\u4FDD\u5B58\u5931\u8D25","msg.saved":"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548","check.rememberCredentialApply":"\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.appliedOnSave":"\u968F\u5361\u7247\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","card.name":"\u7EC8\u7AEF\u9762\u677F","card.desc":"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\u3002","card.descFull":"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","list.loadingConfig":"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026","section.basic":"\u57FA\u7840","check.enabled":"\u542F\u7528\u63D2\u4EF6\uFF08\u4FDD\u5B58\u5373\u70ED\u751F\u6548\uFF1A\u5DE5\u5177\u4E0E\u9762\u677F\u5165\u53E3\u7ACB\u523B\u6536\u8D77\uFF0C\u4F1A\u8BDD\u8F6C\u4FDD\u6D3B\uFF09","check.announce":"\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","check.shellIntegration":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF09","check.shellIntegrationWindows":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF1Acwd \u8DDF\u968F\u3001\u9000\u51FA\u7801\u3001tty_expect \u4E0E\u300C\u6709\u6CA1\u6709\u547D\u4EE4\u5728\u8DD1\u300D\uFF09","hint.shellIntegrationWindows":"cmd \u6CA1\u6709\u547D\u4EE4\u5F00\u59CB/\u7ED3\u675F\u94A9\u5B50\uFF0C\u65E0\u6CD5\u6CE8\u5165\uFF1A\u628A\u300CShell \u8DEF\u5F84\u300D\u6362\u6210 powershell.exe \u6216 pwsh.exe\uFF08\u4E0B\u62C9\u5019\u9009\u91CC\u6709\uFF09\uFF0C\u518D\u786E\u8BA4\u8FD9\u4E2A\u5F00\u5173\u662F\u52FE\u4E0A\u7684\uFF08\u6B64\u524D\u7684 Windows \u88C5\u673A\u4E0A\u5B83\u53EF\u80FD\u5DF2\u88AB\u5B58\u6210\u5173\uFF09\u3002\u8FDC\u7A0B Linux / macOS \u4E3B\u673A\u7167\u65E7\u652F\u6301\u3002","hint.shellIntegrationPowerShell":"PowerShell \u5BB6\u65CF\u7531 `-File` \u6869\u6CE8\u5165\uFF1Acwd \u8DDF\u968F\u3001\u9000\u51FA\u7801\u3001tty_expect \u4E0E\u300C\u6709\u6CA1\u6709\u547D\u4EE4\u5728\u8DD1\u300D\u90FD\u53EF\u7528\u3002\u5DF2\u77E5\u9650\u5236\uFF1APowerShell 7 \u4E0A\u547D\u4EE4\u8F93\u51FA\u5728 ConPTY \u91CC\u665A\u4E8E D \u6807\u8BB0\u62B5\u8FBE\uFF0C`tty_capture{last}` \u53EF\u80FD\u53D6\u5230\u7A7A\u2014\u2014\u90A3\u91CC\u8BF7\u7528 `tty_capture` \u8BFB\u5C3E\u90E8\uFF08Windows PowerShell 5.1 \u4E0D\u53D7\u5F71\u54CD\uFF09\u3002","section.sftp":"SFTP \u6587\u4EF6\u4F20\u8F93","field.sftpStyle":"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C","option.sftpDialog":"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD","option.sftpDual":"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20","hint.sftpDual":"\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","field.sftpLimits":"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09","field.downloadLimit":"\u4E0B\u8F7D\u4E0A\u9650 (MB)","field.uploadLimit":"\u4E0A\u4F20\u4E0A\u9650 (MB)","field.uploadCountLimit":"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650","hint.sftpLimits":"\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","section.session":"\u4F1A\u8BDD","field.persistence":"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09","option.persistOff":"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09","option.persistTmux":"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316","hint.persistence":"\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","hint.persistenceWindows":"\uFF1BWindows \u5BBF\u4E3B\u4E0A tmux \u4E0D\u53EF\u7528\uFF0C\u672C\u5730\u6807\u7B7E\u4F1A\u7167\u5E38\u6253\u5F00\u4F46\u4E0D\u53D7\u6258\u7BA1","check.endOnPageClose":"\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","check.statsEnabled":"\u670D\u52A1\u5668\u72B6\u6001\u6761\uFF08CPU / \u5185\u5B58 / \u78C1\u76D8 / \u5728\u7EBF / TCP / \u7F51\u901F\uFF1B\u91C7\u4E0D\u5230\u7684\u9879\u663E\u793A\u300C\u65E0\u300D\uFF09","hint.statsEnabled":"\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","check.allowProxyCommand":"\u5141\u8BB8 ProxyCommand\uFF08\u672C\u673A\u6267\u884C\u547D\u4EE4\uFF1B\u9ED8\u8BA4\u5173\uFF09","hint.allowProxyCommand":"\u6253\u5F00\u540E\uFF0C\u8FDE\u63A5\u7C3F\u6761\u76EE\u91CC\u586B\u7684\u4EE3\u7406\u547D\u4EE4\u4F1A\u5728\u8FD9\u53F0\u673A\u5668\u4E0A\u6267\u884C\uFF0C\u5B83\u7684 stdin/stdout \u5F53\u4F5C\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u8FD9\u662F\u672C\u63D2\u4EF6\u552F\u4E00\u300C\u914D\u7F6E\u91CC\u5199\u4E00\u884C\u5C31\u5728\u672C\u673A\u8DD1\u547D\u4EE4\u300D\u7684\u5F00\u5173\uFF0C\u6240\u4EE5\u9ED8\u8BA4\u5173\uFF1A\u5173\u7740\u65F6\u643A\u5E26\u4EE3\u7406\u547D\u4EE4\u7684\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002~/.ssh/config \u5BFC\u5165\u6C38\u4E0D\u81EA\u52A8\u5E26\u5165\u4EE3\u7406\u547D\u4EE4\u3002","field.maxSessions":"\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","hint.maxSessions":"\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548","field.shell":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","field.shellWindows":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 %COMSPEC%\uFF09","placeholder.shell":"\u7559\u7A7A\u4F7F\u7528 $SHELL","placeholder.shellWindows":"\u7559\u7A7A\u4F7F\u7528 %COMSPEC%\uFF08\u4E5F\u53EF\u586B powershell.exe / pwsh.exe \u5B8C\u6574\u8DEF\u5F84\uFF09","list.noShellCandidate":"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF","hint.shellCandidatesWindows":"Windows \u5BBF\u4E3B\uFF1A\u5019\u9009\u6765\u81EA %COMSPEC% \u4E0E\u5DF2\u5B89\u88C5\u7684 PowerShell\uFF08Windows PowerShell 5.1 / PowerShell 7\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1BPowerShell \u5BB6\u65CF\u652F\u6301 shell \u96C6\u6210\uFF08`-File` \u6869\u6CE8\u5165 OSC 133/7\uFF09\uFF0Ccmd \u6CA1\u6709\u547D\u4EE4\u8FB9\u754C\u94A9\u5B50\u3001\u4E0D\u652F\u6301","hint.shellCandidates":"\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","hint.term":"TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C","field.cwd":"\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","placeholder.cwd":"\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55","field.grace":"\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","hint.grace":"\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","section.assist":"AI \u8F85\u52A9","check.assistEnabled":"\u5931\u8D25\u5373\u89E3\u91CA\uFF08\u547D\u4EE4\u975E\u96F6\u9000\u51FA\u65F6\u95EE\u6A21\u578B\u300C\u4E3A\u4EC0\u4E48 / \u4E0B\u4E00\u6B65\u300D\uFF09","hint.assistEnabled":"\u9ED8\u8BA4\u5173\u3002\u5F00\u542F\u540E\uFF0C\u547D\u4EE4\u4EE5\u975E\u96F6\u72B6\u6001\u7ED3\u675F\u65F6\u7EC8\u7AEF\u53F3\u4E0B\u89D2\u4F1A\u51FA\u73B0\u4E00\u679A\u5FBD\u6807\uFF1B\u70B9\u5B83\u624D\u628A\u90A3\u6761\u547D\u4EE4\u7684\u300C\u8F93\u51FA\u5C3E\u90E8\u300D\uFF08\u5265\u79BB\u989C\u8272\u4E0E\u8FDB\u5EA6\u6761\u3001\u6298\u6389\u91CD\u590D\u884C\u3001\u5BC6\u94A5/token \u5DF2\u906E\u76D6\uFF09\u8FDE\u540C\u5F53\u524D\u5C4F\u5E55\u53D1\u7ED9\u6A21\u578B\uFF0C\u4E0D\u53D1 scrollback\u3002\u6A21\u578B\u7ED9\u7684\u547D\u4EE4\u53EA\u4F1A\u300C\u586B\u5165\u300D\u547D\u4EE4\u884C\uFF0C\u6C38\u4E0D\u66FF\u4F60\u56DE\u8F66\u3002","field.assistRoute":"\u6A21\u578B\u8DEF\u7531\uFF08\u53EF\u9009\uFF09","hint.assistRoute":"\u7559\u7A7A\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","option.followHostModel":"\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","list.modelLoading":"\u6B63\u5728\u53D6\u5019\u9009\u2026","list.noModelCandidate":"\u5BBF\u4E3B\u6CA1\u6709\u53EF\u7528\u7684\u6A21\u578B","list.modelCatalogFailed":"\u62FF\u4E0D\u5230\u5019\u9009\uFF1A\u5BBF\u4E3B\u53EF\u80FD\u8FD8\u6CA1\u91CD\u542F\uFF0C\u6216\u6CA1\u6709\u63D0\u4F9B\u6A21\u578B\u76EE\u5F55\uFF08\u624B\u8F93\u8BF7\u6309 provider/model\uFF09","badge.assistFailed":"\u547D\u4EE4\u5931\u8D25\uFF08{code}\uFF09\xB7 \u89E3\u91CA\u4E00\u4E0B","panel.assistTitle":"\u8FD9\u6761\u547D\u4EE4\u4E3A\u4EC0\u4E48\u5931\u8D25","panel.assistCommand":"\u5EFA\u8BAE\u547D\u4EE4","status.assistThinking":"\u6B63\u5728\u95EE\u6A21\u578B\u2026","error.assistRequest":"\u89E3\u91CA\u5931\u8D25\uFF1A{message}","btn.assistFill":"\u586B\u5165\u547D\u4EE4\u884C","btn.assistCopy":"\u590D\u5236\u7B54\u6848","btn.assistCopyError":"\u590D\u5236\u62A5\u9519","btn.assistClose":"\u5173\u95ED","hint.assistFillNoEnter":"\u53EA\u5199\u8FDB\u547D\u4EE4\u884C\uFF0C\u4E0D\u4F1A\u66FF\u4F60\u56DE\u8F66","hint.assistNoCommand":"\u6A21\u578B\u6CA1\u7ED9\u51FA\u53EF\u76F4\u63A5\u586B\u7684\u547D\u4EE4 \u2014 \u7528\u300C\u590D\u5236\u300D\u81EA\u5DF1\u6311","section.ssh":"SSH \u8FDE\u63A5","btn.probeRowTitle":"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD","msg.testing":"\u6D4B\u8BD5\u4E2D\u2026","btn.test":"\u6D4B\u8BD5","btn.edit":"\u7F16\u8F91","btn.delete":"\u5220\u9664","list.emptySshHosts":"\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","btn.importSshConfig":"\u4ECE ~/.ssh/config \u5BFC\u5165","hint.importSshConfig":"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","hint.sshBook":"\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","check.tunnelEnabled":"\u542F\u7528","list.emptyTunnels":"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3","field.direction":"\u8F6C\u53D1\u65B9\u5411","option.localForwardTitle":"\u672C\u5730\u8F6C\u53D1 -L\uFF1A\u672C\u673A\u76D1\u542C\uFF0C\u8FDE\u5230 SSH \u670D\u52A1\u5668\u4FA7\u7684\u76EE\u6807","option.localForward":"\u672C\u5730 -L","option.remoteForwardTitle":"\u8FDC\u7A0B\u8F6C\u53D1 -R\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C\uFF0C\u62E8\u56DE\u672C\u673A\u670D\u52A1","option.remoteForward":"\u8FDC\u7A0B -R","option.selectBook":"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelViaBook":"\u7ECF {book} \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelBookEmpty":"\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","hint.localListenFixed":"\u672C\u673A\u76D1\u542C\u5730\u5740\u56FA\u5B9A 127.0.0.1\uFF08\u4E0D\u66B4\u9732\u5230\u5C40\u57DF\u7F51\uFF09","placeholder.localPort":"\u672C\u673A\u7AEF\u53E3","field.localListenPort":"\u672C\u673A\u76D1\u542C\u7AEF\u53E3","hint.flowLocalToRemote":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2192 SSH \u670D\u52A1\u5668\u4FA7","placeholder.remoteHost":"\u670D\u52A1\u5668\u4FA7\u4E3B\u673A","hint.remoteHostTitle":"\u76EE\u6807\u4E3B\u673A\u540D\u6216 IP\uFF08\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF1B127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09","field.remoteHost":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u4E3B\u673A","placeholder.port":"\u7AEF\u53E3","field.remotePort":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u7AEF\u53E3","placeholder.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","hint.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740\uFF08\u7F3A\u7701 127.0.0.1\uFF1B\u7559\u7A7A\u5373\u53EA\u8BA9\u670D\u52A1\u5668\u81EA\u5DF1\u8BBF\u95EE\uFF09","field.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","placeholder.listenPort":"\u76D1\u542C\u7AEF\u53E3","field.remoteListenPort":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u7AEF\u53E3","hint.flowRemoteToLocal":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2190 SSH \u670D\u52A1\u5668\u4FA7","hint.localDialFixed":"\u672C\u673A\u62E8\u53F7\u5730\u5740\u56FA\u5B9A 127.0.0.1","placeholder.localTargetPort":"\u672C\u673A\u670D\u52A1\u7AEF\u53E3","field.localTargetPort":"\u672C\u673A\u76EE\u6807\u7AEF\u53E3","hint.tunnelLocalSummary":"\u5DE6\uFF1A\u672C\u673A\u76D1\u542C\uFF08\u56FA\u5B9A 127.0.0.1\uFF09\u2192 \u53F3\uFF1A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\u7684\u76EE\u6807","hint.tunnelRemoteSummary":"\u5DE6\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C \u2192 \u53F3\uFF1A\u672C\u673A\u88AB\u8BBF\u95EE\u7684\u670D\u52A1\uFF08\u56FA\u5B9A 127.0.0.1\uFF09","btn.addTunnel":"\u6DFB\u52A0\u96A7\u9053","hint.tunnelAdd":"\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","hint.tunnelEditing":"\u6B63\u5728\u7F16\u8F91\u300C{name}\u300D\u2014\u2014\u6539\u7AEF\u53E3/\u6761\u76EE\u4F1A\u6309\u89C4\u5219\u751F\u6210\u65B0\u540D\u5B57\uFF1B\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548","panel.hostKeys":"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09","btn.importKnownHosts":"\u4ECE known_hosts \u5BFC\u5165","list.emptyHostKeys":"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9","hint.hostKeys":"\u4E00\u673A\u591A\u628A\u94A5\u5319\uFF08\u5982 rsa + ed25519\uFF09\u5404\u8BB0\u4E00\u6761\u6307\u7EB9\uFF0C\u4EFB\u4E00\u5339\u914D\u5373\u653E\u884C\uFF1B\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF0C\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE","msg.saving":"\u4FDD\u5B58\u4E2D\u2026","btn.save":"\u4FDD\u5B58","list.none":"\u65E0","meta.mem":"\u5185\u5B58","meta.disk":"\u78C1\u76D8","meta.cores":"\u6838\u5FC3","meta.uptime":"\u5728\u7EBF","meta.temp":"CPU\u6E29\u5EA6","meta.net":"\u7F51\u7EDC","error.tunnelNoBook":"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE","error.tunnelRemotePortRequired":"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09","error.tunnelLocalRequired":"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B","error.tunnelMissing":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u4E0D\u5B58\u5728\uFF08\u53EF\u80FD\u88AB\u53E6\u4E00\u4E2A\u7A97\u53E3\u5220\u9664\uFF09","error.tunnelClash":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u8BF7\u5148\u5904\u7406\u90A3\u6761\u540C\u540D\u7684\u3002","msg.renaming":"\u91CD\u547D\u540D {name}\u2026","msg.deleting":"\u5220\u9664 {name}\u2026","msg.downloading":"\u4E0B\u8F7D {name}\u2026","msg.uploadingName":"\u4E0A\u4F20 {name}","error.invalidTaskState":"\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001","hint.rememberCredentialApply":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u5E94\u7528\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","hint.noCredRefPasswordApply":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","hint.bookNameConflict":"\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD","btn.apply":"\u5E94\u7528"},R_={"error.credServiceMissing":"The host does not provide the credential service (remote.credentials)","error.credServiceIncomplete":"The credential service is incomplete","error.credStoreUnavailable":"The host does not provide the credential service (remote.credentials); cannot store","error.credStoreFailed":"Failed to store the credential: {error}","error.credClearUnavailable":"The host does not provide the credential service (remote.credentials); cannot clear","error.credClearFailed":"Failed to clear: {error}","error.credRefNeedsHost":"Fill in host and username first \u2014 the reference name is derived from them","btn.reopen":"Reopen","btn.reopenTitle":"Reopen the session with the original connection settings","btn.sftpTitle":"Open the SFTP file browser for this connection","btn.tunnels":"Tunnels {count}","btn.tunnelsTitle":"View the port-forwarding tunnels of this connection","btn.more":"More","btn.moreTitle":"More actions (port forwarding\u2026)","btn.reopenSession":"Reopen session","status.exited":"Session exited","status.ended":"Session ended","btn.clickRerun":"Click to run again","status.aiEnded":"The AI finished this session","hint.aiEndedTab":"The content stays for now: switch away or hit \u201CDismiss\u201D to close this tab","btn.dismiss":"Dismiss","btn.dismissTitle":"Close this tab (the session has already ended)","hint.reopenWithSpec":"Open a session again from the same spec (persistent tabs reattach to tmux, command tabs run again)","btn.newLocalTerminal":"New local terminal","hint.reopenAgentLocal":"This session was opened by the AI and has ended: this opens a new local terminal, it does not reattach to the original one","msg.passwordNotStored":"For security, plaintext passwords/passphrases are not kept in browser storage, so this connection needs them again: re-enter them when reopening the tab, or switch the credential to an env: reference in the settings card (the value lives in the host credential store).","error.terminalNeedsCommand":"ttyTerminal requires a command","error.terminalCommandSingleLine":"command must be a single line","error.terminalNeedsHost":"ttyTerminal.mount requires an HTMLElement as the mount point","error.panelNotReady":"ttyPanel.mountPane: the terminal panel is not ready","panel.dragHeight":"Drag to resize height","panel.dragWidth":"Drag to resize width","btn.closePane":"Close the side pane","btn.expandPane":"Expand the side pane","btn.collapsePane":"Collapse the side pane","panel.tabLabel":"Terminal {n}","btn.close":"Close","btn.closeTabAria":"Close tab: {label}","btn.newTab":"New (local / SSH)","btn.tabList":"Tab list","btn.tabListTitle":"Tab list ({n})","list.tabsAllVisible":"No tabs are out of view","list.cleanExited":"Clean up exited tabs ({n})","btn.closeTab":"Close this tab","btn.hideFromAgent":"Hide this tab from the AI","btn.showToAgent":"Unhide (make it available to the AI)","btn.hiddenMark":"Hidden from AI","btn.closeLeft":"Close tabs to the left ({n})","btn.closeOthers":"Close other tabs ({n})","btn.closeRight":"Close tabs to the right ({n})","list.subLive":"{n} of them are still open","meta.tunnelRemote":"remote:{host}:{port} \u2192 local:{local}","meta.tunnelLocal":"local:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"Hosted by tmux \u2014 the session is reattached by name after a disconnect or host restart","status.notPersisted":"Not persisted","status.tmuxUnavailableTitle":"A persistent session was requested but tmux is unavailable \u2014 this is a plain session","status.connected":"Connected","status.connecting":"Connecting","status.errored":"Connection error","panel.tunnels":"Port forwarding","hint.tunnelsSettings":"Configure in Settings \u2192 Plugins \u2192 Terminal panel","panel.tunnelsFor":"Port forwarding \u2014 {name}","list.loading":"Loading\u2026","hint.tunnelsCard":"Add, remove, enable, or disable tunnels in the port-forwarding section of Settings \u2192 Plugins \u2192 Terminal panel","list.noActiveTunnels":"No enabled tunnels for this connection","status.fatalSuffix":" (no retry; fix the config)","msg.maxSessions":"Session limit reached ({live} total / max {max}: {own} in this window{others}) \u2014 close unused windows or tabs, or raise \u201CConcurrent session limit\u201D in the settings card","msg.maxSessionsOthers":" + {count} in other windows","error.probeHttp":"Connection test failed (HTTP {status})","msg.probing":"Testing the connection\u2026","meta.reachable":"reachable","meta.unreachable":"unreachable","meta.probeBanner":"banner ok","meta.hostKeyMatched":"Host key matched","meta.hostKeyRecorded":"Host key recorded (TOFU)","meta.hostKeyMismatch":"Host key mismatch!","meta.authOkMs":"Authenticated ({ms}ms)","meta.authOk":"Authenticated","meta.probeOk":"\u2705 Connected: {detail}","error.unknown":"Unknown error","btn.maxSessionsTitle":"Session limit reached \u2014 click to see what to do","option.localTerminal":"Local terminal","hint.tmuxHosted":"Hosted by tmux \xB7 recoverable after a host restart","hint.openInSessionCwd":"Open in the current session working directory","panel.sshBook":"SSH host book","btn.sftpFileBrowse":"SFTP file browser","btn.editConnection":"Edit connection","list.emptySshBook":"(empty \u2014 save one in the settings card or via \u201CSSH connection\u2026\u201D)","option.sshConnect":"SSH connection\u2026","hint.sshConnect":"Fill in host, user, and authentication manually","panel.editConnection":"Edit connection \xB7 {name}","panel.sshConnect":"SSH connection","section.jump":"Jump host","field.jumpHost":"Jump host ([user@]host[:port]; empty = direct)","placeholder.jumpHost":"e.g. bastion.corp:2222","check.jumpOwnCred":"Use separate credentials for the jump host","field.jumpUsername":"Jump host user (empty = same as the target)","field.jumpAuth":"Jump host auth (empty = same as the target)","hint.jumpInherit":"Empty credentials reuse the target host\u2019s auth method and keys.","hint.jumpInheritFull":"Empty credentials reuse the target host\u2019s auth method and keys. When the jump host itself is unreachable the error names it (it will not masquerade as a target timeout).","meta.jumpStage":"Jump host {label}","meta.viaJump":"\u21E2 via {label}","meta.viaProxy":"\u21E2 via proxy command","section.proxyCommand":"Proxy command","field.proxyCommand":"Proxy command (ProxyCommand; empty = unused)","placeholder.proxyCommand":"e.g. ssh -W %h:%p bastion","hint.proxyCommand":"A command on this machine whose stdin/stdout become the SSH transport; a jump host wins if both are set.","hint.proxyCommandFull":"A command run on this machine whose stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). Supports %h host, %p port, %r user, %n host and %% for a literal %; anything else is left as written. If a jump host is set too, the jump host wins (OpenSSH semantics). It needs the switch below, and importing ~/.ssh/config never fills it in.","hint.proxyCommandDisabled":"\u26A0 \u201CAllow ProxyCommand\u201D is off right now: this command will not run and the connection fails explicitly (it does not fall back to a direct connection). Turn it on in Plugin settings \u2192 Terminal panel.","hint.proxyCommandNotGranted":"\u26A0 Not granted by the host: clicking this switch starts a grant in place (the panel shows one command to run in a terminal on the host \u2014 no restart), or use the strictest route \u2014 export DSH_TTY_ALLOW_PROXY_COMMAND=1 in the environment that launched dsh and restart the host (setting it after launch does not count). The reason: cross-site pages and in-page scripts can both send loopback requests, so if the settings UI could raise it out of thin air this gate would be pointless. Turning it off always works.","badge.notEffective":"Not effective: not granted by the host","elev.title":"Grant in place (no restart)","elev.lockedWhy":"Any local process can send loopback requests, so \u201Cturn on a dangerous capability\u201D cannot be decided by this page alone \u2014 it has to be confirmed on the host\u2019s filesystem once.","elev.step":"Run the command below in a terminal on the host and the switch unlocks by itself:","elev.copy":"Copy command","elev.copied":"Copied","elev.copyManual":"The clipboard is unavailable here \u2014 select the command above and copy it manually.","elev.expiresIn":"expires in {sec}s","elev.expired":"This confirmation has expired \u2014 generate a new one.","elev.waiting":"Waiting for confirmation\u2026 once you run the command this turns into \u201Cgranted\u201D automatically.","elev.regenerate":"Generate a new one","elev.loading":"Generating the confirmation command\u2026","elev.granted":"Granted and now in effect.","elev.grantedNeedSave":"Granted. Press \u201CSave\u201D to apply.","elev.grantedAt":"Granted \xB7 {time}","elev.revoke":"Revoke host grant","elev.revoked":"Host grant revoked (the config switch is left untouched; granting again takes effect immediately).","elev.viaEnv":"Granted by a launch environment variable; to revoke, remove it from the launch environment and restart the host.","elev.close":"Collapse","elev.disableFirst":"Turn this config switch off first","elev.otherWay":"The other way (strongest, needs a host restart)","elev.envHow":"In the environment that launched dsh: export {env}=1, then restart the host. Setting it after launch \u2014 or writing it into some other config file \u2014 does not count as a grant; that is exactly what this gate guards against.","elev.error":"In-place grant failed: ","meta.probeProxy":"Proxy command","meta.probeProxyOff":"Proxy command (disabled)","meta.probeTcpSkipped":"Direct TCP check skipped (using the proxy command)","section.connection":"Connection","field.host":"Host","placeholder.host":"example.com or IP","field.port":"Port","field.username":"Username","section.auth":"Authentication","field.authMethod":"Auth method","option.authInherit":"(same as the target)","option.authAgent":"agent \u2014 use the local ssh-agent","option.authKey":"key \u2014 private key file","option.authPassword":"password \u2014 password","field.keyPath":"Private key path","field.hostKeyAlias":"Host key alias","field.passphrase":"Key passphrase (optional)","field.password":"Password","placeholder.credRef":"Or: pick a reference name from the credential store","hint.credRefCandidates":"Candidates = reference names already in the credential store + those in use by the local host book","list.credOverwrite":"{name} (click again to overwrite)","list.moreMatches":"{count} more \u2014 keep typing to filter","list.noCredRef":"No matching reference","check.rememberCredential":"Store in the credential store on save","hint.rememberCredential":"When checked, \u201CSave changes\u201D or \u201CConnect (and save)\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","btn.clearCredential":"Clear stored credential","error.credPlainUnavailable":"The host does not provide the credential service (remote.credentials); plaintext save only","error.credPlainIncomplete":"The credential service is incomplete; plaintext save only","status.credUnreported":"Reference {ref}: the host reported no status","error.credStatusFailed":"Failed to read the credential status: {error}","status.credStored":"Stored{source} \xB7 {ref}","meta.credSource":" (source: {source})","status.credUnknown":"Reference {ref}: the store does not have this value yet","hint.noCredRefPassphrase":"No other connection uses a credential reference yet \u2014 you can type env:NAME straight into the passphrase box","hint.noCredRefPassword":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on save\u201D above to create one, or type env:NAME straight into the password box","section.options":"Options","section.advanced":"Advanced","hint.advanced":"Jump host \xB7 Proxy command \xB7 Host key alias","meta.advancedConfigured":"Configured: {items}","check.agentForward":"agent forwarding (the remote side can use local ssh-agent keys, e.g. remote git clone)","hint.hostKeyAlias":"Empty = pin by host address; one alias shares a fingerprint record across addresses.","hint.hostKeyAliasFull":"Empty = pin the fingerprint by host address. When one host is reached through different addresses (behind a bastion / via port forwarding), give them the same alias so they share one host-key record instead of reporting a fingerprint change on every switch; it only decides where the fingerprint is stored, never the connection address","placeholder.hostKeyAlias":"Empty = by host address","check.persist":"Persistent session (hosted by tmux, survives a disconnect/restart; tmux must be installed on the remote)","check.saveToBook":"Save to the host book (overwrite the same name)","field.bookName":"Host book name","placeholder.bookName":"Leave empty to use the host name","error.hostUserRequired":"Host and username are required","error.keyPathRequired":"auth=key requires a private key path","error.passwordRequired":"auth=password requires a password","btn.cancel":"Cancel","btn.connect":"Connect","btn.fileBrowse":"File browser","btn.browseTitle":"Open the SFTP file browser with the values currently filled in, without touching a terminal","btn.probe":"Test","btn.probeTitle":"Diagnose the connection with the values currently filled in (TCP \u2192 host key \u2192 authentication); no session is created and no host fingerprint is recorded","error.saveCredFailed":"Save failed: {error}","btn.saveEdit":"Save changes","error.saveBookFailed":"Failed to save the host book: {error}","error.bookNameTaken":"The host book already has an entry named: {name}","panel.sftpDual":"SFTP dual pane \xB7 {label}","status.failed":"Failed","status.done":"Done","placeholder.localPath":"Local path (Enter to go)","placeholder.remotePath":"Remote path (Enter to go)","btn.refresh":"Refresh","btn.mkdir":"New folder","btn.hiddenFiles":"Hidden files","btn.hiddenFilesTitle":"Show / hide dot-files (.env, .gitignore, \u2026)","error.dirNotReady":"The directory is not resolved yet","meta.dir":"folder","btn.transferTo":"Transfer to {target}: {path}","meta.local":"local","meta.remote":"remote","error.transferDirsNotReady":"Both directories are not resolved yet; wait for the lists to load before transferring","msg.transferring":"Transferring {name}\u2026","error.transferFailed":"Transfer failed","error.noTaskId":"The server returned no task id","msg.transferCanceled":"Transfer canceled: {name}","msg.transferred":"Transferred {name}","btn.download":"Download {name}","btn.rename":"Rename {name}","placeholder.newName":"New name","btn.deleteEntry":"Delete {name}","btn.deleteEntryDir":"Delete {name} (with contents)","msg.deleted":"Deleted {name}","list.parentDir":".. (parent folder)","list.emptyDir":"(empty folder)","list.hiddenOnly":"(only hidden files here \u2014 click \u201CHidden files\u201D on the pane header to show them)","error.dropOnLocalPane":"Dropping onto the local pane has no action: to send local files to the other side, drop them on the right-hand \u201CRemote\u201D pane","list.truncated":"\u2026{rest} more not rendered ({total} total) \u2014 use the path box above to jump to a subfolder","list.itemCount":"{count} items","placeholder.newDirName":"New folder name (relative to the current folder)","msg.creatingDir":"Creating folder {name}\u2026","btn.ok":"OK","btn.confirm":"Confirm?","btn.cancelTransfer":"Cancel transfer","msg.downloadCanceled":"Download canceled: {name}","msg.downloadResuming":"Connection dropped \u2014 resuming {name} from {offset}\u2026","error.downloadFailed":"Download failed","msg.downloaded":"Downloaded {name} ({size})","error.downloadTooBig":"The file exceeds the download limit ({size}); use dual-pane \u21E6 direct transfer or scp/rsync in the terminal","msg.canceled":"Canceled","btn.upload":"Upload","btn.uploadTitle":"Pick files to upload, or drag files/folders straight into the list","msg.uploading":"Uploading\u2026","msg.uploadDone":"Upload finished","error.uploadFailed":"Upload failed","error.networkError":"Network error","error.uploadCountExceeded":"Too many files (limit {max}): {count} this time \u2014 upload in batches","status.overLimit":"Over the limit","error.uploadTooBig":"The file exceeds the upload limit ({size}): {name} \u2014 use dual-pane \u21E8 direct transfer or scp/rsync in the terminal","error.uploadTotalTooBig":"The total size exceeds the upload limit: upload in batches (or use dual-pane \u21E8 direct transfer)","msg.uploadCanceled":"Upload canceled ({done}/{total} done)","status.allDone":"All done","msg.uploadDoneCount":"Uploaded {count} files","error.connectFailed":"Connection failed: {error}","status.connectingEllipsis":"Connecting\u2026","status.connectedPid":"Connected pid={pid}","status.connectedSsh":"SSH {target}connected","status.exitedWith":"Exited {detail}","status.error":"Error: {message}","status.retryHint":"{message} \xB7 click to retry","btn.clickRetry":"Click to retry","status.disconnectedReconnecting":"Disconnected \u2014 reconnecting","status.disconnected":"Disconnected","status.reconnecting":"Reconnecting\u2026","error.copyFailed":"Copy failed: this environment does not allow clipboard access (over http, use localhost or the terminal's own shortcuts)","status.initializing":"Initializing\u2026","placeholder.search":"Search (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"Search (Ctrl+F) \u2014 Enter next / Shift+Enter previous","btn.clearTitle":"Clear","btn.minimizeTitle":"Minimize (sessions keep running; the status moves into the sidebar entry)","btn.minimize":"Minimize","btn.closePanelTitle":"Close the panel and end every session (you are asked first when sessions are still open; to just put it away hit \u201C\u2014\u201D, sessions keep running)","confirm.closeTitle":"End {n} sessions and close the panel?","confirm.closeText":"Closing the panel ends these {n} sessions that are still open (the tabs go with them).","confirm.closeTextAgent":"Closing the panel ends these {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.closeHint":"Only need room for other windows? Hit \u201CMinimize\u201D \u2014 sessions and output keep running.","confirm.closeOk":"End {n} sessions and close","confirm.tabsTitle":"End {n} sessions and close those tabs?","confirm.tabsText":"This ends {n} sessions that are still open, and their tabs go with them.","confirm.tabsTextAgent":"This ends {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.tabsHint":"Already-exited tabs are read-only leftovers \u2014 cleaning those loses nothing.","confirm.tabsOk":"End {n} sessions","btn.restoreDock":"Click to restore the terminal window","panel.title":"Terminal","status.minimized":"Terminal minimized \u2014 click to restore","error.configLoadFailed":"Failed to load the config","error.saveTunnelFailed":"Failed to save the tunnel","error.tunnelNameTaken":"A tunnel named \u201C{name}\u201D already exists \u2014 each \u201Chost book entry + direction + port\u201D combination can appear once. Change the port to get a new name, or delete the old one first.","msg.tunnelApplied":"Tunnel \u201C{name}\u201D is active","msg.tunnelUpdated":"Tunnel \u201C{name}\u201D updated","error.nameHostUserRequired":"Name, host, and username are required","msg.hostEdited":"Entry \u201C{name}\u201D updated \u2014 written to the config on \u201CSave\u201D","error.probeFailed":"\u274C Connection failed: {error}","error.hostKeyDeleteFailed":"Failed to delete the host key record","msg.hostKeyDeleted":"Host key record deleted (the fingerprint is recorded again on the next connection)","error.sshConfigReadFailed":"Failed to read ~/.ssh/config","msg.proxySkipped":"{count} entries use a jump host that could not be resolved (missing alias, or the alias itself needs a jump host) and were not imported: {names}","msg.proxyCommandSkipped":"{count} entries only set a proxy command (ProxyCommand) and were not imported: {names} \u2014 a proxy command is local command execution, so importing never fills it in; add it by hand on the connection-book entry and turn on \u201CAllow ProxyCommand\u201D","msg.skippedNotConcrete":"{count} entries are not a concrete host (wildcard / no User)","list.separator":", ","meta.etc":" etc.","msg.importOverflow":"{count} entries beyond the import limit were not imported","list.separatorFull":"; ","msg.noNewEntries":"No new entries ({count} skipped as duplicates)","msg.noImportableHosts":"~/.ssh/config has no concrete hosts to import","msg.importedHosts":"Imported {added} (skipped {skipped} duplicates); written to the config on \u201CSave\u201D","error.knownHostsReadFailed":"Failed to read ~/.ssh/known_hosts","msg.noNewFingerprints":"No new fingerprints ({count} already exist)","msg.noImportableKnownHosts":"known_hosts has no concrete hosts to import","error.saveHostKeysFailed":"Failed to save hostKeys","msg.importedFingerprints":"Imported fingerprints for {added} hosts (skipped {skipped} that already existed)","hint.knownHostsTruncated":"; note: known_hosts has more than 500 hosts \u2014 only the first 500 were imported","error.saveFailed":"Save failed","msg.saved":"Saved and applied live","check.rememberCredentialApply":"Store in the credential store on apply","hint.appliedOnSave":"Written to the config with the card's \u201CSave\u201D","card.name":"Terminal panel","card.desc":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence.","card.descFull":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence; shell / TERM / concurrency limits apply live on save.","list.loadingConfig":"Loading the config\u2026","section.basic":"Basics","check.enabled":"Enable the plugin (applies live on save: tools and the panel entry are withdrawn immediately, sessions move to keepalive)","check.announce":"Announce the terminal panel capabilities to the agent","check.shellIntegration":"Shell integration (OSC 133/7 injection)","check.shellIntegrationWindows":"Shell integration (OSC 133/7 injection: cwd following, exit codes, tty_expect and the running state)","hint.shellIntegrationWindows":"cmd has no command-boundary hooks, so nothing can be injected: switch \u201CShell path\u201D to powershell.exe or pwsh.exe (both are in the candidate list) and then make sure this switch is on (an earlier Windows install may have stored it as off). Remote Linux / macOS hosts are unaffected.","hint.shellIntegrationPowerShell":"The PowerShell family is instrumented through a `-File` stub: cwd following, exit codes, tty_expect and the running state all work. Known limit: on PowerShell 7 the command output reaches ConPTY after the D mark, so `tty_capture{last}` may come back empty \u2014 use `tty_capture` to read the tail there (Windows PowerShell 5.1 is unaffected).","section.sftp":"SFTP file transfer","field.sftpStyle":"SFTP file browser style","option.sftpDialog":"Single pane \u2014 remote directory + upload/download/drag","option.sftpDual":"Dual pane \u2014 local on the left, remote on the right, direct transfer on selection","hint.sftpDual":"Dual pane copies files between local and remote (recursive, overwriting same names); takes effect after reopening SFTP","field.sftpLimits":"SFTP transfer limits (0 = unlimited)","field.downloadLimit":"Download limit (MB)","field.uploadLimit":"Upload limit (MB)","field.uploadCountLimit":"Batch file count limit","hint.sftpLimits":"Browser-side guard: a single file over the limit aborts the download/upload (for large files use dual-pane \u21E8/\u21E6 direct transfer or scp/rsync in the terminal; they do not consume browser memory); the file count limit applies to one batch/drag upload; applies live on save","section.session":"Sessions","field.persistence":"Session persistence (tmux)","option.persistOff":"Off \u2014 sessions end with the panel/host (default)","option.persistTmux":"tmux \u2014 new terminal/SSH tabs are persistent by default","hint.persistence":"When on, all new tabs (local / SSH host book / SSH connection dialog) are hosted by tmux by default and survive a host restart; tmux must be installed locally/remotely; the SSH dialog can opt out per connection; existing tabs are unaffected","hint.persistenceWindows":"; tmux is unavailable on Windows hosts, so local tabs still open but are not hosted","check.endOnPageClose":"End persistent sessions when the page closes (no keepalive)","check.statsEnabled":"Server stats bar (CPU / memory / disk / uptime / TCP / network; items that cannot be sampled show \u201CN/A\u201D)","hint.statsEnabled":"Off by default: persistent sessions survive closing the whole page (recoverable after the keepalive window); when on, they end together with the tmux session once the page disconnects and the keepalive window expires \u2014 note that refreshing the page within the keepalive window is unaffected","check.allowProxyCommand":"Allow ProxyCommand (runs a command on this machine; off by default)","hint.allowProxyCommand":"When on, a proxy command set on a connection-book entry runs on this machine, and its stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). This is the only switch in this plugin that turns a settings field into local command execution, so it is off by default: while off, a connection carrying a proxy command fails explicitly (it does not fall back to a direct connection). Importing ~/.ssh/config never fills one in.","field.maxSessions":"Concurrent session limit (1\u201316)","hint.maxSessions":"New tabs beyond the limit are rejected; applies live on save","field.shell":"Shell path (defaults to $SHELL)","field.shellWindows":"Shell path (defaults to %COMSPEC%)","placeholder.shell":"Leave empty to use $SHELL","placeholder.shellWindows":"Leave empty to use %COMSPEC% (or enter the full path to powershell.exe / pwsh.exe)","list.noShellCandidate":"No matching candidate \u2014 just type any path","hint.shellCandidatesWindows":"Windows host: candidates come from %COMSPEC% and the installed PowerShell (Windows PowerShell 5.1 / PowerShell 7), and you can type any path; the PowerShell family supports shell integration (OSC 133/7 injected by a `-File` stub), cmd has no command-boundary hooks and is unsupported","hint.shellCandidates":"Pick an installed shell from the list ($SHELL first) or type any path; zsh / bash support shell integration","hint.term":"TUI programs depend on this value","field.cwd":"Fallback working directory (the client's current session cwd wins)","placeholder.cwd":"Leave empty to use the host process start directory","field.grace":"Disconnect keepalive (seconds, 0 = end immediately)","hint.grace":"Sessions are kept alive for reconnect after a page refresh or network hiccup and end on timeout; applies live on save","section.assist":"AI assist","check.assistEnabled":'Explain failures (ask the model "why / what next" when a command exits non-zero)',"hint.assistEnabled":"Off by default. When on, a chip appears in the corner of the terminal after a command exits non-zero; clicking it sends that command's output tail (colors and progress bars stripped, repeated lines collapsed, keys/tokens masked) together with the current screen to the model \u2014 never the scrollback. A suggested command is only ever typed into the prompt line, never submitted for you.","field.assistRoute":"Model route (optional)","hint.assistRoute":"Empty follows the host default model","option.followHostModel":"Follow the host default model","list.modelLoading":"Loading candidates\u2026","list.noModelCandidate":"The host advertises no models","list.modelCatalogFailed":"Candidates unavailable \u2014 the host may not have restarted, or serves no model catalog (type provider/model to enter one manually)","badge.assistFailed":"Command failed ({code}) \xB7 explain","panel.assistTitle":"Why this command failed","panel.assistCommand":"Suggested command","status.assistThinking":"Asking the model\u2026","error.assistRequest":"Explanation failed: {message}","btn.assistFill":"Insert command","btn.assistCopy":"Copy answer","btn.assistCopyError":"Copy error","btn.assistClose":"Close","hint.assistFillNoEnter":"Types it into the prompt line; never submits","hint.assistNoCommand":"The model gave no directly-insertable command \u2014 use Copy and pick one yourself","section.ssh":"SSH connections","btn.probeRowTitle":"Test this entry: per-stage diagnosis of TCP \u2192 host key \u2192 authentication","msg.testing":"Testing\u2026","btn.test":"Test","btn.edit":"Edit","btn.delete":"Delete","list.emptySshHosts":"No entries \u2014 add one via the terminal panel's \u201C+\u201D \u2192 SSH connection\u2026 and check \u201CSave to the host book\u201D","btn.importSshConfig":"Import from ~/.ssh/config","hint.importSshConfig":"Same names are skipped; written to the config on \u201CSave\u201D","hint.sshBook":"Written to the config together with \u201CSave\u201D; passwords/passphrases support env:VAR references to avoid plaintext storage","check.tunnelEnabled":"Enable","list.emptyTunnels":"No tunnels \u2014 map a remote database or internal service to a local port","field.direction":"Forwarding direction","option.localForwardTitle":"Local forward -L: listen locally and connect to a target on the SSH server side","option.localForward":"Local -L","option.remoteForwardTitle":"Remote forward -R: listen on the SSH server side and dial back to a local service","option.remoteForward":"Remote -R","option.selectBook":"Pick a host book entry","hint.tunnelViaBook":"Connects via {book} \u2014 the tunnel's host and credentials come from that host book entry","hint.tunnelBookEmpty":"Pick which SSH connection this tunnel uses (host and credentials come from the host book)","hint.localListenFixed":"The local listen address is fixed to 127.0.0.1 (not exposed to the LAN)","placeholder.localPort":"Local port","field.localListenPort":"Local listen port","hint.flowLocalToRemote":"Traffic flow: local \u2192 SSH server side","placeholder.remoteHost":"Server-side host","hint.remoteHostTitle":"Target host name or IP (reached from the SSH server side; 127.0.0.1 = the server itself)","field.remoteHost":"Server-side target host","placeholder.port":"Port","field.remotePort":"Server-side target port","placeholder.remoteListenHost":"Server-side listen address","hint.remoteListenHost":"Server-side listen address (defaults to 127.0.0.1; leave empty to allow only the server itself)","field.remoteListenHost":"Server-side listen address","placeholder.listenPort":"Listen port","field.remoteListenPort":"Server-side listen port","hint.flowRemoteToLocal":"Traffic flow: local \u2190 SSH server side","hint.localDialFixed":"The local dial address is fixed to 127.0.0.1","placeholder.localTargetPort":"Local service port","field.localTargetPort":"Local target port","hint.tunnelLocalSummary":"Left: local listener (fixed 127.0.0.1) \u2192 Right: target reached from the SSH server side","hint.tunnelRemoteSummary":"Left: SSH server-side listener \u2192 Right: local service being reached (fixed 127.0.0.1)","btn.addTunnel":"Add tunnel","hint.tunnelAdd":"Takes effect immediately; reconnects automatically after a drop; prefer local ports above 1024; remote hosts are reached from the SSH server side (127.0.0.1 = the server itself)","hint.tunnelEditing":"Editing \u201C{name}\u201D \u2014 changing the port/entry derives a new name by rule; takes effect immediately on save","panel.hostKeys":"SSH host key records (TOFU)","btn.importKnownHosts":"Import from known_hosts","list.emptyHostKeys":"No records \u2014 the host fingerprint is recorded automatically after the first successful SSH connection","hint.hostKeys":"A host with several keys (e.g. rsa + ed25519) gets one fingerprint each and any match is accepted; a changed fingerprint rejects the connection (MITM protection) \u2014 delete that record once you are sure it is safe, then reconnect","msg.saving":"Saving\u2026","btn.save":"Save","list.none":"N/A","meta.mem":"Memory","meta.disk":"Disk","meta.cores":"Cores","meta.uptime":"Uptime","meta.temp":"CPU temp","meta.net":"Network","error.tunnelNoBook":"Add an SSH entry to the host book first","error.tunnelRemotePortRequired":"A remote listen port and a local target port are required (1\u201365535)","error.tunnelLocalRequired":"Local port, remote host, and remote port are required","error.tunnelMissing":"Tunnel \u201C{name}\u201D no longer exists (it may have been deleted by another window)","error.tunnelClash":"A tunnel named \u201C{name}\u201D already exists \u2014 handle that one first.","msg.renaming":"Renaming {name}\u2026","msg.deleting":"Deleting {name}\u2026","msg.downloading":"Downloading {name}\u2026","msg.uploadingName":"Uploading {name}","error.invalidTaskState":"The server returned an invalid task state","hint.rememberCredentialApply":"When checked, \u201CApply\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","hint.noCredRefPasswordApply":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on apply\u201D above to create one, or type env:NAME straight into the password box","hint.bookNameConflict":"A same-name conflict is rejected","btn.apply":"Apply"};function A_(e,t){return t===void 0?e:String(e).replace(/\{(\w+)\}/g,(r,i)=>t[i]===void 0?"":String(t[i]))}function xh(e,t){return A_(Xs[e]!==void 0?Xs[e]:e,t)}var g=xh;function D_(e){e.inject(["locale"],t=>{let r=t.locale.register(Do,"zh",Xs),i=t.locale.register(Do,"en",R_);return g=t.locale.bind(Do),()=>{i(),r(),g=xh}})}function P_(){return Bc(document.baseURI,globalThis.__DSH_TRANSPORT__?.streamBaseUrl)}function ui(){return Ut!==null&&typeof Ut.describe=="function"?Ut:null}function ii(e){let t=String(e??"").trim();return t.startsWith("env:")?t.slice(4).trim():""}function B_(){let e=new Set;for(let t of nr)for(let r of[t?.password,t?.passphrase]){let i=ii(r);i!==""&&e.add(i)}return[...e]}async function O_(){try{let t=await(await fetch("/api/dsh-tty/credential-refs",{cache:"no-store"})).json();if(t.ok&&Array.isArray(t.names))return t.names.filter(r=>typeof r=="string"&&r!=="")}catch{}return[]}async function kh(){return[...new Set([...B_(),...await O_()])].sort()}async function Eh(e){let t=ui();if(t===null)return{error:g(Ut===null?"error.credServiceMissing":"error.credServiceIncomplete")};try{let r=await t.describe([e]),i=r?.ok===!0?r.value?.[e]:void 0;return i===void 0?{unreported:!0}:{view:{configured:i.configured===!0,writable:i.writable===!0,source:typeof i.source=="string"?i.source:""}}}catch(r){return{error:r instanceof Error?r.message:String(r)}}}async function I_(e,t){let r=ui();if(r===null||typeof r.set!="function")return{error:g("error.credStoreUnavailable")};try{return await r.set(e,t),{value:"env:"+e}}catch(i){return{error:g("error.credStoreFailed",{error:i instanceof Error?i.message:String(i)})}}}async function Lh(e){let t=ui();if(t===null||typeof t.unset!="function")return{error:g("error.credClearUnavailable")};try{return await t.unset(e),{}}catch(r){return{error:g("error.credClearFailed",{error:r instanceof Error?r.message:String(r)})}}}async function Th(e,t,r,i,o,s){if(e!==!0)return{};let n=String(t??"").trim();if(n===""||n.startsWith("env:"))return{};let a=Oc(r,i,o,s);return a===""?{error:g("error.credRefNeedsHost")}:I_(a,n)}function fn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var zs;function es(){document.getElementById("dsh-tty-style")||(zs=document.createElement("style"),zs.id="dsh-tty-style",zs.textContent=Rc+`
3766
+ `+Mc,document.head.appendChild(zs))}var pn='<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>',N_='<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>',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"><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>',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>',F_='<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>',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="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>',Ah='<svg viewBox="0 0 16 16" width="13" height="13" fill="currentColor" stroke="none" aria-hidden="true"><circle cx="3.4" cy="8" r="1.35"/><circle cx="8" cy="8" r="1.35"/><circle cx="12.6" cy="8" r="1.35"/></svg>',W_='<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>',_n='<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>',ts='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>',j_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/></svg>',z_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/><path d="M3 13L13 3"/></svg>',U_='<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>',$i='<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>',Dh='<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>',Ph='<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>',ra='<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>',Bh='<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>',$_='<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>',ia='<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>',Tr='<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>',sa='<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>',Oh='<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>',na='<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>',oa='<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>',q_='<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="M8 3.4v9"/><path d="M4.8 9.2L8 12.4l3.2-3.2"/></svg>',fh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><path d="M6 12L9.29289 8.70711C9.68342 8.31658 9.68342 7.68342 9.29289 7.29289L6 4"/></svg>',K_='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><path d="M4 6L7.29289 9.29289C7.68342 9.68342 8.31658 9.68342 8.70711 9.29289L12 6"/></svg>',G_='<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>',V_='<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>',Y_='<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>',Ih='<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>',J_='<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>',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"><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>',Hh=null,Be=null,ce=null,Zs=null,qi=null,Ut=null,Mr=null,Br=null,Te=null,zt=null,Oi=null,Ii=null,Qs=null,Ct=null,Ni=null,it=null,kt=null,ir=null,si=null,Ki=!1,Hi=null,Xe=!1,rt=null,Gi=null,fi=null,Or=null,en=null,Rr=null,Fi=1e3,tn="dsh-tty:tabs",ie=new Map,rs=new Set,aa=()=>rs.size>0,No=new Set,xe=null,is=0,Us=!1,Et=null,rn=!1,yr=new Map,Ar=null,Ir=null,ni=null,gr=null,sn=null,pt=null,oi=null,nr=[],nn=!0,Rt=null,$t=null,Vi="",ai=null,Ho=null,At=null,Wi=null,Bi=null,Fo=null,Wo=new Set;function mn(e){return Wo.add(e),()=>Wo.delete(e)}mn(({tab:e,addAction:t})=>{Pr&&e.exited&&t(H_,g("btn.reopen"),g("btn.reopenTitle"),()=>Ji(e.sid))});mn(({tab:e,addAction:t})=>{Pr&&t(F_,"SFTP",g("btn.sftpTitle"),()=>yn(e.spawnSpec,e.sid))});mn(({bookName:e,addAction:t})=>{if(!Pr)return;let r=e!==""?od(e):0;if(r>0){t(Rh,g("btn.tunnels",{count:r}),g("btn.tunnelsTitle"),i=>Qh(i.currentTarget,e));return}e!==""&&t(Ah,g("btn.more"),g("btn.moreTitle"),i=>Rm(i.currentTarget,e))});function gn(e,t){if(Mr===null)return;Mr.textContent=e.split("\u2014\u2014")[0],Mr.title=e,Br.dataset.state=t,Zs!==null&&(Zs.style.display=t==="connected"?"none":""),fi!==null&&(fi.textContent=e),Or!==null&&(Or.dataset.state=t);let r=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");r!==null&&(r.dataset.state=t)}function Po(e,t,r){let i=typeof e=="string"&&e!==""?e:null;if(i!==null){let o=ie.get(i);o!==void 0&&(o.statusText=t,o.statusState=r)}th(i,xe)&&(qi=i,gn(t,r))}function $s(e,t){qi=null,gn(e,t)}function la(){if(!rh(qi,xe))return;let e=xe===null?void 0:ie.get(xe);qi=e===void 0?null:xe;let t=eh(e,g);gn(t.text,t.state)}function Ne(e){Be!==null&&Be.readyState===WebSocket.OPEN&&Be.send(JSON.stringify(e))}function X_(){let e=[],t=document.createDocumentFragment();for(let r of Ao(g)){let i=document.createElement("span");i.className="tt_statsItem";let o=document.createElement("span");o.className="tt_statsLabel",o.textContent=r.label,i.appendChild(o);let s=null,n=null;r.kind==="pct"&&(s=document.createElement("span"),s.className="tt_statsMeter",n=document.createElement("span"),n.className="tt_statsMeterFill",s.appendChild(n),i.appendChild(s));let a=document.createElement("span");a.className="tt_statsValue",i.appendChild(a),t.appendChild(i),e.push({item:i,value:a,meter:s,fill:n,slot:null})}return Rt!==null&&Rt.appendChild(t),e}function Z_(e,t){let r=uh(t!==void 0?t.stats:null,g);for(let i=0;i<e.length;i+=1){let o=e[i],s=r[i];if(s!==void 0&&(o.slot!==s.slot&&(o.slot=s.slot,o.value.style.minWidth=s.slot>0?s.slot+"ch":""),o.value.textContent!==s.value&&(o.value.textContent=s.value),o.item.getAttribute("title")!==s.title&&o.item.setAttribute("title",s.title),o.fill!==null&&o.meter!==null)){let n=s.pct===null?"0%":Math.max(0,Math.min(100,s.pct)).toFixed(1)+"%";o.fill.style.width!==n&&(o.fill.style.width=n);let a=ah(s.pct);o.meter.dataset.level!==a&&(o.meter.dataset.level=a)}}}function vn(){Bi=null,Fo=null}function Q_(){if(ce===null||Xe||!nn)return!1;let e=Pt();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:hh(e.statsAt)}function on(){if(Xe)return;let e=Pt();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&vi(e)}catch{}}}function Nr(){try{em()}catch(e){console.warn("[dsh-tty] \u72B6\u6001\u6761\u6E32\u67D3\u5931\u8D25\uFF08\u5DF2\u6536\u8D77\uFF09: "+(e instanceof Error?e.message:String(e)));try{Rt!==null&&(Rt.hidden=!0,Rt.textContent=""),vn(),it!==null&&delete it.dataset.stats}catch{}}}function em(){if(it===null||Rt===null)return;let e=Q_(),t=it.dataset.stats!==void 0!==e;if(!e){t&&delete it.dataset.stats,Rt.hidden=!0,Bi!==null&&(Rt.textContent="",vn()),t&&on();return}Rt.hidden=!1,Bi===null&&(Bi=X_());let r=Pt(),i=r===void 0?"":r.sid+":"+String(r.statsAt||0);i!==Fo&&(Fo=i,Z_(Bi,r)),t&&(it.dataset.stats="",on())}function Fh(){Wi===null&&(Wi=setInterval(()=>Nr(),1e3))}function Wh(){Wi!==null&&(clearInterval(Wi),Wi=null)}function jh(){if(ce===null||Xe||!nn)return null;let e=Pt();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function ss(){let e=jh();e!==At&&(At!==null&&Ne({t:"statsOff",sid:At}),At=e,e!==null&&Ne({t:"statsOn",sid:e}))}function tm(e){if(e!==jh()){ss();return}At!==null&&At!==e&&Ne({t:"statsOff",sid:At}),At=e,Ne({t:"statsOn",sid:e})}function rm(){let e=Pt();return e===void 0||e.embedded===!0?null:e.releasePending===!0?{kind:"released",tab:e}:e.exited===!0?{kind:"exited",tab:e}:null}function ns(){if(it===null||$t===null)return;let e=rm(),t=e!==null,r=it.dataset.exited!==void 0!==t;if(!t){$t.hidden=!0,$t.textContent="",Vi="",r&&(delete it.dataset.exited,on());return}$t.hidden=!1,im(e),r&&(it.dataset.exited="",on())}function im(e){let{kind:t,tab:r}=e,i=typeof r.exitDetail=="string"?r.exitDetail:"",o=t+":"+r.sid+":"+i;if(o===Vi)return;Vi=o,$t.textContent="";let s=document.createElement("span");s.className="tt_exitBarText",s.textContent=t==="released"?g("status.aiEnded"):i===""?g("status.exited"):g("status.exitedWith",{detail:i}),t==="released"&&(s.title=g("hint.aiEndedTab")),$t.appendChild(s);let n=document.createElement("span");if(n.className="tt_exitBarSpacer",$t.appendChild(n),t==="released"){ph(g("btn.dismiss"),g("btn.dismissTitle"),()=>{Gt(r.sid,{silent:!0})});return}if(r.spawnSpec===null||typeof r.spawnSpec!="object")return;let a=r.agentOwned===!0;ph(g(a?"btn.newLocalTerminal":"btn.reopenSession"),g(a?"hint.reopenAgentLocal":"hint.reopenWithSpec"),()=>Ji(r.sid))}function ph(e,t,r){let i=document.createElement("button");i.type="button",i.className="tt_toolBtn tt_exitBarBtn",i.textContent=e,typeof t=="string"&&t!==""&&(i.title=t),i.addEventListener("click",r),$t.appendChild(i)}function Pt(){return xe!==null?ie.get(xe):void 0}function jo(){try{return Wc(Hh?.list?.getSnapshot?.())}catch{return}}function sm(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Ne({t:"refresh",sid:e.sid})}}var qs=null;function zh(e){qs!==null&&clearTimeout(qs),qs=setTimeout(()=>{qs=null;let t=Pt();t!==void 0&&sm(t)},e??200)}var nm=["password","passphrase"];function _h(e){if(e===null||typeof e!="object"||e.t!=="ssh")return e;let t=e.credsStripped===!0,r={...e};for(let i of nm){let o=r[i];typeof o=="string"&&o!==""&&!o.startsWith("env:")&&(delete r[i],t=!0)}return t&&(r.credsStripped=!0),r}var Uh=1;function Kt(){try{let e=[...ie.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:_h(t.spawnSpec),label:t.label}));e.length===0||ce===null?sessionStorage.removeItem(tn):sessionStorage.setItem(tn,JSON.stringify({v:Uh,tabs:e})),om([...ie.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:_h(t.spawnSpec),label:t.label})))}catch(e){console.warn("[dsh-tty] \u6807\u7B7E\u6301\u4E45\u5316\u5931\u8D25\uFF08\u672C\u6B21\u5237\u65B0\u540E\u6807\u7B7E\u5217\u8868\u53EF\u80FD\u4E22\u5931\uFF09: "+(e instanceof Error?e.message:String(e)))}}var zo="dsh-tty:persist-specs";function om(e){try{let t=e.filter(r=>as(r.spawnSpec)).map(r=>({spawnSpec:r.spawnSpec,label:r.label}));t.length===0?localStorage.removeItem(zo):localStorage.setItem(zo,JSON.stringify(t))}catch{}}function am(){try{let e=localStorage.getItem(zo);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&as(r.spawnSpec)):[]}catch{return[]}}function lm(){try{let e=sessionStorage.getItem(tn);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):t!==null&&typeof t=="object"&&t.v===Uh&&Array.isArray(t.tabs)?t.tabs.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):[]}catch{return[]}}function an(e,t){let r=Be;return new Promise(i=>{let o=null,s=n=>{let a;try{a=JSON.parse(n.data)}catch{return}a.t===e&&(o!==null&&clearTimeout(o),r.removeEventListener("message",s),i(r===Be?a:null))};o=setTimeout(()=>{r.removeEventListener("message",s),i(null)},t),r.addEventListener("message",s)})}function cm(e){return e===void 0?null:e.embedded===!0?e.controller!==void 0&&e.controller!==null?e.controller.hostEl:null:e.termEl}function $h(e){if(e===void 0||e.fit===null||e.fit===void 0)return;let t;try{t=e.fit.proposeDimensions()}catch{return}let r=cm(e);return jc(t,r==null?null:{width:r.clientWidth,height:r.clientHeight})}function vi(e){if(e===void 0||e.fit===void 0)return;let t=$h(e);t!==void 0&&(e.lastDims=t,Ne({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows}))}function hm(e){if(e===void 0||e.fit===void 0)return;let t=e.term,r=t!==null&&t.buffer!==void 0?t.buffer.active:null,i=r==null?null:{atBottom:r.viewportY>=r.baseY,line:r.viewportY};try{e.fit.fit()}catch{return}if(i!==null)try{i.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(i.line,t.buffer.active.baseY))}catch{}e.exited||vi(e)}function ei(e,t,r,i){if(e.overlayEl===null||e.overlayEl===void 0)return;let o=e.overlayEl,s=i==="error"||i==="info"?i:"exited";if(s==="exited"&&e.embedded!==!0){o.textContent="";return}if(t===""||t===void 0){o.textContent="";return}o.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?Ih:s==="info"?sa:J_)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(r===void 0||r===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",o.querySelector(".tt_overlayMain").textContent=t,r!==void 0&&r!==""&&(o.querySelector(".tt_overlayHint").textContent=r)}function Ae(e,t=""){try{let r=getComputedStyle(document.body).getPropertyValue(e).trim();return r!==""?r:t}catch{return t}}function bi(e){let t=Ae("--tt-accent"),r={};r.background=Ae("--tt-term-bg"),r.foreground=Ae("--tt-term-fg"),r.cursor=t,r.cursorAccent=Ae("--tt-term-cursor-accent"),r.selectionBackground=Ae("--tt-term-selection"),r.black=Ae("--tt-an-black"),r.red=Ae("--tt-an-red"),r.green=Ae("--tt-an-green"),r.yellow=Ae("--tt-an-yellow"),r.blue=Ae("--tt-an-blue"),r.magenta=Ae("--tt-an-magenta"),r.cyan=Ae("--tt-an-cyan"),r.white=Ae("--tt-an-white"),r.brightBlack=Ae("--tt-an-bright-black"),r.brightRed=Ae("--tt-an-bright-red"),r.brightGreen=Ae("--tt-an-bright-green"),r.brightYellow=Ae("--tt-an-bright-yellow"),r.brightBlue=Ae("--tt-an-bright-blue"),r.brightMagenta=Ae("--tt-an-bright-magenta"),r.brightCyan=Ae("--tt-an-bright-cyan"),r.brightWhite=Ae("--tt-an-bright-white");let i=new Sh.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:r}),o=new Ch.FitAddon,s=new nl;i.loadAddon(o),i.loadAddon(s),i.loadAddon(new ol);let n=document.createElement("div");n.className="tt_term";let a=document.createElement("div");a.className="tt_overlay",a.addEventListener("click",()=>{a.textContent="",Ji(e.sid)}),a.setAttribute("role","button"),a.setAttribute("aria-label",g("btn.reopenSession")),a.tabIndex=0,a.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" "||u.key==="Spacebar")&&(u.preventDefault(),a.textContent="",Ji(e.sid))}),n.appendChild(a),i.open(n);try{o.fit()}catch{}try{let u=new Tc;u.onContextLoss(()=>{try{u.dispose()}catch{}}),i.loadAddon(u)}catch{}i.onData(u=>{Ne({t:"input",sid:e.sid,d:u}),yr.delete(e.sid)&&Fr()}),i.onResize(()=>{as(e.spawnSpec)&&zh(200)}),i.attachCustomKeyEventHandler(u=>e.embedded===!0?!0:(u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="f"?(u.preventDefault(),Ld(),!1):!0),e.term=i,e.fit=o,e.search=s,e.termEl=n,e.overlayEl=a}function mh(e){return e===null||typeof e!="object"?"":["t","name","host","port","username","command","cwd","persist","persistName","hidden"].map(r=>r+"="+String(e[r]??"")).join("\0")}function dm(e){let t=mh(e);if(t==="")return null;for(let r of ie.values())if(r.exited!==!0&&r.embedded!==!0&&mh(r.spawnSpec)===t)return r;return null}function Yi(e,t){let r=fn(),i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??hg(),label:t};return bi(i),ie.set(r,i),is+=1,ut(),lr(r,{user:!0}),bn(i),Kt(),i}function um(e){if(Array.isArray(e))for(let t of e){if(t===null||typeof t!="object"||t.owner!=="agent"||t.exited===!0)continue;let r=typeof t.sid=="string"?t.sid:"";if(r===""||ie.has(r))continue;let i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,agentOwned:!0,spawnSpec:{t:"spawn",cwd:typeof t.cwd=="string"?t.cwd:jo()},label:"agent"+(t.kind==="ssh"&&typeof t.target=="string"&&t.target!==""?" \xB7 "+t.target:"")};bi(i),ie.set(r,i),is+=1,ut(),qh()&&i.termEl!==null&&it!==null&&xe===null&&lr(r),Ne({t:"attach",sid:r}),fm()}}function qh(){return ce!==null&&Xe!==!0}function fm(){try{Kt()}catch{}}function pm(e){if(um(e),!Array.isArray(e))return;for(let i of e){if(i===null||typeof i!="object"||i.owner!=="agent")continue;let o=typeof i.sid=="string"?ie.get(i.sid):void 0;o!==void 0&&o.embedded!==!0&&o.agentOwned!==!0&&(o.agentOwned=!0)}let t=$c(e),r=!1;for(let[i,o]of[...ie]){let s=qc(o,t);if(s!=="keep"){if(s==="mark-exited"){o.exited!==!0&&(o.exited=!0,o.live=!1,r=!0);continue}_m(o)||Gt(i,{silent:!0})}}r&&(ut(),Sn())}function _m(e){return!qh()||e.watched!==!0||e.sid!==xe?!1:(e.releasePending===!0||(e.releasePending=!0,ns()),!0)}function mm(e){if(ie.has(e.sid))return ie.get(e.sid);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};bi(t),ie.set(t.sid,t),is+=1,ut(),lr(t.sid),Ne({t:"attach",sid:t.sid})}function gm(e){if(!(e?.spawnSpec?.credsStripped!==!0||e.term===null))try{e.term.writeln("\x1B[2m[dsh-tty] "+g("msg.passwordNotStored")+"\x1B[0m")}catch{}}function bn(e){gm(e);let t=$h(e);t!==void 0&&(e.lastDims=t);let r=t!==void 0?t:e.lastDims!==void 0?e.lastDims:{cols:80,rows:24},i={...e.spawnSpec,sid:e.sid,cols:r.cols,rows:r.rows};if(Be===null||Be.readyState!==WebSocket.OPEN){No.add({tab:e,frame:i});return}Ne(i)}function vm(e,t){let r=ie.get(e);if(r===void 0||r.embedded===!0||t===!0&&!To(r))return;let i=t===!0;xr(r.spawnSpec)!==i&&(r.spawnSpec=Mo(r.spawnSpec,i),Ne({t:"hidden",sid:e,hidden:i}),Kt(),ut(),pi())}var bm="\u{1F648}";function Kh(e){let t=ie.get(e),r=t===void 0?"":t.label||g("panel.tabLabel",{n:wn(e)});return t===void 0||!xr(t.spawnSpec)?r:`${bm} ${r}`}function gh(e){let t={sid:fn(),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};bi(t),ie.set(t.sid,t),is+=1,ut(),lr(t.sid),bn(t)}function Ji(e){let t=ie.get(e);if(t===void 0)return;if(t.embedded===!0){Jh(t);return}let r=t.spawnSpec,i=t.label;if(Ne({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),ie.delete(e);let o={sid:fn(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:r,label:i};bi(o),ie.set(o.sid,o),ut(),lr(o.sid,{user:!0}),bn(o),Kt()}function Gt(e,t){let r=ie.get(e);if(r===void 0)return;let i=t?.silent===!0;if(Dt!==null&&Dt.ownerKey===e&&zi(!0),i||Ne({t:"kill",sid:e}),ie.delete(e),or(),Ir===e&&Bt(),yr.delete(e),Fr(),rs.delete(e),r.term!==null)try{r.term.dispose()}catch{}if(r.termEl!==null&&r.termEl.remove(),xe===e){xe=null;let o=[...ie.entries()].filter(([,s])=>s.embedded!==!0).map(([s])=>s).pop()??null;o!==null&&lr(o)}ut(),la(),ns(),gi(),rt!==null&&Sn(),[...ie.values()].some(o=>o.embedded!==!0)?Kt():Qi()}function Gh(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error(g("error.terminalNeedsCommand"));if(/[\r\n\0]/.test(t))throw new Error(g("error.terminalCommandSingleLine"));return t}function Vh(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 wm(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&&vi(e)}}),t.observer.observe(t.hostEl))}function Yh(e,t,r){let i={sid:fn(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:r};return bi(i),ie.set(i.sid,i),rs.add(i.sid),e.hostEl.appendChild(i.termEl),wm(i),bn(i),i}function Jh(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||Ne({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),ie.delete(e.sid),rs.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=Yh(t,e.spawnSpec,e.label),xe===e.sid&&(xe=t.tab.sid,la()),t.tab}}function ym(e,t){if(!(e instanceof HTMLElement))throw new Error(g("error.terminalNeedsHost"));let r=Gh(t),i=Vh(t,r),o=typeof t?.label=="string"&&t.label!==""?t.label:void 0;es();let s={hostEl:e,tab:null,observer:null,disposed:!1};return s.tab=Yh(s,i,o),ug(),()=>Sm(s)}function Sm(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||Ne({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),ie.delete(t.sid),rs.delete(t.sid),e.tab=null}if(ce===null&&!aa()&&Be!==null){Ki=!0;try{Be.close()}catch{}Be=null}}var Cm=460,xm=280,km=320,Em=160,Dt=null,ti=Cm,ri=km;function ca(){let e=ce!==null?ce.querySelector(".tt_modal"):null,t=e!==null?e:ce;return t!==null?t.getBoundingClientRect():null}var ha=e=>e==="bottom"?Em:xm;function Lm(e){let t=ca();if(t===null)return 900;let r=e==="bottom"?t.height:t.width;return Math.max(ha(e),Math.round(r*.72))}function ji(e,t){return Math.min(Lm(e),Math.max(ha(e),Math.round(t)))}function Gs(){let e=Dt;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){ri=ji("bottom",ri),e.el.style.width="",e.el.style.height=String(ri)+"px",e.el.style.flexBasis=String(ri)+"px";return}ti=ji("right",ti),e.el.style.height="",e.el.style.width=String(ti)+"px",e.el.style.flexBasis=String(ti)+"px"}}function zi(e){let t=Dt;if(t!==null){if(Dt=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(r){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(r instanceof Error?r.message:String(r)))}try{t.el.remove()}catch{}kt!==null&&delete kt.dataset.side}}function Xh(e){if(ea(),kt===null)throw new Error(g("error.panelNotReady"));Dt!==null&&zi(!0),es();let t=Qr(e?.ownerSid,xe),r=e?.side==="bottom"?"bottom":"right",i=Math.max(r==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:ha(r)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let c=ji(r,e.size);r==="bottom"?ri=c:ti=c}let o=document.createElement("div");o.className="tt_dockPane",o.dataset.side=r,kt.dataset.side=r,o.innerHTML='<div class="tt_dockPaneResize" title="'+g(r==="bottom"?"panel.dragHeight":"panel.dragWidth")+'"></div><div class="tt_dockPaneHead"><span class="tt_dockPaneTitle"></span><span class="tt_dockPaneHint"></span><span class="tt_dockPaneSpacer"></span><button class="tt_dockPaneFold" type="button"></button><button class="tt_dockPaneClose" type="button" title="'+g("btn.closePane")+'">'+_n+'</button></div><div class="tt_dockPaneBody"></div>',kt.appendChild(o);let s=o.querySelector(".tt_dockPaneTitle"),n=o.querySelector(".tt_dockPaneHint"),a=o.querySelector(".tt_dockPaneBody"),u=o.querySelector(".tt_dockPaneFold"),l=o.querySelector(".tt_dockPaneClose"),d=o.querySelector(".tt_dockPaneResize"),m={el:o,element:a,disposed:!1,collapsed:!1,side:r,minSize:i,ownerKey:t,onClose:typeof e?.onClose=="function"?e.onClose:null},y=()=>r==="bottom"?m.collapsed?ra:q_:m.collapsed?oa:na,_=c=>{m.collapsed=c===!0,m.collapsed?o.dataset.collapsed="1":delete o.dataset.collapsed,u.innerHTML=y(),u.title=m.collapsed?g("btn.expandPane"):g("btn.collapsePane"),u.setAttribute("aria-label",u.title),Gs()};return m.setTitle=c=>{s.textContent=typeof c=="string"?c:""},m.setHint=c=>{n.textContent=typeof c=="string"?c:""},m.isCollapsed=()=>m.collapsed===!0,m.collapse=()=>_(!0),m.expand=()=>_(!1),m.toggle=()=>_(!m.collapsed),m.dispose=()=>{m.disposed||Dt!==m||zi(!1)},d.addEventListener("mousedown",c=>{if(c.button!==0||m.collapsed)return;c.preventDefault();let f=c.clientX,h=c.clientY,p=o.getBoundingClientRect(),v=b=>{r==="bottom"?ri=ji("bottom",Math.max(i,p.height+(h-b.clientY))):ti=ji("right",Math.max(i,p.width+(f-b.clientX))),Gs()},S=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)}),d.addEventListener("dblclick",()=>_(!m.collapsed)),u.addEventListener("click",()=>_(!m.collapsed)),l.addEventListener("click",()=>zi(!0)),m.setTitle(typeof e?.title=="string"?e.title:""),m.setHint(typeof e?.hint=="string"?e.hint:""),_(e?.collapsed===!0),Dt=m,Gs(),Zh(),m}function Zh(){let e=Dt;if(e!==null){if(ko(e.ownerKey,xe)){delete e.el.dataset.dockHidden,kt!==null&&(kt.dataset.side=e.side);return}e.el.dataset.dockHidden="1",kt!==null&&delete kt.dataset.side}}function lr(e,t){let r=ie.get(e);if(r===void 0||r.embedded===!0)return;t?.user===!0&&(r.watched=!0);let i=xe!==null?ie.get(xe):void 0;if(!(i!==void 0&&i.releasePending===!0&&i.sid!==e&&ie.size>1&&(Gt(i.sid,{silent:!0}),ie.get(e)===void 0))){xe=e,Bt(),Fr();for(let[o,s]of ie)s.embedded!==!0&&s.termEl!==null&&(s.termEl.style.display=o===e?"":"none");r.embedded!==!0&&it!==null&&r.termEl!==null&&r.termEl.parentElement!==it&&it.appendChild(r.termEl),ss(),Nr(),ut(),Dr(),Zh();try{r.fit.fit()}catch{}r.spawned&&!r.exited&&vi(r),ei(r,""),ns(),la()}}function Bo(e){if(Te===null)return;let t=ie.get(e);if(t===void 0)return;let i=Te.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");if(i==null)return;i.dataset.state=ln(t);let o=pt===null?null:pt.querySelector('[data-sid="'+e+'"] .tt_tabDot');o!==null&&(o.dataset.state=ln(t))}var Oo=!1;function ut(){if(Te===null)return;if(Te.querySelector(".tt_tabRename")!==null){Oo||(Oo=!0,setTimeout(()=>{Oo=!1,ut()},1e3));return}Te.textContent="";for(let[t,r]of ie){if(r.embedded===!0)continue;let i=document.createElement("button");i.className="tt_tab",i.dataset.sid=t,t===xe&&(i.dataset.active="");let o=document.createElement("span");o.className="tt_tabDot",o.dataset.state=ln(r),i.appendChild(o);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=Kh(t),s.addEventListener("dblclick",a=>{a.stopPropagation(),Am(t,i)});let n=document.createElement("span");n.className="tt_tabClose",n.title=g("btn.close"),n.innerHTML=ts,n.setAttribute("role","button"),n.setAttribute("aria-label",g("btn.closeTabAria",{label:r.label||""})),n.tabIndex=0,n.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" "||a.key==="Spacebar")&&(a.preventDefault(),a.stopPropagation(),Gt(t))}),i.title=xr(r.spawnSpec)?`${s.textContent} \u2014 ${g("btn.hiddenMark")}`:s.textContent,i.appendChild(s),i.appendChild(n),i.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),Gt(t);return}lr(t,{user:!0})}),Te.appendChild(i)}let e=Te.querySelector("[data-active]");e!==null&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest",inline:"nearest"}),pi(),pt!==null&&ie.size===0&&Lt()}function pi(){if(Te===null)return;let e=Te.scrollWidth-Te.clientWidth,t=e>1,r=Vc(dd()),i=t||md().length>0||r>=2;if(zt!==null&&(zt.hidden=!i,i?zt.title=g("btn.tabListTitle",{n:String(r)}):pt!==null&&Lt()),!t){delete Te.dataset.edge,pt!==null&&Vo();return}let o=Te.scrollLeft>1,s=Te.scrollLeft<e-1;Te.dataset.edge=o&&s?"both":s?"end":"start",pt!==null&&Vo()}function ln(e){return e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting"}function Tm(e){if(Te===null||Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let t=Te.scrollWidth-Te.clientWidth;if(t<=1)return;let r=Math.max(0,Math.min(t,Te.scrollLeft+e.deltaY));r!==Te.scrollLeft&&(e.preventDefault(),Te.scrollLeft=r)}function Mm(e){return e?.direction==="remote"?g("meta.tunnelRemote",{host:e.remoteHost||"127.0.0.1",port:String(e.remotePort??0),local:String(e.localTargetPort??0)}):g("meta.tunnelLocal",{local:String(e?.localPort??0),host:e?.remoteHost??"?",port:String(e?.remotePort??0)})}function Dr(){if(Oi===null||Qs===null||Ni===null||Ii===null)return;Ni.textContent="";let e=Pt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){Oi.dataset.hidden="";return}delete Oi.dataset.hidden;let r=Number(t.port);Qs.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(r)&&r!==22?":"+r:""),Ct!==null&&(e.persistTmux===!0?(Ct.textContent="tmux",Ct.dataset.state="ok",Ct.title=g("status.tmuxPersistedTitle")):t.persist===!0&&e.spawned===!0?(Ct.textContent=g("status.notPersisted"),Ct.dataset.state="warn",Ct.title=g("status.tmuxUnavailableTitle")):(Ct.textContent="",delete Ct.dataset.state,Ct.removeAttribute("title")));let i=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";Ii.dataset.state=i,Ii.title=g(i==="connected"?"status.connected":i==="connecting"?"status.connecting":i==="error"?"status.errored":"status.exited");let o=(n,a,u,l)=>{let d=document.createElement("button");d.type="button",d.className="tt_toolBtn tt_connAct",d.title=u,d.innerHTML=n+"<span></span>",d.lastElementChild.textContent=a,d.addEventListener("click",l),Ni.appendChild(d)};if(typeof t.command=="string"&&t.command!=="")return;let s=typeof t.name=="string"?t.name:"";for(let n of Wo)try{n({tab:e,spec:t,bookName:s,addAction:o})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}function Rm(e,t){if(li!==null){Vs();return}let r=document.createElement("div");r.className="tt_addMenu tt_connMore",li=r,Hr(r,g("panel.tunnels"),g("hint.tunnelsSettings"),()=>{Vs(),Qh(e,t)},void 0,Rh),document.body.appendChild(r);let i=e.getBoundingClientRect(),o=r.offsetWidth,n=i.left+o>window.innerWidth-8?i.right-o:i.left;r.style.left=Math.max(8,Math.min(n,window.innerWidth-o-8))+"px",r.style.top=i.bottom+6+"px";let a=u=>{li===r&&(r.contains(u.target)||e.contains(u.target)||Vs())};Js=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0)}function Vs(){Js!==null&&(document.removeEventListener("mousedown",Js,!0),Js=null),li!==null&&(li.remove(),li=null)}var Er=null,Ys=null,li=null,Js=null;function cn(){Ys!==null&&(document.removeEventListener("mousedown",Ys,!0),Ys=null),Er!==null&&(Er.remove(),Er=null)}function Qh(e,t){if(Er!==null){cn();return}let r=document.createElement("div");r.className="tt_tunnelPop";let i=document.createElement("div");i.className="tt_tunnelPopTitle",i.textContent=g("panel.tunnelsFor",{name:t}),r.appendChild(i);let o=document.createElement("div");o.textContent=g("list.loading"),r.appendChild(o);let s=document.createElement("span");s.className="tt_cardHint",s.textContent=g("hint.tunnelsCard"),r.appendChild(s),document.body.appendChild(r),Er=r;let n=e.getBoundingClientRect();r.style.top=String(n.bottom+6)+"px",r.style.left=String(Math.max(8,n.right-340))+"px";let a=u=>{Er===r&&(r.contains(u.target)||e.contains(u.target)||cn())};Ys=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let u=[];try{let m=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();m.ok&&Array.isArray(m.tunnels)&&(u=m.tunnels)}catch{}if(Er!==r)return;o.textContent="";let l=da.filter(d=>d?.bookName===t&&d?.enabled!==!1);if(l.length===0){let d=document.createElement("span");d.className="tt_cardHint",d.textContent=g("list.noActiveTunnels"),o.appendChild(d);return}for(let d of l){let m=u.find(h=>h?.name===d?.name),y=m?.state??"stopped",_=document.createElement("div");_.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=y==="active"?"connected":y==="error"?"error":"connecting";let f=document.createElement("span");f.className="tt_connTarget",f.title=String(m?.error??m?.lastForwardError??""),f.textContent=Mm(d)+" \xB7 "+y+(m?.fatal===!0?g("status.fatalSuffix"):""),_.appendChild(c),_.appendChild(f),o.appendChild(_)}})()}function wn(e){let t=1;for(let r of ie.keys()){if(r===e)return String(t);t+=1}return String(t)}function Am(e,t){let r=ie.get(e);if(r===void 0||t.querySelector(".tt_tabRename")!==null)return;let i=t.querySelector(".tt_tabLabel");if(i===null)return;let o=document.createElement("input");o.className="tt_tabRename",o.value=r.label||g("panel.tabLabel",{n:wn(e)}),i.replaceWith(o),o.focus(),o.select();let s=!1,n=()=>{if(s)return;s=!0;let u=o.value.trim();r.label=u!==""?u:void 0,ut(),Kt()},a=()=>{s||(s=!0,ut())};o.addEventListener("keydown",u=>{u.stopPropagation(),u.key==="Enter"?n():u.key==="Escape"&&a()}),o.addEventListener("blur",n),o.addEventListener("click",u=>u.stopPropagation())}var da=[],ed="dialog",wr="off",sr={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},td="dsh-tty:show-hidden",Lr=(()=>{try{return localStorage.getItem(td)==="1"}catch{return!1}})();function Dm(e){Lr=e===!0;try{localStorage.setItem(td,Lr?"1":"0")}catch{}for(let t of Uo)try{t(Lr)}catch{}}var Uo=new Set,$o=null,ci=null,rd=!1,id=!1,br=null,hn=null,Pr=!1;function sd(e){Pr=e,hn!==null&&hn.set(e)}function Pm(e){sd(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==nn&&(nn=e.statsEnabled,ss(),Nr())}function Xi(e){Pm(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(nr=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(da=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(ed=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(wr=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(sr={...sr,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(ci=e.maxSessions),e!==null&&typeof e=="object"&&typeof e.allowProxyCommand=="boolean"&&(rd=e.allowProxyCommand),e!==null&&typeof e=="object"&&typeof e.assistEnabled=="boolean"&&(rn=e.assistEnabled,rn||Bt(),Fr()),e!==null&&typeof e=="object"&&typeof e.allowProxyCommandGranted=="boolean"&&(id=e.allowProxyCommandGranted)}function Bm(e,t){let r=t==="error"||t==="info"?t:"warn",i=document.createElement("div");i.className="tt_toast",i.dataset.kind=r,i.innerHTML='<span class="tt_toastIcon">'+(r==="error"?Ih:r==="info"?Y_:V_)+'</span><span class="tt_toastText"></span>',i.lastElementChild.textContent=e,document.body.appendChild(i),setTimeout(()=>i.remove(),4e3)}async function nd(){try{Ne({t:"sessions"});let e=await an("sessions",3e3);if(e!==null&&Array.isArray(e.list))return br=Uc(e.list),br}catch{}return null}async function dn(){if(await nd(),ci===null||br===null||br<ci)return null;let e=[...ie.values()].filter(o=>!o.exited).length,t=Math.max(0,br-e),r=t>0?g("msg.maxSessionsOthers",{count:t}):"",i=g("msg.maxSessions",{live:br,max:ci,own:e,others:r});return Bm(i),i}function Om(){return ci!==null&&br!==null&&br>=ci}function ua(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function od(e){return da.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function qo(e){let t=Number(e?.port),r=Number.isInteger(t)&&t!==22?":"+t:"",i=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",o=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+r+" \xB7 "+i+o}async function Ko(e,t){let r=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),i=await r.json().catch(()=>({}));return i&&i.ok===!1&&i.error?{error:String(i.error)}:i&&i.result?{result:i.result}:{error:String(i&&i.error?i.error:g("error.probeHttp",{status:r.status}))}}function Go(e,t){if(!e)return g("msg.probing");let r=e,i=typeof r.tcp?.ms=="number"?r.tcp.ms:null,o=typeof r.auth?.ms=="number"?r.auth.ms:null,s=[];if(r.jump!==null&&typeof r.jump=="object"&&typeof r.jump.label=="string"&&r.jump.label!==""){let d=typeof r.jump.tcp?.ms=="number"?r.jump.tcp.ms:null,m=r.jump.tcp?.ok?d!==null?d+"ms":g("meta.reachable"):g("meta.unreachable");s.push(g("meta.jumpStage",{label:r.jump.label})+" "+m)}r.proxy!==null&&typeof r.proxy=="object"&&s.push(r.proxy.active===!0?g("meta.probeProxy"):g("meta.probeProxyOff")),r.tcp?.ok?s.push("TCP "+(i!==null?i+"ms":g("meta.reachable"))):r.tcp?.skipped===!0&&s.push(g("meta.probeTcpSkipped")),r.banner?.ok&&s.push(g("meta.probeBanner"));let n=r.hostkey?.state;if(n==="matched"?s.push(g("meta.hostKeyMatched")):n==="recorded"?s.push(g("meta.hostKeyRecorded")):n==="mismatch"&&s.push(g("meta.hostKeyMismatch")),r.auth?.ok){let d=o!==null?g("meta.authOkMs",{ms:o}):g("meta.authOk");return g("meta.probeOk",{detail:d+(s.length?" \xB7 "+s.join(" \xB7 "):"")})}let a=r.tcp?.skipped===!0?"":r.tcp?.error,l=(r.auth?.error||a||g("error.unknown"))+(s.length?" \xB7 "+s.join(" \xB7 "):"");return t?.prefix!==void 0?t.prefix+l:g("error.probeFailed",{detail:l})}async function fa(){try{let t=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(t.ok&&typeof t.config=="object"&&t.config!==null){let r=nr;Xi(t.config),Et!==null&&nr!==r&&Zo(Et)}}catch{}}function ad(e){Et!==null&&(e.target instanceof Element&&(Et.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||xt())}function os(e,t){ld(e,t.getBoundingClientRect())}function ld(e,t){let r=e.offsetWidth,i=e.offsetHeight,s=t.left+r>window.innerWidth-8?t.right-r:t.left;e.style.left=Math.max(8,Math.min(s,window.innerWidth-r-8))+"px";let n=t.bottom+6,a=t.top-i-6;e.style.top=(n+i>window.innerHeight-8&&a>=8?a:Math.min(n,Math.max(8,window.innerHeight-i-8)))+"px"}function Im(e){if(Et!==null){xt();return}Lt(),fa(),nd().then(()=>{Et!==null&&Zo(Et)});let t=document.createElement("div");t.className="tt_addMenu",Et=t,Zo(t),document.body.appendChild(t),os(t,e),document.addEventListener("mousedown",ad,!0)}function xt(){Et!==null&&(document.removeEventListener("mousedown",ad,!0),Et.remove(),Et=null)}function Nm(e){if(pt!==null){Lt();return}xt();let t=document.createElement("div");t.className="tt_addMenu tt_tabMenu",pt=t,Vo(),document.body.appendChild(t),os(t,e),document.addEventListener("mousedown",cd,!0),document.addEventListener("keydown",hd,!0)}function Lt(){pt!==null&&(document.removeEventListener("mousedown",cd,!0),document.removeEventListener("keydown",hd,!0),pt.remove(),pt=null)}function cd(e){pt!==null&&(e.target instanceof Element&&(pt.contains(e.target)||e.target.closest(".tt_tabMore")!==null)||Lt())}function hd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Lt())}function Vo(){let e=pt;if(e===null)return;e.textContent="";let t=qm();if(t.length===0){let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=g("list.tabsAllVisible"),e.appendChild(i),Yo(e,xe),Jo(e);return}for(let[i,o]of t){let s=Kh(i)||o.label||g("panel.tabLabel",{n:wn(i)}),n=Km(o),a=document.createElement("div");a.className="tt_addMenuRow tt_tabMenuRow",a.dataset.sid=i;let u=document.createElement("button");u.type="button",u.className="tt_addMenuItem tt_tabMenuItem",i===xe&&(u.dataset.active="");let l=document.createElement("span");l.className="tt_tabDot",l.dataset.state=ln(o),u.appendChild(l);let d=document.createElement("span");d.className="tt_addMenuText tt_tabMenuText";let m=document.createElement("span");if(m.className="tt_addMenuMain",m.textContent=s,d.appendChild(m),n!==""){let _=document.createElement("span");_.className="tt_tabMenuMeta",_.textContent=n,d.appendChild(_)}u.appendChild(d),u.title=n===""?s:s+" \xB7 "+n,u.addEventListener("click",()=>{lr(i,{user:!0}),Lt()}),a.appendChild(u);let y=document.createElement("button");y.type="button",y.className="tt_addMenuEdit",y.innerHTML=ts,y.title=g("btn.close"),y.setAttribute("aria-label",g("btn.closeTabAria",{label:s})),y.addEventListener("click",()=>{Gt(i)}),a.appendChild(y),e.appendChild(a)}let r=e.querySelector(".tt_tabMenuItem[data-active]");r!==null&&typeof r.scrollIntoView=="function"&&r.scrollIntoView({block:"nearest"}),Yo(e,xe),Jo(e)}function dd(){return[...ie].map(([e,t])=>({sid:e,embedded:t.embedded===!0,exited:t.exited===!0,agentOwned:t.agentOwned===!0}))}function Yo(e,t){let r=Yc(dd(),t),i=[[g("btn.closeOthers",{n:String(r.others.sids.length)}),r.others,Tr],[g("btn.closeLeft",{n:String(r.left.sids.length)}),r.left,oa],[g("btn.closeRight",{n:String(r.right.sids.length)}),r.right,na]].filter(([,s])=>s.sids.length>0);if(i.length===0)return;let o=document.createElement("div");o.className="tt_addMenuSep",e.appendChild(o);for(let[s,n,a]of i)Hr(e,s,n.live>0?g("list.subLive",{n:String(n.live)}):"",()=>{Hm(n)},void 0,a)}function Hm(e){if(or(),Lt(),e.sids.length===0)return;let t=e.sids.slice(),r=()=>{for(let i of t)Gt(i)};if(e.confirm!==!0){r();return}Ad({title:g("confirm.tabsTitle",{n:String(e.live)}),text:e.agentLive>0?g("confirm.tabsTextAgent",{n:String(e.live),agent:String(e.agentLive)}):g("confirm.tabsText",{n:String(e.live)}),hint:g("confirm.tabsHint"),okLabel:g("confirm.tabsOk",{n:String(e.live)}),onOk:r})}var hi=null,ud=null;function Fm(e,t,r){if(ie.get(e)===void 0)return;or(),xt(),Lt();let i=document.createElement("div");i.className="tt_addMenu tt_tabCtxMenu",hi=i,ud=e,Wm(i,e),document.body.appendChild(i),ld(i,{left:t,right:t,top:r,bottom:r}),document.addEventListener("mousedown",fd,!0),document.addEventListener("keydown",pd,!0)}function or(){hi!==null&&(document.removeEventListener("mousedown",fd,!0),document.removeEventListener("keydown",pd,!0),hi.remove(),hi=null,ud=null)}function fd(e){hi!==null&&(e.target instanceof Element&&hi.contains(e.target)||or())}function pd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),or())}function Wm(e,t){let r=ie.get(t);if(r===void 0)return;let i=r.label||g("panel.tabLabel",{n:wn(t)});if(Hr(e,g("btn.closeTab"),i,()=>{or(),Gt(t)},void 0,ts),To(r)){let o=xr(r.spawnSpec);Hr(e,g(Jc(o)),i,()=>{or(),vm(t,!o)},void 0,o?z_:j_)}Yo(e,t),Jo(e)}function jm(e){let t=_d(e.target);if(t===null)return;e.preventDefault();let r=e.clientX,i=e.clientY;if(r===0&&i===0){let o=e.target instanceof Element?e.target.closest(".tt_tab"):null;if(o!==null){let s=o.getBoundingClientRect();r=s.left,i=s.bottom}}Fm(t,r,i)}function zm(e){if(e.button!==1)return;let t=_d(e.target);t!==null&&(e.preventDefault(),Gt(t))}function _d(e){if(!(e instanceof Element))return null;let t=e.closest(".tt_tab");if(t===null)return null;let r=t.dataset.sid;return r===void 0||r===""||!ie.has(r)?null:r}function md(){return[...ie.values()].filter(e=>e.embedded!==!0&&e.exited===!0)}function Jo(e){let t=md();if(t.length===0)return;let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r),Hr(e,g("list.cleanExited",{n:String(t.length)}),"",()=>{Lt(),or();for(let i of t)Gt(i.sid)},void 0,Mh)}var Um=40;function $m(e,t){let r=e.getBoundingClientRect();return Math.max(0,Math.min(r.right,t.right)-Math.max(r.left,t.left))}function qm(){let e=[];if(Te===null)return e;let t=Te.getBoundingClientRect();for(let[r,i]of ie){if(i.embedded===!0)continue;let o=Te.querySelector('[data-sid="'+r+'"]');o!==null&&$m(o,t)<Um&&e.push([r,i])}return e}function Km(e){return typeof e.target=="string"?e.target:""}function Gm(){return g("panel.assistTitle")===Xs["panel.assistTitle"]?"zh":"en"}function Vm(e){let t=e!=null&&typeof e.exitCode=="number"?String(e.exitCode):"?";return g("badge.assistFailed",{code:t})}function Fr(){if(gr===null)return;let e=xe===null?void 0:yr.get(xe),t=rn&&e!==void 0&&e.dismissed!==!0;if(gr.hidden=!t,t){let r=gr.querySelector(".tt_assistBadgeText");r!==null&&(r.textContent=Vm(e))}}function Bt(){ni!==null&&(ni.abort(),ni=null),Ar!==null&&(Ar.remove(),Ar=null),Ir=null,sn=null}function Ym(e){Ar!==null&&(e.target instanceof Element&&(Ar.contains(e.target)||e.target.closest(".tt_assistBadge")!==null)||Bt())}function Jm(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Bt())}function Xm(e){let t=xe;if(t===null)return;Bt();let r=document.createElement("div");r.className="tt_addMenu tt_assistMenu",Ar=r,Ir=t,sn=e,document.body.appendChild(r),document.addEventListener("mousedown",Ym,!0),document.addEventListener("keydown",Jm,!0),Xo(),os(r,e),Zm(t)}async function Zm(e){let t=yr.get(e);if(t===void 0||t.busy===!0||(t.error===null||t.error===void 0)&&t.answer!==null&&t.answer!==void 0)return;t.busy=!0,t.answer=null,t.command="",t.error=null,Xo();let r=new AbortController;ni=r;try{let i=await fetch("/api/dsh-tty/assist",{method:"POST",cache:"no-store",headers:{"content-type":"application/json"},body:JSON.stringify({sid:e,kind:"failure",lang:Gm()}),signal:r.signal}),o=await i.json().catch(()=>null);if(Ir!==e)return;t.busy=!1,i.ok&&o!==null&&o.ok===!0?(t.answer=String(o.answer!==void 0?o.answer:""),t.command=String(o.command!==void 0?o.command:"")):t.error=o!==null&&o.error!==void 0?String(o.error):"HTTP "+String(i.status)}catch(i){if(r.signal.aborted||Ir!==e)return;t.busy=!1,t.error=i instanceof Error?i.message:String(i)}finally{ni===r&&(ni=null),t.busy=!1,Xo()}}function Xo(){let e=Ar;if(e===null)return;let t=Ir,r=t===null?void 0:yr.get(t);e.textContent="";let i=document.createElement("div");i.className="tt_assistHead";let o=document.createElement("span");if(o.className="tt_assistTitle",o.textContent=g("panel.assistTitle"),i.appendChild(o),r!==void 0&&typeof r.exitCode=="number"){let m=document.createElement("span");m.className="tt_assistCode",m.textContent="exit="+String(r.exitCode),i.appendChild(m)}e.appendChild(i);let s=r!==void 0&&typeof r.error=="string"&&r.error!=="",n=document.createElement("div");if(n.className="tt_assistBody",r===void 0||r.busy===!0){n.classList.add("tt_assistMuted","tt_assistBusy");let m=document.createElement("span");m.className="tt_assistSpin",n.appendChild(m),n.appendChild(document.createTextNode(g("status.assistThinking")))}else if(s)n.textContent=g("error.assistRequest",{message:r.error}),n.classList.add("tt_assistError");else{let m=r.answer!==null&&r.answer!==void 0?r.answer:"";n.textContent=m,n.classList.add("tt_assistAnswer"),m===""&&(n.hidden=!0)}if(e.appendChild(n),r===void 0||r.busy===!0)return;let a=r.command!=="";if(a){let m=document.createElement("div");m.className="tt_assistCmdWrap";let y=document.createElement("span");y.className="tt_assistCmdLabel",y.textContent=g("panel.assistCommand"),m.appendChild(y);let _=document.createElement("div");_.className="tt_assistCmd",_.textContent=r.command,m.appendChild(_),e.appendChild(m)}let u=document.createElement("div");if(u.className="tt_assistFoot",a){let m=document.createElement("button");m.type="button",m.className="tt_toolBtn tt_assistFill",m.textContent=g("btn.assistFill"),m.title=g("hint.assistFillNoEnter"),m.addEventListener("click",Qm),u.appendChild(m)}let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent=g(s?"btn.assistCopyError":"btn.assistCopy"),l.addEventListener("click",()=>{if(s){wh(g("error.assistRequest",{message:r.error}));return}wh(r.answer!==null&&r.answer!==void 0?r.answer:"")}),u.appendChild(l);let d=document.createElement("button");if(d.type="button",d.className="tt_toolBtn tt_assistClose",d.textContent=g("btn.assistClose"),d.addEventListener("click",()=>{Bt()}),u.appendChild(d),e.appendChild(u),!s){let m=document.createElement("span");m.className="tt_assistNote",m.textContent=g(a?"hint.assistFillNoEnter":"hint.assistNoCommand"),e.appendChild(m)}sn!==null&&os(e,sn)}function Qm(){let e=Ir,t=e===null?void 0:yr.get(e);if(e===null||t===void 0||t.command==="")return;Ne({t:"input",sid:e,d:""+t.command});let r=ie.get(e);Bt(),eg(e),r!==void 0&&r.term!==null&&r.term.focus()}function eg(e){let t=yr.get(e);t!==void 0&&(t.dismissed=!0),Fr()}function Hr(e,t,r,i,o,s){let n=document.createElement("button");if(n.type="button",n.className="tt_addMenuItem",o===!0&&(n.setAttribute("data-soldout",""),n.title=g("btn.maxSessionsTitle")),s!==void 0){let l=document.createElement("span");l.className="tt_addMenuIcon",l.innerHTML=s,n.appendChild(l)}let a=document.createElement("span");a.className="tt_addMenuText";let u=document.createElement("span");if(u.className="tt_addMenuMain",u.textContent=t,a.appendChild(u),r!==""){let l=document.createElement("span");l.className="tt_addMenuSub",l.textContent=r,a.appendChild(l)}n.appendChild(a),n.addEventListener("click",i),e.appendChild(n)}function Zo(e){e.textContent="";let t=Om();Hr(e,g("option.localTerminal"),g(wr==="tmux"?"hint.tmuxHosted":"hint.openInSessionCwd"),async()=>{await dn()||(xt(),Yi())},t,pn);let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r);let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=g("panel.sshBook"),e.appendChild(i);for(let s of nr){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let n=document.createElement("div");n.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title=g("btn.maxSessionsTitle"));let u=document.createElement("span");u.className="tt_addMenuIcon",u.innerHTML=G_;let l=document.createElement("span");l.className="tt_addMenuText";let d=document.createElement("span");d.className="tt_addMenuMain",d.textContent=s.name;let m=document.createElement("span");m.className="tt_addMenuSub";let y=od(s.name),_=Co(s.jump);m.textContent=qo(s)+(_===""?"":" "+g("meta.viaJump",{label:_}))+(typeof s.proxyCommand=="string"&&s.proxyCommand.trim()!==""?" "+g("meta.viaProxy"):"")+(y>0?" \xB7 \u21C4"+String(y):""),l.appendChild(d),l.appendChild(m),a.appendChild(u),a.appendChild(l),a.addEventListener("click",async()=>{if(await dn())return;xt();let h=wr==="tmux"&&s.persist!==!1?{persist:!0,persistName:ua()}:{};Yi({t:"ssh",name:s.name,...h},s.name)});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title=g("btn.sftpFileBrowse"),c.innerHTML=$i,c.addEventListener("click",()=>{xt(),yn({name:s.name})});let f=document.createElement("button");f.type="button",f.className="tt_addMenuEdit",f.title=g("btn.editConnection"),f.innerHTML=ia,f.addEventListener("click",()=>{xt(),vh(s)}),n.appendChild(a),n.appendChild(c),n.appendChild(f),e.appendChild(n)}if(nr.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent=g("list.emptySshBook"),e.appendChild(s)}let o=document.createElement("div");o.className="tt_addMenuSep",e.appendChild(o),Hr(e,g("option.sshConnect"),g("hint.sshConnect"),()=>{xt(),vh()},!1,Nh)}function vh(e){if(oi!==null)return;let t=e!==null&&typeof e=="object"?e:null,r=t!==null,i=document.createElement("div");i.className="tt_sshBackdrop";let o=document.createElement("div");o.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshHead";let n=document.createElement("div");n.className="tt_sshBody";let a=document.createElement("div");a.className="tt_sshFoot";let u=document.createElement("div");u.className="tt_sshTitle",u.innerHTML=Nh+"<span></span>",u.lastElementChild.textContent=r?g("panel.editConnection",{name:String(t.name??"")}):g("panel.sshConnect"),s.appendChild(u);let l=Q=>{let oe=document.createElement("div");return oe.className="tt_sshSection",oe.textContent=Q,oe},d={},m=(Q,oe,de)=>{let ae=document.createElement("label");ae.className="tt_sshRow";let pe=document.createElement("span");pe.className="tt_cardLabel",pe.textContent=oe,ae.appendChild(pe);let ue;if(de?.select!==void 0){ue=document.createElement("select");for(let Ce of de.select){let ve=document.createElement("option");ve.value=Ce.value,ve.textContent=Ce.label,ue.appendChild(ve)}}else ue=document.createElement("input"),ue.type=de?.type??"text",ue.placeholder=de?.placeholder??"";return ue.className="tt_cardInput",ue.autocomplete="off",ue.spellcheck=!1,ae.appendChild(ue),d[Q]=ue,ae};n.appendChild(l(g("section.connection")));let y=document.createElement("div");y.className="tt_sshGrid",y.appendChild(m("host",g("field.host"),{placeholder:g("placeholder.host")})),y.appendChild(m("port",g("field.port"),{placeholder:"22"})),n.appendChild(y),n.appendChild(m("username",g("field.username"),{placeholder:"root"})),n.appendChild(l(g("section.auth"))),n.appendChild(m("auth",g("field.authMethod"),{select:[{value:"agent",label:g("option.authAgent")},{value:"key",label:g("option.authKey")},{value:"password",label:g("option.authPassword")}]}));let _=m("keyPath",g("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),c=m("passphrase",g("field.passphrase"),{type:"password"}),f=m("password",g("field.password"),{type:"password"}),h=(Q,oe)=>{let de=document.createElement("div");de.className="tt_sshRow tt_envRow";let ae=document.createElement("input");ae.type="text",ae.className="tt_cardInput",ae.placeholder=g("placeholder.credRef"),ae.title=g("hint.credRefCandidates"),ae.autocomplete="off",ae.spellcheck=!1;let pe=document.createElement("span");pe.className="tt_cardHint tt_envEmpty",pe.textContent=oe,pe.hidden=!0,ae.hidden=!0;let ue=document.createElement("div");ue.className="tt_envList",ue.dataset.hidden="";let Ce=[],ve=()=>{if(ue.textContent="",Ce.length===0){let Le=document.createElement("span");Le.className="tt_cardHint",Le.textContent=oe,ue.appendChild(Le);return}let ye=ae.value.trim().toUpperCase(),Ee=ye===""?Ce:Ce.filter(Le=>Le.toUpperCase().includes(ye));for(let Le of Ee.slice(0,30)){let Se=document.createElement("button");Se.type="button",Se.className="tt_envItem",Se.textContent=Le;let De="env:"+Le,Qe=null,ht=()=>{Qe!==null&&(clearTimeout(Qe),Qe=null),Se.textContent=Le,delete Se.dataset.danger};Se.addEventListener("mousedown",cr=>cr.preventDefault()),Se.addEventListener("click",()=>{let cr=Q.value;if(cr===""||cr.startsWith("env:")||Qe!==null){ht(),Q.value=De,Q.focus(),Q.dispatchEvent(new Event("change"));return}Se.textContent=g("list.credOverwrite",{name:Le}),Se.dataset.danger="",Qe=setTimeout(ht,4e3)}),ue.appendChild(Se)}if(Ee.length>30){let Le=document.createElement("span");Le.className="tt_envMore",Le.textContent=g("list.moreMatches",{count:Ee.length-30}),ue.appendChild(Le)}else if(Ee.length===0){let Le=document.createElement("span");Le.className="tt_envMore",Le.textContent=g("list.noCredRef"),ue.appendChild(Le)}};return ae.addEventListener("input",ve),ae.addEventListener("focus",()=>{Ce.length>0&&delete ue.dataset.hidden}),ae.addEventListener("blur",()=>{ae.value.trim()===""&&(ue.dataset.hidden="")}),de.appendChild(ae),de.appendChild(pe),de.appendChild(ue),{row:de,setNames(ye){Ce=Array.isArray(ye)?ye:[];let Ee=Ce.length>0;ae.hidden=!Ee,pe.hidden=Ee,ve()}}},p=(Q,oe)=>{let de=document.createElement("div");de.className="tt_sshRow tt_credRow";let ae=document.createElement("label");ae.className="tt_credToggle";let pe=document.createElement("input");pe.type="checkbox",pe.className="tt_cardCheckbox";let ue=document.createElement("span");ue.textContent=g("check.rememberCredential"),ae.appendChild(pe),ae.appendChild(ue),pe.checked=Ut!==null,ae.title=g("hint.rememberCredential");let Ce=document.createElement("button");Ce.type="button",Ce.className="tt_toolBtn tt_credClear",Ce.textContent=g("btn.clearCredential"),Ce.dataset.hidden="";let ve=document.createElement("span");ve.className="tt_credStatus",de.appendChild(ae),de.appendChild(Ce),de.appendChild(ve);let ye=(Se,De)=>{ve.textContent=Se,ve.dataset.kind=De},Ee=async()=>{let Se=ii(Q.value),De=Se!=="";if(ae.hidden=De,Ce.hidden=!De,ve.hidden=!1,ui()===null){pe.disabled=!0,pe.checked=!1,Ce.disabled=!0,ye(g(Ut===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),"muted");return}if(pe.disabled=!1,!De){ve.hidden=!0,ye("","plain");return}let Qe=await Eh(Se);if(Qe.unreported===!0){ye(g("status.credUnreported",{ref:Se}),"plain");return}if(Qe.error!==void 0){ye(g("error.credStatusFailed",{error:Qe.error}),"error");return}let ht=Qe.view;ye(ht.configured?g("status.credStored",{ref:Se,source:ht.source!==""?g("meta.credSource",{source:ht.source}):""}):g("status.credUnknown",{ref:Se}),ht.configured?"ok":"plain"),Ce.disabled=ht.configured!==!0||ht.writable!==!0};Ce.addEventListener("click",()=>{(async()=>{let Se=ii(Q.value);if(Se==="")return;let De=await Lh(Se);if(De.error!==void 0){ye(De.error,"error");return}Q.value="",await Ee()})()});let Le=async()=>{let Se=await Th(pe.checked===!0,Q.value,d.host.value,d.port.value,d.username.value,oe);return Se.value!==void 0&&(Q.value=Se.value,await Ee()),Se};return Q.addEventListener("change",()=>{Ee()}),{row:de,refresh:Ee,storeIfRequested:Le}},v=h(d.passphrase,g("hint.noCredRefPassphrase")),S=h(d.password,g("hint.noCredRefPassword")),b=p(d.password,"PASSWORD");(async()=>{let Q=await kh();v.setNames(Q),S.setNames(Q)})(),n.appendChild(_),n.appendChild(c),n.appendChild(v.row),n.appendChild(f),n.appendChild(b.row),n.appendChild(S.row);let x=document.createElement("button");x.type="button",x.className="tt_sshAdvToggle",x.title=g("hint.advanced");let w=document.createElement("span");w.className="tt_sshAdvChevron",w.innerHTML=fh;let E=document.createElement("span");E.className="tt_sshAdvText",E.textContent=g("section.advanced");let B=document.createElement("span");B.className="tt_sshAdvMeta",x.appendChild(w),x.appendChild(E),x.appendChild(B);let P=document.createElement("div");P.className="tt_sshAdvBody";let W=()=>{let Q=[];return Ns(d.jumpHost.value)!==void 0&&Q.push(g("section.jump")),d.proxyCommand.value.trim()!==""&&Q.push(g("section.proxyCommand")),d.hostKeyAlias.value.trim()!==""&&Q.push(g("field.hostKeyAlias")),Q},A=()=>{let Q=P.hidden===!1;x.setAttribute("aria-expanded",Q?"true":"false"),w.innerHTML=Q?K_:fh;let oe=W();B.textContent=oe.length>0?g("meta.advancedConfigured",{items:oe.join(" \xB7 ")}):g("hint.advanced")},V=Q=>{P.hidden=!Q,A()};x.addEventListener("click",()=>V(P.hidden===!0)),P.hidden=!0,x.setAttribute("aria-expanded","false"),P.appendChild(l(g("section.jump")));let O=m("jumpHost",g("field.jumpHost"),{placeholder:g("placeholder.jumpHost")});P.appendChild(O);let R=document.createElement("label");R.className="tt_sshRow";let F=document.createElement("input");F.type="checkbox",F.className="tt_cardCheckbox";let I=document.createElement("span");I.className="tt_cardLabel",I.textContent=g("check.jumpOwnCred"),R.appendChild(F),R.appendChild(I),P.appendChild(R);let C=m("jumpUsername",g("field.jumpUsername"),{placeholder:"root"}),L=m("jumpAuth",g("field.jumpAuth"),{select:[{value:"",label:g("option.authInherit")},{value:"agent",label:g("option.authAgent")},{value:"key",label:g("option.authKey")},{value:"password",label:g("option.authPassword")}]}),T=m("jumpKeyPath",g("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),D=m("jumpPassphrase",g("field.passphrase"),{type:"password"}),N=m("jumpPassword",g("field.password"),{type:"password"});for(let Q of[C,L,T,D,N])P.appendChild(Q);let G=document.createElement("div");G.className="tt_cardHint",G.textContent=g("hint.jumpInherit"),G.title=g("hint.jumpInheritFull"),P.appendChild(G),P.appendChild(l(g("section.proxyCommand")));let $=m("proxyCommand",g("field.proxyCommand"),{placeholder:g("placeholder.proxyCommand")});P.appendChild($);let Y=document.createElement("div");Y.className="tt_cardHint",Y.textContent=g("hint.proxyCommand"),Y.title=g("hint.proxyCommandFull"),P.appendChild(Y);let H=document.createElement("div");H.className="tt_cardHint tt_sshProbeWarn",H.textContent=g("hint.proxyCommandDisabled"),P.appendChild(H),P.appendChild(m("hostKeyAlias",g("field.hostKeyAlias"),{placeholder:g("placeholder.hostKeyAlias")}));let k=document.createElement("span");k.className="tt_cardHint",k.textContent=g("hint.hostKeyAlias"),k.title=g("hint.hostKeyAliasFull"),P.appendChild(k);let j=()=>{let Q=d.proxyCommand.value.trim()!=="",oe=id,de=oe&&rd;H.textContent=g(oe?"hint.proxyCommandDisabled":"hint.proxyCommandNotGranted"),H.style.display=Q&&!de?"":"none"};d.proxyCommand.addEventListener("input",j),j();let q=()=>{let Q=Ns(d.jumpHost.value);if(Q===void 0)return;if(F.checked!==!0)return Q;let oe={...Q},de=d.jumpUsername.value.trim();de!==""&&(oe.username=de);let ae=d.jumpAuth.value;(ae==="agent"||ae==="key"||ae==="password")&&(oe.auth=ae);let pe=d.jumpKeyPath.value.trim();return pe!==""&&(oe.keyPath=pe),d.jumpPassphrase.value!==""&&(oe.passphrase=d.jumpPassphrase.value),d.jumpPassword.value!==""&&(oe.password=d.jumpPassword.value),oe},U=()=>{let Q=d.proxyCommand.value.trim();return Q===""?void 0:Q},J=()=>{let Q=Ns(d.jumpHost.value)!==void 0,oe=Q&&F.checked===!0;R.style.display=Q?"":"none";for(let de of[C,L,T,D,N])de.style.display=oe?"":"none";T.style.display=oe&&d.jumpAuth.value==="key"?"":"none",D.style.display=oe&&d.jumpAuth.value==="key"?"":"none",N.style.display=oe&&d.jumpAuth.value==="password"?"":"none",G.style.display=Q?"":"none"};d.jumpHost.addEventListener("input",J),d.jumpAuth.addEventListener("change",J),F.addEventListener("change",J),n.appendChild(l(g("section.options")));let Z=document.createElement("label");Z.className="tt_cardRow";let se=document.createElement("input");se.type="checkbox",se.className="tt_cardCheckbox";let he=document.createElement("span");he.className="tt_cardLabel",he.textContent=g("check.agentForward"),Z.appendChild(se),Z.appendChild(he),n.appendChild(Z);let fe=document.createElement("label");fe.className="tt_cardRow";let te=document.createElement("input");te.type="checkbox",te.className="tt_cardCheckbox";let qe=document.createElement("span");qe.className="tt_cardLabel",qe.textContent=g("check.persist"),fe.appendChild(te),fe.appendChild(qe),te.checked=wr==="tmux",wr==="tmux"&&n.appendChild(fe);let le=document.createElement("label");le.className="tt_cardRow";let Me=document.createElement("input");Me.type="checkbox",Me.className="tt_cardCheckbox";let st=document.createElement("span");st.className="tt_cardLabel",st.textContent=g("check.saveToBook"),le.appendChild(Me),le.appendChild(st),n.appendChild(le);let He=m("name",g("field.bookName"),{placeholder:g("placeholder.bookName")});if(n.appendChild(He),n.appendChild(x),n.appendChild(P),Me.addEventListener("change",()=>{d.name.value=Pc(Me.checked,d.name.value,d.host.value),Me.checked&&d.name.focus()}),r||d.name.addEventListener("input",()=>{Me.checked=Dc(d.name.value)}),r){le.style.display="none",d.name.value=String(t.name??""),d.host.value=String(t.host??""),d.port.value=String(t.port??22),d.username.value=String(t.username??""),d.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",d.keyPath.value=String(t.keyPath??""),d.passphrase.value=String(t.passphrase??""),d.password.value=String(t.password??"");let Q=t.jump!==null&&typeof t.jump=="object"?t.jump:null;if(d.jumpHost.value=Co(Q),Q!==null){let oe=Q.auth!==void 0||Q.keyPath!==void 0||Q.password!==void 0||Q.passphrase!==void 0;F.checked=oe,oe&&(d.jumpUsername.value=String(Q.username??""),d.jumpAuth.value=Q.auth==="key"||Q.auth==="password"?String(Q.auth):"",d.jumpKeyPath.value=String(Q.keyPath??""),d.jumpPassphrase.value=String(Q.passphrase??""),d.jumpPassword.value=String(Q.password??""))}se.checked=t.agentForward===!0,d.hostKeyAlias.value=String(t.hostKeyAlias??""),d.proxyCommand.value=String(t.proxyCommand??""),j(),te.checked=wr==="tmux"}let ee=document.createElement("div");ee.className="tt_sshStatus";let ne=document.createElement("div");ne.className="tt_sshError";let ge=document.createElement("div");ge.className="tt_sshProbeResult",ee.appendChild(ne),ee.appendChild(ge),a.appendChild(ee),J(),V(W().length>0);for(let Q of[d.jumpHost,d.proxyCommand,d.hostKeyAlias])Q.addEventListener("input",A);let be=()=>d.hostKeyAlias.value.trim(),je=()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim(),de=Number(d.port.value);if((!Number.isInteger(de)||de<1||de>65535)&&(de=22),Q===""||oe==="")return ne.textContent=g("error.hostUserRequired"),null;let ae=d.auth.value,pe={host:Q,port:de,username:oe,auth:ae},ue=q();ue!==void 0&&(pe.jump=ue);let Ce=U();if(Ce!==void 0&&(pe.proxyCommand=Ce),ae==="key"){let ye=d.keyPath.value.trim();if(ye==="")return ne.textContent=g("error.keyPathRequired"),null;pe.keyPath=ye;let Ee=d.passphrase.value;Ee!==""&&(pe.passphrase=Ee)}if(ae==="password"){let ye=d.password.value;if(ye==="")return ne.textContent=g("error.passwordRequired"),null;pe.password=ye}se.checked&&(pe.agentForward=!0);let ve=be();return ve!==""&&(pe.hostKeyAlias=ve),pe},Oe=document.createElement("div");Oe.className="tt_sshActions";let ze=document.createElement("div");ze.className="tt_sshActionsGroup";let Re=document.createElement("div");Re.className="tt_sshActionsGroup",Oe.appendChild(ze),Oe.appendChild(Re);let We=document.createElement("button");We.type="button",We.className="tt_toolBtn",We.textContent=g("btn.cancel");let we=document.createElement("button");we.type="button",we.className="tt_cardSave",we.textContent=g("btn.connect"),ze.appendChild(We);let _t=document.createElement("button");_t.type="button",_t.className="tt_toolBtn",_t.textContent=g("btn.fileBrowse"),_t.title=g("btn.browseTitle"),_t.addEventListener("click",()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim(),de=Number(d.port.value);if((!Number.isInteger(de)||de<1||de>65535)&&(de=22),Q===""||oe===""){ne.textContent=g("error.hostUserRequired");return}let ae=d.auth.value,pe={host:Q,port:de,username:oe,auth:ae},ue=q();ue!==void 0&&(pe.jump=ue);let Ce=U();if(Ce!==void 0&&(pe.proxyCommand=Ce),ae==="key"){let ye=d.keyPath.value.trim();if(ye===""){ne.textContent=g("error.keyPathRequired");return}pe.keyPath=ye;let Ee=d.passphrase.value;Ee!==""&&(pe.passphrase=Ee)}if(ae==="password"){let ye=d.password.value;if(ye===""){ne.textContent=g("error.passwordRequired");return}pe.password=ye}se.checked&&(pe.agentForward=!0);let ve=be();ve!==""&&(pe.hostKeyAlias=ve),vr(),yn(pe)}),ze.appendChild(_t);let Ze=null;r&&(Ze=document.createElement("button"),Ze.type="button",Ze.className="tt_toolBtn",Ze.textContent=g("btn.saveEdit"),Ze.addEventListener("click",()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim();if(Q===""||oe===""){ne.textContent=g("error.hostUserRequired");return}let de=Number(d.port.value);(!Number.isInteger(de)||de<1||de>65535)&&(de=22);let ae=d.auth.value,ue={name:d.name.value.trim()||Q,host:Q,port:de,username:oe,auth:ae,keyPath:ae==="key"?d.keyPath.value.trim():"",passphrase:d.passphrase.value,password:d.password.value,agentForward:se.checked,hostKeyAlias:be(),persist:te.checked},Ce=q();if(Ce!==void 0&&(ue.jump=Ce),ue.proxyCommand=d.proxyCommand.value.trim(),ae==="key"&&ue.keyPath===""){ne.textContent=g("error.keyPathRequired");return}Ze!==null&&(Ze.disabled=!0),(async()=>{let ve=await b.storeIfRequested();if(ve.error!==void 0){ne.textContent=ve.error,Ze!==null&&(Ze.disabled=!1);return}ve.value!==void 0&&(ue.password=ve.value);let ye=await rg(String(t.name??""),ue);if(Ze!==null&&(Ze.disabled=!1),ye!==void 0){ne.textContent=g("error.saveCredFailed",{error:ye});return}vr()})()}),ze.appendChild(Ze));let nt=document.createElement("button");nt.type="button",nt.className="tt_toolBtn",nt.textContent=g("btn.probe"),nt.title=g("btn.probeTitle"),nt.addEventListener("click",()=>{let Q=je();Q!==null&&(ge.className="tt_sshProbeResult",ge.textContent=g("msg.probing"),nt.disabled=!0,Ko(Q,!1).then(oe=>{nt.disabled=!1,oe.result?(ge.className="tt_sshProbeResult"+(oe.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),ge.textContent=Go(oe.result)):(ge.className="tt_sshProbeResult tt_sshProbeBad",ge.textContent=g("error.probeFailed",{detail:String(oe.error||g("error.unknown"))}))}))}),ze.appendChild(nt),Re.appendChild(we),a.appendChild(Oe);let ls=()=>{_.style.display=d.auth.value==="key"?"":"none",c.style.display=d.auth.value==="key"?"":"none",v.row.style.display=d.auth.value==="key"?"":"none",f.style.display=d.auth.value==="password"?"":"none",S.row.style.display=d.auth.value==="password"?"":"none",b.row.style.display=d.auth.value==="password"?"":"none"};d.auth.addEventListener("change",ls),ls(),b.refresh(),We.addEventListener("click",()=>vr()),i.addEventListener("mousedown",Q=>{Q.target===i&&vr()}),we.addEventListener("click",async()=>{ne.textContent="";let Q=await dn();if(Q!==null){ne.textContent=Q;return}let oe=d.host.value.trim(),de=d.username.value.trim(),ae=Number(d.port.value);if((!Number.isInteger(ae)||ae<1||ae>65535)&&(ae=22),oe===""||de===""){ne.textContent=g("error.hostUserRequired");return}let pe=d.auth.value,ue={t:"ssh",host:oe,port:ae,username:de,auth:pe},Ce=q();Ce!==void 0&&(ue.jump=Ce);let ve=U();if(ve!==void 0&&(ue.proxyCommand=ve),pe==="key"){let De=d.keyPath.value.trim();De!==""&&(ue.keyPath=De);let Qe=d.passphrase.value;Qe!==""&&(ue.passphrase=Qe)}if(pe==="password"){let De=d.password.value;De!==""&&(ue.password=De)}se.checked&&(ue.agentForward=!0);let ye=be();ye!==""&&(ue.hostKeyAlias=ye),te.checked&&(ue.persist=!0,ue.persistName=ua());let Ee=ae!==22?de+"@"+oe+":"+ae:de+"@"+oe,Le=De=>{vr(),ce!==null&&Yi(ue,De!==""?De:Ee)};if(!Me.checked){Le("");return}let Se=d.name.value.trim()||oe;we.disabled=!0,(async()=>{let De=await b.storeIfRequested();if(De.error!==void 0){ne.textContent=De.error,we.disabled=!1;return}let Qe=De.value??ue.password??"",ht=await tg({name:Se,host:oe,port:ae,username:de,auth:pe,keyPath:ue.keyPath??"",passphrase:ue.passphrase??"",password:Qe,agentForward:se.checked,hostKeyAlias:be(),persist:te.checked,...Ce!==void 0?{jump:Ce}:{},proxyCommand:d.proxyCommand.value.trim()});if(we.disabled=!1,ht!==void 0){ne.textContent=g("error.saveBookFailed",{error:ht});return}Le(Se)})()}),o.appendChild(s),o.appendChild(n),o.appendChild(a),i.appendChild(o),document.body.appendChild(i),oi=i,d.host.focus()}function vr(){oi!==null&&(oi.remove(),oi=null)}async function tg(e){let t=[...nr.filter(r=>r?.name!==e.name),e];try{let r=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),i=await r.json().catch(()=>({}));if(!r.ok||!i.ok)return String(i.error||"HTTP "+r.status);Xi(i.config);return}catch(r){return String(r&&r.message?r.message:r)}}async function rg(e,t){if(t.name!==e&&nr.some(i=>i?.name===t.name))return g("error.bookNameTaken",{name:t.name});let r=nr.map(i=>i?.name===e?t:i);try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:r})}),o=await i.json().catch(()=>({}));if(!i.ok||!o.ok)return String(o.error||"HTTP "+i.status);Xi(o.config);return}catch(i){return String(i&&i.message?i.message:i)}}function ig(e,t,r){let i=Qr(r,xe);if(vd(i))return;let o=document.createElement("div");o.className="tt_sftpDualCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let n=document.createElement("div");n.className="tt_sshTitle",n.innerHTML=$i+"<span></span>",n.lastElementChild.textContent=g("panel.sftpDual",{label:t});let a=document.createElement("button");a.type="button",a.className="tt_close",a.title=g("btn.close"),a.innerHTML=_n,a.addEventListener("click",()=>mi(i)),s.appendChild(n),s.appendChild(a),o.appendChild(s);let u=document.createElement("div");u.className="tt_sftpStatus";let l=(N,G)=>{u.textContent=N,G===void 0?delete u.dataset.state:u.dataset.state=G},d=!1,m=(N,G)=>{if(!(d||_.local.busy||_.remote.busy)){d=!0;for(let $ of[_.local,_.remote])$.setBusy(!0);l(N,"busy"),Promise.resolve().then(G).catch($=>{($===null||typeof $!="object"||$.name!=="TransferCanceledError")&&R.fail(g("status.failed")),l(String($&&$.message?$.message:$),"error")}).finally(()=>{d=!1;for(let $ of[_.local,_.remote])$.setBusy(!1)})}},y=N=>{_[N].bar.after(h),h.style.display="",p.focus(),p.select()},_={},c=(N,G)=>{if(N===void 0||N==="")throw new Error(g("error.dirNotReady"));return N.endsWith("/")||N.endsWith("\\")?N+G:N+"/"+G},f=(N,G)=>{let $={kind:N,path:"",busy:!1},Y=document.createElement("div");Y.className="tt_sftpPane";let H=document.createElement("div");H.className="tt_sftpPaneHead";let k=document.createElement("span");k.textContent=G;let j=document.createElement("span");j.className="tt_sftpPaneMeta",H.appendChild(k),H.appendChild(j),Y.appendChild(H);let q=document.createElement("div");q.className="tt_sftpBar";let U=document.createElement("input");U.type="text",U.className="tt_sftpPath",U.placeholder=g(N==="local"?"placeholder.localPath":"placeholder.remotePath"),U.spellcheck=!1,U.autocomplete="off";let J=document.createElement("button");J.type="button",J.className="tt_toolBtn",J.innerHTML=sa+"<span>"+g("btn.refresh")+"</span>";let Z=document.createElement("button");Z.type="button",Z.className="tt_toolBtn",Z.innerHTML=Oh+"<span>"+g("btn.mkdir")+"</span>";let se=document.createElement("button");se.type="button",se.className="tt_toolBtn tt_toolToggle",se.textContent=g("btn.hiddenFiles"),se.title=g("btn.hiddenFilesTitle"),Lr&&(se.dataset.on=""),q.appendChild(U),q.appendChild(J),q.appendChild(Z),q.appendChild(se),Y.appendChild(q);let he=document.createElement("div");he.className="tt_sftpList",Y.appendChild(he),$.bar=q;let fe=ee=>{$.busy=ee;for(let ne of[J,Z])ne.disabled=ee;U.disabled=ee},te=async(ee,ne)=>{let ge=N==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",be=N==="local"?ne:{...e,...ne},je=await fetch(ge+ee,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(be)}),Oe=await je.json().catch(()=>({}));if(!je.ok||Oe.ok!==!0)throw new Error(String(Oe.error||"HTTP "+je.status));return Oe},qe=(ee,ne)=>{if(!($.busy||d))return fe(!0),l(ee,"busy"),Promise.resolve().then(ne).catch(ge=>l(String(ge&&ge.message?ge.message:ge),"error")).finally(()=>fe(!1))},le=(ee,ne)=>{if(ee===void 0||ee==="")throw new Error(g("error.dirNotReady"));return ee.endsWith("/")||ee.endsWith("\\")?ee+ne:ee+"/"+ne},Me=ee=>{let ne=le($.path,ee.name),ge=[];ee.isDir===!0?ge.push(g("meta.dir")):ge.push(ct(Number(ee.size))||"\u2014");let be=yd(Number(ee.mtime));be!==""&&ge.push(be);let je=w(ee.isDir?$i:ee.isSymlink?Ph:Dh,ee.name,ge.join(" \xB7 "),ee.isDir===!0?"dir":ee.isSymlink===!0?"link":"file"),Oe=()=>$.loadDir($.path),ze=N==="local"?_.remote:_.local;return ee.isDir===!0&&je.addEventListener("click",Re=>{Re.target instanceof Element&&Re.target.closest(".tt_sftpAct")!==null||$.loadDir(ne)}),E(je,N==="local"?na:oa,g("btn.transferTo",{target:g(N==="local"?"meta.remote":"meta.local"),path:ze.path}),()=>{if($.path===""||ze.path===""){l(g("error.transferDirsNotReady"),"error");return}R.reset(),R.pulse(0),m(g("msg.transferring",{name:ee.name}),async()=>{let Re=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:N==="local"?"up":"down",...e,localPath:N==="local"?ne:le(ze.path,ee.name),remotePath:N==="local"?le(ze.path,ee.name):ne})}),We=await Re.json().catch(()=>({}));if(!Re.ok||We.ok!==!0)throw R.fail(g("error.transferFailed")),new Error(String(We.error||"HTTP "+Re.status));let we=We.job?.id;if(typeof we!="string"||we==="")throw R.fail(g("error.transferFailed")),new Error(g("error.noTaskId"));await F(we,ee.name)==="canceled"?(R.reset(),l(g("msg.transferCanceled",{name:ee.name}))):(R.done(g("status.done")),setTimeout(()=>R.reset(),1500),l(g("msg.transferred",{name:ee.name}))),await ze.loadDir(ze.path)})}),N!=="local"&&ee.isDir!==!0&&E(je,Bh,g("btn.download",{name:ee.name}),()=>{P(ee,ne)}),E(je,ia,g("btn.rename",{name:ee.name}),()=>{p.placeholder=g("placeholder.newName"),p.value=ee.name,y(N),b=async()=>{let Re=p.value.trim();Re===""||Re===ee.name||(x(),await $.runTask(g("msg.renaming",{name:ee.name}),async()=>{await te("rename",{from:ne,to:le($.path,Re)}),await Oe()}))}}),B(je,()=>$.runTask(g("msg.deleting",{name:ee.name}),async()=>{await te("remove",{path:ne,recursive:ee.isDir===!0}),await Oe(),l(g("msg.deleted",{name:ee.name}))}),ee),je},st=ee=>{if(he.textContent="",$.path!==""&&$.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test($.path)===!1){let be=w(ra,g("list.parentDir"),"","up");be.addEventListener("click",()=>{let je=N==="local"?og($.path):Sd($.path);je!==null&&$.loadDir(je)}),he.appendChild(be)}let ne=js(ee,Lr);if(ne.length===0){let be=document.createElement("div");be.className="tt_addMenuTitle",be.textContent=ee.length>0?g("list.hiddenOnly"):g("list.emptyDir"),he.appendChild(be);return}let ge=500;for(let be of ne.slice(0,ge))be===null||typeof be!="object"||typeof be.name!="string"||be.name===""||he.appendChild(Me(be));if(ne.length>ge){let be=document.createElement("div");be.className="tt_addMenuTitle",be.textContent=g("list.truncated",{rest:ne.length-ge,total:ne.length}),he.appendChild(be)}};$.loadDir=async ee=>{try{let ne=await te("list",{path:ee??$.path});$.path=typeof ne.path=="string"&&ne.path!==""?ne.path:$.path,U.value=$.path;let ge=Array.isArray(ne.entries)?ne.entries:[];$.rawEntries=ge,st(ge),j.textContent=g("list.itemCount",{count:js(ge,Lr).length}),l($.path)}catch(ne){l(String(ne&&ne.message?ne.message:ne),"error")}},$.runTask=qe,$.setBusy=fe,_[N]=$,se.addEventListener("click",()=>{Dm(!Lr)});let He=ee=>{se!==null&&(ee?se.dataset.on="":delete se.dataset.on),$.rawEntries=$.rawEntries??[],st($.rawEntries),j.textContent=g("list.itemCount",{count:js($.rawEntries,ee).length})};return Uo.add(He),$.onShowHidden=He,J.addEventListener("click",()=>{$.runTask(g("list.loading"),()=>$.loadDir($.path))}),Z.addEventListener("click",()=>{$.busy||d||(p.placeholder=g("placeholder.newDirName"),p.value="",y(N),b=async()=>{let ee=p.value.trim();ee!==""&&(x(),await $.runTask(g("msg.creatingDir",{name:ee}),async()=>{await te("mkdir",{path:le($.path,ee),parents:!0}),await $.loadDir($.path)}))})}),U.addEventListener("keydown",ee=>{if(ee.key!=="Enter"||(ee.preventDefault(),$.busy||d))return;let ne=U.value.trim();ne!==""&&$.runTask(g("list.loading"),()=>$.loadDir(ne))}),Y},h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let p=document.createElement("input");p.type="text",p.className="tt_cardInput",p.spellcheck=!1,p.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=g("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=g("btn.cancel"),h.appendChild(p),h.appendChild(v),h.appendChild(S);let b=null,x=()=>{h.style.display="none",p.value="",b=null};v.addEventListener("click",()=>{b?.()}),S.addEventListener("click",x),p.addEventListener("keydown",N=>{N.key==="Enter"?(N.preventDefault(),b?.()):N.key==="Escape"&&(N.stopPropagation(),x())});let w=(N,G,$,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let k=document.createElement("span");k.className="tt_sftpIcon",k.innerHTML=N,Y!==void 0&&(k.dataset.kind=Y);let j=document.createElement("span");if(j.className="tt_sftpName",j.textContent=G,j.title=G,H.appendChild(k),H.appendChild(j),$!==""){let q=document.createElement("span");q.className="tt_sftpMeta",q.textContent=$,H.appendChild(q)}return H},E=(N,G,$,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=G,H.title=$,H.addEventListener("click",k=>{k.stopPropagation(),Y()}),N.appendChild(H)},B=(N,G,$)=>{let Y=document.createElement("button");Y.type="button",Y.className="tt_sftpAct",Y.innerHTML=Tr,Y.title=$.isDir?g("btn.deleteEntryDir",{name:$.name}):g("btn.deleteEntry",{name:$.name});let H=null;Y.addEventListener("click",k=>{if(k.stopPropagation(),H!==null){clearTimeout(H),H=null,Y.innerHTML=Tr,delete Y.dataset.danger,G();return}Y.textContent=g("btn.confirm"),Y.dataset.danger="",H=setTimeout(()=>{H=null,Y.innerHTML=Tr,delete Y.dataset.danger},4e3)}),N.appendChild(Y)},P=(N,G)=>_.remote.runTask(g("msg.downloading",{name:N.name}),async()=>{R.reset();let $;try{$=await xd({makeBody:Y=>({...e,path:G,...Y>0?{offset:Y}:{}}),onProgress:(Y,H)=>R.set(Y,H),maxMb:sr.maxDownloadMb,registerCancel:Y=>R.setCancel(Y),onResume:Y=>l(g("msg.downloadResuming",{name:N.name,offset:ct(Y)||String(Y)+" B"}),"busy")})}catch(Y){if(di(Y)){R.reset(),l(g("msg.downloadCanceled",{name:N.name}));return}throw R.fail(g("error.downloadFailed")),Y}R.done(g("status.done")),kd($,N.name),setTimeout(()=>R.reset(),1500),l(g("msg.downloaded",{name:N.name,size:ct($.size)||String($.size)+" B"}))}),W=f("local",g("meta.local")),A=f("remote",g("meta.remote"));_.local.wrap=W,_.remote.wrap=A;let V=document.createElement("div");V.className="tt_sftpDual",V.appendChild(W),V.appendChild(A),o.appendChild(V),o.appendChild(h);let O=document.createElement("div");O.className="tt_sftpFoot";let R=Cd();O.appendChild(R.el),O.appendChild(u),o.appendChild(O);let F=async(N,G)=>{let $=!1;R.setCancel(()=>{$||($=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:N})}).catch(()=>{}))});try{for(;;){await new Promise(j=>setTimeout(j,400));let Y=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:N})}),H=await Y.json().catch(()=>({}));if(!Y.ok||H.ok!==!0){if($)return"canceled";throw new Error(String(H.error||"HTTP "+Y.status))}let k=H.job;if(k===null||typeof k!="object")throw new Error(g("error.invalidTaskState"));if(k.state==="running"){let j=typeof k.current=="string"&&k.current!==""?k.current:G;l(g("msg.transferring",{name:j}),"busy"),Number.isFinite(k.total)&&k.total>0?R.set(Number(k.bytes)||0,k.total):R.pulse(Number(k.bytes)||0);continue}if(k.state==="canceled")return"canceled";if(k.state!=="done")throw new Error(String(k.error||g("error.transferFailed")));return"done"}}finally{R.setCancel(null)}},I=(N,G)=>{G?N.wrap.dataset.drag="":delete N.wrap.dataset.drag},C=N=>Array.isArray(N?.types)&&N.types.includes("Files");for(let N of[_.local,_.remote]){let G=N.wrap,$=0;G.addEventListener("dragenter",Y=>{N.kind!=="remote"||!C(Y.dataTransfer)||(Y.preventDefault(),$+=1,I(N,!0))}),G.addEventListener("dragover",Y=>{N.kind==="remote"&&(Y.preventDefault(),Y.dataTransfer!==null&&(Y.dataTransfer.dropEffect="copy"))}),G.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&I(N,!1)}),G.addEventListener("drop",Y=>{$=0,I(N,!1);let H=Zc(N.kind,Y.dataTransfer);if(!H.accept){H.reason==="wrongPane"&&(Y.preventDefault(),l(g("error.dropOnLocalPane"),"error"));return}Y.preventDefault(),!(d||_.remote.busy)&&Ed(Y.dataTransfer).then(k=>{(k.length>0||k._limitExceeded===!0)&&L(_.remote,k)})})}let L=async(N,G)=>{let $=sr;if($.maxUploadFiles>0&&G.length>$.maxUploadFiles){l(g("error.uploadCountExceeded",{max:$.maxUploadFiles,count:G.length}),"error");return}let Y=$.maxUploadMb>0?$.maxUploadMb*1024*1024:0,H=G.find(k=>Y>0&&(k.file?.size??0)>Y);if(H!==void 0){l(g("error.uploadTooBig",{size:ct(Y),name:String(H.relPath??"")}),"error");return}if(G._limitExceeded===!0){l(g("error.uploadTotalTooBig"),"error");return}await m(g("msg.uploading"),async()=>{if(N.path===""){l(g("error.transferDirsNotReady"),"error");return}for(let q of Qc(G))await fetch("/api/dsh-tty/sftp/mkdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:c(N.path,q),parents:!0})}).catch(()=>{});R.reset();let k={stopped:!1,abort:null};R.setCancel(()=>k.abort?.());let j=0;try{let q=0;for(let U of G){if(k.stopped)break;q+=1,k.abort=null;try{await wd(U.file,c(N.path,U.relPath),{spec:e,label:`${String(q)}/${String(G.length)} ${U.relPath}`,cancelRef:k,onProgress:(J,Z)=>Number.isFinite(Z)&&Z>0?R.set(J,Z):R.pulse(J),onLabel:J=>l(g("msg.uploadingName",{name:J}),"busy")}),j+=1}catch(J){if(di(J)||k.stopped)break;throw J}}}finally{R.setCancel(null)}k.stopped?(R.reset(),l(g("msg.uploadCanceled",{done:j,total:G.length}))):(R.done(g("status.allDone")),setTimeout(()=>R.reset(),1500),l(g("msg.uploadDoneCount",{count:G.length}))),await N.loadDir(N.path)})},T=ca(),D=T===null?420:Math.round(T.height*.56);bd(o,g("panel.sftpDual",{label:t}),D,i),_.local.loadDir(""),_.remote.loadDir(""),$o=()=>{for(let N of[_.local,_.remote])N!==void 0&&typeof N.onShowHidden=="function"&&Uo.delete(N.onShowHidden)}}var ar=null,qt=null;function gd(){return qt!==null&&ko(qt.ownerKey,xe)?qt.ownerKey:Qr(void 0,xe)}var vd=(e=gd())=>ar!==null||qt!==null&&qt.ownerKey===e;function bd(e,t,r,i){let o=Qr(i,xe),s=Dt!==null&&Dt.ownerKey===o;if(ce!==null&&!Xe&&kt!==null&&!s)try{let a=Xh({title:t,side:"bottom",size:r,min:200,ownerSid:o,onClose:()=>mi(o)});a.element.appendChild(e),qt=a;return}catch(a){console.warn("[dsh-tty] SFTP \u6302\u5230\u7EC8\u7AEF\u6302\u8F7D\u4F4D\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(a instanceof Error?a.message:String(a)))}let n=document.createElement("div");n.className="tt_sshBackdrop",n.appendChild(e),n.addEventListener("mousedown",a=>{a.target===n&&mi()}),document.body.appendChild(n),ar=n}var Ui=null;function sg(){let e=Ui;if(Ui=null,e!==null)try{e.click()}catch{}}function ng(e){let t=new TextEncoder().encode(e),r="";for(let i of t)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function wd(e,t,r){let{spec:i,label:o="",cancelRef:s,onProgress:n,onLabel:a,onDone:u}=r;return o!==""&&typeof a=="function"&&a(o),new Promise((l,d)=>{let m=ng(JSON.stringify({...i,path:t})),y=new XMLHttpRequest;s.abort=()=>{s.stopped=!0,y.abort()},y.open("POST","/api/dsh-tty/sftp/upload"),y.setRequestHeader("x-dsh-sftp-meta",m),y.upload.addEventListener("progress",f=>{f.lengthComputable?n(f.loaded,f.total):n(0,NaN)});let _=!1,c=f=>{_||(_=!0,f===null?l():d(f))};y.addEventListener("load",()=>{if(y.status===200){u?.(),c(null);return}if(s.stopped)return;let f="HTTP "+y.status;try{let h=JSON.parse(y.responseText);h!==null&&typeof h=="object"&&typeof h.error=="string"&&(f=h.error)}catch{}c(new Error(f))}),y.addEventListener("error",()=>{if(s.stopped){c(new _i);return}c(new Error(g("error.networkError")))}),y.addEventListener("abort",()=>{c(new _i)}),y.send(e)})}function yd(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=i=>String(i).padStart(2,"0");return t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())+" "+r(t.getHours())+":"+r(t.getMinutes())}function Sd(e){let t=String(e).replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function og(e){let t=String(e).trim();if(t===""||(t=t.replace(/[\\/]+$/,""),t===""))return null;let r=t.match(/^([A-Za-z]:)(.*)$/);if(r!==null){let o=r[2];if(o==="")return null;let s=Math.max(o.lastIndexOf("\\"),o.lastIndexOf("/"));return s<=0?r[1]+"\\":r[1]+o.slice(0,s)}if(t.startsWith("\\\\")||t.startsWith("//")){let o=t.slice(2);if(o.split(/[\\/]/).filter(a=>a!=="").length<=2)return null;let n=Math.max(o.lastIndexOf("\\"),o.lastIndexOf("/"));return t.slice(0,2)+o.slice(0,n)}let i=t.lastIndexOf("/");return i<=0?i===0?"/":null:t.slice(0,i)}function Pi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function Cd(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let r=document.createElement("div");r.className="tt_sftpFill",t.appendChild(r);let i=document.createElement("span");i.className="tt_sftpPct",i.textContent="";let o=document.createElement("button");o.type="button",o.className="tt_sftpCancel",o.title=g("btn.cancelTransfer"),o.innerHTML=ts,o.style.display="none";let s=null;o.addEventListener("click",_=>{_.stopPropagation();let c=s;c!==null&&(o.disabled=!0,c())}),e.appendChild(t),e.appendChild(i),e.appendChild(o);let n=_=>{i.textContent=_},a="",u=-1,l=_=>{_!==a&&(a=_,i.textContent=_)},d=_=>{let c=Math.round(_);c!==u&&(u=c,r.style.width=c+"%")},m=()=>{s=null,Ui===o&&(Ui=null),o.style.display="none",o.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",u=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,r.style.width="0%",i.textContent="",m()},setCancel(_){if(_==null){m();return}s=_,Ui=o,o.disabled=!1,o.style.display=""},set(_,c){e.dataset.active="",delete e.dataset.state;let f=Date.now();if(this._last!==void 0&&f>this._lastAt){let h=(_-this._last)/((f-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}if(this._last=_,this._lastAt=f,Number.isFinite(c)&&c>0){let h=Math.min(100,Math.max(0,_/c*100));d(h);let p=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l(Math.round(h)+"%"+(p!==""?" \xB7 "+p:""))}else{r.style.width="";let h=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l(ct(_)+(h!==""?" \xB7 "+h:""))}},pulse(_){e.dataset.active="",delete e.dataset.state,r.style.width="45%",r.style.transition="none",setTimeout(()=>{r.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let h=(_-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}this._last=_,this._lastAt=c;let f=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l((Number.isFinite(_)?ct(_):"\u2026")+(f!==""?" \xB7 "+f:""))},done(_){e.dataset.active="",e.dataset.state="done",r.style.width="100%",u=100,m(),l(_!==void 0&&_!==""?_:g("status.done"))},fail(_){e.dataset.active="",e.dataset.state="error",m(),l(_!==void 0&&_!==""?_:g("status.failed"))},text(_){delete e.dataset.state,_===void 0||_===""?(e.dataset.active="",a="",i.textContent=""):(e.dataset.active="",r.style.width="",u=-1,l(_))}}}async function ag(e,t,r,i=0,o=null,s=0){let n=i>0?i*1024*1024:0,a=Number.isFinite(s)&&s>0?s:0,u=typeof AbortController=="function"?new AbortController:null,l=!1;u!==null&&(t={...t,signal:u.signal},typeof o=="function"&&o(()=>{l=!0,u.abort()}));let d=a,m=null,y;try{if(y=await fetch(e,t),!y.ok){let S="HTTP "+y.status;try{let b=await y.json();b!==null&&typeof b=="object"&&typeof b.error=="string"&&(S=b.error)}catch{}throw new Error(S)}let _=Number(y.headers.get("content-length")),c=y.headers.get("content-range")??"",f=Number(/\/(\d+)\s*$/.exec(c)?.[1]);Number.isFinite(f)&&f>0?m=f:Number.isFinite(_)&&_>0&&(m=a+_);let h=y.body;if(h===null||typeof h.getReader!="function"){let S=await y.blob();if(n>0&&a+S.size>n)throw new Error(g("error.downloadTooBig",{size:ct(n)}));return m!==null&&r(m,m),S}if(n>0&&m!==null&&m>n){try{await h.cancel()}catch{}throw new Error(g("error.downloadTooBig",{size:ct(n)}))}let p=h.getReader(),v=[];for(;;){let{done:S,value:b}=await p.read();if(S)break;if(b!==void 0&&b.byteLength>0){if(d+=b.byteLength,n>0&&d>n){try{await p.cancel()}catch{}throw new Error(g("error.downloadTooBig",{size:ct(n)}))}v.push(b),r(d,m!==null?m:NaN)}}return new Blob(v,{type:"application/octet-stream"})}catch(_){if(l||_!==null&&typeof _=="object"&&_.name==="AbortError")throw new _i;if(_!==null&&typeof _=="object")throw _.received=d,_.total=m,_;let c=new Error(String(_));throw c.received=d,c.total=m,c}}async function xd({url:e="/api/dsh-tty/sftp/download",makeBody:t,onProgress:r,maxMb:i=0,registerCancel:o=null,onResume:s=null}){let n=0,a=0;for(;;)try{return await ag(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t(n))},r,i,o,n)}catch(u){if(di(u))throw u;a+=1;let l=Xc({received:u?.received??0,total:u?.total??null,attempt:a});if(!l.resume)throw u;n=l.offset,typeof s=="function"&&s(n)}}var _i=class extends Error{constructor(){super(g("msg.canceled")),this.name="TransferCanceledError"}};function di(e){return e instanceof _i}function kd(e,t){let r=URL.createObjectURL(e),i=document.createElement("a");i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}async function Ed(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],r=[];for(let l of t){let d=typeof l.webkitGetAsEntry=="function"?l.webkitGetAsEntry():null;d!==null&&r.push(d)}if(r.length===0)return[...e.files??[]].map(l=>({relPath:l.name,file:l}));let i=[],o=sr.maxUploadFiles,s=sr.maxUploadMb>0?sr.maxUploadMb*1024*1024:0,n=()=>o>0&&i.length>=o,a=0,u=(l,d)=>new Promise(m=>{if(n()){m();return}if(l.isFile===!0){l.file(c=>{s>0&&a+(c.size??0)>s?i._limitExceeded=!0:(i.push({relPath:d+l.name,file:c}),a+=c.size??0),m()},()=>m());return}if(l.isDirectory!==!0){m();return}let y=l.createReader(),_=()=>{y.readEntries(async c=>{if(c.length===0){m();return}for(let f of c){if(n())break;await u(f,d+l.name+"/")}if(n()){m();return}_()},()=>m())};_()});for(let l of r)await u(l,"");return i}function yn(e,t){let r=Qr(t,xe);if(vd(r))return;let i=e!==null&&typeof e=="object"?e:{},o={};if(typeof i.name=="string"&&i.name!=="")o.name=i.name;else{for(let j of["host","username","auth","keyPath","passphrase","password"])typeof i[j]=="string"&&i[j]!==""&&(o[j]=i[j]);let k=Number(i.port);Number.isInteger(k)&&k>=1&&k<=65535&&(o.port=k),i.agentForward===!0&&(o.agentForward=!0)}let s=o.name??(o.username!==void 0?o.username+"@"+String(o.host??""):String(o.host??""));if(ed==="dual"){ig(o,s,r);return}let n=document.createElement("div");n.className="tt_sftpCard";let a=document.createElement("div");a.className="tt_sftpTitleRow";let u=document.createElement("div");u.className="tt_sshTitle",u.innerHTML=$i+"<span></span>",u.lastElementChild.textContent="SFTP \xB7 "+s;let l=document.createElement("button");l.type="button",l.className="tt_close",l.title=g("btn.close"),l.innerHTML=_n,l.addEventListener("click",()=>mi(r)),a.appendChild(u),a.appendChild(l),n.appendChild(a);let d=document.createElement("div");d.className="tt_sftpBar";let m=document.createElement("input");m.type="text",m.className="tt_sftpPath",m.placeholder=g("placeholder.remotePath"),m.spellcheck=!1,m.autocomplete="off";let y=document.createElement("button");y.type="button",y.className="tt_toolBtn",y.innerHTML=sa+"<span>"+g("btn.refresh")+"</span>";let _=document.createElement("button");_.type="button",_.className="tt_toolBtn",_.innerHTML=Oh+"<span>"+g("btn.mkdir")+"</span>";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.innerHTML=$_+"<span>"+g("btn.upload")+"</span>",c.title=g("btn.uploadTitle");let f=document.createElement("input");f.type="file",f.multiple=!0,f.style.display="none",d.appendChild(m),d.appendChild(y),d.appendChild(_),d.appendChild(c),n.appendChild(d),n.appendChild(f);let h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let p=document.createElement("input");p.type="text",p.className="tt_cardInput",p.spellcheck=!1,p.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=g("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=g("btn.cancel"),h.appendChild(p),h.appendChild(v),h.appendChild(S),n.appendChild(h);let b=null,x=()=>{h.style.display="none",b=null};v.addEventListener("click",()=>{b?.()}),S.addEventListener("click",x),p.addEventListener("keydown",k=>{k.key==="Enter"?(k.preventDefault(),b?.()):k.key==="Escape"&&(k.stopPropagation(),x())});let w=document.createElement("div");w.className="tt_sftpList",n.appendChild(w);let E=document.createElement("div");E.className="tt_sftpFoot";let B=document.createElement("div");B.className="tt_sftpStatus";let P=Cd();E.appendChild(P.el),E.appendChild(B),n.appendChild(E);let W={path:"",busy:!1},A=(k,j)=>{B.textContent=k,j===void 0?delete B.dataset.state:B.dataset.state=j},V=k=>{W.busy=k;for(let j of[y,_,c])j.disabled=k;m.disabled=k},O=async(k,j)=>{let q=await fetch("/api/dsh-tty/sftp/"+k,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...o,...j})}),U=await q.json().catch(()=>({}));if(!q.ok||U.ok!==!0)throw new Error(String(U.error||"HTTP "+q.status));return U},R=async(k,j)=>{if(!W.busy){V(!0),A(k,"busy");try{await j()}catch(q){A(String(q&&q.message?q.message:q),"error")}finally{V(!1)}}},F=(k,j,q,U)=>{let J=document.createElement("button");J.type="button",J.className="tt_sftpRow";let Z=document.createElement("span");Z.className="tt_sftpIcon",Z.innerHTML=k,U!==void 0&&(Z.dataset.kind=U);let se=document.createElement("span");if(se.className="tt_sftpName",se.textContent=j,se.title=j,J.appendChild(Z),J.appendChild(se),q!==""){let he=document.createElement("span");he.className="tt_sftpMeta",he.textContent=q,J.appendChild(he)}return J},I=(k,j,q,U)=>{let J=document.createElement("button");J.type="button",J.className="tt_sftpAct",J.innerHTML=j,J.title=q,J.addEventListener("click",Z=>{Z.stopPropagation(),U()}),k.appendChild(J)},C=(k,j,q)=>{let U=document.createElement("button");U.type="button",U.className="tt_sftpAct",U.innerHTML=Tr,U.title=j.isDir?g("btn.deleteEntryDir",{name:j.name}):g("btn.deleteEntry",{name:j.name});let J=null;U.addEventListener("click",Z=>{if(Z.stopPropagation(),!W.busy){if(J!==null){clearTimeout(J),J=null,U.innerHTML=Tr,delete U.dataset.danger,R(g("msg.deleting",{name:j.name}),async()=>{await O("remove",{path:q,recursive:j.isDir===!0}),await T(W.path),A(g("msg.deleted",{name:j.name}))});return}U.textContent=g("btn.confirm"),U.dataset.danger="",J=setTimeout(()=>{J=null,U.innerHTML=Tr,delete U.dataset.danger},4e3)}}),k.appendChild(U)},L=k=>{if(w.textContent="",W.path!==""&&W.path!=="/"){let U=F(ra,g("list.parentDir"),"","up");U.addEventListener("click",()=>{R(g("list.loading"),()=>T(Sd(W.path)))}),w.appendChild(U)}let j=Array.isArray(k)?k:[];if(j.length===0){let U=document.createElement("div");U.className="tt_addMenuTitle",U.textContent=g("list.emptyDir"),w.appendChild(U);return}let q=500;for(let U of j.slice(0,q)){if(U===null||typeof U!="object"||typeof U.name!="string"||U.name==="")continue;let J=Pi(W.path,U.name),Z=[];U.isDir===!0?Z.push(g("meta.dir")):Z.push(ct(Number(U.size))||"\u2014");let se=yd(Number(U.mtime));se!==""&&Z.push(se);let he=F(U.isDir?$i:U.isSymlink?Ph:Dh,U.name,Z.join(" \xB7 "),U.isDir===!0?"dir":U.isSymlink===!0?"link":"file");U.isDir===!0?he.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||R(g("list.loading"),()=>T(J))}):(he.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||D(U,J)}),I(he,Bh,g("btn.download",{name:U.name}),()=>{D(U,J)})),I(he,ia,g("btn.rename",{name:U.name}),()=>{p.placeholder=g("placeholder.newName"),p.value=U.name,h.style.display="",p.focus(),p.select(),b=async()=>{let fe=p.value.trim();fe===""||fe===U.name||(x(),await R(g("msg.renaming",{name:U.name}),async()=>{await O("rename",{from:J,to:Pi(W.path,fe)}),await T(W.path)}))}}),C(he,U,J),w.appendChild(he)}if(j.length>q){let U=document.createElement("div");U.className="tt_addMenuTitle",U.textContent=g("list.truncated",{rest:j.length-q,total:j.length}),w.appendChild(U)}},T=async k=>{try{let j=await O("list",{path:k??W.path});W.path=typeof j.path=="string"&&j.path!==""?j.path:"/",m.value=W.path;let q=Array.isArray(j.entries)?j.entries.length:0;L(j.entries),A(W.path+" \u2014 "+g("list.itemCount",{count:q}))}catch(j){A(String(j&&j.message?j.message:j),"error")}},D=(k,j)=>R(g("msg.downloading",{name:k.name}),async()=>{P.reset();let q;try{q=await xd({makeBody:U=>({...o,path:j,...U>0?{offset:U}:{}}),onProgress:(U,J)=>P.set(U,J),maxMb:sr.maxDownloadMb,registerCancel:U=>P.setCancel(U),onResume:U=>A(g("msg.downloadResuming",{name:k.name,offset:ct(U)||String(U)+" B"}),"busy")})}catch(U){if(di(U)){P.reset(),A(g("msg.downloadCanceled",{name:k.name}));return}throw P.fail(g("error.downloadFailed")),U}P.done(g("status.done")),kd(q,k.name),setTimeout(()=>P.reset(),1500),A(g("msg.downloaded",{name:k.name,size:ct(q.size)||String(q.size)+" B"}))}),N=(k,j,q,U,J)=>wd(k,Pi(W.path,j),{spec:o,label:(U>1?String(q)+"/"+String(U)+" ":"")+j,cancelRef:J,onProgress:(Z,se)=>{Number.isFinite(se)&&se>0?P.set(Z,se):P.pulse(Z)},onLabel:Z=>A(g("msg.uploadingName",{name:Z}),"busy"),onDone:()=>{U===1&&P.done(g("msg.uploadDone"))}}).catch(Z=>{throw di(Z)||P.fail(g("error.uploadFailed")),Z}),G=async k=>R(g("msg.uploading"),async()=>{let j=sr;if(j.maxUploadFiles>0&&k.length>j.maxUploadFiles){A(g("error.uploadCountExceeded",{max:j.maxUploadFiles,count:k.length}),"error"),P.fail(g("status.overLimit"));return}let q=j.maxUploadMb>0?j.maxUploadMb*1024*1024:0,U=k.find(fe=>q>0&&(fe.file?.size??0)>q);if(U!==void 0){A(g("error.uploadTooBig",{size:ct(q),name:String(U.relPath??"")}),"error"),P.fail(g("status.overLimit"));return}if(k._limitExceeded===!0){A(g("error.uploadTotalTooBig"),"error"),P.fail(g("status.overLimit"));return}let J=new Set;for(let fe of k){let te=fe.relPath.lastIndexOf("/");if(te<=0)continue;let qe=fe.relPath.slice(0,te);J.has(qe)||(J.add(qe),await O("mkdir",{path:Pi(W.path,qe),parents:!0}).catch(()=>{}))}P.reset();let Z={stopped:!1,abort:null};P.setCancel(()=>Z.abort?.());let se=0,he=0;try{for(let fe of k){if(Z.stopped)break;se+=1,Z.abort=null;try{await N(fe.file,fe.relPath,se,k.length,Z),he+=1}catch(te){if(di(te)||Z.stopped)break;throw te}}}finally{P.setCancel(null)}if(Z.stopped){P.reset(),A(g("msg.uploadCanceled",{done:he,total:k.length})),await T(W.path);return}P.done(g("status.allDone")),setTimeout(()=>P.reset(),1500),A(g("msg.uploadDoneCount",{count:k.length})),await T(W.path)});y.addEventListener("click",()=>{R(g("list.loading"),()=>T(W.path))}),_.addEventListener("click",()=>{W.busy||(p.placeholder=g("placeholder.newDirName"),p.value="",h.style.display="",p.focus(),b=async()=>{let k=p.value.trim();k!==""&&(x(),await R(g("msg.creatingDir",{name:k}),async()=>{await O("mkdir",{path:Pi(W.path,k)}),await T(W.path)}))})}),c.addEventListener("click",()=>{W.busy===!1&&f.click()}),f.addEventListener("change",()=>{let k=[...f.files??[]].map(j=>({relPath:j.name,file:j}));f.value="",k.length>0&&G(k)});let $=0,Y=k=>{k?w.dataset.drag="":delete w.dataset.drag};n.addEventListener("dragenter",k=>{k.preventDefault(),$+=1,Y(!0)}),n.addEventListener("dragover",k=>{k.preventDefault()}),n.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&Y(!1)}),n.addEventListener("drop",k=>{k.preventDefault(),$=0,Y(!1),!W.busy&&Ed(k.dataTransfer).then(j=>{(j.length>0||j._limitExceeded===!0)&&G(j)})}),m.addEventListener("keydown",k=>{if(k.key!=="Enter"||(k.preventDefault(),W.busy))return;let j=m.value.trim();j!==""&&R(g("list.loading"),()=>T(j))});let H=ca();bd(n,"SFTP \xB7 "+s,H===null?340:Math.round(H.height*.46),r),R(g("status.connectingEllipsis"),()=>T(""))}function mi(e){let t=e===void 0?gd():e,r=ar,i=qt!==null&&qt.ownerKey===t?qt:null;if(r===null&&i===null)return;sg();let o=$o;$o=null,o?.(),ar=null,i!==null&&(qt=null),r!==null&&r.remove(),i!==null&&i.dispose()}function pa(e){if(ir===null)return;ir.style.display=sh(e);let t=ce!==null?ce.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&ir.focus()}function Ld(){ir!==null&&pa(nh(ir.style.display))}function lg(){return{matchBackground:Ae("--tt-term-search-match"),matchBorder:Ae("--tt-term-search-match-border"),activeMatchBackground:Ae("--tt-term-search-active"),activeMatchBorder:Ae("--tt-term-search-active-border"),matchOverviewRuler:Ae("--tt-term-search-match-border"),activeMatchColorOverviewRuler:Ae("--tt-term-search-active-border")}}function cg(e){let t=Pt();if(t===void 0||t.search===void 0)return;let r=ir.value;if(r==="")return;let i={decorations:lg()};e?t.search.findPrevious(r,i):t.search.findNext(r,i)}function bh(){Ki||ce===null&&!aa()||Rr!==null||(Rr=setTimeout(()=>{Rr=null,un()},Fi),Fi=Math.min(Fi*2,5e3))}function as(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Qo(e){return as(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function hg(){return wr==="tmux"?{t:"spawn",cwd:jo(),persist:!0,persistName:ua()}:{t:"spawn",cwd:jo()}}async function Td(){if(!Io){Io=!0;try{await dg()}finally{Io=!1}}}var Io=!1;async function dg(){if(await fa(),ce===null){await fg();return}let e=lm(),t=am();if(![...ie.values()].some(n=>n.embedded!==!0)){if(e.length>0||t.length>0){Ne({t:"sessions"});let n=await an("sessions",4e3),a=new Map;if(n!==null&&Array.isArray(n.list))for(let l of n.list)l!==null&&typeof l=="object"&&l.attachable===!0&&a.set(l.sid,l);let u=new Set;for(let l of e){if(a.has(l.sid))mm(l);else if(Qo(l.spawnSpec))gh(l);else continue;as(l.spawnSpec)&&u.add(l.spawnSpec.persistName)}for(let l of t){let d=l.spawnSpec.persistName;u.has(d)||(gh(l),u.add(d))}Kt()}if(![...ie.values()].some(n=>n.embedded!==!0)){if(await dn())return;Yi()}return}let r=[...ie.values()].filter(n=>!n.exited&&(n.embedded!==!0||n.spawned===!0)),i=r.filter(n=>Qo(n.spawnSpec)),o=null;if(i.length>0){Ne({t:"sessions"});let n=await an("sessions",4e3),a=Lo(n!==null?n.list:[]);o=i.filter(u=>!a.has(u.sid));for(let u of o)Ji(u.sid)}let s=o!==null?new Set(o.map(n=>n.sid)):new Set;for(let n of r)s.has(n.sid)||Ne({t:"attach",sid:n.sid})}function ug(){Be!==null&&(Be.readyState===WebSocket.OPEN||Be.readyState===WebSocket.CONNECTING)||un()}async function fg(){let e=[...ie.values()].filter(i=>i.embedded===!0&&!i.exited);if(e.length===0)return;Ne({t:"sessions"});let t=await an("sessions",4e3),r=Lo(t!==null?t.list:[]);for(let i of e)i.spawned===!0&&(r.has(i.sid)?Ne({t:"attach",sid:i.sid}):Qo(i.spawnSpec)?Jh(i):(i.exited=!0,i.live=!1,ei(i,g("status.ended"),g("btn.clickRerun"),"exited")))}function un(){if(Be!==null){try{Be.close()}catch{}Be=null}Ki=!1,clearTimeout(Rr),Rr=null,Us=!0,$s(g("status.connectingEllipsis"),"");try{Be=new WebSocket(P_())}catch(e){Us=!1,$s(g("error.connectFailed",{error:e.message}),"error"),bh();return}Be.onopen=()=>{Us=!1,Fi=1e3,At=null,$s(g("status.connected"),"connected");for(let e of[...No])No.delete(e),ie.has(e.tab.sid)&&Ne(e.frame);Td()},Be.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=t.sid;if(t.t==="ready"){let i=typeof t.target=="string"?t.target:"";Po(r,t.kind==="ssh"?g("status.connectedSsh",{target:i!==""?i+" ":""}):g("status.connectedPid",{pid:t.pid}),"connected");let o=ie.get(r);if(o!==void 0){if(o.exited=!1,o.spawned=!0,o.live=!0,o.errored=!1,o.target=i,o.persistTmux=t.persist===!0,t.kind==="ssh"&&i!==""&&!o.label&&(o.label=i,ut()),Dr(),Bo(r),ei(o,""),vi(o),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(n=>setTimeout(n,500))]).then(()=>zh(150))}gi(),tm(r),xr(o.spawnSpec)&&Ne({t:"hidden",sid:r,hidden:!0}),Kt()}}else if(t.t==="hidden"){let i=ie.get(r);if(i!==void 0&&i.embedded!==!0){let o=t.hidden===!0;xr(i.spawnSpec)!==o&&(i.spawnSpec=Mo(i.spawnSpec,o),Kt(),ut(),pi())}}else if(t.t==="sessions")pm(t.list);else if(t.t==="data"){let i=ie.get(r);i!==void 0&&i.term!==null&&(i.term.write(String(t.d??"")),gg())}else if(t.t==="exit"){let i=ie.get(r);if(i!==void 0){i.exited=!0,i.live=!1,i.stats=null,r===xe&&Nr();let o=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";i.exitDetail=[o,s].filter(Boolean).join(" "),Po(r,g("status.exitedWith",{detail:i.exitDetail}),""),Dr(),Bo(r),ei(i,""),ns(),pi(),gi(),Sn(),Kt()}}else if(t.t==="stats")try{let i=ie.get(r);if(i!==void 0){let o=t.stats;i.stats=ch(o)?o:null,i.statsAt=Date.now(),r===xe&&Nr()}}catch(i){console.warn("[dsh-tty] stats \u5E27\u5904\u7406\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: "+(i instanceof Error?i.message:String(i)))}else if(t.t==="hint"){if(!rn||t.kind!=="failure"||typeof r!="string"||r==="")return;yr.set(r,{exitCode:typeof t.exitCode=="number"?t.exitCode:null,at:typeof t.at=="number"?t.at:Date.now(),dismissed:!1,busy:!1,answer:null,command:"",error:null}),r===xe&&Fr()}else if(t.t==="error")if(Po(r,g("status.error",{message:String(t.m??"")}),"error"),typeof r=="string"){let i=ie.get(r);i!==void 0&&(i.live||(i.errored=!0),Dr(),Bo(r),ei(i,g("status.errored"),g("status.retryHint",{message:String(t.m??"")}),"error"))}else pg(g("btn.clickRetry"))},Be.onclose=()=>{if(Us=!1,!Ki){$s(g("status.disconnectedReconnecting"),"error");for(let e of ie.values())e.exited||ei(e,g("status.disconnected"),g("status.reconnecting"),"info");bh()}},Be.onerror=()=>{}}function pg(e){si!==null&&(si.textContent=e)}function ea(){(ce===null||Xe)&&ta()}var Ks="DSH_TTY_ALLOW_PROXY_COMMAND";function _g(e){let t=new Date(Number(e)*1e3);if(Number.isNaN(t.getTime()))return String(e);let r=i=>String(i).padStart(2,"0");return`${String(t.getFullYear())}-${r(t.getMonth()+1)}-${r(t.getDate())} ${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`}function Md(){return typeof navigator<"u"&&navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText=="function"}async function wh(e){if(Md())try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let r=!1;try{r=document.execCommand("copy")}catch{r=!1}return t.remove(),r||gn(g("error.copyFailed"),"error"),r}function ta(){if(ce!==null){Xe&&_a();return}es(),ce=document.createElement("div"),ce.className="tt_modalBackdrop",ce.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+pn+'</span><div class="tt_tabbar"><div class="tt_tabs"></div><button type="button" class="tt_tabMore" hidden></button><button type="button" class="tt_tabAdd"></button></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">'+g("status.initializing")+'</span></div><input class="tt_searchInput" style="display:'+Ro+'" placeholder="'+g("placeholder.search")+'" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="'+g("btn.searchTitle")+'">'+N_+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="'+g("btn.clearTitle")+'">'+Mh+'</button></span><span class="tt_winGroup"><button class="tt_min" title="'+g("btn.minimizeTitle")+'">'+W_+'</button><button class="tt_close" title="'+g("btn.closePanelTitle")+'">'+_n+'</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_work"><div class="tt_body"><div class="tt_statsBar" hidden></div><div class="tt_exitBar" hidden></div><button type="button" class="tt_assistBadge" hidden><span class="tt_assistDot"></span><span class="tt_assistBadgeText"></span></button><div class="tt_overlay"></div></div></div></div>',document.body.appendChild(ce),Zs=ce.querySelector(".tt_status"),Mr=ce.querySelector(".tt_statusText"),Br=ce.querySelector(".tt_statusDot"),Te=ce.querySelector(".tt_tabs");let e=ce.querySelector(".tt_tabAdd");e!==null&&(e.title=g("btn.newTab"),e.innerHTML=U_,e.addEventListener("click",()=>{Im(e)})),zt=ce.querySelector(".tt_tabMore"),zt!==null&&(zt.innerHTML=Ah,zt.title=g("btn.tabList"),zt.addEventListener("click",()=>{Nm(zt)})),Te.addEventListener("scroll",pi),Te.addEventListener("wheel",Tm,{passive:!1}),Te.addEventListener("contextmenu",jm),Te.addEventListener("auxclick",zm),Oi=ce.querySelector(".tt_connbar"),Ii=ce.querySelector(".tt_connDot"),Qs=ce.querySelector(".tt_connTarget"),Ct=ce.querySelector(".tt_connBadge"),Ni=ce.querySelector(".tt_connActions"),kt=ce.querySelector(".tt_work"),it=ce.querySelector(".tt_body"),Rt=ce.querySelector(".tt_statsBar"),$t=ce.querySelector(".tt_exitBar"),Vi="",vn(),At=null,Fh(),si=ce.querySelector(".tt_body > .tt_overlay"),gr=ce.querySelector(".tt_assistBadge"),gr!==null&&gr.addEventListener("click",()=>{gr!==null&&Xm(gr)}),Bt(),Fr(),ir=ce.querySelector(".tt_searchInput"),si.addEventListener("click",()=>{si.textContent="",un()}),ce.querySelector("[data-act=search]").addEventListener("click",()=>{Ld()}),ir.addEventListener("keydown",r=>{r.key==="Enter"?(r.preventDefault(),cg(r.shiftKey)):r.key==="Escape"&&(r.stopPropagation(),pa(!1))}),ce.querySelector("[data-act=clear]").addEventListener("click",()=>{let r=Pt();r!==void 0&&r.term!==null&&r.term.clear()}),ce.querySelector(".tt_min").addEventListener("click",()=>{Zi()}),ce.querySelector(".tt_close").addEventListener("click",()=>{Rd()}),ce.addEventListener("mousedown",r=>{ai===null&&r.target===ce&&Zi()}),document.addEventListener("keydown",Dd),Hi=new ResizeObserver(()=>{Xe||(Gs(),hm(Pt()),pi())}),Hi.observe(it),ut(),Dr(),Be!==null&&Be.readyState===WebSocket.OPEN?Td():un()}function Sn(){if(Gi===null)return;let e=[...ie.values()].filter(t=>!t.exited).length;Gi.textContent=ie.size>0?"\xB7 "+e+"/"+ie.size:""}function mg(){rt=document.createElement("div"),rt.className="tt_dock",rt.title=g("btn.restoreDock"),rt.innerHTML='<span class="tt_dockTitle">'+pn+"<span>"+g("panel.title")+'</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="'+g("btn.closePanelTitle")+'">'+ts+"</button>",Gi=rt.querySelector(".tt_dockCount"),fi=rt.querySelector(".tt_dockStatus"),Or=rt.querySelector(".tt_dockDot"),Sn(),Mr!==null&&(fi.textContent=Mr.textContent),Br!==null&&(Or.dataset.state=Br.dataset.state??""),rt.addEventListener("click",e=>{if(e.target.closest(".tt_dockClose")!==null){e.stopPropagation(),Rd();return}_a()}),document.body.appendChild(rt)}function Zi(){ce===null||Xe||(xt(),Lt(),Bt(),vr(),Xe=!0,ar!==null&&(ar.style.display="none"),pa(!1),ce.dataset.minimized="",Wh(),ss(),Nr(),document.querySelector("[data-dsh-tty-entry]")!==null?gi():(mg(),rt.classList.add("tt_dockCompact")))}function gi(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Xe){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=g("status.minimized");let r=[...ie.values()].filter(o=>!o.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=r+"/"+ie.size;let i=t.querySelector(".tt_sidebarBadgeDot");i!==null&&Br!==null&&(i.dataset.state=Br.dataset.state??"")}function gg(){if(!Xe)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Or;e!==null&&(e.dataset.active="",clearTimeout(en),en=setTimeout(()=>{delete e.dataset.active},900))}function _a(){if(ce===null||!Xe)return;Xe=!1,delete ce.dataset.minimized,ar!==null&&(ar.style.display=""),clearTimeout(en),rt!==null&&(rt.remove(),rt=null),Gi=null,fi=null,Or=null,gi(),Fh(),ss(),Nr(),ns();let e=Pt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&vi(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Rd(){let e=Kc(ie.values());if(!e.confirm){Qi();return}Xe&&_a(),vg(e)}function kr(){if(ai===null)return;ai.remove(),ai=null;let e=Ho;if(Ho=null,e!==null&&typeof e.focus=="function")try{e.focus()}catch{}}function Ad(e){if(ce===null)return;kr();let t=ce.querySelector(".tt_modal");if(t===null)return;let r=document.createElement("div");r.className="tt_confirmLayer",r.innerHTML='<div class="tt_confirmCard" role="dialog" aria-modal="true"><div class="tt_confirmTitle"></div><div class="tt_confirmText"></div><div class="tt_confirmHint"></div><div class="tt_confirmActions"><button type="button" class="tt_toolBtn tt_confirmCancel"></button>'+(e.minimize===!0?'<button type="button" class="tt_toolBtn tt_confirmMin"></button>':"")+'<button type="button" class="tt_toolBtn tt_btnDanger tt_confirmOk"></button></div></div>',r.querySelector(".tt_confirmTitle").textContent=e.title,r.querySelector(".tt_confirmText").textContent=e.text,r.querySelector(".tt_confirmHint").textContent=e.hint;let i=r.querySelector(".tt_confirmCancel");if(i.textContent=g("btn.cancel"),i.addEventListener("click",()=>kr()),e.minimize===!0){let s=r.querySelector(".tt_confirmMin");s.textContent=g("btn.minimize"),s.addEventListener("click",()=>{kr(),Zi()})}let o=r.querySelector(".tt_confirmOk");o.textContent=e.okLabel,o.addEventListener("click",()=>{kr(),e.onOk()}),r.addEventListener("mousedown",s=>{s.target===r&&kr()}),Ho=document.activeElement instanceof HTMLElement?document.activeElement:null,t.appendChild(r),ai=r;try{i.focus()}catch{}}function vg(e){Ad({title:g("confirm.closeTitle",{n:String(e.live)}),text:e.agentLive>0?g("confirm.closeTextAgent",{n:String(e.live),agent:String(e.agentLive)}):g("confirm.closeText",{n:String(e.live)}),hint:g("confirm.closeHint"),okLabel:g("confirm.closeOk",{n:String(e.live)}),onOk:Qi,minimize:!0})}function Qi(){if(ce===null)return;kr(),zi(!0);let e=aa();if(Ki=!e,Xe=!1,xt(),Lt(),or(),Bt(),Vs(),cn(),vr(),mi(),clearTimeout(en),clearTimeout(Rr),Rr=null,Fi=1e3,rt!==null&&(rt.remove(),rt=null),Gi=null,fi=null,Or=null,gi(),Be!==null){for(let t of ie.values())!t.exited&&t.embedded!==!0&&Ne({t:"kill",sid:t.sid});if(!e){try{Be.close()}catch{}Be=null}}Hi!==null&&(Hi.disconnect(),Hi=null);for(let[t,r]of[...ie])if(r.embedded!==!0){if(r.term!==null)try{r.term.dispose()}catch{}ie.delete(t)}xe=null,qi=null,document.removeEventListener("keydown",Dd),ce.remove(),ce=null,kt=null,Zs=null,Mr=null,Br=null,Te=null,zt=null,Oi=null,Ii=null,Qs=null,Ct=null,Ni=null,cn(),Wh(),Rt=null,vn(),At=null,$t=null,Vi="",it=null,si=null,ir=null,is=0;try{sessionStorage.removeItem(tn)}catch{}}function Dd(e){if(e.key==="Escape"&&ce!==null){if(e.preventDefault(),ai!==null){kr();return}if(ar!==null){mi();return}if(oi!==null){vr();return}if(Et!==null){xt();return}Zi()}}function bg(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function wg(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let r of e.children)if(r.tagName==="BUTTON")return r}function yg(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label",g("panel.title")),e.tabIndex=0,e.innerHTML='<span class="tt_sidebarEntryIcon">'+pn+'</span><span class="tt_sidebarEntryLabel">'+g("panel.title")+"</span>",e.addEventListener("click",t=>{t.preventDefault(),ta()}),e.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" "||t.key==="Spacebar")&&(t.preventDefault(),ta())}),e}function yh(e,t){let r=wg(e);if(r===void 0)return!1;if(t.parentElement!==e){let i=r.closest('[class*="logoRow"]'),o=i!==null&&i.parentElement===e?i:r,s=Array.from(e.children).filter(n=>n instanceof HTMLElement&&n.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(s.length>0){let n=s[s.length-1];e.insertBefore(t,n.nextSibling)}else e.insertBefore(t,o.nextElementSibling)}return!0}function Sg(){if(es(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=yg(),t,r=!1,i=()=>{if(t!==void 0&&!t.isConnected&&(s.disconnect(),t=void 0,r=!1),r){if(document.body.contains(e))return;s.disconnect(),t=void 0,r=!1}t??(t=bg()),t!==void 0&&(r=yh(t,e),r&&s.observe(t,{childList:!0,subtree:!0}))},o=new MutationObserver(()=>{i()});o.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){r=!1,i();return}t.contains(e)||(r=yh(t,e))});return i(),()=>{o.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},r=e("react"),{jsx:i,jsxs:o}=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 n(u){let l=u&&u.view,d=l==="page",[m,y]=r.useState(d),[_,c]=r.useState(null),[f,h]=r.useState(!1),[p,v]=r.useState(!1),[S,b]=r.useState({kind:"",text:""}),[x,w]=r.useState(null),[E,B]=r.useState(""),[P,W]=r.useState(!1),[A,V]=r.useState(Date.now()),O=r.useRef(null),R=r.useRef(null),[F,I]=r.useState([]),[C,L]=r.useState(!1),[T,D]=r.useState({groups:[],loading:!1,failed:!1}),[N,G]=r.useState(!1),$=r.useRef(null),Y=r.useRef(null),H=r.useRef(0),k=M=>i("div",{className:"tt_cardSection",children:M}),j=async()=>{try{let z=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();z.ok&&typeof z.config=="object"&&z.config!==null?(O.current=z.config,R.current=JSON.stringify(he(z.config)),c(z.config),Xi(z.config)):b({kind:"error",text:String(z.error||g("error.configLoadFailed"))})}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},q=async()=>{try{let z=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();z.ok&&Array.isArray(z.shells)&&I(z.shells)}catch{}},U=(M,z)=>{let K=M.current,X=K===null||K.parentElement===null?null:K.parentElement.querySelector(z);K===null||X===null||(X.style.width=String(Math.round(K.getBoundingClientRect().width))+"px",os(X,K))};r.useLayoutEffect(()=>{if(!N&&!C)return;let M=()=>{N&&U($,".tt_routeList"),C&&U(Y,".tt_shellList")};return M(),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[N,C,T.loading,T.failed,T.groups,F,_?.shell]);let J=async()=>{let M=H.current+1;H.current=M,D(z=>({...z,loading:!0}));try{let K=await(await fetch("/api/dsh-tty/model-catalog",{cache:"no-store"})).json();if(K.ok===!0&&M===H.current){D({groups:Array.isArray(K.groups)?K.groups:[],loading:!1,failed:!1});return}}catch{}M===H.current&&D({groups:[],loading:!1,failed:!0})};r.useEffect(()=>{m&&!f&&(h(!0),j(),q(),J())},[m]);let Z=(M,z)=>c(K=>{let X={...K||{},[M]:z};return O.current=X,X}),se=new Set(["toolsRegistered","platform","shellIntegrationSupported","allowProxyCommandGranted","allowProxyCommandGrantSource","allowProxyCommandGrantedAt"]),he=M=>{let z={};for(let[K,X]of Object.entries(M||{}))se.has(K)||X!==void 0&&(z[K]=X);return z.sshHosts=Array.isArray(M?.sshHosts)?M.sshHosts:[],z.tunnels=Array.isArray(M?.tunnels)?M.tunnels:[],M?.sftpLimits&&typeof M.sftpLimits=="object"&&(z.sftpLimits={maxDownloadMb:Number(M.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(M.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(M.sftpLimits.maxUploadFiles)||0}),z};O.current=_;let fe=(M,z)=>c(K=>({...K||{},sftpLimits:{...K?.sftpLimits??{},[M]:z}})),[te,qe]=r.useState(null),[le,Me]=r.useState(null),[st,He]=r.useState(""),[ee,ne]=r.useState(null),[ge,be]=r.useState(""),[je,Oe]=r.useState(""),[ze,Re]=r.useState(""),We=r.useRef(null),[we,_t]=r.useState(!1),[Ze,nt]=r.useState({text:"",kind:""}),[ls,Q]=r.useState(!1),[oe,de]=r.useState({running:!1,ok:!1,text:""}),[ae,pe]=r.useState({}),[ue,Ce]=r.useState([]),[ve,ye]=r.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""}),[Ee,Le]=r.useState(null);r.useEffect(()=>{if(!m)return;let M=!0,z=async()=>{try{let re=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();M&&re.ok&&Array.isArray(re.tunnels)&&Ce(re.tunnels)}catch{}};z();let K=setInterval(z,2e3);return()=>{M=!1,clearInterval(K)}},[m]);let Se=M=>z=>ye(K=>({...K||{},[M]:z.target.value})),De=(M,z)=>ye(K=>({...K||{},[M]:z})),Qe=M=>M?.direction==="remote"?g("meta.tunnelRemote",{host:M.remoteHost||"127.0.0.1",port:String(M.remotePort??0),local:String(M.localTargetPort??0)}):g("meta.tunnelLocal",{local:String(M?.localPort??0),host:M?.remoteHost??"?",port:String(M?.remotePort??0)}),ht=(_?.sshHosts??[]).find(M=>M?.name===ve?.bookName),cr=async M=>{try{let z=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:M})}),K=await z.json().catch(()=>({}));return!z.ok||!K.ok?(b({kind:"error",text:String(K.error||g("error.saveTunnelFailed"))}),{ok:!1,warnings:[]}):{ok:!0,warnings:Array.isArray(K.warnings)?K.warnings.map(re=>String(re)).filter(re=>re!==""):[]}}catch(z){return b({kind:"error",text:String(z&&z.message?z.message:z)}),{ok:!1,warnings:[]}}},ma=(M,z)=>{if(M.warnings.length>0){b({kind:"warn",text:M.warnings.join(" ")});return}b({kind:"ok",text:z})},ga=()=>Nc(ve,(Array.isArray(_?.sshHosts)?_.sshHosts:[]).map(M=>M?.name),g),Pd=M=>{b({kind:"",text:""}),Le(String(M?.name??"")),ye({direction:M?.direction==="remote"?"remote":"local",bookName:String(M?.bookName??""),localPort:M?.localPort?String(M.localPort):"",remoteHost:String(M?.remoteHost??""),remotePort:M?.remotePort?String(M.remotePort):"",localTargetPort:M?.localTargetPort?String(M.localTargetPort):""})},Bd=()=>{Le(null),b({kind:"",text:""}),ye(M=>({...M||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))},Od=()=>{b({kind:"",text:""});let M=ga();if(!M.ok){b({kind:"error",text:M.error});return}let z=M.tunnel,K=Array.isArray(_?.tunnels)?_.tunnels:[];if(Hc(K,z.name)!==void 0){b({kind:"error",text:g("error.tunnelNameTaken",{name:z.name})});return}let X=[...K,z];c(re=>({...re||{},tunnels:X})),ye(re=>({...re||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),cr(X).then(re=>{re.ok&&ma(re,g("msg.tunnelApplied",{name:z.name}))})},Id=()=>{if(Ee===null)return;b({kind:"",text:""});let M=ga();if(!M.ok){b({kind:"error",text:M.error});return}let z=Array.isArray(_?.tunnels)?_.tunnels:[],K=Fc(z,Ee,M.tunnel,g);if(!K.ok){K.reason==="missing"&&Le(null),b({kind:"error",text:K.error});return}let X=K.tunnels;c(re=>({...re||{},tunnels:X})),cr(X).then(re=>{if(re.ok!==!0){c(_e=>({..._e||{},tunnels:z}));return}Le(null),ye(_e=>({..._e||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),ma(re,g("msg.tunnelUpdated",{name:M.tunnel.name}))})},va=(M,z)=>{c(K=>({...K||{},tunnels:M})),cr(M).then(K=>{if(K.ok!==!0){c(X=>({...X||{},tunnels:z}));return}K.warnings.length>0&&b({kind:"warn",text:K.warnings.join(" ")})})},Nd=M=>{let z=Array.isArray(_?.tunnels)?_.tunnels:[];Ee!==null&&String(M??"")===Ee&&(Le(null),ye(K=>({...K||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))),va(z.filter(K=>K?.name!==M),z)},Hd=(M,z)=>{let K=Array.isArray(_?.tunnels)?_.tunnels:[];va(K.map(X=>X?.name===M?{...X,enabled:z}:X),K)},Fd=M=>{qe(M?.name??null),He(""),de({running:!1,ok:!1,text:""}),be(""),Oe(""),xn(),_t(Ut!==null),Me({name:M?.name??"",host:M?.host??"",port:String(M?.port??22),username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:M?.hostKeyAlias??"",persist:M?.persist!==!1}),kh().then(z=>ne(z)),kn(M?.password??"")},ba=()=>{qe(null),Me(null),He(""),de({running:!1,ok:!1,text:""}),be(""),Oe(""),xn()},Wd=async()=>{if(le===null)return;let M=le.name.trim(),z=le.host.trim(),K=le.username.trim();if(M===""||z===""||K===""){He(g("error.nameHostUserRequired"));return}let X=Number(le.port);if((!Number.isInteger(X)||X<1||X>65535)&&(X=22),(_?.sshHosts??[]).some(_e=>_e?.name===M&&M!==te)){He(g("error.bookNameTaken",{name:M}));return}if(le.auth==="key"&&le.keyPath.trim()===""){He(g("error.keyPathRequired"));return}He("");let re=le.password;if(le.auth==="password"){let _e=await Th(we,le.password,z,X,K,"PASSWORD");if(_e.error!==void 0){He(_e.error);return}_e.value!==void 0&&(re=_e.value)}c(_e=>({..._e||{},sshHosts:(Array.isArray(_e?.sshHosts)?_e.sshHosts:[]).map(ke=>ke?.name===te?{name:M,host:z,port:X,username:K,auth:le.auth,keyPath:le.keyPath.trim(),passphrase:le.passphrase,password:re,agentForward:le.agentForward,hostKeyAlias:String(le.hostKeyAlias??"").trim(),persist:le.persist===!0}:ke)})),pe(_e=>{let ke={..._e};return delete ke[M],te!==M&&delete ke[te],ke}),qe(null),Me(null),de({running:!1,ok:!1,text:""}),b({kind:"ok",text:g("msg.hostEdited",{name:M})})},jd=M=>{te===M&&ba(),pe(z=>{let K={...z};return delete K[M],K}),c(z=>({...z||{},sshHosts:(Array.isArray(z?.sshHosts)?z.sshHosts:[]).filter(K=>K?.name!==M)}))},zd=async M=>{let z=M?.name??"";if(z==="")return;let K={host:M?.host??"",port:Number(M?.port)||22,username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:typeof M?.hostKeyAlias=="string"?M.hostKeyAlias:""};pe(re=>({...re,[z]:{running:!0,text:g("msg.probing")}}));let X=await Ko(K,!0);pe(re=>{let _e=re[z]||{};if(X.result){let ke=X.result.auth?.ok===!0;return{...re,[z]:{running:!1,ok:ke,text:Go(X.result)}}}return{...re,[z]:{running:!1,ok:!1,text:g("error.probeFailed",{detail:String(X.error||g("error.unknown"))})}}})},Ud=async M=>{let z=(Array.isArray(_?.hostKeys)?_.hostKeys:[]).filter(K=>!(K?.host===M?.host&&Number(K?.port)===Number(M?.port)));c(K=>({...K||{},hostKeys:z}));try{let K=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:z})}),X=await K.json().catch(()=>({}));!K.ok||!X.ok?b({kind:"error",text:String(X.error||g("error.hostKeyDeleteFailed"))}):b({kind:"ok",text:g("msg.hostKeyDeleted")})}catch(K){b({kind:"error",text:String(K&&K.message?K.message:K)})}},$d=async()=>{b({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!z.ok){b({kind:"error",text:String(z.error||g("error.sshConfigReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],X=[...Array.isArray(_?.sshHosts)?_.sshHosts:[]],re=new Set(X.map(Fe=>Fe?.name)),_e=0,ke=0;for(let Fe of K)if(!(Fe===null||typeof Fe!="object"||typeof Fe.name!="string")){if(re.has(Fe.name)){ke+=1;continue}re.add(Fe.name),X.push({name:Fe.name,host:String(Fe.host??Fe.name),port:Number(Fe.port)||22,username:String(Fe.username??""),auth:Fe.auth==="key"?"key":"agent",keyPath:String(Fe.keyPath??""),passphrase:"",password:"",agentForward:!1,hostKeyAlias:typeof Fe.hostKeyAlias=="string"?Fe.hostKeyAlias:""}),_e+=1}c(Fe=>({...Fe||{},sshHosts:X}));let me=Array.isArray(z.proxy)?z.proxy.filter(Fe=>typeof Fe=="string"):[],ot=Number.isInteger(z.proxyCount)?z.proxyCount:me.length,Sr=Array.isArray(z.proxyCommand)?z.proxyCommand.filter(Fe=>typeof Fe=="string"):[],dt=Number.isInteger(z.proxyCommandCount)?z.proxyCommandCount:Sr.length,jr=Number.isInteger(z.skippedOther)?z.skippedOther:0,hr=Number.isInteger(z.droppedOverflow)?z.droppedOverflow:0,Tt=[];ot>0&&Tt.push(g("msg.proxySkipped",{count:ot,names:me.slice(0,5).join(g("list.separator"))+(ot>5?g("meta.etc"):"")})),dt>0&&Tt.push(g("msg.proxyCommandSkipped",{count:dt,names:Sr.slice(0,5).join(g("list.separator"))+(dt>5?g("meta.etc"):"")})),jr>0&&Tt.push(g("msg.skippedNotConcrete",{count:jr})),hr>0&&Tt.push(g("msg.importOverflow",{count:hr}));let La=Tt.length>0?g("list.separatorFull")+Tt.join(g("list.separatorFull")):"";if(_e===0){let Fe=ke>0?g("msg.noNewEntries",{count:ke}):g("msg.noImportableHosts");b({kind:Tt.length>0?"error":"ok",text:Fe+La})}else b({kind:Tt.length>0?"error":"ok",text:g("msg.importedHosts",{added:_e,skipped:ke})+La})}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},wa=M=>M===null||typeof M!="object"?[]:Array.isArray(M.fingerprints)?M.fingerprints.filter(z=>typeof z=="string"&&z!==""):typeof M.fingerprint=="string"&&M.fingerprint!==""?[M.fingerprint]:[],qd=async()=>{b({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!z.ok){b({kind:"error",text:String(z.error||g("error.knownHostsReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],X=[...Array.isArray(_?.hostKeys)?_.hostKeys:[]],re=new Map;for(let me of X)me===null||typeof me!="object"||re.set(String(me.host??"")+":"+String(me.port??22),{record:me,fps:new Set(wa(me))});let _e=0,ke=0;for(let me of K){if(me===null||typeof me!="object"||typeof me.host!="string")continue;let ot=Array.isArray(me.fingerprints)?me.fingerprints.filter(hr=>typeof hr=="string"&&hr!==""):[];if(typeof me.fingerprint=="string"&&me.fingerprint!==""&&ot.push(me.fingerprint),ot.length===0)continue;let Sr=me.host+":"+String(me.port??22),dt=re.get(Sr);if(dt!==void 0){let hr=!1;for(let Tt of ot)dt.fps.has(Tt)||dt.fps.size>=8||(dt.fps.add(Tt),hr=!0);if(!hr){ke+=1;continue}delete dt.record.fingerprint,dt.record.fingerprints=[...dt.fps],_e+=1;continue}let jr={host:me.host,port:Number(me.port)||22,fingerprints:[...new Set(ot)].slice(0,8)};re.set(Sr,{record:jr,fps:new Set(jr.fingerprints)}),X.push(jr),_e+=1}if(_e===0){b({kind:"ok",text:ke>0?g("msg.noNewFingerprints",{count:ke}):g("msg.noImportableKnownHosts")});return}c(me=>({...me||{},hostKeys:X}));try{let me=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:X})}),ot=await me.json().catch(()=>({}));if(!me.ok||!ot.ok){b({kind:"error",text:String(ot.error||g("error.saveHostKeysFailed"))});return}b({kind:"ok",text:g("msg.importedFingerprints",{added:_e,skipped:ke})+(z.truncated===!0?g("hint.knownHostsTruncated"):"")})}catch(me){b({kind:"error",text:String(me&&me.message?me.message:me)})}}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},ya=async M=>{let z=M??O.current??_;v(!0),b({kind:"",text:""});let K=he(z);try{let X=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(K)}),re=await X.json();!X.ok||!re.ok?b({kind:"error",text:String(re.error||g("error.saveFailed"))}):(b({kind:"ok",text:g("msg.saved")}),R.current=JSON.stringify(K),re.config&&(O.current=re.config,c(re.config),Xi(re.config)))}catch(X){b({kind:"error",text:String(X&&X.message?X.message:X)})}v(!1)},Cn=M=>"/api/dsh-tty/elevate"+M,Sa=async()=>{try{let z=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json(),K=z&&typeof z.config=="object"&&z.config!==null?z.config:null;if(K===null)return;c(X=>{if(X===null)return X;let re={...X,allowProxyCommandGranted:K.allowProxyCommandGranted===!0,allowProxyCommandGrantSource:K.allowProxyCommandGrantSource??null,allowProxyCommandGrantedAt:Number.isFinite(K.allowProxyCommandGrantedAt)?K.allowProxyCommandGrantedAt:null};return O.current=re,re})}catch{}},Ca=async()=>{w(null),W(!1);let M=O.current||{},z=R.current!==null&&JSON.stringify(he(M))===R.current,K={...M,allowProxyCommand:!0};O.current=K,c(K),await Sa(),z?(await ya(K),B(g("elev.granted"))):B(g("elev.grantedNeedSave"))},xa=async()=>{W(!1),B(""),w({phase:"loading"});try{let M=await fetch(Cn(""),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}),z=await M.json().catch(()=>({}));if(!M.ok){w({phase:"error",error:String(z.error||M.status)});return}if(z.status==="granted"){await Ca();return}w({phase:"pending",command:String(z.command??""),expiresAt:Number(z.expiresAt)||0})}catch(M){w({phase:"error",error:String(M&&M.message?M.message:M)})}},Kd=async()=>{B("");try{let M=await fetch(Cn("/revoke"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}),z=await M.json().catch(()=>({}));if(!M.ok){B(g("elev.error")+String(z.error||M.status));return}await Sa(),B(g("elev.revoked"))}catch(M){B(g("elev.error")+String(M&&M.message?M.message:M))}},Gd=async()=>{let M=x===null?"":String(x.command??"");if(M!==""){if(Md())try{await navigator.clipboard.writeText(M),W(!0);return}catch{}W(!1),B(g("elev.copyManual"))}};r.useEffect(()=>{if(x===null||x.phase!=="pending")return;let M=setInterval(()=>V(Date.now()),1e3),z=setInterval(()=>{fetch(Cn("/status"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}).then(K=>K.json()).then(K=>{K.status==="granted"&&Ca()}).catch(()=>{})},1500);return()=>{clearInterval(M),clearInterval(z)}},[x]);let Vd=()=>{if(_.allowProxyCommandGrantSource==="env")return i("span",{className:"tt_cardHint",children:g("elev.viaEnv")});let M=_.allowProxyCommandGrantedAt;return o("span",{className:"tt_capState",children:[Number.isFinite(M)?i("span",{children:g("elev.grantedAt",{time:_g(M)})}):null,i("button",{type:"button",className:"tt_toolBtn tt_capRevoke",onClick:()=>{Kd()},children:g("elev.revoke")})]})},Yd=()=>{let M=String(x.command??""),z=x.expiresAt>0?Math.max(0,Math.ceil((x.expiresAt-A)/1e3)):0,K=x.phase==="pending"&&x.expiresAt>0&&z===0,X=()=>{w(null),W(!1)};return o("div",{className:"tt_elevPanel",children:[o("div",{className:"tt_elevHead",children:[i("span",{className:"tt_cardLabel",children:g("elev.title")}),i("button",{type:"button",className:"tt_toolBtn",onClick:X,children:g("elev.close")})]}),i("span",{className:"tt_cardHint",children:g("elev.lockedWhy")}),x.phase==="error"?i("span",{className:"tt_cardHint tt_sshProbeWarn",children:g("elev.error")+String(x.error??"")}):null,x.phase==="loading"?i("span",{className:"tt_cardHint",children:g("elev.loading")}):null,M===""?null:o("div",{className:"tt_elevSteps",children:[i("span",{className:"tt_cardHint",children:g("elev.step")}),i("div",{className:"tt_elevCommand",children:i("code",{children:M})}),o("div",{className:"tt_elevActions",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Gd()},children:g(P?"elev.copied":"elev.copy")}),K?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{xa()},children:g("elev.regenerate")}):i("span",{className:"tt_cardHint",children:g("elev.expiresIn",{sec:z})})]}),i("span",{className:"tt_cardHint",children:g(K?"elev.expired":"elev.waiting")})]}),_.allowProxyCommand===!0&&_.allowProxyCommandGranted!==!0?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Z("allowProxyCommand",!1),X()},children:g("elev.disableFirst")}):null,i("span",{className:"tt_cardHint",children:g("elev.otherWay")}),i("span",{className:"tt_cardHint",children:g("elev.envHow",{env:Ks})})]})},Jd=()=>{let M=_.allowProxyCommandGranted===!0,z=_.allowProxyCommand===!0;return o("div",{className:"tt_capBlock",children:[o("label",{className:"tt_cardField tt_cardRow tt_cardToggle tt_cardDanger",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z,onChange:K=>{if(!M){xa();return}Z("allowProxyCommand",K.target.checked)}}),i("span",{className:"tt_cardLabel",children:g("check.allowProxyCommand")}),z&&!M?i("span",{className:"tt_badgeWarn",children:g("badge.notEffective")}):null]}),i("span",{className:"tt_cardHint",children:g("hint.allowProxyCommand")}),M?Vd():i("span",{className:"tt_cardHint tt_sshProbeWarn",children:g("hint.proxyCommandNotGranted")}),E===""?null:i("span",{className:"tt_cardHint",children:E}),x===null?null:Yd()]})},xn=()=>{We.current!==null&&(clearTimeout(We.current),We.current=null),Re("")},kn=async M=>{let z=ii(M);if(ui()===null){_t(!1),Q(!1),nt({text:g(Ut===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),kind:"muted"});return}if(z===""){Q(!1),nt({text:"",kind:""});return}let K=await Eh(z);if(K.unreported===!0){Q(!1),nt({text:g("status.credUnreported",{ref:z}),kind:"plain"});return}if(K.error!==void 0){Q(!1),nt({text:g("error.credStatusFailed",{error:K.error}),kind:"error"});return}let X=K.view;nt({text:X.configured?g("status.credStored",{ref:z,source:X.source!==""?g("meta.credSource",{source:X.source}):""}):g("status.credUnknown",{ref:z}),kind:X.configured?"ok":"plain"}),Q(X.configured===!0&&X.writable===!0)},Xd=async()=>{let M=ii(le?.password??"");if(M==="")return;let z=await Lh(M);if(z.error!==void 0){nt({text:z.error,kind:"error"});return}Me(K=>({...K||{},password:""})),nt({text:"",kind:""}),Q(!1)},Zd=(M,z)=>{let K=String(le?.[M]??"");if(K===""||K.startsWith("env:")||ze===z){xn(),Me(X=>({...X||{},[M]:"env:"+z})),be(""),M==="password"&&kn("env:"+z);return}Re(z),We.current!==null&&clearTimeout(We.current),We.current=setTimeout(()=>{We.current=null,Re("")},4e3)},ka=(M,z)=>{if(ee===null)return null;if(ee.length===0)return i("span",{className:"tt_cardHint",children:z});let K=ge===M,X=je.trim().toUpperCase(),re=X===""?ee:ee.filter(_e=>_e.toUpperCase().includes(X));return o("div",{className:"tt_credPicker",children:[i("input",{className:"tt_cardInput",value:K?je:"",placeholder:g("placeholder.credRef"),title:g("hint.credRefCandidates"),autoComplete:"off",spellCheck:!1,onFocus:()=>{be(M),Oe("")},onBlur:_e=>{_e.currentTarget.parentElement.contains(_e.relatedTarget)||be("")},onChange:_e=>{Oe(_e.target.value),be(M)}}),...K?[i("div",{className:"tt_envList",children:[...re.length===0?[i("span",{className:"tt_envMore",children:g("list.noCredRef")})]:re.slice(0,30).map(_e=>i("button",{type:"button",className:"tt_envItem","data-danger":ze===_e?"":void 0,onMouseDown:ke=>ke.preventDefault(),onClick:()=>Zd(M,_e),children:ze===_e?g("list.credOverwrite",{name:_e}):_e},_e)),...re.length>30?[i("span",{className:"tt_envMore",children:g("list.moreMatches",{count:re.length-30})})]:[]]},"cred-list-"+M)]:[]]})},Qd=()=>{let z=ii(le?.password??"")!=="",K=ui()===null;return o("div",{className:"tt_sshRow tt_credRow",children:[z?i("button",{type:"button",className:"tt_toolBtn tt_credClear",disabled:ls!==!0,onClick:()=>{Xd()},children:g("btn.clearCredential")}):i("label",{className:"tt_credToggle",title:g("hint.rememberCredentialApply"),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:we,disabled:K,onChange:X=>_t(X.target.checked)}),i("span",{children:g("check.rememberCredentialApply")})]}),Ze.text===""?null:i("span",{className:"tt_credStatus","data-kind":Ze.kind,children:Ze.text}),K&&Ze.text===""?i("span",{className:"tt_credStatus","data-kind":"muted",children:g("error.credPlainUnavailable")}):null]})},Ea=()=>{let M=String(le?.host??"").trim(),z=String(le?.username??"").trim(),K=Number(le?.port);if((!Number.isInteger(K)||K<1||K>65535)&&(K=22),M===""||z==="")return He(g("error.hostUserRequired")),null;let X=le?.auth,re={host:M,port:K,username:z,auth:X};if(X==="key"){let ke=String(le?.keyPath??"").trim();if(ke==="")return He(g("error.keyPathRequired")),null;re.keyPath=ke,le?.passphrase!==""&&(re.passphrase=le.passphrase)}if(X==="password"){let ke=String(le?.password??"");if(ke==="")return He(g("error.passwordRequired")),null;re.password=ke}le?.agentForward===!0&&(re.agentForward=!0);let _e=String(le?.hostKeyAlias??"").trim();return _e!==""&&(re.hostKeyAlias=_e),re},eu=()=>{He("");let M=Ea();M!==null&&(de({running:!0,ok:!1,text:g("msg.probing")}),Ko(M,!1).then(z=>{if(z.result){let K=z.result.auth?.ok===!0;de({running:!1,ok:K,text:Go(z.result)});return}de({running:!1,ok:!1,text:g("error.probeFailed",{detail:String(z.error||g("error.unknown"))})})}))},tu=()=>{He("");let M=Ea();M!==null&&yn(M)},ru=()=>{if(le===null)return null;let M=(z,K,X,re,_e)=>o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:z}),i("input",{className:"tt_cardInput",type:re??"text",value:le[K]??"",placeholder:X??"",autoComplete:"off",spellCheck:!1,onChange:ke=>{let me=ke.target.value;Me(ot=>({...ot||{},[K]:me}))},..._e??{}})]});return o("div",{className:"tt_sshEdit",children:[i("div",{className:"tt_sshSection",children:g("section.connection")}),o("div",{className:"tt_sshGrid",children:[M(g("field.bookName"),"name",g("hint.bookNameConflict")),M(g("field.port"),"port","22")]}),M(g("field.host"),"host",g("placeholder.host")),M(g("field.username"),"username","root"),i("div",{className:"tt_sshSection",children:g("section.auth")}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.authMethod")}),o("select",{className:"tt_cardInput",value:le.auth,onChange:z=>Me(K=>({...K||{},auth:z.target.value})),children:[i("option",{value:"agent",children:g("option.authAgent")}),i("option",{value:"key",children:g("option.authKey")}),i("option",{value:"password",children:g("option.authPassword")})]})]}),...le.auth==="key"?[M(g("field.keyPath"),"keyPath","~/.ssh/id_ed25519"),M(g("field.passphrase"),"passphrase","","password"),ka("passphrase",g("hint.noCredRefPassphrase"))]:[],...le.auth==="password"?[M(g("field.password"),"password","","password",{onBlur:()=>{kn(le.password)}}),Qd(),ka("password",g("hint.noCredRefPasswordApply"))]:[],i("div",{className:"tt_sshSection",children:g("section.options")}),o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:le.agentForward===!0,onChange:z=>Me(K=>({...K||{},agentForward:z.target.checked}))}),i("span",{className:"tt_cardLabel",children:g("check.agentForward")})]}),M(g("field.hostKeyAlias"),"hostKeyAlias",g("placeholder.hostKeyAlias")),i("span",{className:"tt_cardHint",title:g("hint.hostKeyAliasFull"),children:g("hint.hostKeyAlias")}),wr==="tmux"?o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:le.persist===!0,onChange:z=>Me(K=>({...K||{},persist:z.target.checked}))}),i("span",{className:"tt_cardLabel",children:g("check.persist")})]}):null,oe.text!==""?i("div",{className:"tt_sshProbeResult"+(!oe.running&&oe.ok?" tt_sshProbeOk":"")+(!oe.running&&!oe.ok?" tt_sshProbeBad":""),children:oe.text}):null,st!==""?i("span",{className:"tt_cardMessage tt_cardMessageError",children:st}):null,o("div",{className:"tt_sshActions",children:[o("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:ba,children:g("btn.cancel")}),i("button",{type:"button",className:"tt_toolBtn",title:g("btn.browseTitle"),onClick:tu,children:g("btn.fileBrowse")}),i("button",{type:"button",className:"tt_toolBtn",disabled:oe.running,title:g("btn.probeTitle"),onClick:eu,children:oe.running?g("msg.probing"):g("btn.probe")})]}),o("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_cardSave",onClick:()=>{Wd()},children:g("btn.apply")}),i("span",{className:"tt_cardHint",children:g("hint.appliedOnSave")})]})]})]})},iu=M=>{let z=typeof M?.assistProvider=="string"?M.assistProvider.trim():"",K=typeof M?.assistModel=="string"?M.assistModel.trim():"";return z!==""&&K!==""?z+"/"+K:z!==""?z:K},su=()=>{if(T.loading)return i("span",{className:"tt_envMore",children:g("list.modelLoading")});if(T.failed)return i("span",{className:"tt_envMore",children:g("list.modelCatalogFailed")});let M=[],z=(_?.assistProvider??"")===""&&(_?.assistModel??"")==="";M.push(i("button",{type:"button",className:"tt_envItem",...z?{"data-active":""}:{},onMouseDown:K=>K.preventDefault(),onClick:()=>{c(K=>({...K||{},assistProvider:"",assistModel:""})),G(!1)},children:g("option.followHostModel")},"assist-route-default"));for(let K of T.groups){let X=String(K.id??"");if(X==="")continue;let re=String(K.name??X),_e=Array.isArray(K.models)?K.models:[];if(_e.length!==0){M.push(i("span",{className:"tt_envMore",children:re},"group-"+X));for(let ke of _e){let me=String(ke.id??"");if(me==="")continue;let ot=String(ke.name??"")===""?me:String(ke.name),Sr=(_?.assistProvider??"")===X&&(_?.assistModel??"")===me;M.push(i("button",{type:"button",className:"tt_envItem",...Sr?{"data-active":""}:{},title:X+"/"+me,onMouseDown:dt=>dt.preventDefault(),onClick:()=>{c(dt=>({...dt||{},assistProvider:X,assistModel:me})),G(!1)},children:ot===me?me:ot},X+"/"+me))}}}return T.groups.length===0&&M.push(i("span",{className:"tt_envMore",children:g("list.noModelCandidate")},"assist-route-empty")),M},wi=(M,z,K,X)=>o("label",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:M}),i("input",{className:"tt_cardInput",value:_[z]??"",placeholder:K??"",onChange:re=>Z(z,re.target.value)}),X?i("span",{className:"tt_cardHint",children:X}):null]}),Wr=(M,z,K,X)=>o("label",{className:"tt_cardField tt_cardRow tt_cardToggle"+(typeof K=="string"&&K!==""?" "+K:""),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:_[z]===!0,disabled:X===!0&&_[z]!==!0,onChange:re=>Z(z,re.target.checked)}),i("span",{className:"tt_cardLabel",children:M})]}),yi=_?.platform==="win32",En=_?.shellIntegrationSupported===!0;return l==="summary"?g("card.desc"):o(d?"div":"li",{className:d?"tt_pageHost":m?"tt_card tt_cardOpen":"tt_card",children:[d?null:o("button",{type:"button",className:"tt_cardHeader","aria-expanded":m,onClick:()=>y(M=>!M),children:[o("span",{className:"tt_cardHeadText",children:[i("span",{className:"tt_cardName",children:g("card.name")}),i("span",{className:"tt_cardDescription",children:g("card.descFull")})]}),i("span",{className:"dshkit_badge",children:"Kit"}),i("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:m?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:i("path",{d:s,fill:"currentColor"})})]}),d||m?o("div",{className:"tt_cardBody",children:[_===null?i("div",{className:"tt_cardMessage",children:g("list.loadingConfig")}):o("div",{children:[k(g("section.basic")),Wr(g("check.enabled"),"enabled"),Wr(g("check.announce"),"announceToAgent"),yi?o("div",{className:"tt_cardField",children:[o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:_.shellIntegration===!0,disabled:!En,onChange:M=>Z("shellIntegration",M.target.checked)}),i("span",{className:"tt_cardLabel",children:g(En?"check.shellIntegrationWindows":"check.shellIntegration")})]}),i("span",{className:"tt_cardHint",children:g(En?"hint.shellIntegrationPowerShell":"hint.shellIntegrationWindows")})]}):Wr(g("check.shellIntegrationWindows"),"shellIntegration"),k(g("section.sftp")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("field.sftpStyle")}),o("select",{className:"tt_cardInput",value:_.sftpStyle==="dual"?"dual":"dialog",onChange:M=>Z("sftpStyle",M.target.value),children:[i("option",{value:"dialog",children:g("option.sftpDialog")}),i("option",{value:"dual",children:g("option.sftpDual")})]}),i("span",{className:"tt_cardHint",children:g("hint.sftpDual")})]}),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("field.sftpLimits")}),o("div",{className:"tt_limitGrid",children:[o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.downloadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxDownloadMb))?Number(_.sftpLimits.maxDownloadMb):1024),onChange:M=>fe("maxDownloadMb",Number(M.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.uploadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxUploadMb))?Number(_.sftpLimits.maxUploadMb):2048),onChange:M=>fe("maxUploadMb",Number(M.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.uploadCountLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxUploadFiles))?Number(_.sftpLimits.maxUploadFiles):1e3),onChange:M=>fe("maxUploadFiles",Number(M.target.value)||0)})]})]}),i("span",{className:"tt_cardHint",children:g("hint.sftpLimits")})]}),k(g("section.session")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("field.persistence")}),o("select",{className:"tt_cardInput",value:_.persistence==="tmux"?"tmux":"off",onChange:M=>Z("persistence",M.target.value),children:[i("option",{value:"off",children:g("option.persistOff")}),i("option",{value:"tmux",children:g("option.persistTmux")})]}),i("span",{className:"tt_cardHint",children:g("hint.persistence")+(yi?g("hint.persistenceWindows"):"")}),Wr(g("check.endOnPageClose"),"endOnPageClose"),Wr(g("check.statsEnabled"),"statsEnabled"),i("span",{className:"tt_cardHint",children:g("hint.statsEnabled")}),Jd()]}),k(g("section.assist")),Wr(g("check.assistEnabled"),"assistEnabled"),i("span",{className:"tt_cardHint",children:g("hint.assistEnabled")}),o("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||G(!1)},children:[i("span",{className:"tt_cardLabel",children:g("field.assistRoute")}),i("input",{className:"tt_cardInput tt_routeInput",ref:$,readOnly:!0,value:iu(_),autoComplete:"off",spellCheck:!1,onFocus:()=>{G(!0),T.groups.length===0&&!T.loading&&J()},onClick:()=>{G(!0),T.groups.length===0&&!T.loading&&J()},onKeyDown:M=>{M.key==="Escape"&&G(!1)}}),...N?[i("div",{className:"tt_envList tt_routeList",children:su()},"assist-route-list")]:[],i("span",{className:"tt_cardHint",children:g("hint.assistRoute")})]},"assist-route-field"),wi(g("field.maxSessions"),"maxSessions","4",g("hint.maxSessions")),o("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||L(!1)},children:[i("span",{className:"tt_cardLabel",children:g(yi?"field.shellWindows":"field.shell")}),i("input",{className:"tt_cardInput",ref:Y,value:_.shell??"",placeholder:g(yi?"placeholder.shellWindows":"placeholder.shell"),autoComplete:"off",spellCheck:!1,onFocus:()=>L(!0),onClick:()=>L(!0),onKeyDown:M=>{M.key==="Escape"&&L(!1)},onChange:M=>{Z("shell",M.target.value),L(!0)}}),...C?[i("div",{className:"tt_envList tt_shellList",children:(()=>{let M=(_.shell??"").trim().toLowerCase(),z=M===""?F:F.filter(K=>K.toLowerCase().includes(M));return z.length===0?i("span",{className:"tt_envMore",children:g("list.noShellCandidate")}):z.map(K=>i("button",{type:"button",className:"tt_envItem",onMouseDown:X=>X.preventDefault(),onClick:()=>{Z("shell",K),L(!1)},children:K},K))})()},"shell-list")]:[],i("span",{className:"tt_cardHint",children:g(yi?"hint.shellCandidatesWindows":"hint.shellCandidates")})]},"shell-field"),wi("TERM","term","xterm-256color",g("hint.term")),wi("COLORTERM","colorTerm","truecolor",""),wi(g("field.cwd"),"cwd","",g("placeholder.cwd")),wi(g("field.grace"),"reconnectGraceSec","120",g("hint.grace")),k(g("section.ssh")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("panel.sshBook")}),...Array.isArray(_.sshHosts)&&_.sshHosts.length>0?[i("div",{className:"tt_hostList","data-editing":te!==null?"":void 0,children:_.sshHosts.map(M=>o("div",{children:[o("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:M?.name??""}),i("span",{className:"tt_sshHostTarget",children:qo(M??{})})]}),i("button",{type:"button",className:"tt_toolBtn",disabled:ae[M?.name]?.running===!0,onClick:()=>{zd(M)},title:g("btn.probeRowTitle"),children:ae[M?.name]?.running===!0?g("msg.testing"):g("btn.test")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Fd(M),children:g("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>jd(M?.name),children:g("btn.delete")})]}),ae[M?.name]&&ae[M?.name].text?i("div",{className:"tt_sshProbeResult"+(ae[M?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:ae[M?.name].text}):null,te===M?.name?ru():null]},String(M?.name??"")))})]:[i("span",{className:"tt_cardHint",children:g("list.emptySshHosts")})],o("div",{className:"tt_cardRow",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{$d()},children:g("btn.importSshConfig")}),i("span",{className:"tt_cardHint",children:g("hint.importSshConfig")})]}),i("span",{className:"tt_cardHint",children:g("hint.sshBook")})]}),o("div",{className:"tt_cardField",children:[o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("panel.tunnels")}),...Array.isArray(_.tunnels)&&_.tunnels.length>0?[i("div",{children:_.tunnels.map(M=>{let z=ue.find(re=>re.name===M?.name),K=z?.state??"stopped",X=Ee!==null&&String(M?.name??"")===Ee;return o("div",{className:"tt_sshHostRow","data-editing":X?"":void 0,children:[i("span",{className:"tt_tunnelDot","data-state":K,title:K}),i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:(M?.name??"")+" \xB7 "+Qe(M??{})}),i("span",{className:"tt_sshHostTarget",children:(M?.bookName??"")+(z?.error?" \xB7 "+z.error:"")+(z?.lastForwardError?" \xB7 "+z.lastForwardError:"")})]}),i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:M?.enabled!==!1,title:g("check.tunnelEnabled"),onChange:re=>Hd(M?.name,re.target.checked)}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Pd(M),children:g("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Nd(M?.name),children:g("btn.delete")})]},String(M?.name??""))})})]:[i("span",{className:"tt_cardHint",children:g("list.emptyTunnels")})],o("div",{className:"tt_sshEdit",children:[o("div",{className:"tt_cardRow tt_tunnelHead",children:[o("div",{className:"tt_segmented",role:"group","aria-label":g("field.direction"),children:[i("button",{type:"button",className:"tt_segmentedBtn","data-active":ve.direction!=="remote"?"":void 0,title:g("option.localForwardTitle"),onClick:()=>De("direction","local"),children:g("option.localForward")}),i("button",{type:"button",className:"tt_segmentedBtn","data-active":ve.direction==="remote"?"":void 0,title:g("option.remoteForwardTitle"),onClick:()=>De("direction","remote"),children:g("option.remoteForward")})]}),o("select",{className:"tt_cardInput",value:ve.bookName,onChange:Se("bookName"),children:[i("option",{value:"",children:g("option.selectBook")}),...Array.isArray(_?.sshHosts)?_.sshHosts.map(M=>i("option",{value:M?.name??"",children:M?.name??""})):[]]})]}),i("span",{className:"tt_cardHint",children:ht!==void 0?g("hint.tunnelViaBook",{book:qo(ht)}):g("hint.tunnelBookEmpty")}),ve.direction==="local"?o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:g("hint.localListenFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.localPort"),value:ve.localPort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.localListenPort"),onChange:Se("localPort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"local",title:g("hint.flowLocalToRemote"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:g("placeholder.remoteHost"),title:g("hint.remoteHostTitle"),value:ve.remoteHost,autoComplete:"off","aria-label":g("field.remoteHost"),onChange:Se("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.port"),value:ve.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.remotePort"),onChange:Se("remotePort")})]})]}):o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:g("placeholder.remoteListenHost"),title:g("hint.remoteListenHost"),value:ve.remoteHost,autoComplete:"off","aria-label":g("field.remoteListenHost"),onChange:Se("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.listenPort"),value:ve.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.remoteListenPort"),onChange:Se("remotePort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"remote",title:g("hint.flowRemoteToLocal"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:g("hint.localDialFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.localTargetPort"),value:ve.localTargetPort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.localTargetPort"),onChange:Se("localTargetPort")})]})]}),i("div",{className:"tt_tunnelEndpoints",children:[i("span",{className:"tt_tunnelEndLabel",children:ve.direction==="local"?g("hint.tunnelLocalSummary"):g("hint.tunnelRemoteSummary")})]}),i("div",{className:"tt_cardRow tt_tunnelActions",children:[Ee===null?i("button",{type:"button",className:"tt_cardSave",onClick:Od,children:g("btn.addTunnel")}):i("button",{type:"button",className:"tt_cardSave",onClick:Id,children:g("btn.saveEdit")}),Ee===null?null:i("button",{type:"button",className:"tt_toolBtn",onClick:Bd,children:g("btn.cancel")}),i("span",{className:"tt_cardHint",children:Ee===null?g("hint.tunnelAdd"):g("hint.tunnelEditing",{name:Ee})})]})]})]}),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("panel.hostKeys")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{qd()},children:g("btn.importKnownHosts")})]}),...Array.isArray(_.hostKeys)&&_.hostKeys.length>0?[i("div",{className:"tt_hostList",children:_.hostKeys.map((M,z)=>o("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:String(M?.host??"")+":"+String(M?.port??22)}),i("span",{className:"tt_sshHostTarget",children:wa(M).map(K=>"sha256:"+K).join(" / ")})]}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>{Ud(M)},children:g("btn.delete")})]},String(M?.host??"")+":"+String(M?.port??22)+"#"+String(z)))})]:[i("span",{className:"tt_cardHint",children:g("list.emptyHostKeys")})],i("span",{className:"tt_cardHint",children:g("hint.hostKeys")})]}),o("div",{className:"tt_cardField tt_cardRow",children:[i("button",{className:"tt_cardSave",disabled:p,onClick:()=>{ya()},children:g(p?"msg.saving":"btn.save")}),i("span",{className:"tt_cardMessage"+(S.kind==="ok"?" tt_cardMessageOk":S.kind==="error"?" tt_cardMessageError":S.kind==="warn"?" tt_cardMessageWarn":""),children:S.text})]})]})]}):null]})}t.inject=["slots","sessions"];let a=["@hyzyn/dsh-tty#tty","@hyzyn/dsh-all#tty"];return t.apply=u=>{D_(u),Hh=u.sessions,u.inject(["remote","remote.credentials"],S=>(Ut=S.remote?.credentials??S["remote.credentials"]??null,()=>{Ut=null}));let l=!1,d=()=>{};hn={set(S){if(S!==l){if(l=S,S){d=Sg();return}d(),d=()=>{},Qi(),Dr()}}},sd(!0),fa();let m="@hyzyn/dsh-all",_=[...new Set(a.map(S=>S.split("#")[0]))].find(S=>S!==m),c=!1,f=[];_!==void 0&&u.slots.inject("plugins.bundle.config",()=>{for(c=!0;f.length>0;){let S=f.pop();typeof S=="function"&&S()}return u.slots.register({name:"plugins.bundle.config",key:_},n)});for(let S of a)u.slots.inject("plugins.row.config",()=>{let b=S.split("#")[0]===_;if(b&&c)return;let x=u.slots.register({name:"plugins.row.config",key:S},n);return b&&f.push(x),x});u.slots.inject("settings.kit.item",()=>u.slots.register({name:"settings.kit.item",id:"tty",order:80,label:()=>g("card.name")},n)),u.slots.inject("settings.plugin.item",()=>u.slots.register({name:"settings.plugin.item",key:"tty",order:100},n));let h=u.provide("ttyConnbar",{version:1,addAction:mn,requestRender(){Dr()}}),p=u.provide("ttyTerminal",{version:3,open(S){if(!Pr)return;let b=Gh(S),x=Vh(S,b),w=typeof S?.label=="string"&&S.label!==""?S.label:void 0;if(es(),S?.reuse!==!1){let E=dm(x);if(E!==null)return ea(),lr(E.sid,{user:!0}),E}return ea(),Yi(x,w)},mount(S,b){return Pr?ym(S,b):()=>{}}}),v=u.provide("ttyPanel",{version:2,isOpen(){return ce!==null&&!Xe},mountPane(S){return Xh(S)},minimize(){return Zi(),ce!==null&&Xe}});return()=>{hn=null,Pr=!1,d(),v(),p(),h(),Qi()}},t}});})();
3767
3767
  /*! Bundled license information:
3768
3768
 
3769
3769
  @xterm/addon-search/lib/addon-search.mjs: