@hyzyn/dsh-tty 0.27.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -1,64 +1,64 @@
1
- "use strict";(()=>{var dd=Object.create;var sa=Object.defineProperty;var ud=Object.getOwnPropertyDescriptor;var fd=Object.getOwnPropertyNames;var pd=Object.getPrototypeOf,_d=Object.prototype.hasOwnProperty;var ia=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var md=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fd(t))!_d.call(e,o)&&o!==r&&sa(e,o,{get:()=>t[o],enumerable:!(s=ud(t,o))||s.enumerable});return e};var na=(e,t,r)=>(r=e!=null?dd(pd(e)):{},md(t||!e||!e.__esModule?sa(r,"default",{value:e,enumerable:!0}):r,e));var aa=ia((js,nn)=>{(function(e,t){if(typeof js=="object"&&typeof nn=="object")nn.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var s in r)(typeof js=="object"?js:e)[s]=r[s]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(o,i,n){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,b=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(b=(x<3?g(b):x>3?g(f,v,b):g(f,v))||b);return x>3&&b&&Object.defineProperty(f,v,b),b},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;let l=n(9042),_=n(9924),m=n(844),y=n(4725),p=n(2585),c=n(3656),u=i.AccessibilityManager=class extends m.Disposable{constructor(h,f,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 g=0;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);if(this._topBoundaryFocusListener=g=>this._handleBoundaryFocus(g,0),this._bottomBoundaryFocusListener=g=>this._handleBoundaryFocus(g,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((g=>this._handleResize(g.rows)))),this.register(this._terminal.onRender((g=>this._refreshRows(g.start,g.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((g=>this._handleChar(g)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
1
+ "use strict";(()=>{var eu=Object.create;var xa=Object.defineProperty;var tu=Object.getOwnPropertyDescriptor;var ru=Object.getOwnPropertyNames;var iu=Object.getPrototypeOf,su=Object.prototype.hasOwnProperty;var ka=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var nu=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ru(t))!su.call(e,n)&&n!==r&&xa(e,n,{get:()=>t[n],enumerable:!(i=tu(t,n))||i.enumerable});return e};var Ea=(e,t,r)=>(r=e!=null?eu(iu(e)):{},nu(t||!e||!e.__esModule?xa(r,"default",{value:e,enumerable:!0}):r,e));var Ta=ka((is,wn)=>{(function(e,t){if(typeof is=="object"&&typeof wn=="object")wn.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var i in r)(typeof is=="object"?is:e)[i]=r[i]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(n,s,o){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,w=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(w=(x<3?g(w):x>3?g(f,v,w):g(f,v))||w);return x>3&&w&&Object.defineProperty(f,v,w),w},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let l=o(9042),_=o(9924),m=o(844),y=o(4725),p=o(2585),c=o(3656),u=s.AccessibilityManager=class extends m.Disposable{constructor(h,f,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 g=0;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);if(this._topBoundaryFocusListener=g=>this._handleBoundaryFocus(g,0),this._bottomBoundaryFocusListener=g=>this._handleBoundaryFocus(g,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((g=>this._handleResize(g.rows)))),this.register(this._terminal.onRender((g=>this._refreshRows(g.start,g.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((g=>this._handleChar(g)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
2
  `)))),this.register(this._terminal.onA11yTab((g=>this._handleTab(g)))),this.register(this._terminal.onKey((g=>this._handleKey(g.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 f=0;f<h;f++)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,f){this._liveRegionDebouncer.refresh(h,f,this._terminal.rows)}_renderRows(h,f){let v=this._terminal.buffer,S=v.lines.length.toString();for(let g=h;g<=f;g++){let x=v.lines.get(v.ydisp+g),b=[],E=x?.translateToString(!0,void 0,void 0,b)||"",P=(v.ydisp+g+1).toString(),O=this._rowElements[g];O&&(E.length===0?(O.innerText="\xA0",this._rowColumns.set(O,[0,1])):(O.textContent=E,this._rowColumns.set(O,b)),O.setAttribute("aria-posinset",P),O.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,f){let v=h.target,S=this._rowElements[f===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(f===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==S)return;let g,x;if(f===0?(g=v,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(g=this._rowElements.shift(),x=v,this._rowContainer.removeChild(g)),g.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),f===0){let b=this._createAccessibilityTreeNode();this._rowElements.unshift(b),this._rowContainer.insertAdjacentElement("afterbegin",b)}else{let b=this._createAccessibilityTreeNode();this._rowElements.push(b),this._rowContainer.appendChild(b)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(f===0?-1:1),this._rowElements[f===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 f={node:h.anchorNode,offset:h.anchorOffset},v={node:h.focusNode,offset:h.focusOffset};if((f.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||f.node===v.node&&f.offset>v.offset)&&([f,v]=[v,f]),f.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(f={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(f.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 g=({node:E,offset:P})=>{let O=E instanceof Text?E.parentNode:E,F=parseInt(O?.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(O);if(!A)return console.warn("columns is null. Race condition?"),null;let V=P<A.length?A[P]:A.slice(-1)[0]+1;return V>=this._terminal.cols&&(++F,V=0),{row:F,column:V}},x=g(f),b=g(v);if(x&&b){if(x.row>b.row||x.row===b.row&&x.column>=b.column)throw new Error("invalid range");this._terminal.select(x.column,x.row,(b.row-x.row)*this._terminal.cols-x.column+b.column)}}_handleResize(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let f=this._rowContainer.children.length;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);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`}};i.AccessibilityManager=u=a([d(1,p.IInstantiationService),d(2,y.ICoreBrowserService),d(3,y.IRenderService)],u)},3614:(o,i)=>{function n(_){return _.replace(/\r?\n/g,"\r")}function a(_,m){return m?"\x1B[200~"+_+"\x1B[201~":_}function d(_,m,y,p){_=a(_=n(_),y.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(_,!0),m.value=""}function l(_,m,y){let p=y.getBoundingClientRect(),c=_.clientX-p.left-10,u=_.clientY-p.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${c}px`,m.style.top=`${u}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=n,i.bracketTextForPaste=a,i.copyHandler=function(_,m){_.clipboardData&&_.clipboardData.setData("text/plain",m.selectionText),_.preventDefault()},i.handlePasteEvent=function(_,m,y,p){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),m,y,p)},i.paste=d,i.moveTextAreaUnderMouseCursor=l,i.rightClickHandler=function(_,m,y,p,c){l(_,m,y),c&&p.rightClickSelect(_),m.value=p.selectionText,m.select()}},7239:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;let a=n(1505);i.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(d,l,_){this._css.set(d,l,_)}getCss(d,l){return this._css.get(d,l)}setColor(d,l,_){this._color.set(d,l,_)}getColor(d,l){return this._color.get(d,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(n,a,d,l){n.addEventListener(a,d,l);let _=!1;return{dispose:()=>{_||(_=!0,n.removeEventListener(a,d,l))}}}},3551:function(o,i,n){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var b=u.length-1;b>=0;b--)(S=u[b])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;let l=n(3656),_=n(8460),m=n(844),y=n(2585),p=n(4725),c=i.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(u,h,f,v,S){super(),this._element=u,this._mouseService=h,this._renderService=f,this._bufferService=v,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,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(u){this._lastMouseEvent=u;let h=this._positionFromMouseEvent(u,this._element,this._mouseService);if(!h)return;this._isMouseOut=!1;let f=u.composedPath();for(let v=0;v<f.length;v++){let S=f[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(u){if(this._activeLine!==u.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(u,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,u)||(this._clearCurrentLink(),this._askForLink(u,!0))}_askForLink(u,h){this._activeProviderReplies&&h||(this._activeProviderReplies?.forEach((v=>{v?.forEach((S=>{S.link.dispose&&S.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=u.y);let f=!1;for(let[v,S]of this._linkProviderService.linkProviders.entries())h?this._activeProviderReplies?.get(v)&&(f=this._checkLinkProviderResult(v,u,f)):S.provideLinks(u.y,(g=>{if(this._isMouseOut)return;let x=g?.map((b=>({link:b})));this._activeProviderReplies?.set(v,x),f=this._checkLinkProviderResult(v,u,f),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(u.y,this._activeProviderReplies)}))}_removeIntersectingLinks(u,h){let f=new Set;for(let v=0;v<h.size;v++){let S=h.get(v);if(S)for(let g=0;g<S.length;g++){let x=S[g],b=x.link.range.start.y<u?0:x.link.range.start.x,E=x.link.range.end.y>u?this._bufferService.cols:x.link.range.end.x;for(let P=b;P<=E;P++){if(f.has(P)){S.splice(g--,1);break}f.add(P)}}}}_checkLinkProviderResult(u,h,f){if(!this._activeProviderReplies)return f;let v=this._activeProviderReplies.get(u),S=!1;for(let g=0;g<u;g++)this._activeProviderReplies.has(g)&&!this._activeProviderReplies.get(g)||(S=!0);if(!S&&v){let g=v.find((x=>this._linkAtPosition(x.link,h)));g&&(f=!0,this._handleNewLink(g))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!f)for(let g=0;g<this._activeProviderReplies.size;g++){let x=this._activeProviderReplies.get(g)?.find((b=>this._linkAtPosition(b.link,h)));if(x){f=!0,this._handleNewLink(x);break}}return f}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(u){if(!this._currentLink)return;let h=this._positionFromMouseEvent(u,this._element,this._mouseService);h&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(u,this._currentLink.link.text)}_clearCurrentLink(u,h){this._currentLink&&this._lastMouseEvent&&(!u||!h||this._currentLink.link.range.start.y>=u&&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(u){if(!this._lastMouseEvent)return;let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._linkAtPosition(u.link,h)&&(this._currentLink=u,this._currentLink.state={decorations:{underline:u.link.decorations===void 0||u.link.decorations.underline,pointerCursor:u.link.decorations===void 0||u.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,u.link,this._lastMouseEvent),u.link.decorations={},Object.defineProperties(u.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:f=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==f&&(this._currentLink.state.decorations.pointerCursor=f,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",f))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:f=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==f&&(this._currentLink.state.decorations.underline=f,this._currentLink.state.isHovered&&this._fireUnderlineEvent(u.link,f))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((f=>{if(!this._currentLink)return;let v=f.start===0?0:f.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+f.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(v,S),this._lastMouseEvent)){let g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._askForLink(g,!1)}}))))}_linkHover(u,h,f){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&u.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(f,h.text)}_fireUnderlineEvent(u,h){let f=u.range,v=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(f.start.x-1,f.start.y-v-1,f.end.x,f.end.y-v-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(u,h,f){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&u.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(f,h.text)}_linkAtPosition(u,h){let f=u.range.start.y*this._bufferService.cols+u.range.start.x,v=u.range.end.y*this._bufferService.cols+u.range.end.x,S=h.y*this._bufferService.cols+h.x;return f<=S&&S<=v}_positionFromMouseEvent(u,h,f){let v=f.getCoords(u,h,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(u,h,f,v,S){return{x1:u,y1:h,x2:f,y2:v,cols:this._bufferService.cols,fg:S}}};i.Linkifier=c=a([d(1,p.IMouseService),d(2,p.IRenderService),d(3,y.IBufferService),d(4,p.ILinkProviderService)],c)},9042:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(o,i,n){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;let l=n(511),_=n(2585),m=i.OscLinkProvider=class{constructor(p,c,u){this._bufferService=p,this._optionsService=c,this._oscLinkService=u}provideLinks(p,c){let u=this._bufferService.buffer.lines.get(p-1);if(!u)return void c(void 0);let h=[],f=this._optionsService.rawOptions.linkHandler,v=new l.CellData,S=u.getTrimmedLength(),g=-1,x=-1,b=!1;for(let E=0;E<S;E++)if(x!==-1||u.hasContent(E)){if(u.loadCell(E,v),v.hasExtendedAttrs()&&v.extended.urlId){if(x===-1){x=E,g=v.extended.urlId;continue}b=v.extended.urlId!==g}else x!==-1&&(b=!0);if(b||x!==-1&&E===S-1){let P=this._oscLinkService.getLinkData(g)?.uri;if(P){let O={start:{x:x+1,y:p},end:{x:E+(b||E!==S-1?0:1),y:p}},F=!1;if(!f?.allowNonHttpProtocols)try{let A=new URL(P);["http:","https:"].includes(A.protocol)||(F=!0)}catch{F=!0}F||h.push({text:P,range:O,activate:(A,V)=>f?f.activate(A,V,O):y(0,V),hover:(A,V)=>f?.hover?.(A,V,O),leave:(A,V)=>f?.leave?.(A,V,O)})}b=!1,v.hasExtendedAttrs()&&v.extended.urlId?(x=E,g=v.extended.urlId):(x=-1,g=-1)}}c(h)}};function y(p,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,f){this._liveRegionDebouncer.refresh(h,f,this._terminal.rows)}_renderRows(h,f){let v=this._terminal.buffer,S=v.lines.length.toString();for(let g=h;g<=f;g++){let x=v.lines.get(v.ydisp+g),w=[],E=x?.translateToString(!0,void 0,void 0,w)||"",P=(v.ydisp+g+1).toString(),O=this._rowElements[g];O&&(E.length===0?(O.innerText="\xA0",this._rowColumns.set(O,[0,1])):(O.textContent=E,this._rowColumns.set(O,w)),O.setAttribute("aria-posinset",P),O.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,f){let v=h.target,S=this._rowElements[f===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(f===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==S)return;let g,x;if(f===0?(g=v,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(g=this._rowElements.shift(),x=v,this._rowContainer.removeChild(g)),g.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),f===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(f===0?-1:1),this._rowElements[f===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 f={node:h.anchorNode,offset:h.anchorOffset},v={node:h.focusNode,offset:h.focusOffset};if((f.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||f.node===v.node&&f.offset>v.offset)&&([f,v]=[v,f]),f.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(f={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(f.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 g=({node:E,offset:P})=>{let O=E instanceof Text?E.parentNode:E,F=parseInt(O?.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(O);if(!A)return console.warn("columns is null. Race condition?"),null;let V=P<A.length?A[P]:A.slice(-1)[0]+1;return V>=this._terminal.cols&&(++F,V=0),{row:F,column:V}},x=g(f),w=g(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 f=this._rowContainer.children.length;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);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=u=a([d(1,p.IInstantiationService),d(2,y.ICoreBrowserService),d(3,y.IRenderService)],u)},3614:(n,s)=>{function o(_){return _.replace(/\r?\n/g,"\r")}function a(_,m){return m?"\x1B[200~"+_+"\x1B[201~":_}function d(_,m,y,p){_=a(_=o(_),y.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(_,!0),m.value=""}function l(_,m,y){let p=y.getBoundingClientRect(),c=_.clientX-p.left-10,u=_.clientY-p.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${c}px`,m.style.top=`${u}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=o,s.bracketTextForPaste=a,s.copyHandler=function(_,m){_.clipboardData&&_.clipboardData.setData("text/plain",m.selectionText),_.preventDefault()},s.handlePasteEvent=function(_,m,y,p){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),m,y,p)},s.paste=d,s.moveTextAreaUnderMouseCursor=l,s.rightClickHandler=function(_,m,y,p,c){l(_,m,y),c&&p.rightClickSelect(_),m.value=p.selectionText,m.select()}},7239:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let a=o(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(d,l,_){this._css.set(d,l,_)}getCss(d,l){return this._css.get(d,l)}setColor(d,l,_){this._color.set(d,l,_)}getColor(d,l){return this._color.get(d,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,a,d,l){o.addEventListener(a,d,l);let _=!1;return{dispose:()=>{_||(_=!0,o.removeEventListener(a,d,l))}}}},3551:function(n,s,o){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let l=o(3656),_=o(8460),m=o(844),y=o(2585),p=o(4725),c=s.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(u,h,f,v,S){super(),this._element=u,this._mouseService=h,this._renderService=f,this._bufferService=v,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,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(u){this._lastMouseEvent=u;let h=this._positionFromMouseEvent(u,this._element,this._mouseService);if(!h)return;this._isMouseOut=!1;let f=u.composedPath();for(let v=0;v<f.length;v++){let S=f[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(u){if(this._activeLine!==u.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(u,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,u)||(this._clearCurrentLink(),this._askForLink(u,!0))}_askForLink(u,h){this._activeProviderReplies&&h||(this._activeProviderReplies?.forEach((v=>{v?.forEach((S=>{S.link.dispose&&S.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=u.y);let f=!1;for(let[v,S]of this._linkProviderService.linkProviders.entries())h?this._activeProviderReplies?.get(v)&&(f=this._checkLinkProviderResult(v,u,f)):S.provideLinks(u.y,(g=>{if(this._isMouseOut)return;let x=g?.map((w=>({link:w})));this._activeProviderReplies?.set(v,x),f=this._checkLinkProviderResult(v,u,f),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(u.y,this._activeProviderReplies)}))}_removeIntersectingLinks(u,h){let f=new Set;for(let v=0;v<h.size;v++){let S=h.get(v);if(S)for(let g=0;g<S.length;g++){let x=S[g],w=x.link.range.start.y<u?0:x.link.range.start.x,E=x.link.range.end.y>u?this._bufferService.cols:x.link.range.end.x;for(let P=w;P<=E;P++){if(f.has(P)){S.splice(g--,1);break}f.add(P)}}}}_checkLinkProviderResult(u,h,f){if(!this._activeProviderReplies)return f;let v=this._activeProviderReplies.get(u),S=!1;for(let g=0;g<u;g++)this._activeProviderReplies.has(g)&&!this._activeProviderReplies.get(g)||(S=!0);if(!S&&v){let g=v.find((x=>this._linkAtPosition(x.link,h)));g&&(f=!0,this._handleNewLink(g))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!f)for(let g=0;g<this._activeProviderReplies.size;g++){let x=this._activeProviderReplies.get(g)?.find((w=>this._linkAtPosition(w.link,h)));if(x){f=!0,this._handleNewLink(x);break}}return f}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(u){if(!this._currentLink)return;let h=this._positionFromMouseEvent(u,this._element,this._mouseService);h&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(u,this._currentLink.link.text)}_clearCurrentLink(u,h){this._currentLink&&this._lastMouseEvent&&(!u||!h||this._currentLink.link.range.start.y>=u&&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(u){if(!this._lastMouseEvent)return;let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._linkAtPosition(u.link,h)&&(this._currentLink=u,this._currentLink.state={decorations:{underline:u.link.decorations===void 0||u.link.decorations.underline,pointerCursor:u.link.decorations===void 0||u.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,u.link,this._lastMouseEvent),u.link.decorations={},Object.defineProperties(u.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:f=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==f&&(this._currentLink.state.decorations.pointerCursor=f,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",f))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:f=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==f&&(this._currentLink.state.decorations.underline=f,this._currentLink.state.isHovered&&this._fireUnderlineEvent(u.link,f))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((f=>{if(!this._currentLink)return;let v=f.start===0?0:f.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+f.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(v,S),this._lastMouseEvent)){let g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._askForLink(g,!1)}}))))}_linkHover(u,h,f){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&u.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(f,h.text)}_fireUnderlineEvent(u,h){let f=u.range,v=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(f.start.x-1,f.start.y-v-1,f.end.x,f.end.y-v-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(u,h,f){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&u.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(f,h.text)}_linkAtPosition(u,h){let f=u.range.start.y*this._bufferService.cols+u.range.start.x,v=u.range.end.y*this._bufferService.cols+u.range.end.x,S=h.y*this._bufferService.cols+h.x;return f<=S&&S<=v}_positionFromMouseEvent(u,h,f){let v=f.getCoords(u,h,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(u,h,f,v,S){return{x1:u,y1:h,x2:f,y2:v,cols:this._bufferService.cols,fg:S}}};s.Linkifier=c=a([d(1,p.IMouseService),d(2,p.IRenderService),d(3,y.IBufferService),d(4,p.ILinkProviderService)],c)},9042:(n,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(n,s,o){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let l=o(511),_=o(2585),m=s.OscLinkProvider=class{constructor(p,c,u){this._bufferService=p,this._optionsService=c,this._oscLinkService=u}provideLinks(p,c){let u=this._bufferService.buffer.lines.get(p-1);if(!u)return void c(void 0);let h=[],f=this._optionsService.rawOptions.linkHandler,v=new l.CellData,S=u.getTrimmedLength(),g=-1,x=-1,w=!1;for(let E=0;E<S;E++)if(x!==-1||u.hasContent(E)){if(u.loadCell(E,v),v.hasExtendedAttrs()&&v.extended.urlId){if(x===-1){x=E,g=v.extended.urlId;continue}w=v.extended.urlId!==g}else x!==-1&&(w=!0);if(w||x!==-1&&E===S-1){let P=this._oscLinkService.getLinkData(g)?.uri;if(P){let O={start:{x:x+1,y:p},end:{x:E+(w||E!==S-1?0:1),y:p}},F=!1;if(!f?.allowNonHttpProtocols)try{let A=new URL(P);["http:","https:"].includes(A.protocol)||(F=!0)}catch{F=!0}F||h.push({text:P,range:O,activate:(A,V)=>f?f.activate(A,V,O):y(0,V),hover:(A,V)=>f?.hover?.(A,V,O),leave:(A,V)=>f?.leave?.(A,V,O)})}w=!1,v.hasExtendedAttrs()&&v.extended.urlId?(x=E,g=v.extended.urlId):(x=-1,g=-1)}}c(h)}};function y(p,c){if(confirm(`Do you want to navigate to ${c}?
4
4
 
5
- WARNING: This link could potentially be dangerous`)){let u=window.open();if(u){try{u.opener=null}catch{}u.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=m=a([d(0,_.IBufferService),d(1,_.IOptionsService),d(2,_.IOscLinkService)],m)},6193:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.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,d){this._rowCount=d,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,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;let a=n(3614),d=n(3656),l=n(3551),_=n(9042),m=n(3730),y=n(1680),p=n(3107),c=n(5744),u=n(2950),h=n(1296),f=n(428),v=n(4269),S=n(5114),g=n(8934),x=n(3230),b=n(9312),E=n(4725),P=n(6731),O=n(8055),F=n(8969),A=n(8460),V=n(844),B=n(6114),M=n(8437),U=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 F.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(H={}){super(H),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new 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,W)=>this.refresh(k,W)))),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 W,q="";switch(k.index){case 256:W="foreground",q="10";break;case 257:W="background",q="11";break;case 258:W="cursor",q="12";break;default:W="ansi",q="4;"+k.index}switch(k.type){case 0:let j=O.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${U.C0.ESC}]${q};${(0,C.toRgbString)(j)}${U.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors((X=>X.ansi[k.index]=O.channels.toColor(...k.color)));else{let X=W;this._themeService.modifyColors((J=>J[X]=O.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(U.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(U.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 W=Math.min(this.buffer.x,this.cols-1),q=this._renderService.dimensions.css.cell.height,j=k.getWidth(W),X=this._renderService.dimensions.css.cell.width*j,J=this.buffer.y*this._renderService.dimensions.css.cell.height,ae=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ae+"px",this.textarea.style.top=J+"px",this.textarea.style.width=X+"px",this.textarea.style.height=q+"px",this.textarea.style.lineHeight=q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.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,d.addDisposableDomListener)(this.textarea,"paste",H)),this.register((0,d.addDisposableDomListener)(this.element,"paste",H)),B.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",(H=>this._keyUp(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",(H=>this._keyDown(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",(H=>this._keyPress(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",(H=>this._compositionHelper.compositionupdate(H)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.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,d.addDisposableDomListener)(this.screenElement,"mousemove",(W=>this.updateCursorStyle(W)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(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,d.addDisposableDomListener)(this.textarea,"focus",(W=>this._handleTextAreaFocus(W)))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(P.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((W=>this._onRender.fire(W)))),this.onResize((W=>this._renderService.resize(W.cols,W.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(u.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.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((W=>this.scrollLines(W.amount,W.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(b.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((W=>this.scrollLines(W.amount,W.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(W=>this._selectionService.handleMouseDown(W)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(W=>this._handleScreenReaderModeOptionChange(W)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(W=>{!this._overviewRulerRenderer&&W&&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 W(X){let J=H._mouseService.getMouseReportCoords(X,H.screenElement);if(!J)return!1;let ae,he;switch(X.overrideType||X.type){case"mousemove":he=32,X.buttons===void 0?(ae=3,X.button!==void 0&&(ae=X.button<3?X.button:3)):ae=1&X.buttons?0:4&X.buttons?1:2&X.buttons?2:3;break;case"mouseup":he=0,ae=X.button<3?X.button:3;break;case"mousedown":he=1,ae=X.button<3?X.button:3;break;case"wheel":if(H._customWheelEventHandler&&H._customWheelEventHandler(X)===!1||H.viewport.getLinesScrolled(X)===0)return!1;he=X.deltaY<0?0:1,ae=4;break;default:return!1}return!(he===void 0||ae===void 0||ae>4)&&H.coreMouseService.triggerMouseEvent({col:J.col,row:J.row,x:J.x,y:J.y,button:ae,action:he,ctrl:X.ctrlKey,alt:X.altKey,shift:X.shiftKey})}let q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},j={mouseup:X=>(W(X),X.buttons||(this._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.removeEventListener("mousemove",q.mousedrag)),this.cancel(X)),wheel:X=>(W(X),this.cancel(X,!0)),mousedrag:X=>{X.buttons&&W(X)},mousemove:X=>{X.buttons||W(X)}};this.register(this.coreMouseService.onProtocolChange((X=>{X?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(X)),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&X?q.mousemove||(k.addEventListener("mousemove",j.mousemove),q.mousemove=j.mousemove):(k.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&X?q.wheel||(k.addEventListener("wheel",j.wheel,{passive:!1}),q.wheel=j.wheel):(k.removeEventListener("wheel",q.wheel),q.wheel=null),2&X?q.mouseup||(q.mouseup=j.mouseup):(this._document.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&X?q.mousedrag||(q.mousedrag=j.mousedrag):(this._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(k,"mousedown",(X=>{if(X.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(X))return W(X),q.mouseup&&this._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.addEventListener("mousemove",q.mousedrag),this.cancel(X)}))),this.register((0,d.addDisposableDomListener)(k,"wheel",(X=>{if(!q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(X)===!1)return!1;if(!this.buffer.hasScrollback){let J=this.viewport.getLinesScrolled(X);if(J===0)return;let ae=U.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(X.deltaY<0?"A":"B"),he="";for(let _e=0;_e<Math.abs(J);_e++)he+=ae;return this.coreService.triggerDataEvent(he,!0),this.cancel(X,!0)}return this.viewport.handleWheel(X)?this.cancel(X):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(k,"touchstart",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(X),this.cancel(X)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(k,"touchmove",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(X)?void 0:this.cancel(X)}),{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,W=0){W===1?(super.scrollLines(H,k,W),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,W){this._selectionService.setSelection(H,k,W)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(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 W=(0,I.evaluateKeyboardEvent)(H,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(H),W.type===3||W.type===2){let q=this.rows-1;return this.scrollLines(W.type===2?-q:q),this.cancel(H,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,H)||(W.cancel&&this.cancel(H,!0),!W.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):(W.key!==U.C0.ETX&&W.key!==U.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||H.altKey||H.ctrlKey?this.cancel(H,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(H,k){let W=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"?W:W&&(!k.keyCode||k.keyCode>47)}_keyUp(H){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(H)||this.focus(),this.updateCursorStyle(H),this._keyPressHandled=!1)}_keyPress(H){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;if(this.cancel(H),H.charCode)k=H.charCode;else if(H.which===null||H.which===void 0)k=H.keyCode;else{if(H.which===0||H.charCode===0)return!1;k=H.which}return!(!k||(H.altKey||H.ctrlKey||H.metaKey)&&!this._isThirdLevelShift(this.browser,H)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(H){if(H.data&&H.inputType==="insertText"&&(!H.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=H.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(H),!0}return!1}resize(H,k){H!==this.cols||k!==this.rows?super.resize(H,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(H,k){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(M.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let H=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=H,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(U.C0.ESC+"[I"):this.coreService.triggerDataEvent(U.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),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[4;${W};${k}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let q=this._renderService.dimensions.css.cell.width.toFixed(0),j=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[6;${j};${q}t`)}}cancel(H,k){if(this.options.cancelEvents||k)return H.preventDefault(),H.stopPropagation(),!1}}i.Terminal=$},9924:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.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,d){this._rowCount=d,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 _=l-this._lastRefreshMs,m=this._debounceThresholdMS-_;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,i,n){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var b=u.length-1;b>=0;b--)(S=u[b])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;let l=n(3656),_=n(4725),m=n(8460),y=n(844),p=n(2585),c=i.Viewport=class extends y.Disposable{constructor(u,h,f,v,S,g,x,b){super(),this._viewportElement=u,this._scrollArea=h,this._bufferService=f,this._optionsService=v,this._charSizeService=S,this._renderService=g,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(b.colors),this.register(b.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(u){this._viewportElement.style.backgroundColor=u.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(u){if(u)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 u=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==u&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=u),this._refreshAnimationFrame=null}syncScrollArea(u=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(u);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(u)}_handleScroll(u){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 u=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(u*(this._smoothScrollState.target-this._smoothScrollState.origin)),u<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(u,h){let f=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&f<this._lastRecordedBufferHeight)||(u.cancelable&&u.preventDefault(),!1)}handleWheel(u){let h=this._getPixelsScrolled(u);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(u,h))}scrollLines(u){if(u!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let h=u*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:u,suppressScrollEvent:!1})}_getPixelsScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let h=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(u,h){let f,v="",S=[],g=h??this._bufferService.buffer.lines.length,x=this._bufferService.buffer.lines;for(let b=u;b<g;b++){let E=x.get(b);if(!E)continue;let P=x.get(b+1)?.isWrapped;if(v+=E.translateToString(!P),!P||b===x.length-1){let O=document.createElement("div");O.textContent=v,S.push(O),v.length>0&&(f=O),v=""}}return{bufferElements:S,cursorElement:f}}getLinesScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let h=this._applyScrollModifier(u.deltaY,u);return u.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):u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(u,h){let f=this._optionsService.rawOptions.fastScrollModifier;return f==="alt"&&h.altKey||f==="ctrl"&&h.ctrlKey||f==="shift"&&h.shiftKey?u*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:u*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(u){this._lastTouchY=u.touches[0].pageY}handleTouchMove(u){let h=this._lastTouchY-u.touches[0].pageY;return this._lastTouchY=u.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(u,h))}};i.Viewport=c=a([d(2,p.IBufferService),d(3,p.IOptionsService),d(4,_.ICharSizeService),d(5,_.IRenderService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],c)},3107:function(o,i,n){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;let l=n(4725),_=n(844),m=n(2585),y=i.BufferDecorationRenderer=class extends _.Disposable{constructor(p,c,u,h,f){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=u,this._decorationService=h,this._renderService=f,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((v=>this._removeDecoration(v)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),c.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let u=p.options.x??0;return u&&u>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(p,c),c}_refreshStyle(p){let c=p.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let u=this._decorationElements.get(p);u||(u=this._createElement(p),p.element=u,this._decorationElements.set(p,u),this._container.appendChild(u),p.onDispose((()=>{this._decorationElements.delete(p),u.remove()}))),u.style.top=c*this._renderService.dimensions.css.cell.height+"px",u.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(u)}}_refreshXPosition(p,c=p.element){if(!c)return;let u=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};i.BufferDecorationRenderer=y=a([d(1,m.IBufferService),d(2,l.ICoreBrowserService),d(3,m.IDecorationService),d(4,l.IRenderService)],y)},5871:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(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,d){return a>=n.startBufferLine-this._linePadding[d||"full"]&&a<=n.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(n,a){n.startBufferLine=Math.min(n.startBufferLine,a),n.endBufferLine=Math.max(n.endBufferLine,a)}}},5744:function(o,i,n){var a=this&&this.__decorate||function(f,v,S,g){var x,b=arguments.length,E=b<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,v,S,g);else for(var P=f.length-1;P>=0;P--)(x=f[P])&&(E=(b<3?x(E):b>3?x(v,S,E):x(v,S))||E);return b>3&&E&&Object.defineProperty(v,S,E),E},d=this&&this.__param||function(f,v){return function(S,g){v(S,g,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;let l=n(5871),_=n(4725),m=n(844),y=n(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},h=i.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(f,v,S,g,x,b,E){super(),this._viewportElement=f,this._screenElement=v,this._bufferService=S,this._decorationService=g,this._renderService=x,this._optionsService=b,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 P=this._canvas.getContext("2d");if(!P)throw new Error("Ctx cannot be null");this._ctx=P,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,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 f=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=f,c.center=v,c.right=f,this._refreshDrawHeightConstants(),u.full=0,u.left=0,u.center=c.left,u.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let f=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(f,12),6)*this._coreBrowserService.dpr);p.left=v,p.center=v,p.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;let f=this._colorZoneStore.zones;for(let v of f)v.position!=="full"&&this._renderColorZone(v);for(let v of f)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(f){this._ctx.fillStyle=f.color,this._ctx.fillRect(u[f.position||"full"],Math.round((this._canvas.height-1)*(f.startBufferLine/this._bufferService.buffers.active.lines.length)-p[f.position||"full"]/2),c[f.position||"full"],Math.round((this._canvas.height-1)*((f.endBufferLine-f.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[f.position||"full"]))}_queueRefresh(f,v){this._shouldUpdateDimensions=f||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};i.OverviewRulerRenderer=h=a([d(2,y.IBufferService),d(3,y.IDecorationService),d(4,_.IRenderService),d(5,y.IOptionsService),d(6,_.ICoreBrowserService)],h)},2950:function(o,i,n){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;let l=n(4725),_=n(2585),m=n(2584),y=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,u,h,f,v){this._textarea=p,this._compositionView=c,this._bufferService=u,this._optionsService=h,this._coreService=f,this._renderService=v,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let u;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,u=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),u.length>0&&this._coreService.triggerDataEvent(u,!0)}}),0)}else{this._isSendingComposition=!1;let c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,u=c.replace(p,"");this._dataAlreadySent=u,c.length>p.length?this._coreService.triggerDataEvent(u,!0):c.length<p.length?this._coreService.triggerDataEvent(`${m.C0.DEL}`,!0):c.length===p.length&&c!==p&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),u=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,f=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=f+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=u+"px",this._compositionView.style.lineHeight=u+"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=f+"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"}p||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};i.CompositionHelper=y=a([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,_.ICoreService),d(5,l.IRenderService)],y)},9806:(o,i)=>{function n(a,d,l){let _=l.getBoundingClientRect(),m=a.getComputedStyle(l),y=parseInt(m.getPropertyValue("padding-left")),p=parseInt(m.getPropertyValue("padding-top"));return[d.clientX-_.left-y,d.clientY-_.top-p]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=n,i.getCoords=function(a,d,l,_,m,y,p,c,u){if(!y)return;let h=n(a,d,l);return h?(h[0]=Math.ceil((h[0]+(u?p/2:0))/p),h[1]=Math.ceil(h[1]/c),h[0]=Math.min(Math.max(h[0],1),_+(u?1:0)),h[1]=Math.min(Math.max(h[1],1),m),h):void 0}},9504:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;let a=n(2584);function d(c,u,h,f){let v=c-l(c,h),S=u-l(u,h),g=Math.abs(v-S)-(function(x,b,E){let P=0,O=x-l(x,E),F=b-l(b,E);for(let A=0;A<Math.abs(O-F);A++){let V=_(x,b)==="A"?-1:1;E.buffer.lines.get(O+V*A)?.isWrapped&&P++}return P})(c,u,h);return p(g,y(_(c,u),f))}function l(c,u){let h=0,f=u.buffer.lines.get(c),v=f?.isWrapped;for(;v&&c>=0&&c<u.rows;)h++,f=u.buffer.lines.get(--c),v=f?.isWrapped;return h}function _(c,u){return c>u?"A":"B"}function m(c,u,h,f,v,S){let g=c,x=u,b="";for(;g!==h||x!==f;)g+=v?1:-1,v&&g>S.cols-1?(b+=S.buffer.translateBufferLineToString(x,!1,c,g),g=0,c=0,x++):!v&&g<0&&(b+=S.buffer.translateBufferLineToString(x,!1,0,c+1),g=S.cols-1,c=g,x--);return b+S.buffer.translateBufferLineToString(x,!1,c,g)}function y(c,u){let h=u?"O":"[";return a.C0.ESC+h+c}function p(c,u){c=Math.floor(c);let h="";for(let f=0;f<c;f++)h+=u;return h}i.moveToCellSequence=function(c,u,h,f){let v=h.buffer.x,S=h.buffer.y;if(!h.buffer.hasScrollback)return(function(b,E,P,O,F,A){return d(E,O,F,A).length===0?"":p(m(b,E,b,E-l(E,F),!1,F).length,y("D",A))})(v,S,0,u,h,f)+d(S,u,h,f)+(function(b,E,P,O,F,A){let V;V=d(E,O,F,A).length>0?O-l(O,F):E;let B=O,M=(function(U,I,C,L,T,D){let N;return N=d(C,L,T,D).length>0?L-l(L,T):I,U<C&&N<=L||U>=C&&N<L?"C":"D"})(b,E,P,O,F,A);return p(m(b,V,P,B,M==="C",F).length,y(M,A))})(v,S,c,u,h,f);let g;if(S===u)return g=v>c?"D":"C",p(Math.abs(v-c),y(g,f));g=S>u?"D":"C";let x=Math.abs(S-u);return p((function(b,E){return E.cols-b})(S>u?c:v,h)+(x-1)*h.cols+1+((S>u?v:c)-1),y(g,f))}},1296:function(o,i,n){var a=this&&this.__decorate||function(A,V,B,M){var U,I=arguments.length,C=I<3?V:M===null?M=Object.getOwnPropertyDescriptor(V,B):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(A,V,B,M);else for(var L=A.length-1;L>=0;L--)(U=A[L])&&(C=(I<3?U(C):I>3?U(V,B,C):U(V,B))||C);return I>3&&C&&Object.defineProperty(V,B,C),C},d=this&&this.__param||function(A,V){return function(B,M){V(B,M,A)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;let l=n(3787),_=n(2550),m=n(2223),y=n(6171),p=n(6052),c=n(4725),u=n(8055),h=n(8460),f=n(844),v=n(2585),S="xterm-dom-renderer-owner-",g="xterm-rows",x="xterm-fg-",b="xterm-bg-",E="xterm-focus",P="xterm-selection",O=1,F=i.DomRenderer=class extends f.Disposable{constructor(A,V,B,M,U,I,C,L,T,D,N,G,$){super(),this._terminal=A,this._document=V,this._element=B,this._screenElement=M,this._viewportElement=U,this._helperContainer=I,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=N,this._coreBrowserService=G,this._themeService=$,this._terminalClass=O++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new h.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(P),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,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,f.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 _.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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let V=`${this._terminalSelector} .${g} 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} .${g} { 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} .${g} .xterm-dim { color: ${u.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 B=`blink_underline_${this._terminalClass}`,M=`blink_bar_${this._terminalClass}`,U=`blink_block_${this._terminalClass}`;V+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,V+=`@keyframes ${M} { 50% { box-shadow: none; }}`,V+=`@keyframes ${U} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,V+=`${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${M} 1s step-end infinite;}${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,V+=`${this._terminalSelector} .${P} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${P} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${P} 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: ${u.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${b}${I} { background-color: ${C.css}; }`;V+=`${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR} { color: ${u.color.opaque(A.background).css}; }${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${u.color.multiplyOpacity(u.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${b}${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 B=this._rowElements.length;B<=V;B++){let M=this._document.createElement("div");this._rowContainer.appendChild(M),this._rowElements.push(M)}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,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,V,B),this.renderRows(0,this._bufferService.rows-1),!A||!V)return;this._selectionRenderModel.update(this._terminal,A,V,B);let M=this._selectionRenderModel.viewportStartRow,U=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(B){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=M===I?A[0]:0,D=I===U?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=U===C?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,G))}}this._selectionContainer.appendChild(L)}_createSelectionElement(A,V,B,M=1){let U=this._document.createElement("div"),I=V*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(B-V);return I+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-I),U.style.height=M*this.dimensions.css.cell.height+"px",U.style.top=A*this.dimensions.css.cell.height+"px",U.style.left=`${I}px`,U.style.width=`${C}px`,U}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 B=this._bufferService.buffer,M=B.ybase+B.y,U=Math.min(B.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+B.ydisp,N=this._rowElements[T],G=B.lines.get(D);if(!N||!G)break;N.replaceChildren(...this._rowFactory.createRow(G,D,D===M,C,L,U,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,B,M,U,I){B<0&&(A=0),M<0&&(V=0);let C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),M=Math.max(Math.min(M,C),0),U=Math.min(U,this._bufferService.cols);let L=this._bufferService.buffer,T=L.ybase+L.y,D=Math.min(L.x,U-1),N=this._optionsService.rawOptions.cursorBlink,G=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=B;Y<=M;++Y){let H=Y+L.ydisp,k=this._rowElements[Y],W=L.lines.get(H);if(!k||!W)break;k.replaceChildren(...this._rowFactory.createRow(W,H,H===T,G,$,D,N,this.dimensions.css.cell.width,this._widthCache,I?Y===B?A:0:-1,I?(Y===M?V:U)-1:-1))}}};i.DomRenderer=F=a([d(7,v.IInstantiationService),d(8,c.ICharSizeService),d(9,v.IOptionsService),d(10,v.IBufferService),d(11,c.ICoreBrowserService),d(12,c.IThemeService)],F)},3787:function(o,i,n){var a=this&&this.__decorate||function(g,x,b,E){var P,O=arguments.length,F=O<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,b):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(g,x,b,E);else for(var A=g.length-1;A>=0;A--)(P=g[A])&&(F=(O<3?P(F):O>3?P(x,b,F):P(x,b))||F);return O>3&&F&&Object.defineProperty(x,b,F),F},d=this&&this.__param||function(g,x){return function(b,E){x(b,E,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;let l=n(2223),_=n(643),m=n(511),y=n(2585),p=n(8055),c=n(4725),u=n(4269),h=n(6171),f=n(3734),v=i.DomRendererRowFactory=class{constructor(g,x,b,E,P,O,F){this._document=g,this._characterJoinerService=x,this._optionsService=b,this._coreBrowserService=E,this._coreService=P,this._decorationService=O,this._themeService=F,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(g,x,b){this._selectionStart=g,this._selectionEnd=x,this._columnSelectMode=b}createRow(g,x,b,E,P,O,F,A,V,B,M){let U=[],I=this._characterJoinerService.getJoinedCharacters(x),C=this._themeService.colors,L,T=g.getNoBgTrimmedLength();b&&T<O+1&&(T=O+1);let D=0,N="",G=0,$=0,Y=0,H=!1,k=0,W=!1,q=0,j=[],X=B!==-1&&M!==-1;for(let J=0;J<T;J++){g.loadCell(J,this._workCell);let ae=this._workCell.getWidth();if(ae===0)continue;let he=!1,_e=J,Z=this._workCell;if(I.length>0&&J===I[0][0]){he=!0;let le=I.shift();Z=new u.JoinedCellData(this._workCell,g.translateToString(!0,le[0],le[1]),le[1]-le[0]),_e=le[1]-1,ae=Z.getWidth()}let Ce=this._isCellInSelection(J,x),He=b&&J===O,Ee=X&&J>=B&&J<=M,Oe=!1;this._decorationService.forEachDecorationAtCell(J,x,void 0,(le=>{Oe=!0}));let Ue=Z.getChars()||_.WHITESPACE_CELL_CHAR;if(Ue===" "&&(Z.isUnderline()||Z.isOverline())&&(Ue="\xA0"),q=ae*A-V.get(Ue,Z.isBold(),Z.isItalic()),L){if(D&&(Ce&&W||!Ce&&!W&&Z.bg===G)&&(Ce&&W&&C.selectionForeground||Z.fg===$)&&Z.extended.ext===Y&&Ee===H&&q===k&&!He&&!he&&!Oe){Z.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=Ue,D++;continue}D&&(L.textContent=N),L=this._document.createElement("span"),D=0,N=""}else L=this._document.createElement("span");if(G=Z.bg,$=Z.fg,Y=Z.extended.ext,H=Ee,k=q,W=Ce,he&&O>=J&&O<=_e&&(O=J),!this._coreService.isCursorHidden&&He&&this._coreService.isCursorInitialized){if(j.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&j.push("xterm-cursor-blink"),j.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(P)switch(P){case"outline":j.push("xterm-cursor-outline");break;case"block":j.push("xterm-cursor-block");break;case"bar":j.push("xterm-cursor-bar");break;case"underline":j.push("xterm-cursor-underline")}}if(Z.isBold()&&j.push("xterm-bold"),Z.isItalic()&&j.push("xterm-italic"),Z.isDim()&&j.push("xterm-dim"),N=Z.isInvisible()?_.WHITESPACE_CELL_CHAR:Z.getChars()||_.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(j.push(`xterm-underline-${Z.extended.underlineStyle}`),N===" "&&(N="\xA0"),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let le=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&le<8&&(le+=8),L.style.textDecorationColor=C.ansi[le].css}Z.isOverline()&&(j.push("xterm-overline"),N===" "&&(N="\xA0")),Z.isStrikethrough()&&j.push("xterm-strikethrough"),Ee&&(L.style.textDecoration="underline");let te=Z.getFgColor(),de=Z.getFgColorMode(),ve=Z.getBgColor(),Q=Z.getBgColorMode(),se=!!Z.isInverse();if(se){let le=te;te=ve,ve=le;let ge=de;de=Q,Q=ge}let oe,re,ne,ce=!1;switch(this._decorationService.forEachDecorationAtCell(J,x,void 0,(le=>{le.options.layer!=="top"&&ce||(le.backgroundColorRGB&&(Q=50331648,ve=le.backgroundColorRGB.rgba>>8&16777215,oe=le.backgroundColorRGB),le.foregroundColorRGB&&(de=50331648,te=le.foregroundColorRGB.rgba>>8&16777215,re=le.foregroundColorRGB),ce=le.options.layer==="top")})),!ce&&Ce&&(oe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ve=oe.rgba>>8&16777215,Q=50331648,ce=!0,C.selectionForeground&&(de=50331648,te=C.selectionForeground.rgba>>8&16777215,re=C.selectionForeground)),ce&&j.push("xterm-decoration-top"),Q){case 16777216:case 33554432:ne=C.ansi[ve],j.push(`xterm-bg-${ve}`);break;case 50331648:ne=p.channels.toColor(ve>>16,ve>>8&255,255&ve),this._addStyle(L,`background-color:#${S((ve>>>0).toString(16),"0",6)}`);break;default:se?(ne=C.foreground,j.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):ne=C.background}switch(oe||Z.isDim()&&(oe=p.color.multiplyOpacity(ne,.5)),de){case 16777216:case 33554432:Z.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(L,ne,C.ansi[te],Z,oe,void 0)||j.push(`xterm-fg-${te}`);break;case 50331648:let le=p.channels.toColor(te>>16&255,te>>8&255,255&te);this._applyMinimumContrast(L,ne,le,Z,oe,re)||this._addStyle(L,`color:#${S(te.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,ne,C.foreground,Z,oe,re)||se&&j.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}j.length&&(L.className=j.join(" "),j.length=0),He||he||Oe?L.textContent=N:D++,q!==this.defaultSpacing&&(L.style.letterSpacing=`${q}px`),U.push(L),J=_e}return L&&D&&(L.textContent=N),U}_applyMinimumContrast(g,x,b,E,P,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.treatGlyphAsBackgroundColor)(E.getCode()))return!1;let F=this._getContrastCache(E),A;if(P||O||(A=F.getColor(x.rgba,b.rgba)),A===void 0){let V=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);A=p.color.ensureContrastRatio(P||x,O||b,V),F.setColor((P||x).rgba,(O||b).rgba,A??null)}return!!A&&(this._addStyle(g,`color:${A.css}`),!0)}_getContrastCache(g){return g.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(g,x){g.setAttribute("style",`${g.getAttribute("style")||""}${x};`)}_isCellInSelection(g,x){let b=this._selectionStart,E=this._selectionEnd;return!(!b||!E)&&(this._columnSelectMode?b[0]<=E[0]?g>=b[0]&&x>=b[1]&&g<E[0]&&x<=E[1]:g<b[0]&&x>=b[1]&&g>=E[0]&&x<=E[1]:x>b[1]&&x<E[1]||b[1]===E[1]&&x===b[1]&&g>=b[0]&&g<E[0]||b[1]<E[1]&&x===E[1]&&g<E[0]||b[1]<E[1]&&x===b[1]&&g>=b[0])}};function S(g,x,b){for(;g.length<b;)g=x+g;return g}i.DomRendererRowFactory=v=a([d(1,c.ICharacterJoinerService),d(2,y.IOptionsService),d(3,c.ICoreBrowserService),d(4,y.ICoreService),d(5,y.IDecorationService),d(6,c.IThemeService)],v)},2550:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.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 d=n.createElement("span");d.classList.add("xterm-char-measure-element");let l=n.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let _=n.createElement("span");_.classList.add("xterm-char-measure-element"),_.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=[d,l,_,m],this._container.appendChild(d),this._container.appendChild(l),this._container.appendChild(_),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,d,l){n===this._font&&a===this._fontSize&&d===this._weight&&l===this._weightBold||(this._font=n,this._fontSize=a,this._weight=d,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(n,a,d){let l=0;if(!a&&!d&&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 _=n;a&&(_+="B"),d&&(_+="I");let m=this._holey.get(_);if(m===void 0){let y=0;a&&(y|=1),d&&(y|=2),m=this._measure(n,y),m>0&&this._holey.set(_,m)}return m}_measure(n,a){let d=this._measureElements[a];return d.textContent=n.repeat(32),d.offsetWidth/32}}},2223:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;let a=n(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(o,i)=>{function n(d){return 57508<=d&&d<=57558}function a(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},i.isPowerlineGlyph=n,i.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},i.isEmoji=a,i.allowRescaling=function(d,l,_,m){return l===1&&_>Math.ceil(1.5*m)&&d!==void 0&&d>255&&!a(d)&&!n(d)&&!(function(y){return 57344<=y&&y<=63743})(d)},i.treatGlyphAsBackgroundColor=function(d){return n(d)||(function(l){return 9472<=l&&l<=9631})(d)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(d,l,_=0){return(d-(2*Math.round(l)-_))%(2*Math.round(l))}},6052:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.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(d,l,_,m=!1){if(this.selectionStart=l,this.selectionEnd=_,!l||!_||l[0]===_[0]&&l[1]===_[1])return void this.clear();let y=d.buffers.active.ydisp,p=l[1]-y,c=_[1]-y,u=Math.max(p,0),h=Math.min(c,d.rows-1);u>=d.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=u,this.viewportCappedEndRow=h,this.startCol=l[0],this.endCol=_[0])}isCellSelected(d,l,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&_>=this.viewportCappedStartRow&&l<this.endCol&&_<=this.viewportCappedEndRow:l<this.startCol&&_>=this.viewportCappedStartRow&&l>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&l>=this.startCol)}}i.createSelectionRenderModel=function(){return new n}},456:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.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,i,n){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,b=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(b=(x<3?g(b):x>3?g(f,v,b):g(f,v))||b);return x>3&&b&&Object.defineProperty(f,v,b),b},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;let l=n(2585),_=n(8460),m=n(844),y=i.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(h,f,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new u(this._optionsService))}catch{this._measureStrategy=this.register(new c(h,f,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())}};i.CharSizeService=y=a([d(2,l.IOptionsService)],y);class p extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(f,v){f!==void 0&&f>0&&v!==void 0&&v>0&&(this._result.width=f,this._result.height=v)}}class c extends p{constructor(f,v,S){super(),this._document=f,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 u extends p{constructor(f){super(),this._optionsService=f,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 f=this._ctx.measureText("W");return this._validateAndSet(f.width,f.fontBoundingBoxAscent+f.fontBoundingBoxDescent),this._result}}},4269:function(o,i,n){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var b=u.length-1;b>=0;b--)(S=u[b])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;let l=n(3734),_=n(643),m=n(511),y=n(2585);class p extends l.AttributeData{constructor(h,f,v){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=f,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()]}}i.JoinedCellData=p;let c=i.CharacterJoinerService=class oa{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(h){let f={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(f),f.id}deregister(h){for(let f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===h)return this._characterJoiners.splice(f,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];let f=this._bufferService.buffer.lines.get(h);if(!f||f.length===0)return[];let v=[],S=f.translateToString(!0),g=0,x=0,b=0,E=f.getFg(0),P=f.getBg(0);for(let O=0;O<f.getTrimmedLength();O++)if(f.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==P){if(O-g>1){let F=this._getJoinedRanges(S,b,x,f,g);for(let A=0;A<F.length;A++)v.push(F[A])}g=O,b=x,E=this._workCell.fg,P=this._workCell.bg}x+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-g>1){let O=this._getJoinedRanges(S,b,x,f,g);for(let F=0;F<O.length;F++)v.push(O[F])}return v}_getJoinedRanges(h,f,v,S,g){let x=h.substring(f,v),b=[];try{b=this._characterJoiners[0].handler(x)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{let P=this._characterJoiners[E].handler(x);for(let O=0;O<P.length;O++)oa._mergeRanges(b,P[O])}catch(P){console.error(P)}return this._stringRangesToCellRanges(b,S,g),b}_stringRangesToCellRanges(h,f,v){let S=0,g=!1,x=0,b=h[S];if(b){for(let E=v;E<this._bufferService.cols;E++){let P=f.getWidth(E),O=f.getString(E).length||_.WHITESPACE_CELL_CHAR.length;if(P!==0){if(!g&&b[0]<=x&&(b[0]=E,g=!0),b[1]<=x){if(b[1]=E,b=h[++S],!b)break;b[0]<=x?(b[0]=E,g=!0):g=!1}x+=O}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(h,f){let v=!1;for(let S=0;S<h.length;S++){let g=h[S];if(v){if(f[1]<=g[0])return h[S-1][1]=f[1],h;if(f[1]<=g[1])return h[S-1][1]=Math.max(f[1],g[1]),h.splice(S,1),h;h.splice(S,1),S--}else{if(f[1]<=g[0])return h.splice(S,0,f),h;if(f[1]<=g[1])return g[0]=Math.min(f[0],g[0]),h;f[0]<g[1]&&(g[0]=Math.min(f[0],g[0]),v=!0)}}return v?h[h.length-1][1]=f[1]:h.push(f),h}};i.CharacterJoinerService=c=a([d(0,y.IBufferService)],c)},5114:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;let a=n(844),d=n(8460),l=n(3656);class _ extends a.Disposable{constructor(p,c,u){super(),this._textarea=p,this._window=c,this.mainDocument=u,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((h=>this._screenDprMonitor.setWindow(h)))),this.register((0,d.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(p){this._window!==p&&(this._window=p,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}i.CoreBrowserService=_;class m extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,a.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,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,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;let a=n(844);class d extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let m=this.linkProviders.indexOf(_);m!==-1&&this.linkProviders.splice(m,1)}}}}i.LinkProviderService=d},8934:function(o,i,n){var a=this&&this.__decorate||function(y,p,c,u){var h,f=arguments.length,v=f<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,c):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(y,p,c,u);else for(var S=y.length-1;S>=0;S--)(h=y[S])&&(v=(f<3?h(v):f>3?h(p,c,v):h(p,c))||v);return f>3&&v&&Object.defineProperty(p,c,v),v},d=this&&this.__param||function(y,p){return function(c,u){p(c,u,y)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;let l=n(4725),_=n(9806),m=i.MouseService=class{constructor(y,p){this._renderService=y,this._charSizeService=p}getCoords(y,p,c,u,h){return(0,_.getCoords)(window,y,p,c,u,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(y,p){let c=(0,_.getCoordsRelativeToElement)(window,y,p);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};i.MouseService=m=a([d(0,l.IRenderService),d(1,l.ICharSizeService)],m)},3230:function(o,i,n){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,b=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(b=(x<3?g(b):x>3?g(f,v,b):g(f,v))||b);return x>3&&b&&Object.defineProperty(f,v,b),b},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;let l=n(6193),_=n(4725),m=n(8460),y=n(844),p=n(7226),c=n(2585),u=i.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(h,f,v,S,g,x,b,E){super(),this._rowCount=h,this._charSizeService=S,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new p.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(((P,O)=>this._renderRows(P,O)),b),this.register(this._renderDebouncer),this.register(b.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(g.onDecorationRegistered((()=>this._fullRefresh()))),this.register(g.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(b.window,f),this.register(b.onWindowChange((P=>this._registerIntersectionObserver(P,f))))}_registerIntersectionObserver(h,f){if("IntersectionObserver"in h){let v=new h.IntersectionObserver((S=>this._handleIntersectionChange(S[S.length-1])),{threshold:0});v.observe(f),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,f,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(h,f,this._rowCount))}_renderRows(h,f){this._renderer.value&&(h=Math.min(h,this._rowCount-1),f=Math.min(f,this._rowCount-1),this._renderer.value.renderRows(h,f),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:f}),this._onRender.fire({start:h,end:f}),this._isNextRenderRedrawOnly=!0)}resize(h,f){this._rowCount=f,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((f=>this.refreshRows(f.start,f.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,f){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(h,f))):this._renderer.value.handleResize(h,f),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(h,f,v){this._selectionState.start=h,this._selectionState.end=f,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(h,f,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};i.RenderService=u=a([d(2,c.IOptionsService),d(3,_.ICharSizeService),d(4,c.IDecorationService),d(5,c.IBufferService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],u)},9312:function(o,i,n){var a=this&&this.__decorate||function(b,E,P,O){var F,A=arguments.length,V=A<3?E:O===null?O=Object.getOwnPropertyDescriptor(E,P):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(b,E,P,O);else for(var B=b.length-1;B>=0;B--)(F=b[B])&&(V=(A<3?F(V):A>3?F(E,P,V):F(E,P))||V);return A>3&&V&&Object.defineProperty(E,P,V),V},d=this&&this.__param||function(b,E){return function(P,O){E(P,O,b)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;let l=n(9806),_=n(9504),m=n(456),y=n(4725),p=n(8460),c=n(844),u=n(6114),h=n(4841),f=n(511),v=n(2585),S="\xA0",g=new RegExp(S,"g"),x=i.SelectionService=class extends c.Disposable{constructor(b,E,P,O,F,A,V,B,M){super(),this._element=b,this._screenElement=E,this._linkifier=P,this._bufferService=O,this._coreService=F,this._mouseService=A,this._optionsService=V,this._renderService=B,this._coreBrowserService=M,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=U=>this._handleMouseMove(U),this._mouseUpListener=U=>this._handleMouseUp(U),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((U=>this._handleTrim(U))),this.register(this._bufferService.buffers.onBufferActivate((U=>this._handleBufferActivate(U)))),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 b=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!b||!E||b[0]===E[0]&&b[1]===E[1])}get selectionText(){let b=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!b||!E)return"";let P=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(b[0]===E[0])return"";let F=b[0]<E[0]?b[0]:E[0],A=b[0]<E[0]?E[0]:b[0];for(let V=b[1];V<=E[1];V++){let B=P.translateBufferLineToString(V,!0,F,A);O.push(B)}}else{let F=b[1]===E[1]?E[0]:void 0;O.push(P.translateBufferLineToString(b[1],!0,b[0],F));for(let A=b[1]+1;A<=E[1]-1;A++){let V=P.lines.get(A),B=P.translateBufferLineToString(A,!0);V?.isWrapped?O[O.length-1]+=B:O.push(B)}if(b[1]!==E[1]){let A=P.lines.get(E[1]),V=P.translateBufferLineToString(E[1],!0,0,E[0]);A&&A.isWrapped?O[O.length-1]+=V:O.push(V)}}return O.map((F=>F.replace(g," "))).join(u.isWindows?`\r
5
+ WARNING: This link could potentially be dangerous`)){let u=window.open();if(u){try{u.opener=null}catch{}u.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=m=a([d(0,_.IBufferService),d(1,_.IOptionsService),d(2,_.IOscLinkService)],m)},6193:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,a){this._renderCallback=o,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,a,d){this._rowCount=d,o=o!==void 0?o:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,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 o=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let a=o(3614),d=o(3656),l=o(3551),_=o(9042),m=o(3730),y=o(1680),p=o(3107),c=o(5744),u=o(2950),h=o(1296),f=o(428),v=o(4269),S=o(5114),g=o(8934),x=o(3230),w=o(9312),E=o(4725),P=o(6731),O=o(8055),F=o(8969),A=o(8460),V=o(844),B=o(6114),R=o(8437),z=o(2584),I=o(7399),C=o(5941),L=o(9074),T=o(2585),D=o(5435),N=o(4567),G=o(779);class j extends F.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(H={}){super(H),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new 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,W)=>this.refresh(k,W)))),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 W,q="";switch(k.index){case 256:W="foreground",q="10";break;case 257:W="background",q="11";break;case 258:W="cursor",q="12";break;default:W="ansi",q="4;"+k.index}switch(k.type){case 0:let $=O.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${z.C0.ESC}]${q};${(0,C.toRgbString)($)}${z.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors((X=>X.ansi[k.index]=O.channels.toColor(...k.color)));else{let X=W;this._themeService.modifyColors((J=>J[X]=O.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(z.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let H=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(H);if(!k)return;let W=Math.min(this.buffer.x,this.cols-1),q=this._renderService.dimensions.css.cell.height,$=k.getWidth(W),X=this._renderService.dimensions.css.cell.width*$,J=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=J+"px",this.textarea.style.width=X+"px",this.textarea.style.height=q+"px",this.textarea.style.lineHeight=q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.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,d.addDisposableDomListener)(this.textarea,"paste",H)),this.register((0,d.addDisposableDomListener)(this.element,"paste",H)),B.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",(H=>this._keyUp(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",(H=>this._keyDown(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",(H=>this._keyPress(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",(H=>this._compositionHelper.compositionupdate(H)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.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,d.addDisposableDomListener)(this.screenElement,"mousemove",(W=>this.updateCursorStyle(W)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(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,d.addDisposableDomListener)(this.textarea,"focus",(W=>this._handleTextAreaFocus(W)))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(P.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((W=>this._onRender.fire(W)))),this.onResize((W=>this._renderService.resize(W.cols,W.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(u.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.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((W=>this.scrollLines(W.amount,W.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(w.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((W=>this.scrollLines(W.amount,W.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(W=>this._selectionService.handleMouseDown(W)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(W=>this._handleScreenReaderModeOptionChange(W)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(W=>{!this._overviewRulerRenderer&&W&&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 W(X){let J=H._mouseService.getMouseReportCoords(X,H.screenElement);if(!J)return!1;let ce,de;switch(X.overrideType||X.type){case"mousemove":de=32,X.buttons===void 0?(ce=3,X.button!==void 0&&(ce=X.button<3?X.button:3)):ce=1&X.buttons?0:4&X.buttons?1:2&X.buttons?2:3;break;case"mouseup":de=0,ce=X.button<3?X.button:3;break;case"mousedown":de=1,ce=X.button<3?X.button:3;break;case"wheel":if(H._customWheelEventHandler&&H._customWheelEventHandler(X)===!1||H.viewport.getLinesScrolled(X)===0)return!1;de=X.deltaY<0?0:1,ce=4;break;default:return!1}return!(de===void 0||ce===void 0||ce>4)&&H.coreMouseService.triggerMouseEvent({col:J.col,row:J.row,x:J.x,y:J.y,button:ce,action:de,ctrl:X.ctrlKey,alt:X.altKey,shift:X.shiftKey})}let q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:X=>(W(X),X.buttons||(this._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.removeEventListener("mousemove",q.mousedrag)),this.cancel(X)),wheel:X=>(W(X),this.cancel(X,!0)),mousedrag:X=>{X.buttons&&W(X)},mousemove:X=>{X.buttons||W(X)}};this.register(this.coreMouseService.onProtocolChange((X=>{X?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(X)),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&X?q.mousemove||(k.addEventListener("mousemove",$.mousemove),q.mousemove=$.mousemove):(k.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&X?q.wheel||(k.addEventListener("wheel",$.wheel,{passive:!1}),q.wheel=$.wheel):(k.removeEventListener("wheel",q.wheel),q.wheel=null),2&X?q.mouseup||(q.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&X?q.mousedrag||(q.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(k,"mousedown",(X=>{if(X.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(X))return W(X),q.mouseup&&this._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.addEventListener("mousemove",q.mousedrag),this.cancel(X)}))),this.register((0,d.addDisposableDomListener)(k,"wheel",(X=>{if(!q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(X)===!1)return!1;if(!this.buffer.hasScrollback){let J=this.viewport.getLinesScrolled(X);if(J===0)return;let ce=z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(X.deltaY<0?"A":"B"),de="";for(let me=0;me<Math.abs(J);me++)de+=ce;return this.coreService.triggerDataEvent(de,!0),this.cancel(X,!0)}return this.viewport.handleWheel(X)?this.cancel(X):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(k,"touchstart",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(X),this.cancel(X)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(k,"touchmove",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(X)?void 0:this.cancel(X)}),{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,W=0){W===1?(super.scrollLines(H,k,W),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,W){this._selectionService.setSelection(H,k,W)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(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 W=(0,I.evaluateKeyboardEvent)(H,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(H),W.type===3||W.type===2){let q=this.rows-1;return this.scrollLines(W.type===2?-q:q),this.cancel(H,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,H)||(W.cancel&&this.cancel(H,!0),!W.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):(W.key!==z.C0.ETX&&W.key!==z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||H.altKey||H.ctrlKey?this.cancel(H,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(H,k){let W=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"?W:W&&(!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(z.C0.ESC+"[I"):this.coreService.triggerDataEvent(z.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),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[4;${W};${k}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let q=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[6;${$};${q}t`)}}cancel(H,k){if(this.options.cancelEvents||k)return H.preventDefault(),H.stopPropagation(),!1}}s.Terminal=j},9924:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,a=1e3){this._renderCallback=o,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,a,d){this._rowCount=d,o=o!==void 0?o:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,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 _=l-this._lastRefreshMs,m=this._debounceThresholdMS-_;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 o=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,a)}}},1680:function(n,s,o){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let l=o(3656),_=o(4725),m=o(8460),y=o(844),p=o(2585),c=s.Viewport=class extends y.Disposable{constructor(u,h,f,v,S,g,x,w){super(),this._viewportElement=u,this._scrollArea=h,this._bufferService=f,this._optionsService=v,this._charSizeService=S,this._renderService=g,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(u){this._viewportElement.style.backgroundColor=u.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(u){if(u)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 u=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==u&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=u),this._refreshAnimationFrame=null}syncScrollArea(u=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(u);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(u)}_handleScroll(u){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 u=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(u*(this._smoothScrollState.target-this._smoothScrollState.origin)),u<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(u,h){let f=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&f<this._lastRecordedBufferHeight)||(u.cancelable&&u.preventDefault(),!1)}handleWheel(u){let h=this._getPixelsScrolled(u);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(u,h))}scrollLines(u){if(u!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let h=u*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:u,suppressScrollEvent:!1})}_getPixelsScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let h=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(u,h){let f,v="",S=[],g=h??this._bufferService.buffer.lines.length,x=this._bufferService.buffer.lines;for(let w=u;w<g;w++){let E=x.get(w);if(!E)continue;let P=x.get(w+1)?.isWrapped;if(v+=E.translateToString(!P),!P||w===x.length-1){let O=document.createElement("div");O.textContent=v,S.push(O),v.length>0&&(f=O),v=""}}return{bufferElements:S,cursorElement:f}}getLinesScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let h=this._applyScrollModifier(u.deltaY,u);return u.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):u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(u,h){let f=this._optionsService.rawOptions.fastScrollModifier;return f==="alt"&&h.altKey||f==="ctrl"&&h.ctrlKey||f==="shift"&&h.shiftKey?u*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:u*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(u){this._lastTouchY=u.touches[0].pageY}handleTouchMove(u){let h=this._lastTouchY-u.touches[0].pageY;return this._lastTouchY=u.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(u,h))}};s.Viewport=c=a([d(2,p.IBufferService),d(3,p.IOptionsService),d(4,_.ICharSizeService),d(5,_.IRenderService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],c)},3107:function(n,s,o){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let l=o(4725),_=o(844),m=o(2585),y=s.BufferDecorationRenderer=class extends _.Disposable{constructor(p,c,u,h,f){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=u,this._decorationService=h,this._renderService=f,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((v=>this._removeDecoration(v)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),c.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let u=p.options.x??0;return u&&u>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(p,c),c}_refreshStyle(p){let c=p.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let u=this._decorationElements.get(p);u||(u=this._createElement(p),p.element=u,this._decorationElements.set(p,u),this._container.appendChild(u),p.onDispose((()=>{this._decorationElements.delete(p),u.remove()}))),u.style.top=c*this._renderService.dimensions.css.cell.height+"px",u.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(u)}}_refreshXPosition(p,c=p.element){if(!c)return;let u=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};s.BufferDecorationRenderer=y=a([d(1,m.IBufferService),d(2,l.ICoreBrowserService),d(3,m.IDecorationService),d(4,l.IRenderService)],y)},5871:(n,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(o){if(o.options.overviewRulerOptions){for(let a of this._zones)if(a.color===o.options.overviewRulerOptions.color&&a.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,o.marker.line))return;if(this._lineAdjacentToZone(a,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(a,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,a){return a>=o.startBufferLine&&a<=o.endBufferLine}_lineAdjacentToZone(o,a,d){return a>=o.startBufferLine-this._linePadding[d||"full"]&&a<=o.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(o,a){o.startBufferLine=Math.min(o.startBufferLine,a),o.endBufferLine=Math.max(o.endBufferLine,a)}}},5744:function(n,s,o){var a=this&&this.__decorate||function(f,v,S,g){var x,w=arguments.length,E=w<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,v,S,g);else for(var P=f.length-1;P>=0;P--)(x=f[P])&&(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},d=this&&this.__param||function(f,v){return function(S,g){v(S,g,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let l=o(5871),_=o(4725),m=o(844),y=o(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},h=s.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(f,v,S,g,x,w,E){super(),this._viewportElement=f,this._screenElement=v,this._bufferService=S,this._decorationService=g,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 P=this._canvas.getContext("2d");if(!P)throw new Error("Ctx cannot be null");this._ctx=P,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,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 f=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=f,c.center=v,c.right=f,this._refreshDrawHeightConstants(),u.full=0,u.left=0,u.center=c.left,u.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let f=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(f,12),6)*this._coreBrowserService.dpr);p.left=v,p.center=v,p.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;let f=this._colorZoneStore.zones;for(let v of f)v.position!=="full"&&this._renderColorZone(v);for(let v of f)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(f){this._ctx.fillStyle=f.color,this._ctx.fillRect(u[f.position||"full"],Math.round((this._canvas.height-1)*(f.startBufferLine/this._bufferService.buffers.active.lines.length)-p[f.position||"full"]/2),c[f.position||"full"],Math.round((this._canvas.height-1)*((f.endBufferLine-f.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[f.position||"full"]))}_queueRefresh(f,v){this._shouldUpdateDimensions=f||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([d(2,y.IBufferService),d(3,y.IDecorationService),d(4,_.IRenderService),d(5,y.IOptionsService),d(6,_.ICoreBrowserService)],h)},2950:function(n,s,o){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let l=o(4725),_=o(2585),m=o(2584),y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,u,h,f,v){this._textarea=p,this._compositionView=c,this._bufferService=u,this._optionsService=h,this._coreService=f,this._renderService=v,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let u;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,u=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),u.length>0&&this._coreService.triggerDataEvent(u,!0)}}),0)}else{this._isSendingComposition=!1;let c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,u=c.replace(p,"");this._dataAlreadySent=u,c.length>p.length?this._coreService.triggerDataEvent(u,!0):c.length<p.length?this._coreService.triggerDataEvent(`${m.C0.DEL}`,!0):c.length===p.length&&c!==p&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),u=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,f=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=f+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=u+"px",this._compositionView.style.lineHeight=u+"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=f+"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"}p||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=y=a([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,_.ICoreService),d(5,l.IRenderService)],y)},9806:(n,s)=>{function o(a,d,l){let _=l.getBoundingClientRect(),m=a.getComputedStyle(l),y=parseInt(m.getPropertyValue("padding-left")),p=parseInt(m.getPropertyValue("padding-top"));return[d.clientX-_.left-y,d.clientY-_.top-p]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(a,d,l,_,m,y,p,c,u){if(!y)return;let h=o(a,d,l);return h?(h[0]=Math.ceil((h[0]+(u?p/2:0))/p),h[1]=Math.ceil(h[1]/c),h[0]=Math.min(Math.max(h[0],1),_+(u?1:0)),h[1]=Math.min(Math.max(h[1],1),m),h):void 0}},9504:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let a=o(2584);function d(c,u,h,f){let v=c-l(c,h),S=u-l(u,h),g=Math.abs(v-S)-(function(x,w,E){let P=0,O=x-l(x,E),F=w-l(w,E);for(let A=0;A<Math.abs(O-F);A++){let V=_(x,w)==="A"?-1:1;E.buffer.lines.get(O+V*A)?.isWrapped&&P++}return P})(c,u,h);return p(g,y(_(c,u),f))}function l(c,u){let h=0,f=u.buffer.lines.get(c),v=f?.isWrapped;for(;v&&c>=0&&c<u.rows;)h++,f=u.buffer.lines.get(--c),v=f?.isWrapped;return h}function _(c,u){return c>u?"A":"B"}function m(c,u,h,f,v,S){let g=c,x=u,w="";for(;g!==h||x!==f;)g+=v?1:-1,v&&g>S.cols-1?(w+=S.buffer.translateBufferLineToString(x,!1,c,g),g=0,c=0,x++):!v&&g<0&&(w+=S.buffer.translateBufferLineToString(x,!1,0,c+1),g=S.cols-1,c=g,x--);return w+S.buffer.translateBufferLineToString(x,!1,c,g)}function y(c,u){let h=u?"O":"[";return a.C0.ESC+h+c}function p(c,u){c=Math.floor(c);let h="";for(let f=0;f<c;f++)h+=u;return h}s.moveToCellSequence=function(c,u,h,f){let v=h.buffer.x,S=h.buffer.y;if(!h.buffer.hasScrollback)return(function(w,E,P,O,F,A){return d(E,O,F,A).length===0?"":p(m(w,E,w,E-l(E,F),!1,F).length,y("D",A))})(v,S,0,u,h,f)+d(S,u,h,f)+(function(w,E,P,O,F,A){let V;V=d(E,O,F,A).length>0?O-l(O,F):E;let B=O,R=(function(z,I,C,L,T,D){let N;return N=d(C,L,T,D).length>0?L-l(L,T):I,z<C&&N<=L||z>=C&&N<L?"C":"D"})(w,E,P,O,F,A);return p(m(w,V,P,B,R==="C",F).length,y(R,A))})(v,S,c,u,h,f);let g;if(S===u)return g=v>c?"D":"C",p(Math.abs(v-c),y(g,f));g=S>u?"D":"C";let x=Math.abs(S-u);return p((function(w,E){return E.cols-w})(S>u?c:v,h)+(x-1)*h.cols+1+((S>u?v:c)-1),y(g,f))}},1296:function(n,s,o){var a=this&&this.__decorate||function(A,V,B,R){var z,I=arguments.length,C=I<3?V:R===null?R=Object.getOwnPropertyDescriptor(V,B):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(A,V,B,R);else for(var L=A.length-1;L>=0;L--)(z=A[L])&&(C=(I<3?z(C):I>3?z(V,B,C):z(V,B))||C);return I>3&&C&&Object.defineProperty(V,B,C),C},d=this&&this.__param||function(A,V){return function(B,R){V(B,R,A)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let l=o(3787),_=o(2550),m=o(2223),y=o(6171),p=o(6052),c=o(4725),u=o(8055),h=o(8460),f=o(844),v=o(2585),S="xterm-dom-renderer-owner-",g="xterm-rows",x="xterm-fg-",w="xterm-bg-",E="xterm-focus",P="xterm-selection",O=1,F=s.DomRenderer=class extends f.Disposable{constructor(A,V,B,R,z,I,C,L,T,D,N,G,j){super(),this._terminal=A,this._document=V,this._element=B,this._screenElement=R,this._viewportElement=z,this._helperContainer=I,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=N,this._coreBrowserService=G,this._themeService=j,this._terminalClass=O++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new h.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(P),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,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,f.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 _.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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let V=`${this._terminalSelector} .${g} 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} .${g} { 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} .${g} .xterm-dim { color: ${u.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 B=`blink_underline_${this._terminalClass}`,R=`blink_bar_${this._terminalClass}`,z=`blink_block_${this._terminalClass}`;V+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,V+=`@keyframes ${R} { 50% { box-shadow: none; }}`,V+=`@keyframes ${z} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,V+=`${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${R} 1s step-end infinite;}${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,V+=`${this._terminalSelector} .${P} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${P} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${P} 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: ${u.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${w}${I} { background-color: ${C.css}; }`;V+=`${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR} { color: ${u.color.opaque(A.background).css}; }${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${u.color.multiplyOpacity(u.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 B=this._rowElements.length;B<=V;B++){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,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,V,B),this.renderRows(0,this._bufferService.rows-1),!A||!V)return;this._selectionRenderModel.update(this._terminal,A,V,B);let R=this._selectionRenderModel.viewportStartRow,z=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(B){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===z?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=z===C?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,G))}}this._selectionContainer.appendChild(L)}_createSelectionElement(A,V,B,R=1){let z=this._document.createElement("div"),I=V*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(B-V);return I+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-I),z.style.height=R*this.dimensions.css.cell.height+"px",z.style.top=A*this.dimensions.css.cell.height+"px",z.style.left=`${I}px`,z.style.width=`${C}px`,z}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let A of this._rowElements)A.replaceChildren()}renderRows(A,V){let B=this._bufferService.buffer,R=B.ybase+B.y,z=Math.min(B.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+B.ydisp,N=this._rowElements[T],G=B.lines.get(D);if(!N||!G)break;N.replaceChildren(...this._rowFactory.createRow(G,D,D===R,C,L,z,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,B,R,z,I){B<0&&(A=0),R<0&&(V=0);let C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),R=Math.max(Math.min(R,C),0),z=Math.min(z,this._bufferService.cols);let L=this._bufferService.buffer,T=L.ybase+L.y,D=Math.min(L.x,z-1),N=this._optionsService.rawOptions.cursorBlink,G=this._optionsService.rawOptions.cursorStyle,j=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=B;Y<=R;++Y){let H=Y+L.ydisp,k=this._rowElements[Y],W=L.lines.get(H);if(!k||!W)break;k.replaceChildren(...this._rowFactory.createRow(W,H,H===T,G,j,D,N,this.dimensions.css.cell.width,this._widthCache,I?Y===B?A:0:-1,I?(Y===R?V:z)-1:-1))}}};s.DomRenderer=F=a([d(7,v.IInstantiationService),d(8,c.ICharSizeService),d(9,v.IOptionsService),d(10,v.IBufferService),d(11,c.ICoreBrowserService),d(12,c.IThemeService)],F)},3787:function(n,s,o){var a=this&&this.__decorate||function(g,x,w,E){var P,O=arguments.length,F=O<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(g,x,w,E);else for(var A=g.length-1;A>=0;A--)(P=g[A])&&(F=(O<3?P(F):O>3?P(x,w,F):P(x,w))||F);return O>3&&F&&Object.defineProperty(x,w,F),F},d=this&&this.__param||function(g,x){return function(w,E){x(w,E,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let l=o(2223),_=o(643),m=o(511),y=o(2585),p=o(8055),c=o(4725),u=o(4269),h=o(6171),f=o(3734),v=s.DomRendererRowFactory=class{constructor(g,x,w,E,P,O,F){this._document=g,this._characterJoinerService=x,this._optionsService=w,this._coreBrowserService=E,this._coreService=P,this._decorationService=O,this._themeService=F,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(g,x,w){this._selectionStart=g,this._selectionEnd=x,this._columnSelectMode=w}createRow(g,x,w,E,P,O,F,A,V,B,R){let z=[],I=this._characterJoinerService.getJoinedCharacters(x),C=this._themeService.colors,L,T=g.getNoBgTrimmedLength();w&&T<O+1&&(T=O+1);let D=0,N="",G=0,j=0,Y=0,H=!1,k=0,W=!1,q=0,$=[],X=B!==-1&&R!==-1;for(let J=0;J<T;J++){g.loadCell(J,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let de=!1,me=J,te=this._workCell;if(I.length>0&&J===I[0][0]){de=!0;let he=I.shift();te=new u.JoinedCellData(this._workCell,g.translateToString(!0,he[0],he[1]),he[1]-he[0]),me=he[1]-1,ce=te.getWidth()}let Be=this._isCellInSelection(J,x),fe=w&&J===O,Oe=X&&J>=B&&J<=R,We=!1;this._decorationService.forEachDecorationAtCell(J,x,void 0,(he=>{We=!0}));let ke=te.getChars()||_.WHITESPACE_CELL_CHAR;if(ke===" "&&(te.isUnderline()||te.isOverline())&&(ke="\xA0"),q=ce*A-V.get(ke,te.isBold(),te.isItalic()),L){if(D&&(Be&&W||!Be&&!W&&te.bg===G)&&(Be&&W&&C.selectionForeground||te.fg===j)&&te.extended.ext===Y&&Oe===H&&q===k&&!fe&&!de&&!We){te.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=ke,D++;continue}D&&(L.textContent=N),L=this._document.createElement("span"),D=0,N=""}else L=this._document.createElement("span");if(G=te.bg,j=te.fg,Y=te.extended.ext,H=Oe,k=q,W=Be,de&&O>=J&&O<=me&&(O=J),!this._coreService.isCursorHidden&&fe&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&$.push("xterm-cursor-blink"),$.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(P)switch(P){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline")}}if(te.isBold()&&$.push("xterm-bold"),te.isItalic()&&$.push("xterm-italic"),te.isDim()&&$.push("xterm-dim"),N=te.isInvisible()?_.WHITESPACE_CELL_CHAR:te.getChars()||_.WHITESPACE_CELL_CHAR,te.isUnderline()&&($.push(`xterm-underline-${te.extended.underlineStyle}`),N===" "&&(N="\xA0"),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let he=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&he<8&&(he+=8),L.style.textDecorationColor=C.ansi[he].css}te.isOverline()&&($.push("xterm-overline"),N===" "&&(N="\xA0")),te.isStrikethrough()&&$.push("xterm-strikethrough"),Oe&&(L.style.textDecoration="underline");let ee=te.getFgColor(),pe=te.getFgColorMode(),ve=te.getBgColor(),Z=te.getBgColorMode(),re=!!te.isInverse();if(re){let he=ee;ee=ve,ve=he;let ye=pe;pe=Z,Z=ye}let ne,oe,ie,ae=!1;switch(this._decorationService.forEachDecorationAtCell(J,x,void 0,(he=>{he.options.layer!=="top"&&ae||(he.backgroundColorRGB&&(Z=50331648,ve=he.backgroundColorRGB.rgba>>8&16777215,ne=he.backgroundColorRGB),he.foregroundColorRGB&&(pe=50331648,ee=he.foregroundColorRGB.rgba>>8&16777215,oe=he.foregroundColorRGB),ae=he.options.layer==="top")})),!ae&&Be&&(ne=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ve=ne.rgba>>8&16777215,Z=50331648,ae=!0,C.selectionForeground&&(pe=50331648,ee=C.selectionForeground.rgba>>8&16777215,oe=C.selectionForeground)),ae&&$.push("xterm-decoration-top"),Z){case 16777216:case 33554432:ie=C.ansi[ve],$.push(`xterm-bg-${ve}`);break;case 50331648:ie=p.channels.toColor(ve>>16,ve>>8&255,255&ve),this._addStyle(L,`background-color:#${S((ve>>>0).toString(16),"0",6)}`);break;default:re?(ie=C.foreground,$.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):ie=C.background}switch(ne||te.isDim()&&(ne=p.color.multiplyOpacity(ie,.5)),pe){case 16777216:case 33554432:te.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(L,ie,C.ansi[ee],te,ne,void 0)||$.push(`xterm-fg-${ee}`);break;case 50331648:let he=p.channels.toColor(ee>>16&255,ee>>8&255,255&ee);this._applyMinimumContrast(L,ie,he,te,ne,oe)||this._addStyle(L,`color:#${S(ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,ie,C.foreground,te,ne,oe)||re&&$.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}$.length&&(L.className=$.join(" "),$.length=0),fe||de||We?L.textContent=N:D++,q!==this.defaultSpacing&&(L.style.letterSpacing=`${q}px`),z.push(L),J=me}return L&&D&&(L.textContent=N),z}_applyMinimumContrast(g,x,w,E,P,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.treatGlyphAsBackgroundColor)(E.getCode()))return!1;let F=this._getContrastCache(E),A;if(P||O||(A=F.getColor(x.rgba,w.rgba)),A===void 0){let V=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);A=p.color.ensureContrastRatio(P||x,O||w,V),F.setColor((P||x).rgba,(O||w).rgba,A??null)}return!!A&&(this._addStyle(g,`color:${A.css}`),!0)}_getContrastCache(g){return g.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(g,x){g.setAttribute("style",`${g.getAttribute("style")||""}${x};`)}_isCellInSelection(g,x){let w=this._selectionStart,E=this._selectionEnd;return!(!w||!E)&&(this._columnSelectMode?w[0]<=E[0]?g>=w[0]&&x>=w[1]&&g<E[0]&&x<=E[1]:g<w[0]&&x>=w[1]&&g>=E[0]&&x<=E[1]:x>w[1]&&x<E[1]||w[1]===E[1]&&x===w[1]&&g>=w[0]&&g<E[0]||w[1]<E[1]&&x===E[1]&&g<E[0]||w[1]<E[1]&&x===w[1]&&g>=w[0])}};function S(g,x,w){for(;g.length<w;)g=x+g;return g}s.DomRendererRowFactory=v=a([d(1,c.ICharacterJoinerService),d(2,y.IOptionsService),d(3,c.ICoreBrowserService),d(4,y.ICoreService),d(5,y.IDecorationService),d(6,c.IThemeService)],v)},2550:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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 d=o.createElement("span");d.classList.add("xterm-char-measure-element");let l=o.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let m=o.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[d,l,_,m],this._container.appendChild(d),this._container.appendChild(l),this._container.appendChild(_),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(o,a,d,l){o===this._font&&a===this._fontSize&&d===this._weight&&l===this._weightBold||(this._font=o,this._fontSize=a,this._weight=d,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(o,a,d){let l=0;if(!a&&!d&&o.length===1&&(l=o.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let y=this._measure(o,0);return y>0&&(this._flat[l]=y),y}let _=o;a&&(_+="B"),d&&(_+="I");let m=this._holey.get(_);if(m===void 0){let y=0;a&&(y|=1),d&&(y|=2),m=this._measure(o,y),m>0&&this._holey.set(_,m)}return m}_measure(o,a){let d=this._measureElements[a];return d.textContent=o.repeat(32),d.offsetWidth/32}}},2223:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let a=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(n,s)=>{function o(d){return 57508<=d&&d<=57558}function a(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=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(d){if(!d)throw new Error("value must not be falsy");return d},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},s.isEmoji=a,s.allowRescaling=function(d,l,_,m){return l===1&&_>Math.ceil(1.5*m)&&d!==void 0&&d>255&&!a(d)&&!o(d)&&!(function(y){return 57344<=y&&y<=63743})(d)},s.treatGlyphAsBackgroundColor=function(d){return o(d)||(function(l){return 9472<=l&&l<=9631})(d)},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(d,l,_=0){return(d-(2*Math.round(l)-_))%(2*Math.round(l))}},6052:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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(d,l,_,m=!1){if(this.selectionStart=l,this.selectionEnd=_,!l||!_||l[0]===_[0]&&l[1]===_[1])return void this.clear();let y=d.buffers.active.ydisp,p=l[1]-y,c=_[1]-y,u=Math.max(p,0),h=Math.min(c,d.rows-1);u>=d.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=u,this.viewportCappedEndRow=h,this.startCol=l[0],this.endCol=_[0])}isCellSelected(d,l,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&_>=this.viewportCappedStartRow&&l<this.endCol&&_<=this.viewportCappedEndRow:l<this.startCol&&_>=this.viewportCappedStartRow&&l>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&l>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,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 o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let o=this.selectionStart,a=this.selectionEnd;return!(!o||!a)&&(o[1]>a[1]||o[1]===a[1]&&o[0]>a[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(n,s,o){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,w=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(w=(x<3?g(w):x>3?g(f,v,w):g(f,v))||w);return x>3&&w&&Object.defineProperty(f,v,w),w},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let l=o(2585),_=o(8460),m=o(844),y=s.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(h,f,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new u(this._optionsService))}catch{this._measureStrategy=this.register(new c(h,f,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([d(2,l.IOptionsService)],y);class p extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(f,v){f!==void 0&&f>0&&v!==void 0&&v>0&&(this._result.width=f,this._result.height=v)}}class c extends p{constructor(f,v,S){super(),this._document=f,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 u extends p{constructor(f){super(),this._optionsService=f,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 f=this._ctx.measureText("W");return this._validateAndSet(f.width,f.fontBoundingBoxAscent+f.fontBoundingBoxDescent),this._result}}},4269:function(n,s,o){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let l=o(3734),_=o(643),m=o(511),y=o(2585);class p extends l.AttributeData{constructor(h,f,v){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=f,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=p;let c=s.CharacterJoinerService=class La{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(h){let f={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(f),f.id}deregister(h){for(let f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===h)return this._characterJoiners.splice(f,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];let f=this._bufferService.buffer.lines.get(h);if(!f||f.length===0)return[];let v=[],S=f.translateToString(!0),g=0,x=0,w=0,E=f.getFg(0),P=f.getBg(0);for(let O=0;O<f.getTrimmedLength();O++)if(f.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==P){if(O-g>1){let F=this._getJoinedRanges(S,w,x,f,g);for(let A=0;A<F.length;A++)v.push(F[A])}g=O,w=x,E=this._workCell.fg,P=this._workCell.bg}x+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-g>1){let O=this._getJoinedRanges(S,w,x,f,g);for(let F=0;F<O.length;F++)v.push(O[F])}return v}_getJoinedRanges(h,f,v,S,g){let x=h.substring(f,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 P=this._characterJoiners[E].handler(x);for(let O=0;O<P.length;O++)La._mergeRanges(w,P[O])}catch(P){console.error(P)}return this._stringRangesToCellRanges(w,S,g),w}_stringRangesToCellRanges(h,f,v){let S=0,g=!1,x=0,w=h[S];if(w){for(let E=v;E<this._bufferService.cols;E++){let P=f.getWidth(E),O=f.getString(E).length||_.WHITESPACE_CELL_CHAR.length;if(P!==0){if(!g&&w[0]<=x&&(w[0]=E,g=!0),w[1]<=x){if(w[1]=E,w=h[++S],!w)break;w[0]<=x?(w[0]=E,g=!0):g=!1}x+=O}}w&&(w[1]=this._bufferService.cols)}}static _mergeRanges(h,f){let v=!1;for(let S=0;S<h.length;S++){let g=h[S];if(v){if(f[1]<=g[0])return h[S-1][1]=f[1],h;if(f[1]<=g[1])return h[S-1][1]=Math.max(f[1],g[1]),h.splice(S,1),h;h.splice(S,1),S--}else{if(f[1]<=g[0])return h.splice(S,0,f),h;if(f[1]<=g[1])return g[0]=Math.min(f[0],g[0]),h;f[0]<g[1]&&(g[0]=Math.min(f[0],g[0]),v=!0)}}return v?h[h.length-1][1]=f[1]:h.push(f),h}};s.CharacterJoinerService=c=a([d(0,y.IBufferService)],c)},5114:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let a=o(844),d=o(8460),l=o(3656);class _ extends a.Disposable{constructor(p,c,u){super(),this._textarea=p,this._window=c,this.mainDocument=u,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((h=>this._screenDprMonitor.setWindow(h)))),this.register((0,d.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(p){this._window!==p&&(this._window=p,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}s.CoreBrowserService=_;class m extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,a.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,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:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let a=o(844);class d extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let m=this.linkProviders.indexOf(_);m!==-1&&this.linkProviders.splice(m,1)}}}}s.LinkProviderService=d},8934:function(n,s,o){var a=this&&this.__decorate||function(y,p,c,u){var h,f=arguments.length,v=f<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,c):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(y,p,c,u);else for(var S=y.length-1;S>=0;S--)(h=y[S])&&(v=(f<3?h(v):f>3?h(p,c,v):h(p,c))||v);return f>3&&v&&Object.defineProperty(p,c,v),v},d=this&&this.__param||function(y,p){return function(c,u){p(c,u,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let l=o(4725),_=o(9806),m=s.MouseService=class{constructor(y,p){this._renderService=y,this._charSizeService=p}getCoords(y,p,c,u,h){return(0,_.getCoords)(window,y,p,c,u,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(y,p){let c=(0,_.getCoordsRelativeToElement)(window,y,p);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};s.MouseService=m=a([d(0,l.IRenderService),d(1,l.ICharSizeService)],m)},3230:function(n,s,o){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,w=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(w=(x<3?g(w):x>3?g(f,v,w):g(f,v))||w);return x>3&&w&&Object.defineProperty(f,v,w),w},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let l=o(6193),_=o(4725),m=o(8460),y=o(844),p=o(7226),c=o(2585),u=s.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(h,f,v,S,g,x,w,E){super(),this._rowCount=h,this._charSizeService=S,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new p.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(((P,O)=>this._renderRows(P,O)),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(g.onDecorationRegistered((()=>this._fullRefresh()))),this.register(g.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,f),this.register(w.onWindowChange((P=>this._registerIntersectionObserver(P,f))))}_registerIntersectionObserver(h,f){if("IntersectionObserver"in h){let v=new h.IntersectionObserver((S=>this._handleIntersectionChange(S[S.length-1])),{threshold:0});v.observe(f),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,f,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(h,f,this._rowCount))}_renderRows(h,f){this._renderer.value&&(h=Math.min(h,this._rowCount-1),f=Math.min(f,this._rowCount-1),this._renderer.value.renderRows(h,f),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:f}),this._onRender.fire({start:h,end:f}),this._isNextRenderRedrawOnly=!0)}resize(h,f){this._rowCount=f,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((f=>this.refreshRows(f.start,f.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,f){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(h,f))):this._renderer.value.handleResize(h,f),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(h,f,v){this._selectionState.start=h,this._selectionState.end=f,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(h,f,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=u=a([d(2,c.IOptionsService),d(3,_.ICharSizeService),d(4,c.IDecorationService),d(5,c.IBufferService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],u)},9312:function(n,s,o){var a=this&&this.__decorate||function(w,E,P,O){var F,A=arguments.length,V=A<3?E:O===null?O=Object.getOwnPropertyDescriptor(E,P):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(w,E,P,O);else for(var B=w.length-1;B>=0;B--)(F=w[B])&&(V=(A<3?F(V):A>3?F(E,P,V):F(E,P))||V);return A>3&&V&&Object.defineProperty(E,P,V),V},d=this&&this.__param||function(w,E){return function(P,O){E(P,O,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let l=o(9806),_=o(9504),m=o(456),y=o(4725),p=o(8460),c=o(844),u=o(6114),h=o(4841),f=o(511),v=o(2585),S="\xA0",g=new RegExp(S,"g"),x=s.SelectionService=class extends c.Disposable{constructor(w,E,P,O,F,A,V,B,R){super(),this._element=w,this._screenElement=E,this._linkifier=P,this._bufferService=O,this._coreService=F,this._mouseService=A,this._optionsService=V,this._renderService=B,this._coreBrowserService=R,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=z=>this._handleMouseMove(z),this._mouseUpListener=z=>this._handleMouseUp(z),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((z=>this._handleTrim(z))),this.register(this._bufferService.buffers.onBufferActivate((z=>this._handleBufferActivate(z)))),this.enable(),this._model=new 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 P=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(w[0]===E[0])return"";let F=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 B=P.translateBufferLineToString(V,!0,F,A);O.push(B)}}else{let F=w[1]===E[1]?E[0]:void 0;O.push(P.translateBufferLineToString(w[1],!0,w[0],F));for(let A=w[1]+1;A<=E[1]-1;A++){let V=P.lines.get(A),B=P.translateBufferLineToString(A,!0);V?.isWrapped?O[O.length-1]+=B:O.push(B)}if(w[1]!==E[1]){let A=P.lines.get(E[1]),V=P.translateBufferLineToString(E[1],!0,0,E[0]);A&&A.isWrapped?O[O.length-1]+=V:O.push(V)}}return O.map((F=>F.replace(g," "))).join(u.isWindows?`\r
6
6
  `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(b){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),u.isLinux&&b&&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(b){let E=this._getMouseBufferCoords(b),P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(P&&O&&E)&&this._areCoordsInSelection(E,P,O)}isCellInSelection(b,E){let P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!P||!O)&&this._areCoordsInSelection([b,E],P,O)}_areCoordsInSelection(b,E,P){return b[1]>E[1]&&b[1]<P[1]||E[1]===P[1]&&b[1]===E[1]&&b[0]>=E[0]&&b[0]<P[0]||E[1]<P[1]&&b[1]===P[1]&&b[0]<P[0]||E[1]<P[1]&&b[1]===E[1]&&b[0]>=E[0]}_selectWordAtCursor(b,E){let P=this._linkifier.currentLink?.link?.range;if(P)return this._model.selectionStart=[P.start.x-1,P.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(P,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let O=this._getMouseBufferCoords(b);return!!O&&(this._selectWordAt(O,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(b,E){this._model.clearSelection(),b=Math.max(b,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,b],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(b){this._model.handleTrim(b)&&this.refresh()}_getMouseBufferCoords(b){let E=this._mouseService.getCoords(b,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(b){let E=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,b,this._screenElement)[1],P=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=P?0:(E>P&&(E-=P),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(b){return u.isMac?b.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:b.shiftKey}handleMouseDown(b){if(this._mouseDownTimeStamp=b.timeStamp,(b.button!==2||!this.hasSelection)&&b.button===0){if(!this._enabled){if(!this.shouldForceSelection(b))return;b.stopPropagation()}b.preventDefault(),this._dragScrollAmount=0,this._enabled&&b.shiftKey?this._handleIncrementalClick(b):b.detail===1?this._handleSingleClick(b):b.detail===2?this._handleDoubleClick(b):b.detail===3&&this._handleTripleClick(b),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(b){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(b))}_handleSingleClick(b){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(b)?3:0,this._model.selectionStart=this._getMouseBufferCoords(b),!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(b){this._selectWordAtCursor(b,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(b){let E=this._getMouseBufferCoords(b);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(b){return b.altKey&&!(u.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(b){if(b.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(b),!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(b),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let P=this._bufferService.buffer;if(this._model.selectionEnd[1]<P.lines.length){let O=P.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}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 b=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(b.ydisp+this._bufferService.rows,b.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=b.ydisp),this.refresh()}}_handleMouseUp(b){let E=b.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&b.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let P=this._mouseService.getCoords(b,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(P&&P[0]!==void 0&&P[1]!==void 0){let O=(0,_.moveToCellSequence)(P[0]-1,P[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let b=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,P=!(!b||!E||b[0]===E[0]&&b[1]===E[1]);P?b&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&b[0]===this._oldSelectionStart[0]&&b[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(b,E,P)):this._oldHasSelection&&this._fireOnSelectionChange(b,E,P)}_fireOnSelectionChange(b,E,P){this._oldSelectionStart=b,this._oldSelectionEnd=E,this._oldHasSelection=P,this._onSelectionChange.fire()}_handleBufferActivate(b){this.clearSelection(),this._trimListener.dispose(),this._trimListener=b.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(b,E){let P=E;for(let O=0;E>=O;O++){let F=b.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?P--:F>1&&E!==O&&(P+=F-1)}return P}setSelection(b,E,P){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[b,E],this._model.selectionStartLength=P,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(b){this._isClickInSelection(b)||(this._selectWordAtCursor(b,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(b,E,P=!0,O=!0){if(b[0]>=this._bufferService.cols)return;let F=this._bufferService.buffer,A=F.lines.get(b[1]);if(!A)return;let V=F.translateBufferLineToString(b[1],!1),B=this._convertViewportColToCharacterIndex(A,b[0]),M=B,U=b[0]-B,I=0,C=0,L=0,T=0;if(V.charAt(B)===" "){for(;B>0&&V.charAt(B-1)===" ";)B--;for(;M<V.length&&V.charAt(M+1)===" ";)M++}else{let G=b[0],$=b[0];A.getWidth(G)===0&&(I++,G--),A.getWidth($)===2&&(C++,$++);let Y=A.getString($).length;for(Y>1&&(T+=Y-1,M+=Y-1);G>0&&B>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,B-=H-1),B--,G--}for(;$<A.length&&M+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,M+=H-1),M++,$++}}M++;let D=B+U-I+L,N=Math.min(this._bufferService.cols,M-B+I+C-L-T);if(E||V.slice(B,M).trim()!==""){if(P&&D===0&&A.getCodePoint(0)!==32){let G=F.lines.get(b[1]-1);if(G&&A.isWrapped&&G.getCodePoint(this._bufferService.cols-1)!==32){let $=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if($){let Y=this._bufferService.cols-$.start;D-=Y,N+=Y}}}if(O&&D+N===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let G=F.lines.get(b[1]+1);if(G?.isWrapped&&G.getCodePoint(0)!==32){let $=this._getWordAt([0,b[1]+1],!1,!1,!0);$&&(N+=$.length)}}return{start:D,length:N}}}_selectWordAt(b,E){let P=this._getWordAt(b,E);if(P){for(;P.start<0;)P.start+=this._bufferService.cols,b[1]--;this._model.selectionStart=[P.start,b[1]],this._model.selectionStartLength=P.length}}_selectToWordAt(b){let E=this._getWordAt(b,!0);if(E){let P=b[1];for(;E.start<0;)E.start+=this._bufferService.cols,P--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,P++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,P]}}_isCharWordSeparator(b){return b.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(b.getChars())>=0}_selectLineAt(b){let E=this._bufferService.buffer.getWrappedRangeForLine(b),P={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(P,this._bufferService.cols)}};i.SelectionService=x=a([d(3,v.IBufferService),d(4,v.ICoreService),d(5,y.IMouseService),d(6,v.IOptionsService),d(7,y.IRenderService),d(8,y.ICoreBrowserService)],x)},4725:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;let a=n(8343);i.ICharSizeService=(0,a.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),i.IMouseService=(0,a.createDecorator)("MouseService"),i.IRenderService=(0,a.createDecorator)("RenderService"),i.ISelectionService=(0,a.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,a.createDecorator)("ThemeService"),i.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(o,i,n){var a=this&&this.__decorate||function(x,b,E,P){var O,F=arguments.length,A=F<3?b:P===null?P=Object.getOwnPropertyDescriptor(b,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,b,E,P);else for(var V=x.length-1;V>=0;V--)(O=x[V])&&(A=(F<3?O(A):F>3?O(b,E,A):O(b,E))||A);return F>3&&A&&Object.defineProperty(b,E,A),A},d=this&&this.__param||function(x,b){return function(E,P){b(E,P,x)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;let l=n(7239),_=n(8055),m=n(8460),y=n(844),p=n(2585),c=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),h=_.css.toColor("#ffffff"),f=_.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let x=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],b=[0,95,135,175,215,255];for(let E=0;E<216;E++){let P=b[E/36%6|0],O=b[E/6%6|0],F=b[E%6];x.push({css:_.channels.toCss(P,O,F),rgba:_.channels.toRgba(P,O,F)})}for(let E=0;E<24;E++){let P=8+10*E;x.push({css:_.channels.toCss(P,P,P),rgba:_.channels.toRgba(P,P,P)})}return x})());let S=i.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:u,cursor:h,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:_.color.blend(u,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:_.color.blend(u,v),ansi:i.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(x={}){let b=this._colors;if(b.foreground=g(x.foreground,c),b.background=g(x.background,u),b.cursor=g(x.cursor,h),b.cursorAccent=g(x.cursorAccent,f),b.selectionBackgroundTransparent=g(x.selectionBackground,v),b.selectionBackgroundOpaque=_.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=g(x.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=_.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=x.selectionForeground?g(x.selectionForeground,_.NULL_COLOR):void 0,b.selectionForeground===_.NULL_COLOR&&(b.selectionForeground=void 0),_.color.isOpaque(b.selectionBackgroundTransparent)&&(b.selectionBackgroundTransparent=_.color.opacity(b.selectionBackgroundTransparent,.3)),_.color.isOpaque(b.selectionInactiveBackgroundTransparent)&&(b.selectionInactiveBackgroundTransparent=_.color.opacity(b.selectionInactiveBackgroundTransparent,.3)),b.ansi=i.DEFAULT_ANSI_COLORS.slice(),b.ansi[0]=g(x.black,i.DEFAULT_ANSI_COLORS[0]),b.ansi[1]=g(x.red,i.DEFAULT_ANSI_COLORS[1]),b.ansi[2]=g(x.green,i.DEFAULT_ANSI_COLORS[2]),b.ansi[3]=g(x.yellow,i.DEFAULT_ANSI_COLORS[3]),b.ansi[4]=g(x.blue,i.DEFAULT_ANSI_COLORS[4]),b.ansi[5]=g(x.magenta,i.DEFAULT_ANSI_COLORS[5]),b.ansi[6]=g(x.cyan,i.DEFAULT_ANSI_COLORS[6]),b.ansi[7]=g(x.white,i.DEFAULT_ANSI_COLORS[7]),b.ansi[8]=g(x.brightBlack,i.DEFAULT_ANSI_COLORS[8]),b.ansi[9]=g(x.brightRed,i.DEFAULT_ANSI_COLORS[9]),b.ansi[10]=g(x.brightGreen,i.DEFAULT_ANSI_COLORS[10]),b.ansi[11]=g(x.brightYellow,i.DEFAULT_ANSI_COLORS[11]),b.ansi[12]=g(x.brightBlue,i.DEFAULT_ANSI_COLORS[12]),b.ansi[13]=g(x.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),b.ansi[14]=g(x.brightCyan,i.DEFAULT_ANSI_COLORS[14]),b.ansi[15]=g(x.brightWhite,i.DEFAULT_ANSI_COLORS[15]),x.extendedAnsi){let E=Math.min(b.ansi.length-16,x.extendedAnsi.length);for(let P=0;P<E;P++)b.ansi[P+16]=g(x.extendedAnsi[P],i.DEFAULT_ANSI_COLORS[P+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 b=0;b<this._restoreColors.ansi.length;++b)this._colors.ansi[b]=this._restoreColors.ansi[b]}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 g(x,b){if(x!==void 0)try{return _.css.toColor(x)}catch{}return b}i.ThemeService=S=a([d(0,p.IOptionsService)],S)},6349:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;let a=n(8460),d=n(844);class l extends d.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 p=0;p<Math.min(m,this.length);p++)y[p]=this._array[this._getCyclicIndex(p)];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,...p){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+p.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<p.length;c++)this._array[this._getCyclicIndex(m+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:m,amount:p.length}),this._length+p.length>this._maxLength){let c=this._length+p.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=p.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,p){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let u=y-1;u>=0;u--)this.set(m+u+p,this.get(m+u));let c=m+y+p-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<y;c++)this.set(m+c+p,this.get(m+c))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}i.CircularList=l},1439:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function n(a,d=5){if(typeof a!="object")return a;let l=Array.isArray(a)?[]:{};for(let _ in a)l[_]=d<=1?a[_]:a[_]&&n(a[_],d-1);return l}},8055:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let n=0,a=0,d=0,l=0;var _,m,y,p,c;function u(f){let v=f.toString(16);return v.length<2?"0"+v:v}function h(f,v){return f<v?(v+.05)/(f+.05):(f+.05)/(v+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(v,S,g,x){return x!==void 0?`#${u(v)}${u(S)}${u(g)}${u(x)}`:`#${u(v)}${u(S)}${u(g)}`},f.toRgba=function(v,S,g,x=255){return(v<<24|S<<16|g<<8|x)>>>0},f.toColor=function(v,S,g,x){return{css:f.toCss(v,S,g,x),rgba:f.toRgba(v,S,g,x)}}})(_||(i.channels=_={})),(function(f){function v(S,g){return l=Math.round(255*g),[n,a,d]=c.toChannels(S.rgba),{css:_.toCss(n,a,d,l),rgba:_.toRgba(n,a,d,l)}}f.blend=function(S,g){if(l=(255&g.rgba)/255,l===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,E=g.rgba>>8&255,P=S.rgba>>24&255,O=S.rgba>>16&255,F=S.rgba>>8&255;return n=P+Math.round((x-P)*l),a=O+Math.round((b-O)*l),d=F+Math.round((E-F)*l),{css:_.toCss(n,a,d),rgba:_.toRgba(n,a,d)}},f.isOpaque=function(S){return(255&S.rgba)==255},f.ensureContrastRatio=function(S,g,x){let b=c.ensureContrastRatio(S.rgba,g.rgba,x);if(b)return _.toColor(b>>24&255,b>>16&255,b>>8&255)},f.opaque=function(S){let g=(255|S.rgba)>>>0;return[n,a,d]=c.toChannels(g),{css:_.toCss(n,a,d),rgba:g}},f.opacity=v,f.multiplyOpacity=function(S,g){return l=255&S.rgba,v(S,l*g/255)},f.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(m||(i.color=m={})),(function(f){let v,S;try{let g=document.createElement("canvas");g.width=1,g.height=1;let x=g.getContext("2d",{willReadFrequently:!0});x&&(v=x,v.globalCompositeOperation="copy",S=v.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return n=parseInt(g.slice(1,2).repeat(2),16),a=parseInt(g.slice(2,3).repeat(2),16),d=parseInt(g.slice(3,4).repeat(2),16),_.toColor(n,a,d);case 5:return n=parseInt(g.slice(1,2).repeat(2),16),a=parseInt(g.slice(2,3).repeat(2),16),d=parseInt(g.slice(3,4).repeat(2),16),l=parseInt(g.slice(4,5).repeat(2),16),_.toColor(n,a,d,l);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}let x=g.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]),d=parseInt(x[3]),l=Math.round(255*(x[5]===void 0?1:parseFloat(x[5]))),_.toColor(n,a,d,l);if(!v||!S)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=S,v.fillStyle=g,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[n,a,d,l]=v.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(n,a,d,l),css:g}}})(y||(i.css=y={})),(function(f){function v(S,g,x){let b=S/255,E=g/255,P=x/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(P<=.03928?P/12.92:Math.pow((P+.055)/1.055,2.4))}f.relativeLuminance=function(S){return v(S>>16&255,S>>8&255,255&S)},f.relativeLuminance2=v})(p||(i.rgb=p={})),(function(f){function v(g,x,b){let E=g>>24&255,P=g>>16&255,O=g>>8&255,F=x>>24&255,A=x>>16&255,V=x>>8&255,B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));for(;B<b&&(F>0||A>0||V>0);)F-=Math.max(0,Math.ceil(.1*F)),A-=Math.max(0,Math.ceil(.1*A)),V-=Math.max(0,Math.ceil(.1*V)),B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));return(F<<24|A<<16|V<<8|255)>>>0}function S(g,x,b){let E=g>>24&255,P=g>>16&255,O=g>>8&255,F=x>>24&255,A=x>>16&255,V=x>>8&255,B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));for(;B<b&&(F<255||A<255||V<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),A=Math.min(255,A+Math.ceil(.1*(255-A))),V=Math.min(255,V+Math.ceil(.1*(255-V))),B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));return(F<<24|A<<16|V<<8|255)>>>0}f.blend=function(g,x){if(l=(255&x)/255,l===1)return x;let b=x>>24&255,E=x>>16&255,P=x>>8&255,O=g>>24&255,F=g>>16&255,A=g>>8&255;return n=O+Math.round((b-O)*l),a=F+Math.round((E-F)*l),d=A+Math.round((P-A)*l),_.toRgba(n,a,d)},f.ensureContrastRatio=function(g,x,b){let E=p.relativeLuminance(g>>8),P=p.relativeLuminance(x>>8);if(h(E,P)<b){if(P<E){let A=v(g,x,b),V=h(E,p.relativeLuminance(A>>8));if(V<b){let B=S(g,x,b);return V>h(E,p.relativeLuminance(B>>8))?A:B}return A}let O=S(g,x,b),F=h(E,p.relativeLuminance(O>>8));if(F<b){let A=v(g,x,b);return F>h(E,p.relativeLuminance(A>>8))?O:A}return O}},f.reduceLuminance=v,f.increaseLuminance=S,f.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]}})(c||(i.rgba=c={})),i.toPaddedHex=u,i.contrastRatio=h},8969:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;let a=n(844),d=n(2585),l=n(4348),_=n(7866),m=n(744),y=n(7302),p=n(6975),c=n(8460),u=n(1753),h=n(1480),f=n(7994),v=n(9282),S=n(5435),g=n(5981),x=n(2660),b=!1;class E extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((O=>{this._onScrollApi?.fire(O.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(O){for(let F in O)this.optionsService.options[F]=O[F]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new l.InstantiationService,this.optionsService=this.register(new y.OptionsService(O)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(u.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(x.OscLinkService),this._instantiationService.setService(d.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((F=>{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((F=>{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 g.WriteBuffer(((F,A)=>this._inputHandler.parse(F,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,F){this._writeBuffer.write(O,F)}writeSync(O,F){this._logService.logLevel<=d.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(O,F)}input(O,F=!0){this.coreService.triggerDataEvent(O,F)}resize(O,F){isNaN(O)||isNaN(F)||(O=Math.max(O,m.MINIMUM_COLS),F=Math.max(F,m.MINIMUM_ROWS),this._bufferService.resize(O,F))}scroll(O,F=!1){this._bufferService.scroll(O,F)}scrollLines(O,F,A){this._bufferService.scrollLines(O,F,A)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){let F=O-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(O,F){return this._inputHandler.registerEscHandler(O,F)}registerDcsHandler(O,F){return this._inputHandler.registerDcsHandler(O,F)}registerCsiHandler(O,F){return this._inputHandler.registerCsiHandler(O,F)}registerOscHandler(O,F){return this._inputHandler.registerOscHandler(O,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1,F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?O=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let O=[];O.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let F of O)F.dispose()}))}}}i.CoreTerminal=E},8460:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=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 d=[];for(let l=0;l<this._listeners.length;l++)d.push(this._listeners[l]);for(let l=0;l<d.length;l++)d[l].call(void 0,n,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(n,a){return n((d=>a.fire(d)))},i.runAndSubscribe=function(n,a){return a(void 0),n((d=>a(d)))}},5435:function(o,i,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},d=this&&this.__param||function(I,C){return function(L,T){C(L,T,I)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;let l=n(2584),_=n(7116),m=n(2015),y=n(844),p=n(482),c=n(8437),u=n(8460),h=n(643),f=n(511),v=n(3734),S=n(2585),g=n(1480),x=n(6242),b=n(6351),E=n(5941),P={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function F(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||(i.WindowsOptionsReportType=A={}));let V=0;class B 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 p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new f.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 u.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new u.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new u.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new u.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new u.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new u.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new u.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new u.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new u.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new u.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new u.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new M(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:W.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,W,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:W,data:q})})),this._parser.setDcsHandlerFallback(((k,W,q)=>{W==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:W,payload:q})})),this._parser.setPrintHandler(((k,W,q)=>this.print(k,W,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 _.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 b.DcsHandler(((k,W)=>this.requestStatusString(k,W))))}_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>O&&(G=this._parseStack.position+O)}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<O&&(this._parseBuffer=new Uint32Array(Math.min(C.length,O))),$||this._dirtyRowTracker.clearRange(),C.length>O)for(let k=G;k<C.length;k+=O){let W=k+O<C.length?k+O:C.length,q=typeof C=="string"?this._stringDecoder.decode(C.substring(k,W),this._parseBuffer):this._utf8Decoder.decode(C.subarray(k,W),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,W=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,W);let j=this._parser.precedingJoinState;for(let X=L;X<T;++X){if(D=C[X],D<127&&G){let _e=G[String.fromCharCode(D)];_e&&(D=_e.charCodeAt(0))}let J=this._unicodeService.charProperties(D,j);N=g.UnicodeService.extractWidth(J);let ae=g.UnicodeService.extractShouldJoin(J),he=ae?g.UnicodeService.extractWidth(j):0;if(j=J,$&&this._onA11yChar.fire((0,p.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-he>Y){if(H){let _e=q,Z=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(_e,Z,0,he,!1);Z<Y;)_e.setCellFromCodepoint(Z++,0,1,W)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(ae&&this._activeBuffer.x){let _e=q.getWidth(this._activeBuffer.x-1)?1:2;q.addCodepointToCell(this._activeBuffer.x-_e,D,N);for(let Z=N-he;--Z>=0;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(k&&(q.insertCells(this._activeBuffer.x,N-he,this._activeBuffer.getNullCell(W)),q.getWidth(Y-1)===2&&q.setCellFromCodepoint(Y-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,W)),q.setCellFromCodepoint(this._activeBuffer.x++,D,N,W),N>0)for(;--N;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=j,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,W),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=>!F(T.params[0],this._optionsService.rawOptions.windowOptions)||L(T)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new b.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=g.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 W=G.codePointAt(k)||0;$[Y++]=W,k+=W>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,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let 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}=$,W=this._optionsService.rawOptions,q=ae=>ae?1:2,j=C.params[0];return X=j,J=L?j===2?4:j===4?q(G.modes.insertMode):j===12?3:j===20?q(W.convertEol):0:j===1?q(T.applicationCursorKeys):j===3?W.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:j===6?q(T.origin):j===7?q(T.wraparound):j===8?3:j===9?q(D==="X10"):j===12?q(W.cursorBlink):j===25?q(!G.isCursorHidden):j===45?q(T.reverseWraparound):j===66?q(T.applicationKeypad):j===67?4:j===1e3?q(D==="VT200"):j===1002?q(D==="DRAG"):j===1003?q(D==="ANY"):j===1004?q(T.sendFocus):j===1005?4:j===1006?q(N==="SGR"):j===1015?4:j===1016?q(N==="SGR_PIXELS"):j===1048?1:j===47||j===1047||j===1049?q(H===k):j===2004?q(T.bracketedPasteMode):0,G.triggerDataEvent(`${l.C0.ESC}[${L?"":"?"}${X};${J}$y`),!0;var X,J}_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(!F(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(U(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]);U(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,_.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(P[C[0]],_.CHARSETS[C[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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 f.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)}}i.InputHandler=B;let M=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 U(I){return 0<=I&&I<256}M=a([d(0,S.IBufferService)],M)},844:(o,i)=>{function n(a){for(let d of a)d.dispose();a.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let d=this._disposables.indexOf(a);d!==-1&&this._disposables.splice(d,1)}},i.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}},i.toDisposable=function(a){return{dispose:a}},i.disposeArray=n,i.getDisposeArrayDisposable=function(a){return{dispose:()=>n(a)}}},1505:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(d,l,_){this._data[d]||(this._data[d]={}),this._data[d][l]=_}get(d,l){return this._data[d]?this._data[d][l]:void 0}clear(){this._data={}}}i.TwoKeyMap=n,i.FourKeyMap=class{constructor(){this._data=new n}set(a,d,l,_,m){this._data.get(a,d)||this._data.set(a,d,new n),this._data.get(a,d).set(l,_,m)}get(a,d,l,_){return this._data.get(a,d)?.get(l,_)}clear(){this._data.clear()}}},6114:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;let n=i.isNode?"node":navigator.userAgent,a=i.isNode?"node":navigator.platform;i.isFirefox=n.includes("Firefox"),i.isLegacyEdge=n.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(n),i.getSafariVersion=function(){if(!i.isSafari)return 0;let d=n.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),i.isIpad=a==="iPad",i.isIphone=a==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),i.isLinux=a.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(n)},6106:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let n=0;i.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 d=this._getKey(a);if(d===void 0||(n=this._search(d),n===-1)||this._getKey(this._array[n])!==d)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])===d);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,d){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do d(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===a)}values(){return[...this._array].values()}_search(a){let d=0,l=this._array.length-1;for(;l>=d;){let _=d+l>>1,m=this._getKey(this._array[_]);if(m>a)l=_-1;else{if(!(m<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}d=_+1}}return d}}},7226:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;let a=n(6114);class d{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,p=0,c=m.timeRemaining(),u=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),p=Math.max(y,p),u=m.timeRemaining(),1.5*p>u)return c-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-y))}ms`),void this._start();c=u}this.clear()}}class l extends d{_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())}}}i.PriorityTaskQueue=l,i.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:l,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;let a=n(643);i.updateWindowsModeWrappedState=function(d){let l=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),_=l?.get(d.cols-1),m=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);m&&_&&(m.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.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}}i.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,_=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=_}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=a},9092:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;let a=n(6349),d=n(7226),l=n(3734),_=n(8437),m=n(4634),y=n(511),p=n(643),c=n(4863),u=n(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(h,f,v){this._hasScrollback=h,this._optionsService=f,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=u.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.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,f){return new _.BufferLine(this._bufferService.cols,this.getNullCell(h),f)}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 f=h+this._optionsService.rawOptions.scrollback;return f>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:f}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=_.DEFAULT_ATTR_DATA);let f=this._rows;for(;f--;)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,f){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),S=0,g=this._getCorrectBufferLength(f);if(g>this.lines.maxLength&&(this.lines.maxLength=g),this.lines.length>0){if(this._cols<h)for(let b=0;b<this.lines.length;b++)S+=+this.lines.get(b).resize(h,v);let x=0;if(this._rows<f)for(let b=this._rows;b<f;b++)this.lines.length<f+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(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 _.BufferLine(h,v)));else for(let b=this._rows;b>f;b--)this.lines.length>f+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(g<this.lines.maxLength){let b=this.lines.length-g;b>0&&(this.lines.trimStart(b),this.ybase=Math.max(this.ybase-b,0),this.ydisp=Math.max(this.ydisp-b,0),this.savedY=Math.max(this.savedY-b,0)),this.lines.maxLength=g}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,f-1),x&&(this.y+=x),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=f-1,this._isReflowEnabled&&(this._reflow(h,f),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=f,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 f=0;for(;this._memoryCleanupPosition<this.lines.length;)if(f+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),f>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,f){this._cols!==h&&(h>this._cols?this._reflowLarger(h,f):this._reflowSmaller(h,f))}_reflowLarger(h,f){let v=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(_.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,f,S.countRemoved)}}_reflowLargerAdjustViewport(h,f,v){let S=this.getNullCell(_.DEFAULT_ATTR_DATA),g=v;for(;g-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<f&&this.lines.push(new _.BufferLine(h,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(h,f){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),S=[],g=0;for(let x=this.lines.length-1;x>=0;x--){let b=this.lines.get(x);if(!b||!b.isWrapped&&b.getTrimmedLength()<=h)continue;let E=[b];for(;b.isWrapped&&x>0;)b=this.lines.get(--x),E.unshift(b);let P=this.ybase+this.y;if(P>=x&&P<x+E.length)continue;let O=E[E.length-1].getTrimmedLength(),F=(0,m.reflowSmallerGetNewLineLengths)(E,this._cols,h),A=F.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 B=[];for(let T=0;T<A;T++){let D=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(D)}B.length>0&&(S.push({start:x+E.length+g,newLines:B}),g+=B.length),E.push(...B);let M=F.length-1,U=F[M];U===0&&(M--,U=F[M]);let I=E.length-A-1,C=O;for(;I>=0;){let T=Math.min(C,U);if(E[M]===void 0)break;if(E[M].copyCellsFrom(E[I],C-T,U-T,T,!0),U-=T,U===0&&(M--,U=F[M]),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++)F[T]<h&&E[T].setCell(F[T],v);let L=A-V;for(;L-- >0;)this.ybase===0?this.y<f-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+g)-f&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+f-1)}if(S.length>0){let x=[],b=[];for(let M=0;M<this.lines.length;M++)b.push(this.lines.get(M));let E=this.lines.length,P=E-1,O=0,F=S[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+g);let A=0;for(let M=Math.min(this.lines.maxLength-1,E+g-1);M>=0;M--)if(F&&F.start>P+A){for(let U=F.newLines.length-1;U>=0;U--)this.lines.set(M--,F.newLines[U]);M++,x.push({index:P+1,amount:F.newLines.length}),A+=F.newLines.length,F=S[++O]}else this.lines.set(M,b[P--]);let V=0;for(let M=x.length-1;M>=0;M--)x[M].index+=V,this.lines.onInsertEmitter.fire(x[M]),V+=x[M].amount;let B=Math.max(0,E+g-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(h,f,v=0,S){let g=this.lines.get(h);return g?g.translateToString(f,v,S):""}getWrappedRangeForLine(h){let f=h,v=h;for(;f>0&&this.lines.get(f).isWrapped;)f--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:f,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 f=0;f<this.markers.length;f++)this.markers[f].line===h&&(this.markers[f].dispose(),this.markers.splice(f--,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 f=new c.Marker(h);return this.markers.push(f),f.register(this.lines.onTrim((v=>{f.line-=v,f.line<0&&f.dispose()}))),f.register(this.lines.onInsert((v=>{f.line>=v.index&&(f.line+=v.amount)}))),f.register(this.lines.onDelete((v=>{f.line>=v.index&&f.line<v.index+v.amount&&f.dispose(),f.line>v.index&&(f.line-=v.amount)}))),f.register(f.onDispose((()=>this._removeMarker(f)))),f}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;let a=n(3734),d=n(511),l=n(643),_=n(482);i.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let m=0;class y{constructor(c,u,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let f=u||d.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,f);this.length=c}get(c){let u=this._data[3*c+0],h=2097151&u;return[this._data[3*c+1],2097152&u?this._combined[c]:h?(0,_.stringFromCodePoint)(h):"",u>>22,2097152&u?this._combined[c].charCodeAt(this._combined[c].length-1):h]}set(c,u){this._data[3*c+1]=u[l.CHAR_DATA_ATTR_INDEX],u[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=u[1],this._data[3*c+0]=2097152|c|u[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=u[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[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 u=this._data[3*c+0];return 2097152&u?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&u}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let u=this._data[3*c+0];return 2097152&u?this._combined[c]:2097151&u?(0,_.stringFromCodePoint)(2097151&u):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,u){return m=3*c,u.content=this._data[m+0],u.fg=this._data[m+1],u.bg=this._data[m+2],2097152&u.content&&(u.combinedData=this._combined[c]),268435456&u.bg&&(u.extended=this._extendedAttrs[c]),u}setCell(c,u){2097152&u.content&&(this._combined[c]=u.combinedData),268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=u.content,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}setCellFromCodepoint(c,u,h,f){268435456&f.bg&&(this._extendedAttrs[c]=f.extended),this._data[3*c+0]=u|h<<22,this._data[3*c+1]=f.fg,this._data[3*c+2]=f.bg}addCodepointToCell(c,u,h){let f=this._data[3*c+0];2097152&f?this._combined[c]+=(0,_.stringFromCodePoint)(u):2097151&f?(this._combined[c]=(0,_.stringFromCodePoint)(2097151&f)+(0,_.stringFromCodePoint)(u),f&=-2097152,f|=2097152):f=u|4194304,h&&(f&=-12582913,f|=h<<22),this._data[3*c+0]=f}insertCells(c,u,h){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),u<this.length-c){let f=new d.CellData;for(let v=this.length-c-u-1;v>=0;--v)this.setCell(c+u+v,this.loadCell(c+v,f));for(let v=0;v<u;++v)this.setCell(c+v,h)}else for(let f=c;f<this.length;++f)this.setCell(f,h);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,h)}deleteCells(c,u,h){if(c%=this.length,u<this.length-c){let f=new d.CellData;for(let v=0;v<this.length-c-u;++v)this.setCell(c+v,this.loadCell(c+u+v,f));for(let v=this.length-u;v<this.length;++v)this.setCell(v,h)}else for(let f=c;f<this.length;++f)this.setCell(f,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,u,h,f=!1){if(f)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,h),u<this.length&&this.getWidth(u-1)===2&&!this.isProtected(u)&&this.setCellFromCodepoint(u,0,1,h);c<u&&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),u<this.length&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u,0,1,h);c<u&&c<this.length;)this.setCell(c++,h)}resize(c,u){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 f=new Uint32Array(h);f.set(this._data),this._data=f}for(let f=this.length;f<c;++f)this.setCell(f,u)}else{this._data=this._data.subarray(0,h);let f=Object.keys(this._combined);for(let S=0;S<f.length;S++){let g=parseInt(f[S],10);g>=c&&delete this._combined[g]}let v=Object.keys(this._extendedAttrs);for(let S=0;S<v.length;S++){let g=parseInt(v[S],10);g>=c&&delete this._extendedAttrs[g]}}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,u=!1){if(u)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 u in c._combined)this._combined[u]=c._combined[u];this._extendedAttrs={};for(let u in c._extendedAttrs)this._extendedAttrs[u]=c._extendedAttrs[u];this.isWrapped=c.isWrapped}clone(){let c=new y(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let u in this._combined)c._combined[u]=this._combined[u];for(let u in this._extendedAttrs)c._extendedAttrs[u]=this._extendedAttrs[u];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,u,h,f,v){let S=c._data;if(v)for(let x=f-1;x>=0;x--){for(let b=0;b<3;b++)this._data[3*(h+x)+b]=S[3*(u+x)+b];268435456&S[3*(u+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[u+x])}else for(let x=0;x<f;x++){for(let b=0;b<3;b++)this._data[3*(h+x)+b]=S[3*(u+x)+b];268435456&S[3*(u+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[u+x])}let g=Object.keys(c._combined);for(let x=0;x<g.length;x++){let b=parseInt(g[x],10);b>=u&&(this._combined[b-u+h]=c._combined[b])}}translateToString(c,u,h,f){u=u??0,h=h??this.length,c&&(h=Math.min(h,this.getTrimmedLength())),f&&(f.length=0);let v="";for(;u<h;){let S=this._data[3*u+0],g=2097151&S,x=2097152&S?this._combined[u]:g?(0,_.stringFromCodePoint)(g):l.WHITESPACE_CELL_CHAR;if(v+=x,f)for(let b=0;b<x.length;++b)f.push(u);u+=S>>22||1}return f&&f.push(u),v}}i.BufferLine=y},4841:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.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,i)=>{function n(a,d,l){if(d===a.length-1)return a[d].getTrimmedLength();let _=!a[d].hasContent(l-1)&&a[d].getWidth(l-1)===1,m=a[d+1].getWidth(0)===2;return _&&m?l-1:l}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(a,d,l,_,m){let y=[];for(let p=0;p<a.length-1;p++){let c=p,u=a.get(++c);if(!u.isWrapped)continue;let h=[a.get(p)];for(;c<a.length&&u.isWrapped;)h.push(u),u=a.get(++c);if(_>=p&&_<c){p+=h.length-1;continue}let f=0,v=n(h,f,d),S=1,g=0;for(;S<h.length;){let b=n(h,S,d),E=b-g,P=l-v,O=Math.min(E,P);h[f].copyCellsFrom(h[S],g,v,O,!1),v+=O,v===l&&(f++,v=0),g+=O,g===b&&(S++,g=0),v===0&&f!==0&&h[f-1].getWidth(l-1)===2&&(h[f].copyCellsFrom(h[f-1],l-1,v++,1,!1),h[f-1].setCell(l-1,m))}h[f].replaceCells(v,l,m);let x=0;for(let b=h.length-1;b>0&&(b>f||h[b].getTrimmedLength()===0);b--)x++;x>0&&(y.push(p+h.length-x),y.push(x)),p+=h.length-1}return y},i.reflowLargerCreateNewLayout=function(a,d){let l=[],_=0,m=d[_],y=0;for(let p=0;p<a.length;p++)if(m===p){let c=d[++_];a.onDeleteEmitter.fire({index:p-y,amount:c}),p+=c-1,y+=c,m=d[++_]}else l.push(p);return{layout:l,countRemoved:y}},i.reflowLargerApplyNewLayout=function(a,d){let l=[];for(let _=0;_<d.length;_++)l.push(a.get(d[_]));for(let _=0;_<l.length;_++)a.set(_,l[_]);a.length=d.length},i.reflowSmallerGetNewLineLengths=function(a,d,l){let _=[],m=a.map(((u,h)=>n(a,h,d))).reduce(((u,h)=>u+h)),y=0,p=0,c=0;for(;c<m;){if(m-c<l){_.push(m-c);break}y+=l;let u=n(a,p,d);y>u&&(y-=u,p++);let h=a[p].getWidth(y-1)===2;h&&y--;let f=h?l-1:l;_.push(f),c+=f}return _},i.getWrappedLineTrimmedLength=n},5295:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;let a=n(8460),d=n(844),l=n(9092);class _ extends d.Disposable{constructor(y,p){super(),this._optionsService=y,this._bufferService=p,this._onBufferActivate=this.register(new a.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new 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,p){this._normal.resize(y,p),this._alt.resize(y,p),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}i.BufferSet=_},511:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;let a=n(482),d=n(643),l=n(3734);class _ 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 p=new _;return p.setFromCharData(y),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(y[d.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(y[d.CHAR_DATA_CHAR_INDEX].length===2){let c=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let u=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=u&&u<=57343?this.content=1024*(c-55296)+u-56320+65536|y[d.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=y[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=_},643:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;let a=n(8460),d=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,d.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}i.Marker=l,l._nextId=1},7116:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},i.CHARSETS.A={"#":"\xA3"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},i.CHARSETS.C=i.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},i.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},i.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},i.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},i.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},i.CHARSETS.E=i.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},i.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},i.CHARSETS.H=i.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},i.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(o,i)=>{var n,a,d;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.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||(i.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||(i.C1=a={})),(function(l){l.ST=`${n.ESC}\\`})(d||(i.C1_ESCAPED=d={}))},7399:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;let a=n(2584),d={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};i.evaluateKeyboardEvent=function(l,_,m,y){let p={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"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=l.ctrlKey?"\b":a.C0.DEL,l.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(l.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=l.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,l.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(m?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(m?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"A",m||p.key!==a.C0.ESC+"[1;3A"||(p.key=a.C0.ESC+"[1;5A")):p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"B",m||p.key!==a.C0.ESC+"[1;3B"||(p.key=a.C0.ESC+"[1;5B")):p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(p.key=a.C0.ESC+"[2~");break;case 46:p.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:p.key=c?a.C0.ESC+"[1;"+(c+1)+"H":_?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:p.key=c?a.C0.ESC+"[1;"+(c+1)+"F":_?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:l.shiftKey?p.type=2:l.ctrlKey?p.key=a.C0.ESC+"[5;"+(c+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:l.shiftKey?p.type=3:l.ctrlKey?p.key=a.C0.ESC+"[6;"+(c+1)+"~":p.key=a.C0.ESC+"[6~";break;case 112:p.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:p.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:p.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:p.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:p.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:p.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:p.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:p.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:p.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:p.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:p.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:p.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!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?p.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(p.key=a.C0.US),l.key==="@"&&(p.key=a.C0.NUL)):l.keyCode===65&&(p.type=1);else{let u=d[l.keyCode],h=u?.[l.shiftKey?1:0];if(h)p.key=a.C0.ESC+h;else if(l.keyCode>=65&&l.keyCode<=90){let f=l.ctrlKey?l.keyCode-64:l.keyCode+32,v=String.fromCharCode(f);l.shiftKey&&(v=v.toUpperCase()),p.key=a.C0.ESC+v}else if(l.keyCode===32)p.key=a.C0.ESC+(l.ctrlKey?a.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let f=l.code.slice(3,4);l.shiftKey||(f=f.toLowerCase()),p.key=a.C0.ESC+f,p.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?p.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?p.key=a.C0.NUL:l.keyCode>=51&&l.keyCode<=55?p.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?p.key=a.C0.DEL:l.keyCode===219?p.key=a.C0.ESC:l.keyCode===220?p.key=a.C0.FS:l.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},i.utf32ToString=function(n,a=0,d=n.length){let l="";for(let _=a;_<d;++_){let m=n[_];m>65535?(m-=65536,l+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):l+=String.fromCharCode(m)}return l},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,a){let d=n.length;if(!d)return 0;let l=0,_=0;if(this._interim){let m=n.charCodeAt(_++);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=_;m<d;++m){let y=n.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=d)return this._interim=y,l;let p=n.charCodeAt(m);56320<=p&&p<=57343?a[l++]=1024*(y-55296)+p-56320+65536:(a[l++]=y,a[l++]=p)}else y!==65279&&(a[l++]=y)}return l}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,a){let d=n.length;if(!d)return 0;let l,_,m,y,p=0,c=0,u=0;if(this.interim[0]){let v=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let g,x=0;for(;(g=63&this.interim[++x])&&x<4;)S<<=6,S|=g;let b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=b-x;for(;u<E;){if(u>=d)return 0;if(g=n[u++],(192&g)!=128){u--,v=!0;break}this.interim[x++]=g,S<<=6,S|=63&g}v||(b===2?S<128?u--:a[p++]=S:b===3?S<2048||S>=55296&&S<=57343||S===65279||(a[p++]=S):S<65536||S>1114111||(a[p++]=S)),this.interim.fill(0)}let h=d-4,f=u;for(;f<d;){for(;!(!(f<h)||128&(l=n[f])||128&(_=n[f+1])||128&(m=n[f+2])||128&(y=n[f+3]));)a[p++]=l,a[p++]=_,a[p++]=m,a[p++]=y,f+=4;if(l=n[f++],l<128)a[p++]=l;else if((224&l)==192){if(f>=d)return this.interim[0]=l,p;if(_=n[f++],(192&_)!=128){f--;continue}if(c=(31&l)<<6|63&_,c<128){f--;continue}a[p++]=c}else if((240&l)==224){if(f>=d)return this.interim[0]=l,p;if(_=n[f++],(192&_)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,p;if(m=n[f++],(192&m)!=128){f--;continue}if(c=(15&l)<<12|(63&_)<<6|63&m,c<2048||c>=55296&&c<=57343||c===65279)continue;a[p++]=c}else if((248&l)==240){if(f>=d)return this.interim[0]=l,p;if(_=n[f++],(192&_)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,p;if(m=n[f++],(192&m)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,this.interim[2]=m,p;if(y=n[f++],(192&y)!=128){f--;continue}if(c=(7&l)<<18|(63&_)<<12|(63&m)<<6|63&y,c<65536||c>1114111)continue;a[p++]=c}}return p}}},225:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;let a=n(1480),d=[[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]],_;i.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let m=0;m<d.length;++m)_.fill(0,d[m][0],d[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?_[m]:(function(y,p){let c,u=0,h=p.length-1;if(y<p[0][0]||y>p[h][1])return!1;for(;h>=u;)if(c=u+h>>1,y>p[c][1])u=c+1;else{if(!(y<p[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 p=this.wcwidth(m),c=p===0&&y!==0;if(c){let u=a.UnicodeService.extractWidth(y);u===0?c=!1:u>p&&(p=u)}return a.UnicodeService.createPropertyValue(0,p,c)}}},5981:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;let a=n(8460),d=n(844);class l extends d.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 p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(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 p=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],u=this._action(c,y);if(u){let f=v=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(p,v);return void u.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(f)}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-p>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}i.WriteBuffer=l},5941:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.toRgbString=i.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 d(l,_){let m=l.toString(16),y=m.length<2?"0"+m:m;switch(_){case 4:return m[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}i.parseColor=function(l){if(!l)return;let _=l.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let m=n.exec(_);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(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let m=_.length/3,y=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(_.slice(m*p,m*p+m),16);y[p]=m===1?c<<4:m===2?c:m===3?c>>4:c>>8}return y}},i.toRgbString=function(l,_=16){let[m,y,p]=l;return`rgb:${d(m,_)}/${d(y,_)}/${d(p,_)}`}},5770:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;let a=n(482),d=n(8742),l=n(5770),_=[];i.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(y,p){this._handlers[y]===void 0&&(this._handlers[y]=[]);let c=this._handlers[y];return c.push(p),{dispose:()=>{let u=c.indexOf(p);u!==-1&&c.splice(u,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=_,this._ident=0}hook(y,p){if(this.reset(),this._ident=y,this._active=this._handlers[y]||_,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(y,p,c){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(y,p,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(y,p,c))}unhook(y,p=!0){if(this._active.length){let c=!1,u=this._active.length-1,h=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,c=p,h=this._stack.fallThrough,this._stack.paused=!1),!h&&c===!1){for(;u>=0&&(c=this._active[u].unhook(y),c!==!0);u--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,c;u--}for(;u>=0;u--)if(c=this._active[u].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",y);this._active=_,this._ident=0}};let m=new d.Params;m.addParam(0),i.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,p,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(y,p,c),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let p=!1;if(this._hitLimit)p=!1;else if(y&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=m,this._data="",this._hitLimit=!1,c)));return this._params=m,this._data="",this._hitLimit=!1,p}}},2015:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;let a=n(844),d=n(8742),l=n(6242),_=n(6351);class m{constructor(u){this.table=new Uint8Array(u)}setDefault(u,h){this.table.fill(u<<4|h)}add(u,h,f,v){this.table[h<<8|u]=f<<4|v}addMany(u,h,f,v){for(let S=0;S<u.length;S++)this.table[h<<8|u[S]]=f<<4|v}}i.TransitionTable=m;let y=160;i.VT500_TRANSITION_TABLE=(function(){let c=new m(4095),u=Array.apply(null,Array(256)).map(((x,b)=>b)),h=(x,b)=>u.slice(x,b),f=h(32,127),v=h(0,24);v.push(25),v.push.apply(v,h(28,32));let S=h(0,14),g;for(g in c.setDefault(1,0),c.addMany(f,0,2,0),S)c.addMany([24,26,153,154],g,3,0),c.addMany(h(128,144),g,3,0),c.addMany(h(144,152),g,3,0),c.add(156,g,0,0),c.add(27,g,11,1),c.add(157,g,4,8),c.addMany([152,158,159],g,0,7),c.add(155,g,11,3),c.add(144,g,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(f,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(f,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(f,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 p extends a.Disposable{constructor(u=i.VT500_TRANSITION_TABLE){super(),this._transitions=u,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(h,f,v)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,f)=>{},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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(u,h=[64,126]){let f=0;if(u.prefix){if(u.prefix.length>1)throw new Error("only one byte as prefix supported");if(f=u.prefix.charCodeAt(0),f&&60>f||f>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(u.intermediates){if(u.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<u.intermediates.length;++S){let g=u.intermediates.charCodeAt(S);if(32>g||g>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");f<<=8,f|=g}}if(u.final.length!==1)throw new Error("final must be a single byte");let v=u.final.charCodeAt(0);if(h[0]>v||v>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return f<<=8,f|=v,f}identToString(u){let h=[];for(;u;)h.push(String.fromCharCode(255&u)),u>>=8;return h.reverse().join("")}setPrintHandler(u){this._printHandler=u}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(u,h){let f=this._identifier(u,[48,126]);this._escHandlers[f]===void 0&&(this._escHandlers[f]=[]);let v=this._escHandlers[f];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearEscHandler(u){this._escHandlers[this._identifier(u,[48,126])]&&delete this._escHandlers[this._identifier(u,[48,126])]}setEscHandlerFallback(u){this._escHandlerFb=u}setExecuteHandler(u,h){this._executeHandlers[u.charCodeAt(0)]=h}clearExecuteHandler(u){this._executeHandlers[u.charCodeAt(0)]&&delete this._executeHandlers[u.charCodeAt(0)]}setExecuteHandlerFallback(u){this._executeHandlerFb=u}registerCsiHandler(u,h){let f=this._identifier(u);this._csiHandlers[f]===void 0&&(this._csiHandlers[f]=[]);let v=this._csiHandlers[f];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearCsiHandler(u){this._csiHandlers[this._identifier(u)]&&delete this._csiHandlers[this._identifier(u)]}setCsiHandlerFallback(u){this._csiHandlerFb=u}registerDcsHandler(u,h){return this._dcsParser.registerHandler(this._identifier(u),h)}clearDcsHandler(u){this._dcsParser.clearHandler(this._identifier(u))}setDcsHandlerFallback(u){this._dcsParser.setHandlerFallback(u)}registerOscHandler(u,h){return this._oscParser.registerHandler(u,h)}clearOscHandler(u){this._oscParser.clearHandler(u)}setOscHandlerFallback(u){this._oscParser.setHandlerFallback(u)}setErrorHandler(u){this._errorHandler=u}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(u,h,f,v,S){this._parseStack.state=u,this._parseStack.handlers=h,this._parseStack.handlerPos=f,this._parseStack.transition=v,this._parseStack.chunkPos=S}parse(u,h,f){let v,S=0,g=0,x=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,x=this._parseStack.chunkPos+1;else{if(f===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let b=this._parseStack.handlers,E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(f===!1&&E>-1){for(;E>=0&&(v=b[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(f===!1&&E>-1){for(;E>=0&&(v=b[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(S=u[this._parseStack.chunkPos],v=this._dcsParser.unhook(S!==24&&S!==26,f),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=u[this._parseStack.chunkPos],v=this._oscParser.end(S!==24&&S!==26,f),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 b=x;b<h;++b){switch(S=u[b],g=this._transitions.table[this.currentState<<8|(S<160?S:y)],g>>4){case 2:for(let A=b+1;;++A){if(A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,b,A),b=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,b,A),b=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,b,A),b=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,b,A),b=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:b,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],P=E?E.length-1:-1;for(;P>=0&&(v=E[P](this._params),v!==!0);P--)if(v instanceof Promise)return this._preserveStack(3,E,P,g,b),v;P<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(++b<h&&(S=u[b])>47&&S<60);b--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:let O=this._escHandlers[this._collect<<8|S],F=O?O.length-1:-1;for(;F>=0&&(v=O[F](),v!==!0);F--)if(v instanceof Promise)return this._preserveStack(4,O,F,g,b),v;F<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=b+1;;++A)if(A>=h||(S=u[A])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(u,b,A),b=A-1;break}break;case 14:if(v=this._dcsParser.unhook(S!==24&&S!==26),v)return this._preserveStack(6,[],0,g,b),v;S===27&&(g|=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=b+1;;A++)if(A>=h||(S=u[A])<32||S>127&&S<y){this._oscParser.put(u,b,A),b=A-1;break}break;case 6:if(v=this._oscParser.end(S!==24&&S!==26),v)return this._preserveStack(5,[],0,g,b),v;S===27&&(g|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&g}}}i.EscapeSequenceParser=p},6242:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;let a=n(5770),d=n(482),l=[];i.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(_,m){this._handlers[_]===void 0&&(this._handlers[_]=[]);let y=this._handlers[_];return y.push(m),{dispose:()=>{let p=y.indexOf(m);p!==-1&&y.splice(p,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,m,y){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,m,y);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(_,m,y))}start(){this.reset(),this._state=1}put(_,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){let p=_[m++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&y-m>0&&this._put(_,m,y)}}end(_,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,y=m,c=this._stack.fallThrough,this._stack.paused=!1),!c&&y===!1){for(;p>=0&&(y=this._active[p].end(_),y!==!0);p--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,y;p--}for(;p>=0;p--)if(y=this._active[p].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",_);this._active=l,this._id=-1,this._state=0}}},i.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,m,y){this._hitLimit||(this._data+=(0,d.utf32ToString)(_,m,y),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let m=!1;if(this._hitLimit)m=!1;else if(_&&(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,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;let n=2147483647;class a{static fromArray(l){let _=new a;if(!l.length)return _;for(let m=Array.isArray(l[0])?1:0;m<l.length;++m){let y=l[m];if(Array.isArray(y))for(let p=0;p<y.length;++p)_.addSubParam(y[p]);else _.addParam(y)}return _}constructor(l=32,_=32){if(this.maxLength=l,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(_),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 _=0;_<this.length;++_){l.push(this.params[_]);let m=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];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 _=this._subParamsIdx[l]>>8,m=255&this._subParamsIdx[l];return m-_>0?this._subParams.subarray(_,m):null}getSubParamsAll(){let l={};for(let _=0;_<this.length;++_){let m=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];y-m>0&&(l[_]=this._subParams.slice(m,y))}return l}addDigit(l){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let m=this._digitIsSub?this._subParams:this.params,y=m[_-1];m[_-1]=~y?Math.min(10*y+l,n):l}}i.Params=a},5741:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AddonManager=void 0,i.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 d={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(d),a.dispose=()=>this._wrappedAddonDispose(d),a.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let a=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===n){a=d;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,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;let a=n(3785),d=n(511);i.BufferApiView=class{constructor(l,_){this._buffer=l,this.type=_}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 _=this._buffer.lines.get(l);if(_)return new a.BufferLineApiView(_)}getNullCell(){return new d.CellData}}},3785:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;let a=n(511);i.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,l){if(!(d<0||d>=this._line.length))return l?(this._line.loadCell(d,l),l):this._line.loadCell(d,new a.CellData)}translateToString(d,l,_){return this._line.translateToString(d,l,_)}}},8285:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;let a=n(8771),d=n(8460),l=n(844);class _ extends l.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new d.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)}}i.BufferNamespaceApi=_},7975:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ParserApi=void 0,i.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,a){return this._core.registerCsiHandler(n,(d=>a(d.toArray())))}addCsiHandler(n,a){return this.registerCsiHandler(n,a)}registerDcsHandler(n,a){return this._core.registerDcsHandler(n,((d,l)=>a(d,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,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.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,i,n){var a=this&&this.__decorate||function(c,u,h,f){var v,S=arguments.length,g=S<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(c,u,h,f);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(g=(S<3?v(g):S>3?v(u,h,g):v(u,h))||g);return S>3&&g&&Object.defineProperty(u,h,g),g},d=this&&this.__param||function(c,u){return function(h,f){u(h,f,c)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;let l=n(8460),_=n(844),m=n(5295),y=n(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let p=i.BufferService=class extends _.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,i.MINIMUM_COLS),this.rows=Math.max(c.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new m.BufferSet(c,this))}resize(c,u){this.cols=c,this.rows=u,this.buffers.resize(c,u),this._onResize.fire({cols:c,rows:u})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,u=!1){let h=this.buffer,f;f=this._cachedBlankLine,f&&f.length===this.cols&&f.getFg(0)===c.fg&&f.getBg(0)===c.bg||(f=h.getBlankLine(c,u),this._cachedBlankLine=f),f.isWrapped=u;let v=h.ybase+h.scrollTop,S=h.ybase+h.scrollBottom;if(h.scrollTop===0){let g=h.lines.isFull;S===h.lines.length-1?g?h.lines.recycle().copyFrom(f):h.lines.push(f.clone()):h.lines.splice(S+1,0,f.clone()),g?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{let g=S-v+1;h.lines.shiftElements(v+1,g-1,-1),h.lines.set(S,f.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(c,u,h){let f=this.buffer;if(c<0){if(f.ydisp===0)return;this.isUserScrolling=!0}else c+f.ydisp>=f.ybase&&(this.isUserScrolling=!1);let v=f.ydisp;f.ydisp=Math.max(Math.min(f.ydisp+c,f.ybase),0),v!==f.ydisp&&(u||this._onScroll.fire(f.ydisp))}};i.BufferService=p=a([d(0,y.IOptionsService)],p)},7994:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CharsetService=void 0,i.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(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,i,n){var a=this&&this.__decorate||function(f,v,S,g){var x,b=arguments.length,E=b<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,v,S,g);else for(var P=f.length-1;P>=0;P--)(x=f[P])&&(E=(b<3?x(E):b>3?x(v,S,E):x(v,S))||E);return b>3&&E&&Object.defineProperty(v,S,E),E},d=this&&this.__param||function(f,v){return function(S,g){v(S,g,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;let l=n(2585),_=n(8460),m=n(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:f=>f.button!==4&&f.action===1&&(f.ctrl=!1,f.alt=!1,f.shift=!1,!0)},VT200:{events:19,restrict:f=>f.action!==32},DRAG:{events:23,restrict:f=>f.action!==32||f.button!==3},ANY:{events:31,restrict:f=>!0}};function p(f,v){let S=(f.ctrl?16:0)|(f.shift?4:0)|(f.alt?8:0);return f.button===4?(S|=64,S|=f.action):(S|=3&f.button,4&f.button&&(S|=64),8&f.button&&(S|=128),f.action===32?S|=32:f.action!==0||v||(S|=3)),S}let c=String.fromCharCode,u={DEFAULT:f=>{let v=[p(f,!1)+32,f.col+32,f.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${c(v[0])}${c(v[1])}${c(v[2])}`},SGR:f=>{let v=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${p(f,!0)};${f.col};${f.row}${v}`},SGR_PIXELS:f=>{let v=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${p(f,!0)};${f.x};${f.y}${v}`}},h=i.CoreMouseService=class extends m.Disposable{constructor(f,v){super(),this._bufferService=f,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let S of Object.keys(y))this.addProtocol(S,y[S]);for(let S of Object.keys(u))this.addEncoding(S,u[S]);this.reset()}addProtocol(f,v){this._protocols[f]=v}addEncoding(f,v){this._encodings[f]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(f){if(!this._protocols[f])throw new Error(`unknown protocol "${f}"`);this._activeProtocol=f,this._onProtocolChange.fire(this._protocols[f].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(f){if(!this._encodings[f])throw new Error(`unknown encoding "${f}"`);this._activeEncoding=f}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(f){if(f.col<0||f.col>=this._bufferService.cols||f.row<0||f.row>=this._bufferService.rows||f.button===4&&f.action===32||f.button===3&&f.action!==32||f.button!==4&&(f.action===2||f.action===3)||(f.col++,f.row++,f.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,f,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(f))return!1;let v=this._encodings[this._activeEncoding](f);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=f,!0}explainEvents(f){return{down:!!(1&f),up:!!(2&f),drag:!!(4&f),move:!!(8&f),wheel:!!(16&f)}}_equalEvents(f,v,S){if(S){if(f.x!==v.x||f.y!==v.y)return!1}else if(f.col!==v.col||f.row!==v.row)return!1;return f.button===v.button&&f.action===v.action&&f.ctrl===v.ctrl&&f.alt===v.alt&&f.shift===v.shift}};i.CoreMouseService=h=a([d(0,l.IBufferService),d(1,l.ICoreService)],h)},6975:function(o,i,n){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,b=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(b=(x<3?g(b):x>3?g(f,v,b):g(f,v))||b);return x>3&&b&&Object.defineProperty(f,v,b),b},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;let l=n(1439),_=n(8460),m=n(844),y=n(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),u=i.CoreService=class extends m.Disposable{constructor(h,f,v){super(),this._bufferService=h,this._logService=f,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,l.clone)(p),this.decPrivateModes=(0,l.clone)(c)}reset(){this.modes=(0,l.clone)(p),this.decPrivateModes=(0,l.clone)(c)}triggerDataEvent(h,f=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;f&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),f&&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((f=>f.charCodeAt(0))))),this._onBinary.fire(h))}};i.CoreService=u=a([d(0,y.IBufferService),d(1,y.ILogService),d(2,y.IOptionsService)],u)},9074:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;let a=n(8055),d=n(8460),l=n(844),_=n(6106),m=0,y=0;class p extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((h=>h?.marker.line)),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;let f=new c(h);if(f){let v=f.marker.onDispose((()=>f.dispose()));f.onDispose((()=>{f&&(this._decorations.delete(f)&&this._onDecorationRemoved.fire(f),v.dispose())})),this._decorations.insert(f),this._onDecorationRegistered.fire(f)}return f}reset(){for(let h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,f,v){let S=0,g=0;for(let x of this._decorations.getKeyIterator(f))S=x.options.x??0,g=S+(x.options.width??1),h>=S&&h<g&&(!v||(x.options.layer??"bottom")===v)&&(yield x)}forEachDecorationAtCell(h,f,v,S){this._decorations.forEachByKey(f,(g=>{m=g.options.x??0,y=m+(g.options.width??1),h>=m&&h<y&&(!v||(g.options.layer??"bottom")===v)&&S(g)}))}}i.DecorationService=p;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 d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.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,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;let a=n(2585),d=n(8343);class l{constructor(...m){this._entries=new Map;for(let[y,p]of m)this.set(y,p)}set(m,y){let p=this._entries.get(m);return this._entries.set(m,y),p}forEach(m){for(let[y,p]of this._entries.entries())m(y,p)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}i.ServiceCollection=l,i.InstantiationService=class{constructor(){this._services=new l,this._services.set(a.IInstantiationService,this)}setService(_,m){this._services.set(_,m)}getService(_){return this._services.get(_)}createInstance(_,...m){let y=(0,d.getServiceDependencies)(_).sort(((u,h)=>u.index-h.index)),p=[];for(let u of y){let h=this._services.get(u.id);if(!h)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${u.id}.`);p.push(h)}let c=y.length>0?y[0].index:m.length;if(m.length!==c)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${c+1} conflicts with ${m.length} static arguments`);return new _(...m,...p)}}},7866:function(o,i,n){var a=this&&this.__decorate||function(c,u,h,f){var v,S=arguments.length,g=S<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(c,u,h,f);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(g=(S<3?v(g):S>3?v(u,h,g):v(u,h))||g);return S>3&&g&&Object.defineProperty(u,h,g),g},d=this&&this.__param||function(c,u){return function(h,f){u(h,f,c)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;let l=n(844),_=n(2585),m={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},y,p=i.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let u=0;u<c.length;u++)typeof c[u]=="function"&&(c[u]=c[u]())}_log(c,u,h){this._evalLazyOptionalParams(h),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+u,...h)}trace(c,...u){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,u)}debug(c,...u){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,u)}info(c,...u){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,u)}warn(c,...u){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,u)}error(c,...u){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,u)}};i.LogService=p=a([d(0,_.IOptionsService)],p),i.setTraceLogger=function(c){y=c},i.traceCall=function(c,u,h){if(typeof h.value!="function")throw new Error("not supported");let f=h.value;h.value=function(...v){if(y.logLevel!==_.LogLevelEnum.TRACE)return f.apply(this,v);y.trace(`GlyphRenderer#${f.name}(${v.map((g=>JSON.stringify(g))).join(", ")})`);let S=f.apply(this,v);return y.trace(`GlyphRenderer#${f.name} return`,S),S}}},7302:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;let a=n(8460),d=n(844),l=n(6114);i.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:l.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let _=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends d.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...i.DEFAULT_OPTIONS};for(let u in p)if(u in c)try{let h=p[u];c[u]=this._sanitizeAndValidateOption(u,h)}catch(h){console.error(h)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,d.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((u=>{u===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((u=>{p.indexOf(u)!==-1&&c()}))}_setupOptions(){let p=u=>{if(!(u in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);return this.rawOptions[u]},c=(u,h)=>{if(!(u in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);h=this._sanitizeAndValidateOption(u,h),this.rawOptions[u]!==h&&(this.rawOptions[u]=h,this._onOptionChange.fire(u))};for(let u in this.rawOptions){let h={get:p.bind(this,u),set:c.bind(this,u)};Object.defineProperty(this.options,u,h)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=i.DEFAULT_OPTIONS[p]),!(function(u){return u==="block"||u==="underline"||u==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${p}`);break;case"wordSeparator":c||(c=i.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=_.includes(c)?c:i.DEFAULT_OPTIONS[p];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${p} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${p} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}i.OptionsService=m},2660:function(o,i,n){var a=this&&this.__decorate||function(m,y,p,c){var u,h=arguments.length,f=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(m,y,p,c);else for(var v=m.length-1;v>=0;v--)(u=m[v])&&(f=(h<3?u(f):h>3?u(y,p,f):u(y,p))||f);return h>3&&f&&Object.defineProperty(y,p,f),f},d=this&&this.__param||function(m,y){return function(p,c){y(p,c,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;let l=n(2585),_=i.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 p=m,c=this._getEntryIdKey(p),u=this._entriesWithId.get(c);if(u)return this.addLineToLink(u.id,y.ybase+y.y),u.id;let h=y.addMarker(y.ybase+y.y),f={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(f,h))),this._entriesWithId.set(f.key,f),this._dataByLinkId.set(f.id,f),f.id}addLineToLink(m,y){let p=this._dataByLinkId.get(m);if(p&&p.lines.every((c=>c.line!==y))){let c=this._bufferService.buffer.addMarker(y);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(m){return this._dataByLinkId.get(m)?.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){let p=m.lines.indexOf(y);p!==-1&&(m.lines.splice(p,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};i.OscLinkService=_=a([d(0,l.IBufferService)],_)},8343:(o,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;let n="di$target",a="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(d){return d[a]||[]},i.createDecorator=function(d){if(i.serviceRegistry.has(d))return i.serviceRegistry.get(d);let l=function(_,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,u){c[n]===c?c[a].push({id:p,index:u}):(c[a]=[{id:p,index:u}],c[n]=c)})(l,_,y)};return l.toString=()=>d,i.serviceRegistry.set(d,l),l}},2585:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;let a=n(8343);var d;i.IBufferService=(0,a.createDecorator)("BufferService"),i.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),i.ICoreService=(0,a.createDecorator)("CoreService"),i.ICharsetService=(0,a.createDecorator)("CharsetService"),i.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"})(d||(i.LogLevelEnum=d={})),i.ILogService=(0,a.createDecorator)("LogService"),i.IOptionsService=(0,a.createDecorator)("OptionsService"),i.IOscLinkService=(0,a.createDecorator)("OscLinkService"),i.IUnicodeService=(0,a.createDecorator)("UnicodeService"),i.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(o,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;let a=n(8460),d=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,p=!1){return(16777215&m)<<3|(3&y)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let m=new d.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,p=0,c=m.length;for(let u=0;u<c;++u){let h=m.charCodeAt(u);if(55296<=h&&h<=56319){if(++u>=c)return y+this.wcwidth(h);let S=m.charCodeAt(u);56320<=S&&S<=57343?h=1024*(h-55296)+S-56320+65536:y+=this.wcwidth(S)}let f=this.charProperties(h,p),v=l.extractWidth(f);l.extractShouldJoin(f)&&(v-=l.extractWidth(p)),y+=v,p=f}return y}charProperties(m,y){return this._activeProvider.charProperties(m,y)}}i.UnicodeService=l}},t={};function r(o){var i=t[o];if(i!==void 0)return i.exports;var n=t[o]={exports:{}};return e[o].call(n.exports,n,n.exports,r),n.exports}var s={};return(()=>{var o=s;Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;let i=r(9042),n=r(3236),a=r(844),d=r(5741),l=r(8285),_=r(7975),m=r(7090),y=["cols","rows"];class p extends a.Disposable{constructor(u){super(),this._core=this.register(new n.Terminal(u)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};let h=v=>this._core.options[v],f=(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:f.bind(this,v)};Object.defineProperty(this._publicOptions,v,S)}}_checkReadonlyOptions(u){if(y.includes(u))throw new Error(`Option "${u}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new 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 u=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:u.applicationCursorKeys,applicationKeypadMode:u.applicationKeypad,bracketedPasteMode:u.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:u.origin,reverseWraparoundMode:u.reverseWraparound,sendFocusMode:u.sendFocus,wraparoundMode:u.wraparound}}get options(){return this._publicOptions}set options(u){for(let h in u)this._publicOptions[h]=u[h]}blur(){this._core.blur()}focus(){this._core.focus()}input(u,h=!0){this._core.input(u,h)}resize(u,h){this._verifyIntegers(u,h),this._core.resize(u,h)}open(u){this._core.open(u)}attachCustomKeyEventHandler(u){this._core.attachCustomKeyEventHandler(u)}attachCustomWheelEventHandler(u){this._core.attachCustomWheelEventHandler(u)}registerLinkProvider(u){return this._core.registerLinkProvider(u)}registerCharacterJoiner(u){return this._checkProposedApi(),this._core.registerCharacterJoiner(u)}deregisterCharacterJoiner(u){this._checkProposedApi(),this._core.deregisterCharacterJoiner(u)}registerMarker(u=0){return this._verifyIntegers(u),this._core.registerMarker(u)}registerDecoration(u){return this._checkProposedApi(),this._verifyPositiveIntegers(u.x??0,u.width??0,u.height??0),this._core.registerDecoration(u)}hasSelection(){return this._core.hasSelection()}select(u,h,f){this._verifyIntegers(u,h,f),this._core.select(u,h,f)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(u,h){this._verifyIntegers(u,h),this._core.selectLines(u,h)}dispose(){super.dispose()}scrollLines(u){this._verifyIntegers(u),this._core.scrollLines(u)}scrollPages(u){this._verifyIntegers(u),this._core.scrollPages(u)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(u){this._verifyIntegers(u),this._core.scrollToLine(u)}clear(){this._core.clear()}write(u,h){this._core.write(u,h)}writeln(u,h){this._core.write(u),this._core.write(`\r
9
- `,h)}paste(u){this._core.paste(u)}refresh(u,h){this._verifyIntegers(u,h),this._core.refresh(u,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(u){this._addonManager.loadAddon(this,u)}static get strings(){return i}_verifyIntegers(...u){for(let h of u)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...u){for(let h of u)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}o.Terminal=p})(),s})()))});var la=ia(($s,on)=>{(function(e,t){typeof $s=="object"&&typeof on=="object"?on.exports=t():typeof define=="function"&&define.amd?define([],t):typeof $s=="object"?$s.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 s=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(s._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,s=r._renderService.dimensions;if(s.css.cell.width===0||s.css.cell.height===0)return;let o=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),a=Math.max(0,parseInt(i.getPropertyValue("width"))),d=window.getComputedStyle(this._terminal.element),l=n-(parseInt(d.getPropertyValue("padding-top"))+parseInt(d.getPropertyValue("padding-bottom"))),_=a-(parseInt(d.getPropertyValue("padding-right"))+parseInt(d.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(_/s.css.cell.width)),rows:Math.max(1,Math.floor(l/s.css.cell.height))}}}})(),e})()))});var Ic=na(aa(),1),Nc=na(la(),1);var gd=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ca.isErrorNoTelemetry(e)?new ca(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()))),u.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),P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(P&&O&&E)&&this._areCoordsInSelection(E,P,O)}isCellInSelection(w,E){let P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!P||!O)&&this._areCoordsInSelection([w,E],P,O)}_areCoordsInSelection(w,E,P){return w[1]>E[1]&&w[1]<P[1]||E[1]===P[1]&&w[1]===E[1]&&w[0]>=E[0]&&w[0]<P[0]||E[1]<P[1]&&w[1]===P[1]&&w[0]<P[0]||E[1]<P[1]&&w[1]===E[1]&&w[0]>=E[0]}_selectWordAtCursor(w,E){let P=this._linkifier.currentLink?.link?.range;if(P)return this._model.selectionStart=[P.start.x-1,P.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(P,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let O=this._getMouseBufferCoords(w);return!!O&&(this._selectWordAt(O,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],P=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=P?0:(E>P&&(E-=P),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(w){return u.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&&!(u.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 P=this._bufferService.buffer;if(this._model.selectionEnd[1]<P.lines.length){let O=P.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}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 P=this._mouseService.getCoords(w,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(P&&P[0]!==void 0&&P[1]!==void 0){let O=(0,_.moveToCellSequence)(P[0]-1,P[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,P=!(!w||!E||w[0]===E[0]&&w[1]===E[1]);P?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,P)):this._oldHasSelection&&this._fireOnSelectionChange(w,E,P)}_fireOnSelectionChange(w,E,P){this._oldSelectionStart=w,this._oldSelectionEnd=E,this._oldHasSelection=P,this._onSelectionChange.fire()}_handleBufferActivate(w){this.clearSelection(),this._trimListener.dispose(),this._trimListener=w.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(w,E){let P=E;for(let O=0;E>=O;O++){let F=w.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?P--:F>1&&E!==O&&(P+=F-1)}return P}setSelection(w,E,P){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[w,E],this._model.selectionStartLength=P,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(w){this._isClickInSelection(w)||(this._selectWordAtCursor(w,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(w,E,P=!0,O=!0){if(w[0]>=this._bufferService.cols)return;let F=this._bufferService.buffer,A=F.lines.get(w[1]);if(!A)return;let V=F.translateBufferLineToString(w[1],!1),B=this._convertViewportColToCharacterIndex(A,w[0]),R=B,z=w[0]-B,I=0,C=0,L=0,T=0;if(V.charAt(B)===" "){for(;B>0&&V.charAt(B-1)===" ";)B--;for(;R<V.length&&V.charAt(R+1)===" ";)R++}else{let G=w[0],j=w[0];A.getWidth(G)===0&&(I++,G--),A.getWidth(j)===2&&(C++,j++);let Y=A.getString(j).length;for(Y>1&&(T+=Y-1,R+=Y-1);G>0&&B>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,B-=H-1),B--,G--}for(;j<A.length&&R+1<V.length&&!this._isCharWordSeparator(A.loadCell(j+1,this._workCell));){A.loadCell(j+1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,j++):H>1&&(T+=H-1,R+=H-1),R++,j++}}R++;let D=B+z-I+L,N=Math.min(this._bufferService.cols,R-B+I+C-L-T);if(E||V.slice(B,R).trim()!==""){if(P&&D===0&&A.getCodePoint(0)!==32){let G=F.lines.get(w[1]-1);if(G&&A.isWrapped&&G.getCodePoint(this._bufferService.cols-1)!==32){let j=this._getWordAt([this._bufferService.cols-1,w[1]-1],!1,!0,!1);if(j){let Y=this._bufferService.cols-j.start;D-=Y,N+=Y}}}if(O&&D+N===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let G=F.lines.get(w[1]+1);if(G?.isWrapped&&G.getCodePoint(0)!==32){let j=this._getWordAt([0,w[1]+1],!1,!1,!0);j&&(N+=j.length)}}return{start:D,length:N}}}_selectWordAt(w,E){let P=this._getWordAt(w,E);if(P){for(;P.start<0;)P.start+=this._bufferService.cols,w[1]--;this._model.selectionStart=[P.start,w[1]],this._model.selectionStartLength=P.length}}_selectToWordAt(w){let E=this._getWordAt(w,!0);if(E){let P=w[1];for(;E.start<0;)E.start+=this._bufferService.cols,P--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,P++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,P]}}_isCharWordSeparator(w){return w.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(w.getChars())>=0}_selectLineAt(w){let E=this._bufferService.buffer.getWrappedRangeForLine(w),P={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(P,this._bufferService.cols)}};s.SelectionService=x=a([d(3,v.IBufferService),d(4,v.ICoreService),d(5,y.IMouseService),d(6,v.IOptionsService),d(7,y.IRenderService),d(8,y.ICoreBrowserService)],x)},4725:(n,s,o)=>{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=o(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(n,s,o){var a=this&&this.__decorate||function(x,w,E,P){var O,F=arguments.length,A=F<3?w:P===null?P=Object.getOwnPropertyDescriptor(w,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,w,E,P);else for(var V=x.length-1;V>=0;V--)(O=x[V])&&(A=(F<3?O(A):F>3?O(w,E,A):O(w,E))||A);return F>3&&A&&Object.defineProperty(w,E,A),A},d=this&&this.__param||function(x,w){return function(E,P){w(E,P,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let l=o(7239),_=o(8055),m=o(8460),y=o(844),p=o(2585),c=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),h=_.css.toColor("#ffffff"),f=_.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let x=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],w=[0,95,135,175,215,255];for(let E=0;E<216;E++){let P=w[E/36%6|0],O=w[E/6%6|0],F=w[E%6];x.push({css:_.channels.toCss(P,O,F),rgba:_.channels.toRgba(P,O,F)})}for(let E=0;E<24;E++){let P=8+10*E;x.push({css:_.channels.toCss(P,P,P),rgba:_.channels.toRgba(P,P,P)})}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:u,cursor:h,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:_.color.blend(u,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:_.color.blend(u,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=g(x.foreground,c),w.background=g(x.background,u),w.cursor=g(x.cursor,h),w.cursorAccent=g(x.cursorAccent,f),w.selectionBackgroundTransparent=g(x.selectionBackground,v),w.selectionBackgroundOpaque=_.color.blend(w.background,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundTransparent=g(x.selectionInactiveBackground,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundOpaque=_.color.blend(w.background,w.selectionInactiveBackgroundTransparent),w.selectionForeground=x.selectionForeground?g(x.selectionForeground,_.NULL_COLOR):void 0,w.selectionForeground===_.NULL_COLOR&&(w.selectionForeground=void 0),_.color.isOpaque(w.selectionBackgroundTransparent)&&(w.selectionBackgroundTransparent=_.color.opacity(w.selectionBackgroundTransparent,.3)),_.color.isOpaque(w.selectionInactiveBackgroundTransparent)&&(w.selectionInactiveBackgroundTransparent=_.color.opacity(w.selectionInactiveBackgroundTransparent,.3)),w.ansi=s.DEFAULT_ANSI_COLORS.slice(),w.ansi[0]=g(x.black,s.DEFAULT_ANSI_COLORS[0]),w.ansi[1]=g(x.red,s.DEFAULT_ANSI_COLORS[1]),w.ansi[2]=g(x.green,s.DEFAULT_ANSI_COLORS[2]),w.ansi[3]=g(x.yellow,s.DEFAULT_ANSI_COLORS[3]),w.ansi[4]=g(x.blue,s.DEFAULT_ANSI_COLORS[4]),w.ansi[5]=g(x.magenta,s.DEFAULT_ANSI_COLORS[5]),w.ansi[6]=g(x.cyan,s.DEFAULT_ANSI_COLORS[6]),w.ansi[7]=g(x.white,s.DEFAULT_ANSI_COLORS[7]),w.ansi[8]=g(x.brightBlack,s.DEFAULT_ANSI_COLORS[8]),w.ansi[9]=g(x.brightRed,s.DEFAULT_ANSI_COLORS[9]),w.ansi[10]=g(x.brightGreen,s.DEFAULT_ANSI_COLORS[10]),w.ansi[11]=g(x.brightYellow,s.DEFAULT_ANSI_COLORS[11]),w.ansi[12]=g(x.brightBlue,s.DEFAULT_ANSI_COLORS[12]),w.ansi[13]=g(x.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),w.ansi[14]=g(x.brightCyan,s.DEFAULT_ANSI_COLORS[14]),w.ansi[15]=g(x.brightWhite,s.DEFAULT_ANSI_COLORS[15]),x.extendedAnsi){let E=Math.min(w.ansi.length-16,x.extendedAnsi.length);for(let P=0;P<E;P++)w.ansi[P+16]=g(x.extendedAnsi[P],s.DEFAULT_ANSI_COLORS[P+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 g(x,w){if(x!==void 0)try{return _.css.toColor(x)}catch{}return w}s.ThemeService=S=a([d(0,p.IOptionsService)],S)},6349:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let a=o(8460),d=o(844);class l extends d.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 p=0;p<Math.min(m,this.length);p++)y[p]=this._array[this._getCyclicIndex(p)];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,...p){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+p.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<p.length;c++)this._array[this._getCyclicIndex(m+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:m,amount:p.length}),this._length+p.length>this._maxLength){let c=this._length+p.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=p.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,p){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let u=y-1;u>=0;u--)this.set(m+u+p,this.get(m+u));let c=m+y+p-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<y;c++)this.set(m+c+p,this.get(m+c))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}s.CircularList=l},1439:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(a,d=5){if(typeof a!="object")return a;let l=Array.isArray(a)?[]:{};for(let _ in a)l[_]=d<=1?a[_]:a[_]&&o(a[_],d-1);return l}},8055:(n,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 o=0,a=0,d=0,l=0;var _,m,y,p,c;function u(f){let v=f.toString(16);return v.length<2?"0"+v:v}function h(f,v){return f<v?(v+.05)/(f+.05):(f+.05)/(v+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(v,S,g,x){return x!==void 0?`#${u(v)}${u(S)}${u(g)}${u(x)}`:`#${u(v)}${u(S)}${u(g)}`},f.toRgba=function(v,S,g,x=255){return(v<<24|S<<16|g<<8|x)>>>0},f.toColor=function(v,S,g,x){return{css:f.toCss(v,S,g,x),rgba:f.toRgba(v,S,g,x)}}})(_||(s.channels=_={})),(function(f){function v(S,g){return l=Math.round(255*g),[o,a,d]=c.toChannels(S.rgba),{css:_.toCss(o,a,d,l),rgba:_.toRgba(o,a,d,l)}}f.blend=function(S,g){if(l=(255&g.rgba)/255,l===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,w=g.rgba>>16&255,E=g.rgba>>8&255,P=S.rgba>>24&255,O=S.rgba>>16&255,F=S.rgba>>8&255;return o=P+Math.round((x-P)*l),a=O+Math.round((w-O)*l),d=F+Math.round((E-F)*l),{css:_.toCss(o,a,d),rgba:_.toRgba(o,a,d)}},f.isOpaque=function(S){return(255&S.rgba)==255},f.ensureContrastRatio=function(S,g,x){let w=c.ensureContrastRatio(S.rgba,g.rgba,x);if(w)return _.toColor(w>>24&255,w>>16&255,w>>8&255)},f.opaque=function(S){let g=(255|S.rgba)>>>0;return[o,a,d]=c.toChannels(g),{css:_.toCss(o,a,d),rgba:g}},f.opacity=v,f.multiplyOpacity=function(S,g){return l=255&S.rgba,v(S,l*g/255)},f.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(m||(s.color=m={})),(function(f){let v,S;try{let g=document.createElement("canvas");g.width=1,g.height=1;let x=g.getContext("2d",{willReadFrequently:!0});x&&(v=x,v.globalCompositeOperation="copy",S=v.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return o=parseInt(g.slice(1,2).repeat(2),16),a=parseInt(g.slice(2,3).repeat(2),16),d=parseInt(g.slice(3,4).repeat(2),16),_.toColor(o,a,d);case 5:return o=parseInt(g.slice(1,2).repeat(2),16),a=parseInt(g.slice(2,3).repeat(2),16),d=parseInt(g.slice(3,4).repeat(2),16),l=parseInt(g.slice(4,5).repeat(2),16),_.toColor(o,a,d,l);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}let x=g.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 o=parseInt(x[1]),a=parseInt(x[2]),d=parseInt(x[3]),l=Math.round(255*(x[5]===void 0?1:parseFloat(x[5]))),_.toColor(o,a,d,l);if(!v||!S)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=S,v.fillStyle=g,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[o,a,d,l]=v.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(o,a,d,l),css:g}}})(y||(s.css=y={})),(function(f){function v(S,g,x){let w=S/255,E=g/255,P=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*(P<=.03928?P/12.92:Math.pow((P+.055)/1.055,2.4))}f.relativeLuminance=function(S){return v(S>>16&255,S>>8&255,255&S)},f.relativeLuminance2=v})(p||(s.rgb=p={})),(function(f){function v(g,x,w){let E=g>>24&255,P=g>>16&255,O=g>>8&255,F=x>>24&255,A=x>>16&255,V=x>>8&255,B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));for(;B<w&&(F>0||A>0||V>0);)F-=Math.max(0,Math.ceil(.1*F)),A-=Math.max(0,Math.ceil(.1*A)),V-=Math.max(0,Math.ceil(.1*V)),B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));return(F<<24|A<<16|V<<8|255)>>>0}function S(g,x,w){let E=g>>24&255,P=g>>16&255,O=g>>8&255,F=x>>24&255,A=x>>16&255,V=x>>8&255,B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));for(;B<w&&(F<255||A<255||V<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),A=Math.min(255,A+Math.ceil(.1*(255-A))),V=Math.min(255,V+Math.ceil(.1*(255-V))),B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));return(F<<24|A<<16|V<<8|255)>>>0}f.blend=function(g,x){if(l=(255&x)/255,l===1)return x;let w=x>>24&255,E=x>>16&255,P=x>>8&255,O=g>>24&255,F=g>>16&255,A=g>>8&255;return o=O+Math.round((w-O)*l),a=F+Math.round((E-F)*l),d=A+Math.round((P-A)*l),_.toRgba(o,a,d)},f.ensureContrastRatio=function(g,x,w){let E=p.relativeLuminance(g>>8),P=p.relativeLuminance(x>>8);if(h(E,P)<w){if(P<E){let A=v(g,x,w),V=h(E,p.relativeLuminance(A>>8));if(V<w){let B=S(g,x,w);return V>h(E,p.relativeLuminance(B>>8))?A:B}return A}let O=S(g,x,w),F=h(E,p.relativeLuminance(O>>8));if(F<w){let A=v(g,x,w);return F>h(E,p.relativeLuminance(A>>8))?O:A}return O}},f.reduceLuminance=v,f.increaseLuminance=S,f.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]}})(c||(s.rgba=c={})),s.toPaddedHex=u,s.contrastRatio=h},8969:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let a=o(844),d=o(2585),l=o(4348),_=o(7866),m=o(744),y=o(7302),p=o(6975),c=o(8460),u=o(1753),h=o(1480),f=o(7994),v=o(9282),S=o(5435),g=o(5981),x=o(2660),w=!1;class E extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((O=>{this._onScrollApi?.fire(O.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(O){for(let F in O)this.optionsService.options[F]=O[F]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new l.InstantiationService,this.optionsService=this.register(new y.OptionsService(O)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(u.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(x.OscLinkService),this._instantiationService.setService(d.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((F=>{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((F=>{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 g.WriteBuffer(((F,A)=>this._inputHandler.parse(F,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,F){this._writeBuffer.write(O,F)}writeSync(O,F){this._logService.logLevel<=d.LogLevelEnum.WARN&&!w&&(this._logService.warn("writeSync is unreliable and will be removed soon."),w=!0),this._writeBuffer.writeSync(O,F)}input(O,F=!0){this.coreService.triggerDataEvent(O,F)}resize(O,F){isNaN(O)||isNaN(F)||(O=Math.max(O,m.MINIMUM_COLS),F=Math.max(F,m.MINIMUM_ROWS),this._bufferService.resize(O,F))}scroll(O,F=!1){this._bufferService.scroll(O,F)}scrollLines(O,F,A){this._bufferService.scrollLines(O,F,A)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){let F=O-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(O,F){return this._inputHandler.registerEscHandler(O,F)}registerDcsHandler(O,F){return this._inputHandler.registerDcsHandler(O,F)}registerCsiHandler(O,F){return this._inputHandler.registerCsiHandler(O,F)}registerOscHandler(O,F){return this._inputHandler.registerOscHandler(O,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1,F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?O=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let O=[];O.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let F of O)F.dispose()}))}}}s.CoreTerminal=E},8460:(n,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=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===o)return void this._listeners.splice(a,1)}}})),this._event}fire(o,a){let d=[];for(let l=0;l<this._listeners.length;l++)d.push(this._listeners[l]);for(let l=0;l<d.length;l++)d[l].call(void 0,o,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,a){return o((d=>a.fire(d)))},s.runAndSubscribe=function(o,a){return a(void 0),o((d=>a(d)))}},5435:function(n,s,o){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 j=I.length-1;j>=0;j--)(D=I[j])&&(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},d=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=o(2584),_=o(7116),m=o(2015),y=o(844),p=o(482),c=o(8437),u=o(8460),h=o(643),f=o(511),v=o(3734),S=o(2585),g=o(1480),x=o(6242),w=o(6351),E=o(5941),P={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function F(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 B extends y.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,T,D,N,G,j,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=j,this._unicodeService=Y,this._parser=H,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new f.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 u.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new u.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new u.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new u.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new u.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new u.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new u.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new u.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new u.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new u.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new u.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,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:W.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,W,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:W,data:q})})),this._parser.setDcsHandlerFallback(((k,W,q)=>{W==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:W,payload:q})})),this._parser.setPrintHandler(((k,W,q)=>this.print(k,W,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 _.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,W)=>this.requestStatusString(k,W))))}_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,j=this._parseStack.paused;if(j){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>O&&(G=this._parseStack.position+O)}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<O&&(this._parseBuffer=new Uint32Array(Math.min(C.length,O))),j||this._dirtyRowTracker.clearRange(),C.length>O)for(let k=G;k<C.length;k+=O){let W=k+O<C.length?k+O:C.length,q=typeof C=="string"?this._stringDecoder.decode(C.substring(k,W),this._parseBuffer):this._utf8Decoder.decode(C.subarray(k,W),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,q))return this._preserveStack(D,N,q,k),this._logSlowResolvingAsync(T),T}else if(!j){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,j=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,H=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,W=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,W);let $=this._parser.precedingJoinState;for(let X=L;X<T;++X){if(D=C[X],D<127&&G){let me=G[String.fromCharCode(D)];me&&(D=me.charCodeAt(0))}let J=this._unicodeService.charProperties(D,$);N=g.UnicodeService.extractWidth(J);let ce=g.UnicodeService.extractShouldJoin(J),de=ce?g.UnicodeService.extractWidth($):0;if($=J,j&&this._onA11yChar.fire((0,p.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-de>Y){if(H){let me=q,te=this._activeBuffer.x-de;for(this._activeBuffer.x=de,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),de>0&&q instanceof c.BufferLine&&q.copyCellsFrom(me,te,0,de,!1);te<Y;)me.setCellFromCodepoint(te++,0,1,W)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(ce&&this._activeBuffer.x){let me=q.getWidth(this._activeBuffer.x-1)?1:2;q.addCodepointToCell(this._activeBuffer.x-me,D,N);for(let te=N-de;--te>=0;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(k&&(q.insertCells(this._activeBuffer.x,N-de,this._activeBuffer.getNullCell(W)),q.getWidth(Y-1)===2&&q.setCellFromCodepoint(Y-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,W)),q.setCellFromCodepoint(this._activeBuffer.x++,D,N,W),N>0)for(;--N;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=$,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,W),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=>!F(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=g.UnicodeService.extractWidth(L),N=this._activeBuffer.x-D,G=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),j=new Uint32Array(G.length*T),Y=0;for(let k=0;k<G.length;){let W=G.codePointAt(k)||0;j[Y++]=W,k+=W>65535?2:1}let H=Y;for(let k=1;k<T;++k)j.copyWithin(H,0,Y),H+=Y;return this.print(j,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,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let 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:j,cols:Y}=this._bufferService,{active:H,alt:k}=j,W=this._optionsService.rawOptions,q=ce=>ce?1:2,$=C.params[0];return X=$,J=L?$===2?4:$===4?q(G.modes.insertMode):$===12?3:$===20?q(W.convertEol):0:$===1?q(T.applicationCursorKeys):$===3?W.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:$===6?q(T.origin):$===7?q(T.wraparound):$===8?3:$===9?q(D==="X10"):$===12?q(W.cursorBlink):$===25?q(!G.isCursorHidden):$===45?q(T.reverseWraparound):$===66?q(T.applicationKeypad):$===67?4:$===1e3?q(D==="VT200"):$===1002?q(D==="DRAG"):$===1003?q(D==="ANY"):$===1004?q(T.sendFocus):$===1005?4:$===1006?q(N==="SGR"):$===1015?4:$===1016?q(N==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?q(H===k):$===2004?q(T.bracketedPasteMode):0,G.triggerDataEvent(`${l.C0.ESC}[${L?"":"?"}${X};${J}$y`),!0;var X,J}_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 j=C.getSubParams(L+G),Y=0;do D[1]===5&&(N=1),D[G+Y+1+N]=j[Y];while(++Y<j.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 j=2;j<D.length;++j)D[j]===-1&&(D[j]=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(!F(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(z(G))if(N==="?")L.push({type:0,index:G});else{let j=(0,E.parseColor)(N);j&&L.push({type:1,index:G,color:j})}}}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]);z(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,_.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(P[C[0]],_.CHARSETS[C[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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 f.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=B;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 z(I){return 0<=I&&I<256}R=a([d(0,S.IBufferService)],R)},844:(n,s)=>{function o(a){for(let d of a)d.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 d=this._disposables.indexOf(a);d!==-1&&this._disposables.splice(d,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=o,s.getDisposeArrayDisposable=function(a){return{dispose:()=>o(a)}}},1505:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(d,l,_){this._data[d]||(this._data[d]={}),this._data[d][l]=_}get(d,l){return this._data[d]?this._data[d][l]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(a,d,l,_,m){this._data.get(a,d)||this._data.set(a,d,new o),this._data.get(a,d).set(l,_,m)}get(a,d,l,_){return this._data.get(a,d)?.get(l,_)}clear(){this._data.clear()}}},6114:(n,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 o=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;let d=o.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[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(o)},6106:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(o=this._search(this._getKey(a)),this._array.splice(o,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let d=this._getKey(a);if(d===void 0||(o=this._search(d),o===-1)||this._getKey(this._array[o])!==d)return!1;do if(this._array[o]===a)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===d);return!1}*getKeyIterator(a){if(this._array.length!==0&&(o=this._search(a),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===a))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===a)}forEachByKey(a,d){if(this._array.length!==0&&(o=this._search(a),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===a))do d(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===a)}values(){return[...this._array].values()}_search(a){let d=0,l=this._array.length-1;for(;l>=d;){let _=d+l>>1,m=this._getKey(this._array[_]);if(m>a)l=_-1;else{if(!(m<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}d=_+1}}return d}}},7226:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let a=o(6114);class d{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,p=0,c=m.timeRemaining(),u=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),p=Math.max(y,p),u=m.timeRemaining(),1.5*p>u)return c-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-y))}ms`),void this._start();c=u}this.clear()}}class l extends d{_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 d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:l,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let a=o(643);s.updateWindowsModeWrappedState=function(d){let l=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),_=l?.get(d.cols-1),m=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);m&&_&&(m.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{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 o;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=o;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,_=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=_}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let a=o(6349),d=o(7226),l=o(3734),_=o(8437),m=o(4634),y=o(511),p=o(643),c=o(4863),u=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(h,f,v){this._hasScrollback=h,this._optionsService=f,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=u.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.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,f){return new _.BufferLine(this._bufferService.cols,this.getNullCell(h),f)}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 f=h+this._optionsService.rawOptions.scrollback;return f>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:f}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=_.DEFAULT_ATTR_DATA);let f=this._rows;for(;f--;)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,f){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),S=0,g=this._getCorrectBufferLength(f);if(g>this.lines.maxLength&&(this.lines.maxLength=g),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<f)for(let w=this._rows;w<f;w++)this.lines.length<f+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(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 _.BufferLine(h,v)));else for(let w=this._rows;w>f;w--)this.lines.length>f+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(g<this.lines.maxLength){let w=this.lines.length-g;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=g}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,f-1),x&&(this.y+=x),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=f-1,this._isReflowEnabled&&(this._reflow(h,f),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=f,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 f=0;for(;this._memoryCleanupPosition<this.lines.length;)if(f+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),f>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,f){this._cols!==h&&(h>this._cols?this._reflowLarger(h,f):this._reflowSmaller(h,f))}_reflowLarger(h,f){let v=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(_.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,f,S.countRemoved)}}_reflowLargerAdjustViewport(h,f,v){let S=this.getNullCell(_.DEFAULT_ATTR_DATA),g=v;for(;g-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<f&&this.lines.push(new _.BufferLine(h,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(h,f){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),S=[],g=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 P=this.ybase+this.y;if(P>=x&&P<x+E.length)continue;let O=E[E.length-1].getTrimmedLength(),F=(0,m.reflowSmallerGetNewLineLengths)(E,this._cols,h),A=F.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 B=[];for(let T=0;T<A;T++){let D=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(D)}B.length>0&&(S.push({start:x+E.length+g,newLines:B}),g+=B.length),E.push(...B);let R=F.length-1,z=F[R];z===0&&(R--,z=F[R]);let I=E.length-A-1,C=O;for(;I>=0;){let T=Math.min(C,z);if(E[R]===void 0)break;if(E[R].copyCellsFrom(E[I],C-T,z-T,T,!0),z-=T,z===0&&(R--,z=F[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++)F[T]<h&&E[T].setCell(F[T],v);let L=A-V;for(;L-- >0;)this.ybase===0?this.y<f-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+g)-f&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+f-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,P=E-1,O=0,F=S[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+g);let A=0;for(let R=Math.min(this.lines.maxLength-1,E+g-1);R>=0;R--)if(F&&F.start>P+A){for(let z=F.newLines.length-1;z>=0;z--)this.lines.set(R--,F.newLines[z]);R++,x.push({index:P+1,amount:F.newLines.length}),A+=F.newLines.length,F=S[++O]}else this.lines.set(R,w[P--]);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 B=Math.max(0,E+g-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(h,f,v=0,S){let g=this.lines.get(h);return g?g.translateToString(f,v,S):""}getWrappedRangeForLine(h){let f=h,v=h;for(;f>0&&this.lines.get(f).isWrapped;)f--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:f,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 f=0;f<this.markers.length;f++)this.markers[f].line===h&&(this.markers[f].dispose(),this.markers.splice(f--,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 f=new c.Marker(h);return this.markers.push(f),f.register(this.lines.onTrim((v=>{f.line-=v,f.line<0&&f.dispose()}))),f.register(this.lines.onInsert((v=>{f.line>=v.index&&(f.line+=v.amount)}))),f.register(this.lines.onDelete((v=>{f.line>=v.index&&f.line<v.index+v.amount&&f.dispose(),f.line>v.index&&(f.line-=v.amount)}))),f.register(f.onDispose((()=>this._removeMarker(f)))),f}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let a=o(3734),d=o(511),l=o(643),_=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let m=0;class y{constructor(c,u,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let f=u||d.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,f);this.length=c}get(c){let u=this._data[3*c+0],h=2097151&u;return[this._data[3*c+1],2097152&u?this._combined[c]:h?(0,_.stringFromCodePoint)(h):"",u>>22,2097152&u?this._combined[c].charCodeAt(this._combined[c].length-1):h]}set(c,u){this._data[3*c+1]=u[l.CHAR_DATA_ATTR_INDEX],u[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=u[1],this._data[3*c+0]=2097152|c|u[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=u[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[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 u=this._data[3*c+0];return 2097152&u?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&u}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let u=this._data[3*c+0];return 2097152&u?this._combined[c]:2097151&u?(0,_.stringFromCodePoint)(2097151&u):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,u){return m=3*c,u.content=this._data[m+0],u.fg=this._data[m+1],u.bg=this._data[m+2],2097152&u.content&&(u.combinedData=this._combined[c]),268435456&u.bg&&(u.extended=this._extendedAttrs[c]),u}setCell(c,u){2097152&u.content&&(this._combined[c]=u.combinedData),268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=u.content,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}setCellFromCodepoint(c,u,h,f){268435456&f.bg&&(this._extendedAttrs[c]=f.extended),this._data[3*c+0]=u|h<<22,this._data[3*c+1]=f.fg,this._data[3*c+2]=f.bg}addCodepointToCell(c,u,h){let f=this._data[3*c+0];2097152&f?this._combined[c]+=(0,_.stringFromCodePoint)(u):2097151&f?(this._combined[c]=(0,_.stringFromCodePoint)(2097151&f)+(0,_.stringFromCodePoint)(u),f&=-2097152,f|=2097152):f=u|4194304,h&&(f&=-12582913,f|=h<<22),this._data[3*c+0]=f}insertCells(c,u,h){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),u<this.length-c){let f=new d.CellData;for(let v=this.length-c-u-1;v>=0;--v)this.setCell(c+u+v,this.loadCell(c+v,f));for(let v=0;v<u;++v)this.setCell(c+v,h)}else for(let f=c;f<this.length;++f)this.setCell(f,h);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,h)}deleteCells(c,u,h){if(c%=this.length,u<this.length-c){let f=new d.CellData;for(let v=0;v<this.length-c-u;++v)this.setCell(c+v,this.loadCell(c+u+v,f));for(let v=this.length-u;v<this.length;++v)this.setCell(v,h)}else for(let f=c;f<this.length;++f)this.setCell(f,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,u,h,f=!1){if(f)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,h),u<this.length&&this.getWidth(u-1)===2&&!this.isProtected(u)&&this.setCellFromCodepoint(u,0,1,h);c<u&&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),u<this.length&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u,0,1,h);c<u&&c<this.length;)this.setCell(c++,h)}resize(c,u){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 f=new Uint32Array(h);f.set(this._data),this._data=f}for(let f=this.length;f<c;++f)this.setCell(f,u)}else{this._data=this._data.subarray(0,h);let f=Object.keys(this._combined);for(let S=0;S<f.length;S++){let g=parseInt(f[S],10);g>=c&&delete this._combined[g]}let v=Object.keys(this._extendedAttrs);for(let S=0;S<v.length;S++){let g=parseInt(v[S],10);g>=c&&delete this._extendedAttrs[g]}}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,u=!1){if(u)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 u in c._combined)this._combined[u]=c._combined[u];this._extendedAttrs={};for(let u in c._extendedAttrs)this._extendedAttrs[u]=c._extendedAttrs[u];this.isWrapped=c.isWrapped}clone(){let c=new y(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let u in this._combined)c._combined[u]=this._combined[u];for(let u in this._extendedAttrs)c._extendedAttrs[u]=this._extendedAttrs[u];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,u,h,f,v){let S=c._data;if(v)for(let x=f-1;x>=0;x--){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(u+x)+w];268435456&S[3*(u+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[u+x])}else for(let x=0;x<f;x++){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(u+x)+w];268435456&S[3*(u+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[u+x])}let g=Object.keys(c._combined);for(let x=0;x<g.length;x++){let w=parseInt(g[x],10);w>=u&&(this._combined[w-u+h]=c._combined[w])}}translateToString(c,u,h,f){u=u??0,h=h??this.length,c&&(h=Math.min(h,this.getTrimmedLength())),f&&(f.length=0);let v="";for(;u<h;){let S=this._data[3*u+0],g=2097151&S,x=2097152&S?this._combined[u]:g?(0,_.stringFromCodePoint)(g):l.WHITESPACE_CELL_CHAR;if(v+=x,f)for(let w=0;w<x.length;++w)f.push(u);u+=S>>22||1}return f&&f.push(u),v}}s.BufferLine=y},4841:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,a){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return a*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(n,s)=>{function o(a,d,l){if(d===a.length-1)return a[d].getTrimmedLength();let _=!a[d].hasContent(l-1)&&a[d].getWidth(l-1)===1,m=a[d+1].getWidth(0)===2;return _&&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,d,l,_,m){let y=[];for(let p=0;p<a.length-1;p++){let c=p,u=a.get(++c);if(!u.isWrapped)continue;let h=[a.get(p)];for(;c<a.length&&u.isWrapped;)h.push(u),u=a.get(++c);if(_>=p&&_<c){p+=h.length-1;continue}let f=0,v=o(h,f,d),S=1,g=0;for(;S<h.length;){let w=o(h,S,d),E=w-g,P=l-v,O=Math.min(E,P);h[f].copyCellsFrom(h[S],g,v,O,!1),v+=O,v===l&&(f++,v=0),g+=O,g===w&&(S++,g=0),v===0&&f!==0&&h[f-1].getWidth(l-1)===2&&(h[f].copyCellsFrom(h[f-1],l-1,v++,1,!1),h[f-1].setCell(l-1,m))}h[f].replaceCells(v,l,m);let x=0;for(let w=h.length-1;w>0&&(w>f||h[w].getTrimmedLength()===0);w--)x++;x>0&&(y.push(p+h.length-x),y.push(x)),p+=h.length-1}return y},s.reflowLargerCreateNewLayout=function(a,d){let l=[],_=0,m=d[_],y=0;for(let p=0;p<a.length;p++)if(m===p){let c=d[++_];a.onDeleteEmitter.fire({index:p-y,amount:c}),p+=c-1,y+=c,m=d[++_]}else l.push(p);return{layout:l,countRemoved:y}},s.reflowLargerApplyNewLayout=function(a,d){let l=[];for(let _=0;_<d.length;_++)l.push(a.get(d[_]));for(let _=0;_<l.length;_++)a.set(_,l[_]);a.length=d.length},s.reflowSmallerGetNewLineLengths=function(a,d,l){let _=[],m=a.map(((u,h)=>o(a,h,d))).reduce(((u,h)=>u+h)),y=0,p=0,c=0;for(;c<m;){if(m-c<l){_.push(m-c);break}y+=l;let u=o(a,p,d);y>u&&(y-=u,p++);let h=a[p].getWidth(y-1)===2;h&&y--;let f=h?l-1:l;_.push(f),c+=f}return _},s.getWrappedLineTrimmedLength=o},5295:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let a=o(8460),d=o(844),l=o(9092);class _ extends d.Disposable{constructor(y,p){super(),this._optionsService=y,this._bufferService=p,this._onBufferActivate=this.register(new a.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new 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,p){this._normal.resize(y,p),this._alt.resize(y,p),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=_},511:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let a=o(482),d=o(643),l=o(3734);class _ 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 p=new _;return p.setFromCharData(y),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(y[d.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(y[d.CHAR_DATA_CHAR_INDEX].length===2){let c=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let u=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=u&&u<=57343?this.content=1024*(c-55296)+u-56320+65536|y[d.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=y[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=_},643:(n,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:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let a=o(8460),d=o(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,d.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}s.Marker=l,l._nextId=1},7116:(n,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:(n,s)=>{var o,a,d;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"})(o||(s.C0=o={})),(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=`${o.ESC}\\`})(d||(s.C1_ESCAPED=d={}))},7399:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let a=o(2584),d={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,_,m,y){let p={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"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=l.ctrlKey?"\b":a.C0.DEL,l.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(l.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=l.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,l.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(m?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(m?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"A",m||p.key!==a.C0.ESC+"[1;3A"||(p.key=a.C0.ESC+"[1;5A")):p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"B",m||p.key!==a.C0.ESC+"[1;3B"||(p.key=a.C0.ESC+"[1;5B")):p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(p.key=a.C0.ESC+"[2~");break;case 46:p.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:p.key=c?a.C0.ESC+"[1;"+(c+1)+"H":_?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:p.key=c?a.C0.ESC+"[1;"+(c+1)+"F":_?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:l.shiftKey?p.type=2:l.ctrlKey?p.key=a.C0.ESC+"[5;"+(c+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:l.shiftKey?p.type=3:l.ctrlKey?p.key=a.C0.ESC+"[6;"+(c+1)+"~":p.key=a.C0.ESC+"[6~";break;case 112:p.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:p.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:p.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:p.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:p.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:p.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:p.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:p.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:p.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:p.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:p.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:p.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!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?p.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(p.key=a.C0.US),l.key==="@"&&(p.key=a.C0.NUL)):l.keyCode===65&&(p.type=1);else{let u=d[l.keyCode],h=u?.[l.shiftKey?1:0];if(h)p.key=a.C0.ESC+h;else if(l.keyCode>=65&&l.keyCode<=90){let f=l.ctrlKey?l.keyCode-64:l.keyCode+32,v=String.fromCharCode(f);l.shiftKey&&(v=v.toUpperCase()),p.key=a.C0.ESC+v}else if(l.keyCode===32)p.key=a.C0.ESC+(l.ctrlKey?a.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let f=l.code.slice(3,4);l.shiftKey||(f=f.toLowerCase()),p.key=a.C0.ESC+f,p.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?p.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?p.key=a.C0.NUL:l.keyCode>=51&&l.keyCode<=55?p.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?p.key=a.C0.DEL:l.keyCode===219?p.key=a.C0.ESC:l.keyCode===220?p.key=a.C0.FS:l.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,a=0,d=o.length){let l="";for(let _=a;_<d;++_){let m=o[_];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(o,a){let d=o.length;if(!d)return 0;let l=0,_=0;if(this._interim){let m=o.charCodeAt(_++);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=_;m<d;++m){let y=o.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=d)return this._interim=y,l;let p=o.charCodeAt(m);56320<=p&&p<=57343?a[l++]=1024*(y-55296)+p-56320+65536:(a[l++]=y,a[l++]=p)}else y!==65279&&(a[l++]=y)}return l}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,a){let d=o.length;if(!d)return 0;let l,_,m,y,p=0,c=0,u=0;if(this.interim[0]){let v=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let g,x=0;for(;(g=63&this.interim[++x])&&x<4;)S<<=6,S|=g;let w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=w-x;for(;u<E;){if(u>=d)return 0;if(g=o[u++],(192&g)!=128){u--,v=!0;break}this.interim[x++]=g,S<<=6,S|=63&g}v||(w===2?S<128?u--:a[p++]=S:w===3?S<2048||S>=55296&&S<=57343||S===65279||(a[p++]=S):S<65536||S>1114111||(a[p++]=S)),this.interim.fill(0)}let h=d-4,f=u;for(;f<d;){for(;!(!(f<h)||128&(l=o[f])||128&(_=o[f+1])||128&(m=o[f+2])||128&(y=o[f+3]));)a[p++]=l,a[p++]=_,a[p++]=m,a[p++]=y,f+=4;if(l=o[f++],l<128)a[p++]=l;else if((224&l)==192){if(f>=d)return this.interim[0]=l,p;if(_=o[f++],(192&_)!=128){f--;continue}if(c=(31&l)<<6|63&_,c<128){f--;continue}a[p++]=c}else if((240&l)==224){if(f>=d)return this.interim[0]=l,p;if(_=o[f++],(192&_)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,p;if(m=o[f++],(192&m)!=128){f--;continue}if(c=(15&l)<<12|(63&_)<<6|63&m,c<2048||c>=55296&&c<=57343||c===65279)continue;a[p++]=c}else if((248&l)==240){if(f>=d)return this.interim[0]=l,p;if(_=o[f++],(192&_)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,p;if(m=o[f++],(192&m)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,this.interim[2]=m,p;if(y=o[f++],(192&y)!=128){f--;continue}if(c=(7&l)<<18|(63&_)<<12|(63&m)<<6|63&y,c<65536||c>1114111)continue;a[p++]=c}}return p}}},225:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let a=o(1480),d=[[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]],_;s.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let m=0;m<d.length;++m)_.fill(0,d[m][0],d[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?_[m]:(function(y,p){let c,u=0,h=p.length-1;if(y<p[0][0]||y>p[h][1])return!1;for(;h>=u;)if(c=u+h>>1,y>p[c][1])u=c+1;else{if(!(y<p[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 p=this.wcwidth(m),c=p===0&&y!==0;if(c){let u=a.UnicodeService.extractWidth(y);u===0?c=!1:u>p&&(p=u)}return a.UnicodeService.createPropertyValue(0,p,c)}}},5981:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let a=o(8460),d=o(844);class l extends d.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 p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(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 p=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],u=this._action(c,y);if(u){let f=v=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(p,v);return void u.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(f)}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-p>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}s.WriteBuffer=l},5941:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let o=/^([\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 d(l,_){let m=l.toString(16),y=m.length<2?"0"+m:m;switch(_){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 _=l.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let m=o.exec(_);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(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let m=_.length/3,y=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(_.slice(m*p,m*p+m),16);y[p]=m===1?c<<4:m===2?c:m===3?c>>4:c>>8}return y}},s.toRgbString=function(l,_=16){let[m,y,p]=l;return`rgb:${d(m,_)}/${d(y,_)}/${d(p,_)}`}},5770:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let a=o(482),d=o(8742),l=o(5770),_=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(y,p){this._handlers[y]===void 0&&(this._handlers[y]=[]);let c=this._handlers[y];return c.push(p),{dispose:()=>{let u=c.indexOf(p);u!==-1&&c.splice(u,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=_,this._ident=0}hook(y,p){if(this.reset(),this._ident=y,this._active=this._handlers[y]||_,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(y,p,c){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(y,p,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(y,p,c))}unhook(y,p=!0){if(this._active.length){let c=!1,u=this._active.length-1,h=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,c=p,h=this._stack.fallThrough,this._stack.paused=!1),!h&&c===!1){for(;u>=0&&(c=this._active[u].unhook(y),c!==!0);u--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,c;u--}for(;u>=0;u--)if(c=this._active[u].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",y);this._active=_,this._ident=0}};let m=new d.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,p,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(y,p,c),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let p=!1;if(this._hitLimit)p=!1;else if(y&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=m,this._data="",this._hitLimit=!1,c)));return this._params=m,this._data="",this._hitLimit=!1,p}}},2015:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let a=o(844),d=o(8742),l=o(6242),_=o(6351);class m{constructor(u){this.table=new Uint8Array(u)}setDefault(u,h){this.table.fill(u<<4|h)}add(u,h,f,v){this.table[h<<8|u]=f<<4|v}addMany(u,h,f,v){for(let S=0;S<u.length;S++)this.table[h<<8|u[S]]=f<<4|v}}s.TransitionTable=m;let y=160;s.VT500_TRANSITION_TABLE=(function(){let c=new m(4095),u=Array.apply(null,Array(256)).map(((x,w)=>w)),h=(x,w)=>u.slice(x,w),f=h(32,127),v=h(0,24);v.push(25),v.push.apply(v,h(28,32));let S=h(0,14),g;for(g in c.setDefault(1,0),c.addMany(f,0,2,0),S)c.addMany([24,26,153,154],g,3,0),c.addMany(h(128,144),g,3,0),c.addMany(h(144,152),g,3,0),c.add(156,g,0,0),c.add(27,g,11,1),c.add(157,g,4,8),c.addMany([152,158,159],g,0,7),c.add(155,g,11,3),c.add(144,g,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(f,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(f,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(f,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 p extends a.Disposable{constructor(u=s.VT500_TRANSITION_TABLE){super(),this._transitions=u,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(h,f,v)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,f)=>{},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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(u,h=[64,126]){let f=0;if(u.prefix){if(u.prefix.length>1)throw new Error("only one byte as prefix supported");if(f=u.prefix.charCodeAt(0),f&&60>f||f>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(u.intermediates){if(u.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<u.intermediates.length;++S){let g=u.intermediates.charCodeAt(S);if(32>g||g>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");f<<=8,f|=g}}if(u.final.length!==1)throw new Error("final must be a single byte");let v=u.final.charCodeAt(0);if(h[0]>v||v>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return f<<=8,f|=v,f}identToString(u){let h=[];for(;u;)h.push(String.fromCharCode(255&u)),u>>=8;return h.reverse().join("")}setPrintHandler(u){this._printHandler=u}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(u,h){let f=this._identifier(u,[48,126]);this._escHandlers[f]===void 0&&(this._escHandlers[f]=[]);let v=this._escHandlers[f];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearEscHandler(u){this._escHandlers[this._identifier(u,[48,126])]&&delete this._escHandlers[this._identifier(u,[48,126])]}setEscHandlerFallback(u){this._escHandlerFb=u}setExecuteHandler(u,h){this._executeHandlers[u.charCodeAt(0)]=h}clearExecuteHandler(u){this._executeHandlers[u.charCodeAt(0)]&&delete this._executeHandlers[u.charCodeAt(0)]}setExecuteHandlerFallback(u){this._executeHandlerFb=u}registerCsiHandler(u,h){let f=this._identifier(u);this._csiHandlers[f]===void 0&&(this._csiHandlers[f]=[]);let v=this._csiHandlers[f];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearCsiHandler(u){this._csiHandlers[this._identifier(u)]&&delete this._csiHandlers[this._identifier(u)]}setCsiHandlerFallback(u){this._csiHandlerFb=u}registerDcsHandler(u,h){return this._dcsParser.registerHandler(this._identifier(u),h)}clearDcsHandler(u){this._dcsParser.clearHandler(this._identifier(u))}setDcsHandlerFallback(u){this._dcsParser.setHandlerFallback(u)}registerOscHandler(u,h){return this._oscParser.registerHandler(u,h)}clearOscHandler(u){this._oscParser.clearHandler(u)}setOscHandlerFallback(u){this._oscParser.setHandlerFallback(u)}setErrorHandler(u){this._errorHandler=u}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(u,h,f,v,S){this._parseStack.state=u,this._parseStack.handlers=h,this._parseStack.handlerPos=f,this._parseStack.transition=v,this._parseStack.chunkPos=S}parse(u,h,f){let v,S=0,g=0,x=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,x=this._parseStack.chunkPos+1;else{if(f===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(f===!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(f===!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=u[this._parseStack.chunkPos],v=this._dcsParser.unhook(S!==24&&S!==26,f),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=u[this._parseStack.chunkPos],v=this._oscParser.end(S!==24&&S!==26,f),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=u[w],g=this._transitions.table[this.currentState<<8|(S<160?S:y)],g>>4){case 2:for(let A=w+1;;++A){if(A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,w,A),w=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,w,A),w=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,w,A),w=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,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],P=E?E.length-1:-1;for(;P>=0&&(v=E[P](this._params),v!==!0);P--)if(v instanceof Promise)return this._preserveStack(3,E,P,g,w),v;P<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=u[w])>47&&S<60);w--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:let O=this._escHandlers[this._collect<<8|S],F=O?O.length-1:-1;for(;F>=0&&(v=O[F](),v!==!0);F--)if(v instanceof Promise)return this._preserveStack(4,O,F,g,w),v;F<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=u[A])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(u,w,A),w=A-1;break}break;case 14:if(v=this._dcsParser.unhook(S!==24&&S!==26),v)return this._preserveStack(6,[],0,g,w),v;S===27&&(g|=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=u[A])<32||S>127&&S<y){this._oscParser.put(u,w,A),w=A-1;break}break;case 6:if(v=this._oscParser.end(S!==24&&S!==26),v)return this._preserveStack(5,[],0,g,w),v;S===27&&(g|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&g}}}s.EscapeSequenceParser=p},6242:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let a=o(5770),d=o(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(_,m){this._handlers[_]===void 0&&(this._handlers[_]=[]);let y=this._handlers[_];return y.push(m),{dispose:()=>{let p=y.indexOf(m);p!==-1&&y.splice(p,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,m,y){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,m,y);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(_,m,y))}start(){this.reset(),this._state=1}put(_,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){let p=_[m++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&y-m>0&&this._put(_,m,y)}}end(_,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,y=m,c=this._stack.fallThrough,this._stack.paused=!1),!c&&y===!1){for(;p>=0&&(y=this._active[p].end(_),y!==!0);p--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,y;p--}for(;p>=0;p--)if(y=this._active[p].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",_);this._active=l,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,m,y){this._hitLimit||(this._data+=(0,d.utf32ToString)(_,m,y),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let m=!1;if(this._hitLimit)m=!1;else if(_&&(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:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let o=2147483647;class a{static fromArray(l){let _=new a;if(!l.length)return _;for(let m=Array.isArray(l[0])?1:0;m<l.length;++m){let y=l[m];if(Array.isArray(y))for(let p=0;p<y.length;++p)_.addSubParam(y[p]);else _.addParam(y)}return _}constructor(l=32,_=32){if(this.maxLength=l,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(_),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 _=0;_<this.length;++_){l.push(this.params[_]);let m=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];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>o?o: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>o?o:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){let _=this._subParamsIdx[l]>>8,m=255&this._subParamsIdx[l];return m-_>0?this._subParams.subarray(_,m):null}getSubParamsAll(){let l={};for(let _=0;_<this.length;++_){let m=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];y-m>0&&(l[_]=this._subParams.slice(m,y))}return l}addDigit(l){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let m=this._digitIsSub?this._subParams:this.params,y=m[_-1];m[_-1]=~y?Math.min(10*y+l,o):l}}s.Params=a},5741:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,a){let d={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(d),a.dispose=()=>this._wrappedAddonDispose(d),a.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let a=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===o){a=d;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(a,1)}}},8771:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let a=o(3785),d=o(511);s.BufferApiView=class{constructor(l,_){this._buffer=l,this.type=_}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 _=this._buffer.lines.get(l);if(_)return new a.BufferLineApiView(_)}getNullCell(){return new d.CellData}}},3785:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let a=o(511);s.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,l){if(!(d<0||d>=this._line.length))return l?(this._line.loadCell(d,l),l):this._line.loadCell(d,new a.CellData)}translateToString(d,l,_){return this._line.translateToString(d,l,_)}}},8285:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let a=o(8771),d=o(8460),l=o(844);class _ extends l.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new d.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=_},7975:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,a){return this._core.registerCsiHandler(o,(d=>a(d.toArray())))}addCsiHandler(o,a){return this.registerCsiHandler(o,a)}registerDcsHandler(o,a){return this._core.registerDcsHandler(o,((d,l)=>a(d,l.toArray())))}addDcsHandler(o,a){return this.registerDcsHandler(o,a)}registerEscHandler(o,a){return this._core.registerEscHandler(o,a)}addEscHandler(o,a){return this.registerEscHandler(o,a)}registerOscHandler(o,a){return this._core.registerOscHandler(o,a)}addOscHandler(o,a){return this.registerOscHandler(o,a)}}},7090:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(n,s,o){var a=this&&this.__decorate||function(c,u,h,f){var v,S=arguments.length,g=S<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(c,u,h,f);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(g=(S<3?v(g):S>3?v(u,h,g):v(u,h))||g);return S>3&&g&&Object.defineProperty(u,h,g),g},d=this&&this.__param||function(c,u){return function(h,f){u(h,f,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let l=o(8460),_=o(844),m=o(5295),y=o(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let p=s.BufferService=class extends _.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,u){this.cols=c,this.rows=u,this.buffers.resize(c,u),this._onResize.fire({cols:c,rows:u})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,u=!1){let h=this.buffer,f;f=this._cachedBlankLine,f&&f.length===this.cols&&f.getFg(0)===c.fg&&f.getBg(0)===c.bg||(f=h.getBlankLine(c,u),this._cachedBlankLine=f),f.isWrapped=u;let v=h.ybase+h.scrollTop,S=h.ybase+h.scrollBottom;if(h.scrollTop===0){let g=h.lines.isFull;S===h.lines.length-1?g?h.lines.recycle().copyFrom(f):h.lines.push(f.clone()):h.lines.splice(S+1,0,f.clone()),g?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{let g=S-v+1;h.lines.shiftElements(v+1,g-1,-1),h.lines.set(S,f.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(c,u,h){let f=this.buffer;if(c<0){if(f.ydisp===0)return;this.isUserScrolling=!0}else c+f.ydisp>=f.ybase&&(this.isUserScrolling=!1);let v=f.ydisp;f.ydisp=Math.max(Math.min(f.ydisp+c,f.ybase),0),v!==f.ydisp&&(u||this._onScroll.fire(f.ydisp))}};s.BufferService=p=a([d(0,y.IOptionsService)],p)},7994:(n,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(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,a){this._charsets[o]=a,this.glevel===o&&(this.charset=a)}}},1753:function(n,s,o){var a=this&&this.__decorate||function(f,v,S,g){var x,w=arguments.length,E=w<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,v,S,g);else for(var P=f.length-1;P>=0;P--)(x=f[P])&&(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},d=this&&this.__param||function(f,v){return function(S,g){v(S,g,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let l=o(2585),_=o(8460),m=o(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:f=>f.button!==4&&f.action===1&&(f.ctrl=!1,f.alt=!1,f.shift=!1,!0)},VT200:{events:19,restrict:f=>f.action!==32},DRAG:{events:23,restrict:f=>f.action!==32||f.button!==3},ANY:{events:31,restrict:f=>!0}};function p(f,v){let S=(f.ctrl?16:0)|(f.shift?4:0)|(f.alt?8:0);return f.button===4?(S|=64,S|=f.action):(S|=3&f.button,4&f.button&&(S|=64),8&f.button&&(S|=128),f.action===32?S|=32:f.action!==0||v||(S|=3)),S}let c=String.fromCharCode,u={DEFAULT:f=>{let v=[p(f,!1)+32,f.col+32,f.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${c(v[0])}${c(v[1])}${c(v[2])}`},SGR:f=>{let v=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${p(f,!0)};${f.col};${f.row}${v}`},SGR_PIXELS:f=>{let v=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${p(f,!0)};${f.x};${f.y}${v}`}},h=s.CoreMouseService=class extends m.Disposable{constructor(f,v){super(),this._bufferService=f,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let S of Object.keys(y))this.addProtocol(S,y[S]);for(let S of Object.keys(u))this.addEncoding(S,u[S]);this.reset()}addProtocol(f,v){this._protocols[f]=v}addEncoding(f,v){this._encodings[f]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(f){if(!this._protocols[f])throw new Error(`unknown protocol "${f}"`);this._activeProtocol=f,this._onProtocolChange.fire(this._protocols[f].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(f){if(!this._encodings[f])throw new Error(`unknown encoding "${f}"`);this._activeEncoding=f}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(f){if(f.col<0||f.col>=this._bufferService.cols||f.row<0||f.row>=this._bufferService.rows||f.button===4&&f.action===32||f.button===3&&f.action!==32||f.button!==4&&(f.action===2||f.action===3)||(f.col++,f.row++,f.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,f,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(f))return!1;let v=this._encodings[this._activeEncoding](f);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=f,!0}explainEvents(f){return{down:!!(1&f),up:!!(2&f),drag:!!(4&f),move:!!(8&f),wheel:!!(16&f)}}_equalEvents(f,v,S){if(S){if(f.x!==v.x||f.y!==v.y)return!1}else if(f.col!==v.col||f.row!==v.row)return!1;return f.button===v.button&&f.action===v.action&&f.ctrl===v.ctrl&&f.alt===v.alt&&f.shift===v.shift}};s.CoreMouseService=h=a([d(0,l.IBufferService),d(1,l.ICoreService)],h)},6975:function(n,s,o){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,w=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(w=(x<3?g(w):x>3?g(f,v,w):g(f,v))||w);return x>3&&w&&Object.defineProperty(f,v,w),w},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let l=o(1439),_=o(8460),m=o(844),y=o(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),u=s.CoreService=class extends m.Disposable{constructor(h,f,v){super(),this._bufferService=h,this._logService=f,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,l.clone)(p),this.decPrivateModes=(0,l.clone)(c)}reset(){this.modes=(0,l.clone)(p),this.decPrivateModes=(0,l.clone)(c)}triggerDataEvent(h,f=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;f&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),f&&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((f=>f.charCodeAt(0))))),this._onBinary.fire(h))}};s.CoreService=u=a([d(0,y.IBufferService),d(1,y.ILogService),d(2,y.IOptionsService)],u)},9074:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let a=o(8055),d=o(8460),l=o(844),_=o(6106),m=0,y=0;class p extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((h=>h?.marker.line)),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;let f=new c(h);if(f){let v=f.marker.onDispose((()=>f.dispose()));f.onDispose((()=>{f&&(this._decorations.delete(f)&&this._onDecorationRemoved.fire(f),v.dispose())})),this._decorations.insert(f),this._onDecorationRegistered.fire(f)}return f}reset(){for(let h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,f,v){let S=0,g=0;for(let x of this._decorations.getKeyIterator(f))S=x.options.x??0,g=S+(x.options.width??1),h>=S&&h<g&&(!v||(x.options.layer??"bottom")===v)&&(yield x)}forEachDecorationAtCell(h,f,v,S){this._decorations.forEachByKey(f,(g=>{m=g.options.x??0,y=m+(g.options.width??1),h>=m&&h<y&&(!v||(g.options.layer??"bottom")===v)&&S(g)}))}}s.DecorationService=p;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 d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.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:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let a=o(2585),d=o(8343);class l{constructor(...m){this._entries=new Map;for(let[y,p]of m)this.set(y,p)}set(m,y){let p=this._entries.get(m);return this._entries.set(m,y),p}forEach(m){for(let[y,p]of this._entries.entries())m(y,p)}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(_,m){this._services.set(_,m)}getService(_){return this._services.get(_)}createInstance(_,...m){let y=(0,d.getServiceDependencies)(_).sort(((u,h)=>u.index-h.index)),p=[];for(let u of y){let h=this._services.get(u.id);if(!h)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${u.id}.`);p.push(h)}let c=y.length>0?y[0].index:m.length;if(m.length!==c)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${c+1} conflicts with ${m.length} static arguments`);return new _(...m,...p)}}},7866:function(n,s,o){var a=this&&this.__decorate||function(c,u,h,f){var v,S=arguments.length,g=S<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(c,u,h,f);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(g=(S<3?v(g):S>3?v(u,h,g):v(u,h))||g);return S>3&&g&&Object.defineProperty(u,h,g),g},d=this&&this.__param||function(c,u){return function(h,f){u(h,f,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let l=o(844),_=o(2585),m={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},y,p=s.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let u=0;u<c.length;u++)typeof c[u]=="function"&&(c[u]=c[u]())}_log(c,u,h){this._evalLazyOptionalParams(h),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+u,...h)}trace(c,...u){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,u)}debug(c,...u){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,u)}info(c,...u){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,u)}warn(c,...u){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,u)}error(c,...u){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,u)}};s.LogService=p=a([d(0,_.IOptionsService)],p),s.setTraceLogger=function(c){y=c},s.traceCall=function(c,u,h){if(typeof h.value!="function")throw new Error("not supported");let f=h.value;h.value=function(...v){if(y.logLevel!==_.LogLevelEnum.TRACE)return f.apply(this,v);y.trace(`GlyphRenderer#${f.name}(${v.map((g=>JSON.stringify(g))).join(", ")})`);let S=f.apply(this,v);return y.trace(`GlyphRenderer#${f.name} return`,S),S}}},7302:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let a=o(8460),d=o(844),l=o(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 _=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends d.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let u in p)if(u in c)try{let h=p[u];c[u]=this._sanitizeAndValidateOption(u,h)}catch(h){console.error(h)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,d.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((u=>{u===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((u=>{p.indexOf(u)!==-1&&c()}))}_setupOptions(){let p=u=>{if(!(u in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);return this.rawOptions[u]},c=(u,h)=>{if(!(u in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);h=this._sanitizeAndValidateOption(u,h),this.rawOptions[u]!==h&&(this.rawOptions[u]=h,this._onOptionChange.fire(u))};for(let u in this.rawOptions){let h={get:p.bind(this,u),set:c.bind(this,u)};Object.defineProperty(this.options,u,h)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[p]),!(function(u){return u==="block"||u==="underline"||u==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${p}`);break;case"wordSeparator":c||(c=s.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=_.includes(c)?c:s.DEFAULT_OPTIONS[p];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${p} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${p} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}s.OptionsService=m},2660:function(n,s,o){var a=this&&this.__decorate||function(m,y,p,c){var u,h=arguments.length,f=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(m,y,p,c);else for(var v=m.length-1;v>=0;v--)(u=m[v])&&(f=(h<3?u(f):h>3?u(y,p,f):u(y,p))||f);return h>3&&f&&Object.defineProperty(y,p,f),f},d=this&&this.__param||function(m,y){return function(p,c){y(p,c,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let l=o(2585),_=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 p=m,c=this._getEntryIdKey(p),u=this._entriesWithId.get(c);if(u)return this.addLineToLink(u.id,y.ybase+y.y),u.id;let h=y.addMarker(y.ybase+y.y),f={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(f,h))),this._entriesWithId.set(f.key,f),this._dataByLinkId.set(f.id,f),f.id}addLineToLink(m,y){let p=this._dataByLinkId.get(m);if(p&&p.lines.every((c=>c.line!==y))){let c=this._bufferService.buffer.addMarker(y);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(m){return this._dataByLinkId.get(m)?.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){let p=m.lines.indexOf(y);p!==-1&&(m.lines.splice(p,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};s.OscLinkService=_=a([d(0,l.IBufferService)],_)},8343:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let o="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(d){return d[a]||[]},s.createDecorator=function(d){if(s.serviceRegistry.has(d))return s.serviceRegistry.get(d);let l=function(_,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,u){c[o]===c?c[a].push({id:p,index:u}):(c[a]=[{id:p,index:u}],c[o]=c)})(l,_,y)};return l.toString=()=>d,s.serviceRegistry.set(d,l),l}},2585:(n,s,o)=>{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=o(8343);var d;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"})(d||(s.LogLevelEnum=d={})),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:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let a=o(8460),d=o(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,p=!1){return(16777215&m)<<3|(3&y)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let m=new d.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,p=0,c=m.length;for(let u=0;u<c;++u){let h=m.charCodeAt(u);if(55296<=h&&h<=56319){if(++u>=c)return y+this.wcwidth(h);let S=m.charCodeAt(u);56320<=S&&S<=57343?h=1024*(h-55296)+S-56320+65536:y+=this.wcwidth(S)}let f=this.charProperties(h,p),v=l.extractWidth(f);l.extractShouldJoin(f)&&(v-=l.extractWidth(p)),y+=v,p=f}return y}charProperties(m,y){return this._activeProvider.charProperties(m,y)}}s.UnicodeService=l}},t={};function r(n){var s=t[n];if(s!==void 0)return s.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var i={};return(()=>{var n=i;Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;let s=r(9042),o=r(3236),a=r(844),d=r(5741),l=r(8285),_=r(7975),m=r(7090),y=["cols","rows"];class p extends a.Disposable{constructor(u){super(),this._core=this.register(new o.Terminal(u)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};let h=v=>this._core.options[v],f=(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:f.bind(this,v)};Object.defineProperty(this._publicOptions,v,S)}}_checkReadonlyOptions(u){if(y.includes(u))throw new Error(`Option "${u}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new 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 u=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:u.applicationCursorKeys,applicationKeypadMode:u.applicationKeypad,bracketedPasteMode:u.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:u.origin,reverseWraparoundMode:u.reverseWraparound,sendFocusMode:u.sendFocus,wraparoundMode:u.wraparound}}get options(){return this._publicOptions}set options(u){for(let h in u)this._publicOptions[h]=u[h]}blur(){this._core.blur()}focus(){this._core.focus()}input(u,h=!0){this._core.input(u,h)}resize(u,h){this._verifyIntegers(u,h),this._core.resize(u,h)}open(u){this._core.open(u)}attachCustomKeyEventHandler(u){this._core.attachCustomKeyEventHandler(u)}attachCustomWheelEventHandler(u){this._core.attachCustomWheelEventHandler(u)}registerLinkProvider(u){return this._core.registerLinkProvider(u)}registerCharacterJoiner(u){return this._checkProposedApi(),this._core.registerCharacterJoiner(u)}deregisterCharacterJoiner(u){this._checkProposedApi(),this._core.deregisterCharacterJoiner(u)}registerMarker(u=0){return this._verifyIntegers(u),this._core.registerMarker(u)}registerDecoration(u){return this._checkProposedApi(),this._verifyPositiveIntegers(u.x??0,u.width??0,u.height??0),this._core.registerDecoration(u)}hasSelection(){return this._core.hasSelection()}select(u,h,f){this._verifyIntegers(u,h,f),this._core.select(u,h,f)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(u,h){this._verifyIntegers(u,h),this._core.selectLines(u,h)}dispose(){super.dispose()}scrollLines(u){this._verifyIntegers(u),this._core.scrollLines(u)}scrollPages(u){this._verifyIntegers(u),this._core.scrollPages(u)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(u){this._verifyIntegers(u),this._core.scrollToLine(u)}clear(){this._core.clear()}write(u,h){this._core.write(u,h)}writeln(u,h){this._core.write(u),this._core.write(`\r
9
+ `,h)}paste(u){this._core.paste(u)}refresh(u,h){this._verifyIntegers(u,h),this._core.refresh(u,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(u){this._addonManager.loadAddon(this,u)}static get strings(){return s}_verifyIntegers(...u){for(let h of u)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...u){for(let h of u)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}n.Terminal=p})(),i})()))});var Ma=ka((ss,yn)=>{(function(e,t){typeof ss=="object"&&typeof yn=="object"?yn.exports=t():typeof define=="function"&&define.amd?define([],t):typeof ss=="object"?ss.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 n=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))),d=window.getComputedStyle(this._terminal.element),l=o-(parseInt(d.getPropertyValue("padding-top"))+parseInt(d.getPropertyValue("padding-bottom"))),_=a-(parseInt(d.getPropertyValue("padding-right"))+parseInt(d.getPropertyValue("padding-left")))-n;return{cols:Math.max(2,Math.floor(_/i.css.cell.width)),rows:Math.max(1,Math.floor(l/i.css.cell.height))}}}})(),e})()))});var ph=Ea(Ta(),1),_h=Ea(Ma(),1);var ou=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ra.isErrorNoTelemetry(e)?new Ra(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)}},vd=new gd;function an(e){bd(e)||vd.onUnexpectedError(e)}var hn="Canceled";function bd(e){return e instanceof wd?!0:e instanceof Error&&e.name===hn&&e.message===hn}var wd=class extends Error{constructor(){super(hn),this.name=this.message}},ca=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 yd(e,t,r=0,s=e.length){let o=r,i=s;for(;o<i;){let n=Math.floor((o+i)/2);t(e[n])?o=n+1:i=n}return o-1}var Sd=class ya{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(ya.assertInvariants){if(this._prevFindLastPredicate){for(let s of this._array)if(this._prevFindLastPredicate(s)&&!t(s))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=yd(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};Sd.assertInvariants=!1;var un;(e=>{function t(i){return i<0}e.isLessThan=t;function r(i){return i<=0}e.isLessThanOrEqual=r;function s(i){return i>0}e.isGreaterThan=s;function o(i){return i===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(un||(un={}));function Cd(e,t){return(r,s)=>t(e(r),e(s))}var xd=(e,t)=>e-t,ha=class fn{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 fn(r=>this.iterate(s=>t(s)?r(s):!0))}map(t){return new fn(r=>this.iterate(s=>r(t(s))))}some(t){let r=!1;return this.iterate(s=>(r=t(s),!r)),r}findFirst(t){let r;return this.iterate(s=>t(s)?(r=s,!1):!0),r}findLast(t){let r;return this.iterate(s=>(t(s)&&(r=s),!0)),r}findLastMaxBy(t){let r,s=!0;return this.iterate(o=>((s||un.isGreaterThan(t(o,r)))&&(s=!1,r=o),!0)),r}};ha.empty=new ha(e=>{});function kd(e,t){let r=Object.create(null);for(let s of e){let o=t(s),i=r[o];i||(i=r[o]=[]),i.push(s)}return r}var da,ua,_g=class{constructor(e,t){this.toKey=t,this._map=new Map,this[da]="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))}[(ua=Symbol.iterator,da=Symbol.toStringTag,ua)](){return this.values()}},Ed=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 Ld(e,t){let r=this,s=!1,o;return function(){if(s)return o;if(s=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var pn;(e=>{function t(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function s(){return r}e.empty=s;function*o(g){yield g}e.single=o;function i(g){return t(g)?g:o(g)}e.wrap=i;function n(g){return g||r}e.from=n;function*a(g){for(let x=g.length-1;x>=0;x--)yield g[x]}e.reverse=a;function d(g){return!g||g[Symbol.iterator]().next().done===!0}e.isEmpty=d;function l(g){return g[Symbol.iterator]().next().value}e.first=l;function _(g,x){let b=0;for(let E of g)if(x(E,b++))return!0;return!1}e.some=_;function m(g,x){for(let b of g)if(x(b))return b}e.find=m;function*y(g,x){for(let b of g)x(b)&&(yield b)}e.filter=y;function*p(g,x){let b=0;for(let E of g)yield x(E,b++)}e.map=p;function*c(g,x){let b=0;for(let E of g)yield*x(E,b++)}e.flatMap=c;function*u(...g){for(let x of g)yield*x}e.concat=u;function h(g,x,b){let E=b;for(let P of g)E=x(E,P);return E}e.reduce=h;function*f(g,x,b=g.length){for(x<0&&(x+=g.length),b<0?b+=g.length:b>g.length&&(b=g.length);x<b;x++)yield g[x]}e.slice=f;function v(g,x=Number.POSITIVE_INFINITY){let b=[];if(x===0)return[b,g];let E=g[Symbol.iterator]();for(let P=0;P<x;P++){let O=E.next();if(O.done)return[b,e.empty()];b.push(O.value)}return[b,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(g){let x=[];for await(let b of g)x.push(b);return Promise.resolve(x)}e.asyncToArray=S})(pn||(pn={}));var Td=!1,Mr=null,Rd=class Sa{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:Sa.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 s=this.getDisposableData(t);s.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let s=r.get(t);if(s)return s;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 s;if(r)s=r;else{let d=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,d).isSingleton);if(l.length===0)return;let _=new Set(l.map(m=>m.value));if(s=l.filter(m=>!(m.parent&&_.has(m.parent))),s.length===0)throw new Error("There are cyclic diposable chains!")}if(!s)return;function o(d){function l(m,y){for(;m.length>0&&y.some(p=>typeof p=="string"?p===m[0]:m[0].match(p));)m.shift()}let _=d.source.split(`
14
- `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let i=new Ed;for(let d of s){let l=o(d);for(let _=0;_<=l.length;_++)i.add(l.slice(0,_).join(`
15
- `),d)}s.sort(Cd(d=>d.idx,xd));let n="",a=0;for(let d of s.slice(0,t)){a++;let l=o(d),_=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${i.get(l.slice(0,m+1).join(`
16
- `)).size}/${s.length} leaks) at ${y}`;let p=i.get(l.slice(0,m).join(`
17
- `)),c=kd([...p].map(u=>o(u)[m]),u=>u);delete c[l[m]];for(let[u,h]of Object.entries(c))_.unshift(` - stacktraces of ${h.length} other leaks continue with ${u}`);_.unshift(y)}n+=`
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)}},au=new ou;function Sn(e){lu(e)||au.onUnexpectedError(e)}var kn="Canceled";function lu(e){return e instanceof cu?!0:e instanceof Error&&e.name===kn&&e.message===kn}var cu=class extends Error{constructor(){super(kn),this.name=this.message}},Ra=class En extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof En)return t;let r=new En;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function hu(e,t,r=0,i=e.length){let n=r,s=i;for(;n<s;){let o=Math.floor((n+s)/2);t(e[o])?n=o+1:s=o}return n-1}var du=class Ua{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Ua.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=hu(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};du.assertInvariants=!1;var Ln;(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 n(s){return s===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ln||(Ln={}));function uu(e,t){return(r,i)=>t(e(r),e(i))}var fu=(e,t)=>e-t,Aa=class Tn{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 Tn(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new Tn(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(n=>((i||Ln.isGreaterThan(t(n,r)))&&(i=!1,r=n),!0)),r}};Aa.empty=new Aa(e=>{});function pu(e,t){let r=Object.create(null);for(let i of e){let n=t(i),s=r[n];s||(s=r[n]=[]),s.push(i)}return r}var Da,Pa,fv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Da]="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))}[(Pa=Symbol.iterator,Da=Symbol.toStringTag,Pa)](){return this.values()}},_u=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 mu(e,t){let r=this,i=!1,n;return function(){if(i)return n;if(i=!0,t)try{n=e.apply(r,arguments)}finally{t()}else n=e.apply(r,arguments);return n}}var Mn;(e=>{function t(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*n(g){yield g}e.single=n;function s(g){return t(g)?g:n(g)}e.wrap=s;function o(g){return g||r}e.from=o;function*a(g){for(let x=g.length-1;x>=0;x--)yield g[x]}e.reverse=a;function d(g){return!g||g[Symbol.iterator]().next().done===!0}e.isEmpty=d;function l(g){return g[Symbol.iterator]().next().value}e.first=l;function _(g,x){let w=0;for(let E of g)if(x(E,w++))return!0;return!1}e.some=_;function m(g,x){for(let w of g)if(x(w))return w}e.find=m;function*y(g,x){for(let w of g)x(w)&&(yield w)}e.filter=y;function*p(g,x){let w=0;for(let E of g)yield x(E,w++)}e.map=p;function*c(g,x){let w=0;for(let E of g)yield*x(E,w++)}e.flatMap=c;function*u(...g){for(let x of g)yield*x}e.concat=u;function h(g,x,w){let E=w;for(let P of g)E=x(E,P);return E}e.reduce=h;function*f(g,x,w=g.length){for(x<0&&(x+=g.length),w<0?w+=g.length:w>g.length&&(w=g.length);x<w;x++)yield g[x]}e.slice=f;function v(g,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,g];let E=g[Symbol.iterator]();for(let P=0;P<x;P++){let O=E.next();if(O.done)return[w,e.empty()];w.push(O.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(g){let x=[];for await(let w of g)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(Mn||(Mn={}));var gu=!1,Nr=null,vu=class ja{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:ja.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 n=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,n),n}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 d=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,d).isSingleton);if(l.length===0)return;let _=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&_.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function n(d){function l(m,y){for(;m.length>0&&y.some(p=>typeof p=="string"?p===m[0]:m[0].match(p));)m.shift()}let _=d.source.split(`
14
+ `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let s=new _u;for(let d of i){let l=n(d);for(let _=0;_<=l.length;_++)s.add(l.slice(0,_).join(`
15
+ `),d)}i.sort(uu(d=>d.idx,fu));let o="",a=0;for(let d of i.slice(0,t)){a++;let l=n(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
+ `)).size}/${i.length} leaks) at ${y}`;let p=s.get(l.slice(0,m).join(`
17
+ `)),c=pu([...p].map(u=>n(u)[m]),u=>u);delete c[l[m]];for(let[u,h]of Object.entries(c))_.unshift(` - stacktraces of ${h.length} other leaks continue with ${u}`);_.unshift(y)}o+=`
18
18
 
19
19
 
20
- ==================== Leaking disposable ${a}/${s.length}: ${d.value.constructor.name} ====================
20
+ ==================== Leaking disposable ${a}/${i.length}: ${d.value.constructor.name} ====================
21
21
  ${_.join(`
22
22
  `)}
23
23
  ============================================================
24
24
 
25
- `}return s.length>t&&(n+=`
25
+ `}return i.length>t&&(o+=`
26
26
 
27
27
 
28
- ... and ${s.length-t} more leaking disposables
28
+ ... and ${i.length-t} more leaking disposables
29
29
 
30
- `),{leaks:s,details:n}}};Rd.idx=0;function Md(e){Mr=e}if(Td){let e="__is_disposable_tracked__";Md(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!==Tt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Tt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Zs(e){return Mr?.trackDisposable(e),e}function Qs(e){Mr?.markAsDisposed(e)}function ls(e,t){Mr?.setParent(e,t)}function Ad(e,t){if(Mr)for(let r of e)Mr.setParent(r,t)}function as(e){if(pn.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(s){t.push(s)}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 Ca(...e){let t=Ar(()=>as(e));return Ad(e,t),t}function Ar(e){let t=Zs({dispose:Ld(()=>{Qs(t),e()})});return t}var xa=class ka{constructor(){this._toDispose=new Set,this._isDisposed=!1,Zs(this)}dispose(){this._isDisposed||(Qs(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{as(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 ls(t,this),this._isDisposed?ka.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),ls(t,null))}};xa.DISABLE_DISPOSED_WARNING=!1;var yn=xa,Tt=class{constructor(){this._store=new yn,Zs(this),ls(this._store,this)}dispose(){Qs(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Tt.None=Object.freeze({dispose(){}});var Xs=class{constructor(){this._isDisposed=!1,Zs(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ls(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Qs(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ls(e,null),e}},fa=class _n{constructor(t){this.element=t,this.next=_n.Undefined,this.prev=_n.Undefined}};fa.Undefined=new fa(void 0);var Dd=globalThis.performance&&typeof globalThis.performance.now=="function",Pd=class Ea{static create(t){return new Ea(t)}constructor(t){this._now=Dd&&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}},Bd=!1,pa=!1,Od=!1,Js;(e=>{e.None=()=>Tt.None;function t(B){if(Od){let{onDidAddListener:M}=B,U=vn.create(),I=0;B.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),U.print()),M?.()}}}function r(B,M){return y(B,()=>{},0,void 0,!0,void 0,M)}e.defer=r;function s(B){return(M,U=null,I)=>{let C=!1,L;return L=B(T=>{if(!C)return L?L.dispose():C=!0,M.call(U,T)},null,I),C&&L.dispose(),L}}e.once=s;function o(B,M,U){return _((I,C=null,L)=>B(T=>I.call(C,M(T)),null,L),U)}e.map=o;function i(B,M,U){return _((I,C=null,L)=>B(T=>{M(T),I.call(C,T)},null,L),U)}e.forEach=i;function n(B,M,U){return _((I,C=null,L)=>B(T=>M(T)&&I.call(C,T),null,L),U)}e.filter=n;function a(B){return B}e.signal=a;function d(...B){return(M,U=null,I)=>{let C=Ca(...B.map(L=>L(T=>M.call(U,T))));return m(C,I)}}e.any=d;function l(B,M,U,I){let C=U;return o(B,L=>(C=M(C,L),C),I)}e.reduce=l;function _(B,M){let U,I={onWillAddFirstListener(){U=B(C.fire,C)},onDidRemoveLastListener(){U?.dispose()}};M||t(I);let C=new Lt(I);return M?.add(C),C.event}function m(B,M){return M instanceof Array?M.push(B):M&&M.add(B),B}function y(B,M,U=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=B(W=>{$++,N=M(N,W),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 U=="number"?(clearTimeout(G),G=setTimeout(Y,U)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Lt(H);return T?.add(k),k.event}e.debounce=y;function p(B,M=0,U){return e.debounce(B,(I,C)=>I?(I.push(C),I):[C],M,void 0,!0,void 0,U)}e.accumulate=p;function c(B,M=(I,C)=>I===C,U){let I=!0,C;return n(B,L=>{let T=I||!M(L,C);return I=!1,C=L,T},U)}e.latch=c;function u(B,M,U){return[e.filter(B,M,U),e.filter(B,I=>!M(I),U)]}e.split=u;function h(B,M=!1,U=[],I){let C=U.slice(),L=B(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Lt({onWillAddFirstListener(){L||(L=B(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(M?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function f(B,M){return(U,I,C)=>{let L=M(new S);return B(function(T){let D=L.evaluate(T);D!==v&&U.call(I,D)},void 0,C)}}e.chain=f;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(U=>(M(U),U)),this}filter(M){return this.steps.push(U=>M(U)?U:v),this}reduce(M,U){let I=U;return this.steps.push(C=>(I=M(I,C),I)),this}latch(M=(U,I)=>U===I){let U=!0,I;return this.steps.push(C=>{let L=U||!M(C,I);return U=!1,I=C,L?C:v}),this}evaluate(M){for(let U of this.steps)if(M=U(M),M===v)break;return M}}function g(B,M,U=I=>I){let I=(...D)=>T.fire(U(...D)),C=()=>B.on(M,I),L=()=>B.removeListener(M,I),T=new Lt({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=g;function x(B,M,U=I=>I){let I=(...D)=>T.fire(U(...D)),C=()=>B.addEventListener(M,I),L=()=>B.removeEventListener(M,I),T=new Lt({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function b(B){return new Promise(M=>s(B)(M))}e.toPromise=b;function E(B){let M=new Lt;return B.then(U=>{M.fire(U)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=E;function P(B,M){return B(U=>M.fire(U))}e.forward=P;function O(B,M,U){return M(U),B(I=>M(I))}e.runAndSubscribe=O;class F{constructor(M,U){this._observable=M,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};U||t(I),this.emitter=new Lt(I),U&&U.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,U){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(B,M){return new F(B,M).emitter.event}e.fromObservable=A;function V(B){return(M,U,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(B.reportChanges(),L&&(L=!1,M.call(U)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver(T),B.reportChanges();let D={dispose(){B.removeObserver(T)}};return I instanceof yn?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(Js||(Js={}));var mn=class gn{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${gn._idPool++}`,gn.all.add(this)}start(t){this._stopWatch=new Pd,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}}};mn.all=new Set,mn._idPool=0;var Id=mn,_a=-1,La=class Ta{constructor(t,r,s=(Ta._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let s=this.threshold;if(s<=0||r<s)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=s*.5;let[i,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(i);let d=new Hd(a,i);this._errorHandler(d)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[s,o]of this._stacks)(!t||r<o)&&(t=[s,o],r=o);return t}};La._idPool=1;var Nd=La,vn=class Ra{constructor(t){this.value=t}static create(){let t=new Error;return new Ra(t.stack??"")}print(){console.warn(this.value.split(`
30
+ `),{leaks:i,details:o}}};vu.idx=0;function bu(e){Nr=e}if(gu){let e="__is_disposable_tracked__";bu(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!==Tt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Tt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function us(e){return Nr?.trackDisposable(e),e}function fs(e){Nr?.markAsDisposed(e)}function vi(e,t){Nr?.setParent(e,t)}function wu(e,t){if(Nr)for(let r of e)Nr.setParent(r,t)}function gi(e){if(Mn.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 $a(...e){let t=Hr(()=>gi(e));return wu(e,t),t}function Hr(e){let t=us({dispose:mu(()=>{fs(t),e()})});return t}var qa=class Ka{constructor(){this._toDispose=new Set,this._isDisposed=!1,us(this)}dispose(){this._isDisposed||(fs(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{gi(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 vi(t,this),this._isDisposed?Ka.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),vi(t,null))}};qa.DISABLE_DISPOSED_WARNING=!1;var In=qa,Tt=class{constructor(){this._store=new In,us(this),vi(this._store,this)}dispose(){fs(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Tt.None=Object.freeze({dispose(){}});var hs=class{constructor(){this._isDisposed=!1,us(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&vi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,fs(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&vi(e,null),e}},Ba=class Rn{constructor(t){this.element=t,this.next=Rn.Undefined,this.prev=Rn.Undefined}};Ba.Undefined=new Ba(void 0);var yu=globalThis.performance&&typeof globalThis.performance.now=="function",Su=class Ga{static create(t){return new Ga(t)}constructor(t){this._now=yu&&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}},Cu=!1,Oa=!1,xu=!1,ds;(e=>{e.None=()=>Tt.None;function t(B){if(xu){let{onDidAddListener:R}=B,z=Pn.create(),I=0;B.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),z.print()),R?.()}}}function r(B,R){return y(B,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(B){return(R,z=null,I)=>{let C=!1,L;return L=B(T=>{if(!C)return L?L.dispose():C=!0,R.call(z,T)},null,I),C&&L.dispose(),L}}e.once=i;function n(B,R,z){return _((I,C=null,L)=>B(T=>I.call(C,R(T)),null,L),z)}e.map=n;function s(B,R,z){return _((I,C=null,L)=>B(T=>{R(T),I.call(C,T)},null,L),z)}e.forEach=s;function o(B,R,z){return _((I,C=null,L)=>B(T=>R(T)&&I.call(C,T),null,L),z)}e.filter=o;function a(B){return B}e.signal=a;function d(...B){return(R,z=null,I)=>{let C=$a(...B.map(L=>L(T=>R.call(z,T))));return m(C,I)}}e.any=d;function l(B,R,z,I){let C=z;return n(B,L=>(C=R(C,L),C),I)}e.reduce=l;function _(B,R){let z,I={onWillAddFirstListener(){z=B(C.fire,C)},onDidRemoveLastListener(){z?.dispose()}};R||t(I);let C=new Lt(I);return R?.add(C),C.event}function m(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function y(B,R,z=100,I=!1,C=!1,L,T){let D,N,G,j=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=B(W=>{j++,N=R(N,W),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||j>1)&&k.fire(q),j=0},typeof z=="number"?(clearTimeout(G),G=setTimeout(Y,z)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&j>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Lt(H);return T?.add(k),k.event}e.debounce=y;function p(B,R=0,z){return e.debounce(B,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,z)}e.accumulate=p;function c(B,R=(I,C)=>I===C,z){let I=!0,C;return o(B,L=>{let T=I||!R(L,C);return I=!1,C=L,T},z)}e.latch=c;function u(B,R,z){return[e.filter(B,R,z),e.filter(B,I=>!R(I),z)]}e.split=u;function h(B,R=!1,z=[],I){let C=z.slice(),L=B(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Lt({onWillAddFirstListener(){L||(L=B(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 f(B,R){return(z,I,C)=>{let L=R(new S);return B(function(T){let D=L.evaluate(T);D!==v&&z.call(I,D)},void 0,C)}}e.chain=f;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(z=>(R(z),z)),this}filter(R){return this.steps.push(z=>R(z)?z:v),this}reduce(R,z){let I=z;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(z,I)=>z===I){let z=!0,I;return this.steps.push(C=>{let L=z||!R(C,I);return z=!1,I=C,L?C:v}),this}evaluate(R){for(let z of this.steps)if(R=z(R),R===v)break;return R}}function g(B,R,z=I=>I){let I=(...D)=>T.fire(z(...D)),C=()=>B.on(R,I),L=()=>B.removeListener(R,I),T=new Lt({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=g;function x(B,R,z=I=>I){let I=(...D)=>T.fire(z(...D)),C=()=>B.addEventListener(R,I),L=()=>B.removeEventListener(R,I),T=new Lt({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(B){return new Promise(R=>i(B)(R))}e.toPromise=w;function E(B){let R=new Lt;return B.then(z=>{R.fire(z)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function P(B,R){return B(z=>R.fire(z))}e.forward=P;function O(B,R,z){return R(z),B(I=>R(I))}e.runAndSubscribe=O;class F{constructor(R,z){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};z||t(I),this.emitter=new Lt(I),z&&z.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,z){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(B,R){return new F(B,R).emitter.event}e.fromObservable=A;function V(B){return(R,z,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(B.reportChanges(),L&&(L=!1,R.call(z)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver(T),B.reportChanges();let D={dispose(){B.removeObserver(T)}};return I instanceof In?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(ds||(ds={}));var An=class Dn{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Dn._idPool++}`,Dn.all.add(this)}start(t){this._stopWatch=new Su,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}}};An.all=new Set,An._idPool=0;var ku=An,Ia=-1,Va=class Ya{constructor(t,r,i=(Ya._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 n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let d=new Lu(a,s);this._errorHandler(d)}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,n]of this._stacks)(!t||r<n)&&(t=[i,n],r=n);return t}};Va._idPool=1;var Eu=Va,Pn=class Xa{constructor(t){this.value=t}static create(){let t=new Error;return new Xa(t.stack??"")}print(){console.warn(this.value.split(`
31
31
  `).slice(2).join(`
32
- `))}},Hd=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Fd=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Wd=0,Ks=class{constructor(e){this.value=e,this.id=Wd++}},Ud=2,zd=(e,t)=>{if(e instanceof Ks)t(e);else for(let r=0;r<e.length;r++){let s=e[r];s&&t(s)}},Gs;if(Bd){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),Gs=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Lt=class{constructor(e){this._size=0,this._options=e,this._leakageMon=_a>0||this._options?.leakWarningThreshold?new Nd(e?.onListenerError??an,this._options?.leakWarningThreshold??_a):void 0,this._perfMon=this._options?._profName?new Id(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(pa){let e=this._listeners;queueMicrotask(()=>{zd(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 d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Fd(`${a}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(this._options?.onListenerError||an)(l),Tt.None}if(this._disposed)return Tt.None;t&&(e=e.bind(t));let s=new Ks(e),o,i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=vn.create(),o=this._leakageMon.check(s.stack,this._size+1)),pa&&(s.stack=i??vn.create()),this._listeners?this._listeners instanceof Ks?(this._deliveryQueue??(this._deliveryQueue=new jd),this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=Ar(()=>{Gs?.unregister(n),o?.(),this._removeListener(s)});if(r instanceof yn?r.add(n):Array.isArray(r)&&r.push(n),Gs){let a=new Error().stack.split(`
32
+ `))}},Lu=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Tu=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Mu=0,os=class{constructor(e){this.value=e,this.id=Mu++}},Ru=2,Au=(e,t)=>{if(e instanceof os)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},as;if(Cu){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),as=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Lt=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ia>0||this._options?.leakWarningThreshold?new Eu(e?.onListenerError??Sn,this._options?.leakWarningThreshold??Ia):void 0,this._perfMon=this._options?._profName?new ku(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(Oa){let e=this._listeners;queueMicrotask(()=>{Au(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 d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Tu(`${a}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(this._options?.onListenerError||Sn)(l),Tt.None}if(this._disposed)return Tt.None;t&&(e=e.bind(t));let i=new os(e),n,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Pn.create(),n=this._leakageMon.check(i.stack,this._size+1)),Oa&&(i.stack=s??Pn.create()),this._listeners?this._listeners instanceof os?(this._deliveryQueue??(this._deliveryQueue=new Du),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=Hr(()=>{as?.unregister(o),n?.(),this._removeListener(i)});if(r instanceof In?r.add(o):Array.isArray(r)&&r.push(o),as){let a=new Error().stack.split(`
34
34
  `).slice(2,3).join(`
35
- `).trim(),d=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Gs.register(n,d?.[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 s=this._deliveryQueue.current===this;if(this._size*Ud<=t.length){let o=0;for(let i=0;i<t.length;i++)t[i]?t[o++]=t[i]:s&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||an;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}_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 Ks)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}},jd=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}},Ma=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),ma;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof $d?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Js.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ma})})(ma||(ma={}));var $d=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?Ma:(this._emitter||(this._emitter=new Lt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Rr="en",bn=!1,wn=!1,Vs=!1,qd=!1,Kd=!1,Aa=!1,Gd=!1,Vd=!1,Yd=!1,Xd=!1,qs,Ys=Rr,ga=Rr,Jd,Nt,Ht=globalThis,nt;typeof Ht.vscode<"u"&&typeof Ht.vscode.process<"u"?nt=Ht.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(nt=process);var Da=typeof nt?.versions?.electron=="string",Zd=Da&&nt?.type==="renderer";if(typeof nt=="object"){bn=nt.platform==="win32",wn=nt.platform==="darwin",Vs=nt.platform==="linux",qd=Vs&&!!nt.env.SNAP&&!!nt.env.SNAP_REVISION,Gd=Da,Yd=!!nt.env.CI||!!nt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qs=Rr,Ys=Rr;let e=nt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);qs=t.userLocale,ga=t.osLocale,Ys=t.resolvedLanguage||Rr,Jd=t.languagePack?.translationsConfigFile}catch{}Kd=!0}else typeof navigator=="object"&&!Zd?(Nt=navigator.userAgent,bn=Nt.indexOf("Windows")>=0,wn=Nt.indexOf("Macintosh")>=0,Vd=(Nt.indexOf("Macintosh")>=0||Nt.indexOf("iPad")>=0||Nt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Vs=Nt.indexOf("Linux")>=0,Xd=Nt?.indexOf("Mobi")>=0,Aa=!0,Ys=globalThis._VSCODE_NLS_LANGUAGE||Rr,qs=navigator.language.toLowerCase(),ga=qs):console.error("Unable to resolve platform.");var ln=0;wn?ln=1:bn?ln=3:Vs&&(ln=2);var Qd=Aa&&typeof Ht.importScripts=="function",mg=Qd?Ht.origin:void 0,Rt=Nt,Zt=Ys,va;(e=>{function t(){return Zt}e.value=t;function r(){return Zt.length===2?Zt==="en":Zt.length>=3?Zt[0]==="e"&&Zt[1]==="n"&&Zt[2]==="-":!1}e.isDefaultVariant=r;function s(){return Zt==="en"}e.isDefault=s})(va||(va={}));var eu=typeof Ht.postMessage=="function"&&!Ht.importScripts,tu=(()=>{if(eu){let e=[];Ht.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let s=0,o=e.length;s<o;s++){let i=e[s];if(i.id===r.data.vscodeScheduleAsyncWork){e.splice(s,1),i.callback();return}}});let t=0;return r=>{let s=++t;e.push({id:s,callback:r}),Ht.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),ru=!!(Rt&&Rt.indexOf("Chrome")>=0),gg=!!(Rt&&Rt.indexOf("Firefox")>=0),vg=!!(!ru&&Rt&&Rt.indexOf("Safari")>=0),bg=!!(Rt&&Rt.indexOf("Edg/")>=0),wg=!!(Rt&&Rt.indexOf("Android")>=0);function Pa(e,t=0,r){let s=setTimeout(()=>{e(),r&&o.dispose()},t),o=Ar(()=>{clearTimeout(s),r?.deleteAndLeak(o)});return r?.add(o),o}var su,cn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?cn=(e,t)=>{tu(()=>{if(r)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:cn=(e,t,r)=>{let s=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(s))}}},su=e=>cn(globalThis,e)})();var ba;(e=>{async function t(s){let o,i=await Promise.all(s.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return i}e.settled=t;function r(s){return new Promise(async(o,i)=>{try{await s(o,i)}catch(n){i(n)}})}e.withAsyncBody=r})(ba||(ba={}));var wa=class dt{static fromArray(t){return new dt(r=>{r.emitMany(t)})}static fromPromise(t){return new dt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new dt(async r=>{await Promise.all(t.map(async s=>r.emitOne(await s)))})}static merge(t){return new dt(async r=>{await Promise.all(t.map(async s=>{for await(let o of s)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Lt,queueMicrotask(async()=>{let s={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(s)),this.resolve()}catch(o){this.reject(o)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 Js.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new dt(async s=>{for await(let o of t)s.emitOne(r(o))})}map(t){return dt.map(this,t)}static filter(t,r){return new dt(async s=>{for await(let o of t)r(o)&&s.emitOne(o)})}filter(t){return dt.filter(this,t)}static coalesce(t){return dt.filter(t,r=>!!r)}coalesce(){return dt.coalesce(this)}static async toPromise(t){let r=[];for await(let s of t)r.push(s);return r}toPromise(){return dt.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())}};wa.EMPTY=wa.fromArray([]);var iu=class extends Tt{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Xs),this._linesCacheDisposables=this._register(new Xs),this._register(Ar(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ca(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Pa(()=>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=[],s=[0],o=this._terminal.buffer.active.getLine(e);for(;o;){let i=this._terminal.buffer.active.getLine(e+1),n=i?i.isWrapped:!1,a=o.translateToString(!n&&t);if(n&&i){let d=o.getCell(o.length-1);d&&d.getCode()===0&&d.getWidth()===1&&i.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(r.push(a),n)s.push(s[s.length-1]+a.length);else break;e++,o=i}return[r.join(""),s]}},nu=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}},ou=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,r,s){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},i=this._findInLine(e,o,s);if(!i)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,i=this._findInLine(e,o,s),!i);n++);return i}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=0,i=0;s&&(r===e?(o=s.end.x,i=s.end.y):(o=s.start.x,i=s.start.y)),this._lineCache.initLinesCache();let n={startRow:i,startCol:o},a=this._findInLine(e,n,t);if(!a)for(let d=i+1;d<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=d,n.startCol=0,a=this._findInLine(e,n,t),!a);d++);if(!a&&i!==0)for(let d=0;d<i&&(n.startRow=d,n.startCol=0,a=this._findInLine(e,n,t),!a);d++);return!a&&s&&(n.startRow=s.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 s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let a={startRow:o,startCol:i},d;if(s&&(a.startRow=o=s.start.y,a.startCol=i=s.start.x,r!==e&&(d=this._findInLine(e,a,t,!1),d||(a.startRow=o=s.end.y,a.startCol=i=s.end.x))),d||(d=this._findInLine(e,a,t,n)),!d){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=o-1;l>=0&&(a.startRow=l,d=this._findInLine(e,a,t,n),!d);l--);}if(!d&&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,d=this._findInLine(e,a,t,n),!d);l--);return d}_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={},s=!1){let o=t.startRow,i=t.startCol;if(this._terminal.buffer.active.getLine(o)?.isWrapped){if(s){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,d]=n,l=this._bufferColsToStringOffset(o,i),_=e,m=a;r.regex||(_=r.caseSensitive?e:e.toLowerCase(),m=r.caseSensitive?a:a.toLowerCase());let y=-1;if(r.regex){let p=RegExp(_,r.caseSensitive?"g":"gi"),c;if(s)for(;c=p.exec(m.slice(0,l));)y=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(m.slice(l)),c&&c[0].length>0&&(y=l+(p.lastIndex-c[0].length),e=c[0])}else s?l-_.length>=0&&(y=m.lastIndexOf(_,l-_.length)):y=m.indexOf(_,l);if(y>=0){if(r.wholeWord&&!this._isWholeWord(y,m,e))return;let p=0;for(;p<d.length-1&&y>=d[p+1];)p++;let c=p;for(;c<d.length-1&&y+e.length>=d[c+1];)c++;let u=y-d[p],h=y+e.length-d[c],f=this._stringLengthToBufferSize(o+p,u),v=this._stringLengthToBufferSize(o+c,h)-f+this._terminal.cols*(c-p);return{term:e,col:f,row:o+p,size:v}}}_stringLengthToBufferSize(e,t){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let s=0;s<t;s++){let o=r.getCell(s);if(!o)break;let i=o.getChars();i.length>1&&(t-=i.length-1);let n=r.getCell(s+1);n&&n.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,s=0,o=this._terminal.buffer.active.getLine(r);for(;t>0&&o;){for(let i=0;i<t&&i<this._terminal.cols;i++){let n=o.getCell(i);if(!n)break;n.getWidth()&&(s+=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 s}},au=class extends Tt{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Ar(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let s=this._createResultDecorations(r,t,!1);if(s)for(let o of s)this._storeDecoration(o,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){as(r)}}}clearHighlightDecorations(){as(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 s=[],o=e.col,i=e.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;i>0;){let d=Math.min(this._terminal.cols-o,i);s.push([n,o,d]),o=0,i-=d,n++}let a=[];for(let d of s){let l=this._terminal.registerMarker(d[0]),_=this._terminal.registerDecoration({marker:l,x:d[1],width:d[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let m=[];m.push(l),m.push(_.onRender(y=>this._applyStyles(y,r?t.activeMatchBorder:t.matchBorder,!1))),m.push(_.onDispose(()=>as(m))),a.push(_)}}return a.length===0?void 0:a}},lu=class extends Tt{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Lt)}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()}},Ba=class extends Tt{constructor(e){super(),this._highlightTimeout=this._register(new Xs),this._lineCache=this._register(new Xs),this._state=new nu,this._resultTracker=this._register(new lu),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new iu(e),this._engine=new ou(e,this._lineCache.value),this._decorationManager=new au(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ar(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Pa(()=>{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 s=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,s}_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=[],s,o=this._engine.find(e,0,0,t);for(;o&&(s?.row!==o.row||s?.col!==o.col)&&!(r.length>=this._highlightLimit);)s=o,r.push(s),o=this._engine.find(e,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.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 s=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(s,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 s=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,s}_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 s=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(s,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 s=this._decorationManager.createActiveDecoration(e,t);s&&(this._resultTracker.selectedDecoration=s)}if(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let s=e.row-this._terminal.buffer.active.viewportY;s-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(s)}return!0}};var cu=class{constructor(e,t,r,s={}){this._terminal=e,this._regex=t,this._handler=r,this._options=s}provideLinks(e,t){let r=du.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,s)=>{if(this._options.hover){let{range:o}=t;this._options.hover(r,s,o)}},t))}};function hu(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 du=class ei{static computeLink(t,r,s,o){let i=new RegExp(r.source,(r.flags||"")+"g"),[n,a]=ei._getWindowedLineStrings(t-1,s),d=n.join(""),l,_=[];for(;l=i.exec(d);){let m=l[0];if(!hu(m))continue;let[y,p]=ei._mapStrIdx(s,a,0,l.index),[c,u]=ei._mapStrIdx(s,y,p,m.length);if(y===-1||p===-1||c===-1||u===-1)continue;let h={start:{x:p+1,y:y+1},end:{x:u,y:c+1}};_.push({range:h,text:m,activate:o})}return _}static _getWindowedLineStrings(t,r){let s,o=t,i=t,n=0,a="",d=[];if(s=r.buffer.active.getLine(t)){let l=s.translateToString(!0);if(s.isWrapped&&l[0]!==" "){for(n=0;(s=r.buffer.active.getLine(--o))&&n<2048&&(a=s.translateToString(!0),n+=a.length,d.push(a),!(!s.isWrapped||a.indexOf(" ")!==-1)););d.reverse()}for(d.push(l),n=0;(s=r.buffer.active.getLine(++i))&&s.isWrapped&&n<2048&&(a=s.translateToString(!0),n+=a.length,d.push(a),a.indexOf(" ")===-1););}return[d,o]}static _mapStrIdx(t,r,s,o){let i=t.buffer.active,n=i.getNullCell(),a=s;for(;o;){let d=i.getLine(r);if(!d)return[-1,-1];for(let l=a;l<d.length;++l){d.getCell(l,n);let _=n.getChars();if(n.getWidth()&&(o-=_.length||1,l===d.length-1&&_==="")){let m=i.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]}},uu=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function fu(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 Oa=class{constructor(e=fu,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||uu;this._linkProvider=this._terminal.registerLinkProvider(new cu(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var pu=Object.defineProperty,_u=Object.getOwnPropertyDescriptor,mu=(e,t,r,s)=>{for(var o=s>1?void 0:s?_u(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&pu(t,r,o),o},gu=(e,t)=>(r,s)=>t(r,s,e),vu=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ia.isErrorNoTelemetry(e)?new Ia(e.message+`
35
+ `).trim(),d=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);as.register(o,d?.[2]??a,o)}return o}),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*Ru<=t.length){let n=0;for(let s=0;s<t.length;s++)t[s]?t[n++]=t[s]:i&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=n}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||Sn;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 os)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}},Du=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}},Ja=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Na;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Pu?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ds.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ja})})(Na||(Na={}));var Pu=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?Ja:(this._emitter||(this._emitter=new Lt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ir="en",Bn=!1,On=!1,ls=!1,Bu=!1,Ou=!1,Za=!1,Iu=!1,Nu=!1,Hu=!1,Fu=!1,ns,cs=Ir,Ha=Ir,Wu,zt,Ut=globalThis,at;typeof Ut.vscode<"u"&&typeof Ut.vscode.process<"u"?at=Ut.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(at=process);var Qa=typeof at?.versions?.electron=="string",zu=Qa&&at?.type==="renderer";if(typeof at=="object"){Bn=at.platform==="win32",On=at.platform==="darwin",ls=at.platform==="linux",Bu=ls&&!!at.env.SNAP&&!!at.env.SNAP_REVISION,Iu=Qa,Hu=!!at.env.CI||!!at.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ns=Ir,cs=Ir;let e=at.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ns=t.userLocale,Ha=t.osLocale,cs=t.resolvedLanguage||Ir,Wu=t.languagePack?.translationsConfigFile}catch{}Ou=!0}else typeof navigator=="object"&&!zu?(zt=navigator.userAgent,Bn=zt.indexOf("Windows")>=0,On=zt.indexOf("Macintosh")>=0,Nu=(zt.indexOf("Macintosh")>=0||zt.indexOf("iPad")>=0||zt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ls=zt.indexOf("Linux")>=0,Fu=zt?.indexOf("Mobi")>=0,Za=!0,cs=globalThis._VSCODE_NLS_LANGUAGE||Ir,ns=navigator.language.toLowerCase(),Ha=ns):console.error("Unable to resolve platform.");var Cn=0;On?Cn=1:Bn?Cn=3:ls&&(Cn=2);var Uu=Za&&typeof Ut.importScripts=="function",pv=Uu?Ut.origin:void 0,Mt=zt,ir=cs,Fa;(e=>{function t(){return ir}e.value=t;function r(){return ir.length===2?ir==="en":ir.length>=3?ir[0]==="e"&&ir[1]==="n"&&ir[2]==="-":!1}e.isDefaultVariant=r;function i(){return ir==="en"}e.isDefault=i})(Fa||(Fa={}));var ju=typeof Ut.postMessage=="function"&&!Ut.importScripts,$u=(()=>{if(ju){let e=[];Ut.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;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}),Ut.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),qu=!!(Mt&&Mt.indexOf("Chrome")>=0),_v=!!(Mt&&Mt.indexOf("Firefox")>=0),mv=!!(!qu&&Mt&&Mt.indexOf("Safari")>=0),gv=!!(Mt&&Mt.indexOf("Edg/")>=0),vv=!!(Mt&&Mt.indexOf("Android")>=0);function el(e,t=0,r){let i=setTimeout(()=>{e(),r&&n.dispose()},t),n=Hr(()=>{clearTimeout(i),r?.deleteAndLeak(n)});return r?.add(n),n}var Ku,xn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?xn=(e,t)=>{$u(()=>{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)}}}:xn=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),n=!1;return{dispose(){n||(n=!0,e.cancelIdleCallback(i))}}},Ku=e=>xn(globalThis,e)})();var Wa;(e=>{async function t(i){let n,s=await Promise.all(i.map(o=>o.then(a=>a,a=>{n||(n=a)})));if(typeof n<"u")throw n;return s}e.settled=t;function r(i){return new Promise(async(n,s)=>{try{await i(n,s)}catch(o){s(o)}})}e.withAsyncBody=r})(Wa||(Wa={}));var za=class ht{static fromArray(t){return new ht(r=>{r.emitMany(t)})}static fromPromise(t){return new ht(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ht(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new ht(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Lt,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}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 ds.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new ht(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return ht.map(this,t)}static filter(t,r){return new ht(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return ht.filter(this,t)}static coalesce(t){return ht.filter(t,r=>!!r)}coalesce(){return ht.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return ht.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())}};za.EMPTY=za.fromArray([]);var Gu=class extends Tt{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new hs),this._linesCacheDisposables=this._register(new hs),this._register(Hr(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=$a(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=el(()=>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],n=this._terminal.buffer.active.getLine(e);for(;n;){let s=this._terminal.buffer.active.getLine(e+1),o=s?s.isWrapped:!1,a=n.translateToString(!o&&t);if(o&&s){let d=n.getCell(n.length-1);d&&d.getCode()===0&&d.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(r.push(a),o)i.push(i[i.length-1]+a.length);else break;e++,n=s}return[r.join(""),i]}},Vu=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}},Yu=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 n={startRow:t,startCol:r},s=this._findInLine(e,n,i);if(!s)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=o,n.startCol=0,s=this._findInLine(e,n,i),!s);o++);return s}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=0,s=0;i&&(r===e?(n=i.end.x,s=i.end.y):(n=i.start.x,s=i.start.y)),this._lineCache.initLinesCache();let o={startRow:s,startCol:n},a=this._findInLine(e,o,t);if(!a)for(let d=s+1;d<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=d,o.startCol=0,a=this._findInLine(e,o,t),!a);d++);if(!a&&s!==0)for(let d=0;d<s&&(o.startRow=d,o.startCol=0,a=this._findInLine(e,o,t),!a);d++);return!a&&i&&(o.startRow=i.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,o=!0;this._lineCache.initLinesCache();let a={startRow:n,startCol:s},d;if(i&&(a.startRow=n=i.start.y,a.startCol=s=i.start.x,r!==e&&(d=this._findInLine(e,a,t,!1),d||(a.startRow=n=i.end.y,a.startCol=s=i.end.x))),d||(d=this._findInLine(e,a,t,o)),!d){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=n-1;l>=0&&(a.startRow=l,d=this._findInLine(e,a,t,o),!d);l--);}if(!d&&n!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=n&&(a.startRow=l,d=this._findInLine(e,a,t,o),!d);l--);return d}_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 n=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(n)?.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,r)}let o=this._lineCache.getLineFromCache(n);o||(o=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,o));let[a,d]=o,l=this._bufferColsToStringOffset(n,s),_=e,m=a;r.regex||(_=r.caseSensitive?e:e.toLowerCase(),m=r.caseSensitive?a:a.toLowerCase());let y=-1;if(r.regex){let p=RegExp(_,r.caseSensitive?"g":"gi"),c;if(i)for(;c=p.exec(m.slice(0,l));)y=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(m.slice(l)),c&&c[0].length>0&&(y=l+(p.lastIndex-c[0].length),e=c[0])}else i?l-_.length>=0&&(y=m.lastIndexOf(_,l-_.length)):y=m.indexOf(_,l);if(y>=0){if(r.wholeWord&&!this._isWholeWord(y,m,e))return;let p=0;for(;p<d.length-1&&y>=d[p+1];)p++;let c=p;for(;c<d.length-1&&y+e.length>=d[c+1];)c++;let u=y-d[p],h=y+e.length-d[c],f=this._stringLengthToBufferSize(n+p,u),v=this._stringLengthToBufferSize(n+c,h)-f+this._terminal.cols*(c-p);return{term:e,col:f,row:n+p,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 n=r.getCell(i);if(!n)break;let s=n.getChars();s.length>1&&(t-=s.length-1);let o=r.getCell(i+1);o&&o.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,i=0,n=this._terminal.buffer.active.getLine(r);for(;t>0&&n;){for(let s=0;s<t&&s<this._terminal.cols;s++){let o=n.getCell(s);if(!o)break;o.getWidth()&&(i+=o.getCode()===0?1:o.getChars().length)}if(r++,n=this._terminal.buffer.active.getLine(r),n&&!n.isWrapped)break;t-=this._terminal.cols}return i}},Xu=class extends Tt{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Hr(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let i=this._createResultDecorations(r,t,!1);if(i)for(let n of i)this._storeDecoration(n,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){gi(r)}}}clearHighlightDecorations(){gi(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=[],n=e.col,s=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let d=Math.min(this._terminal.cols-n,s);i.push([o,n,d]),n=0,s-=d,o++}let a=[];for(let d of i){let l=this._terminal.registerMarker(d[0]),_=this._terminal.registerDecoration({marker:l,x:d[1],width:d[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let m=[];m.push(l),m.push(_.onRender(y=>this._applyStyles(y,r?t.activeMatchBorder:t.matchBorder,!1))),m.push(_.onDispose(()=>gi(m))),a.push(_)}}return a.length===0?void 0:a}},Ju=class extends Tt{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Lt)}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()}},tl=class extends Tt{constructor(e){super(),this._highlightTimeout=this._register(new hs),this._lineCache=this._register(new hs),this._state=new Vu,this._resultTracker=this._register(new Ju),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Gu(e),this._engine=new Yu(e,this._lineCache.value),this._decorationManager=new Xu(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Hr(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=el(()=>{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,n=this._engine.find(e,0,0,t);for(;n&&(i?.row!==n.row||i?.col!==n.col)&&!(r.length>=this._highlightLimit);)i=n,r.push(i),n=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 Zu=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=ef.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:n}=t;this._options.hover(r,i,n)}},t))}};function Qu(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 ef=class ps{static computeLink(t,r,i,n){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,a]=ps._getWindowedLineStrings(t-1,i),d=o.join(""),l,_=[];for(;l=s.exec(d);){let m=l[0];if(!Qu(m))continue;let[y,p]=ps._mapStrIdx(i,a,0,l.index),[c,u]=ps._mapStrIdx(i,y,p,m.length);if(y===-1||p===-1||c===-1||u===-1)continue;let h={start:{x:p+1,y:y+1},end:{x:u,y:c+1}};_.push({range:h,text:m,activate:n})}return _}static _getWindowedLineStrings(t,r){let i,n=t,s=t,o=0,a="",d=[];if(i=r.buffer.active.getLine(t)){let l=i.translateToString(!0);if(i.isWrapped&&l[0]!==" "){for(o=0;(i=r.buffer.active.getLine(--n))&&o<2048&&(a=i.translateToString(!0),o+=a.length,d.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););d.reverse()}for(d.push(l),o=0;(i=r.buffer.active.getLine(++s))&&i.isWrapped&&o<2048&&(a=i.translateToString(!0),o+=a.length,d.push(a),a.indexOf(" ")===-1););}return[d,n]}static _mapStrIdx(t,r,i,n){let s=t.buffer.active,o=s.getNullCell(),a=i;for(;n;){let d=s.getLine(r);if(!d)return[-1,-1];for(let l=a;l<d.length;++l){d.getCell(l,o);let _=o.getChars();if(o.getWidth()&&(n-=_.length||1,l===d.length-1&&_==="")){let m=s.getLine(r+1);m&&m.isWrapped&&(m.getCell(0,o),o.getWidth()===2&&(n+=1))}if(n<0)return[r,l]}r++,a=0}return[r,a]}},tf=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function rf(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 rl=class{constructor(e=rf,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||tf;this._linkProvider=this._terminal.registerLinkProvider(new Zu(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var sf=Object.defineProperty,nf=Object.getOwnPropertyDescriptor,of=(e,t,r,i)=>{for(var n=i>1?void 0:i?nf(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=(i?o(t,r,n):o(n))||n);return i&&n&&sf(t,r,n),n},af=(e,t)=>(r,i)=>t(r,i,e),lf=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?il.isErrorNoTelemetry(e)?new il(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)}},bu=new vu;function ni(e){wu(e)||bu.onUnexpectedError(e)}var In="Canceled";function wu(e){return e instanceof yu?!0:e instanceof Error&&e.name===In&&e.message===In}var yu=class extends Error{constructor(){super(In),this.name=this.message}},Ia=class Nn extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Nn)return t;let r=new Nn;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Su(e,t,r=0,s=e.length){let o=r,i=s;for(;o<i;){let n=Math.floor((o+i)/2);t(e[n])?o=n+1:i=n}return o-1}var Cu=class xl{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(xl.assertInvariants){if(this._prevFindLastPredicate){for(let s of this._array)if(this._prevFindLastPredicate(s)&&!t(s))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=Su(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};Cu.assertInvariants=!1;var Hn;(e=>{function t(i){return i<0}e.isLessThan=t;function r(i){return i<=0}e.isLessThanOrEqual=r;function s(i){return i>0}e.isGreaterThan=s;function o(i){return i===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Hn||(Hn={}));function xu(e,t){return(r,s)=>t(e(r),e(s))}var ku=(e,t)=>e-t,Na=class Fn{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 Fn(r=>this.iterate(s=>t(s)?r(s):!0))}map(t){return new Fn(r=>this.iterate(s=>r(t(s))))}some(t){let r=!1;return this.iterate(s=>(r=t(s),!r)),r}findFirst(t){let r;return this.iterate(s=>t(s)?(r=s,!1):!0),r}findLast(t){let r;return this.iterate(s=>(t(s)&&(r=s),!0)),r}findLastMaxBy(t){let r,s=!0;return this.iterate(o=>((s||Hn.isGreaterThan(t(o,r)))&&(s=!1,r=o),!0)),r}};Na.empty=new Na(e=>{});function Eu(e,t){let r=Object.create(null);for(let s of e){let o=t(s),i=r[o];i||(i=r[o]=[]),i.push(s)}return r}var Ha,Fa,$g=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Ha]="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))}[(Fa=Symbol.iterator,Ha=Symbol.toStringTag,Fa)](){return this.values()}},Lu=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 Tu(e,t){let r=this,s=!1,o;return function(){if(s)return o;if(s=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var Wn;(e=>{function t(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function s(){return r}e.empty=s;function*o(g){yield g}e.single=o;function i(g){return t(g)?g:o(g)}e.wrap=i;function n(g){return g||r}e.from=n;function*a(g){for(let x=g.length-1;x>=0;x--)yield g[x]}e.reverse=a;function d(g){return!g||g[Symbol.iterator]().next().done===!0}e.isEmpty=d;function l(g){return g[Symbol.iterator]().next().value}e.first=l;function _(g,x){let b=0;for(let E of g)if(x(E,b++))return!0;return!1}e.some=_;function m(g,x){for(let b of g)if(x(b))return b}e.find=m;function*y(g,x){for(let b of g)x(b)&&(yield b)}e.filter=y;function*p(g,x){let b=0;for(let E of g)yield x(E,b++)}e.map=p;function*c(g,x){let b=0;for(let E of g)yield*x(E,b++)}e.flatMap=c;function*u(...g){for(let x of g)yield*x}e.concat=u;function h(g,x,b){let E=b;for(let P of g)E=x(E,P);return E}e.reduce=h;function*f(g,x,b=g.length){for(x<0&&(x+=g.length),b<0?b+=g.length:b>g.length&&(b=g.length);x<b;x++)yield g[x]}e.slice=f;function v(g,x=Number.POSITIVE_INFINITY){let b=[];if(x===0)return[b,g];let E=g[Symbol.iterator]();for(let P=0;P<x;P++){let O=E.next();if(O.done)return[b,e.empty()];b.push(O.value)}return[b,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(g){let x=[];for await(let b of g)x.push(b);return Promise.resolve(x)}e.asyncToArray=S})(Wn||(Wn={}));var Ru=!1,Hr=null,Mu=class kl{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:kl.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 s=this.getDisposableData(t);s.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let s=r.get(t);if(s)return s;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 s;if(r)s=r;else{let d=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,d).isSingleton);if(l.length===0)return;let _=new Set(l.map(m=>m.value));if(s=l.filter(m=>!(m.parent&&_.has(m.parent))),s.length===0)throw new Error("There are cyclic diposable chains!")}if(!s)return;function o(d){function l(m,y){for(;m.length>0&&y.some(p=>typeof p=="string"?p===m[0]:m[0].match(p));)m.shift()}let _=d.source.split(`
40
- `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let i=new Lu;for(let d of s){let l=o(d);for(let _=0;_<=l.length;_++)i.add(l.slice(0,_).join(`
41
- `),d)}s.sort(xu(d=>d.idx,ku));let n="",a=0;for(let d of s.slice(0,t)){a++;let l=o(d),_=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${i.get(l.slice(0,m+1).join(`
42
- `)).size}/${s.length} leaks) at ${y}`;let p=i.get(l.slice(0,m).join(`
43
- `)),c=Eu([...p].map(u=>o(u)[m]),u=>u);delete c[l[m]];for(let[u,h]of Object.entries(c))_.unshift(` - stacktraces of ${h.length} other leaks continue with ${u}`);_.unshift(y)}n+=`
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)}},cf=new lf;function bs(e){hf(e)||cf.onUnexpectedError(e)}var Jn="Canceled";function hf(e){return e instanceof df?!0:e instanceof Error&&e.name===Jn&&e.message===Jn}var df=class extends Error{constructor(){super(Jn),this.name=this.message}},il=class Zn extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Zn)return t;let r=new Zn;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function uf(e,t,r=0,i=e.length){let n=r,s=i;for(;n<s;){let o=Math.floor((n+s)/2);t(e[o])?n=o+1:s=o}return n-1}var ff=class ql{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(ql.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=uf(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};ff.assertInvariants=!1;var Qn;(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 n(s){return s===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Qn||(Qn={}));function pf(e,t){return(r,i)=>t(e(r),e(i))}var _f=(e,t)=>e-t,sl=class eo{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 eo(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new eo(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(n=>((i||Qn.isGreaterThan(t(n,r)))&&(i=!1,r=n),!0)),r}};sl.empty=new sl(e=>{});function mf(e,t){let r=Object.create(null);for(let i of e){let n=t(i),s=r[n];s||(s=r[n]=[]),s.push(i)}return r}var nl,ol,Uv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[nl]="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))}[(ol=Symbol.iterator,nl=Symbol.toStringTag,ol)](){return this.values()}},gf=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 vf(e,t){let r=this,i=!1,n;return function(){if(i)return n;if(i=!0,t)try{n=e.apply(r,arguments)}finally{t()}else n=e.apply(r,arguments);return n}}var to;(e=>{function t(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*n(g){yield g}e.single=n;function s(g){return t(g)?g:n(g)}e.wrap=s;function o(g){return g||r}e.from=o;function*a(g){for(let x=g.length-1;x>=0;x--)yield g[x]}e.reverse=a;function d(g){return!g||g[Symbol.iterator]().next().done===!0}e.isEmpty=d;function l(g){return g[Symbol.iterator]().next().value}e.first=l;function _(g,x){let w=0;for(let E of g)if(x(E,w++))return!0;return!1}e.some=_;function m(g,x){for(let w of g)if(x(w))return w}e.find=m;function*y(g,x){for(let w of g)x(w)&&(yield w)}e.filter=y;function*p(g,x){let w=0;for(let E of g)yield x(E,w++)}e.map=p;function*c(g,x){let w=0;for(let E of g)yield*x(E,w++)}e.flatMap=c;function*u(...g){for(let x of g)yield*x}e.concat=u;function h(g,x,w){let E=w;for(let P of g)E=x(E,P);return E}e.reduce=h;function*f(g,x,w=g.length){for(x<0&&(x+=g.length),w<0?w+=g.length:w>g.length&&(w=g.length);x<w;x++)yield g[x]}e.slice=f;function v(g,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,g];let E=g[Symbol.iterator]();for(let P=0;P<x;P++){let O=E.next();if(O.done)return[w,e.empty()];w.push(O.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(g){let x=[];for await(let w of g)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(to||(to={}));var bf=!1,qr=null,wf=class Kl{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:Kl.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 n=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,n),n}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 d=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,d).isSingleton);if(l.length===0)return;let _=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&_.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function n(d){function l(m,y){for(;m.length>0&&y.some(p=>typeof p=="string"?p===m[0]:m[0].match(p));)m.shift()}let _=d.source.split(`
40
+ `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let s=new gf;for(let d of i){let l=n(d);for(let _=0;_<=l.length;_++)s.add(l.slice(0,_).join(`
41
+ `),d)}i.sort(pf(d=>d.idx,_f));let o="",a=0;for(let d of i.slice(0,t)){a++;let l=n(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
+ `)).size}/${i.length} leaks) at ${y}`;let p=s.get(l.slice(0,m).join(`
43
+ `)),c=mf([...p].map(u=>n(u)[m]),u=>u);delete c[l[m]];for(let[u,h]of Object.entries(c))_.unshift(` - stacktraces of ${h.length} other leaks continue with ${u}`);_.unshift(y)}o+=`
44
44
 
45
45
 
46
- ==================== Leaking disposable ${a}/${s.length}: ${d.value.constructor.name} ====================
46
+ ==================== Leaking disposable ${a}/${i.length}: ${d.value.constructor.name} ====================
47
47
  ${_.join(`
48
48
  `)}
49
49
  ============================================================
50
50
 
51
- `}return s.length>t&&(n+=`
51
+ `}return i.length>t&&(o+=`
52
52
 
53
53
 
54
- ... and ${s.length-t} more leaking disposables
54
+ ... and ${i.length-t} more leaking disposables
55
55
 
56
- `),{leaks:s,details:n}}};Mu.idx=0;function Au(e){Hr=e}if(Ru){let e="__is_disposable_tracked__";Au(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!==at.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==at.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function _i(e){return Hr?.trackDisposable(e),e}function mi(e){Hr?.markAsDisposed(e)}function ps(e,t){Hr?.setParent(e,t)}function Du(e,t){if(Hr)for(let r of e)Hr.setParent(r,t)}function El(e){if(Wn.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(s){t.push(s)}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 Ll(...e){let t=Ge(()=>El(e));return Du(e,t),t}function Ge(e){let t=_i({dispose:Tu(()=>{mi(t),e()})});return t}var Tl=class Rl{constructor(){this._toDispose=new Set,this._isDisposed=!1,_i(this)}dispose(){this._isDisposed||(mi(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{El(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 ps(t,this),this._isDisposed?Rl.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),ps(t,null))}};Tl.DISABLE_DISPOSED_WARNING=!1;var Nr=Tl,at=class{constructor(){this._store=new Nr,_i(this),ps(this._store,this)}dispose(){mi(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};at.None=Object.freeze({dispose(){}});var cs=class{constructor(){this._isDisposed=!1,_i(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ps(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,mi(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ps(e,null),e}},Yn=typeof process<"u"&&"title"in process,ms=Yn?"node":navigator.userAgent,Xn=Yn?"node":navigator.platform,Pu=ms.includes("Firefox"),Bu=ms.includes("Edge"),Ml=/^((?!chrome|android).)*safari/i.test(ms);function Ou(){if(!Ml)return 0;let e=ms.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var qg=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Xn),Kg=["Windows","Win16","Win32","WinCE"].includes(Xn),Gg=Xn.indexOf("Linux")>=0,Vg=/\bCrOS\b/.test(ms),Iu="",je=0,$e=0,qe=0,Ne=0,ut={css:"#00000000",rgba:0},Je;(e=>{function t(o,i,n,a){return a!==void 0?`#${fr(o)}${fr(i)}${fr(n)}${fr(a)}`:`#${fr(o)}${fr(i)}${fr(n)}`}e.toCss=t;function r(o,i,n,a=255){return(o<<24|i<<16|n<<8|a)>>>0}e.toRgba=r;function s(o,i,n,a){return{css:e.toCss(o,i,n,a),rgba:e.toRgba(o,i,n,a)}}e.toColor=s})(Je||(Je={}));var Br;(e=>{function t(d,l){if(Ne=(l.rgba&255)/255,Ne===1)return{css:l.css,rgba:l.rgba};let _=l.rgba>>24&255,m=l.rgba>>16&255,y=l.rgba>>8&255,p=d.rgba>>24&255,c=d.rgba>>16&255,u=d.rgba>>8&255;je=p+Math.round((_-p)*Ne),$e=c+Math.round((m-c)*Ne),qe=u+Math.round((y-u)*Ne);let h=Je.toCss(je,$e,qe),f=Je.toRgba(je,$e,qe);return{css:h,rgba:f}}e.blend=t;function r(d){return(d.rgba&255)===255}e.isOpaque=r;function s(d,l,_){let m=sr.ensureContrastRatio(d.rgba,l.rgba,_);if(m)return Je.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=s;function o(d){let l=(d.rgba|255)>>>0;return[je,$e,qe]=sr.toChannels(l),{css:Je.toCss(je,$e,qe),rgba:l}}e.opaque=o;function i(d,l){return Ne=Math.round(l*255),[je,$e,qe]=sr.toChannels(d.rgba),{css:Je.toCss(je,$e,qe,Ne),rgba:Je.toRgba(je,$e,qe,Ne)}}e.opacity=i;function n(d,l){return Ne=d.rgba&255,i(d,Ne*l/255)}e.multiplyOpacity=n;function a(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}e.toColorRGB=a})(Br||(Br={}));var Wa;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let i=o.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return je=parseInt(o.slice(1,2).repeat(2),16),$e=parseInt(o.slice(2,3).repeat(2),16),qe=parseInt(o.slice(3,4).repeat(2),16),Je.toColor(je,$e,qe);case 5:return je=parseInt(o.slice(1,2).repeat(2),16),$e=parseInt(o.slice(2,3).repeat(2),16),qe=parseInt(o.slice(3,4).repeat(2),16),Ne=parseInt(o.slice(4,5).repeat(2),16),Je.toColor(je,$e,qe,Ne);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 i=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(i)return je=parseInt(i[1]),$e=parseInt(i[2]),qe=parseInt(i[3]),Ne=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),Je.toColor(je,$e,qe,Ne);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),[je,$e,qe,Ne]=t.getImageData(0,0,1,1).data,Ne!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Je.toRgba(je,$e,qe,Ne),css:o}}e.toColor=s})(Wa||(Wa={}));var Xe;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,o,i){let n=s/255,a=o/255,d=i/255,l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return l*.2126+_*.7152+m*.0722}e.relativeLuminance2=r})(Xe||(Xe={}));var sr;(e=>{function t(n,a){if(Ne=(a&255)/255,Ne===1)return a;let d=a>>24&255,l=a>>16&255,_=a>>8&255,m=n>>24&255,y=n>>16&255,p=n>>8&255;return je=m+Math.round((d-m)*Ne),$e=y+Math.round((l-y)*Ne),qe=p+Math.round((_-p)*Ne),Je.toRgba(je,$e,qe)}e.blend=t;function r(n,a,d){let l=Xe.relativeLuminance(n>>8),_=Xe.relativeLuminance(a>>8);if(Ft(l,_)<d){if(_<l){let p=s(n,a,d),c=Ft(l,Xe.relativeLuminance(p>>8));if(c<d){let u=o(n,a,d),h=Ft(l,Xe.relativeLuminance(u>>8));return c>h?p:u}return p}let m=o(n,a,d),y=Ft(l,Xe.relativeLuminance(m>>8));if(y<d){let p=s(n,a,d),c=Ft(l,Xe.relativeLuminance(p>>8));return y>c?m:p}return m}}e.ensureContrastRatio=r;function s(n,a,d){let l=n>>24&255,_=n>>16&255,m=n>>8&255,y=a>>24&255,p=a>>16&255,c=a>>8&255,u=Ft(Xe.relativeLuminance2(y,p,c),Xe.relativeLuminance2(l,_,m));for(;u<d&&(y>0||p>0||c>0);)y-=Math.max(0,Math.ceil(y*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),u=Ft(Xe.relativeLuminance2(y,p,c),Xe.relativeLuminance2(l,_,m));return(y<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=s;function o(n,a,d){let l=n>>24&255,_=n>>16&255,m=n>>8&255,y=a>>24&255,p=a>>16&255,c=a>>8&255,u=Ft(Xe.relativeLuminance2(y,p,c),Xe.relativeLuminance2(l,_,m));for(;u<d&&(y<255||p<255||c<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),u=Ft(Xe.relativeLuminance2(y,p,c),Xe.relativeLuminance2(l,_,m));return(y<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=o;function i(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=i})(sr||(sr={}));function fr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ft(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function We(e){if(!e)throw new Error("value must not be falsy");return e}function Jn(e){return 57508<=e&&e<=57558}function Nu(e){return 57520<=e&&e<=57527}function Hu(e){return 57344<=e&&e<=63743}function Fu(e){return 9472<=e&&e<=9631}function Wu(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 Uu(e,t,r,s){return t===1&&r>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!Wu(e)&&!Jn(e)&&!Hu(e)}function Al(e){return Jn(e)||Fu(e)}function zu(){return{css:{canvas:ti(),cell:ti()},device:{canvas:ti(),cell:ti(),char:{width:0,height:0,left:0,top:0}}}}function ti(){return{width:0,height:0}}function ju(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Ke=0,ze=0,Mt=!1,Wt=!1,ri=!1,rt,Sn=0,$u=class{constructor(e,t,r,s,o,i){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=s,this._coreBrowserService=o,this._themeService=i,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,ze=0,Ke=0,Wt=!1,Mt=!1,ri=!1,rt=this._themeService.colors,Sn=0,e.getCode()!==0&&e.extended.underlineStyle===4){let o=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Sn=t*s%(Math.round(o)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",o=>{o.backgroundColorRGB&&(ze=o.backgroundColorRGB.rgba>>8&16777215,Wt=!0),o.foregroundColorRGB&&(Ke=o.foregroundColorRGB.rgba>>8&16777215,Mt=!0)}),ri=this._selectionRenderModel.isCellSelected(this._terminal,t,r),ri){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ze=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ze=(this.result.fg&16777215)<<8|255;break;default:ze=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ze=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ze=(this.result.bg&16777215)<<8|255;break}ze=sr.blend(ze,(this._coreBrowserService.isFocused?rt.selectionBackgroundOpaque:rt.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ze=(this._coreBrowserService.isFocused?rt.selectionBackgroundOpaque:rt.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Wt=!0,rt.selectionForeground&&(Ke=rt.selectionForeground.rgba>>8&16777215,Mt=!0),Al(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ke=(this._coreBrowserService.isFocused?rt.selectionBackgroundOpaque:rt.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ke=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ke=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ke=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ke=(this.result.fg&16777215)<<8|255;break;default:Ke=this._themeService.colors.foreground.rgba}Ke=sr.blend(Ke,(this._coreBrowserService.isFocused?rt.selectionBackgroundOpaque:rt.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Mt=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",o=>{o.backgroundColorRGB&&(ze=o.backgroundColorRGB.rgba>>8&16777215,Wt=!0),o.foregroundColorRGB&&(Ke=o.foregroundColorRGB.rgba>>8&16777215,Mt=!0)}),Wt&&(ri?ze=e.bg&-16777216&-134217729|ze|50331648:ze=e.bg&-16777216|ze|50331648),Mt&&(Ke=e.fg&-16777216&-67108865|Ke|50331648),this.result.fg&67108864&&(Wt&&!Mt&&((this.result.bg&50331648)===0?Ke=this.result.fg&-134217728|rt.background.rgba>>8&16777215&16777215|50331648:Ke=this.result.fg&-134217728|this.result.bg&67108863,Mt=!0),!Wt&&Mt&&((this.result.fg&50331648)===0?ze=this.result.bg&-67108864|rt.foreground.rgba>>8&16777215&16777215|50331648:ze=this.result.bg&-67108864|this.result.fg&67108863,Wt=!0)),rt=void 0,this.result.bg=Wt?ze:this.result.bg,this.result.fg=Mt?Ke:this.result.fg,this.result.ext&=536870911,this.result.ext|=Sn<<29&3758096384}},qu=.5,Dl=Pu||Bu?"bottom":"ideographic",Ku={"\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}]},Gu={"\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]]},Vu={"\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`}},_s={"\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}};_s["\uE0BB"]=_s["\uE0BD"];_s["\uE0BF"]=_s["\uE0B9"];function Yu(e,t,r,s,o,i,n,a){let d=Ku[t];if(d)return Xu(e,d,r,s,o,i),!0;let l=Gu[t];if(l)return Ju(e,l,r,s,o,i),!0;let _=Vu[t];if(_)return Zu(e,_,r,s,o,i,a),!0;let m=_s[t];return m?(Qu(e,m,r,s,o,i,n,a),!0):!1}function Xu(e,t,r,s,o,i){for(let n=0;n<t.length;n++){let a=t[n],d=o/8,l=i/8;e.fillRect(r+a.x*d,s+a.y*l,a.w*d,a.h*l)}}var Ua=new Map;function Ju(e,t,r,s,o,i){let n=Ua.get(t);n||(n=new Map,Ua.set(t,n));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let d=n.get(a);if(!d){let l=t[0].length,_=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=l,m.height=_;let y=We(m.getContext("2d")),p=new ImageData(l,_),c,u,h,f;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),u=parseInt(a.slice(3,5),16),h=parseInt(a.slice(5,7),16),f=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,u,h,f]=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<_;v++)for(let S=0;S<l;S++)p.data[(v*l+S)*4]=c,p.data[(v*l+S)*4+1]=u,p.data[(v*l+S)*4+2]=h,p.data[(v*l+S)*4+3]=t[v][S]*(f*255);y.putImageData(p,0,0),d=We(e.createPattern(m,null)),n.set(a,d)}e.fillStyle=d,e.fillRect(r,s,o,i)}function Zu(e,t,r,s,o,i,n){e.strokeStyle=e.fillStyle;for(let[a,d]of Object.entries(t)){e.beginPath(),e.lineWidth=n*Number.parseInt(a);let l;if(typeof d=="function"){let _=.15/i*o;l=d(.15,_)}else l=d;for(let _ of l.split(" ")){let m=_[0],y=Pl[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||y(e,Bl(p,o,i,r,s,!0,n))}e.stroke(),e.closePath()}}function Qu(e,t,r,s,o,i,n,a){let d=new Path2D;d.rect(r,s,o,i),e.clip(d),e.beginPath();let l=n/12;e.lineWidth=a*l;for(let _ of t.d.split(" ")){let m=_[0],y=Pl[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||y(e,Bl(p,o,i,r,s,!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 za(e,t,r=0){return Math.max(Math.min(e,t),r)}var Pl={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 Bl(e,t,r,s,o,i,n,a=0,d=0){let l=e.map(_=>parseFloat(_)||parseInt(_));if(l.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<l.length;_+=2)l[_]*=t-a*n-d*n,i&&l[_]!==0&&(l[_]=za(Math.round(l[_]+.5)-.5,t,0)),l[_]+=s+a*n;for(let _=1;_<l.length;_+=2)l[_]*=r,i&&l[_]!==0&&(l[_]=za(Math.round(l[_]+.5)-.5,r,0)),l[_]+=o;return l}var ja=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={}}},$a=class{constructor(){this._data=new ja}set(e,t,r,s,o){this._data.get(e,t)||this._data.set(e,t,new ja),this._data.get(e,t).set(r,s,o)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}},Ol=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,s=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){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},ef=class extends Ol{_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())}}},tf=class extends Ol{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},rf=!Yn&&"requestIdleCallback"in window?tf:ef,Or=class Il{constructor(){this.fg=0,this.bg=0,this.extended=new Nl}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 Il;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}},Nl=class Hl{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 Hl(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},qa=class Un{constructor(t){this.element=t,this.next=Un.Undefined,this.prev=Un.Undefined}};qa.Undefined=new qa(void 0);var sf=globalThis.performance&&typeof globalThis.performance.now=="function",nf=class Fl{static create(t){return new Fl(t)}constructor(t){this._now=sf&&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}},of=!1,Ka=!1,af=!1,At;(e=>{e.None=()=>at.None;function t(B){if(af){let{onDidAddListener:M}=B,U=$n.create(),I=0;B.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),U.print()),M?.()}}}function r(B,M){return y(B,()=>{},0,void 0,!0,void 0,M)}e.defer=r;function s(B){return(M,U=null,I)=>{let C=!1,L;return L=B(T=>{if(!C)return L?L.dispose():C=!0,M.call(U,T)},null,I),C&&L.dispose(),L}}e.once=s;function o(B,M,U){return _((I,C=null,L)=>B(T=>I.call(C,M(T)),null,L),U)}e.map=o;function i(B,M,U){return _((I,C=null,L)=>B(T=>{M(T),I.call(C,T)},null,L),U)}e.forEach=i;function n(B,M,U){return _((I,C=null,L)=>B(T=>M(T)&&I.call(C,T),null,L),U)}e.filter=n;function a(B){return B}e.signal=a;function d(...B){return(M,U=null,I)=>{let C=Ll(...B.map(L=>L(T=>M.call(U,T))));return m(C,I)}}e.any=d;function l(B,M,U,I){let C=U;return o(B,L=>(C=M(C,L),C),I)}e.reduce=l;function _(B,M){let U,I={onWillAddFirstListener(){U=B(C.fire,C)},onDidRemoveLastListener(){U?.dispose()}};M||t(I);let C=new Me(I);return M?.add(C),C.event}function m(B,M){return M instanceof Array?M.push(B):M&&M.add(B),B}function y(B,M,U=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=B(W=>{$++,N=M(N,W),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 U=="number"?(clearTimeout(G),G=setTimeout(Y,U)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Me(H);return T?.add(k),k.event}e.debounce=y;function p(B,M=0,U){return e.debounce(B,(I,C)=>I?(I.push(C),I):[C],M,void 0,!0,void 0,U)}e.accumulate=p;function c(B,M=(I,C)=>I===C,U){let I=!0,C;return n(B,L=>{let T=I||!M(L,C);return I=!1,C=L,T},U)}e.latch=c;function u(B,M,U){return[e.filter(B,M,U),e.filter(B,I=>!M(I),U)]}e.split=u;function h(B,M=!1,U=[],I){let C=U.slice(),L=B(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Me({onWillAddFirstListener(){L||(L=B(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(M?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function f(B,M){return(U,I,C)=>{let L=M(new S);return B(function(T){let D=L.evaluate(T);D!==v&&U.call(I,D)},void 0,C)}}e.chain=f;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(U=>(M(U),U)),this}filter(M){return this.steps.push(U=>M(U)?U:v),this}reduce(M,U){let I=U;return this.steps.push(C=>(I=M(I,C),I)),this}latch(M=(U,I)=>U===I){let U=!0,I;return this.steps.push(C=>{let L=U||!M(C,I);return U=!1,I=C,L?C:v}),this}evaluate(M){for(let U of this.steps)if(M=U(M),M===v)break;return M}}function g(B,M,U=I=>I){let I=(...D)=>T.fire(U(...D)),C=()=>B.on(M,I),L=()=>B.removeListener(M,I),T=new Me({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=g;function x(B,M,U=I=>I){let I=(...D)=>T.fire(U(...D)),C=()=>B.addEventListener(M,I),L=()=>B.removeEventListener(M,I),T=new Me({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function b(B){return new Promise(M=>s(B)(M))}e.toPromise=b;function E(B){let M=new Me;return B.then(U=>{M.fire(U)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=E;function P(B,M){return B(U=>M.fire(U))}e.forward=P;function O(B,M,U){return M(U),B(I=>M(I))}e.runAndSubscribe=O;class F{constructor(M,U){this._observable=M,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};U||t(I),this.emitter=new Me(I),U&&U.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,U){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(B,M){return new F(B,M).emitter.event}e.fromObservable=A;function V(B){return(M,U,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(B.reportChanges(),L&&(L=!1,M.call(U)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver(T),B.reportChanges();let D={dispose(){B.removeObserver(T)}};return I instanceof Nr?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(At||(At={}));var zn=class jn{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${jn._idPool++}`,jn.all.add(this)}start(t){this._stopWatch=new nf,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}}};zn.all=new Set,zn._idPool=0;var lf=zn,Ga=-1,Wl=class Ul{constructor(t,r,s=(Ul._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let s=this.threshold;if(s<=0||r<s)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=s*.5;let[i,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(i);let d=new hf(a,i);this._errorHandler(d)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[s,o]of this._stacks)(!t||r<o)&&(t=[s,o],r=o);return t}};Wl._idPool=1;var cf=Wl,$n=class zl{constructor(t){this.value=t}static create(){let t=new Error;return new zl(t.stack??"")}print(){console.warn(this.value.split(`
56
+ `),{leaks:i,details:o}}};wf.idx=0;function yf(e){qr=e}if(bf){let e="__is_disposable_tracked__";yf(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!==ct.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==ct.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Ms(e){return qr?.trackDisposable(e),e}function Rs(e){qr?.markAsDisposed(e)}function xi(e,t){qr?.setParent(e,t)}function Sf(e,t){if(qr)for(let r of e)qr.setParent(r,t)}function Gl(e){if(to.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 Vl(...e){let t=Ye(()=>Gl(e));return Sf(e,t),t}function Ye(e){let t=Ms({dispose:vf(()=>{Rs(t),e()})});return t}var Yl=class Xl{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ms(this)}dispose(){this._isDisposed||(Rs(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Gl(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 xi(t,this),this._isDisposed?Xl.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),xi(t,null))}};Yl.DISABLE_DISPOSED_WARNING=!1;var $r=Yl,ct=class{constructor(){this._store=new $r,Ms(this),xi(this._store,this)}dispose(){Rs(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ct.None=Object.freeze({dispose(){}});var bi=class{constructor(){this._isDisposed=!1,Ms(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&xi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Rs(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&xi(e,null),e}},ho=typeof process<"u"&&"title"in process,Ei=ho?"node":navigator.userAgent,uo=ho?"node":navigator.platform,Cf=Ei.includes("Firefox"),xf=Ei.includes("Edge"),Jl=/^((?!chrome|android).)*safari/i.test(Ei);function kf(){if(!Jl)return 0;let e=Ei.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var jv=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(uo),$v=["Windows","Win16","Win32","WinCE"].includes(uo),qv=uo.indexOf("Linux")>=0,Kv=/\bCrOS\b/.test(Ei),Ef="",$e=0,qe=0,Ke=0,Fe=0,dt={css:"#00000000",rgba:0},et;(e=>{function t(n,s,o,a){return a!==void 0?`#${gr(n)}${gr(s)}${gr(o)}${gr(a)}`:`#${gr(n)}${gr(s)}${gr(o)}`}e.toCss=t;function r(n,s,o,a=255){return(n<<24|s<<16|o<<8|a)>>>0}e.toRgba=r;function i(n,s,o,a){return{css:e.toCss(n,s,o,a),rgba:e.toRgba(n,s,o,a)}}e.toColor=i})(et||(et={}));var zr;(e=>{function t(d,l){if(Fe=(l.rgba&255)/255,Fe===1)return{css:l.css,rgba:l.rgba};let _=l.rgba>>24&255,m=l.rgba>>16&255,y=l.rgba>>8&255,p=d.rgba>>24&255,c=d.rgba>>16&255,u=d.rgba>>8&255;$e=p+Math.round((_-p)*Fe),qe=c+Math.round((m-c)*Fe),Ke=u+Math.round((y-u)*Fe);let h=et.toCss($e,qe,Ke),f=et.toRgba($e,qe,Ke);return{css:h,rgba:f}}e.blend=t;function r(d){return(d.rgba&255)===255}e.isOpaque=r;function i(d,l,_){let m=lr.ensureContrastRatio(d.rgba,l.rgba,_);if(m)return et.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=i;function n(d){let l=(d.rgba|255)>>>0;return[$e,qe,Ke]=lr.toChannels(l),{css:et.toCss($e,qe,Ke),rgba:l}}e.opaque=n;function s(d,l){return Fe=Math.round(l*255),[$e,qe,Ke]=lr.toChannels(d.rgba),{css:et.toCss($e,qe,Ke,Fe),rgba:et.toRgba($e,qe,Ke,Fe)}}e.opacity=s;function o(d,l){return Fe=d.rgba&255,s(d,Fe*l/255)}e.multiplyOpacity=o;function a(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}e.toColorRGB=a})(zr||(zr={}));var al;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let s=n.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return $e=parseInt(n.slice(1,2).repeat(2),16),qe=parseInt(n.slice(2,3).repeat(2),16),Ke=parseInt(n.slice(3,4).repeat(2),16),et.toColor($e,qe,Ke);case 5:return $e=parseInt(n.slice(1,2).repeat(2),16),qe=parseInt(n.slice(2,3).repeat(2),16),Ke=parseInt(n.slice(3,4).repeat(2),16),Fe=parseInt(n.slice(4,5).repeat(2),16),et.toColor($e,qe,Ke,Fe);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let s=n.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 $e=parseInt(s[1]),qe=parseInt(s[2]),Ke=parseInt(s[3]),Fe=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),et.toColor($e,qe,Ke,Fe);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[$e,qe,Ke,Fe]=t.getImageData(0,0,1,1).data,Fe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:et.toRgba($e,qe,Ke,Fe),css:n}}e.toColor=i})(al||(al={}));var Qe;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,n,s){let o=i/255,a=n/255,d=s/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return l*.2126+_*.7152+m*.0722}e.relativeLuminance2=r})(Qe||(Qe={}));var lr;(e=>{function t(o,a){if(Fe=(a&255)/255,Fe===1)return a;let d=a>>24&255,l=a>>16&255,_=a>>8&255,m=o>>24&255,y=o>>16&255,p=o>>8&255;return $e=m+Math.round((d-m)*Fe),qe=y+Math.round((l-y)*Fe),Ke=p+Math.round((_-p)*Fe),et.toRgba($e,qe,Ke)}e.blend=t;function r(o,a,d){let l=Qe.relativeLuminance(o>>8),_=Qe.relativeLuminance(a>>8);if(jt(l,_)<d){if(_<l){let p=i(o,a,d),c=jt(l,Qe.relativeLuminance(p>>8));if(c<d){let u=n(o,a,d),h=jt(l,Qe.relativeLuminance(u>>8));return c>h?p:u}return p}let m=n(o,a,d),y=jt(l,Qe.relativeLuminance(m>>8));if(y<d){let p=i(o,a,d),c=jt(l,Qe.relativeLuminance(p>>8));return y>c?m:p}return m}}e.ensureContrastRatio=r;function i(o,a,d){let l=o>>24&255,_=o>>16&255,m=o>>8&255,y=a>>24&255,p=a>>16&255,c=a>>8&255,u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));for(;u<d&&(y>0||p>0||c>0);)y-=Math.max(0,Math.ceil(y*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));return(y<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=i;function n(o,a,d){let l=o>>24&255,_=o>>16&255,m=o>>8&255,y=a>>24&255,p=a>>16&255,c=a>>8&255,u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));for(;u<d&&(y<255||p<255||c<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));return(y<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=n;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(lr||(lr={}));function gr(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 ze(e){if(!e)throw new Error("value must not be falsy");return e}function fo(e){return 57508<=e&&e<=57558}function Lf(e){return 57520<=e&&e<=57527}function Tf(e){return 57344<=e&&e<=63743}function Mf(e){return 9472<=e&&e<=9631}function Rf(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 Af(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Rf(e)&&!fo(e)&&!Tf(e)}function Zl(e){return fo(e)||Mf(e)}function Df(){return{css:{canvas:_s(),cell:_s()},device:{canvas:_s(),cell:_s(),char:{width:0,height:0,left:0,top:0}}}}function _s(){return{width:0,height:0}}function Pf(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Ve=0,je=0,Rt=!1,$t=!1,ms=!1,st,Nn=0,Bf=class{constructor(e,t,r,i,n,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=n,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,je=0,Ve=0,$t=!1,Rt=!1,ms=!1,st=this._themeService.colors,Nn=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Nn=t*i%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(je=n.backgroundColorRGB.rgba>>8&16777215,$t=!0),n.foregroundColorRGB&&(Ve=n.foregroundColorRGB.rgba>>8&16777215,Rt=!0)}),ms=this._selectionRenderModel.isCellSelected(this._terminal,t,r),ms){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:je=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:je=(this.result.fg&16777215)<<8|255;break;default:je=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:je=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:je=(this.result.bg&16777215)<<8|255;break}je=lr.blend(je,(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else je=(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if($t=!0,st.selectionForeground&&(Ve=st.selectionForeground.rgba>>8&16777215,Rt=!0),Zl(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ve=(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ve=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ve=(this.result.fg&16777215)<<8|255;break;default:Ve=this._themeService.colors.foreground.rgba}Ve=lr.blend(Ve,(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Rt=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(je=n.backgroundColorRGB.rgba>>8&16777215,$t=!0),n.foregroundColorRGB&&(Ve=n.foregroundColorRGB.rgba>>8&16777215,Rt=!0)}),$t&&(ms?je=e.bg&-16777216&-134217729|je|50331648:je=e.bg&-16777216|je|50331648),Rt&&(Ve=e.fg&-16777216&-67108865|Ve|50331648),this.result.fg&67108864&&($t&&!Rt&&((this.result.bg&50331648)===0?Ve=this.result.fg&-134217728|st.background.rgba>>8&16777215&16777215|50331648:Ve=this.result.fg&-134217728|this.result.bg&67108863,Rt=!0),!$t&&Rt&&((this.result.fg&50331648)===0?je=this.result.bg&-67108864|st.foreground.rgba>>8&16777215&16777215|50331648:je=this.result.bg&-67108864|this.result.fg&67108863,$t=!0)),st=void 0,this.result.bg=$t?je:this.result.bg,this.result.fg=Rt?Ve:this.result.fg,this.result.ext&=536870911,this.result.ext|=Nn<<29&3758096384}},Of=.5,Ql=Cf||xf?"bottom":"ideographic",If={"\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}]},Nf={"\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]]},Hf={"\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`}},ki={"\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}};ki["\uE0BB"]=ki["\uE0BD"];ki["\uE0BF"]=ki["\uE0B9"];function Ff(e,t,r,i,n,s,o,a){let d=If[t];if(d)return Wf(e,d,r,i,n,s),!0;let l=Nf[t];if(l)return zf(e,l,r,i,n,s),!0;let _=Hf[t];if(_)return Uf(e,_,r,i,n,s,a),!0;let m=ki[t];return m?(jf(e,m,r,i,n,s,o,a),!0):!1}function Wf(e,t,r,i,n,s){for(let o=0;o<t.length;o++){let a=t[o],d=n/8,l=s/8;e.fillRect(r+a.x*d,i+a.y*l,a.w*d,a.h*l)}}var ll=new Map;function zf(e,t,r,i,n,s){let o=ll.get(t);o||(o=new Map,ll.set(t,o));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let d=o.get(a);if(!d){let l=t[0].length,_=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=l,m.height=_;let y=ze(m.getContext("2d")),p=new ImageData(l,_),c,u,h,f;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),u=parseInt(a.slice(3,5),16),h=parseInt(a.slice(5,7),16),f=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,u,h,f]=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<_;v++)for(let S=0;S<l;S++)p.data[(v*l+S)*4]=c,p.data[(v*l+S)*4+1]=u,p.data[(v*l+S)*4+2]=h,p.data[(v*l+S)*4+3]=t[v][S]*(f*255);y.putImageData(p,0,0),d=ze(e.createPattern(m,null)),o.set(a,d)}e.fillStyle=d,e.fillRect(r,i,n,s)}function Uf(e,t,r,i,n,s,o){e.strokeStyle=e.fillStyle;for(let[a,d]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(a);let l;if(typeof d=="function"){let _=.15/s*n;l=d(.15,_)}else l=d;for(let _ of l.split(" ")){let m=_[0],y=ec[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||y(e,tc(p,n,s,r,i,!0,o))}e.stroke(),e.closePath()}}function jf(e,t,r,i,n,s,o,a){let d=new Path2D;d.rect(r,i,n,s),e.clip(d),e.beginPath();let l=o/12;e.lineWidth=a*l;for(let _ of t.d.split(" ")){let m=_[0],y=ec[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||y(e,tc(p,n,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 cl(e,t,r=0){return Math.max(Math.min(e,t),r)}var ec={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 tc(e,t,r,i,n,s,o,a=0,d=0){let l=e.map(_=>parseFloat(_)||parseInt(_));if(l.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<l.length;_+=2)l[_]*=t-a*o-d*o,s&&l[_]!==0&&(l[_]=cl(Math.round(l[_]+.5)-.5,t,0)),l[_]+=i+a*o;for(let _=1;_<l.length;_+=2)l[_]*=r,s&&l[_]!==0&&(l[_]=cl(Math.round(l[_]+.5)-.5,r,0)),l[_]+=n;return l}var hl=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={}}},dl=class{constructor(){this._data=new hl}set(e,t,r,i,n){this._data.get(e,t)||this._data.set(e,t,new hl),this._data.get(e,t).set(r,i,n)}get(e,t,r,i){return this._data.get(e,t)?.get(r,i)}clear(){this._data.clear()}},rc=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(),n=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),n=e.timeRemaining(),r*1.5>n){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=n}this.clear()}},$f=class extends rc{_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())}}},qf=class extends rc{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Kf=!ho&&"requestIdleCallback"in window?qf:$f,Ur=class ic{constructor(){this.fg=0,this.bg=0,this.extended=new sc}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 ic;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}},sc=class nc{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 nc(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ul=class ro{constructor(t){this.element=t,this.next=ro.Undefined,this.prev=ro.Undefined}};ul.Undefined=new ul(void 0);var Gf=globalThis.performance&&typeof globalThis.performance.now=="function",Vf=class oc{static create(t){return new oc(t)}constructor(t){this._now=Gf&&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}},Yf=!1,fl=!1,Xf=!1,At;(e=>{e.None=()=>ct.None;function t(B){if(Xf){let{onDidAddListener:R}=B,z=no.create(),I=0;B.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),z.print()),R?.()}}}function r(B,R){return y(B,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(B){return(R,z=null,I)=>{let C=!1,L;return L=B(T=>{if(!C)return L?L.dispose():C=!0,R.call(z,T)},null,I),C&&L.dispose(),L}}e.once=i;function n(B,R,z){return _((I,C=null,L)=>B(T=>I.call(C,R(T)),null,L),z)}e.map=n;function s(B,R,z){return _((I,C=null,L)=>B(T=>{R(T),I.call(C,T)},null,L),z)}e.forEach=s;function o(B,R,z){return _((I,C=null,L)=>B(T=>R(T)&&I.call(C,T),null,L),z)}e.filter=o;function a(B){return B}e.signal=a;function d(...B){return(R,z=null,I)=>{let C=Vl(...B.map(L=>L(T=>R.call(z,T))));return m(C,I)}}e.any=d;function l(B,R,z,I){let C=z;return n(B,L=>(C=R(C,L),C),I)}e.reduce=l;function _(B,R){let z,I={onWillAddFirstListener(){z=B(C.fire,C)},onDidRemoveLastListener(){z?.dispose()}};R||t(I);let C=new Me(I);return R?.add(C),C.event}function m(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function y(B,R,z=100,I=!1,C=!1,L,T){let D,N,G,j=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=B(W=>{j++,N=R(N,W),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||j>1)&&k.fire(q),j=0},typeof z=="number"?(clearTimeout(G),G=setTimeout(Y,z)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&j>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Me(H);return T?.add(k),k.event}e.debounce=y;function p(B,R=0,z){return e.debounce(B,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,z)}e.accumulate=p;function c(B,R=(I,C)=>I===C,z){let I=!0,C;return o(B,L=>{let T=I||!R(L,C);return I=!1,C=L,T},z)}e.latch=c;function u(B,R,z){return[e.filter(B,R,z),e.filter(B,I=>!R(I),z)]}e.split=u;function h(B,R=!1,z=[],I){let C=z.slice(),L=B(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Me({onWillAddFirstListener(){L||(L=B(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 f(B,R){return(z,I,C)=>{let L=R(new S);return B(function(T){let D=L.evaluate(T);D!==v&&z.call(I,D)},void 0,C)}}e.chain=f;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(z=>(R(z),z)),this}filter(R){return this.steps.push(z=>R(z)?z:v),this}reduce(R,z){let I=z;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(z,I)=>z===I){let z=!0,I;return this.steps.push(C=>{let L=z||!R(C,I);return z=!1,I=C,L?C:v}),this}evaluate(R){for(let z of this.steps)if(R=z(R),R===v)break;return R}}function g(B,R,z=I=>I){let I=(...D)=>T.fire(z(...D)),C=()=>B.on(R,I),L=()=>B.removeListener(R,I),T=new Me({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=g;function x(B,R,z=I=>I){let I=(...D)=>T.fire(z(...D)),C=()=>B.addEventListener(R,I),L=()=>B.removeEventListener(R,I),T=new Me({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(B){return new Promise(R=>i(B)(R))}e.toPromise=w;function E(B){let R=new Me;return B.then(z=>{R.fire(z)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function P(B,R){return B(z=>R.fire(z))}e.forward=P;function O(B,R,z){return R(z),B(I=>R(I))}e.runAndSubscribe=O;class F{constructor(R,z){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};z||t(I),this.emitter=new Me(I),z&&z.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,z){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(B,R){return new F(B,R).emitter.event}e.fromObservable=A;function V(B){return(R,z,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(B.reportChanges(),L&&(L=!1,R.call(z)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver(T),B.reportChanges();let D={dispose(){B.removeObserver(T)}};return I instanceof $r?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(At||(At={}));var io=class so{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${so._idPool++}`,so.all.add(this)}start(t){this._stopWatch=new Vf,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}}};io.all=new Set,io._idPool=0;var Jf=io,pl=-1,ac=class lc{constructor(t,r,i=(lc._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 n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let d=new Qf(a,s);this._errorHandler(d)}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,n]of this._stacks)(!t||r<n)&&(t=[i,n],r=n);return t}};ac._idPool=1;var Zf=ac,no=class cc{constructor(t){this.value=t}static create(){let t=new Error;return new cc(t.stack??"")}print(){console.warn(this.value.split(`
57
57
  `).slice(2).join(`
58
- `))}},hf=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},df=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},uf=0,oi=class{constructor(e){this.value=e,this.id=uf++}},ff=2,pf=(e,t)=>{if(e instanceof oi)t(e);else for(let r=0;r<e.length;r++){let s=e[r];s&&t(s)}},ai;if(of){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),ai=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Me=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ga>0||this._options?.leakWarningThreshold?new cf(e?.onListenerError??ni,this._options?.leakWarningThreshold??Ga):void 0,this._perfMon=this._options?._profName?new lf(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(Ka){let e=this._listeners;queueMicrotask(()=>{pf(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 d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new df(`${a}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(this._options?.onListenerError||ni)(l),at.None}if(this._disposed)return at.None;t&&(e=e.bind(t));let s=new oi(e),o,i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=$n.create(),o=this._leakageMon.check(s.stack,this._size+1)),Ka&&(s.stack=i??$n.create()),this._listeners?this._listeners instanceof oi?(this._deliveryQueue??(this._deliveryQueue=new _f),this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=Ge(()=>{ai?.unregister(n),o?.(),this._removeListener(s)});if(r instanceof Nr?r.add(n):Array.isArray(r)&&r.push(n),ai){let a=new Error().stack.split(`
58
+ `))}},Qf=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},ep=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},tp=0,ws=class{constructor(e){this.value=e,this.id=tp++}},rp=2,ip=(e,t)=>{if(e instanceof ws)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},ys;if(Yf){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),ys=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Me=class{constructor(e){this._size=0,this._options=e,this._leakageMon=pl>0||this._options?.leakWarningThreshold?new Zf(e?.onListenerError??bs,this._options?.leakWarningThreshold??pl):void 0,this._perfMon=this._options?._profName?new Jf(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(fl){let e=this._listeners;queueMicrotask(()=>{ip(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 d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new ep(`${a}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(this._options?.onListenerError||bs)(l),ct.None}if(this._disposed)return ct.None;t&&(e=e.bind(t));let i=new ws(e),n,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=no.create(),n=this._leakageMon.check(i.stack,this._size+1)),fl&&(i.stack=s??no.create()),this._listeners?this._listeners instanceof ws?(this._deliveryQueue??(this._deliveryQueue=new sp),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=Ye(()=>{ys?.unregister(o),n?.(),this._removeListener(i)});if(r instanceof $r?r.add(o):Array.isArray(r)&&r.push(o),ys){let a=new Error().stack.split(`
60
60
  `).slice(2,3).join(`
61
- `).trim(),d=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);ai.register(n,d?.[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 s=this._deliveryQueue.current===this;if(this._size*ff<=t.length){let o=0;for(let i=0;i<t.length;i++)t[i]?t[o++]=t[i]:s&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||ni;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}_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 oi)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}},_f=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}},Va={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}},hs=2,ds,tr=class Pr{constructor(t,r,s){this._document=t,this._config=r,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new $a,this._cacheMapCombined=new $a,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Or,this._textureSize=512,this._onAddTextureAtlasCanvas=new Me,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Me,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=jl(t,this._config.deviceCellWidth*4+hs*2,this._config.deviceCellHeight+hs*2),this._tmpCtx=We(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 rf;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let s=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,s)}})}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(Pr.maxAtlasPages&&this._pages.length>=Math.max(4,Pr.maxAtlasPages)){let r=this._pages.filter(l=>l.canvas.width*2<=(Pr.maxTextureSize||4096)).sort((l,_)=>_.canvas.width!==l.canvas.width?_.canvas.width-l.canvas.width:_.percentageUsed-l.percentageUsed),s=-1,o=0;for(let l=0;l<r.length;l++)if(r[l].canvas.width!==o)s=l,o=r[l].canvas.width;else if(l-s===3)break;let i=r.slice(s,s+4),n=i.map(l=>l.glyphs[0].texturePage).sort((l,_)=>l>_?1:-1),a=this.pages.length-i.length,d=this._mergePages(i,a);d.version++;for(let l=n.length-1;l>=0;l--)this._deletePage(n[l]);this.pages.push(d),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(d.canvas)}let t=new Cn(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let s=t[0].canvas.width*2,o=new Cn(this._document,s,t);for(let[i,n]of t.entries()){let a=i*n.canvas.width%s,d=Math.floor(i/2)*n.canvas.height;o.ctx.drawImage(n.canvas,a,d);for(let _ of n.glyphs)_.texturePage=r,_.sizeClipSpace.x=_.size.x/s,_.sizeClipSpace.y=_.size.y/s,_.texturePosition.x+=a,_.texturePosition.y+=d,_.texturePositionClipSpace.x=_.texturePosition.x/s,_.texturePositionClipSpace.y=_.texturePosition.y/s;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 s=this._pages[r];for(let o of s.glyphs)o.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,r,s,o,i,n){return this._getFromCacheMap(this._cacheMapCombined,t,r,s,o,i,n)}getRasterizedGlyph(t,r,s,o,i,n){return this._getFromCacheMap(this._cacheMap,t,r,s,o,i,n)}_getFromCacheMap(t,r,s,o,i,n,a){return ds=t.get(r,s,o,i),ds||(ds=this._drawToCache(r,s,o,i,n,a),t.set(r,s,o,i,ds)),ds}_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,s,o){if(this._config.allowTransparency)return ut;let i;switch(t){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(r);break;case 50331648:let n=Or.toColorRGB(r);i=Je.toColor(n[0],n[1],n[2]);break;default:s?i=Br.opaque(this._config.colors.foreground):i=this._config.colors.background;break}return this._config.allowTransparency||(i=Br.opaque(i)),i}_getForegroundColor(t,r,s,o,i,n,a,d,l,_){let m=this._getMinimumContrastColor(t,r,s,o,i,n,a,l,d,_);if(m)return m;let y;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&n<8&&(n+=8),y=this._getColorFromAnsiIndex(n);break;case 50331648:let p=Or.toColorRGB(n);y=Je.toColor(p[0],p[1],p[2]);break;default:a?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=Br.opaque(y)),d&&(y=Br.multiplyOpacity(y,qu)),y}_resolveBackgroundRgba(t,r,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,s,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 s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,s,o,i,n,a,d,l,_){if(this._config.minimumContrastRatio===1||_)return;let m=this._getContrastCache(l),y=m.getColor(t,o);if(y!==void 0)return y||void 0;let p=this._resolveBackgroundRgba(r,s,a),c=this._resolveForegroundRgba(i,n,a,d),u=sr.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(l?2:1));if(!u){m.setColor(t,o,null);return}let h=Je.toColor(u>>24&255,u>>16&255,u>>8&255);return m.setColor(t,o,h),h}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,s,o,i,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 d=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+hs*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<d&&(this._tmpCanvas.width=d);let l=Math.min(this._config.deviceCellHeight+hs*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=o,!!this._workAttributeData.isInvisible())return Va;let _=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),u=!!this._workAttributeData.isStrikethrough(),h=!!this._workAttributeData.isOverline(),f=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),g=this._workAttributeData.getBgColorMode();if(m){let D=f;f=S,S=D;let N=v;v=g,g=N}let x=this._getBackgroundColor(g,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 b=_?this._config.fontWeightBold:this._config.fontWeight,E=p?"italic":"";this._tmpCtx.font=`${E} ${b} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Dl;let P=a.length===1&&Jn(a.charCodeAt(0)),O=a.length===1&&Nu(a.charCodeAt(0)),F=this._getForegroundColor(r,g,S,s,v,f,m,y,_,Al(a.charCodeAt(0)));this._tmpCtx.fillStyle=F.css;let A=O?0:hs*2,V=!1;this._config.customGlyphs!==!1&&(V=Yu(this._tmpCtx,a,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!P,M;if(typeof t=="number"?M=this._unicodeService.wcwidth(t):M=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())B=!1,this._tmpCtx.strokeStyle=`rgb(${Or.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let W=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&W<8&&(W+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(W).css}this._tmpCtx.beginPath();let G=A,$=Math.ceil(A+this._config.deviceCharHeight)-N-(i?D*2:0),Y=$+D,H=$+D*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let W=0;W<M;W++){this._tmpCtx.save();let q=G+W*this._config.deviceCellWidth,j=G+(W+1)*this._config.deviceCellWidth,X=q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(j,$),this._tmpCtx.moveTo(q,H),this._tmpCtx.lineTo(j,H);break;case 3:let J=D<=1?H:Math.ceil(A+this._config.deviceCharHeight-D/2)-N,ae=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,ae,q,ae,q,Y),this._tmpCtx.bezierCurveTo(q,J,X,J,X,Y),this._tmpCtx.bezierCurveTo(X,ae,j,ae,j,Y),this._tmpCtx.bezierCurveTo(j,J,j+this._config.deviceCellWidth/2,J,j+this._config.deviceCellWidth/2,Y);break;case 4:let _e=k===0?0:k>=D?D*2-k:D-k;k>=D||_e===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q+_e,$),this._tmpCtx.lineTo(j,$)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(q+_e,$),this._tmpCtx.moveTo(q+_e+D,$),this._tmpCtx.lineTo(j,$)),k=ju(j-q,D,k);break;case 5:let Z=.6,Ce=.3,He=j-q,Ee=Math.floor(Z*He),Oe=Math.floor(Ce*He),Ue=He-Ee-Oe;this._tmpCtx.setLineDash([Ee,Oe,Ue]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(j,$);break;default:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(j,$);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 W=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in W&&W.actualBoundingBoxDescent>0){this._tmpCtx.save();let q=new Path2D;q.rect(G,$-Math.ceil(D/2),this._config.deviceCellWidth*M,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*M,A+N),this._tmpCtx.stroke()}if(V||this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let D=xn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,F,B);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=xn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,F,B),!!D);N++);}if(u){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*M,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.stroke()}this._tmpCtx.restore();let U=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),I;if(this._config.allowTransparency?I=mf(U):I=xn(U,x,F,B),I)return Va;let C=this._findGlyphBoundingBox(U,this._workBoundingBox,d,O,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 Cn(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(Pr.maxAtlasPages&&this._pages.length>=Pr.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(U,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,s,o,i,n){r.top=0;let a=o?this._config.deviceCellHeight:this._tmpCanvas.height,d=o?this._config.deviceCellWidth:s,l=!1;for(let _=0;_<a;_++){for(let m=0;m<d;m++){let y=_*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.top=_,l=!0;break}}if(l)break}r.left=0,l=!1;for(let _=0;_<n+d;_++){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+_*4+3;if(t.data[y]!==0){r.left=_,l=!0;break}}if(l)break}r.right=d,l=!1;for(let _=n+d-1;_>=n;_--){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+_*4+3;if(t.data[y]!==0){r.right=_,l=!0;break}}if(l)break}r.bottom=a,l=!1;for(let _=a-1;_>=0;_--){for(let m=0;m<d;m++){let y=_*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.bottom=_,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||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+n+(o||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Cn=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 s of r)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=jl(e,t,t),this.ctx=We(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 xn(e,t,r,s){let o=t.rgba>>>24,i=t.rgba>>>16&255,n=t.rgba>>>8&255,a=r.rgba>>>24,d=r.rgba>>>16&255,l=r.rgba>>>8&255,_=Math.floor((Math.abs(o-a)+Math.abs(i-d)+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]===i&&e.data[y+2]===n||s&&Math.abs(e.data[y]-o)+Math.abs(e.data[y+1]-i)+Math.abs(e.data[y+2]-n)<_?e.data[y+3]=0:m=!1;return m}function mf(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function jl(e,t,r){let s=e.createElement("canvas");return s.width=t,s.height=r,s}function gf(e,t,r,s,o,i,n,a){let d={foreground:i.foreground,background:i.background,cursor:ut,cursorAccent:ut,selectionForeground:ut,selectionBackgroundTransparent:ut,selectionBackgroundOpaque:ut,selectionInactiveBackgroundTransparent:ut,selectionInactiveBackgroundOpaque:ut,overviewRulerBorder:ut,scrollbarSliderBackground:ut,scrollbarSliderHoverBackground:ut,scrollbarSliderActiveBackground:ut,ansi:i.ansi.slice(),contrastCache:i.contrastCache,halfContrastCache:i.halfContrastCache};return{customGlyphs:o.customGlyphs,devicePixelRatio:n,deviceMaxTextureSize:a,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:s,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:d}}function Ya(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 vf(e){return(e&50331648)===16777216||(e&50331648)===33554432}var pt=[];function $l(e,t,r,s,o,i,n,a,d){let l=gf(s,o,i,n,t,r,a,d);for(let y=0;y<pt.length;y++){let p=pt[y],c=p.ownedBy.indexOf(e);if(c>=0){if(Ya(p.config,l))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),pt.splice(y,1)):p.ownedBy.splice(c,1);break}}for(let y=0;y<pt.length;y++){let p=pt[y];if(Ya(p.config,l))return p.ownedBy.push(e),p.atlas}let _=e._core,m={atlas:new tr(document,l,_.unicodeService),config:l,ownedBy:[e]};return pt.push(m),m.atlas}function Xa(e){for(let t=0;t<pt.length;t++){let r=pt[t].ownedBy.indexOf(e);if(r!==-1){pt[t].ownedBy.length===1?(pt[t].atlas.dispose(),pt.splice(t,1)):pt[t].ownedBy.splice(r,1);break}}}var si=600,bf=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=si){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=si-(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=si-(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})},si)},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 Ja(e,t,r){let s=new t.ResizeObserver(o=>{let i=o.find(d=>d.target===e);if(!i)return;if(!("devicePixelContentBoxSize"in i)){s?.disconnect(),s=void 0;return}let n=i.devicePixelContentBoxSize[0].inlineSize,a=i.devicePixelContentBoxSize[0].blockSize;n>0&&a>0&&r(n,a)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Ge(()=>s?.disconnect())}function wf(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Za=class ql extends Or{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Nl,this.combinedData=""}static fromCharData(t){let r=new ql;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?wf(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 s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-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()]}},Kl=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Gl(e,t,r){let s=We(e.createProgram());if(e.attachShader(s,We(Qa(e,e.VERTEX_SHADER,t))),e.attachShader(s,We(Qa(e,e.FRAGMENT_SHADER,r))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function Qa(e,t,r){let s=We(e.createShader(t));if(e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function yf(e,t){let r=Math.min(e.length*2,t),s=new Float32Array(r);for(let o=0;o<e.length;o++)s[o]=e[o];return s}var Sf=class{constructor(e){this.texture=e,this.version=-1}},Cf=`#version 300 es
61
+ `).trim(),d=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);ys.register(o,d?.[2]??a,o)}return o}),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*rp<=t.length){let n=0;for(let s=0;s<t.length;s++)t[s]?t[n++]=t[s]:i&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=n}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||bs;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 ws)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}},sp=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}},_l={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}},wi=2,yi,or=class Wr{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new dl,this._cacheMapCombined=new dl,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ur,this._textureSize=512,this._onAddTextureAtlasCanvas=new Me,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Me,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=hc(t,this._config.deviceCellWidth*4+wi*2,this._config.deviceCellHeight+wi*2),this._tmpCtx=ze(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 Kf;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(Wr.maxAtlasPages&&this._pages.length>=Math.max(4,Wr.maxAtlasPages)){let r=this._pages.filter(l=>l.canvas.width*2<=(Wr.maxTextureSize||4096)).sort((l,_)=>_.canvas.width!==l.canvas.width?_.canvas.width-l.canvas.width:_.percentageUsed-l.percentageUsed),i=-1,n=0;for(let l=0;l<r.length;l++)if(r[l].canvas.width!==n)i=l,n=r[l].canvas.width;else if(l-i===3)break;let s=r.slice(i,i+4),o=s.map(l=>l.glyphs[0].texturePage).sort((l,_)=>l>_?1:-1),a=this.pages.length-s.length,d=this._mergePages(s,a);d.version++;for(let l=o.length-1;l>=0;l--)this._deletePage(o[l]);this.pages.push(d),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(d.canvas)}let t=new Hn(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,n=new Hn(this._document,i,t);for(let[s,o]of t.entries()){let a=s*o.canvas.width%i,d=Math.floor(s/2)*o.canvas.height;n.ctx.drawImage(o.canvas,a,d);for(let _ of o.glyphs)_.texturePage=r,_.sizeClipSpace.x=_.size.x/i,_.sizeClipSpace.y=_.size.y/i,_.texturePosition.x+=a,_.texturePosition.y+=d,_.texturePositionClipSpace.x=_.texturePosition.x/i,_.texturePositionClipSpace.y=_.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let l=this._activePages.indexOf(o);l!==-1&&this._activePages.splice(l,1)}return n}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let n of i.glyphs)n.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,n,s,o){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,n,s,o)}getRasterizedGlyph(t,r,i,n,s,o){return this._getFromCacheMap(this._cacheMap,t,r,i,n,s,o)}_getFromCacheMap(t,r,i,n,s,o,a){return yi=t.get(r,i,n,s),yi||(yi=this._drawToCache(r,i,n,s,o,a),t.set(r,i,n,s,yi)),yi}_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,n){if(this._config.allowTransparency)return dt;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(r);break;case 50331648:let o=Ur.toColorRGB(r);s=et.toColor(o[0],o[1],o[2]);break;default:i?s=zr.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=zr.opaque(s)),s}_getForegroundColor(t,r,i,n,s,o,a,d,l,_){let m=this._getMinimumContrastColor(t,r,i,n,s,o,a,l,d,_);if(m)return m;let y;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&o<8&&(o+=8),y=this._getColorFromAnsiIndex(o);break;case 50331648:let p=Ur.toColorRGB(o);y=et.toColor(p[0],p[1],p[2]);break;default:a?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=zr.opaque(y)),d&&(y=zr.multiplyOpacity(y,Of)),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,n){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&n&&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,n,s,o,a,d,l,_){if(this._config.minimumContrastRatio===1||_)return;let m=this._getContrastCache(l),y=m.getColor(t,n);if(y!==void 0)return y||void 0;let p=this._resolveBackgroundRgba(r,i,a),c=this._resolveForegroundRgba(s,o,a,d),u=lr.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(l?2:1));if(!u){m.setColor(t,n,null);return}let h=et.toColor(u>>24&255,u>>16&255,u>>8&255);return m.setColor(t,n,h),h}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,n,s,o){let a=typeof t=="number"?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let d=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+wi*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<d&&(this._tmpCanvas.width=d);let l=Math.min(this._config.deviceCellHeight+wi*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=n,!!this._workAttributeData.isInvisible())return _l;let _=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),u=!!this._workAttributeData.isStrikethrough(),h=!!this._workAttributeData.isOverline(),f=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),g=this._workAttributeData.getBgColorMode();if(m){let D=f;f=S,S=D;let N=v;v=g,g=N}let x=this._getBackgroundColor(g,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=_?this._config.fontWeightBold:this._config.fontWeight,E=p?"italic":"";this._tmpCtx.font=`${E} ${w} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Ql;let P=a.length===1&&fo(a.charCodeAt(0)),O=a.length===1&&Lf(a.charCodeAt(0)),F=this._getForegroundColor(r,g,S,i,v,f,m,y,_,Zl(a.charCodeAt(0)));this._tmpCtx.fillStyle=F.css;let A=O?0:wi*2,V=!1;this._config.customGlyphs!==!1&&(V=Ff(this._tmpCtx,a,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!P,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())B=!1,this._tmpCtx.strokeStyle=`rgb(${Ur.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let W=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&W<8&&(W+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(W).css}this._tmpCtx.beginPath();let G=A,j=Math.ceil(A+this._config.deviceCharHeight)-N-(s?D*2:0),Y=j+D,H=j+D*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let W=0;W<R;W++){this._tmpCtx.save();let q=G+W*this._config.deviceCellWidth,$=G+(W+1)*this._config.deviceCellWidth,X=q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo($,j),this._tmpCtx.moveTo(q,H),this._tmpCtx.lineTo($,H);break;case 3:let J=D<=1?H:Math.ceil(A+this._config.deviceCharHeight-D/2)-N,ce=D<=1?j:Math.ceil(A+this._config.deviceCharHeight+D/2)-N,de=new Path2D;de.rect(q,j,this._config.deviceCellWidth,H-j),this._tmpCtx.clip(de),this._tmpCtx.moveTo(q-this._config.deviceCellWidth/2,Y),this._tmpCtx.bezierCurveTo(q-this._config.deviceCellWidth/2,ce,q,ce,q,Y),this._tmpCtx.bezierCurveTo(q,J,X,J,X,Y),this._tmpCtx.bezierCurveTo(X,ce,$,ce,$,Y),this._tmpCtx.bezierCurveTo($,J,$+this._config.deviceCellWidth/2,J,$+this._config.deviceCellWidth/2,Y);break;case 4:let me=k===0?0:k>=D?D*2-k:D-k;k>=D||me===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q+me,j),this._tmpCtx.lineTo($,j)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo(q+me,j),this._tmpCtx.moveTo(q+me+D,j),this._tmpCtx.lineTo($,j)),k=Pf($-q,D,k);break;case 5:let te=.6,Be=.3,fe=$-q,Oe=Math.floor(te*fe),We=Math.floor(Be*fe),ke=fe-Oe-We;this._tmpCtx.setLineDash([Oe,We,ke]),this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo($,j);break;default:this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo($,j);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 W=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in W&&W.actualBoundingBoxDescent>0){this._tmpCtx.save();let q=new Path2D;q.rect(G,j-Math.ceil(D/2),this._config.deviceCellWidth*R,H-j+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=Fn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,F,B);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=Fn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,F,B),!!D);N++);}if(u){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 z=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),I;if(this._config.allowTransparency?I=np(z):I=Fn(z,x,F,B),I)return _l;let C=this._findGlyphBoundingBox(z,this._workBoundingBox,d,O,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 Hn(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(Wr.maxAtlasPages&&this._pages.length>=Wr.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(z,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,n,s,o){r.top=0;let a=n?this._config.deviceCellHeight:this._tmpCanvas.height,d=n?this._config.deviceCellWidth:i,l=!1;for(let _=0;_<a;_++){for(let m=0;m<d;m++){let y=_*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.top=_,l=!0;break}}if(l)break}r.left=0,l=!1;for(let _=0;_<o+d;_++){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+_*4+3;if(t.data[y]!==0){r.left=_,l=!0;break}}if(l)break}r.right=d,l=!1;for(let _=o+d-1;_>=o;_--){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+_*4+3;if(t.data[y]!==0){r.right=_,l=!0;break}}if(l)break}r.bottom=a,l=!1;for(let _=a-1;_>=0;_--){for(let m=0;m<d;m++){let y=_*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.bottom=_,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+o+(n||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+o+(n||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Hn=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=hc(e,t,t),this.ctx=ze(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 Fn(e,t,r,i){let n=t.rgba>>>24,s=t.rgba>>>16&255,o=t.rgba>>>8&255,a=r.rgba>>>24,d=r.rgba>>>16&255,l=r.rgba>>>8&255,_=Math.floor((Math.abs(n-a)+Math.abs(s-d)+Math.abs(o-l))/12),m=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===n&&e.data[y+1]===s&&e.data[y+2]===o||i&&Math.abs(e.data[y]-n)+Math.abs(e.data[y+1]-s)+Math.abs(e.data[y+2]-o)<_?e.data[y+3]=0:m=!1;return m}function np(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function hc(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function op(e,t,r,i,n,s,o,a){let d={foreground:s.foreground,background:s.background,cursor:dt,cursorAccent:dt,selectionForeground:dt,selectionBackgroundTransparent:dt,selectionBackgroundOpaque:dt,selectionInactiveBackgroundTransparent:dt,selectionInactiveBackgroundOpaque:dt,overviewRulerBorder:dt,scrollbarSliderBackground:dt,scrollbarSliderHoverBackground:dt,scrollbarSliderActiveBackground:dt,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:n.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontWeightBold:n.fontWeightBold,allowTransparency:n.allowTransparency,drawBoldTextInBrightColors:n.drawBoldTextInBrightColors,minimumContrastRatio:n.minimumContrastRatio,colors:d}}function ml(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 ap(e){return(e&50331648)===16777216||(e&50331648)===33554432}var ft=[];function dc(e,t,r,i,n,s,o,a,d){let l=op(i,n,s,o,t,r,a,d);for(let y=0;y<ft.length;y++){let p=ft[y],c=p.ownedBy.indexOf(e);if(c>=0){if(ml(p.config,l))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),ft.splice(y,1)):p.ownedBy.splice(c,1);break}}for(let y=0;y<ft.length;y++){let p=ft[y];if(ml(p.config,l))return p.ownedBy.push(e),p.atlas}let _=e._core,m={atlas:new or(document,l,_.unicodeService),config:l,ownedBy:[e]};return ft.push(m),m.atlas}function gl(e){for(let t=0;t<ft.length;t++){let r=ft[t].ownedBy.indexOf(e);if(r!==-1){ft[t].ownedBy.length===1?(ft[t].atlas.dispose(),ft.splice(t,1)):ft[t].ownedBy.splice(r,1);break}}}var gs=600,lp=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=gs){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=gs-(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=gs-(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})},gs)},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 vl(e,t,r){let i=new t.ResizeObserver(n=>{let s=n.find(d=>d.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){i?.disconnect(),i=void 0;return}let o=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&r(o,a)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Ye(()=>i?.disconnect())}function cp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var bl=class uc extends Ur{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new sc,this.combinedData=""}static fromCharData(t){let r=new uc;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?cp(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 n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-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()]}},fc=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function pc(e,t,r){let i=ze(e.createProgram());if(e.attachShader(i,ze(wl(e,e.VERTEX_SHADER,t))),e.attachShader(i,ze(wl(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 wl(e,t,r){let i=ze(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 hp(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let n=0;n<e.length;n++)i[n]=e[n];return i}var dp=class{constructor(e){this.texture=e,this.version=-1}},up=`#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 xf(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 fp(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 rr=11,Dr=rr*Float32Array.BYTES_PER_ELEMENT,kf=2,Ie=0,De,kn=0,us=0,Ef=class extends at{constructor(e,t,r,s){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;tr.maxAtlasPages===void 0&&(tr.maxAtlasPages=Math.min(32,We(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),tr.maxTextureSize=We(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=We(Gl(o,Cf,xf(tr.maxAtlasPages))),this._register(Ge(()=>o.deleteProgram(this._program))),this._projectionLocation=We(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=We(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=We(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let i=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(Ge(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,i,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),d=o.createBuffer();this._register(Ge(()=>o.deleteBuffer(d))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,d),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=We(o.createBuffer()),this._register(Ge(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Dr,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Dr,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Dr,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Dr,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Dr,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Dr,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let l=new Int32Array(tr.maxAtlasPages);for(let _=0;_<tr.maxAtlasPages;_++)l[_]=_;o.uniform1iv(this._textureLocation,l),o.uniformMatrix4fv(this._projectionLocation,!1,Kl),this._atlasTextures=[];for(let _=0;_<tr.maxAtlasPages;_++){let m=new Sf(We(o.createTexture()));this._register(Ge(()=>o.deleteTexture(m.texture))),o.activeTexture(o.TEXTURE0+_),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[_]=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,s,o,i,n,a,d){this._updateCell(this._vertices.attributes,e,t,r,s,o,i,n,a,d)}_updateCell(e,t,r,s,o,i,n,a,d,l){if(Ie=(r*this._terminal.cols+t)*rr,s===0||s===void 0){e.fill(0,Ie,Ie+rr-1-kf);return}this._atlas&&(a&&a.length>1?De=this._atlas.getRasterizedGlyphCombinedChar(a,o,i,n,!1,this._terminal.element):De=this._atlas.getRasterizedGlyph(s,o,i,n,!1,this._terminal.element),kn=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==l&&De.offset.x>kn?(us=De.offset.x-kn,e[Ie]=-(De.offset.x-us)+this._dimensions.device.char.left,e[Ie+1]=-De.offset.y+this._dimensions.device.char.top,e[Ie+2]=(De.size.x-us)/this._dimensions.device.canvas.width,e[Ie+3]=De.size.y/this._dimensions.device.canvas.height,e[Ie+4]=De.texturePage,e[Ie+5]=De.texturePositionClipSpace.x+us/this._atlas.pages[De.texturePage].canvas.width,e[Ie+6]=De.texturePositionClipSpace.y,e[Ie+7]=De.sizeClipSpace.x-us/this._atlas.pages[De.texturePage].canvas.width,e[Ie+8]=De.sizeClipSpace.y):(e[Ie]=-De.offset.x+this._dimensions.device.char.left,e[Ie+1]=-De.offset.y+this._dimensions.device.char.top,e[Ie+2]=De.size.x/this._dimensions.device.canvas.width,e[Ie+3]=De.size.y/this._dimensions.device.canvas.height,e[Ie+4]=De.texturePage,e[Ie+5]=De.texturePositionClipSpace.x,e[Ie+6]=De.texturePositionClipSpace.y,e[Ie+7]=De.sizeClipSpace.x,e[Ie+8]=De.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Uu(s,d,De.size.x,this._dimensions.device.cell.width)&&(e[Ie+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*rr;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 s=0;s<e.rows;s++)for(let o=0;o<e.cols;o++)this._vertices.attributes[r+9]=o/e.cols,this._vertices.attributes[r+10]=s/e.rows,r+=rr}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],s=0;for(let o=0;o<e.lineLengths.length;o++){let i=o*this._terminal.cols*rr,n=this._vertices.attributes.subarray(i,i+e.lineLengths[o]*rr);r.set(n,s),s+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,r.subarray(0,s),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,s/rr)}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}},Lf=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,s=!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,i=t[1]-o,n=r[1]-o,a=Math.max(i,0),d=Math.min(n,e.rows-1);if(a>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=i,this.viewportEndRow=n,this.viewportCappedStartRow=a,this.viewportCappedEndRow=d,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 Tf(){return new Lf}var pi=4,li=1,ci=2,En=3,Rf=2147483648,Mf=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Tf()}resize(e,t){let r=e*t*pi;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)}},Af=`#version 300 es
95
+ }`}var ar=11,Fr=ar*Float32Array.BYTES_PER_ELEMENT,pp=2,He=0,De,Wn=0,Si=0,_p=class extends ct{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 n=this._gl;or.maxAtlasPages===void 0&&(or.maxAtlasPages=Math.min(32,ze(n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS))),or.maxTextureSize=ze(n.getParameter(n.MAX_TEXTURE_SIZE))),this._program=ze(pc(n,up,fp(or.maxAtlasPages))),this._register(Ye(()=>n.deleteProgram(this._program))),this._projectionLocation=ze(n.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=ze(n.getUniformLocation(this._program,"u_resolution")),this._textureLocation=ze(n.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),o=n.createBuffer();this._register(Ye(()=>n.deleteBuffer(o))),n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,s,n.STATIC_DRAW),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),d=n.createBuffer();this._register(Ye(()=>n.deleteBuffer(d))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,d),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=ze(n.createBuffer()),this._register(Ye(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,2,n.FLOAT,!1,Fr,0),n.vertexAttribDivisor(2,1),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,n.FLOAT,!1,Fr,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(3,1),n.enableVertexAttribArray(4),n.vertexAttribPointer(4,1,n.FLOAT,!1,Fr,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(4,1),n.enableVertexAttribArray(5),n.vertexAttribPointer(5,2,n.FLOAT,!1,Fr,5*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(5,1),n.enableVertexAttribArray(6),n.vertexAttribPointer(6,2,n.FLOAT,!1,Fr,7*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(6,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,Fr,9*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.useProgram(this._program);let l=new Int32Array(or.maxAtlasPages);for(let _=0;_<or.maxAtlasPages;_++)l[_]=_;n.uniform1iv(this._textureLocation,l),n.uniformMatrix4fv(this._projectionLocation,!1,fc),this._atlasTextures=[];for(let _=0;_<or.maxAtlasPages;_++){let m=new dp(ze(n.createTexture()));this._register(Ye(()=>n.deleteTexture(m.texture))),n.activeTexture(n.TEXTURE0+_),n.bindTexture(n.TEXTURE_2D,m.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=m}n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,r,i,n,s,o,a,d){this._updateCell(this._vertices.attributes,e,t,r,i,n,s,o,a,d)}_updateCell(e,t,r,i,n,s,o,a,d,l){if(He=(r*this._terminal.cols+t)*ar,i===0||i===void 0){e.fill(0,He,He+ar-1-pp);return}this._atlas&&(a&&a.length>1?De=this._atlas.getRasterizedGlyphCombinedChar(a,n,s,o,!1,this._terminal.element):De=this._atlas.getRasterizedGlyph(i,n,s,o,!1,this._terminal.element),Wn=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),n!==l&&De.offset.x>Wn?(Si=De.offset.x-Wn,e[He]=-(De.offset.x-Si)+this._dimensions.device.char.left,e[He+1]=-De.offset.y+this._dimensions.device.char.top,e[He+2]=(De.size.x-Si)/this._dimensions.device.canvas.width,e[He+3]=De.size.y/this._dimensions.device.canvas.height,e[He+4]=De.texturePage,e[He+5]=De.texturePositionClipSpace.x+Si/this._atlas.pages[De.texturePage].canvas.width,e[He+6]=De.texturePositionClipSpace.y,e[He+7]=De.sizeClipSpace.x-Si/this._atlas.pages[De.texturePage].canvas.width,e[He+8]=De.sizeClipSpace.y):(e[He]=-De.offset.x+this._dimensions.device.char.left,e[He+1]=-De.offset.y+this._dimensions.device.char.top,e[He+2]=De.size.x/this._dimensions.device.canvas.width,e[He+3]=De.size.y/this._dimensions.device.canvas.height,e[He+4]=De.texturePage,e[He+5]=De.texturePositionClipSpace.x,e[He+6]=De.texturePositionClipSpace.y,e[He+7]=De.sizeClipSpace.x,e[He+8]=De.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Af(i,d,De.size.x,this._dimensions.device.cell.width)&&(e[He+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*ar;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 n=0;n<e.cols;n++)this._vertices.attributes[r+9]=n/e.cols,this._vertices.attributes[r+10]=i/e.rows,r+=ar}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 n=0;n<e.lineLengths.length;n++){let s=n*this._terminal.cols*ar,o=this._vertices.attributes.subarray(s,s+e.lineLengths[n]*ar);r.set(o,i),i+=o.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,r.subarray(0,i),t.STREAM_DRAW);for(let n=0;n<this._atlas.pages.length;n++)this._atlas.pages[n].version!==this._atlasTextures[n].version&&this._bindAtlasPageTexture(t,this._atlas,n);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,i/ar)}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}},mp=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 n=e.buffers.active.ydisp,s=t[1]-n,o=r[1]-n,a=Math.max(s,0),d=Math.min(o,e.rows-1);if(a>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=d,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 gp(){return new mp}var Ts=4,Ss=1,Cs=2,zn=3,vp=2147483648,bp=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=gp()}resize(e,t){let r=e*t*Ts;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)}},wp=`#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
- }`,Df=`#version 300 es
109
+ }`,yp=`#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
- }`,jt=8,Ln=jt*Float32Array.BYTES_PER_ELEMENT,Pf=20*jt,el=class{constructor(){this.attributes=new Float32Array(Pf),this.count=0}},Ut=0,tl=0,rl=0,sl=0,il=0,nl=0,ol=0,Bf=class extends at{constructor(e,t,r,s){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=s,this._vertices=new el,this._verticesCursor=new el;let o=this._gl;this._program=We(Gl(o,Af,Df)),this._register(Ge(()=>o.deleteProgram(this._program))),this._projectionLocation=We(o.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let i=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(Ge(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,i,o.STATIC_DRAW),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),d=o.createBuffer();this._register(Ge(()=>o.deleteBuffer(d))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,d),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=We(o.createBuffer()),this._register(Ge(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,Ln,0),o.vertexAttribDivisor(0,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Ln,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,Ln,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(2,1),this._updateCachedColors(s.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,Kl),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,s=1,o,i,n,a,d,l,_,m,y,p,c;for(o=0;o<t.rows;o++){for(n=-1,a=0,d=0,l=!1,i=0;i<t.cols;i++)_=(o*t.cols+i)*pi,m=e.cells[_+li],y=e.cells[_+ci],p=!!(y&67108864),(m!==a||y!==d&&(l||p))&&((a!==0||l&&d!==0)&&(c=s++*jt,this._updateRectangle(r,c,d,a,n,i,o)),n=i,a=m,d=y,l=p);(a!==0||l&&d!==0)&&(c=s++*jt,this._updateRectangle(r,c,d,a,n,t.cols,o))}r.count=s}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let s,o=0;(r.style==="bar"||r.style==="outline")&&(s=o++*jt,this._addRectangleFloat(t.attributes,s,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")&&(s=o++*jt,this._addRectangleFloat(t.attributes,s,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"&&(s=o++*jt,this._addRectangleFloat(t.attributes,s,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),s=o++*jt,this._addRectangleFloat(t.attributes,s,(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,s,o,i,n){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:Ut=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Ut=(r&16777215)<<8;break;default:Ut=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Ut=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Ut=(s&16777215)<<8;break;default:Ut=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=yf(e.attributes,this._terminal.rows*this._terminal.cols*jt)),tl=o*this._dimensions.device.cell.width,rl=n*this._dimensions.device.cell.height,sl=(Ut>>24&255)/255,il=(Ut>>16&255)/255,nl=(Ut>>8&255)/255,ol=1,this._addRectangle(e.attributes,t,tl,rl,(i-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,sl,il,nl,ol)}_addRectangle(e,t,r,s,o,i,n,a,d,l){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=i/this._dimensions.device.canvas.height,e[t+4]=n,e[t+5]=a,e[t+6]=d,e[t+7]=l}_addRectangleFloat(e,t,r,s,o,i,n){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=i/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])}},Of=class extends at{constructor(e,t,r,s,o,i,n,a){super(),this._container=t,this._alpha=o,this._coreBrowserService=i,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=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(d=>{this._refreshCharAtlas(e,d),this.reset(e)})),this._register(Ge(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=We(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,s=!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=$l(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,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Dl,this._clipCell(r,s,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,s*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 s=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},If=class extends Of{constructor(e,t,r,s,o,i,n){super(r,e,"link",t,!0,o,i,n),this._register(s.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(s.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&&vf(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()}},wt=typeof window=="object"?window:globalThis,qn=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Me,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 s=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}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 s=this.getWindowId(r);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};qn.INSTANCE=new qn;var Vl=qn;function Nf(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}var Xg=Vl.INSTANCE.onDidChangeZoomLevel,Jg=Vl.INSTANCE.onDidChangeFullscreen,Fr=typeof navigator=="object"?navigator.userAgent:"",Zg=Fr.indexOf("Firefox")>=0,Tn=Fr.indexOf("AppleWebKit")>=0,Hf=Fr.indexOf("Chrome")>=0,Ff=!Hf&&Fr.indexOf("Safari")>=0,Qg=Fr.indexOf("Electron/")>=0,ev=Fr.indexOf("Android")>=0,hi=!1;if(typeof wt.matchMedia=="function"){let e=wt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=wt.matchMedia("(display-mode: fullscreen)");hi=e.matches,Nf(wt,e,({matches:r})=>{hi&&t.matches||(hi=r)})}function Wf(){return hi}var Ir="en",Kn=!1,Gn=!1,di=!1,Uf=!1,Yl=!1,Xl=!1,zf=!1,jf=!1,$f=!1,qf=!1,ii,ui=Ir,al=Ir,Kf,zt,qt=globalThis,ot;typeof qt.vscode<"u"&&typeof qt.vscode.process<"u"?ot=qt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ot=process);var Jl=typeof ot?.versions?.electron=="string",Gf=Jl&&ot?.type==="renderer";if(typeof ot=="object"){Kn=ot.platform==="win32",Gn=ot.platform==="darwin",di=ot.platform==="linux",Uf=di&&!!ot.env.SNAP&&!!ot.env.SNAP_REVISION,zf=Jl,$f=!!ot.env.CI||!!ot.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ii=Ir,ui=Ir;let e=ot.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ii=t.userLocale,al=t.osLocale,ui=t.resolvedLanguage||Ir,Kf=t.languagePack?.translationsConfigFile}catch{}Yl=!0}else typeof navigator=="object"&&!Gf?(zt=navigator.userAgent,Kn=zt.indexOf("Windows")>=0,Gn=zt.indexOf("Macintosh")>=0,jf=(zt.indexOf("Macintosh")>=0||zt.indexOf("iPad")>=0||zt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,di=zt.indexOf("Linux")>=0,qf=zt?.indexOf("Mobi")>=0,Xl=!0,ui=globalThis._VSCODE_NLS_LANGUAGE||Ir,ii=navigator.language.toLowerCase(),al=ii):console.error("Unable to resolve platform.");var Rn=0;Gn?Rn=1:Kn?Rn=3:di&&(Rn=2);var Mn=Yl,Vf=Xl&&typeof qt.importScripts=="function",tv=Vf?qt.origin:void 0,Dt=zt,Qt=ui,ll;(e=>{function t(){return Qt}e.value=t;function r(){return Qt.length===2?Qt==="en":Qt.length>=3?Qt[0]==="e"&&Qt[1]==="n"&&Qt[2]==="-":!1}e.isDefaultVariant=r;function s(){return Qt==="en"}e.isDefault=s})(ll||(ll={}));var Yf=typeof qt.postMessage=="function"&&!qt.importScripts,Xf=(()=>{if(Yf){let e=[];qt.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let s=0,o=e.length;s<o;s++){let i=e[s];if(i.id===r.data.vscodeScheduleAsyncWork){e.splice(s,1),i.callback();return}}});let t=0;return r=>{let s=++t;e.push({id:s,callback:r}),qt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),Jf=!!(Dt&&Dt.indexOf("Chrome")>=0),rv=!!(Dt&&Dt.indexOf("Firefox")>=0),sv=!!(!Jf&&Dt&&Dt.indexOf("Safari")>=0),iv=!!(Dt&&Dt.indexOf("Edg/")>=0),nv=!!(Dt&&Dt.indexOf("Android")>=0),er=typeof navigator=="object"?navigator:{},ov={clipboard:{writeText:Mn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(er&&er.clipboard&&er.clipboard.writeText),readText:Mn||!!(er&&er.clipboard&&er.clipboard.readText)},keyboard:Mn||Wf()?0:er.keyboard||Ff?1:2,touch:"ontouchstart"in wt||er.maxTouchPoints>0,pointerEvents:wt.PointerEvent&&("ontouchstart"in wt||navigator.maxTouchPoints>0)},Zn=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}},An=new Zn,cl=new Zn,hl=new Zn,av=new Array(230),dl;(e=>{function t(a){return An.keyCodeToStr(a)}e.toString=t;function r(a){return An.strToKeyCode(a)}e.fromString=r;function s(a){return cl.keyCodeToStr(a)}e.toUserSettingsUS=s;function o(a){return hl.keyCodeToStr(a)}e.toUserSettingsGeneral=o;function i(a){return cl.strToKeyCode(a)||hl.strToKeyCode(a)}e.fromUserSettings=i;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 An.keyCodeToStr(a)}e.toElectronAccelerator=n})(dl||(dl={}));var Zl=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),ul;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Zf?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:At.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Zl})})(ul||(ul={}));var Zf=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?Zl:(this._emitter||(this._emitter=new Me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Qf,Dn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Dn=(e,t)=>{Xf(()=>{if(r)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:Dn=(e,t,r)=>{let s=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(s))}}},Qf=e=>Dn(globalThis,e)})();var fl;(e=>{async function t(s){let o,i=await Promise.all(s.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return i}e.settled=t;function r(s){return new Promise(async(o,i)=>{try{await s(o,i)}catch(n){i(n)}})}e.withAsyncBody=r})(fl||(fl={}));var pl=class ft{static fromArray(t){return new ft(r=>{r.emitMany(t)})}static fromPromise(t){return new ft(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ft(async r=>{await Promise.all(t.map(async s=>r.emitOne(await s)))})}static merge(t){return new ft(async r=>{await Promise.all(t.map(async s=>{for await(let o of s)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Me,queueMicrotask(async()=>{let s={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(s)),this.resolve()}catch(o){this.reject(o)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 At.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new ft(async s=>{for await(let o of t)s.emitOne(r(o))})}map(t){return ft.map(this,t)}static filter(t,r){return new ft(async s=>{for await(let o of t)r(o)&&s.emitOne(o)})}filter(t){return ft.filter(this,t)}static coalesce(t){return ft.filter(t,r=>!!r)}coalesce(){return ft.coalesce(this)}static async toPromise(t){let r=[];for await(let s of t)r.push(s);return r}toPromise(){return ft.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())}};pl.EMPTY=pl.fromArray([]);function ep(e){return 55296<=e&&e<=56319}function _l(e){return 56320<=e&&e<=57343}function tp(e,t){return(e-55296<<10)+(t-56320)+65536}function rp(e){return Qn(e,0)}function Qn(e,t){switch(typeof e){case"object":return e===null?$t(349,t):Array.isArray(e)?ip(e,t):np(e,t);case"string":return Ql(e,t);case"boolean":return sp(e,t);case"number":return $t(e,t);case"undefined":return $t(937,t);default:return $t(617,t)}}function $t(e,t){return(t<<5)-t+e|0}function sp(e,t){return $t(e?433:863,t)}function Ql(e,t){t=$t(149417,t);for(let r=0,s=e.length;r<s;r++)t=$t(e.charCodeAt(r),t);return t}function ip(e,t){return t=$t(104579,t),e.reduce((r,s)=>Qn(s,r),t)}function np(e,t){return t=$t(181387,t),Object.keys(e).sort().reduce((r,s)=>(r=Ql(s,r),Qn(e[s],r)),t)}function Pn(e,t,r=32){let s=r-t,o=~((1<<s)-1);return(e<<t|(o&e)>>>s)>>>0}function ml(e,t=0,r=e.byteLength,s=0){for(let o=0;o<r;o++)e[t+o]=s}function op(e,t,r="0"){for(;e.length<t;)e=r+e;return e}function fs(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""):op((e>>>0).toString(16),t/4)}var ap=class ec{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 s=this._buff,o=this._buffLen,i=this._leftoverHighSurrogate,n,a;for(i!==0?(n=i,a=-1,i=0):(n=t.charCodeAt(0),a=0);;){let d=n;if(ep(n))if(a+1<r){let l=t.charCodeAt(a+1);_l(l)?(a++,d=tp(n,l)):d=65533}else{i=n;break}else _l(n)&&(d=65533);if(o=this._push(s,o,d),a++,a<r)n=t.charCodeAt(a);else break}this._buffLen=o,this._leftoverHighSurrogate=i}_push(t,r,s){return s<128?t[r++]=s:s<2048?(t[r++]=192|(s&1984)>>>6,t[r++]=128|(s&63)>>>0):s<65536?(t[r++]=224|(s&61440)>>>12,t[r++]=128|(s&4032)>>>6,t[r++]=128|(s&63)>>>0):(t[r++]=240|(s&1835008)>>>18,t[r++]=128|(s&258048)>>>12,t[r++]=128|(s&4032)>>>6,t[r++]=128|(s&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()),fs(this._h0)+fs(this._h1)+fs(this._h2)+fs(this._h3)+fs(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,ml(this._buff,this._buffLen),this._buffLen>56&&(this._step(),ml(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=ec._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,Pn(t.getUint32(m-12,!1)^t.getUint32(m-32,!1)^t.getUint32(m-56,!1)^t.getUint32(m-64,!1),1),!1);let s=this._h0,o=this._h1,i=this._h2,n=this._h3,a=this._h4,d,l,_;for(let m=0;m<80;m++)m<20?(d=o&i|~o&n,l=1518500249):m<40?(d=o^i^n,l=1859775393):m<60?(d=o&i|o&n|i&n,l=2400959708):(d=o^i^n,l=3395469782),_=Pn(s,5)+d+a+l+t.getUint32(m*4,!1)&4294967295,a=n,n=i,i=Pn(o,30),o=s,s=_;this._h0=this._h0+s&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+i&4294967295,this._h3=this._h3+n&4294967295,this._h4=this._h4+a&4294967295}};ap._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:lv,getWindow:lp,getDocument:cv,getWindows:hv,getWindowsCount:dv,getWindowId:gl,getWindowById:uv,hasWindow:fv,onDidRegisterWindow:pv,onWillUnregisterWindow:_v,onDidUnregisterWindow:mv}=(function(){let e=new Map,t={window:wt,disposables:new Nr};e.set(wt.vscodeWindowId,t);let r=new Me,s=new Me,o=new Me;function i(n,a){return(typeof n=="number"?e.get(n):void 0)??(a?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:s.event,registerWindow(n){if(e.has(n.vscodeWindowId))return at.None;let a=new Nr,d={window:n,disposables:a.add(new Nr)};return e.set(n.vscodeWindowId,d),a.add(Ge(()=>{e.delete(n.vscodeWindowId),s.fire(n)})),a.add(Vn(n,dp.BEFORE_UNLOAD,()=>{o.fire(n)})),r.fire(d),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:i,getWindow(n){let a=n;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let d=n;return d?.view?d.view.window:wt},getDocument(n){return lp(n).document}}})(),cp=class{constructor(e,t,r,s){this._node=e,this._type=t,this._handler=r,this._options=s||!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 Vn(e,t,r,s){return new cp(e,t,r,s)}var hp,vl,Bn=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ni(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,s=new Map,o=i=>{r.set(i,!1);let n=e.get(i)??[];for(t.set(i,n),e.set(i,[]),s.set(i,!0);n.length>0;)n.sort(Bn.sort),n.shift().execute();s.set(i,!1)};vl=(i,n,a=0)=>{let d=gl(i),l=new Bn(n,a),_=e.get(d);return _||(_=[],e.set(d,_)),_.push(l),r.get(d)||(r.set(d,!0),i.requestAnimationFrame(()=>o(d))),l},hp=(i,n,a)=>{let d=gl(i);if(s.get(d)){let l=new Bn(n,a),_=t.get(d);return _||(_=[],t.set(d,_)),_.push(l),l}else return vl(i,n,a)}})();var bl=class fi{constructor(t,r){this.width=t,this.height=r}with(t=this.width,r=this.height){return t!==this.width||r!==this.height?new fi(t,r):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof fi?t:new fi(t.width,t.height)}static equals(t,r){return t===r?!0:!t||!r?!1:t.width===r.width&&t.height===r.height}};bl.None=new bl(0,0);var gv=new class{constructor(){this.mutationObservers=new Map}observe(e,t,r){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let o=rp(r),i=s.get(o);if(i)i.users+=1;else{let n=new Me,a=new MutationObserver(l=>n.fire(l));a.observe(e,r);let d=i={users:1,observer:a,onDidMutate:n.event};t.add(Ge(()=>{d.users-=1,d.users===0&&(n.dispose(),a.disconnect(),s?.delete(o),s?.size===0&&this.mutationObservers.delete(e))})),s.set(o,i)}return i.onDidMutate}},dp={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:Tn?"webkitAnimationStart":"animationstart",ANIMATION_END:Tn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Tn?"webkitAnimationIteration":"animationiteration"},up=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function tc(e,t,r,...s){let o=up.exec(t);if(!o)throw new Error("Bad use of emmet");let i=o[1]||"div",n;return e!=="http://www.w3.org/1999/xhtml"?n=document.createElementNS(e,i):n=document.createElement(i),o[3]&&(n.id=o[3]),o[4]&&(n.className=o[4].replace(/\./g," ").trim()),r&&Object.entries(r).forEach(([a,d])=>{typeof d>"u"||(/^on\w+$/.test(a)?n[a]=d:a==="selected"?d&&n.setAttribute(a,"true"):n.setAttribute(a,d))}),n.append(...s),n}function fp(e,t,...r){return tc("http://www.w3.org/1999/xhtml",e,t,...r)}fp.SVG=function(e,t,...r){return tc("http://www.w3.org/2000/svg",e,t,...r)};var pp=class extends at{constructor(e,t,r,s,o,i,n,a,d){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=s,this._coreService=o,this._decorationService=i,this._optionsService=n,this._themeService=a,this._cursorBlinkStateManager=new cs,this._charAtlasDisposable=this._register(new cs),this._observerDisposable=this._register(new cs),this._model=new Mf,this._workCell=new Za,this._workCell2=new Za,this._rectangleRenderer=this._register(new cs),this._glyphRenderer=this._register(new cs),this._onChangeTextureAtlas=this._register(new Me),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Me),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Me),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Me),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Me),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:d};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 $u(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new If(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,n,this._themeService)],this.dimensions=zu(),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(Vn(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(Vn(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Xa(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Ja(this._canvas,this._coreBrowserService.window,(_,m)=>this._setCanvasDevicePixelDimensions(_,m)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=Ja(this._canvas,_,(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(Ge(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),Xa(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 s of this._renderLayers)s.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 Bf(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Ef(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=$l(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=Ll(At.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),At.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 bf(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,s=this._workCell,o,i,n,a,d,l,_=0,m=!0,y,p,c,u,h,f,v,S,g;e=wl(e,r.rows-1,0),t=wl(t,r.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",b=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,E=b-r.buffer.ydisp,P=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),O=-1,F=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let A=!1;for(i=e;i<=t;i++)for(n=i+r.buffer.ydisp,a=r.buffer.lines.get(n),this._model.lineLengths[i]=0,c=b===n,_=0,d=this._characterJoinerService.getJoinedCharacters(n),S=0;S<r.cols;S++){if(o=this._cellColorResolver.result.bg,a.loadCell(S,s),S===0&&(o=this._cellColorResolver.result.bg),l=!1,m=S>=_,y=S,d.length>0&&S===d[0][0]&&m){p=d.shift();let V=this._model.selection.isCellSelected(this._terminal,p[0],n);for(v=p[0]+1;v<p[1];v++)m&&(m=V===this._model.selection.isCellSelected(this._terminal,v,n));m&&(m=!c||P<p[0]||P>=p[1]),m?(l=!0,s=new _p(s,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),y=p[1]-1):_=p[1]}if(u=s.getChars(),h=s.getCode(),v=(i*r.cols+S)*pi,this._cellColorResolver.resolve(s,S,n,this.dimensions.device.cell.width),F&&n===b&&(S===P&&(this._model.cursor={x:P,y:E,width:s.getWidth(),style:this._coreBrowserService.isFocused?x:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},O=P+s.getWidth()-1),S>=P&&S<=O&&(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[i]=S+1),!(this._model.cells[v]===h&&this._model.cells[v+li]===this._cellColorResolver.result.bg&&this._model.cells[v+ci]===this._cellColorResolver.result.fg&&this._model.cells[v+En]===this._cellColorResolver.result.ext)&&(A=!0,u.length>1&&(h|=Rf),this._model.cells[v]=h,this._model.cells[v+li]=this._cellColorResolver.result.bg,this._model.cells[v+ci]=this._cellColorResolver.result.fg,this._model.cells[v+En]=this._cellColorResolver.result.ext,f=s.getWidth(),this._glyphRenderer.value.updateCell(S,i,h,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,u,f,o),l)){for(s=this._workCell,S++;S<=y;S++)g=(i*r.cols+S)*pi,this._glyphRenderer.value.updateCell(S,i,0,0,0,0,Iu,0,0),this._model.cells[g]=0,this._model.cells[g+li]=this._cellColorResolver.result.bg,this._model.cells[g+ci]=this._cellColorResolver.result.fg,this._model.cells[g+En]=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})}},_p=class extends Or{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 wl(e,t,r=0){return Math.max(Math.min(e,t),r)}var yl="di$target",Sl="di$dependencies",On=new Map;function Pt(e){if(On.has(e))return On.get(e);let t=function(r,s,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");mp(t,r,o)};return t._id=e,On.set(e,t),t}function mp(e,t,r){t[yl]===t?t[Sl].push({id:e,index:r}):(t[Sl]=[{id:e,index:r}],t[yl]=t)}var vv=Pt("BufferService"),bv=Pt("CoreMouseService"),wv=Pt("CoreService"),yv=Pt("CharsetService"),Sv=Pt("InstantiationService"),Cv=Pt("LogService"),gp=Pt("OptionsService"),xv=Pt("OscLinkService"),kv=Pt("UnicodeService"),Ev=Pt("DecorationService"),vp={trace:0,debug:1,info:2,warn:3,error:4,off:5},bp="xterm.js: ",Cl=class extends at{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),rc=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=vp[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?"":bp)+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)}};Cl=mu([gu(0,gp)],Cl);var rc;function wp(e){rc=e}var sc=class extends at{constructor(e){if(Ml&&Ou()<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 Me),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Me),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Me),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Me),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,s=t.optionsService,o=t,i=o._renderService,n=o._characterJoinerService,a=o._charSizeService,d=o._coreBrowserService,l=o._decorationService,_=o._logService,m=o._themeService;wp(_),this._renderer=this._register(new pp(e,n,a,d,r,l,s,m,this._preserveDrawingBuffer)),this._register(At.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(At.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(At.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(At.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),i.setRenderer(this._renderer),this._register(Ge(()=>{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 ic=`/**
118
+ }`,Gt=8,Un=Gt*Float32Array.BYTES_PER_ELEMENT,Sp=20*Gt,yl=class{constructor(){this.attributes=new Float32Array(Sp),this.count=0}},qt=0,Sl=0,Cl=0,xl=0,kl=0,El=0,Ll=0,Cp=class extends ct{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new yl,this._verticesCursor=new yl;let n=this._gl;this._program=ze(pc(n,wp,yp)),this._register(Ye(()=>n.deleteProgram(this._program))),this._projectionLocation=ze(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),o=n.createBuffer();this._register(Ye(()=>n.deleteBuffer(o))),n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,s,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),d=n.createBuffer();this._register(Ye(()=>n.deleteBuffer(d))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,d),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=ze(n.createBuffer()),this._register(Ye(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,Un,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,Un,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,Un,4*Float32Array.BYTES_PER_ELEMENT),n.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,fc),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,n,s,o,a,d,l,_,m,y,p,c;for(n=0;n<t.rows;n++){for(o=-1,a=0,d=0,l=!1,s=0;s<t.cols;s++)_=(n*t.cols+s)*Ts,m=e.cells[_+Ss],y=e.cells[_+Cs],p=!!(y&67108864),(m!==a||y!==d&&(l||p))&&((a!==0||l&&d!==0)&&(c=i++*Gt,this._updateRectangle(r,c,d,a,o,s,n)),o=s,a=m,d=y,l=p);(a!==0||l&&d!==0)&&(c=i++*Gt,this._updateRectangle(r,c,d,a,o,t.cols,n))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,n=0;(r.style==="bar"||r.style==="outline")&&(i=n++*Gt,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=n++*Gt,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=n++*Gt,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=n++*Gt,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=n}_updateRectangle(e,t,r,i,n,s,o){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:qt=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:qt=(r&16777215)<<8;break;default:qt=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:qt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:qt=(i&16777215)<<8;break;default:qt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=hp(e.attributes,this._terminal.rows*this._terminal.cols*Gt)),Sl=n*this._dimensions.device.cell.width,Cl=o*this._dimensions.device.cell.height,xl=(qt>>24&255)/255,kl=(qt>>16&255)/255,El=(qt>>8&255)/255,Ll=1,this._addRectangle(e.attributes,t,Sl,Cl,(s-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,xl,kl,El,Ll)}_addRectangle(e,t,r,i,n,s,o,a,d,l){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=d,e[t+7]=l}_addRectangleFloat(e,t,r,i,n,s,o){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[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])}},xp=class extends ct{constructor(e,t,r,i,n,s,o,a){super(),this._container=t,this._alpha=n,this._coreBrowserService=s,this._optionsService=o,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(d=>{this._refreshCharAtlas(e,d),this.reset(e)})),this._register(Ye(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ze(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=dc(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=Ql,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}`}},kp=class extends xp{constructor(e,t,r,i,n,s,o){super(r,e,"link",t,!0,n,s,o),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&&ap(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()}},wt=typeof window=="object"?window:globalThis,oo=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Me,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}};oo.INSTANCE=new oo;var _c=oo;function Ep(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}var Vv=_c.INSTANCE.onDidChangeZoomLevel,Yv=_c.INSTANCE.onDidChangeFullscreen,Kr=typeof navigator=="object"?navigator.userAgent:"",Xv=Kr.indexOf("Firefox")>=0,jn=Kr.indexOf("AppleWebKit")>=0,Lp=Kr.indexOf("Chrome")>=0,Tp=!Lp&&Kr.indexOf("Safari")>=0,Jv=Kr.indexOf("Electron/")>=0,Zv=Kr.indexOf("Android")>=0,xs=!1;if(typeof wt.matchMedia=="function"){let e=wt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=wt.matchMedia("(display-mode: fullscreen)");xs=e.matches,Ep(wt,e,({matches:r})=>{xs&&t.matches||(xs=r)})}function Mp(){return xs}var jr="en",ao=!1,lo=!1,ks=!1,Rp=!1,mc=!1,gc=!1,Ap=!1,Dp=!1,Pp=!1,Bp=!1,vs,Es=jr,Tl=jr,Op,Kt,Yt=globalThis,lt;typeof Yt.vscode<"u"&&typeof Yt.vscode.process<"u"?lt=Yt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(lt=process);var vc=typeof lt?.versions?.electron=="string",Ip=vc&&lt?.type==="renderer";if(typeof lt=="object"){ao=lt.platform==="win32",lo=lt.platform==="darwin",ks=lt.platform==="linux",Rp=ks&&!!lt.env.SNAP&&!!lt.env.SNAP_REVISION,Ap=vc,Pp=!!lt.env.CI||!!lt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,vs=jr,Es=jr;let e=lt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);vs=t.userLocale,Tl=t.osLocale,Es=t.resolvedLanguage||jr,Op=t.languagePack?.translationsConfigFile}catch{}mc=!0}else typeof navigator=="object"&&!Ip?(Kt=navigator.userAgent,ao=Kt.indexOf("Windows")>=0,lo=Kt.indexOf("Macintosh")>=0,Dp=(Kt.indexOf("Macintosh")>=0||Kt.indexOf("iPad")>=0||Kt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ks=Kt.indexOf("Linux")>=0,Bp=Kt?.indexOf("Mobi")>=0,gc=!0,Es=globalThis._VSCODE_NLS_LANGUAGE||jr,vs=navigator.language.toLowerCase(),Tl=vs):console.error("Unable to resolve platform.");var $n=0;lo?$n=1:ao?$n=3:ks&&($n=2);var qn=mc,Np=gc&&typeof Yt.importScripts=="function",Qv=Np?Yt.origin:void 0,Dt=Kt,sr=Es,Ml;(e=>{function t(){return sr}e.value=t;function r(){return sr.length===2?sr==="en":sr.length>=3?sr[0]==="e"&&sr[1]==="n"&&sr[2]==="-":!1}e.isDefaultVariant=r;function i(){return sr==="en"}e.isDefault=i})(Ml||(Ml={}));var Hp=typeof Yt.postMessage=="function"&&!Yt.importScripts,Fp=(()=>{if(Hp){let e=[];Yt.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;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)})(),Wp=!!(Dt&&Dt.indexOf("Chrome")>=0),eb=!!(Dt&&Dt.indexOf("Firefox")>=0),tb=!!(!Wp&&Dt&&Dt.indexOf("Safari")>=0),rb=!!(Dt&&Dt.indexOf("Edg/")>=0),ib=!!(Dt&&Dt.indexOf("Android")>=0),nr=typeof navigator=="object"?navigator:{},sb={clipboard:{writeText:qn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(nr&&nr.clipboard&&nr.clipboard.writeText),readText:qn||!!(nr&&nr.clipboard&&nr.clipboard.readText)},keyboard:qn||Mp()?0:nr.keyboard||Tp?1:2,touch:"ontouchstart"in wt||nr.maxTouchPoints>0,pointerEvents:wt.PointerEvent&&("ontouchstart"in wt||navigator.maxTouchPoints>0)},po=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}},Kn=new po,Rl=new po,Al=new po,nb=new Array(230),Dl;(e=>{function t(a){return Kn.keyCodeToStr(a)}e.toString=t;function r(a){return Kn.strToKeyCode(a)}e.fromString=r;function i(a){return Rl.keyCodeToStr(a)}e.toUserSettingsUS=i;function n(a){return Al.keyCodeToStr(a)}e.toUserSettingsGeneral=n;function s(a){return Rl.strToKeyCode(a)||Al.strToKeyCode(a)}e.fromUserSettings=s;function o(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 Kn.keyCodeToStr(a)}e.toElectronAccelerator=o})(Dl||(Dl={}));var bc=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Pl;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof zp?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:At.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:bc})})(Pl||(Pl={}));var zp=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?bc:(this._emitter||(this._emitter=new Me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Up,Gn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Gn=(e,t)=>{Fp(()=>{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)}}}:Gn=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),n=!1;return{dispose(){n||(n=!0,e.cancelIdleCallback(i))}}},Up=e=>Gn(globalThis,e)})();var Bl;(e=>{async function t(i){let n,s=await Promise.all(i.map(o=>o.then(a=>a,a=>{n||(n=a)})));if(typeof n<"u")throw n;return s}e.settled=t;function r(i){return new Promise(async(n,s)=>{try{await i(n,s)}catch(o){s(o)}})}e.withAsyncBody=r})(Bl||(Bl={}));var Ol=class ut{static fromArray(t){return new ut(r=>{r.emitMany(t)})}static fromPromise(t){return new ut(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ut(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new ut(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Me,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}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 At.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new ut(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return ut.map(this,t)}static filter(t,r){return new ut(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return ut.filter(this,t)}static coalesce(t){return ut.filter(t,r=>!!r)}coalesce(){return ut.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return ut.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())}};Ol.EMPTY=Ol.fromArray([]);function jp(e){return 55296<=e&&e<=56319}function Il(e){return 56320<=e&&e<=57343}function $p(e,t){return(e-55296<<10)+(t-56320)+65536}function qp(e){return _o(e,0)}function _o(e,t){switch(typeof e){case"object":return e===null?Vt(349,t):Array.isArray(e)?Gp(e,t):Vp(e,t);case"string":return wc(e,t);case"boolean":return Kp(e,t);case"number":return Vt(e,t);case"undefined":return Vt(937,t);default:return Vt(617,t)}}function Vt(e,t){return(t<<5)-t+e|0}function Kp(e,t){return Vt(e?433:863,t)}function wc(e,t){t=Vt(149417,t);for(let r=0,i=e.length;r<i;r++)t=Vt(e.charCodeAt(r),t);return t}function Gp(e,t){return t=Vt(104579,t),e.reduce((r,i)=>_o(i,r),t)}function Vp(e,t){return t=Vt(181387,t),Object.keys(e).sort().reduce((r,i)=>(r=wc(i,r),_o(e[i],r)),t)}function Vn(e,t,r=32){let i=r-t,n=~((1<<i)-1);return(e<<t|(n&e)>>>i)>>>0}function Nl(e,t=0,r=e.byteLength,i=0){for(let n=0;n<r;n++)e[t+n]=i}function Yp(e,t,r="0"){for(;e.length<t;)e=r+e;return e}function Ci(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""):Yp((e>>>0).toString(16),t/4)}var Xp=class yc{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,n=this._buffLen,s=this._leftoverHighSurrogate,o,a;for(s!==0?(o=s,a=-1,s=0):(o=t.charCodeAt(0),a=0);;){let d=o;if(jp(o))if(a+1<r){let l=t.charCodeAt(a+1);Il(l)?(a++,d=$p(o,l)):d=65533}else{s=o;break}else Il(o)&&(d=65533);if(n=this._push(i,n,d),a++,a<r)o=t.charCodeAt(a);else break}this._buffLen=n,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()),Ci(this._h0)+Ci(this._h1)+Ci(this._h2)+Ci(this._h3)+Ci(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Nl(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Nl(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=yc._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,Vn(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,n=this._h1,s=this._h2,o=this._h3,a=this._h4,d,l,_;for(let m=0;m<80;m++)m<20?(d=n&s|~n&o,l=1518500249):m<40?(d=n^s^o,l=1859775393):m<60?(d=n&s|n&o|s&o,l=2400959708):(d=n^s^o,l=3395469782),_=Vn(i,5)+d+a+l+t.getUint32(m*4,!1)&4294967295,a=o,o=s,s=Vn(n,30),n=i,i=_;this._h0=this._h0+i&4294967295,this._h1=this._h1+n&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};Xp._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:ob,getWindow:Jp,getDocument:ab,getWindows:lb,getWindowsCount:cb,getWindowId:Hl,getWindowById:hb,hasWindow:db,onDidRegisterWindow:ub,onWillUnregisterWindow:fb,onDidUnregisterWindow:pb}=(function(){let e=new Map,t={window:wt,disposables:new $r};e.set(wt.vscodeWindowId,t);let r=new Me,i=new Me,n=new Me;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ct.None;let a=new $r,d={window:o,disposables:a.add(new $r)};return e.set(o.vscodeWindowId,d),a.add(Ye(()=>{e.delete(o.vscodeWindowId),i.fire(o)})),a.add(co(o,e_.BEFORE_UNLOAD,()=>{n.fire(o)})),r.fire(d),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let d=o;return d?.view?d.view.window:wt},getDocument(o){return Jp(o).document}}})(),Zp=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 co(e,t,r,i){return new Zp(e,t,r,i)}var Qp,Fl,Yn=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){bs(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,n=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),i.set(s,!0);o.length>0;)o.sort(Yn.sort),o.shift().execute();i.set(s,!1)};Fl=(s,o,a=0)=>{let d=Hl(s),l=new Yn(o,a),_=e.get(d);return _||(_=[],e.set(d,_)),_.push(l),r.get(d)||(r.set(d,!0),s.requestAnimationFrame(()=>n(d))),l},Qp=(s,o,a)=>{let d=Hl(s);if(i.get(d)){let l=new Yn(o,a),_=t.get(d);return _||(_=[],t.set(d,_)),_.push(l),l}else return Fl(s,o,a)}})();var Wl=class Ls{constructor(t,r){this.width=t,this.height=r}with(t=this.width,r=this.height){return t!==this.width||r!==this.height?new Ls(t,r):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Ls?t:new Ls(t.width,t.height)}static equals(t,r){return t===r?!0:!t||!r?!1:t.width===r.width&&t.height===r.height}};Wl.None=new Wl(0,0);var _b=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 n=qp(r),s=i.get(n);if(s)s.users+=1;else{let o=new Me,a=new MutationObserver(l=>o.fire(l));a.observe(e,r);let d=s={users:1,observer:a,onDidMutate:o.event};t.add(Ye(()=>{d.users-=1,d.users===0&&(o.dispose(),a.disconnect(),i?.delete(n),i?.size===0&&this.mutationObservers.delete(e))})),i.set(n,s)}return s.onDidMutate}},e_={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"},t_=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Sc(e,t,r,...i){let n=t_.exec(t);if(!n)throw new Error("Bad use of emmet");let s=n[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,s):o=document.createElement(s),n[3]&&(o.id=n[3]),n[4]&&(o.className=n[4].replace(/\./g," ").trim()),r&&Object.entries(r).forEach(([a,d])=>{typeof d>"u"||(/^on\w+$/.test(a)?o[a]=d:a==="selected"?d&&o.setAttribute(a,"true"):o.setAttribute(a,d))}),o.append(...i),o}function r_(e,t,...r){return Sc("http://www.w3.org/1999/xhtml",e,t,...r)}r_.SVG=function(e,t,...r){return Sc("http://www.w3.org/2000/svg",e,t,...r)};var i_=class extends ct{constructor(e,t,r,i,n,s,o,a,d){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=i,this._coreService=n,this._decorationService=s,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new bi,this._charAtlasDisposable=this._register(new bi),this._observerDisposable=this._register(new bi),this._model=new bp,this._workCell=new bl,this._workCell2=new bl,this._rectangleRenderer=this._register(new bi),this._glyphRenderer=this._register(new bi),this._onChangeTextureAtlas=this._register(new Me),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Me),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Me),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Me),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Me),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:d};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 Bf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new kp(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Df(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(co(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(co(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,gl(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=vl(this._canvas,this._coreBrowserService.window,(_,m)=>this._setCanvasDevicePixelDimensions(_,m)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=vl(this._canvas,_,(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(Ye(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),gl(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 Cp(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new _p(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=dc(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=Vl(At.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),At.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 lp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,i=this._workCell,n,s,o,a,d,l,_=0,m=!0,y,p,c,u,h,f,v,S,g;e=zl(e,r.rows-1,0),t=zl(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,P=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),O=-1,F=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(o=s+r.buffer.ydisp,a=r.buffer.lines.get(o),this._model.lineLengths[s]=0,c=w===o,_=0,d=this._characterJoinerService.getJoinedCharacters(o),S=0;S<r.cols;S++){if(n=this._cellColorResolver.result.bg,a.loadCell(S,i),S===0&&(n=this._cellColorResolver.result.bg),l=!1,m=S>=_,y=S,d.length>0&&S===d[0][0]&&m){p=d.shift();let V=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)m&&(m=V===this._model.selection.isCellSelected(this._terminal,v,o));m&&(m=!c||P<p[0]||P>=p[1]),m?(l=!0,i=new s_(i,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),y=p[1]-1):_=p[1]}if(u=i.getChars(),h=i.getCode(),v=(s*r.cols+S)*Ts,this._cellColorResolver.resolve(i,S,o,this.dimensions.device.cell.width),F&&o===w&&(S===P&&(this._model.cursor={x:P,y:E,width:i.getWidth(),style:this._coreBrowserService.isFocused?x:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},O=P+i.getWidth()-1),S>=P&&S<=O&&(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+Ss]===this._cellColorResolver.result.bg&&this._model.cells[v+Cs]===this._cellColorResolver.result.fg&&this._model.cells[v+zn]===this._cellColorResolver.result.ext)&&(A=!0,u.length>1&&(h|=vp),this._model.cells[v]=h,this._model.cells[v+Ss]=this._cellColorResolver.result.bg,this._model.cells[v+Cs]=this._cellColorResolver.result.fg,this._model.cells[v+zn]=this._cellColorResolver.result.ext,f=i.getWidth(),this._glyphRenderer.value.updateCell(S,s,h,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,u,f,n),l)){for(i=this._workCell,S++;S<=y;S++)g=(s*r.cols+S)*Ts,this._glyphRenderer.value.updateCell(S,s,0,0,0,0,Ef,0,0),this._model.cells[g]=0,this._model.cells[g+Ss]=this._cellColorResolver.result.bg,this._model.cells[g+Cs]=this._cellColorResolver.result.fg,this._model.cells[g+zn]=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})}},s_=class extends Ur{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 zl(e,t,r=0){return Math.max(Math.min(e,t),r)}var Ul="di$target",jl="di$dependencies",Xn=new Map;function Pt(e){if(Xn.has(e))return Xn.get(e);let t=function(r,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");n_(t,r,n)};return t._id=e,Xn.set(e,t),t}function n_(e,t,r){t[Ul]===t?t[jl].push({id:e,index:r}):(t[jl]=[{id:e,index:r}],t[Ul]=t)}var mb=Pt("BufferService"),gb=Pt("CoreMouseService"),vb=Pt("CoreService"),bb=Pt("CharsetService"),wb=Pt("InstantiationService"),yb=Pt("LogService"),o_=Pt("OptionsService"),Sb=Pt("OscLinkService"),Cb=Pt("UnicodeService"),xb=Pt("DecorationService"),a_={trace:0,debug:1,info:2,warn:3,error:4,off:5},l_="xterm.js: ",$l=class extends ct{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Cc=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=a_[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?"":l_)+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)}};$l=of([af(0,o_)],$l);var Cc;function c_(e){Cc=e}var xc=class extends ct{constructor(e){if(Jl&&kf()<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 Me),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Me),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Me),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Me),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,n=t,s=n._renderService,o=n._characterJoinerService,a=n._charSizeService,d=n._coreBrowserService,l=n._decorationService,_=n._logService,m=n._themeService;c_(_),this._renderer=this._register(new i_(e,o,a,d,r,l,i,m,this._preserveDrawingBuffer)),this._register(At.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(At.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(At.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(At.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(Ye(()=>{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 kc=`/**
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 nc=`/* eslint-disable */
336
+ `;var Ec=`/* eslint-disable */
337
337
  /**
338
338
  * @hyzyn/dsh-tty \u2014 \u9762\u677F\u6837\u5F0F\u8868\u3002
339
339
  *
@@ -372,6 +372,11 @@ void main() {
372
372
  --tt-h-lg: 32px;
373
373
  /* \u670D\u52A1\u5668\u72B6\u6001\u6761\u9AD8\u5EA6\uFF1A\u663E\u9690\u65F6 .tt_term \u7684 top \u8DDF\u7740\u8BA9\u4F4D\uFF08JS \u8D1F\u8D23 fit \u91CD\u7B97\uFF09 */
374
374
  --tt-statsbar-h: 24px;
375
+ /* \u9000\u51FA\u63D0\u793A\u6761\u9AD8\u5EA6\uFF08issue #7\u2460\u2461\uFF09\uFF1A\u91CC\u9762\u6709\u4E00\u9897 28px \u7684\u6309\u94AE\uFF0C\u6BD4\u72B6\u6001\u6761\u9AD8\u4E00\u6863 */
376
+ --tt-exitbar-h: 32px;
377
+ /* \u7EC8\u7AEF\u533A\u7684\u6C34\u5E73\u5185\u8FB9\u8DDD = \u6587\u5B57\u4E0E\u9762\u677F\u8FB9\u7F18\u7684\u547C\u5438\u4F4D\u3002**\u5B83\u540C\u65F6\u51B3\u5B9A\u6EDA\u52A8\u6761\u79BB\u9762\u677F\u8FB9\u7F18\u591A\u8FDC**\uFF1A
378
+ \`.tt_term .xterm-viewport\` \u6309\u540C\u4E00\u4E2A\u503C\u53CD\u5411\u62C9\u51FA\u5185\u8FB9\u8DDD\uFF0C\u522B\u5728\u8FD9\u4E24\u5904\u5404\u5199\u4E00\u4E2A\u6570\u5B57\u3002 */
379
+ --tt-term-pad-x: 12px;
375
380
  /* \u95F4\u8DDD */
376
381
  --tt-gap-xs: 4px;
377
382
  --tt-gap-sm: 6px;
@@ -461,6 +466,10 @@ void main() {
461
466
  --tt-term-stats-label: rgba(255, 255, 255, .5);
462
467
  --tt-term-stats-value: rgba(255, 255, 255, .86);
463
468
  --tt-term-stats-track: rgba(255, 255, 255, .14);
469
+ /* \u9000\u51FA\u63D0\u793A\u6761\uFF08issue #7\u2460\uFF09\uFF1A\u7EC8\u7AEF\u57DF\u56FA\u5B9A\u6DF1\u8272\uFF0C\u4E0E\u72B6\u6001\u6761\u540C\u65CF\u7684\u6D45\u767D\u7CFB */
470
+ --tt-term-exit-bg: rgba(255, 255, 255, .06);
471
+ --tt-term-exit-border: rgba(255, 255, 255, .10);
472
+ --tt-term-exit-fg: rgba(255, 255, 255, .86);
464
473
  --tt-term-overlay: rgba(6, 9, 15, .58);
465
474
  --tt-term-card-bg: rgba(18, 22, 31, .92);
466
475
  --tt-term-card-border: rgba(255, 255, 255, .12);
@@ -976,8 +985,14 @@ void main() {
976
985
 
977
986
  /* ---- \u641C\u7D22\u6846 ---- */
978
987
  .tt_searchInput {
979
- flex: none;
980
- width: 190px;
988
+ /*
989
+ * \u5BBD\u5EA6\uFF1A240px \u662F\u300C\u77ED\u7248 placeholder \u5B8C\u6574\u53EF\u89C1\u300D\u7684\u5B9E\u6D4B\u503C\uFF08\u539F\u5148 190px \u8FDE
990
+ * \`\u641C\u7D22 (Enter \u2193 / Shift+Enter \u2191)\` \u90FD\u653E\u4E0D\u4E0B\uFF0C\u5360\u4F4D\u6587\u6848\u88AB\u622A\u6389\u534A\u53E5\uFF09\u3002
991
+ * \u5934\u90E8\u7684\u4E3B\u5F39\u6027\u9879\u662F\u6807\u7B7E\u680F\uFF08.tt_tabbar \u662F flex:1 1 0\uFF09\uFF0C\u6240\u4EE5\u8FD9\u91CC**\u4E0D\u62A2**\u5BBD\u5EA6\uFF1A
992
+ * flex-basis \u7ED9 240\u3001\u53EA\u7559 shrink \u5728\u7A84\u7A97\u53E3\u515C\u5E95\uFF0Cmin-width \u4FDD\u8BC1\u8FD8\u770B\u5F97\u89C1\u8F93\u5165\u7684\u5B57\u3002
993
+ */
994
+ flex: 0 1 240px;
995
+ min-width: 120px;
981
996
  height: var(--tt-h-md);
982
997
  padding: 0 10px;
983
998
  border: 0.5px solid var(--tt-border-strong);
@@ -1072,12 +1087,6 @@ void main() {
1072
1087
  height: var(--tt-h-sm);
1073
1088
  padding: 0;
1074
1089
  }
1075
- /* \u7C98\u8D34\u56FE\u6807\u91CC\u90A3\u5757\u300C\u7EB8\u300D\u7684\u9542\u7A7A\uFF1A\u586B\u5BBF\u4E3B\u5E95\u8272\u3002
1076
- SVG \u7684 presentation attribute **\u4E0D\u89E3\u6790 var()**\uFF08\u539F\u6765\u5199\u7684 fill="var(--dsw-\u2026)" \u4E00\u76F4\u662F\u65E0\u6548\u503C\uFF09\uFF0C
1077
- \u6240\u4EE5\u8D70\u7C7B\u540D + CSS \u89C4\u5219\u3002 */
1078
- .tt_iconPasteHole {
1079
- fill: var(--dsw-alias-bg-base);
1080
- }
1081
1090
  .tt_toolGroup {
1082
1091
  display: flex;
1083
1092
  align-items: center;
@@ -1504,7 +1513,7 @@ void main() {
1504
1513
  position: absolute;
1505
1514
  inset: 0;
1506
1515
  z-index: 1;
1507
- padding: 10px 12px;
1516
+ padding: 10px var(--tt-term-pad-x);
1508
1517
  }
1509
1518
  .tt_term .xterm {
1510
1519
  height: 100%;
@@ -1540,6 +1549,7 @@ void main() {
1540
1549
  .tt_term .xterm-viewport::-webkit-scrollbar {
1541
1550
  width: 10px;
1542
1551
  }
1552
+
1543
1553
  .tt_term .xterm-viewport::-webkit-scrollbar-thumb {
1544
1554
  border: 3px solid transparent;
1545
1555
  border-radius: var(--tt-r-pill);
@@ -1551,6 +1561,29 @@ void main() {
1551
1561
  background-clip: content-box;
1552
1562
  }
1553
1563
 
1564
+ /*
1565
+ * \u6EDA\u52A8\u6761\u8D34\u8FB9\uFF08\u7528\u6237\u53CD\u9988\u300C\u6EDA\u52A8\u6761\u53EF\u4EE5\u4F18\u5316\u9760\u8FB9\u4E00\u70B9\u5417\u300D\uFF1B\u622A\u56FE\u5B9E\u6D4B\u6ED1\u5757\u53F3\u7F18\u8DDD\u9762\u677F\u8FB9\u7F18 15px\uFF09\uFF1A
1566
+ * \u89C6\u53E3\u6B62\u6B65\u4E8E \`.tt_term\` \u7684\u5185\u5BB9\u76D2\uFF08= \u9762\u677F\u8FB9\u7F18\u518D\u5F80\u91CC\u4E00\u6574\u4E2A \`--tt-term-pad-x\`\uFF09\uFF0C\u800C\u6EDA\u52A8\u6761\u753B\u5728
1567
+ * \u89C6\u53E3\u81EA\u5DF1\u7684\u53F3\u7F18\u2014\u2014\u4E8E\u662F 10px \u7684\u8F68\u9053\u6574\u6761\u8EBA\u5728\u5185\u8FB9\u8DDD\u91CC\u30014px \u7684\u6ED1\u5757\u88AB\u63A8\u5230\u79BB\u8FB9\u7F18 15\u201319px\uFF0C
1568
+ * \u770B\u7740\u50CF\u60AC\u7A7A\u3002\u8FD9\u91CC\u53EA\u628A**\u89C6\u53E3**\u7684\u53F3\u8FB9\u754C\u5F80\u5916\u62C9\u51FA\u5185\u8FB9\u8DDD\u3001\u7559 2px \u8D34\u8FB9\u4F59\u91CF\uFF0C\u6EDA\u52A8\u6761\u5C31\u843D\u8FDB\u90A3\u6761
1569
+ * \u7A7A\u9699\uFF0C\u800C**\u6587\u5B57\u7684\u5185\u7F29\u4E00\u70B9\u4E0D\u52A8**\u2014\u2014\`.xterm-screen\` \u4E0E\u89C6\u53E3\u662F\u5144\u5F1F\u8282\u70B9\uFF08\u5B9E\u6D4B\u540C\u6302 \`.xterm\`\uFF09\uFF0C
1570
+ * \u5BBD\u5EA6\u7531 \`.tt_term\` \u7684\u5185\u5BB9\u76D2\uFF08\u4E5F\u5C31\u662F cols\uFF09\u51B3\u5B9A\uFF0C\u52A0\u5BBD\u89C6\u53E3\u53EA\u662F\u8BA9\u53F3\u8FB9\u591A\u51FA\u4E00\u6BB5\u7A7A\u767D\uFF1B\u5B9E\u6D4B\u6539\u540E
1571
+ * \`.xterm-screen\` \u4ECD\u662F 1239\xD7800\u3001\`scrollWidth == clientWidth\`\uFF08\u4E0D\u4F1A\u5192\u51FA\u6A2A\u5411\u6EDA\u52A8\u6761\uFF09\uFF0C\u4E0A\u4E0B\u8FD8
1572
+ * \u5404\u6709 \`.tt_term\` \u7684 10px \u5185\u8FB9\u8DDD\uFF0C\u4E0D\u4F1A\u9876\u5230\u9762\u677F\u5706\u89D2\u3002
1573
+ *
1574
+ * \u26A0\uFE0F \u591A\u5E26\u7684\u8FD9\u4E00\u5C42 \`.xterm\` \u4E0D\u662F\u5197\u4F59\uFF1Axterm.css \u81EA\u5DF1\u7684 \`.xterm .xterm-viewport { right: 0 }\`
1575
+ * \u4E0E\u672C\u5305\u539F\u9009\u62E9\u5668**\u540C\u4E3A (0,2,0)**\uFF0C\u800C\u6CE8\u5165\u987A\u5E8F\u662F \`ttyCss + '\\n' + xtermCss\`\uFF08\u89C1 client-src \u7684
1576
+ * ensureStyle\uFF09\u2014\u2014\u540C\u6743\u91CD\u4E0B xterm.css \u540E\u5199\u8005\u80DC\uFF0C\u628A \`right\` \u5199\u8FDB\u4E0A\u9762\u90A3\u6761\u89C4\u5219\u4F1A\u88AB\u5B83\u7684 0 \u9876\u6389
1577
+ * \uFF08\u5B9E\u6D4B computed right \u4ECD\u662F \`0px\`\uFF09\u3002\u591A\u4E00\u5C42\u5373 (0,3,0)\uFF0C\u4E0E\u6CE8\u5165\u987A\u5E8F\u65E0\u5173\u3002
1578
+ *
1579
+ * \u60F3\u8C03\u8D34\u8FB9\u7A0B\u5EA6\u53EA\u52A8 \`--tt-term-pad-x\`\uFF08\u6587\u5B57\u5185\u7F29\u4E0E\u5916\u6269\u540C\u6E90\uFF09\uFF1A2px \u4F59\u91CF\u6539\u5927 = \u79BB\u8FB9\u7F18\u66F4\u8FDC\uFF0C
1580
+ * \u6539\u5230 \u2265 \u5185\u8FB9\u8DDD\u5C31\u7B49\u4E8E\u56DE\u5230\u300C\u6EDA\u52A8\u6761\u8EBA\u5728\u5185\u8FB9\u8DDD\u91CC\u300D\u7684\u8001\u6837\u5B50\uFF1B\`test/scrollbar-skin.test.ts\`
1581
+ * \u9489\u7740\u8FD9\u5C42\u5173\u7CFB\u3002
1582
+ */
1583
+ .tt_term .xterm .xterm-viewport {
1584
+ right: calc(2px - var(--tt-term-pad-x));
1585
+ }
1586
+
1554
1587
  /* ======================= \u670D\u52A1\u5668\u72B6\u6001\u6761\uFF080.17.0\uFF09 ======================= */
1555
1588
 
1556
1589
  /*
@@ -1718,6 +1751,123 @@ void main() {
1718
1751
  font-weight: 500;
1719
1752
  }
1720
1753
 
1754
+ /* ======================= \u9000\u51FA\u63D0\u793A\u6761\uFF08D96 / issue #7\u2460\u2461\uFF09 ======================= */
1755
+
1756
+ /*
1757
+ * \u9000\u51FA\u6001**\u4E0D\u518D\u94FA\u6EE1\u906E\u7F69**\uFF1A\u90A3\u5C42 inset:0 + \u534A\u900F\u660E\u5E95 + \u6A21\u7CCA + \u6574\u5757\u53EF\u70B9\uFF0C\u628A AI \u8DD1\u51FA\u6765\u7684\u7ED3\u679C
1758
+ * \u538B\u5728\u4E0B\u9762\uFF08\u7528\u6237\u4E0A\u62A5\uFF1A\u5F97\u53BB F12 \u628A \`.tt_overlay\` \u85CF\u6389\u624D\u770B\u5F97\u6E05\uFF09\uFF0C\u800C\u4E14\u6574\u5757\u5403\u70B9\u51FB\u2014\u2014
1759
+ * \u8FDE\u9009\u4E2D\u590D\u5236\u90FD\u505A\u4E0D\u5230\u3002\u6539\u6210\u672C\u6761\uFF1A\u4E00\u884C\u300C\u5DF2\u9000\u51FA / AI \u5DF2\u7ED3\u675F\u8BE5\u4F1A\u8BDD\u300D+ \u6700\u591A\u4E00\u9897\u52A8\u4F5C\u6309\u94AE\u3002
1760
+ *
1761
+ * \u51E0\u4F55\u4E0E\u72B6\u6001\u6761\u540C\u4E00\u5957\uFF1A\u7EDD\u5BF9\u5B9A\u4F4D\u5728 .tt_body \u9876\u90E8\uFF0C\u663E\u9690\u53EA\u628A .tt_term \u7684 top \u5F80\u4E0B\u63A8
1762
+ * \uFF08JS \u5728\u663E\u9690\u7FFB\u8F6C\u65F6\u91CD\u8DD1 fit\uFF0C\u89C1 client-src \u7684 applyExitBar / refitActiveTab\uFF09\u3002
1763
+ * \u4E24\u6761\u540C\u65F6\u53EF\u89C1\u65F6\u53E0\u7740\u653E\uFF1A\u72B6\u6001\u6761\u5728\u4E0A\u3001\u9000\u51FA\u6761\u5728\u4E0B\uFF0C.tt_term \u8BA9\u51FA\u4E24\u8005\u4E4B\u548C\u3002
1764
+ */
1765
+ .tt_body[data-exited] .tt_term {
1766
+ top: var(--tt-exitbar-h);
1767
+ }
1768
+ .tt_body[data-stats] .tt_exitBar {
1769
+ top: var(--tt-statsbar-h);
1770
+ }
1771
+ .tt_body[data-stats][data-exited] .tt_term {
1772
+ top: calc(var(--tt-statsbar-h) + var(--tt-exitbar-h));
1773
+ }
1774
+ .tt_exitBar {
1775
+ position: absolute;
1776
+ top: 0;
1777
+ left: 0;
1778
+ right: 0;
1779
+ z-index: 4; /* \u4E0E\u72B6\u6001\u6761\u540C\u7EA7\uFF1A\u9AD8\u4E8E .tt_term(1)\u3001\u4F4E\u4E8E .tt_overlay(5) */
1780
+ display: flex;
1781
+ align-items: center;
1782
+ gap: var(--tt-gap-md);
1783
+ height: var(--tt-exitbar-h);
1784
+ padding: 0 var(--tt-gap-lg);
1785
+ border-bottom: 0.5px solid var(--tt-term-exit-border);
1786
+ color: var(--tt-term-exit-fg);
1787
+ background: var(--tt-term-exit-bg);
1788
+ font-size: 12px;
1789
+ line-height: 18px;
1790
+ }
1791
+ /*
1792
+ * \u663E\u5F0F\u515C\u5E95\uFF1A\u4E0A\u9762\u7684 display:flex \u662F\u4F5C\u8005\u6837\u5F0F\uFF0C\u800C [hidden] \u7684 display:none \u6765\u81EA UA \u8868\u2014\u2014
1793
+ * \u8001\u5F15\u64CE / \u5185\u5D4C WebView \u4E0D\u4FDD\u8BC1\uFF0C\u6B8B\u7559\u7684 32px \u4F1A\u76D6\u4F4F\u7EC8\u7AEF\u7B2C\u4E00\u884C\uFF08\u4E0E\u72B6\u6001\u6761\u540C\u6B3E\u5904\u7406\uFF09\u3002
1794
+ */
1795
+ .tt_exitBar[hidden] {
1796
+ display: none;
1797
+ }
1798
+ .tt_exitBarText {
1799
+ flex: 0 1 auto;
1800
+ min-width: 0;
1801
+ overflow: hidden;
1802
+ text-overflow: ellipsis;
1803
+ white-space: nowrap;
1804
+ }
1805
+ /* \u628A\u6309\u94AE\u63A8\u5230\u53F3\u7AEF\uFF1A\u6761\u7A84\u7684\u65F6\u5019\u6587\u5B57\u5148\u7701\u7565\uFF0C\u522B\u628A\u6309\u94AE\u6324\u51FA\u53EF\u89C6\u533A */
1806
+ .tt_exitBarSpacer {
1807
+ flex: 1 1 auto;
1808
+ }
1809
+ .tt_exitBarBtn {
1810
+ flex: none;
1811
+ }
1812
+
1813
+ /* ======================= \u5173\u9762\u677F\u786E\u8BA4\uFF08D98 / issue #8\uFF09 ======================= */
1814
+
1815
+ /*
1816
+ * \u2715 \u662F\u7834\u574F\u6027\u52A8\u4F5C\uFF08\u7ED3\u675F\u5168\u90E8\u4F1A\u8BDD\uFF09\u3002\u6709\u6D3B\u4F1A\u8BDD\u65F6\u5148\u95EE\u4E00\u53E5\uFF0C\u5224\u636E\u89C1 client-src/close-guard.js\u3002
1817
+ *
1818
+ * \u5C42\u6302\u5728 .tt_modal \u91CC\u800C\u4E0D\u662F backdrop \u4E0A\uFF1Abackdrop \u90A3\u5C42\u5E26\u7740\u300C\u70B9\u7A7A\u767D\u5904 = \u6700\u5C0F\u5316\u300D\uFF0C
1819
+ * \u6302\u5728\u91CC\u9762\u624D\u80FD\u4FDD\u8BC1\u786E\u8BA4\u5C42\u9762\u524D\u7684\u70B9\u51FB\u90FD\u4E0D\u4F1A\u88AB\u90A3\u6761\u987A\u624B\u5403\u6389\u3002\u5361\u7247\u6309\u9AD8\u5C42\u7EA7\u8868\u9762\u5199
1820
+ * \uFF08\u8868\u9762\u8272 + elevation\u3001\u4E0D\u914D\u4E2D\u6027 border\uFF0C\u68C0\u67E5\u516B\uFF09\uFF0C\u6309\u94AE\u590D\u7528\u9762\u677F\u7684\u6309\u94AE\u65CF
1821
+ * \uFF08\u6B21\u8981 = .tt_toolBtn\uFF0C\u7834\u574F\u6027 = .tt_toolBtn.tt_btnDanger\uFF0C\u68C0\u67E5\u5341\u4E00\uFF09\u3002
1822
+ */
1823
+ .tt_confirmLayer {
1824
+ position: absolute;
1825
+ inset: 0;
1826
+ z-index: 6; /* \u9AD8\u4E8E\u6807\u7B7E\u906E\u7F69(5)\uFF1A\u786E\u8BA4\u5C42\u4E0A\u4E0D\u8BE5\u518D\u53E0\u522B\u7684\u52A8\u4F5C\u5361\u7247 */
1827
+ display: flex;
1828
+ align-items: center;
1829
+ justify-content: center;
1830
+ padding: var(--tt-gap-xl);
1831
+ background: var(--tt-term-overlay);
1832
+ -webkit-backdrop-filter: blur(1.5px);
1833
+ backdrop-filter: blur(1.5px);
1834
+ }
1835
+ .tt_confirmCard {
1836
+ display: flex;
1837
+ flex-direction: column;
1838
+ gap: var(--tt-gap-sm);
1839
+ width: min(380px, 92%);
1840
+ padding: var(--tt-gap-xl);
1841
+ border-radius: var(--tt-r-xl);
1842
+ color: var(--tt-label);
1843
+ background-color: var(--tt-surface-solid);
1844
+ background-image: linear-gradient(var(--tt-surface), var(--tt-surface));
1845
+ box-shadow: var(--dsw-elevation-prominent);
1846
+ animation: ttModalIn .18s var(--tt-ease);
1847
+ }
1848
+ .tt_confirmTitle {
1849
+ font-size: 14px;
1850
+ line-height: 20px;
1851
+ font-weight: 600;
1852
+ }
1853
+ .tt_confirmText {
1854
+ color: var(--tt-label-2);
1855
+ font-size: 13px;
1856
+ line-height: 20px;
1857
+ }
1858
+ .tt_confirmHint {
1859
+ color: var(--tt-label-3);
1860
+ font-size: 12px;
1861
+ line-height: 18px;
1862
+ }
1863
+ .tt_confirmActions {
1864
+ display: flex;
1865
+ align-items: center;
1866
+ justify-content: flex-end;
1867
+ gap: var(--tt-gap-md);
1868
+ margin-top: var(--tt-gap-sm);
1869
+ }
1870
+
1721
1871
  /* ======================= \u6700\u5C0F\u5316\u60AC\u6D6E\u6761 ======================= */
1722
1872
 
1723
1873
  .tt_dock {
@@ -2116,8 +2266,9 @@ void main() {
2116
2266
  * \u5B9E\u6D4B\u75C7\u72B6\u662F\u805A\u7126\u7B5B\u9009\u6846\u7684\u4E00\u77AC\u95F4\u6574\u5757\u5185\u5BB9\u4F4D\u79FB\uFF0C\u770B\u7740\u50CF\u5BF9\u8BDD\u6846\u5728\u8DF3\u2014\u2014\u5217\u8868\u672C\u6765\u662F\u6587\u6863\u6D41\u91CC\u7684
2117
2267
  * flex \u5B50\u9879\uFF0C\u957F\u4E00\u622A\u5C31\u6491\u957F\u6574\u5F20\u5361\u7247\u3002
2118
2268
  *
2119
- * \u53EA\u4F5C\u7528\u4E8E .tt_sshRow \u5185\uFF1A\u540C\u4E00\u4E2A .tt_envList \u5728**\u8BBE\u7F6E\u5361\u7247**\uFF08React \u4FA7\uFF09\u662F\u5185\u8054\u7684 shell \u8DEF\u5F84
2120
- * \u5019\u9009\uFF0C\u90A3\u91CC\u63A8\u52A8\u5185\u5BB9\u662F\u6B63\u5E38\u7684\uFF0C\u522B\u4E00\u8D77\u6539\u3002
2269
+ * \u53EA\u4F5C\u7528\u4E8E .tt_sshRow \u5185\uFF1A\u540C\u4E00\u4E2A .tt_envList \u5728**\u8BBE\u7F6E\u5361\u7247**\uFF08React \u4FA7\uFF09\u53E6\u6709\u6D6E\u5C42\u5F62\u6001
2270
+ * \uFF08\`.tt_routeList\` / \`.tt_shellList\`\uFF0C\`position: fixed\` + placePopover\uFF0C\u89C1\u4E0B\uFF09\uFF0C\u90A3\u8FB9\u7531 JS \u9010\u6B21
2271
+ * \u5B9A\u4F4D\u3001\u5929\u7136\u9003\u51FA\u5361\u7247\u7684 overflow\uFF0C\u4E0E\u8FD9\u91CC\u7684 absolute \u7248\u5404\u7BA1\u4E00\u5904\uFF0C\u522B\u4E00\u8D77\u6539\u3002
2121
2272
  *
2122
2273
  * \u5DF2\u77E5\u8FB9\u754C\uFF1A\u5361\u7247\u662F \`overflow-y: auto\`\uFF0C\u6D6E\u5C42\u5982\u679C\u8D34\u5230\u5361\u7247\u4E0B\u7F18\u4F1A\u88AB\u88C1\u3002\u5F53\u524D\u4E24\u4E2A\u9009\u62E9\u5668
2123
2274
  * \uFF08\u79C1\u94A5\u53E3\u4EE4 / \u5BC6\u7801\uFF09\u90FD\u5728\u5BF9\u8BDD\u6846\u4E2D\u6BB5\uFF0C180px \u653E\u5F97\u4E0B\uFF1B\u771F\u9047\u5230\u8D34\u5E95\u7684\u4F4D\u7F6E\uFF0C\u518D\u6539\u6210 \`position: fixed\`
@@ -2431,20 +2582,30 @@ void main() {
2431
2582
  display: flex;
2432
2583
  align-items: center;
2433
2584
  gap: 8px;
2434
- flex: 1 1 auto;
2585
+ /* \u8D34\u5408\u5185\u5BB9\uFF1A\u7BAD\u5934\u7D27\u8DDF\u6E90\u7AEF\u70B9\u3002\u539F\u5148 \`1 1 auto\` \u4F1A\u628A\u300C\u8DF3\u300D\u62BB\u6EE1\u6574\u884C\uFF0C\u7AEF\u70B9\u8DDF\u7740\u88AB\u62BB\u5F00 */
2586
+ flex: 0 1 auto;
2435
2587
  min-width: 0;
2436
2588
  }
2437
- /* \u4E00\u4E2A\u7AEF\u70B9 = \u4E3B\u673A + \u5192\u53F7 + \u7AEF\u53E3\uFF1B\u7528\u540C\u4E00\u5E95\u8272\u8FDE\u6210\u4E00\u4F53\uFF0C\u770B\u5F97\u51FA\u662F\u4E00\u7EC4 */
2589
+ /*
2590
+ * \u4E00\u4E2A\u7AEF\u70B9 = \u4E3B\u673A + \u5192\u53F7 + \u7AEF\u53E3\uFF1B\u7528\u540C\u4E00\u5E95\u8272\u8FDE\u6210\u4E00\u4F53\uFF0C\u770B\u5F97\u51FA\u662F\u4E00\u7EC4\u3002
2591
+ *
2592
+ * **\u5BBD\u5EA6\u8D34\u5408\u5185\u5BB9**\uFF08\`0 1 auto\`\uFF09\uFF0C\u4E0D\u8DDF\u7740\u884C\u5BBD\u62BB\u5F00\u3002\u539F\u5148\u7684 \`1 1 190px\` \u5728\u5BBD\u5361\u7247\u91CC\u6709\u5BF9\u79F0\u7684\u4E24\u4E2A
2593
+ * \u75C7\u72B6\uFF08\u7528\u6237\u4E24\u5F20\u622A\u56FE\u5404\u62CD\u5230\u4E00\u5904\uFF09\uFF1A\u2460 \u5DE6\u7EC4\uFF08\u9759\u6001 \`127.0.0.1\` + \u5192\u53F7 + \u7AEF\u53E3\u6846\uFF0C\u4E09\u4E2A\u5B69\u5B50\u90FD\u4E0D\u589E\u957F\uFF09
2594
+ * \u88AB\u62BB\u5230 ~900px\uFF0C\u7AEF\u53E3\u6846\u540E\u9762\u7559\u4E0B\u4E00\u5927\u7247**\u7EC4\u5185\u6B7B\u533A**\uFF1B\u2461 \u53F3\u7EC4\u7684 host \u662F \`1 1 auto\`\u3001\u81EA\u5DF1\u5403\u6389\u5168\u90E8
2595
+ * \u4F59\u91CF\uFF0C\u4E8E\u662F\u5192\u53F7 + \u7AEF\u53E3\u88AB\u9876\u5230\u5361\u7247\u53F3\u7F18\uFF0C\u79BB\u300C\u670D\u52A1\u5668\u4FA7\u4E3B\u673A\u300D\u5360\u4F4D\u7B26\u51E0\u767E\u50CF\u7D20\u3002\u73B0\u5728 host \u6709\u786E\u5B9A
2596
+ * \u5BBD\u5EA6\uFF08\u89C1\u4E0B\uFF09\uFF0C\u6574\u7EC4\u5BBD\u5EA6 = \u5185\u5BB9\u5BBD\u5EA6\uFF0C\u4E24\u4E2A\u75C7\u72B6\u4E00\u8D77\u6D88\u5931\u3002
2597
+ */
2438
2598
  .tt_tunnelEndpoint {
2439
2599
  display: flex;
2440
2600
  align-items: center;
2441
2601
  gap: 0;
2442
- flex: 1 1 190px;
2602
+ flex: 0 1 auto;
2443
2603
  min-width: 0;
2444
2604
  border: 0.5px solid var(--tt-border);
2445
2605
  border-radius: var(--tt-r-md);
2446
2606
  background: var(--tt-surface-2);
2447
2607
  overflow: hidden;
2608
+ transition: border-color var(--tt-dur) var(--tt-ease), box-shadow var(--tt-dur) var(--tt-ease);
2448
2609
  }
2449
2610
  .tt_tunnelEndpoint .tt_cardInput {
2450
2611
  border: 0;
@@ -2453,6 +2614,20 @@ void main() {
2453
2614
  min-width: 0;
2454
2615
  width: auto;
2455
2616
  }
2617
+ /*
2618
+ * \u7EC4\u5185\u8F93\u5165\u6846**\u4E0D\u81EA\u5DF1\u753B\u805A\u7126\u73AF**\uFF1A\u672C\u5305\u8F93\u5165\u6846\u7684\u805A\u7126\u6001\u662F \`border-color\` + \`--tt-ring\`\uFF082px \u5916\u6269\uFF09\uFF0C
2619
+ * \u800C\u8FD9\u4E00\u7EC4\u662F \`overflow: hidden\` \u7684\u2014\u2014\u73AF\u88AB\u88C1\u6389\u5927\u534A\uFF0C\u53EA\u5269\u8F93\u5165\u6846\u4E24\u4FA7\u5404\u4E00\u6761\u7AD6\u7EBF\u3002\u7528\u6237\u622A\u56FE\u91CC
2620
+ * \u300C\u5192\u53F7\u5DE6\u8FB9 / \u53F3\u8FB9\u591A\u51FA\u6765\u4E00\u9053\u7EBF\u300D\u5C31\u662F\u5B83\uFF0C\u8BFB\u8D77\u6765\u50CF\u591A\u4E86\u4E00\u9053\u5206\u9694\u7EBF\u800C\u4E0D\u662F\u805A\u7126\u63D0\u793A\u3002
2621
+ * \u6539\u6210\u805A\u7126\u843D\u5728\u7EC4\u5185\u4EFB\u4E00\u683C\u65F6**\u6574\u7EC4\u4EAE**\uFF08\`box-shadow\` \u753B\u5728\u7EC4\u81EA\u5DF1\u8EAB\u4E0A\uFF0C\u4E0D\u4F1A\u88AB\u81EA\u5DF1\u7684 overflow \u88C1\uFF09\u3002
2622
+ */
2623
+ .tt_tunnelEndpoint .tt_cardInput:focus,
2624
+ .tt_tunnelEndpoint .tt_cardInput:focus-visible {
2625
+ box-shadow: none;
2626
+ }
2627
+ .tt_tunnelEndpoint:focus-within {
2628
+ border-color: var(--tt-accent);
2629
+ box-shadow: var(--tt-ring);
2630
+ }
2456
2631
  /* \u56FA\u5B9A\u7AEF\uFF08\u672C\u5730 127.0.0.1 \u76D1\u542C / \u62E8\u53F7\u5730\u5740\uFF09\u6E32\u67D3\u6210\u9759\u6001\u6587\u672C\u800C\u4E0D\u662F\u8F93\u5165\u6846\uFF1A
2457
2632
  \u5BBF\u4E3B\u628A\u8FD9\u4E00\u7AEF\u786C\u7F16\u7801\u4E86\uFF0C\u7ED9\u4E2A\u53EF\u7F16\u8F91\u7684\u6846\u662F\u9A97\u4EBA */
2458
2633
  .tt_tunnelEndpointStatic {
@@ -2473,7 +2648,9 @@ void main() {
2473
2648
  user-select: none;
2474
2649
  }
2475
2650
  .tt_tunnelEndpoint .tt_tunnelHost {
2476
- flex: 1 1 auto;
2651
+ /* \u4E3B\u673A\u540D\u7ED9\u8DB3\u4F4D\u7F6E\uFF1B\u7A84\u5BB9\u5668\u91CC\u53EF\u4EE5\u7F29\uFF08min-width \u515C\u4F4F\uFF0C\u522B\u7F29\u5230\u770B\u4E0D\u89C1\uFF09 */
2652
+ flex: 0 1 220px;
2653
+ min-width: 96px;
2477
2654
  }
2478
2655
  .tt_tunnelEndpoint .tt_tunnelPort {
2479
2656
  flex: 0 0 78px;
@@ -2633,23 +2810,25 @@ void main() {
2633
2810
  font-size: 12px;
2634
2811
  line-height: 18px;
2635
2812
  }
2636
- .tt_shellList {
2637
- margin-top: 6px;
2638
- }
2639
2813
  /*
2640
- * \u6A21\u578B\u8DEF\u7531\u7684\u5019\u9009\u8868\uFF1A**\u6D6E\u5C42**\uFF0C\u4E0D\u662F\u5185\u8054\u5217\u8868\u3002
2814
+ * \u5361\u7247\u91CC\u7684\u5019\u9009\u8868\uFF08\u6A21\u578B\u8DEF\u7531 / Shell \u8DEF\u5F84\uFF09\uFF1A**\u6D6E\u5C42**\uFF0C\u4E0D\u662F\u5185\u8054\u5217\u8868\u3002
2641
2815
  *
2642
- * \u5185\u8054\uFF08\`.tt_shellList\` \u90A3\u79CD\u505A\u6CD5\uFF09\u4F1A\u628A\u8BBE\u7F6E\u5361\u7247\u9876\u9AD8\u3001\u628A\u4E0B\u9762\u7684\u5B57\u6BB5\u6574\u6BB5\u63A8\u8D70\u2014\u2014\u7528\u6237\u5B9E\u6D4B\u539F\u8BDD
2643
- * \u300C\u4E0B\u62C9\u9009\u4F1A\u7834\u574F\u5E03\u5C40\u300D\u3002\u56FA\u5B9A\u5B9A\u4F4D + placePopover \u9010\u6B21\u5B9A\u4F4D\uFF0C\u4E0E\u300C+\u300D\u83DC\u5355\u3001\u7EC8\u7AEF\u90A3\u8FB9\u51E0\u4E2A\u6D6E\u5C42\u540C\u4E00\u5957\uFF1B
2644
- * \u5BBD\u5EA6\u7531 JS \u5BF9\u9F50\u8F93\u5165\u6846\uFF08\u89C1 client-src \u7684\u5B9A\u4F4D effect\uFF09\u3002
2816
+ * \u5185\u8054\u4F1A\u628A\u8BBE\u7F6E\u5361\u7247\u9876\u9AD8\u3001\u628A\u4E0B\u9762\u7684\u5B57\u6BB5\u6574\u6BB5\u63A8\u8D70\u2014\u2014\u7528\u6237\u4E24\u5904\u90FD\u5B9E\u6D4B\u8FC7\uFF1A\u6A21\u578B\u8DEF\u7531\u90A3\u6B21**\u9876\u52A8 134px**\uFF0C
2817
+ * Shell \u8DEF\u5F84\u90A3\u6B21\u662F\u622A\u56FE\u91CC\u8F93\u5165\u6846\u6B63\u4E0B\u65B9\u591A\u51FA\u4E00\u6574\u5757\uFF08\u300C\u8FD9\u4E2A\u9009\u62E9\u4F1A\u6324\u5360\u7A7A\u95F4\u7834\u574F\u5E03\u5C40\u300D\uFF09\u3002\u56FA\u5B9A\u5B9A\u4F4D +
2818
+ * placePopover \u9010\u6B21\u5B9A\u4F4D\uFF0C\u4E0E\u300C+\u300D\u83DC\u5355\u3001\u7EC8\u7AEF\u90A3\u8FB9\u51E0\u4E2A\u6D6E\u5C42\u540C\u4E00\u5957\uFF1B\u5BBD\u5EA6\u7531 JS \u5BF9\u9F50\u8F93\u5165\u6846
2819
+ * \uFF08\u89C1 client-src \u7684\u5B9A\u4F4D effect\uFF09\u3002
2645
2820
  */
2646
- .tt_routeList {
2821
+ .tt_routeList,
2822
+ .tt_shellList {
2647
2823
  position: fixed;
2648
2824
  z-index: 1400;
2649
2825
  max-width: min(560px, 92vw);
2650
- max-height: 260px;
2651
2826
  box-shadow: var(--tt-shadow);
2652
2827
  }
2828
+ /* \u6A21\u578B\u5019\u9009\u6309\u6E20\u9053\u5206\u7EC4\u3001\u884C\u6570\u591A\uFF08\u51E0\u5341\u6761\uFF09\uFF0C\u6BD4 Shell \u8DEF\u5F84\u591A\u7ED9\u4E00\u6863\u9AD8\u5EA6 */
2829
+ .tt_routeList {
2830
+ max-height: 260px;
2831
+ }
2653
2832
  /* \u6A21\u578B\u8DEF\u7531\u662F**\u53EA\u8BFB**\u7684\uFF08\u53EA\u80FD\u9009\uFF0C\u4E0D\u80FD\u6253\u5B57\uFF09\uFF1A\u624B\u578B + \u85CF\u5149\u6807\uFF0C\u522B\u8BA9\u5B83\u770B\u8D77\u6765\u50CF\u80FD\u8F93 */
2654
2833
  .tt_routeInput {
2655
2834
  cursor: pointer;
@@ -3483,8 +3662,8 @@ void main() {
3483
3662
  transition: none !important;
3484
3663
  }
3485
3664
  }
3486
- `;function eo(e){let t=typeof e=="string"?e.trim():"";if(t==="")return;let r=t,s="",o=r.lastIndexOf("@");o>0&&(s=r.slice(0,o).trim(),r=r.slice(o+1).trim());let i=r,n=22,a=/^\[([^\]]+)\](?::(\d+))?$/.exec(r)??/^([^:]+):(\d+)$/.exec(r);if(a!==null){i=a[1];let l=Number(a[2]);Number.isInteger(l)&&l>=1&&l<=65535&&(n=l)}if(i==="")return;let d={host:i,port:n};return s!==""&&(d.username=s),d}function to(e){if(e===null||typeof e!="object")return"";let t=e,r=typeof t.host=="string"?t.host.trim():"";if(r==="")return"";let s=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()+"@":"",i=r.includes(":")&&!r.startsWith("[")?`[${r}]`:r;return`${o}${i}${s===22?"":":"+String(s)}`}var ro="\0global";function Wr(e,t){return e===null?ro:typeof e=="string"&&e!==""?e:typeof t=="string"&&t!==""?t:ro}function so(e,t){return e===ro?!0:typeof t=="string"&&t!==""&&e===t}var Cp="/api/dsh-tty/ws";function oc(e,t){let r=new URL(t??e,e);return(r.protocol==="https:"?"wss:":"ws:")+"//"+r.host+Cp}function io(e){return String(e??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function ac(e,t,r,s){let o=io(r),i=io(e);if(o===""||i==="")return"";let n=io(t),a=["DSH_TTY",o,i];return n!==""&&n!=="22"&&a.push(n),a.push(s),a.join("_")}function gi(e){let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=65535?t:0}function lc(e,t,r){return`${e}-${t==="remote"?"R":"L"}${String(r)}`}function cc(e,t=[],r=s=>s){let s=e??{},o=String(s.bookName??"")||String(t[0]??"")||"";if(o==="")return{ok:!1,error:r("error.tunnelNoBook")};if(s.direction==="remote"){let d=gi(s.remotePort),l=gi(s.localTargetPort);return d<1||l<1?{ok:!1,error:r("error.tunnelRemotePortRequired")}:{ok:!0,tunnel:{name:lc(o,"remote",d),bookName:o,direction:"remote",remotePort:d,localTargetHost:"",localTargetPort:l,enabled:!0}}}let i=gi(s.localPort),n=String(s.remoteHost??"").trim(),a=gi(s.remotePort);return i<1||n===""||a<1?{ok:!1,error:r("error.tunnelLocalRequired")}:{ok:!0,tunnel:{name:lc(o,"local",i),bookName:o,direction:"local",localPort:i,remoteHost:n,remotePort:a,enabled:!0}}}function hc(e,t){return(Array.isArray(e)?e:[]).find(r=>String(r?.name??"")===String(t))}function xp(e,t,r){return(Array.isArray(e)?e:[]).find(s=>String(s?.name??"")!==String(t)&&String(s?.name??"")===String(r))}function dc(e,t,r,s){let o=Array.isArray(e)?e:[],i=o.find(d=>String(d?.name??"")===String(t));if(i===void 0)return{ok:!1,reason:"missing",error:s("error.tunnelMissing",{name:String(t)})};if(xp(o,t,r.name)!==void 0)return{ok:!1,reason:"clash",error:s("error.tunnelClash",{name:String(r.name)})};let a={...r,enabled:i.enabled!==!1};return{ok:!0,tunnels:o.map(d=>String(d?.name??"")===String(t)?a:d)}}function kp(e){let t=e?.byId;if(!(t===null||typeof t!="object"))for(let r of Object.keys(t)){let s=t[r]?.retainedBy?.mainView??0;if(typeof s=="number"&&s>0)return r}}function Ep(e){let t=e?.current;return typeof t=="string"&&t!==""?t:kp(e)}function uc(e){let t=Ep(e);if(t===void 0)return;let r=e?.byId?.[t]?.cwd;return typeof r=="string"&&r!==""?r:void 0}function Lp(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0}function fc(e,t){if(e==null)return;let r=Math.floor(Number(e.cols)),s=Math.floor(Number(e.rows));if(!(!Number.isFinite(r)||!Number.isFinite(s))&&!(r<20||s<3)&&!(t==null||!Lp(Number(t.width),Number(t.height))))return{cols:Math.min(500,r),rows:Math.min(200,s)}}function pc(e){return e!==null&&typeof e=="object"&&e.exited!==!0}function _c(e){if(!Array.isArray(e))return 0;let t=0;for(let r of e)pc(r)&&(t+=1);return t}function vi(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)pc(r)&&typeof r.sid=="string"&&r.sid!==""&&t.add(r.sid);return t}function mc(e){let t=Number(e?.received),r=Number(e?.attempt),s=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>s?{resume:!1,reason:"attemptsExhausted"}:o!==null&&Number.isFinite(o)&&o>0&&t>=o?{resume:!1,reason:"complete"}:{resume:!0,offset:t}}function Tp(e){return typeof e!="string"||e===""||e==="."||e===".."?!1:e.startsWith(".")}function bi(e,t){let s=(Array.isArray(e)?e:[]).filter(o=>o!==null&&typeof o=="object"&&typeof o.name=="string"&&o.name!=="");return t===!0?s:s.filter(o=>!Tp(o.name))}function gc(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 vc(e){let t=new Set;for(let r of Array.isArray(e)?e:[]){let s=typeof r?.relPath=="string"?r.relPath:"",o=s.lastIndexOf("/");o<=0||t.add(s.slice(0,o))}return[...t].sort((r,s)=>r.split("/").length-s.split("/").length||r.localeCompare(s))}function bc(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 wc(e,t){return typeof e!="string"||e===""?!0:e===t}function yc(e,t){return e===null?!1:e!==t}function Ze(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],r=e,s=-1;do r/=1024,s+=1;while(r>=1024&&s<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[s]}function gs(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],r=e,s=-1;do r/=1024,s+=1;while(r>=1024&&s<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[s]+"/s"}function Cc(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function Sc(e,t){return!Number.isFinite(e)||e<0?t("list.none"):e<1024?Math.round(e)+" B/s":gs(e)||t("list.none")}function Rp(e,t){if(!Number.isFinite(e)||e<0)return t("list.none");let r=Math.floor(e),s=Math.floor(r/604800),o=Math.floor(r%604800/86400),i=Math.floor(r%86400/3600),n=Math.floor(r%3600/60),a=[];return s>0&&a.push(s+"w"),(s>0||o>0)&&a.push(o+"d"),(s>0||o>0||i>0)&&a.push(i+"h"),(s>0||o>0||i>0||n>0)&&a.push(n+"m"),a.length>0?a.join(""):r+"s"}function Mp(e,t,r){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?r("list.none"):(Ze(e)||"0 B")+"/"+(Ze(t)||"0 B")}function xc(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 Ap=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function kc(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:Ap.some(t=>xc(e,t)!==null)}var Dp=8e3;function Ec(e,t=Date.now()){return t-(e||0)<=Dp}var Lc=23;function no(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:Lc}]}function Tc(e,t){let r=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{},s=i=>xc(r,i),o=(i,n,a,d=i.slot)=>({key:i.key,label:i.label,kind:i.kind,slot:d,pct:a??null,value:n,title:i.label+": "+n});return no(t).map(i=>{if(i.kind==="pct"){let a=s(i.key);return o(i,a===null?t("list.none"):Math.round(a)+"%",a)}if(i.kind==="pair")return o(i,Mp(s(i.used),s(i.total),t),null);if(i.kind==="uptime")return o(i,Rp(s(i.key),t),null);if(i.kind==="temp"){let a=s(i.key);return o(i,a===null?t("list.none"):a.toFixed(1)+"\xB0C",null)}if(i.kind==="net"){let a=s("rxRate"),d=s("txRate");return a===null&&d===null?o(i,t("list.none"),null,0):o(i,"\u2193"+Sc(a,t)+" \u2191"+Sc(d,t),null,Lc)}let n=s(i.key);return o(i,n===null?t("list.none"):String(n),null)})}var oo="tty",Ri={"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.clickReopen":"\u70B9\u51FB\u91CD\u65B0\u6253\u5F00","btn.clickRerun":"\u70B9\u51FB\u91CD\u65B0\u6267\u884C","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","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\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\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","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\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","error.pasteFailed":"\u6D4F\u89C8\u5668\u4E0D\u5141\u8BB8\u7F51\u9875\u8BFB\u53D6\u526A\u8D34\u677F\uFF08http \u8BBF\u95EE\u65F6\u5E38\u89C1\uFF09\uFF1A\u8BF7\u5728\u7EC8\u7AEF\u91CC\u6309 Ctrl+V / Cmd+V \u7C98\u8D34","status.initializing":"\u521D\u59CB\u5316\u2026","placeholder.search":"\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)","btn.searchTitle":"\u641C\u7D22 (Ctrl+F)","btn.clearTitle":"\u6E05\u5C4F","btn.copyTitle":"\u590D\u5236\u9009\u4E2D\u5185\u5BB9","btn.pasteTitle":"\u7C98\u8D34","btn.minimizeTitle":"\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09","btn.closePanelTitle":"\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09","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"},Op={"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.clickReopen":"Click to reopen","btn.clickRerun":"Click to run again","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","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. 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 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","check.agentForward":"agent forwarding (the remote side can use local ssh-agent keys, e.g. remote git clone)","hint.hostKeyAlias":"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)","error.pasteFailed":"The browser does not allow pages to read the clipboard (common over http): paste with Ctrl+V / Cmd+V inside the terminal","status.initializing":"Initializing\u2026","placeholder.search":"Search (Enter next, Shift+Enter previous)","btn.searchTitle":"Search (Ctrl+F)","btn.clearTitle":"Clear","btn.copyTitle":"Copy selection","btn.pasteTitle":"Paste","btn.minimizeTitle":"Minimize (sessions keep running; the status moves into the sidebar entry)","btn.closePanelTitle":"Close the panel (ends sessions; tabs are kept and the list comes back on reopen)","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 Ip(e,t){return t===void 0?e:String(e).replace(/\{(\w+)\}/g,(r,s)=>t[s]===void 0?"":String(t[s]))}function Hc(e,t){return Ip(Ri[e]!==void 0?Ri[e]:e,t)}var w=Hc;function Np(e){e.inject(["locale"],t=>{let r=t.locale.register(oo,"zh",Ri),s=t.locale.register(oo,"en",Op);return w=t.locale.bind(oo),()=>{s(),r(),w=Hc}})}function Hp(){return oc(document.baseURI,globalThis.__DSH_TRANSPORT__?.streamBaseUrl)}function Zr(){return Ot!==null&&typeof Ot.describe=="function"?Ot:null}function $r(e){let t=String(e??"").trim();return t.startsWith("env:")?t.slice(4).trim():""}function Fp(){let e=new Set;for(let t of Gt)for(let r of[t?.password,t?.passphrase]){let s=$r(r);s!==""&&e.add(s)}return[...e]}async function Wp(){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 Fc(){return[...new Set([...Fp(),...await Wp()])].sort()}async function Wc(e){let t=Zr();if(t===null)return{error:w(Ot===null?"error.credServiceMissing":"error.credServiceIncomplete")};try{let r=await t.describe([e]),s=r?.ok===!0?r.value?.[e]:void 0;return s===void 0?{unreported:!0}:{view:{configured:s.configured===!0,writable:s.writable===!0,source:typeof s.source=="string"?s.source:""}}}catch(r){return{error:r instanceof Error?r.message:String(r)}}}async function Up(e,t){let r=Zr();if(r===null||typeof r.set!="function")return{error:w("error.credStoreUnavailable")};try{return await r.set(e,t),{value:"env:"+e}}catch(s){return{error:w("error.credStoreFailed",{error:s instanceof Error?s.message:String(s)})}}}async function Uc(e){let t=Zr();if(t===null||typeof t.unset!="function")return{error:w("error.credClearUnavailable")};try{return await t.unset(e),{}}catch(r){return{error:w("error.credClearFailed",{error:r instanceof Error?r.message:String(r)})}}}async function zc(e,t,r,s,o,i){if(e!==!0)return{};let n=String(t??"").trim();if(n===""||n.startsWith("env:"))return{};let a=ac(r,s,o,i);return a===""?{error:w("error.credRefNeedsHost")}:Up(a,n)}function Ki(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var wi;function Is(){document.getElementById("dsh-tty-style")||(wi=document.createElement("style"),wi.id="dsh-tty-style",wi.textContent=nc+`
3487
- `+ic,document.head.appendChild(wi))}var Gi='<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>',zp='<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>',jp='<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>',$p='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="8" rx="1.4"/><path d="M3.5 10.5h-1v-8h8v1"/></svg>',qp='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3" width="9" height="11" rx="1.4"/><rect x="5.5" y="1.5" width="5" height="3" rx="1" class="tt_iconPasteHole"/></svg>',Kp='<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>',Gp='<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>',jc='<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>',$c='<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>',Vp='<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>',Vi='<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>',Yi='<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>',Yp='<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>',Rs='<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>',qc='<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>',Kc='<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>',Ao='<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>',Gc='<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>',Xp='<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>',Do='<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>',qr='<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>',Po='<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>',Vc='<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>',Yc='<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>',Xc='<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>',Jp='<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>',Zp='<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>',Qp='<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>',e_='<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>',Jc='<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>',t_='<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>',Zc='<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>',Qc=null,Ae=null,ue=null,Mi=null,Ms=null,Ot=null,mr=null,yr=null,Re=null,Bt=null,ws=null,ys=null,Ai=null,_t=null,Ss=null,lt=null,mt=null,st=null,Kr=null,As=!1,Cs=null,Ve=!1,Qe=null,Di=null,Qr=null,Sr=null,Pi=null,gr=null,xs=1e3,Bi="dsh-tty:tabs",fe=new Map,Ns=new Set,Bo=()=>Ns.size>0,uo=new Set,ke=null,Hs=0,yi=!1,gt=null,Oi=!1,cr=new Map,vr=null,Cr=null,Gr=null,ir=null,Ii=null,ct=null,Vr=null,Gt=[],Ni=!0,St=null,Ct=null,ks=null,bs=null,fo=null,po=new Set;function Xi(e){return po.add(e),()=>po.delete(e)}Xi(({tab:e,addAction:t})=>{wr&&e.exited&&t(Kp,w("btn.reopen"),w("btn.reopenTitle"),()=>Fi(e.sid))});Xi(({tab:e,addAction:t})=>{wr&&t(Gp,"SFTP",w("btn.sftpTitle"),()=>Qi(e.spawnSpec,e.sid))});Xi(({bookName:e,addAction:t})=>{if(!wr)return;let r=e!==""?bh(e):0;if(r>0){t(jc,w("btn.tunnels",{count:r}),w("btn.tunnelsTitle"),s=>uh(s.currentTarget,e));return}e!==""&&t($c,w("btn.more"),w("btn.moreTitle"),s=>A_(s.currentTarget,e))});function Fs(e,t){if(mr===null)return;mr.textContent=e.split("\u2014\u2014")[0],mr.title=e,yr.dataset.state=t,Mi!==null&&(Mi.style.display=t==="connected"?"none":""),Qr!==null&&(Qr.textContent=e),Sr!==null&&(Sr.dataset.state=t);let r=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");r!==null&&(r.dataset.state=t)}function ao(e,t,r){let s=typeof e=="string"&&e!==""?e:null;if(s!==null){let o=fe.get(s);o!==void 0&&(o.statusText=t,o.statusState=r)}wc(s,ke)&&(Ms=s,Fs(t,r))}function Si(e,t){Ms=null,Fs(e,t)}function Oo(){if(!yc(Ms,ke))return;let e=ke===null?void 0:fe.get(ke);Ms=e===void 0?null:ke;let t=bc(e,w);Fs(t.text,t.state)}function Pe(e){Ae!==null&&Ae.readyState===WebSocket.OPEN&&Ae.send(JSON.stringify(e))}function r_(){let e=[],t=document.createDocumentFragment();for(let r of no(w)){let s=document.createElement("span");s.className="tt_statsItem";let o=document.createElement("span");o.className="tt_statsLabel",o.textContent=r.label,s.appendChild(o);let i=null,n=null;r.kind==="pct"&&(i=document.createElement("span"),i.className="tt_statsMeter",n=document.createElement("span"),n.className="tt_statsMeterFill",i.appendChild(n),s.appendChild(i));let a=document.createElement("span");a.className="tt_statsValue",s.appendChild(a),t.appendChild(s),e.push({item:s,value:a,meter:i,fill:n,slot:null})}return St!==null&&St.appendChild(t),e}function s_(e,t){let r=Tc(t!==void 0?t.stats:null,w);for(let s=0;s<e.length;s+=1){let o=e[s],i=r[s];if(i!==void 0&&(o.slot!==i.slot&&(o.slot=i.slot,o.value.style.minWidth=i.slot>0?i.slot+"ch":""),o.value.textContent!==i.value&&(o.value.textContent=i.value),o.item.getAttribute("title")!==i.title&&o.item.setAttribute("title",i.title),o.fill!==null&&o.meter!==null)){let n=i.pct===null?"0%":Math.max(0,Math.min(100,i.pct)).toFixed(1)+"%";o.fill.style.width!==n&&(o.fill.style.width=n);let a=Cc(i.pct);o.meter.dataset.level!==a&&(o.meter.dataset.level=a)}}}function Ji(){bs=null,fo=null}function i_(){if(ue===null||Ve||!Ni)return!1;let e=vt();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:Ec(e.statsAt)}function Rc(){if(Ve)return;let e=vt();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&rs(e)}catch{}}}function xr(){try{n_()}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{St!==null&&(St.hidden=!0,St.textContent=""),Ji(),lt!==null&&delete lt.dataset.stats}catch{}}}function n_(){if(lt===null||St===null)return;let e=i_(),t=lt.dataset.stats!==void 0!==e;if(!e){t&&delete lt.dataset.stats,St.hidden=!0,bs!==null&&(St.textContent="",Ji()),t&&Rc();return}St.hidden=!1,bs===null&&(bs=r_());let r=vt(),s=r===void 0?"":r.sid+":"+String(r.statsAt||0);s!==fo&&(fo=s,s_(bs,r)),t&&(lt.dataset.stats="",Rc())}function eh(){ks===null&&(ks=setInterval(()=>xr(),1e3))}function th(){ks!==null&&(clearInterval(ks),ks=null)}function rh(){if(ue===null||Ve||!Ni)return null;let e=vt();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function Ws(){let e=rh();e!==Ct&&(Ct!==null&&Pe({t:"statsOff",sid:Ct}),Ct=e,e!==null&&Pe({t:"statsOn",sid:e}))}function o_(e){if(e!==rh()){Ws();return}Ct!==null&&Ct!==e&&Pe({t:"statsOff",sid:Ct}),Ct=e,Pe({t:"statsOn",sid:e})}function vt(){return ke!==null?fe.get(ke):void 0}function _o(){try{return uc(Qc?.list?.getSnapshot?.())}catch{return}}function a_(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Pe({t:"refresh",sid:e.sid})}}var Ci=null;function sh(e){Ci!==null&&clearTimeout(Ci),Ci=setTimeout(()=>{Ci=null;let t=vt();t!==void 0&&a_(t)},e??200)}var l_=["password","passphrase"];function Mc(e){if(e===null||typeof e!="object"||e.t!=="ssh")return e;let t=e.credsStripped===!0,r={...e};for(let s of l_){let o=r[s];typeof o=="string"&&o!==""&&!o.startsWith("env:")&&(delete r[s],t=!0)}return t&&(r.credsStripped=!0),r}var ih=1;function lr(){try{let e=[...fe.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:Mc(t.spawnSpec),label:t.label}));e.length===0||ue===null?sessionStorage.removeItem(Bi):sessionStorage.setItem(Bi,JSON.stringify({v:ih,tabs:e})),c_([...fe.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:Mc(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 mo="dsh-tty:persist-specs";function c_(e){try{let t=e.filter(r=>zs(r.spawnSpec)).map(r=>({spawnSpec:r.spawnSpec,label:r.label}));t.length===0?localStorage.removeItem(mo):localStorage.setItem(mo,JSON.stringify(t))}catch{}}function h_(){try{let e=localStorage.getItem(mo);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&zs(r.spawnSpec)):[]}catch{return[]}}function d_(){try{let e=sessionStorage.getItem(Bi);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):t!==null&&typeof t=="object"&&t.v===ih&&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 Hi(e,t){let r=Ae;return new Promise(s=>{let o=null,i=n=>{let a;try{a=JSON.parse(n.data)}catch{return}a.t===e&&(o!==null&&clearTimeout(o),r.removeEventListener("message",i),s(r===Ae?a:null))};o=setTimeout(()=>{r.removeEventListener("message",i),s(null)},t),r.addEventListener("message",i)})}function u_(e){return e===void 0?null:e.embedded===!0?e.controller!==void 0&&e.controller!==null?e.controller.hostEl:null:e.termEl}function nh(e){if(e===void 0||e.fit===null||e.fit===void 0)return;let t;try{t=e.fit.proposeDimensions()}catch{return}let r=u_(e);return fc(t,r==null?null:{width:r.clientWidth,height:r.clientHeight})}function rs(e){if(e===void 0||e.fit===void 0)return;let t=nh(e);t!==void 0&&(e.lastDims=t,Pe({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows}))}function f_(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,s=r==null?null:{atBottom:r.viewportY>=r.baseY,line:r.viewportY};try{e.fit.fit()}catch{return}if(s!==null)try{s.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(s.line,t.buffer.active.baseY))}catch{}e.exited||rs(e)}function Ur(e,t,r,s){if(e.overlayEl===null||e.overlayEl===void 0)return;let o=e.overlayEl;if(t===""||t===void 0){o.textContent="";return}let i=s==="error"||s==="info"?s:"exited";o.innerHTML='<div class="tt_overlayCard" data-kind="'+i+'"><span class="tt_overlayIcon">'+(i==="error"?Jc:i==="info"?Po:t_)+'</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 Te(e,t=""){try{let r=getComputedStyle(document.body).getPropertyValue(e).trim();return r!==""?r:t}catch{return t}}function ss(e){let t=Te("--tt-accent"),r={};r.background=Te("--tt-term-bg"),r.foreground=Te("--tt-term-fg"),r.cursor=t,r.cursorAccent=Te("--tt-term-cursor-accent"),r.selectionBackground=Te("--tt-term-selection"),r.black=Te("--tt-an-black"),r.red=Te("--tt-an-red"),r.green=Te("--tt-an-green"),r.yellow=Te("--tt-an-yellow"),r.blue=Te("--tt-an-blue"),r.magenta=Te("--tt-an-magenta"),r.cyan=Te("--tt-an-cyan"),r.white=Te("--tt-an-white"),r.brightBlack=Te("--tt-an-bright-black"),r.brightRed=Te("--tt-an-bright-red"),r.brightGreen=Te("--tt-an-bright-green"),r.brightYellow=Te("--tt-an-bright-yellow"),r.brightBlue=Te("--tt-an-bright-blue"),r.brightMagenta=Te("--tt-an-bright-magenta"),r.brightCyan=Te("--tt-an-bright-cyan"),r.brightWhite=Te("--tt-an-bright-white");let s=new Ic.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 Nc.FitAddon,i=new Ba;s.loadAddon(o),s.loadAddon(i),s.loadAddon(new Oa);let n=document.createElement("div");n.className="tt_term";let a=document.createElement("div");a.className="tt_overlay",a.addEventListener("click",()=>{a.textContent="",Fi(e.sid)}),a.setAttribute("role","button"),a.setAttribute("aria-label",w("btn.reopenSession")),a.tabIndex=0,a.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" "||d.key==="Spacebar")&&(d.preventDefault(),a.textContent="",Fi(e.sid))}),n.appendChild(a),s.open(n);try{o.fit()}catch{}try{let d=new sc;d.onContextLoss(()=>{try{d.dispose()}catch{}}),s.loadAddon(d)}catch{}s.onData(d=>{Pe({t:"input",sid:e.sid,d}),cr.delete(e.sid)&&kr()}),s.onResize(()=>{zs(e.spawnSpec)&&sh(200)}),s.attachCustomKeyEventHandler(d=>e.embedded===!0?!0:(d.ctrlKey||d.metaKey)&&d.key.toLowerCase()==="f"?(d.preventDefault(),Bh(),!1):!0),e.term=s,e.fit=o,e.search=i,e.termEl=n,e.overlayEl=a}function Ac(e){return e===null||typeof e!="object"?"":["t","name","host","port","username","command","cwd","persist","persistName"].map(r=>r+"="+String(e[r]??"")).join("\0")}function p_(e){let t=Ac(e);if(t==="")return null;for(let r of fe.values())if(r.exited!==!0&&r.embedded!==!0&&Ac(r.spawnSpec)===t)return r;return null}function Ds(e,t){let r=Ki(),s={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??om(),label:t};return ss(s),fe.set(r,s),Hs+=1,ht(),Yt(r),Zi(s),lr(),s}function __(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===""||fe.has(r))continue;let s={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:_o()},label:"agent"+(t.kind==="ssh"&&typeof t.target=="string"&&t.target!==""?" \xB7 "+t.target:"")};ss(s),fe.set(r,s),Hs+=1,ht(),m_()&&s.termEl!==null&&lt!==null&&ke===null&&Yt(r),Pe({t:"attach",sid:r}),g_()}}function m_(){return ue!==null&&Ve!==!0}function g_(){try{lr()}catch{}}function v_(e){if(__(e),!Array.isArray(e))return;let t=vi(e.filter(r=>r!==null&&typeof r=="object"&&r.owner==="agent"));for(let[r,s]of[...fe])s.agentOwned===!0&&(t.has(r)||s.exited!==!0&&s.live===!0&&(s.exited=!0,s.live=!1,ht()))}function b_(e){if(fe.has(e.sid))return fe.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};ss(t),fe.set(t.sid,t),Hs+=1,ht(),Yt(t.sid),Pe({t:"attach",sid:t.sid})}function w_(e){if(!(e?.spawnSpec?.credsStripped!==!0||e.term===null))try{e.term.writeln("\x1B[2m[dsh-tty] "+w("msg.passwordNotStored")+"\x1B[0m")}catch{}}function Zi(e){w_(e);let t=nh(e);t!==void 0&&(e.lastDims=t);let r=t!==void 0?t:e.lastDims!==void 0?e.lastDims:{cols:80,rows:24},s={...e.spawnSpec,sid:e.sid,cols:r.cols,rows:r.rows};if(Ae===null||Ae.readyState!==WebSocket.OPEN){uo.add({tab:e,frame:s});return}Pe(s)}function Dc(e){let t={sid:Ki(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};ss(t),fe.set(t.sid,t),Hs+=1,ht(),Yt(t.sid),Zi(t)}function Fi(e){let t=fe.get(e);if(t===void 0)return;if(t.embedded===!0){ch(t);return}let r=t.spawnSpec,s=t.label;if(Pe({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),fe.delete(e);let o={sid:Ki(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:r,label:s};ss(o),fe.set(o.sid,o),ht(),Yt(o.sid),Zi(o),lr()}function go(e){let t=fe.get(e);if(t!==void 0){if(xt!==null&&xt.ownerKey===e&&Ls(!0),Pe({t:"kill",sid:e}),fe.delete(e),Cr===e&&kt(),cr.delete(e),kr(),Ns.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),ke===e){ke=null;let r=[...fe.entries()].filter(([,s])=>s.embedded!==!0).map(([s])=>s).pop()??null;r!==null&&Yt(r)}ht(),Oo(),[...fe.values()].some(r=>r.embedded!==!0)?lr():Os()}}function oh(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error(w("error.terminalNeedsCommand"));if(/[\r\n\0]/.test(t))throw new Error(w("error.terminalCommandSingleLine"));return t}function ah(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 y_(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&&rs(e)}}),t.observer.observe(t.hostEl))}function lh(e,t,r){let s={sid:Ki(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:r};return ss(s),fe.set(s.sid,s),Ns.add(s.sid),e.hostEl.appendChild(s.termEl),y_(s),Zi(s),s}function ch(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||Pe({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),fe.delete(e.sid),Ns.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=lh(t,e.spawnSpec,e.label),ke===e.sid&&(ke=t.tab.sid,Oo()),t.tab}}function S_(e,t){if(!(e instanceof HTMLElement))throw new Error(w("error.terminalNeedsHost"));let r=oh(t),s=ah(t,r),o=typeof t?.label=="string"&&t.label!==""?t.label:void 0;Is();let i={hostEl:e,tab:null,observer:null,disposed:!1};return i.tab=lh(i,s,o),lm(),()=>C_(i)}function C_(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||Pe({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),fe.delete(t.sid),Ns.delete(t.sid),e.tab=null}if(ue===null&&!Bo()&&Ae!==null){As=!0;try{Ae.close()}catch{}Ae=null}}var x_=460,k_=280,E_=320,L_=160,xt=null,zr=x_,jr=E_;function Io(){let e=ue!==null?ue.querySelector(".tt_modal"):null,t=e!==null?e:ue;return t!==null?t.getBoundingClientRect():null}var No=e=>e==="bottom"?L_:k_;function T_(e){let t=Io();if(t===null)return 900;let r=e==="bottom"?t.height:t.width;return Math.max(No(e),Math.round(r*.72))}function Es(e,t){return Math.min(T_(e),Math.max(No(e),Math.round(t)))}function ki(){let e=xt;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){jr=Es("bottom",jr),e.el.style.width="",e.el.style.height=String(jr)+"px",e.el.style.flexBasis=String(jr)+"px";return}zr=Es("right",zr),e.el.style.height="",e.el.style.width=String(zr)+"px",e.el.style.flexBasis=String(zr)+"px"}}function Ls(e){let t=xt;if(t!==null){if(xt=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{}mt!==null&&delete mt.dataset.side}}function hh(e){if(To(),mt===null)throw new Error(w("error.panelNotReady"));xt!==null&&Ls(!0),Is();let t=Wr(e?.ownerSid,ke),r=e?.side==="bottom"?"bottom":"right",s=Math.max(r==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:No(r)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let c=Es(r,e.size);r==="bottom"?jr=c:zr=c}let o=document.createElement("div");o.className="tt_dockPane",o.dataset.side=r,mt.dataset.side=r,o.innerHTML='<div class="tt_dockPaneResize" title="'+w(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="'+w("btn.closePane")+'">'+Vi+'</button></div><div class="tt_dockPaneBody"></div>',mt.appendChild(o);let i=o.querySelector(".tt_dockPaneTitle"),n=o.querySelector(".tt_dockPaneHint"),a=o.querySelector(".tt_dockPaneBody"),d=o.querySelector(".tt_dockPaneFold"),l=o.querySelector(".tt_dockPaneClose"),_=o.querySelector(".tt_dockPaneResize"),m={el:o,element:a,disposed:!1,collapsed:!1,side:r,minSize:s,ownerKey:t,onClose:typeof e?.onClose=="function"?e.onClose:null},y=()=>r==="bottom"?m.collapsed?Ao:Jp:m.collapsed?Xc:Yc,p=c=>{m.collapsed=c===!0,m.collapsed?o.dataset.collapsed="1":delete o.dataset.collapsed,d.innerHTML=y(),d.title=m.collapsed?w("btn.expandPane"):w("btn.collapsePane"),d.setAttribute("aria-label",d.title),ki()};return m.setTitle=c=>{i.textContent=typeof c=="string"?c:""},m.setHint=c=>{n.textContent=typeof c=="string"?c:""},m.isCollapsed=()=>m.collapsed===!0,m.collapse=()=>p(!0),m.expand=()=>p(!1),m.toggle=()=>p(!m.collapsed),m.dispose=()=>{m.disposed||xt!==m||Ls(!1)},_.addEventListener("mousedown",c=>{if(c.button!==0||m.collapsed)return;c.preventDefault();let u=c.clientX,h=c.clientY,f=o.getBoundingClientRect(),v=g=>{r==="bottom"?jr=Es("bottom",Math.max(s,f.height+(h-g.clientY))):zr=Es("right",Math.max(s,f.width+(u-g.clientX))),ki()},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)}),_.addEventListener("dblclick",()=>p(!m.collapsed)),d.addEventListener("click",()=>p(!m.collapsed)),l.addEventListener("click",()=>Ls(!0)),m.setTitle(typeof e?.title=="string"?e.title:""),m.setHint(typeof e?.hint=="string"?e.hint:""),p(e?.collapsed===!0),xt=m,ki(),dh(),m}function dh(){let e=xt;if(e!==null){if(so(e.ownerKey,ke)){delete e.el.dataset.dockHidden,mt!==null&&(mt.dataset.side=e.side);return}e.el.dataset.dockHidden="1",mt!==null&&delete mt.dataset.side}}function Yt(e){let t=fe.get(e);if(t!==void 0&&t.embedded!==!0){ke=e,kt(),kr();for(let[r,s]of fe)s.embedded!==!0&&s.termEl!==null&&(s.termEl.style.display=r===e?"":"none");t.embedded!==!0&&lt!==null&&t.termEl!==null&&t.termEl.parentElement!==lt&&lt.appendChild(t.termEl),Ws(),xr(),ht(),br(),dh();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&rs(t),Ur(t,t.exited?w("status.exited"):"",t.exited?w("btn.clickReopen"):"","exited"),Oo()}}function lo(e){if(Re===null)return;let t=fe.get(e);if(t===void 0)return;let s=Re.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");if(s==null)return;s.dataset.state=Wi(t);let o=ct===null?null:ct.querySelector('[data-sid="'+e+'"] .tt_tabDot');o!==null&&(o.dataset.state=Wi(t))}var co=!1;function ht(){if(Re===null)return;if(Re.querySelector(".tt_tabRename")!==null){co||(co=!0,setTimeout(()=>{co=!1,ht()},1e3));return}Re.textContent="";for(let[t,r]of fe){if(r.embedded===!0)continue;let s=document.createElement("button");s.className="tt_tab",s.dataset.sid=t,t===ke&&(s.dataset.active="");let o=document.createElement("span");o.className="tt_tabDot",o.dataset.state=Wi(r),s.appendChild(o);let i=document.createElement("span");i.className="tt_tabLabel",i.textContent=r.label||w("panel.tabLabel",{n:Ho(t)}),i.addEventListener("dblclick",a=>{a.stopPropagation(),D_(t,s)});let n=document.createElement("span");n.className="tt_tabClose",n.title=w("btn.close"),n.innerHTML=Yi,n.setAttribute("role","button"),n.setAttribute("aria-label",w("btn.closeTabAria",{label:r.label||""})),n.tabIndex=0,n.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" "||a.key==="Spacebar")&&(a.preventDefault(),a.stopPropagation(),go(t))}),s.title=i.textContent,s.appendChild(i),s.appendChild(n),s.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),go(t);return}Yt(t)}),Re.appendChild(s)}let e=Re.querySelector("[data-active]");e!==null&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest",inline:"nearest"}),vo(),ct!==null&&fe.size===0&&Xt()}function vo(){if(Re===null)return;let e=Re.scrollWidth-Re.clientWidth,t=e>1;if(Bt!==null&&(Bt.hidden=!t,t?Bt.title=w("btn.tabListTitle",{n:fe.size}):ct!==null&&Xt()),!t){delete Re.dataset.edge;return}let r=Re.scrollLeft>1,s=Re.scrollLeft<e-1;Re.dataset.edge=r&&s?"both":s?"end":"start",ct!==null&&Ch()}function Wi(e){return e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting"}function R_(e){if(Re===null||Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let t=Re.scrollWidth-Re.clientWidth;if(t<=1)return;let r=Math.max(0,Math.min(t,Re.scrollLeft+e.deltaY));r!==Re.scrollLeft&&(e.preventDefault(),Re.scrollLeft=r)}function M_(e){return e?.direction==="remote"?w("meta.tunnelRemote",{host:e.remoteHost||"127.0.0.1",port:String(e.remotePort??0),local:String(e.localTargetPort??0)}):w("meta.tunnelLocal",{local:String(e?.localPort??0),host:e?.remoteHost??"?",port:String(e?.remotePort??0)})}function br(){if(ws===null||Ai===null||Ss===null||ys===null)return;Ss.textContent="";let e=vt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){ws.dataset.hidden="";return}delete ws.dataset.hidden;let r=Number(t.port);Ai.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:""),_t!==null&&(e.persistTmux===!0?(_t.textContent="tmux",_t.dataset.state="ok",_t.title=w("status.tmuxPersistedTitle")):t.persist===!0&&e.spawned===!0?(_t.textContent=w("status.notPersisted"),_t.dataset.state="warn",_t.title=w("status.tmuxUnavailableTitle")):(_t.textContent="",delete _t.dataset.state,_t.removeAttribute("title")));let s=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";ys.dataset.state=s,ys.title=w(s==="connected"?"status.connected":s==="connecting"?"status.connecting":s==="error"?"status.errored":"status.exited");let o=(n,a,d,l)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=d,_.innerHTML=n+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",l),Ss.appendChild(_)};if(typeof t.command=="string"&&t.command!=="")return;let i=typeof t.name=="string"?t.name:"";for(let n of po)try{n({tab:e,spec:t,bookName:i,addAction:o})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}function A_(e,t){if(Yr!==null){Ei();return}let r=document.createElement("div");r.className="tt_addMenu tt_connMore",Yr=r,ko(r,w("panel.tunnels"),w("hint.tunnelsSettings"),()=>{Ei(),uh(e,t)},void 0,jc),document.body.appendChild(r);let s=e.getBoundingClientRect(),o=r.offsetWidth,n=s.left+o>window.innerWidth-8?s.right-o:s.left;r.style.left=Math.max(8,Math.min(n,window.innerWidth-o-8))+"px",r.style.top=s.bottom+6+"px";let a=d=>{Yr===r&&(r.contains(d.target)||e.contains(d.target)||Ei())};Ti=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0)}function Ei(){Ti!==null&&(document.removeEventListener("mousedown",Ti,!0),Ti=null),Yr!==null&&(Yr.remove(),Yr=null)}var pr=null,Li=null,Yr=null,Ti=null;function Ui(){Li!==null&&(document.removeEventListener("mousedown",Li,!0),Li=null),pr!==null&&(pr.remove(),pr=null)}function uh(e,t){if(pr!==null){Ui();return}let r=document.createElement("div");r.className="tt_tunnelPop";let s=document.createElement("div");s.className="tt_tunnelPopTitle",s.textContent=w("panel.tunnelsFor",{name:t}),r.appendChild(s);let o=document.createElement("div");o.textContent=w("list.loading"),r.appendChild(o);let i=document.createElement("span");i.className="tt_cardHint",i.textContent=w("hint.tunnelsCard"),r.appendChild(i),document.body.appendChild(r),pr=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=d=>{pr===r&&(r.contains(d.target)||e.contains(d.target)||Ui())};Li=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let d=[];try{let m=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();m.ok&&Array.isArray(m.tunnels)&&(d=m.tunnels)}catch{}if(pr!==r)return;o.textContent="";let l=Fo.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(l.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent=w("list.noActiveTunnels"),o.appendChild(_);return}for(let _ of l){let m=d.find(h=>h?.name===_?.name),y=m?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=y==="active"?"connected":y==="error"?"error":"connecting";let u=document.createElement("span");u.className="tt_connTarget",u.title=String(m?.error??m?.lastForwardError??""),u.textContent=M_(_)+" \xB7 "+y+(m?.fatal===!0?w("status.fatalSuffix"):""),p.appendChild(c),p.appendChild(u),o.appendChild(p)}})()}function Ho(e){let t=1;for(let r of fe.keys()){if(r===e)return String(t);t+=1}return String(t)}function D_(e,t){let r=fe.get(e);if(r===void 0||t.querySelector(".tt_tabRename")!==null)return;let s=t.querySelector(".tt_tabLabel");if(s===null)return;let o=document.createElement("input");o.className="tt_tabRename",o.value=r.label||w("panel.tabLabel",{n:Ho(e)}),s.replaceWith(o),o.focus(),o.select();let i=!1,n=()=>{if(i)return;i=!0;let d=o.value.trim();r.label=d!==""?d:void 0,ht(),lr()},a=()=>{i||(i=!0,ht())};o.addEventListener("keydown",d=>{d.stopPropagation(),d.key==="Enter"?n():d.key==="Escape"&&a()}),o.addEventListener("blur",n),o.addEventListener("click",d=>d.stopPropagation())}var Fo=[],fh="dialog",ar="off",Kt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},ph="dsh-tty:show-hidden",_r=(()=>{try{return localStorage.getItem(ph)==="1"}catch{return!1}})();function P_(e){_r=e===!0;try{localStorage.setItem(ph,_r?"1":"0")}catch{}for(let t of bo)try{t(_r)}catch{}}var bo=new Set,wo=null,Xr=null,_h=!1,mh=!1,or=null,zi=null,wr=!1;function gh(e){wr=e,zi!==null&&zi.set(e)}function B_(e){gh(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==Ni&&(Ni=e.statsEnabled,Ws(),xr())}function Ps(e){B_(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(Gt=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(Fo=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(fh=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(ar=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(Kt={...Kt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(Xr=e.maxSessions),e!==null&&typeof e=="object"&&typeof e.allowProxyCommand=="boolean"&&(_h=e.allowProxyCommand),e!==null&&typeof e=="object"&&typeof e.assistEnabled=="boolean"&&(Oi=e.assistEnabled,Oi||kt(),kr()),e!==null&&typeof e=="object"&&typeof e.allowProxyCommandGranted=="boolean"&&(mh=e.allowProxyCommandGranted)}function O_(e,t){let r=t==="error"||t==="info"?t:"warn",s=document.createElement("div");s.className="tt_toast",s.dataset.kind=r,s.innerHTML='<span class="tt_toastIcon">'+(r==="error"?Jc:r==="info"?e_:Qp)+'</span><span class="tt_toastText"></span>',s.lastElementChild.textContent=e,document.body.appendChild(s),setTimeout(()=>s.remove(),4e3)}async function vh(){try{Pe({t:"sessions"});let e=await Hi("sessions",3e3);if(e!==null&&Array.isArray(e.list))return or=_c(e.list),or}catch{}return null}async function ji(){if(await vh(),Xr===null||or===null||or<Xr)return null;let e=[...fe.values()].filter(o=>!o.exited).length,t=Math.max(0,or-e),r=t>0?w("msg.maxSessionsOthers",{count:t}):"",s=w("msg.maxSessions",{live:or,max:Xr,own:e,others:r});return O_(s),s}function I_(){return Xr!==null&&or!==null&&or>=Xr}function Wo(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function bh(e){return Fo.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function yo(e){let t=Number(e?.port),r=Number.isInteger(t)&&t!==22?":"+t:"",s=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",o=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+r+" \xB7 "+s+o}async function So(e,t){let r=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),s=await r.json().catch(()=>({}));return s&&s.ok===!1&&s.error?{error:String(s.error)}:s&&s.result?{result:s.result}:{error:String(s&&s.error?s.error:w("error.probeHttp",{status:r.status}))}}function Co(e,t){if(!e)return w("msg.probing");let r=e,s=typeof r.tcp?.ms=="number"?r.tcp.ms:null,o=typeof r.auth?.ms=="number"?r.auth.ms:null,i=[];if(r.jump!==null&&typeof r.jump=="object"&&typeof r.jump.label=="string"&&r.jump.label!==""){let _=typeof r.jump.tcp?.ms=="number"?r.jump.tcp.ms:null,m=r.jump.tcp?.ok?_!==null?_+"ms":w("meta.reachable"):w("meta.unreachable");i.push(w("meta.jumpStage",{label:r.jump.label})+" "+m)}r.proxy!==null&&typeof r.proxy=="object"&&i.push(r.proxy.active===!0?w("meta.probeProxy"):w("meta.probeProxyOff")),r.tcp?.ok?i.push("TCP "+(s!==null?s+"ms":w("meta.reachable"))):r.tcp?.skipped===!0&&i.push(w("meta.probeTcpSkipped")),r.banner?.ok&&i.push(w("meta.probeBanner"));let n=r.hostkey?.state;if(n==="matched"?i.push(w("meta.hostKeyMatched")):n==="recorded"?i.push(w("meta.hostKeyRecorded")):n==="mismatch"&&i.push(w("meta.hostKeyMismatch")),r.auth?.ok){let _=o!==null?w("meta.authOkMs",{ms:o}):w("meta.authOk");return w("meta.probeOk",{detail:_+(i.length?" \xB7 "+i.join(" \xB7 "):"")})}let a=r.tcp?.skipped===!0?"":r.tcp?.error,l=(r.auth?.error||a||w("error.unknown"))+(i.length?" \xB7 "+i.join(" \xB7 "):"");return t?.prefix!==void 0?t.prefix+l:w("error.probeFailed",{detail:l})}async function Uo(){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=Gt;Ps(t.config),gt!==null&&Gt!==r&&Eo(gt)}}catch{}}function wh(e){gt!==null&&(e.target instanceof Element&&(gt.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||yt())}function Us(e,t){let r=t.getBoundingClientRect(),s=e.offsetWidth,o=e.offsetHeight,n=r.left+s>window.innerWidth-8?r.right-s:r.left;e.style.left=Math.max(8,Math.min(n,window.innerWidth-s-8))+"px";let a=r.bottom+6,d=r.top-o-6;e.style.top=(a+o>window.innerHeight-8&&d>=8?d:Math.min(a,Math.max(8,window.innerHeight-o-8)))+"px"}function N_(e){if(gt!==null){yt();return}Xt(),Uo(),vh().then(()=>{gt!==null&&Eo(gt)});let t=document.createElement("div");t.className="tt_addMenu",gt=t,Eo(t),document.body.appendChild(t),Us(t,e),document.addEventListener("mousedown",wh,!0)}function yt(){gt!==null&&(document.removeEventListener("mousedown",wh,!0),gt.remove(),gt=null)}function H_(e){if(ct!==null){Xt();return}yt();let t=document.createElement("div");t.className="tt_addMenu tt_tabMenu",ct=t,Ch(),document.body.appendChild(t),Us(t,e),document.addEventListener("mousedown",yh,!0),document.addEventListener("keydown",Sh,!0)}function Xt(){ct!==null&&(document.removeEventListener("mousedown",yh,!0),document.removeEventListener("keydown",Sh,!0),ct.remove(),ct=null)}function yh(e){ct!==null&&(e.target instanceof Element&&(ct.contains(e.target)||e.target.closest(".tt_tabMore")!==null)||Xt())}function Sh(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Xt())}function Ch(){let e=ct;if(e===null)return;e.textContent="";let t=U_();if(t.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent=w("list.tabsAllVisible"),e.appendChild(s);return}for(let[s,o]of t){let i=o.label||w("panel.tabLabel",{n:Ho(s)}),n=z_(o),a=document.createElement("div");a.className="tt_addMenuRow tt_tabMenuRow",a.dataset.sid=s;let d=document.createElement("button");d.type="button",d.className="tt_addMenuItem tt_tabMenuItem",s===ke&&(d.dataset.active="");let l=document.createElement("span");l.className="tt_tabDot",l.dataset.state=Wi(o),d.appendChild(l);let _=document.createElement("span");_.className="tt_addMenuText tt_tabMenuText";let m=document.createElement("span");if(m.className="tt_addMenuMain",m.textContent=i,_.appendChild(m),n!==""){let p=document.createElement("span");p.className="tt_tabMenuMeta",p.textContent=n,_.appendChild(p)}d.appendChild(_),d.title=n===""?i:i+" \xB7 "+n,d.addEventListener("click",()=>{Yt(s),Xt()}),a.appendChild(d);let y=document.createElement("button");y.type="button",y.className="tt_addMenuEdit",y.innerHTML=Yi,y.title=w("btn.close"),y.setAttribute("aria-label",w("btn.closeTabAria",{label:i})),y.addEventListener("click",()=>{go(s)}),a.appendChild(y),e.appendChild(a)}let r=e.querySelector(".tt_tabMenuItem[data-active]");r!==null&&typeof r.scrollIntoView=="function"&&r.scrollIntoView({block:"nearest"})}var F_=40;function W_(e,t){let r=e.getBoundingClientRect();return Math.max(0,Math.min(r.right,t.right)-Math.max(r.left,t.left))}function U_(){let e=[];if(Re===null)return e;let t=Re.getBoundingClientRect();for(let[r,s]of fe){if(s.embedded===!0)continue;let o=Re.querySelector('[data-sid="'+r+'"]');o!==null&&W_(o,t)<F_&&e.push([r,s])}return e}function z_(e){return typeof e.target=="string"?e.target:""}function j_(){return w("panel.assistTitle")===Ri["panel.assistTitle"]?"zh":"en"}function $_(e){let t=e!=null&&typeof e.exitCode=="number"?String(e.exitCode):"?";return w("badge.assistFailed",{code:t})}function kr(){if(ir===null)return;let e=ke===null?void 0:cr.get(ke),t=Oi&&e!==void 0&&e.dismissed!==!0;if(ir.hidden=!t,t){let r=ir.querySelector(".tt_assistBadgeText");r!==null&&(r.textContent=$_(e))}}function kt(){Gr!==null&&(Gr.abort(),Gr=null),vr!==null&&(vr.remove(),vr=null),Cr=null,Ii=null}function q_(e){vr!==null&&(e.target instanceof Element&&(vr.contains(e.target)||e.target.closest(".tt_assistBadge")!==null)||kt())}function K_(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),kt())}function G_(e){let t=ke;if(t===null)return;kt();let r=document.createElement("div");r.className="tt_addMenu tt_assistMenu",vr=r,Cr=t,Ii=e,document.body.appendChild(r),document.addEventListener("mousedown",q_,!0),document.addEventListener("keydown",K_,!0),xo(),Us(r,e),V_(t)}async function V_(e){let t=cr.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;Gr=r;try{let s=await fetch("/api/dsh-tty/assist",{method:"POST",cache:"no-store",headers:{"content-type":"application/json"},body:JSON.stringify({sid:e,kind:"failure",lang:j_()}),signal:r.signal}),o=await s.json().catch(()=>null);if(Cr!==e)return;t.busy=!1,s.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(s.status)}catch(s){if(r.signal.aborted||Cr!==e)return;t.busy=!1,t.error=s instanceof Error?s.message:String(s)}finally{Gr===r&&(Gr=null),t.busy=!1,xo()}}function xo(){let e=vr;if(e===null)return;let t=Cr,r=t===null?void 0:cr.get(t);e.textContent="";let s=document.createElement("div");s.className="tt_assistHead";let o=document.createElement("span");if(o.className="tt_assistTitle",o.textContent=w("panel.assistTitle"),s.appendChild(o),r!==void 0&&typeof r.exitCode=="number"){let m=document.createElement("span");m.className="tt_assistCode",m.textContent="exit="+String(r.exitCode),s.appendChild(m)}e.appendChild(s);let i=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(w("status.assistThinking")))}else if(i)n.textContent=w("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=w("panel.assistCommand"),m.appendChild(y);let p=document.createElement("div");p.className="tt_assistCmd",p.textContent=r.command,m.appendChild(p),e.appendChild(m)}let d=document.createElement("div");if(d.className="tt_assistFoot",a){let m=document.createElement("button");m.type="button",m.className="tt_toolBtn tt_assistFill",m.textContent=w("btn.assistFill"),m.title=w("hint.assistFillNoEnter"),m.addEventListener("click",Y_),d.appendChild(m)}let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent=w(i?"btn.assistCopyError":"btn.assistCopy"),l.addEventListener("click",()=>{if(i){Ro(w("error.assistRequest",{message:r.error}));return}Ro(r.answer!==null&&r.answer!==void 0?r.answer:"")}),d.appendChild(l);let _=document.createElement("button");if(_.type="button",_.className="tt_toolBtn tt_assistClose",_.textContent=w("btn.assistClose"),_.addEventListener("click",()=>{kt()}),d.appendChild(_),e.appendChild(d),!i){let m=document.createElement("span");m.className="tt_assistNote",m.textContent=w(a?"hint.assistFillNoEnter":"hint.assistNoCommand"),e.appendChild(m)}Ii!==null&&Us(e,Ii)}function Y_(){let e=Cr,t=e===null?void 0:cr.get(e);if(e===null||t===void 0||t.command==="")return;Pe({t:"input",sid:e,d:""+t.command});let r=fe.get(e);kt(),X_(e),r!==void 0&&r.term!==null&&r.term.focus()}function X_(e){let t=cr.get(e);t!==void 0&&(t.dismissed=!0),kr()}function ko(e,t,r,s,o,i){let n=document.createElement("button");if(n.type="button",n.className="tt_addMenuItem",o===!0&&(n.setAttribute("data-soldout",""),n.title=w("btn.maxSessionsTitle")),i!==void 0){let l=document.createElement("span");l.className="tt_addMenuIcon",l.innerHTML=i,n.appendChild(l)}let a=document.createElement("span");a.className="tt_addMenuText";let d=document.createElement("span");if(d.className="tt_addMenuMain",d.textContent=t,a.appendChild(d),r!==""){let l=document.createElement("span");l.className="tt_addMenuSub",l.textContent=r,a.appendChild(l)}n.appendChild(a),n.addEventListener("click",s),e.appendChild(n)}function Eo(e){e.textContent="";let t=I_();ko(e,w("option.localTerminal"),w(ar==="tmux"?"hint.tmuxHosted":"hint.openInSessionCwd"),async()=>{await ji()||(yt(),Ds())},t,Gi);let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r);let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent=w("panel.sshBook"),e.appendChild(s);for(let i of Gt){if(i===null||typeof i!="object"||typeof i.name!="string"||i.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=w("btn.maxSessionsTitle"));let d=document.createElement("span");d.className="tt_addMenuIcon",d.innerHTML=Zp;let l=document.createElement("span");l.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=i.name;let m=document.createElement("span");m.className="tt_addMenuSub";let y=bh(i.name),p=to(i.jump);m.textContent=yo(i)+(p===""?"":" "+w("meta.viaJump",{label:p}))+(typeof i.proxyCommand=="string"&&i.proxyCommand.trim()!==""?" "+w("meta.viaProxy"):"")+(y>0?" \xB7 \u21C4"+String(y):""),l.appendChild(_),l.appendChild(m),a.appendChild(d),a.appendChild(l),a.addEventListener("click",async()=>{if(await ji())return;yt();let h=ar==="tmux"&&i.persist!==!1?{persist:!0,persistName:Wo()}:{};Ds({t:"ssh",name:i.name,...h},i.name)});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title=w("btn.sftpFileBrowse"),c.innerHTML=Rs,c.addEventListener("click",()=>{yt(),Qi({name:i.name})});let u=document.createElement("button");u.type="button",u.className="tt_addMenuEdit",u.title=w("btn.editConnection"),u.innerHTML=Do,u.addEventListener("click",()=>{yt(),Pc(i)}),n.appendChild(a),n.appendChild(c),n.appendChild(u),e.appendChild(n)}if(Gt.length===0){let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=w("list.emptySshBook"),e.appendChild(i)}let o=document.createElement("div");o.className="tt_addMenuSep",e.appendChild(o),ko(e,w("option.sshConnect"),w("hint.sshConnect"),()=>{yt(),Pc()},!1,Zc)}function Pc(e){if(Vr!==null)return;let t=e!==null&&typeof e=="object"?e:null,r=t!==null,s=document.createElement("div");s.className="tt_sshBackdrop";let o=document.createElement("div");o.className="tt_sshCard";let i=document.createElement("div");i.className="tt_sshTitle",i.innerHTML=Zc+"<span></span>",i.lastElementChild.textContent=r?w("panel.editConnection",{name:String(t.name??"")}):w("panel.sshConnect"),o.appendChild(i);let n=Q=>{let se=document.createElement("div");return se.className="tt_sshSection",se.textContent=Q,se},a={},d=(Q,se,oe)=>{let re=document.createElement("label");re.className="tt_sshRow";let ne=document.createElement("span");ne.className="tt_cardLabel",ne.textContent=se,re.appendChild(ne);let ce;if(oe?.select!==void 0){ce=document.createElement("select");for(let le of oe.select){let ge=document.createElement("option");ge.value=le.value,ge.textContent=le.label,ce.appendChild(ge)}}else ce=document.createElement("input"),ce.type=oe?.type??"text",ce.placeholder=oe?.placeholder??"";return ce.className="tt_cardInput",ce.autocomplete="off",ce.spellcheck=!1,re.appendChild(ce),a[Q]=ce,re};o.appendChild(n(w("section.connection")));let l=document.createElement("div");l.className="tt_sshGrid",l.appendChild(d("host",w("field.host"),{placeholder:w("placeholder.host")})),l.appendChild(d("port",w("field.port"),{placeholder:"22"})),o.appendChild(l),o.appendChild(d("username",w("field.username"),{placeholder:"root"})),o.appendChild(n(w("section.auth"))),o.appendChild(d("auth",w("field.authMethod"),{select:[{value:"agent",label:w("option.authAgent")},{value:"key",label:w("option.authKey")},{value:"password",label:w("option.authPassword")}]}));let _=d("keyPath",w("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),m=d("passphrase",w("field.passphrase"),{type:"password"}),y=d("password",w("field.password"),{type:"password"}),p=(Q,se)=>{let oe=document.createElement("div");oe.className="tt_sshRow tt_envRow";let re=document.createElement("input");re.type="text",re.className="tt_cardInput",re.placeholder=w("placeholder.credRef"),re.title=w("hint.credRefCandidates"),re.autocomplete="off",re.spellcheck=!1;let ne=document.createElement("span");ne.className="tt_cardHint tt_envEmpty",ne.textContent=se,ne.hidden=!0,re.hidden=!0;let ce=document.createElement("div");ce.className="tt_envList",ce.dataset.hidden="";let le=[],ge=()=>{if(ce.textContent="",le.length===0){let ye=document.createElement("span");ye.className="tt_cardHint",ye.textContent=se,ce.appendChild(ye);return}let we=re.value.trim().toUpperCase(),Le=we===""?le:le.filter(ye=>ye.toUpperCase().includes(we));for(let ye of Le.slice(0,30)){let be=document.createElement("button");be.type="button",be.className="tt_envItem",be.textContent=ye;let xe="env:"+ye,Fe=null,tt=()=>{Fe!==null&&(clearTimeout(Fe),Fe=null),be.textContent=ye,delete be.dataset.danger};be.addEventListener("mousedown",Er=>Er.preventDefault()),be.addEventListener("click",()=>{let Er=Q.value;if(Er===""||Er.startsWith("env:")||Fe!==null){tt(),Q.value=xe,Q.focus(),Q.dispatchEvent(new Event("change"));return}be.textContent=w("list.credOverwrite",{name:ye}),be.dataset.danger="",Fe=setTimeout(tt,4e3)}),ce.appendChild(be)}if(Le.length>30){let ye=document.createElement("span");ye.className="tt_envMore",ye.textContent=w("list.moreMatches",{count:Le.length-30}),ce.appendChild(ye)}else if(Le.length===0){let ye=document.createElement("span");ye.className="tt_envMore",ye.textContent=w("list.noCredRef"),ce.appendChild(ye)}};return re.addEventListener("input",ge),re.addEventListener("focus",()=>{le.length>0&&delete ce.dataset.hidden}),re.addEventListener("blur",()=>{re.value.trim()===""&&(ce.dataset.hidden="")}),oe.appendChild(re),oe.appendChild(ne),oe.appendChild(ce),{row:oe,setNames(we){le=Array.isArray(we)?we:[];let Le=le.length>0;re.hidden=!Le,ne.hidden=Le,ge()}}},c=(Q,se)=>{let oe=document.createElement("div");oe.className="tt_sshRow tt_credRow";let re=document.createElement("label");re.className="tt_credToggle";let ne=document.createElement("input");ne.type="checkbox",ne.className="tt_cardCheckbox";let ce=document.createElement("span");ce.textContent=w("check.rememberCredential"),re.appendChild(ne),re.appendChild(ce),ne.checked=Ot!==null,re.title=w("hint.rememberCredential");let le=document.createElement("button");le.type="button",le.className="tt_toolBtn tt_credClear",le.textContent=w("btn.clearCredential"),le.dataset.hidden="";let ge=document.createElement("span");ge.className="tt_credStatus",oe.appendChild(re),oe.appendChild(le),oe.appendChild(ge);let we=(be,xe)=>{ge.textContent=be,ge.dataset.kind=xe},Le=async()=>{let be=$r(Q.value),xe=be!=="";if(re.hidden=xe,le.hidden=!xe,ge.hidden=!1,Zr()===null){ne.disabled=!0,ne.checked=!1,le.disabled=!0,we(w(Ot===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),"muted");return}if(ne.disabled=!1,!xe){ge.hidden=!0,we("","plain");return}let Fe=await Wc(be);if(Fe.unreported===!0){we(w("status.credUnreported",{ref:be}),"plain");return}if(Fe.error!==void 0){we(w("error.credStatusFailed",{error:Fe.error}),"error");return}let tt=Fe.view;we(tt.configured?w("status.credStored",{ref:be,source:tt.source!==""?w("meta.credSource",{source:tt.source}):""}):w("status.credUnknown",{ref:be}),tt.configured?"ok":"plain"),le.disabled=tt.configured!==!0||tt.writable!==!0};le.addEventListener("click",()=>{(async()=>{let be=$r(Q.value);if(be==="")return;let xe=await Uc(be);if(xe.error!==void 0){we(xe.error,"error");return}Q.value="",await Le()})()});let ye=async()=>{let be=await zc(ne.checked===!0,Q.value,a.host.value,a.port.value,a.username.value,se);return be.value!==void 0&&(Q.value=be.value,await Le()),be};return Q.addEventListener("change",()=>{Le()}),{row:oe,refresh:Le,storeIfRequested:ye}},u=p(a.passphrase,w("hint.noCredRefPassphrase")),h=p(a.password,w("hint.noCredRefPassword")),f=c(a.password,"PASSWORD");(async()=>{let Q=await Fc();u.setNames(Q),h.setNames(Q)})(),o.appendChild(_),o.appendChild(m),o.appendChild(u.row),o.appendChild(y),o.appendChild(f.row),o.appendChild(h.row),o.appendChild(n(w("section.jump")));let v=d("jumpHost",w("field.jumpHost"),{placeholder:w("placeholder.jumpHost")});o.appendChild(v);let S=document.createElement("label");S.className="tt_sshRow";let g=document.createElement("input");g.type="checkbox",g.className="tt_cardCheckbox";let x=document.createElement("span");x.className="tt_cardLabel",x.textContent=w("check.jumpOwnCred"),S.appendChild(g),S.appendChild(x),o.appendChild(S);let b=d("jumpUsername",w("field.jumpUsername"),{placeholder:"root"}),E=d("jumpAuth",w("field.jumpAuth"),{select:[{value:"",label:w("option.authInherit")},{value:"agent",label:w("option.authAgent")},{value:"key",label:w("option.authKey")},{value:"password",label:w("option.authPassword")}]}),P=d("jumpKeyPath",w("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),O=d("jumpPassphrase",w("field.passphrase"),{type:"password"}),F=d("jumpPassword",w("field.password"),{type:"password"});for(let Q of[b,E,P,O,F])o.appendChild(Q);let A=document.createElement("div");A.className="tt_cardHint",A.textContent=w("hint.jumpInherit"),o.appendChild(A),o.appendChild(n(w("section.proxyCommand")));let V=d("proxyCommand",w("field.proxyCommand"),{placeholder:w("placeholder.proxyCommand")});o.appendChild(V);let B=document.createElement("div");B.className="tt_cardHint",B.textContent=w("hint.proxyCommand"),o.appendChild(B);let M=document.createElement("div");M.className="tt_cardHint tt_sshProbeWarn",M.textContent=w("hint.proxyCommandDisabled"),o.appendChild(M);let U=()=>{let Q=a.proxyCommand.value.trim()!=="",se=mh,oe=se&&_h;M.textContent=w(se?"hint.proxyCommandDisabled":"hint.proxyCommandNotGranted"),M.style.display=Q&&!oe?"":"none"};a.proxyCommand.addEventListener("input",U),U();let I=()=>{let Q=eo(a.jumpHost.value);if(Q===void 0)return;if(g.checked!==!0)return Q;let se={...Q},oe=a.jumpUsername.value.trim();oe!==""&&(se.username=oe);let re=a.jumpAuth.value;(re==="agent"||re==="key"||re==="password")&&(se.auth=re);let ne=a.jumpKeyPath.value.trim();return ne!==""&&(se.keyPath=ne),a.jumpPassphrase.value!==""&&(se.passphrase=a.jumpPassphrase.value),a.jumpPassword.value!==""&&(se.password=a.jumpPassword.value),se},C=()=>{let Q=a.proxyCommand.value.trim();return Q===""?void 0:Q},L=()=>{let Q=eo(a.jumpHost.value)!==void 0,se=Q&&g.checked===!0;S.style.display=Q?"":"none";for(let oe of[b,E,P,O,F])oe.style.display=se?"":"none";P.style.display=se&&a.jumpAuth.value==="key"?"":"none",O.style.display=se&&a.jumpAuth.value==="key"?"":"none",F.style.display=se&&a.jumpAuth.value==="password"?"":"none",A.style.display=Q?"":"none"};a.jumpHost.addEventListener("input",L),a.jumpAuth.addEventListener("change",L),g.addEventListener("change",L),o.appendChild(n(w("section.options")));let T=document.createElement("label");T.className="tt_cardRow";let D=document.createElement("input");D.type="checkbox",D.className="tt_cardCheckbox";let N=document.createElement("span");N.className="tt_cardLabel",N.textContent=w("check.agentForward"),T.appendChild(D),T.appendChild(N),o.appendChild(T),o.appendChild(d("hostKeyAlias",w("field.hostKeyAlias"),{placeholder:w("placeholder.hostKeyAlias")}));let G=document.createElement("span");G.className="tt_cardHint",G.textContent=w("hint.hostKeyAlias"),o.appendChild(G);let $=document.createElement("label");$.className="tt_cardRow";let Y=document.createElement("input");Y.type="checkbox",Y.className="tt_cardCheckbox";let H=document.createElement("span");H.className="tt_cardLabel",H.textContent=w("check.persist"),$.appendChild(Y),$.appendChild(H),Y.checked=ar==="tmux",ar==="tmux"&&o.appendChild($);let k=document.createElement("label");k.className="tt_cardRow";let W=document.createElement("input");W.type="checkbox",W.className="tt_cardCheckbox";let q=document.createElement("span");q.className="tt_cardLabel",q.textContent=w("check.saveToBook"),k.appendChild(W),k.appendChild(q),o.appendChild(k);let j=d("name",w("field.bookName"),{placeholder:w("placeholder.bookName")});if(j.style.display="none",o.appendChild(j),W.addEventListener("change",()=>{j.style.display=W.checked?"":"none",W.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),W.checked&&a.name.focus()}),r){k.style.display="none",a.name.value=String(t.name??""),j.style.display="",a.host.value=String(t.host??""),a.port.value=String(t.port??22),a.username.value=String(t.username??""),a.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",a.keyPath.value=String(t.keyPath??""),a.passphrase.value=String(t.passphrase??""),a.password.value=String(t.password??"");let Q=t.jump!==null&&typeof t.jump=="object"?t.jump:null;if(a.jumpHost.value=to(Q),Q!==null){let se=Q.auth!==void 0||Q.keyPath!==void 0||Q.password!==void 0||Q.passphrase!==void 0;g.checked=se,se&&(a.jumpUsername.value=String(Q.username??""),a.jumpAuth.value=Q.auth==="key"||Q.auth==="password"?String(Q.auth):"",a.jumpKeyPath.value=String(Q.keyPath??""),a.jumpPassphrase.value=String(Q.passphrase??""),a.jumpPassword.value=String(Q.password??""))}D.checked=t.agentForward===!0,a.hostKeyAlias.value=String(t.hostKeyAlias??""),a.proxyCommand.value=String(t.proxyCommand??""),U(),Y.checked=ar==="tmux"}let X=document.createElement("div");X.className="tt_sshStatus";let J=document.createElement("div");J.className="tt_sshError";let ae=document.createElement("div");ae.className="tt_sshProbeResult",X.appendChild(J),X.appendChild(ae),o.appendChild(X),L();let he=()=>a.hostKeyAlias.value.trim(),_e=()=>{J.textContent="";let Q=a.host.value.trim(),se=a.username.value.trim(),oe=Number(a.port.value);if((!Number.isInteger(oe)||oe<1||oe>65535)&&(oe=22),Q===""||se==="")return J.textContent=w("error.hostUserRequired"),null;let re=a.auth.value,ne={host:Q,port:oe,username:se,auth:re},ce=I();ce!==void 0&&(ne.jump=ce);let le=C();if(le!==void 0&&(ne.proxyCommand=le),re==="key"){let we=a.keyPath.value.trim();if(we==="")return J.textContent=w("error.keyPathRequired"),null;ne.keyPath=we;let Le=a.passphrase.value;Le!==""&&(ne.passphrase=Le)}if(re==="password"){let we=a.password.value;if(we==="")return J.textContent=w("error.passwordRequired"),null;ne.password=we}D.checked&&(ne.agentForward=!0);let ge=he();return ge!==""&&(ne.hostKeyAlias=ge),ne},Z=document.createElement("div");Z.className="tt_sshActions";let Ce=document.createElement("div");Ce.className="tt_sshActionsGroup";let He=document.createElement("div");He.className="tt_sshActionsGroup",Z.appendChild(Ce),Z.appendChild(He);let Ee=document.createElement("button");Ee.type="button",Ee.className="tt_toolBtn",Ee.textContent=w("btn.cancel");let Oe=document.createElement("button");Oe.type="button",Oe.className="tt_cardSave",Oe.textContent=w("btn.connect"),Ce.appendChild(Ee);let Ue=document.createElement("button");Ue.type="button",Ue.className="tt_toolBtn",Ue.textContent=w("btn.fileBrowse"),Ue.title=w("btn.browseTitle"),Ue.addEventListener("click",()=>{J.textContent="";let Q=a.host.value.trim(),se=a.username.value.trim(),oe=Number(a.port.value);if((!Number.isInteger(oe)||oe<1||oe>65535)&&(oe=22),Q===""||se===""){J.textContent=w("error.hostUserRequired");return}let re=a.auth.value,ne={host:Q,port:oe,username:se,auth:re},ce=I();ce!==void 0&&(ne.jump=ce);let le=C();if(le!==void 0&&(ne.proxyCommand=le),re==="key"){let we=a.keyPath.value.trim();if(we===""){J.textContent=w("error.keyPathRequired");return}ne.keyPath=we;let Le=a.passphrase.value;Le!==""&&(ne.passphrase=Le)}if(re==="password"){let we=a.password.value;if(we===""){J.textContent=w("error.passwordRequired");return}ne.password=we}D.checked&&(ne.agentForward=!0);let ge=he();ge!==""&&(ne.hostKeyAlias=ge),nr(),Qi(ne)}),Ce.appendChild(Ue);let te=null;r&&(te=document.createElement("button"),te.type="button",te.className="tt_toolBtn",te.textContent=w("btn.saveEdit"),te.addEventListener("click",()=>{J.textContent="";let Q=a.host.value.trim(),se=a.username.value.trim();if(Q===""||se===""){J.textContent=w("error.hostUserRequired");return}let oe=Number(a.port.value);(!Number.isInteger(oe)||oe<1||oe>65535)&&(oe=22);let re=a.auth.value,ce={name:a.name.value.trim()||Q,host:Q,port:oe,username:se,auth:re,keyPath:re==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:D.checked,hostKeyAlias:he(),persist:Y.checked},le=I();if(le!==void 0&&(ce.jump=le),ce.proxyCommand=a.proxyCommand.value.trim(),re==="key"&&ce.keyPath===""){J.textContent=w("error.keyPathRequired");return}te!==null&&(te.disabled=!0),(async()=>{let ge=await f.storeIfRequested();if(ge.error!==void 0){J.textContent=ge.error,te!==null&&(te.disabled=!1);return}ge.value!==void 0&&(ce.password=ge.value);let we=await Z_(String(t.name??""),ce);if(te!==null&&(te.disabled=!1),we!==void 0){J.textContent=w("error.saveCredFailed",{error:we});return}nr()})()}),Ce.appendChild(te));let de=document.createElement("button");de.type="button",de.className="tt_toolBtn",de.textContent=w("btn.probe"),de.title=w("btn.probeTitle"),de.addEventListener("click",()=>{let Q=_e();Q!==null&&(ae.className="tt_sshProbeResult",ae.textContent=w("msg.probing"),de.disabled=!0,So(Q,!1).then(se=>{de.disabled=!1,se.result?(ae.className="tt_sshProbeResult"+(se.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),ae.textContent=Co(se.result)):(ae.className="tt_sshProbeResult tt_sshProbeBad",ae.textContent=w("error.probeFailed",{detail:String(se.error||w("error.unknown"))}))}))}),Ce.appendChild(de),He.appendChild(Oe),o.appendChild(Z);let ve=()=>{_.style.display=a.auth.value==="key"?"":"none",m.style.display=a.auth.value==="key"?"":"none",u.row.style.display=a.auth.value==="key"?"":"none",y.style.display=a.auth.value==="password"?"":"none",h.row.style.display=a.auth.value==="password"?"":"none",f.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",ve),ve(),f.refresh(),Ee.addEventListener("click",()=>nr()),s.addEventListener("mousedown",Q=>{Q.target===s&&nr()}),Oe.addEventListener("click",async()=>{J.textContent="";let Q=await ji();if(Q!==null){J.textContent=Q;return}let se=a.host.value.trim(),oe=a.username.value.trim(),re=Number(a.port.value);if((!Number.isInteger(re)||re<1||re>65535)&&(re=22),se===""||oe===""){J.textContent=w("error.hostUserRequired");return}let ne=a.auth.value,ce={t:"ssh",host:se,port:re,username:oe,auth:ne},le=I();le!==void 0&&(ce.jump=le);let ge=C();if(ge!==void 0&&(ce.proxyCommand=ge),ne==="key"){let xe=a.keyPath.value.trim();xe!==""&&(ce.keyPath=xe);let Fe=a.passphrase.value;Fe!==""&&(ce.passphrase=Fe)}if(ne==="password"){let xe=a.password.value;xe!==""&&(ce.password=xe)}D.checked&&(ce.agentForward=!0);let we=he();we!==""&&(ce.hostKeyAlias=we),Y.checked&&(ce.persist=!0,ce.persistName=Wo());let Le=re!==22?oe+"@"+se+":"+re:oe+"@"+se,ye=xe=>{nr(),ue!==null&&Ds(ce,xe!==""?xe:Le)};if(!W.checked){ye("");return}let be=a.name.value.trim()||se;Oe.disabled=!0,(async()=>{let xe=await f.storeIfRequested();if(xe.error!==void 0){J.textContent=xe.error,Oe.disabled=!1;return}let Fe=xe.value??ce.password??"",tt=await J_({name:be,host:se,port:re,username:oe,auth:ne,keyPath:ce.keyPath??"",passphrase:ce.passphrase??"",password:Fe,agentForward:D.checked,hostKeyAlias:he(),persist:Y.checked,...le!==void 0?{jump:le}:{},proxyCommand:a.proxyCommand.value.trim()});if(Oe.disabled=!1,tt!==void 0){J.textContent=w("error.saveBookFailed",{error:tt});return}ye(be)})()}),s.appendChild(o),document.body.appendChild(s),Vr=s,a.host.focus()}function nr(){Vr!==null&&(Vr.remove(),Vr=null)}async function J_(e){let t=[...Gt.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})}),s=await r.json().catch(()=>({}));if(!r.ok||!s.ok)return String(s.error||"HTTP "+r.status);Ps(s.config);return}catch(r){return String(r&&r.message?r.message:r)}}async function Z_(e,t){if(t.name!==e&&Gt.some(s=>s?.name===t.name))return w("error.bookNameTaken",{name:t.name});let r=Gt.map(s=>s?.name===e?t:s);try{let s=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:r})}),o=await s.json().catch(()=>({}));if(!s.ok||!o.ok)return String(o.error||"HTTP "+s.status);Ps(o.config);return}catch(s){return String(s&&s.message?s.message:s)}}function Q_(e,t,r){let s=Wr(r,ke);if(kh(s))return;let o=document.createElement("div");o.className="tt_sftpDualCard";let i=document.createElement("div");i.className="tt_sftpTitleRow";let n=document.createElement("div");n.className="tt_sshTitle",n.innerHTML=Rs+"<span></span>",n.lastElementChild.textContent=w("panel.sftpDual",{label:t});let a=document.createElement("button");a.type="button",a.className="tt_close",a.title=w("btn.close"),a.innerHTML=Vi,a.addEventListener("click",()=>ts(s)),i.appendChild(n),i.appendChild(a),o.appendChild(i);let d=document.createElement("div");d.className="tt_sftpStatus";let l=(N,G)=>{d.textContent=N,G===void 0?delete d.dataset.state:d.dataset.state=G},_=!1,m=(N,G)=>{if(!(_||p.local.busy||p.remote.busy)){_=!0;for(let $ of[p.local,p.remote])$.setBusy(!0);l(N,"busy"),Promise.resolve().then(G).catch($=>{($===null||typeof $!="object"||$.name!=="TransferCanceledError")&&M.fail(w("status.failed")),l(String($&&$.message?$.message:$),"error")}).finally(()=>{_=!1;for(let $ of[p.local,p.remote])$.setBusy(!1)})}},y=N=>{p[N].bar.after(h),h.style.display="",f.focus(),f.select()},p={},c=(N,G)=>{if(N===void 0||N==="")throw new Error(w("error.dirNotReady"));return N.endsWith("/")||N.endsWith("\\")?N+G:N+"/"+G},u=(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 W=document.createElement("span");W.className="tt_sftpPaneMeta",H.appendChild(k),H.appendChild(W),Y.appendChild(H);let q=document.createElement("div");q.className="tt_sftpBar";let j=document.createElement("input");j.type="text",j.className="tt_sftpPath",j.placeholder=w(N==="local"?"placeholder.localPath":"placeholder.remotePath"),j.spellcheck=!1,j.autocomplete="off";let X=document.createElement("button");X.type="button",X.className="tt_toolBtn",X.innerHTML=Po+"<span>"+w("btn.refresh")+"</span>";let J=document.createElement("button");J.type="button",J.className="tt_toolBtn",J.innerHTML=Vc+"<span>"+w("btn.mkdir")+"</span>";let ae=document.createElement("button");ae.type="button",ae.className="tt_toolBtn tt_toolToggle",ae.textContent=w("btn.hiddenFiles"),ae.title=w("btn.hiddenFilesTitle"),_r&&(ae.dataset.on=""),q.appendChild(j),q.appendChild(X),q.appendChild(J),q.appendChild(ae),Y.appendChild(q);let he=document.createElement("div");he.className="tt_sftpList",Y.appendChild(he),$.bar=q;let _e=te=>{$.busy=te;for(let de of[X,J])de.disabled=te;j.disabled=te},Z=async(te,de)=>{let ve=N==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",Q=N==="local"?de:{...e,...de},se=await fetch(ve+te,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)}),oe=await se.json().catch(()=>({}));if(!se.ok||oe.ok!==!0)throw new Error(String(oe.error||"HTTP "+se.status));return oe},Ce=(te,de)=>{if(!($.busy||_))return _e(!0),l(te,"busy"),Promise.resolve().then(de).catch(ve=>l(String(ve&&ve.message?ve.message:ve),"error")).finally(()=>_e(!1))},He=(te,de)=>{if(te===void 0||te==="")throw new Error(w("error.dirNotReady"));return te.endsWith("/")||te.endsWith("\\")?te+de:te+"/"+de},Ee=te=>{let de=He($.path,te.name),ve=[];te.isDir===!0?ve.push(w("meta.dir")):ve.push(Ze(Number(te.size))||"\u2014");let Q=Th(Number(te.mtime));Q!==""&&ve.push(Q);let se=b(te.isDir?Rs:te.isSymlink?Kc:qc,te.name,ve.join(" \xB7 "),te.isDir===!0?"dir":te.isSymlink===!0?"link":"file"),oe=()=>$.loadDir($.path),re=N==="local"?p.remote:p.local;return te.isDir===!0&&se.addEventListener("click",ne=>{ne.target instanceof Element&&ne.target.closest(".tt_sftpAct")!==null||$.loadDir(de)}),E(se,N==="local"?Yc:Xc,w("btn.transferTo",{target:w(N==="local"?"meta.remote":"meta.local"),path:re.path}),()=>{if($.path===""||re.path===""){l(w("error.transferDirsNotReady"),"error");return}M.reset(),M.pulse(0),m(w("msg.transferring",{name:te.name}),async()=>{let ne=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"?de:He(re.path,te.name),remotePath:N==="local"?He(re.path,te.name):de})}),ce=await ne.json().catch(()=>({}));if(!ne.ok||ce.ok!==!0)throw M.fail(w("error.transferFailed")),new Error(String(ce.error||"HTTP "+ne.status));let le=ce.job?.id;if(typeof le!="string"||le==="")throw M.fail(w("error.transferFailed")),new Error(w("error.noTaskId"));await U(le,te.name)==="canceled"?(M.reset(),l(w("msg.transferCanceled",{name:te.name}))):(M.done(w("status.done")),setTimeout(()=>M.reset(),1500),l(w("msg.transferred",{name:te.name}))),await re.loadDir(re.path)})}),N!=="local"&&te.isDir!==!0&&E(se,Gc,w("btn.download",{name:te.name}),()=>{O(te,de)}),E(se,Do,w("btn.rename",{name:te.name}),()=>{f.placeholder=w("placeholder.newName"),f.value=te.name,y(N),g=async()=>{let ne=f.value.trim();ne===""||ne===te.name||(x(),await $.runTask(w("msg.renaming",{name:te.name}),async()=>{await Z("rename",{from:de,to:He($.path,ne)}),await oe()}))}}),P(se,()=>$.runTask(w("msg.deleting",{name:te.name}),async()=>{await Z("remove",{path:de,recursive:te.isDir===!0}),await oe(),l(w("msg.deleted",{name:te.name}))}),te),se},Oe=te=>{if(he.textContent="",$.path!==""&&$.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test($.path)===!1){let Q=b(Ao,w("list.parentDir"),"","up");Q.addEventListener("click",()=>{let se=N==="local"?rm($.path):Rh($.path);se!==null&&$.loadDir(se)}),he.appendChild(Q)}let de=bi(te,_r);if(de.length===0){let Q=document.createElement("div");Q.className="tt_addMenuTitle",Q.textContent=te.length>0?w("list.hiddenOnly"):w("list.emptyDir"),he.appendChild(Q);return}let ve=500;for(let Q of de.slice(0,ve))Q===null||typeof Q!="object"||typeof Q.name!="string"||Q.name===""||he.appendChild(Ee(Q));if(de.length>ve){let Q=document.createElement("div");Q.className="tt_addMenuTitle",Q.textContent=w("list.truncated",{rest:de.length-ve,total:de.length}),he.appendChild(Q)}};$.loadDir=async te=>{try{let de=await Z("list",{path:te??$.path});$.path=typeof de.path=="string"&&de.path!==""?de.path:$.path,j.value=$.path;let ve=Array.isArray(de.entries)?de.entries:[];$.rawEntries=ve,Oe(ve),W.textContent=w("list.itemCount",{count:bi(ve,_r).length}),l($.path)}catch(de){l(String(de&&de.message?de.message:de),"error")}},$.runTask=Ce,$.setBusy=_e,p[N]=$,ae.addEventListener("click",()=>{P_(!_r)});let Ue=te=>{ae!==null&&(te?ae.dataset.on="":delete ae.dataset.on),$.rawEntries=$.rawEntries??[],Oe($.rawEntries),W.textContent=w("list.itemCount",{count:bi($.rawEntries,te).length})};return bo.add(Ue),$.onShowHidden=Ue,X.addEventListener("click",()=>{$.runTask(w("list.loading"),()=>$.loadDir($.path))}),J.addEventListener("click",()=>{$.busy||_||(f.placeholder=w("placeholder.newDirName"),f.value="",y(N),g=async()=>{let te=f.value.trim();te!==""&&(x(),await $.runTask(w("msg.creatingDir",{name:te}),async()=>{await Z("mkdir",{path:He($.path,te),parents:!0}),await $.loadDir($.path)}))})}),j.addEventListener("keydown",te=>{if(te.key!=="Enter"||(te.preventDefault(),$.busy||_))return;let de=j.value.trim();de!==""&&$.runTask(w("list.loading"),()=>$.loadDir(de))}),Y},h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let f=document.createElement("input");f.type="text",f.className="tt_cardInput",f.spellcheck=!1,f.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=w("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=w("btn.cancel"),h.appendChild(f),h.appendChild(v),h.appendChild(S);let g=null,x=()=>{h.style.display="none",f.value="",g=null};v.addEventListener("click",()=>{g?.()}),S.addEventListener("click",x),f.addEventListener("keydown",N=>{N.key==="Enter"?(N.preventDefault(),g?.()):N.key==="Escape"&&(N.stopPropagation(),x())});let b=(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 W=document.createElement("span");if(W.className="tt_sftpName",W.textContent=G,W.title=G,H.appendChild(k),H.appendChild(W),$!==""){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)},P=(N,G,$)=>{let Y=document.createElement("button");Y.type="button",Y.className="tt_sftpAct",Y.innerHTML=qr,Y.title=$.isDir?w("btn.deleteEntryDir",{name:$.name}):w("btn.deleteEntry",{name:$.name});let H=null;Y.addEventListener("click",k=>{if(k.stopPropagation(),H!==null){clearTimeout(H),H=null,Y.innerHTML=qr,delete Y.dataset.danger,G();return}Y.textContent=w("btn.confirm"),Y.dataset.danger="",H=setTimeout(()=>{H=null,Y.innerHTML=qr,delete Y.dataset.danger},4e3)}),N.appendChild(Y)},O=(N,G)=>p.remote.runTask(w("msg.downloading",{name:N.name}),async()=>{M.reset();let $;try{$=await Ah({makeBody:Y=>({...e,path:G,...Y>0?{offset:Y}:{}}),onProgress:(Y,H)=>M.set(Y,H),maxMb:Kt.maxDownloadMb,registerCancel:Y=>M.setCancel(Y),onResume:Y=>l(w("msg.downloadResuming",{name:N.name,offset:Ze(Y)||String(Y)+" B"}),"busy")})}catch(Y){if(Jr(Y)){M.reset(),l(w("msg.downloadCanceled",{name:N.name}));return}throw M.fail(w("error.downloadFailed")),Y}M.done(w("status.done")),Dh($,N.name),setTimeout(()=>M.reset(),1500),l(w("msg.downloaded",{name:N.name,size:Ze($.size)||String($.size)+" B"}))}),F=u("local",w("meta.local")),A=u("remote",w("meta.remote"));p.local.wrap=F,p.remote.wrap=A;let V=document.createElement("div");V.className="tt_sftpDual",V.appendChild(F),V.appendChild(A),o.appendChild(V),o.appendChild(h);let B=document.createElement("div");B.className="tt_sftpFoot";let M=Mh();B.appendChild(M.el),B.appendChild(d),o.appendChild(B);let U=async(N,G)=>{let $=!1;M.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(W=>setTimeout(W,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(w("error.invalidTaskState"));if(k.state==="running"){let W=typeof k.current=="string"&&k.current!==""?k.current:G;l(w("msg.transferring",{name:W}),"busy"),Number.isFinite(k.total)&&k.total>0?M.set(Number(k.bytes)||0,k.total):M.pulse(Number(k.bytes)||0);continue}if(k.state==="canceled")return"canceled";if(k.state!=="done")throw new Error(String(k.error||w("error.transferFailed")));return"done"}}finally{M.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[p.local,p.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=gc(N.kind,Y.dataTransfer);if(!H.accept){H.reason==="wrongPane"&&(Y.preventDefault(),l(w("error.dropOnLocalPane"),"error"));return}Y.preventDefault(),!(_||p.remote.busy)&&Ph(Y.dataTransfer).then(k=>{(k.length>0||k._limitExceeded===!0)&&L(p.remote,k)})})}let L=async(N,G)=>{let $=Kt;if($.maxUploadFiles>0&&G.length>$.maxUploadFiles){l(w("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(w("error.uploadTooBig",{size:Ze(Y),name:String(H.relPath??"")}),"error");return}if(G._limitExceeded===!0){l(w("error.uploadTotalTooBig"),"error");return}await m(w("msg.uploading"),async()=>{if(N.path===""){l(w("error.transferDirsNotReady"),"error");return}for(let q of vc(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(()=>{});M.reset();let k={stopped:!1,abort:null};M.setCancel(()=>k.abort?.());let W=0;try{let q=0;for(let j of G){if(k.stopped)break;q+=1,k.abort=null;try{await Lh(j.file,c(N.path,j.relPath),{spec:e,label:`${String(q)}/${String(G.length)} ${j.relPath}`,cancelRef:k,onProgress:(X,J)=>Number.isFinite(J)&&J>0?M.set(X,J):M.pulse(X),onLabel:X=>l(w("msg.uploadingName",{name:X}),"busy")}),W+=1}catch(X){if(Jr(X)||k.stopped)break;throw X}}}finally{M.setCancel(null)}k.stopped?(M.reset(),l(w("msg.uploadCanceled",{done:W,total:G.length}))):(M.done(w("status.allDone")),setTimeout(()=>M.reset(),1500),l(w("msg.uploadDoneCount",{count:G.length}))),await N.loadDir(N.path)})},T=Io(),D=T===null?420:Math.round(T.height*.56);Eh(o,w("panel.sftpDual",{label:t}),D,s),p.local.loadDir(""),p.remote.loadDir(""),wo=()=>{for(let N of[p.local,p.remote])N!==void 0&&typeof N.onShowHidden=="function"&&bo.delete(N.onShowHidden)}}var Vt=null,It=null;function xh(){return It!==null&&so(It.ownerKey,ke)?It.ownerKey:Wr(void 0,ke)}var kh=(e=xh())=>Vt!==null||It!==null&&It.ownerKey===e;function Eh(e,t,r,s){let o=Wr(s,ke),i=xt!==null&&xt.ownerKey===o;if(ue!==null&&!Ve&&mt!==null&&!i)try{let a=hh({title:t,side:"bottom",size:r,min:200,ownerSid:o,onClose:()=>ts(o)});a.element.appendChild(e),It=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&&ts()}),document.body.appendChild(n),Vt=n}var Ts=null;function em(){let e=Ts;if(Ts=null,e!==null)try{e.click()}catch{}}function tm(e){let t=new TextEncoder().encode(e),r="";for(let s of t)r+=String.fromCharCode(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Lh(e,t,r){let{spec:s,label:o="",cancelRef:i,onProgress:n,onLabel:a,onDone:d}=r;return o!==""&&typeof a=="function"&&a(o),new Promise((l,_)=>{let m=tm(JSON.stringify({...s,path:t})),y=new XMLHttpRequest;i.abort=()=>{i.stopped=!0,y.abort()},y.open("POST","/api/dsh-tty/sftp/upload"),y.setRequestHeader("x-dsh-sftp-meta",m),y.upload.addEventListener("progress",u=>{u.lengthComputable?n(u.loaded,u.total):n(0,NaN)});let p=!1,c=u=>{p||(p=!0,u===null?l():_(u))};y.addEventListener("load",()=>{if(y.status===200){d?.(),c(null);return}if(i.stopped)return;let u="HTTP "+y.status;try{let h=JSON.parse(y.responseText);h!==null&&typeof h=="object"&&typeof h.error=="string"&&(u=h.error)}catch{}c(new Error(u))}),y.addEventListener("error",()=>{if(i.stopped){c(new es);return}c(new Error(w("error.networkError")))}),y.addEventListener("abort",()=>{c(new es)}),y.send(e)})}function Th(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=s=>String(s).padStart(2,"0");return t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())+" "+r(t.getHours())+":"+r(t.getMinutes())}function Rh(e){let t=String(e).replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function rm(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 i=Math.max(o.lastIndexOf("\\"),o.lastIndexOf("/"));return i<=0?r[1]+"\\":r[1]+o.slice(0,i)}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 s=t.lastIndexOf("/");return s<=0?s===0?"/":null:t.slice(0,s)}function vs(e,t){return e.endsWith("/")?e+t:e+"/"+t}function Mh(){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 s=document.createElement("span");s.className="tt_sftpPct",s.textContent="";let o=document.createElement("button");o.type="button",o.className="tt_sftpCancel",o.title=w("btn.cancelTransfer"),o.innerHTML=Yi,o.style.display="none";let i=null;o.addEventListener("click",p=>{p.stopPropagation();let c=i;c!==null&&(o.disabled=!0,c())}),e.appendChild(t),e.appendChild(s),e.appendChild(o);let n=p=>{s.textContent=p},a="",d=-1,l=p=>{p!==a&&(a=p,s.textContent=p)},_=p=>{let c=Math.round(p);c!==d&&(d=c,r.style.width=c+"%")},m=()=>{i=null,Ts===o&&(Ts=null),o.style.display="none",o.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",d=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,r.style.width="0%",s.textContent="",m()},setCancel(p){if(p==null){m();return}i=p,Ts=o,o.disabled=!1,o.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let u=Date.now();if(this._last!==void 0&&u>this._lastAt){let h=(p-this._last)/((u-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}if(this._last=p,this._lastAt=u,Number.isFinite(c)&&c>0){let h=Math.min(100,Math.max(0,p/c*100));_(h);let f=this._rate!==void 0&&this._rate>=0?gs(this._rate):"";l(Math.round(h)+"%"+(f!==""?" \xB7 "+f:""))}else{r.style.width="";let h=this._rate!==void 0&&this._rate>=0?gs(this._rate):"";l(Ze(p)+(h!==""?" \xB7 "+h:""))}},pulse(p){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=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}this._last=p,this._lastAt=c;let u=this._rate!==void 0&&this._rate>=0?gs(this._rate):"";l((Number.isFinite(p)?Ze(p):"\u2026")+(u!==""?" \xB7 "+u:""))},done(p){e.dataset.active="",e.dataset.state="done",r.style.width="100%",d=100,m(),l(p!==void 0&&p!==""?p:w("status.done"))},fail(p){e.dataset.active="",e.dataset.state="error",m(),l(p!==void 0&&p!==""?p:w("status.failed"))},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",s.textContent=""):(e.dataset.active="",r.style.width="",d=-1,l(p))}}}async function sm(e,t,r,s=0,o=null,i=0){let n=s>0?s*1024*1024:0,a=Number.isFinite(i)&&i>0?i:0,d=typeof AbortController=="function"?new AbortController:null,l=!1;d!==null&&(t={...t,signal:d.signal},typeof o=="function"&&o(()=>{l=!0,d.abort()}));let _=a,m=null,y;try{if(y=await fetch(e,t),!y.ok){let S="HTTP "+y.status;try{let g=await y.json();g!==null&&typeof g=="object"&&typeof g.error=="string"&&(S=g.error)}catch{}throw new Error(S)}let p=Number(y.headers.get("content-length")),c=y.headers.get("content-range")??"",u=Number(/\/(\d+)\s*$/.exec(c)?.[1]);Number.isFinite(u)&&u>0?m=u:Number.isFinite(p)&&p>0&&(m=a+p);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(w("error.downloadTooBig",{size:Ze(n)}));return m!==null&&r(m,m),S}if(n>0&&m!==null&&m>n){try{await h.cancel()}catch{}throw new Error(w("error.downloadTooBig",{size:Ze(n)}))}let f=h.getReader(),v=[];for(;;){let{done:S,value:g}=await f.read();if(S)break;if(g!==void 0&&g.byteLength>0){if(_+=g.byteLength,n>0&&_>n){try{await f.cancel()}catch{}throw new Error(w("error.downloadTooBig",{size:Ze(n)}))}v.push(g),r(_,m!==null?m:NaN)}}return new Blob(v,{type:"application/octet-stream"})}catch(p){if(l||p!==null&&typeof p=="object"&&p.name==="AbortError")throw new es;if(p!==null&&typeof p=="object")throw p.received=_,p.total=m,p;let c=new Error(String(p));throw c.received=_,c.total=m,c}}async function Ah({url:e="/api/dsh-tty/sftp/download",makeBody:t,onProgress:r,maxMb:s=0,registerCancel:o=null,onResume:i=null}){let n=0,a=0;for(;;)try{return await sm(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t(n))},r,s,o,n)}catch(d){if(Jr(d))throw d;a+=1;let l=mc({received:d?.received??0,total:d?.total??null,attempt:a});if(!l.resume)throw d;n=l.offset,typeof i=="function"&&i(n)}}var es=class extends Error{constructor(){super(w("msg.canceled")),this.name="TransferCanceledError"}};function Jr(e){return e instanceof es}function Dh(e,t){let r=URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.download=t,s.click(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}async function Ph(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],r=[];for(let l of t){let _=typeof l.webkitGetAsEntry=="function"?l.webkitGetAsEntry():null;_!==null&&r.push(_)}if(r.length===0)return[...e.files??[]].map(l=>({relPath:l.name,file:l}));let s=[],o=Kt.maxUploadFiles,i=Kt.maxUploadMb>0?Kt.maxUploadMb*1024*1024:0,n=()=>o>0&&s.length>=o,a=0,d=(l,_)=>new Promise(m=>{if(n()){m();return}if(l.isFile===!0){l.file(c=>{i>0&&a+(c.size??0)>i?s._limitExceeded=!0:(s.push({relPath:_+l.name,file:c}),a+=c.size??0),m()},()=>m());return}if(l.isDirectory!==!0){m();return}let y=l.createReader(),p=()=>{y.readEntries(async c=>{if(c.length===0){m();return}for(let u of c){if(n())break;await d(u,_+l.name+"/")}if(n()){m();return}p()},()=>m())};p()});for(let l of r)await d(l,"");return s}function Qi(e,t){let r=Wr(t,ke);if(kh(r))return;let s=e!==null&&typeof e=="object"?e:{},o={};if(typeof s.name=="string"&&s.name!=="")o.name=s.name;else{for(let W of["host","username","auth","keyPath","passphrase","password"])typeof s[W]=="string"&&s[W]!==""&&(o[W]=s[W]);let k=Number(s.port);Number.isInteger(k)&&k>=1&&k<=65535&&(o.port=k),s.agentForward===!0&&(o.agentForward=!0)}let i=o.name??(o.username!==void 0?o.username+"@"+String(o.host??""):String(o.host??""));if(fh==="dual"){Q_(o,i,r);return}let n=document.createElement("div");n.className="tt_sftpCard";let a=document.createElement("div");a.className="tt_sftpTitleRow";let d=document.createElement("div");d.className="tt_sshTitle",d.innerHTML=Rs+"<span></span>",d.lastElementChild.textContent="SFTP \xB7 "+i;let l=document.createElement("button");l.type="button",l.className="tt_close",l.title=w("btn.close"),l.innerHTML=Vi,l.addEventListener("click",()=>ts(r)),a.appendChild(d),a.appendChild(l),n.appendChild(a);let _=document.createElement("div");_.className="tt_sftpBar";let m=document.createElement("input");m.type="text",m.className="tt_sftpPath",m.placeholder=w("placeholder.remotePath"),m.spellcheck=!1,m.autocomplete="off";let y=document.createElement("button");y.type="button",y.className="tt_toolBtn",y.innerHTML=Po+"<span>"+w("btn.refresh")+"</span>";let p=document.createElement("button");p.type="button",p.className="tt_toolBtn",p.innerHTML=Vc+"<span>"+w("btn.mkdir")+"</span>";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.innerHTML=Xp+"<span>"+w("btn.upload")+"</span>",c.title=w("btn.uploadTitle");let u=document.createElement("input");u.type="file",u.multiple=!0,u.style.display="none",_.appendChild(m),_.appendChild(y),_.appendChild(p),_.appendChild(c),n.appendChild(_),n.appendChild(u);let h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let f=document.createElement("input");f.type="text",f.className="tt_cardInput",f.spellcheck=!1,f.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=w("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=w("btn.cancel"),h.appendChild(f),h.appendChild(v),h.appendChild(S),n.appendChild(h);let g=null,x=()=>{h.style.display="none",g=null};v.addEventListener("click",()=>{g?.()}),S.addEventListener("click",x),f.addEventListener("keydown",k=>{k.key==="Enter"?(k.preventDefault(),g?.()):k.key==="Escape"&&(k.stopPropagation(),x())});let b=document.createElement("div");b.className="tt_sftpList",n.appendChild(b);let E=document.createElement("div");E.className="tt_sftpFoot";let P=document.createElement("div");P.className="tt_sftpStatus";let O=Mh();E.appendChild(O.el),E.appendChild(P),n.appendChild(E);let F={path:"",busy:!1},A=(k,W)=>{P.textContent=k,W===void 0?delete P.dataset.state:P.dataset.state=W},V=k=>{F.busy=k;for(let W of[y,p,c])W.disabled=k;m.disabled=k},B=async(k,W)=>{let q=await fetch("/api/dsh-tty/sftp/"+k,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...o,...W})}),j=await q.json().catch(()=>({}));if(!q.ok||j.ok!==!0)throw new Error(String(j.error||"HTTP "+q.status));return j},M=async(k,W)=>{if(!F.busy){V(!0),A(k,"busy");try{await W()}catch(q){A(String(q&&q.message?q.message:q),"error")}finally{V(!1)}}},U=(k,W,q,j)=>{let X=document.createElement("button");X.type="button",X.className="tt_sftpRow";let J=document.createElement("span");J.className="tt_sftpIcon",J.innerHTML=k,j!==void 0&&(J.dataset.kind=j);let ae=document.createElement("span");if(ae.className="tt_sftpName",ae.textContent=W,ae.title=W,X.appendChild(J),X.appendChild(ae),q!==""){let he=document.createElement("span");he.className="tt_sftpMeta",he.textContent=q,X.appendChild(he)}return X},I=(k,W,q,j)=>{let X=document.createElement("button");X.type="button",X.className="tt_sftpAct",X.innerHTML=W,X.title=q,X.addEventListener("click",J=>{J.stopPropagation(),j()}),k.appendChild(X)},C=(k,W,q)=>{let j=document.createElement("button");j.type="button",j.className="tt_sftpAct",j.innerHTML=qr,j.title=W.isDir?w("btn.deleteEntryDir",{name:W.name}):w("btn.deleteEntry",{name:W.name});let X=null;j.addEventListener("click",J=>{if(J.stopPropagation(),!F.busy){if(X!==null){clearTimeout(X),X=null,j.innerHTML=qr,delete j.dataset.danger,M(w("msg.deleting",{name:W.name}),async()=>{await B("remove",{path:q,recursive:W.isDir===!0}),await T(F.path),A(w("msg.deleted",{name:W.name}))});return}j.textContent=w("btn.confirm"),j.dataset.danger="",X=setTimeout(()=>{X=null,j.innerHTML=qr,delete j.dataset.danger},4e3)}}),k.appendChild(j)},L=k=>{if(b.textContent="",F.path!==""&&F.path!=="/"){let j=U(Ao,w("list.parentDir"),"","up");j.addEventListener("click",()=>{M(w("list.loading"),()=>T(Rh(F.path)))}),b.appendChild(j)}let W=Array.isArray(k)?k:[];if(W.length===0){let j=document.createElement("div");j.className="tt_addMenuTitle",j.textContent=w("list.emptyDir"),b.appendChild(j);return}let q=500;for(let j of W.slice(0,q)){if(j===null||typeof j!="object"||typeof j.name!="string"||j.name==="")continue;let X=vs(F.path,j.name),J=[];j.isDir===!0?J.push(w("meta.dir")):J.push(Ze(Number(j.size))||"\u2014");let ae=Th(Number(j.mtime));ae!==""&&J.push(ae);let he=U(j.isDir?Rs:j.isSymlink?Kc:qc,j.name,J.join(" \xB7 "),j.isDir===!0?"dir":j.isSymlink===!0?"link":"file");j.isDir===!0?he.addEventListener("click",_e=>{_e.target instanceof Element&&_e.target.closest(".tt_sftpAct")!==null||M(w("list.loading"),()=>T(X))}):(he.addEventListener("click",_e=>{_e.target instanceof Element&&_e.target.closest(".tt_sftpAct")!==null||D(j,X)}),I(he,Gc,w("btn.download",{name:j.name}),()=>{D(j,X)})),I(he,Do,w("btn.rename",{name:j.name}),()=>{f.placeholder=w("placeholder.newName"),f.value=j.name,h.style.display="",f.focus(),f.select(),g=async()=>{let _e=f.value.trim();_e===""||_e===j.name||(x(),await M(w("msg.renaming",{name:j.name}),async()=>{await B("rename",{from:X,to:vs(F.path,_e)}),await T(F.path)}))}}),C(he,j,X),b.appendChild(he)}if(W.length>q){let j=document.createElement("div");j.className="tt_addMenuTitle",j.textContent=w("list.truncated",{rest:W.length-q,total:W.length}),b.appendChild(j)}},T=async k=>{try{let W=await B("list",{path:k??F.path});F.path=typeof W.path=="string"&&W.path!==""?W.path:"/",m.value=F.path;let q=Array.isArray(W.entries)?W.entries.length:0;L(W.entries),A(F.path+" \u2014 "+w("list.itemCount",{count:q}))}catch(W){A(String(W&&W.message?W.message:W),"error")}},D=(k,W)=>M(w("msg.downloading",{name:k.name}),async()=>{O.reset();let q;try{q=await Ah({makeBody:j=>({...o,path:W,...j>0?{offset:j}:{}}),onProgress:(j,X)=>O.set(j,X),maxMb:Kt.maxDownloadMb,registerCancel:j=>O.setCancel(j),onResume:j=>A(w("msg.downloadResuming",{name:k.name,offset:Ze(j)||String(j)+" B"}),"busy")})}catch(j){if(Jr(j)){O.reset(),A(w("msg.downloadCanceled",{name:k.name}));return}throw O.fail(w("error.downloadFailed")),j}O.done(w("status.done")),Dh(q,k.name),setTimeout(()=>O.reset(),1500),A(w("msg.downloaded",{name:k.name,size:Ze(q.size)||String(q.size)+" B"}))}),N=(k,W,q,j,X)=>Lh(k,vs(F.path,W),{spec:o,label:(j>1?String(q)+"/"+String(j)+" ":"")+W,cancelRef:X,onProgress:(J,ae)=>{Number.isFinite(ae)&&ae>0?O.set(J,ae):O.pulse(J)},onLabel:J=>A(w("msg.uploadingName",{name:J}),"busy"),onDone:()=>{j===1&&O.done(w("msg.uploadDone"))}}).catch(J=>{throw Jr(J)||O.fail(w("error.uploadFailed")),J}),G=async k=>M(w("msg.uploading"),async()=>{let W=Kt;if(W.maxUploadFiles>0&&k.length>W.maxUploadFiles){A(w("error.uploadCountExceeded",{max:W.maxUploadFiles,count:k.length}),"error"),O.fail(w("status.overLimit"));return}let q=W.maxUploadMb>0?W.maxUploadMb*1024*1024:0,j=k.find(_e=>q>0&&(_e.file?.size??0)>q);if(j!==void 0){A(w("error.uploadTooBig",{size:Ze(q),name:String(j.relPath??"")}),"error"),O.fail(w("status.overLimit"));return}if(k._limitExceeded===!0){A(w("error.uploadTotalTooBig"),"error"),O.fail(w("status.overLimit"));return}let X=new Set;for(let _e of k){let Z=_e.relPath.lastIndexOf("/");if(Z<=0)continue;let Ce=_e.relPath.slice(0,Z);X.has(Ce)||(X.add(Ce),await B("mkdir",{path:vs(F.path,Ce),parents:!0}).catch(()=>{}))}O.reset();let J={stopped:!1,abort:null};O.setCancel(()=>J.abort?.());let ae=0,he=0;try{for(let _e of k){if(J.stopped)break;ae+=1,J.abort=null;try{await N(_e.file,_e.relPath,ae,k.length,J),he+=1}catch(Z){if(Jr(Z)||J.stopped)break;throw Z}}}finally{O.setCancel(null)}if(J.stopped){O.reset(),A(w("msg.uploadCanceled",{done:he,total:k.length})),await T(F.path);return}O.done(w("status.allDone")),setTimeout(()=>O.reset(),1500),A(w("msg.uploadDoneCount",{count:k.length})),await T(F.path)});y.addEventListener("click",()=>{M(w("list.loading"),()=>T(F.path))}),p.addEventListener("click",()=>{F.busy||(f.placeholder=w("placeholder.newDirName"),f.value="",h.style.display="",f.focus(),g=async()=>{let k=f.value.trim();k!==""&&(x(),await M(w("msg.creatingDir",{name:k}),async()=>{await B("mkdir",{path:vs(F.path,k)}),await T(F.path)}))})}),c.addEventListener("click",()=>{F.busy===!1&&u.click()}),u.addEventListener("change",()=>{let k=[...u.files??[]].map(W=>({relPath:W.name,file:W}));u.value="",k.length>0&&G(k)});let $=0,Y=k=>{k?b.dataset.drag="":delete b.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),!F.busy&&Ph(k.dataTransfer).then(W=>{(W.length>0||W._limitExceeded===!0)&&G(W)})}),m.addEventListener("keydown",k=>{if(k.key!=="Enter"||(k.preventDefault(),F.busy))return;let W=m.value.trim();W!==""&&M(w("list.loading"),()=>T(W))});let H=Io();Eh(n,"SFTP \xB7 "+i,H===null?340:Math.round(H.height*.46),r),M(w("status.connectingEllipsis"),()=>T(""))}function ts(e){let t=e===void 0?xh():e,r=Vt,s=It!==null&&It.ownerKey===t?It:null;if(r===null&&s===null)return;em();let o=wo;wo=null,o?.(),Vt=null,s!==null&&(It=null),r!==null&&r.remove(),s!==null&&s.dispose()}function Bh(){if(st===null)return;let e=st.style.display==="none"||st.style.display==="";st.style.display=e?"":"none";let t=ue!==null?ue.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&st.focus()}function im(){return{matchBackground:Te("--tt-term-search-match"),matchBorder:Te("--tt-term-search-match-border"),activeMatchBackground:Te("--tt-term-search-active"),activeMatchBorder:Te("--tt-term-search-active-border"),matchOverviewRuler:Te("--tt-term-search-match-border"),activeMatchColorOverviewRuler:Te("--tt-term-search-active-border")}}function nm(e){let t=vt();if(t===void 0||t.search===void 0)return;let r=st.value;if(r==="")return;let s={decorations:im()};e?t.search.findPrevious(r,s):t.search.findNext(r,s)}function Bc(){As||ue===null&&!Bo()||gr!==null||(gr=setTimeout(()=>{gr=null,$i()},xs),xs=Math.min(xs*2,5e3))}function zs(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Lo(e){return zs(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function om(){return ar==="tmux"?{t:"spawn",cwd:_o(),persist:!0,persistName:Wo()}:{t:"spawn",cwd:_o()}}async function Oh(){if(!ho){ho=!0;try{await am()}finally{ho=!1}}}var ho=!1;async function am(){if(await Uo(),ue===null){await cm();return}let e=d_(),t=h_();if(![...fe.values()].some(n=>n.embedded!==!0)){if(e.length>0||t.length>0){Pe({t:"sessions"});let n=await Hi("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 d=new Set;for(let l of e){if(a.has(l.sid))b_(l);else if(Lo(l.spawnSpec))Dc(l);else continue;zs(l.spawnSpec)&&d.add(l.spawnSpec.persistName)}for(let l of t){let _=l.spawnSpec.persistName;d.has(_)||(Dc(l),d.add(_))}lr()}if(![...fe.values()].some(n=>n.embedded!==!0)){if(await ji())return;Ds()}return}let r=[...fe.values()].filter(n=>!n.exited&&(n.embedded!==!0||n.spawned===!0)),s=r.filter(n=>Lo(n.spawnSpec)),o=null;if(s.length>0){Pe({t:"sessions"});let n=await Hi("sessions",4e3),a=vi(n!==null?n.list:[]);o=s.filter(d=>!a.has(d.sid));for(let d of o)Fi(d.sid)}let i=o!==null?new Set(o.map(n=>n.sid)):new Set;for(let n of r)i.has(n.sid)||Pe({t:"attach",sid:n.sid})}function lm(){Ae!==null&&(Ae.readyState===WebSocket.OPEN||Ae.readyState===WebSocket.CONNECTING)||$i()}async function cm(){let e=[...fe.values()].filter(s=>s.embedded===!0&&!s.exited);if(e.length===0)return;Pe({t:"sessions"});let t=await Hi("sessions",4e3),r=vi(t!==null?t.list:[]);for(let s of e)s.spawned===!0&&(r.has(s.sid)?Pe({t:"attach",sid:s.sid}):Lo(s.spawnSpec)?ch(s):(s.exited=!0,s.live=!1,Ur(s,w("status.ended"),w("btn.clickRerun"),"exited")))}function $i(){if(Ae!==null){try{Ae.close()}catch{}Ae=null}As=!1,clearTimeout(gr),gr=null,yi=!0,Si(w("status.connectingEllipsis"),"");try{Ae=new WebSocket(Hp())}catch(e){yi=!1,Si(w("error.connectFailed",{error:e.message}),"error"),Bc();return}Ae.onopen=()=>{yi=!1,xs=1e3,Ct=null,Si(w("status.connected"),"connected");for(let e of[...uo])uo.delete(e),fe.has(e.tab.sid)&&Pe(e.frame);Oh()},Ae.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=t.sid;if(t.t==="ready"){let s=typeof t.target=="string"?t.target:"";ao(r,t.kind==="ssh"?w("status.connectedSsh",{target:s!==""?s+" ":""}):w("status.connectedPid",{pid:t.pid}),"connected");let o=fe.get(r);if(o!==void 0){if(o.exited=!1,o.spawned=!0,o.live=!0,o.errored=!1,o.target=s,o.persistTmux=t.persist===!0,t.kind==="ssh"&&s!==""&&!o.label&&(o.label=s,ht()),br(),lo(r),Ur(o,""),rs(o),t.persist===!0){let i=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([i,new Promise(n=>setTimeout(n,500))]).then(()=>sh(150))}Bs(),o_(r),lr()}}else if(t.t==="sessions")v_(t.list);else if(t.t==="data"){let s=fe.get(r);s!==void 0&&s.term!==null&&(s.term.write(String(t.d??"")),pm())}else if(t.t==="exit"){let s=fe.get(r);if(s!==void 0){s.exited=!0,s.live=!1,s.stats=null,r===ke&&xr();let o=t.code!==null&&t.code!==void 0?"code="+t.code:"",i=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";ao(r,w("status.exitedWith",{detail:[o,i].filter(Boolean).join(" ")}),""),br(),lo(r),Ur(s,w("status.exited"),w("btn.clickReopen"),"exited"),Bs(),lr()}}else if(t.t==="stats")try{let s=fe.get(r);if(s!==void 0){let o=t.stats;s.stats=kc(o)?o:null,s.statsAt=Date.now(),r===ke&&xr()}}catch(s){console.warn("[dsh-tty] stats \u5E27\u5904\u7406\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: "+(s instanceof Error?s.message:String(s)))}else if(t.t==="hint"){if(!Oi||t.kind!=="failure"||typeof r!="string"||r==="")return;cr.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===ke&&kr()}else if(t.t==="error")if(ao(r,w("status.error",{message:String(t.m??"")}),"error"),typeof r=="string"){let s=fe.get(r);s!==void 0&&(s.live||(s.errored=!0),br(),lo(r),Ur(s,w("status.errored"),w("status.retryHint",{message:String(t.m??"")}),"error"))}else hm(w("btn.clickRetry"))},Ae.onclose=()=>{if(yi=!1,!As){Si(w("status.disconnectedReconnecting"),"error");for(let e of fe.values())e.exited||Ur(e,w("status.disconnected"),w("status.reconnecting"),"info");Bc()}},Ae.onerror=()=>{}}function hm(e){Kr!==null&&(Kr.textContent=e)}function To(){(ue===null||Ve)&&Mo()}var xi="DSH_TTY_ALLOW_PROXY_COMMAND";function dm(e){let t=new Date(Number(e)*1e3);if(Number.isNaN(t.getTime()))return String(e);let r=s=>String(s).padStart(2,"0");return`${String(t.getFullYear())}-${r(t.getMonth()+1)}-${r(t.getDate())} ${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`}function zo(){return typeof navigator<"u"&&navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText=="function"}async function Ro(e){if(zo())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||Fs(w("error.copyFailed"),"error"),r}async function um(e){if(zo()&&typeof navigator.clipboard.readText=="function")try{let s=await navigator.clipboard.readText();return s!==""&&Pe({t:"input",sid:e.sid,d:s}),!0}catch{}let t=document.createElement("textarea");t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus();let r=!1;try{r=document.execCommand("paste");let s=r?t.value:"";s!==""&&Pe({t:"input",sid:e.sid,d:s})}catch{r=!1}return t.remove(),r||Fs(w("error.pasteFailed"),"error"),r}function Mo(){if(ue!==null){Ve&&Ih();return}Is(),ue=document.createElement("div"),ue.className="tt_modalBackdrop",ue.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+Gi+'</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">'+w("status.initializing")+'</span></div><input class="tt_searchInput" style="display:none" placeholder="'+w("placeholder.search")+'" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="'+w("btn.searchTitle")+'">'+zp+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="'+w("btn.clearTitle")+'">'+jp+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="'+w("btn.copyTitle")+'">'+$p+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="'+w("btn.pasteTitle")+'">'+qp+'</button></span><span class="tt_winGroup"><button class="tt_min" title="'+w("btn.minimizeTitle")+'">'+Vp+'</button><button class="tt_close" title="'+w("btn.closePanelTitle")+'">'+Vi+'</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><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(ue),Mi=ue.querySelector(".tt_status"),mr=ue.querySelector(".tt_statusText"),yr=ue.querySelector(".tt_statusDot"),Re=ue.querySelector(".tt_tabs");let e=ue.querySelector(".tt_tabAdd");e!==null&&(e.title=w("btn.newTab"),e.innerHTML=Yp,e.addEventListener("click",()=>{N_(e)})),Bt=ue.querySelector(".tt_tabMore"),Bt!==null&&(Bt.innerHTML=$c,Bt.title=w("btn.tabList"),Bt.addEventListener("click",()=>{H_(Bt)})),Re.addEventListener("scroll",vo),Re.addEventListener("wheel",R_,{passive:!1}),ws=ue.querySelector(".tt_connbar"),ys=ue.querySelector(".tt_connDot"),Ai=ue.querySelector(".tt_connTarget"),_t=ue.querySelector(".tt_connBadge"),Ss=ue.querySelector(".tt_connActions"),mt=ue.querySelector(".tt_work"),lt=ue.querySelector(".tt_body"),St=ue.querySelector(".tt_statsBar"),Ji(),Ct=null,eh(),Kr=ue.querySelector(".tt_body > .tt_overlay"),ir=ue.querySelector(".tt_assistBadge"),ir!==null&&ir.addEventListener("click",()=>{ir!==null&&G_(ir)}),kt(),kr(),st=ue.querySelector(".tt_searchInput"),Kr.addEventListener("click",()=>{Kr.textContent="",$i()});let t=ue.querySelector("[data-act=search]");t.addEventListener("click",()=>{Bh(),st.style.display!=="none"&&st.focus()}),t.dataset.on="",st.addEventListener("keydown",r=>{r.key==="Enter"?(r.preventDefault(),nm(r.shiftKey)):r.key==="Escape"&&(r.stopPropagation(),st.style.display="none")}),ue.querySelector("[data-act=clear]").addEventListener("click",()=>{let r=vt();r!==void 0&&r.term!==null&&r.term.clear()}),ue.querySelector("[data-act=copy]").addEventListener("click",()=>{let r=vt();if(r===void 0||r.term===null)return;let s=r.term.getSelection();s!==""&&Ro(s)}),ue.querySelector("[data-act=paste]").addEventListener("click",()=>{let r=vt();r!==void 0&&um(r)}),ue.querySelector(".tt_min").addEventListener("click",()=>{qi()}),ue.querySelector(".tt_close").addEventListener("click",()=>{Os()}),ue.addEventListener("mousedown",r=>{r.target===ue&&qi()}),document.addEventListener("keydown",Nh),Cs=new ResizeObserver(()=>{Ve||(ki(),f_(vt()),vo())}),Cs.observe(lt),ht(),br(),Ae!==null&&Ae.readyState===WebSocket.OPEN?Oh():$i()}function fm(){Qe=document.createElement("div"),Qe.className="tt_dock",Qe.title=w("btn.restoreDock"),Qe.innerHTML='<span class="tt_dockTitle">'+Gi+"<span>"+w("panel.title")+'</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="'+w("btn.closePanelTitle")+'">'+Yi+"</button>",Di=Qe.querySelector(".tt_dockCount"),Qr=Qe.querySelector(".tt_dockStatus"),Sr=Qe.querySelector(".tt_dockDot");let e=[...fe.values()].filter(t=>!t.exited).length;Di.textContent=fe.size>0?"\xB7 "+e+"/"+fe.size:"",mr!==null&&(Qr.textContent=mr.textContent),yr!==null&&(Sr.dataset.state=yr.dataset.state??""),Qe.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),Os();return}Ih()}),document.body.appendChild(Qe)}function qi(){ue===null||Ve||(yt(),Xt(),kt(),nr(),Ve=!0,Vt!==null&&(Vt.style.display="none"),st!==null&&(st.style.display="none"),ue.dataset.minimized="",th(),Ws(),xr(),document.querySelector("[data-dsh-tty-entry]")!==null?Bs():(fm(),Qe.classList.add("tt_dockCompact")))}function Bs(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Ve){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=w("status.minimized");let r=[...fe.values()].filter(o=>!o.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=r+"/"+fe.size;let s=t.querySelector(".tt_sidebarBadgeDot");s!==null&&yr!==null&&(s.dataset.state=yr.dataset.state??"")}function pm(){if(!Ve)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Sr;e!==null&&(e.dataset.active="",clearTimeout(Pi),Pi=setTimeout(()=>{delete e.dataset.active},900))}function Ih(){if(ue===null||!Ve)return;Ve=!1,delete ue.dataset.minimized,Vt!==null&&(Vt.style.display=""),clearTimeout(Pi),Qe!==null&&(Qe.remove(),Qe=null),Di=null,Qr=null,Sr=null,Bs(),eh(),Ws(),xr();let e=vt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&rs(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Os(){if(ue===null)return;Ls(!0);let e=Bo();if(As=!e,Ve=!1,yt(),Xt(),kt(),Ei(),Ui(),nr(),ts(),clearTimeout(Pi),clearTimeout(gr),gr=null,xs=1e3,Qe!==null&&(Qe.remove(),Qe=null),Di=null,Qr=null,Sr=null,Bs(),Ae!==null){for(let t of fe.values())!t.exited&&t.embedded!==!0&&Pe({t:"kill",sid:t.sid});if(!e){try{Ae.close()}catch{}Ae=null}}Cs!==null&&(Cs.disconnect(),Cs=null);for(let[t,r]of[...fe])if(r.embedded!==!0){if(r.term!==null)try{r.term.dispose()}catch{}fe.delete(t)}ke=null,Ms=null,document.removeEventListener("keydown",Nh),ue.remove(),ue=null,mt=null,Mi=null,mr=null,yr=null,Re=null,Bt=null,ws=null,ys=null,Ai=null,_t=null,Ss=null,Ui(),th(),St=null,Ji(),Ct=null,lt=null,Kr=null,st=null,Hs=0;try{sessionStorage.removeItem(Bi)}catch{}}function Nh(e){if(e.key==="Escape"&&ue!==null){if(e.preventDefault(),Vt!==null){ts();return}if(Vr!==null){nr();return}if(gt!==null){yt();return}qi()}}function _m(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function mm(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 gm(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label",w("panel.title")),e.tabIndex=0,e.innerHTML='<span class="tt_sidebarEntryIcon">'+Gi+'</span><span class="tt_sidebarEntryLabel">'+w("panel.title")+"</span>",e.addEventListener("click",t=>{t.preventDefault(),Mo()}),e.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" "||t.key==="Spacebar")&&(t.preventDefault(),Mo())}),e}function Oc(e,t){let r=mm(e);if(r===void 0)return!1;if(t.parentElement!==e){let s=r.closest('[class*="logoRow"]'),o=s!==null&&s.parentElement===e?s:r,i=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(i.length>0){let n=i[i.length-1];e.insertBefore(t,n.nextSibling)}else e.insertBefore(t,o.nextElementSibling)}return!0}function vm(){if(Is(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=gm(),t,r=!1,s=()=>{if(t!==void 0&&!t.isConnected&&(i.disconnect(),t=void 0,r=!1),r){if(document.body.contains(e))return;i.disconnect(),t=void 0,r=!1}t??(t=_m()),t!==void 0&&(r=Oc(t,e),r&&i.observe(t,{childList:!0,subtree:!0}))},o=new MutationObserver(()=>{s()});o.observe(document.body,{childList:!0,subtree:!0});let i=new MutationObserver(()=>{if(t===void 0||!t.isConnected){r=!1,s();return}t.contains(e)||(r=Oc(t,e))});return s(),()=>{o.disconnect(),i.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},r=e("react"),{jsx:s,jsxs:o}=e("react/jsx-runtime"),i="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function n(d){let l=d&&d.view,_=l==="page",[m,y]=r.useState(_),[p,c]=r.useState(null),[u,h]=r.useState(!1),[f,v]=r.useState(!1),[S,g]=r.useState({kind:"",text:""}),[x,b]=r.useState(null),[E,P]=r.useState(""),[O,F]=r.useState(!1),[A,V]=r.useState(Date.now()),B=r.useRef(null),M=r.useRef(null),[U,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(0),H=R=>s("div",{className:"tt_cardSection",children:R}),k=async()=>{try{let z=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();z.ok&&typeof z.config=="object"&&z.config!==null?(B.current=z.config,M.current=JSON.stringify(J(z.config)),c(z.config),Ps(z.config)):g({kind:"error",text:String(z.error||w("error.configLoadFailed"))})}catch(R){g({kind:"error",text:String(R&&R.message?R.message:R)})}},W=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{}};r.useLayoutEffect(()=>{if(!N)return;let R=()=>{let z=$.current,K=z===null||z.parentElement===null?null:z.parentElement.querySelector(".tt_routeList");z===null||K===null||(K.style.width=String(Math.round(z.getBoundingClientRect().width))+"px",Us(K,z))};return R(),window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[N,T.loading,T.failed,T.groups]);let q=async()=>{let R=Y.current+1;Y.current=R,D(z=>({...z,loading:!0}));try{let K=await(await fetch("/api/dsh-tty/model-catalog",{cache:"no-store"})).json();if(K.ok===!0&&R===Y.current){D({groups:Array.isArray(K.groups)?K.groups:[],loading:!1,failed:!1});return}}catch{}R===Y.current&&D({groups:[],loading:!1,failed:!0})};r.useEffect(()=>{m&&!u&&(h(!0),k(),W(),q())},[m]);let j=(R,z)=>c(K=>{let ee={...K||{},[R]:z};return B.current=ee,ee}),X=new Set(["toolsRegistered","platform","allowProxyCommandGranted","allowProxyCommandGrantSource","allowProxyCommandGrantedAt"]),J=R=>{let z={};for(let[K,ee]of Object.entries(R||{}))X.has(K)||ee!==void 0&&(z[K]=ee);return z.sshHosts=Array.isArray(R?.sshHosts)?R.sshHosts:[],z.tunnels=Array.isArray(R?.tunnels)?R.tunnels:[],R?.sftpLimits&&typeof R.sftpLimits=="object"&&(z.sftpLimits={maxDownloadMb:Number(R.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(R.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(R.sftpLimits.maxUploadFiles)||0}),z};B.current=p;let ae=(R,z)=>c(K=>({...K||{},sftpLimits:{...K?.sftpLimits??{},[R]:z}})),[he,_e]=r.useState(null),[Z,Ce]=r.useState(null),[He,Ee]=r.useState(""),[Oe,Ue]=r.useState(null),[te,de]=r.useState(""),[ve,Q]=r.useState(""),[se,oe]=r.useState(""),re=r.useRef(null),[ne,ce]=r.useState(!1),[le,ge]=r.useState({text:"",kind:""}),[we,Le]=r.useState(!1),[ye,be]=r.useState({running:!1,ok:!1,text:""}),[xe,Fe]=r.useState({}),[tt,Er]=r.useState([]),[it,hr]=r.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""}),[Et,is]=r.useState(null);r.useEffect(()=>{if(!m)return;let R=!0,z=async()=>{try{let ie=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();R&&ie.ok&&Array.isArray(ie.tunnels)&&Er(ie.tunnels)}catch{}};z();let K=setInterval(z,2e3);return()=>{R=!1,clearInterval(K)}},[m]);let dr=R=>z=>hr(K=>({...K||{},[R]:z.target.value})),jo=(R,z)=>hr(K=>({...K||{},[R]:z})),Hh=R=>R?.direction==="remote"?w("meta.tunnelRemote",{host:R.remoteHost||"127.0.0.1",port:String(R.remotePort??0),local:String(R.localTargetPort??0)}):w("meta.tunnelLocal",{local:String(R?.localPort??0),host:R?.remoteHost??"?",port:String(R?.remotePort??0)}),$o=(p?.sshHosts??[]).find(R=>R?.name===it?.bookName),en=async R=>{try{let z=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:R})}),K=await z.json().catch(()=>({}));return!z.ok||!K.ok?(g({kind:"error",text:String(K.error||w("error.saveTunnelFailed"))}),{ok:!1,warnings:[]}):{ok:!0,warnings:Array.isArray(K.warnings)?K.warnings.map(ie=>String(ie)).filter(ie=>ie!==""):[]}}catch(z){return g({kind:"error",text:String(z&&z.message?z.message:z)}),{ok:!1,warnings:[]}}},qo=(R,z)=>{if(R.warnings.length>0){g({kind:"warn",text:R.warnings.join(" ")});return}g({kind:"ok",text:z})},Ko=()=>cc(it,(Array.isArray(p?.sshHosts)?p.sshHosts:[]).map(R=>R?.name),w),Fh=R=>{g({kind:"",text:""}),is(String(R?.name??"")),hr({direction:R?.direction==="remote"?"remote":"local",bookName:String(R?.bookName??""),localPort:R?.localPort?String(R.localPort):"",remoteHost:String(R?.remoteHost??""),remotePort:R?.remotePort?String(R.remotePort):"",localTargetPort:R?.localTargetPort?String(R.localTargetPort):""})},Wh=()=>{is(null),g({kind:"",text:""}),hr(R=>({...R||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))},Uh=()=>{g({kind:"",text:""});let R=Ko();if(!R.ok){g({kind:"error",text:R.error});return}let z=R.tunnel,K=Array.isArray(p?.tunnels)?p.tunnels:[];if(hc(K,z.name)!==void 0){g({kind:"error",text:w("error.tunnelNameTaken",{name:z.name})});return}let ee=[...K,z];c(ie=>({...ie||{},tunnels:ee})),hr(ie=>({...ie||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),en(ee).then(ie=>{ie.ok&&qo(ie,w("msg.tunnelApplied",{name:z.name}))})},zh=()=>{if(Et===null)return;g({kind:"",text:""});let R=Ko();if(!R.ok){g({kind:"error",text:R.error});return}let z=Array.isArray(p?.tunnels)?p.tunnels:[],K=dc(z,Et,R.tunnel,w);if(!K.ok){K.reason==="missing"&&is(null),g({kind:"error",text:K.error});return}let ee=K.tunnels;c(ie=>({...ie||{},tunnels:ee})),en(ee).then(ie=>{if(ie.ok!==!0){c(pe=>({...pe||{},tunnels:z}));return}is(null),hr(pe=>({...pe||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),qo(ie,w("msg.tunnelUpdated",{name:R.tunnel.name}))})},Go=(R,z)=>{c(K=>({...K||{},tunnels:R})),en(R).then(K=>{if(K.ok!==!0){c(ee=>({...ee||{},tunnels:z}));return}K.warnings.length>0&&g({kind:"warn",text:K.warnings.join(" ")})})},jh=R=>{let z=Array.isArray(p?.tunnels)?p.tunnels:[];Et!==null&&String(R??"")===Et&&(is(null),hr(K=>({...K||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))),Go(z.filter(K=>K?.name!==R),z)},$h=(R,z)=>{let K=Array.isArray(p?.tunnels)?p.tunnels:[];Go(K.map(ee=>ee?.name===R?{...ee,enabled:z}:ee),K)},qh=R=>{_e(R?.name??null),Ee(""),be({running:!1,ok:!1,text:""}),de(""),Q(""),rn(),ce(Ot!==null),Ce({name:R?.name??"",host:R?.host??"",port:String(R?.port??22),username:R?.username??"",auth:R?.auth==="key"||R?.auth==="password"?R.auth:"agent",keyPath:R?.keyPath??"",passphrase:R?.passphrase??"",password:R?.password??"",agentForward:R?.agentForward===!0,hostKeyAlias:R?.hostKeyAlias??"",persist:R?.persist!==!1}),Fc().then(z=>Ue(z)),sn(R?.password??"")},Vo=()=>{_e(null),Ce(null),Ee(""),be({running:!1,ok:!1,text:""}),de(""),Q(""),rn()},Kh=async()=>{if(Z===null)return;let R=Z.name.trim(),z=Z.host.trim(),K=Z.username.trim();if(R===""||z===""||K===""){Ee(w("error.nameHostUserRequired"));return}let ee=Number(Z.port);if((!Number.isInteger(ee)||ee<1||ee>65535)&&(ee=22),(p?.sshHosts??[]).some(pe=>pe?.name===R&&R!==he)){Ee(w("error.bookNameTaken",{name:R}));return}if(Z.auth==="key"&&Z.keyPath.trim()===""){Ee(w("error.keyPathRequired"));return}Ee("");let ie=Z.password;if(Z.auth==="password"){let pe=await zc(ne,Z.password,z,ee,K,"PASSWORD");if(pe.error!==void 0){Ee(pe.error);return}pe.value!==void 0&&(ie=pe.value)}c(pe=>({...pe||{},sshHosts:(Array.isArray(pe?.sshHosts)?pe.sshHosts:[]).map(Se=>Se?.name===he?{name:R,host:z,port:ee,username:K,auth:Z.auth,keyPath:Z.keyPath.trim(),passphrase:Z.passphrase,password:ie,agentForward:Z.agentForward,hostKeyAlias:String(Z.hostKeyAlias??"").trim(),persist:Z.persist===!0}:Se)})),Fe(pe=>{let Se={...pe};return delete Se[R],he!==R&&delete Se[he],Se}),_e(null),Ce(null),be({running:!1,ok:!1,text:""}),g({kind:"ok",text:w("msg.hostEdited",{name:R})})},Gh=R=>{he===R&&Vo(),Fe(z=>{let K={...z};return delete K[R],K}),c(z=>({...z||{},sshHosts:(Array.isArray(z?.sshHosts)?z.sshHosts:[]).filter(K=>K?.name!==R)}))},Vh=async R=>{let z=R?.name??"";if(z==="")return;let K={host:R?.host??"",port:Number(R?.port)||22,username:R?.username??"",auth:R?.auth==="key"||R?.auth==="password"?R.auth:"agent",keyPath:R?.keyPath??"",passphrase:R?.passphrase??"",password:R?.password??"",agentForward:R?.agentForward===!0,hostKeyAlias:typeof R?.hostKeyAlias=="string"?R.hostKeyAlias:""};Fe(ie=>({...ie,[z]:{running:!0,text:w("msg.probing")}}));let ee=await So(K,!0);Fe(ie=>{let pe=ie[z]||{};if(ee.result){let Se=ee.result.auth?.ok===!0;return{...ie,[z]:{running:!1,ok:Se,text:Co(ee.result)}}}return{...ie,[z]:{running:!1,ok:!1,text:w("error.probeFailed",{detail:String(ee.error||w("error.unknown"))})}}})},Yh=async R=>{let z=(Array.isArray(p?.hostKeys)?p.hostKeys:[]).filter(K=>!(K?.host===R?.host&&Number(K?.port)===Number(R?.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})}),ee=await K.json().catch(()=>({}));!K.ok||!ee.ok?g({kind:"error",text:String(ee.error||w("error.hostKeyDeleteFailed"))}):g({kind:"ok",text:w("msg.hostKeyDeleted")})}catch(K){g({kind:"error",text:String(K&&K.message?K.message:K)})}},Xh=async()=>{g({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!z.ok){g({kind:"error",text:String(z.error||w("error.sshConfigReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],ee=[...Array.isArray(p?.sshHosts)?p.sshHosts:[]],ie=new Set(ee.map(Be=>Be?.name)),pe=0,Se=0;for(let Be of K)if(!(Be===null||typeof Be!="object"||typeof Be.name!="string")){if(ie.has(Be.name)){Se+=1;continue}ie.add(Be.name),ee.push({name:Be.name,host:String(Be.host??Be.name),port:Number(Be.port)||22,username:String(Be.username??""),auth:Be.auth==="key"?"key":"agent",keyPath:String(Be.keyPath??""),passphrase:"",password:"",agentForward:!1,hostKeyAlias:typeof Be.hostKeyAlias=="string"?Be.hostKeyAlias:""}),pe+=1}c(Be=>({...Be||{},sshHosts:ee}));let me=Array.isArray(z.proxy)?z.proxy.filter(Be=>typeof Be=="string"):[],Ye=Number.isInteger(z.proxyCount)?z.proxyCount:me.length,ur=Array.isArray(z.proxyCommand)?z.proxyCommand.filter(Be=>typeof Be=="string"):[],et=Number.isInteger(z.proxyCommandCount)?z.proxyCommandCount:ur.length,Tr=Number.isInteger(z.skippedOther)?z.skippedOther:0,Jt=Number.isInteger(z.droppedOverflow)?z.droppedOverflow:0,bt=[];Ye>0&&bt.push(w("msg.proxySkipped",{count:Ye,names:me.slice(0,5).join(w("list.separator"))+(Ye>5?w("meta.etc"):"")})),et>0&&bt.push(w("msg.proxyCommandSkipped",{count:et,names:ur.slice(0,5).join(w("list.separator"))+(et>5?w("meta.etc"):"")})),Tr>0&&bt.push(w("msg.skippedNotConcrete",{count:Tr})),Jt>0&&bt.push(w("msg.importOverflow",{count:Jt}));let ra=bt.length>0?w("list.separatorFull")+bt.join(w("list.separatorFull")):"";if(pe===0){let Be=Se>0?w("msg.noNewEntries",{count:Se}):w("msg.noImportableHosts");g({kind:bt.length>0?"error":"ok",text:Be+ra})}else g({kind:bt.length>0?"error":"ok",text:w("msg.importedHosts",{added:pe,skipped:Se})+ra})}catch(R){g({kind:"error",text:String(R&&R.message?R.message:R)})}},Yo=R=>R===null||typeof R!="object"?[]:Array.isArray(R.fingerprints)?R.fingerprints.filter(z=>typeof z=="string"&&z!==""):typeof R.fingerprint=="string"&&R.fingerprint!==""?[R.fingerprint]:[],Jh=async()=>{g({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!z.ok){g({kind:"error",text:String(z.error||w("error.knownHostsReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],ee=[...Array.isArray(p?.hostKeys)?p.hostKeys:[]],ie=new Map;for(let me of ee)me===null||typeof me!="object"||ie.set(String(me.host??"")+":"+String(me.port??22),{record:me,fps:new Set(Yo(me))});let pe=0,Se=0;for(let me of K){if(me===null||typeof me!="object"||typeof me.host!="string")continue;let Ye=Array.isArray(me.fingerprints)?me.fingerprints.filter(Jt=>typeof Jt=="string"&&Jt!==""):[];if(typeof me.fingerprint=="string"&&me.fingerprint!==""&&Ye.push(me.fingerprint),Ye.length===0)continue;let ur=me.host+":"+String(me.port??22),et=ie.get(ur);if(et!==void 0){let Jt=!1;for(let bt of Ye)et.fps.has(bt)||et.fps.size>=8||(et.fps.add(bt),Jt=!0);if(!Jt){Se+=1;continue}delete et.record.fingerprint,et.record.fingerprints=[...et.fps],pe+=1;continue}let Tr={host:me.host,port:Number(me.port)||22,fingerprints:[...new Set(Ye)].slice(0,8)};ie.set(ur,{record:Tr,fps:new Set(Tr.fingerprints)}),ee.push(Tr),pe+=1}if(pe===0){g({kind:"ok",text:Se>0?w("msg.noNewFingerprints",{count:Se}):w("msg.noImportableKnownHosts")});return}c(me=>({...me||{},hostKeys:ee}));try{let me=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:ee})}),Ye=await me.json().catch(()=>({}));if(!me.ok||!Ye.ok){g({kind:"error",text:String(Ye.error||w("error.saveHostKeysFailed"))});return}g({kind:"ok",text:w("msg.importedFingerprints",{added:pe,skipped:Se})+(z.truncated===!0?w("hint.knownHostsTruncated"):"")})}catch(me){g({kind:"error",text:String(me&&me.message?me.message:me)})}}catch(R){g({kind:"error",text:String(R&&R.message?R.message:R)})}},Xo=async R=>{let z=R??B.current??p;v(!0),g({kind:"",text:""});let K=J(z);try{let ee=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(K)}),ie=await ee.json();!ee.ok||!ie.ok?g({kind:"error",text:String(ie.error||w("error.saveFailed"))}):(g({kind:"ok",text:w("msg.saved")}),M.current=JSON.stringify(K),ie.config&&(B.current=ie.config,c(ie.config),Ps(ie.config)))}catch(ee){g({kind:"error",text:String(ee&&ee.message?ee.message:ee)})}v(!1)},tn=R=>"/api/dsh-tty/elevate"+R,Jo=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(ee=>{if(ee===null)return ee;let ie={...ee,allowProxyCommandGranted:K.allowProxyCommandGranted===!0,allowProxyCommandGrantSource:K.allowProxyCommandGrantSource??null,allowProxyCommandGrantedAt:Number.isFinite(K.allowProxyCommandGrantedAt)?K.allowProxyCommandGrantedAt:null};return B.current=ie,ie})}catch{}},Zo=async()=>{b(null),F(!1);let R=B.current||{},z=M.current!==null&&JSON.stringify(J(R))===M.current,K={...R,allowProxyCommand:!0};B.current=K,c(K),await Jo(),z?(await Xo(K),P(w("elev.granted"))):P(w("elev.grantedNeedSave"))},Qo=async()=>{F(!1),P(""),b({phase:"loading"});try{let R=await fetch(tn(""),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:xi})}),z=await R.json().catch(()=>({}));if(!R.ok){b({phase:"error",error:String(z.error||R.status)});return}if(z.status==="granted"){await Zo();return}b({phase:"pending",command:String(z.command??""),expiresAt:Number(z.expiresAt)||0})}catch(R){b({phase:"error",error:String(R&&R.message?R.message:R)})}},Zh=async()=>{P("");try{let R=await fetch(tn("/revoke"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:xi})}),z=await R.json().catch(()=>({}));if(!R.ok){P(w("elev.error")+String(z.error||R.status));return}await Jo(),P(w("elev.revoked"))}catch(R){P(w("elev.error")+String(R&&R.message?R.message:R))}},Qh=async()=>{let R=x===null?"":String(x.command??"");if(R!==""){if(zo())try{await navigator.clipboard.writeText(R),F(!0);return}catch{}F(!1),P(w("elev.copyManual"))}};r.useEffect(()=>{if(x===null||x.phase!=="pending")return;let R=setInterval(()=>V(Date.now()),1e3),z=setInterval(()=>{fetch(tn("/status"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:xi})}).then(K=>K.json()).then(K=>{K.status==="granted"&&Zo()}).catch(()=>{})},1500);return()=>{clearInterval(R),clearInterval(z)}},[x]);let ed=()=>{if(p.allowProxyCommandGrantSource==="env")return s("span",{className:"tt_cardHint",children:w("elev.viaEnv")});let R=p.allowProxyCommandGrantedAt;return o("span",{className:"tt_capState",children:[Number.isFinite(R)?s("span",{children:w("elev.grantedAt",{time:dm(R)})}):null,s("button",{type:"button",className:"tt_toolBtn tt_capRevoke",onClick:()=>{Zh()},children:w("elev.revoke")})]})},td=()=>{let R=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,ee=()=>{b(null),F(!1)};return o("div",{className:"tt_elevPanel",children:[o("div",{className:"tt_elevHead",children:[s("span",{className:"tt_cardLabel",children:w("elev.title")}),s("button",{type:"button",className:"tt_toolBtn",onClick:ee,children:w("elev.close")})]}),s("span",{className:"tt_cardHint",children:w("elev.lockedWhy")}),x.phase==="error"?s("span",{className:"tt_cardHint tt_sshProbeWarn",children:w("elev.error")+String(x.error??"")}):null,x.phase==="loading"?s("span",{className:"tt_cardHint",children:w("elev.loading")}):null,R===""?null:o("div",{className:"tt_elevSteps",children:[s("span",{className:"tt_cardHint",children:w("elev.step")}),s("div",{className:"tt_elevCommand",children:s("code",{children:R})}),o("div",{className:"tt_elevActions",children:[s("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Qh()},children:w(O?"elev.copied":"elev.copy")}),K?s("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Qo()},children:w("elev.regenerate")}):s("span",{className:"tt_cardHint",children:w("elev.expiresIn",{sec:z})})]}),s("span",{className:"tt_cardHint",children:w(K?"elev.expired":"elev.waiting")})]}),p.allowProxyCommand===!0&&p.allowProxyCommandGranted!==!0?s("button",{type:"button",className:"tt_toolBtn",onClick:()=>{j("allowProxyCommand",!1),ee()},children:w("elev.disableFirst")}):null,s("span",{className:"tt_cardHint",children:w("elev.otherWay")}),s("span",{className:"tt_cardHint",children:w("elev.envHow",{env:xi})})]})},rd=()=>{let R=p.allowProxyCommandGranted===!0,z=p.allowProxyCommand===!0;return o("div",{className:"tt_capBlock",children:[o("label",{className:"tt_cardField tt_cardRow tt_cardToggle tt_cardDanger",children:[s("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z,onChange:K=>{if(!R){Qo();return}j("allowProxyCommand",K.target.checked)}}),s("span",{className:"tt_cardLabel",children:w("check.allowProxyCommand")}),z&&!R?s("span",{className:"tt_badgeWarn",children:w("badge.notEffective")}):null]}),s("span",{className:"tt_cardHint",children:w("hint.allowProxyCommand")}),R?ed():s("span",{className:"tt_cardHint tt_sshProbeWarn",children:w("hint.proxyCommandNotGranted")}),E===""?null:s("span",{className:"tt_cardHint",children:E}),x===null?null:td()]})},rn=()=>{re.current!==null&&(clearTimeout(re.current),re.current=null),oe("")},sn=async R=>{let z=$r(R);if(Zr()===null){ce(!1),Le(!1),ge({text:w(Ot===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),kind:"muted"});return}if(z===""){Le(!1),ge({text:"",kind:""});return}let K=await Wc(z);if(K.unreported===!0){Le(!1),ge({text:w("status.credUnreported",{ref:z}),kind:"plain"});return}if(K.error!==void 0){Le(!1),ge({text:w("error.credStatusFailed",{error:K.error}),kind:"error"});return}let ee=K.view;ge({text:ee.configured?w("status.credStored",{ref:z,source:ee.source!==""?w("meta.credSource",{source:ee.source}):""}):w("status.credUnknown",{ref:z}),kind:ee.configured?"ok":"plain"}),Le(ee.configured===!0&&ee.writable===!0)},sd=async()=>{let R=$r(Z?.password??"");if(R==="")return;let z=await Uc(R);if(z.error!==void 0){ge({text:z.error,kind:"error"});return}Ce(K=>({...K||{},password:""})),ge({text:"",kind:""}),Le(!1)},id=(R,z)=>{let K=String(Z?.[R]??"");if(K===""||K.startsWith("env:")||se===z){rn(),Ce(ee=>({...ee||{},[R]:"env:"+z})),de(""),R==="password"&&sn("env:"+z);return}oe(z),re.current!==null&&clearTimeout(re.current),re.current=setTimeout(()=>{re.current=null,oe("")},4e3)},ea=(R,z)=>{if(Oe===null)return null;if(Oe.length===0)return s("span",{className:"tt_cardHint",children:z});let K=te===R,ee=ve.trim().toUpperCase(),ie=ee===""?Oe:Oe.filter(pe=>pe.toUpperCase().includes(ee));return o("div",{className:"tt_credPicker",children:[s("input",{className:"tt_cardInput",value:K?ve:"",placeholder:w("placeholder.credRef"),title:w("hint.credRefCandidates"),autoComplete:"off",spellCheck:!1,onFocus:()=>{de(R),Q("")},onBlur:pe=>{pe.currentTarget.parentElement.contains(pe.relatedTarget)||de("")},onChange:pe=>{Q(pe.target.value),de(R)}}),...K?[s("div",{className:"tt_envList",children:[...ie.length===0?[s("span",{className:"tt_envMore",children:w("list.noCredRef")})]:ie.slice(0,30).map(pe=>s("button",{type:"button",className:"tt_envItem","data-danger":se===pe?"":void 0,onMouseDown:Se=>Se.preventDefault(),onClick:()=>id(R,pe),children:se===pe?w("list.credOverwrite",{name:pe}):pe},pe)),...ie.length>30?[s("span",{className:"tt_envMore",children:w("list.moreMatches",{count:ie.length-30})})]:[]]},"cred-list-"+R)]:[]]})},nd=()=>{let z=$r(Z?.password??"")!=="",K=Zr()===null;return o("div",{className:"tt_sshRow tt_credRow",children:[z?s("button",{type:"button",className:"tt_toolBtn tt_credClear",disabled:we!==!0,onClick:()=>{sd()},children:w("btn.clearCredential")}):s("label",{className:"tt_credToggle",title:w("hint.rememberCredentialApply"),children:[s("input",{type:"checkbox",className:"tt_cardCheckbox",checked:ne,disabled:K,onChange:ee=>ce(ee.target.checked)}),s("span",{children:w("check.rememberCredentialApply")})]}),le.text===""?null:s("span",{className:"tt_credStatus","data-kind":le.kind,children:le.text}),K&&le.text===""?s("span",{className:"tt_credStatus","data-kind":"muted",children:w("error.credPlainUnavailable")}):null]})},ta=()=>{let R=String(Z?.host??"").trim(),z=String(Z?.username??"").trim(),K=Number(Z?.port);if((!Number.isInteger(K)||K<1||K>65535)&&(K=22),R===""||z==="")return Ee(w("error.hostUserRequired")),null;let ee=Z?.auth,ie={host:R,port:K,username:z,auth:ee};if(ee==="key"){let Se=String(Z?.keyPath??"").trim();if(Se==="")return Ee(w("error.keyPathRequired")),null;ie.keyPath=Se,Z?.passphrase!==""&&(ie.passphrase=Z.passphrase)}if(ee==="password"){let Se=String(Z?.password??"");if(Se==="")return Ee(w("error.passwordRequired")),null;ie.password=Se}Z?.agentForward===!0&&(ie.agentForward=!0);let pe=String(Z?.hostKeyAlias??"").trim();return pe!==""&&(ie.hostKeyAlias=pe),ie},od=()=>{Ee("");let R=ta();R!==null&&(be({running:!0,ok:!1,text:w("msg.probing")}),So(R,!1).then(z=>{if(z.result){let K=z.result.auth?.ok===!0;be({running:!1,ok:K,text:Co(z.result)});return}be({running:!1,ok:!1,text:w("error.probeFailed",{detail:String(z.error||w("error.unknown"))})})}))},ad=()=>{Ee("");let R=ta();R!==null&&Qi(R)},ld=()=>{if(Z===null)return null;let R=(z,K,ee,ie,pe)=>o("label",{className:"tt_sshRow",children:[s("span",{className:"tt_cardLabel",children:z}),s("input",{className:"tt_cardInput",type:ie??"text",value:Z[K]??"",placeholder:ee??"",autoComplete:"off",spellCheck:!1,onChange:Se=>{let me=Se.target.value;Ce(Ye=>({...Ye||{},[K]:me}))},...pe??{}})]});return o("div",{className:"tt_sshEdit",children:[s("div",{className:"tt_sshSection",children:w("section.connection")}),o("div",{className:"tt_sshGrid",children:[R(w("field.bookName"),"name",w("hint.bookNameConflict")),R(w("field.port"),"port","22")]}),R(w("field.host"),"host",w("placeholder.host")),R(w("field.username"),"username","root"),s("div",{className:"tt_sshSection",children:w("section.auth")}),o("label",{className:"tt_sshRow",children:[s("span",{className:"tt_cardLabel",children:w("field.authMethod")}),o("select",{className:"tt_cardInput",value:Z.auth,onChange:z=>Ce(K=>({...K||{},auth:z.target.value})),children:[s("option",{value:"agent",children:w("option.authAgent")}),s("option",{value:"key",children:w("option.authKey")}),s("option",{value:"password",children:w("option.authPassword")})]})]}),...Z.auth==="key"?[R(w("field.keyPath"),"keyPath","~/.ssh/id_ed25519"),R(w("field.passphrase"),"passphrase","","password"),ea("passphrase",w("hint.noCredRefPassphrase"))]:[],...Z.auth==="password"?[R(w("field.password"),"password","","password",{onBlur:()=>{sn(Z.password)}}),nd(),ea("password",w("hint.noCredRefPasswordApply"))]:[],s("div",{className:"tt_sshSection",children:w("section.options")}),o("label",{className:"tt_cardRow",children:[s("input",{type:"checkbox",className:"tt_cardCheckbox",checked:Z.agentForward===!0,onChange:z=>Ce(K=>({...K||{},agentForward:z.target.checked}))}),s("span",{className:"tt_cardLabel",children:w("check.agentForward")})]}),R(w("field.hostKeyAlias"),"hostKeyAlias",w("placeholder.hostKeyAlias")),s("span",{className:"tt_cardHint",children:w("hint.hostKeyAlias")}),ar==="tmux"?o("label",{className:"tt_cardRow",children:[s("input",{type:"checkbox",className:"tt_cardCheckbox",checked:Z.persist===!0,onChange:z=>Ce(K=>({...K||{},persist:z.target.checked}))}),s("span",{className:"tt_cardLabel",children:w("check.persist")})]}):null,ye.text!==""?s("div",{className:"tt_sshProbeResult"+(!ye.running&&ye.ok?" tt_sshProbeOk":"")+(!ye.running&&!ye.ok?" tt_sshProbeBad":""),children:ye.text}):null,He!==""?s("span",{className:"tt_cardMessage tt_cardMessageError",children:He}):null,o("div",{className:"tt_sshActions",children:[o("div",{className:"tt_sshActionsGroup",children:[s("button",{type:"button",className:"tt_toolBtn",onClick:Vo,children:w("btn.cancel")}),s("button",{type:"button",className:"tt_toolBtn",title:w("btn.browseTitle"),onClick:ad,children:w("btn.fileBrowse")}),s("button",{type:"button",className:"tt_toolBtn",disabled:ye.running,title:w("btn.probeTitle"),onClick:od,children:ye.running?w("msg.probing"):w("btn.probe")})]}),o("div",{className:"tt_sshActionsGroup",children:[s("button",{type:"button",className:"tt_cardSave",onClick:()=>{Kh()},children:w("btn.apply")}),s("span",{className:"tt_cardHint",children:w("hint.appliedOnSave")})]})]})]})},cd=R=>{let z=typeof R?.assistProvider=="string"?R.assistProvider.trim():"",K=typeof R?.assistModel=="string"?R.assistModel.trim():"";return z!==""&&K!==""?z+"/"+K:z!==""?z:K},hd=()=>{if(T.loading)return s("span",{className:"tt_envMore",children:w("list.modelLoading")});if(T.failed)return s("span",{className:"tt_envMore",children:w("list.modelCatalogFailed")});let R=[],z=(p?.assistProvider??"")===""&&(p?.assistModel??"")==="";R.push(s("button",{type:"button",className:"tt_envItem",...z?{"data-active":""}:{},onMouseDown:K=>K.preventDefault(),onClick:()=>{c(K=>({...K||{},assistProvider:"",assistModel:""})),G(!1)},children:w("option.followHostModel")},"assist-route-default"));for(let K of T.groups){let ee=String(K.id??"");if(ee==="")continue;let ie=String(K.name??ee),pe=Array.isArray(K.models)?K.models:[];if(pe.length!==0){R.push(s("span",{className:"tt_envMore",children:ie},"group-"+ee));for(let Se of pe){let me=String(Se.id??"");if(me==="")continue;let Ye=String(Se.name??"")===""?me:String(Se.name),ur=(p?.assistProvider??"")===ee&&(p?.assistModel??"")===me;R.push(s("button",{type:"button",className:"tt_envItem",...ur?{"data-active":""}:{},title:ee+"/"+me,onMouseDown:et=>et.preventDefault(),onClick:()=>{c(et=>({...et||{},assistProvider:ee,assistModel:me})),G(!1)},children:Ye===me?me:Ye},ee+"/"+me))}}}return T.groups.length===0&&R.push(s("span",{className:"tt_envMore",children:w("list.noModelCandidate")},"assist-route-empty")),R},ns=(R,z,K,ee)=>o("label",{className:"tt_cardField",children:[s("span",{className:"tt_cardLabel",children:R}),s("input",{className:"tt_cardInput",value:p[z]??"",placeholder:K??"",onChange:ie=>j(z,ie.target.value)}),ee?s("span",{className:"tt_cardHint",children:ee}):null]}),Lr=(R,z,K,ee)=>o("label",{className:"tt_cardField tt_cardRow tt_cardToggle"+(typeof K=="string"&&K!==""?" "+K:""),children:[s("input",{type:"checkbox",className:"tt_cardCheckbox",checked:p[z]===!0,disabled:ee===!0&&p[z]!==!0,onChange:ie=>j(z,ie.target.checked)}),s("span",{className:"tt_cardLabel",children:R})]}),os=p?.platform==="win32";return l==="summary"?w("card.desc"):o(_?"div":"li",{className:_?"tt_pageHost":m?"tt_card tt_cardOpen":"tt_card",children:[_?null:o("button",{type:"button",className:"tt_cardHeader","aria-expanded":m,onClick:()=>y(R=>!R),children:[o("span",{className:"tt_cardHeadText",children:[s("span",{className:"tt_cardName",children:w("card.name")}),s("span",{className:"tt_cardDescription",children:w("card.descFull")})]}),s("span",{className:"dshkit_badge",children:"Kit"}),s("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:s("path",{d:i,fill:"currentColor"})})]}),_||m?o("div",{className:"tt_cardBody",children:[p===null?s("div",{className:"tt_cardMessage",children:w("list.loadingConfig")}):o("div",{children:[H(w("section.basic")),Lr(w("check.enabled"),"enabled"),Lr(w("check.announce"),"announceToAgent"),os?o("div",{className:"tt_cardField",children:[o("label",{className:"tt_cardRow",children:[s("input",{type:"checkbox",className:"tt_cardCheckbox",checked:!1,disabled:!0}),s("span",{className:"tt_cardLabel",children:w("check.shellIntegration")})]}),s("span",{className:"tt_cardHint",children:w("hint.shellIntegrationWindows")})]}):Lr(w("check.shellIntegrationWindows"),"shellIntegration"),H(w("section.sftp")),o("div",{className:"tt_cardField",children:[s("span",{className:"tt_cardLabel",children:w("field.sftpStyle")}),o("select",{className:"tt_cardInput",value:p.sftpStyle==="dual"?"dual":"dialog",onChange:R=>j("sftpStyle",R.target.value),children:[s("option",{value:"dialog",children:w("option.sftpDialog")}),s("option",{value:"dual",children:w("option.sftpDual")})]}),s("span",{className:"tt_cardHint",children:w("hint.sftpDual")})]}),o("div",{className:"tt_cardField",children:[s("span",{className:"tt_cardLabel",children:w("field.sftpLimits")}),o("div",{className:"tt_limitGrid",children:[o("label",{className:"tt_sshRow",children:[s("span",{className:"tt_cardLabel",children:w("field.downloadLimit")}),s("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxDownloadMb))?Number(p.sftpLimits.maxDownloadMb):1024),onChange:R=>ae("maxDownloadMb",Number(R.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[s("span",{className:"tt_cardLabel",children:w("field.uploadLimit")}),s("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxUploadMb))?Number(p.sftpLimits.maxUploadMb):2048),onChange:R=>ae("maxUploadMb",Number(R.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[s("span",{className:"tt_cardLabel",children:w("field.uploadCountLimit")}),s("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxUploadFiles))?Number(p.sftpLimits.maxUploadFiles):1e3),onChange:R=>ae("maxUploadFiles",Number(R.target.value)||0)})]})]}),s("span",{className:"tt_cardHint",children:w("hint.sftpLimits")})]}),H(w("section.session")),o("div",{className:"tt_cardField",children:[s("span",{className:"tt_cardLabel",children:w("field.persistence")}),o("select",{className:"tt_cardInput",value:p.persistence==="tmux"?"tmux":"off",onChange:R=>j("persistence",R.target.value),children:[s("option",{value:"off",children:w("option.persistOff")}),s("option",{value:"tmux",children:w("option.persistTmux")})]}),s("span",{className:"tt_cardHint",children:w("hint.persistence")+(os?w("hint.persistenceWindows"):"")}),Lr(w("check.endOnPageClose"),"endOnPageClose"),Lr(w("check.statsEnabled"),"statsEnabled"),s("span",{className:"tt_cardHint",children:w("hint.statsEnabled")}),rd()]}),H(w("section.assist")),Lr(w("check.assistEnabled"),"assistEnabled"),s("span",{className:"tt_cardHint",children:w("hint.assistEnabled")}),o("div",{className:"tt_cardField",onBlur:R=>{R.currentTarget.contains(R.relatedTarget)||G(!1)},children:[s("span",{className:"tt_cardLabel",children:w("field.assistRoute")}),s("input",{className:"tt_cardInput tt_routeInput",ref:$,readOnly:!0,value:cd(p),autoComplete:"off",spellCheck:!1,onFocus:()=>{G(!0),T.groups.length===0&&!T.loading&&q()},onClick:()=>{G(!0),T.groups.length===0&&!T.loading&&q()},onKeyDown:R=>{R.key==="Escape"&&G(!1)}}),...N?[s("div",{className:"tt_envList tt_routeList",children:hd()},"assist-route-list")]:[],s("span",{className:"tt_cardHint",children:w("hint.assistRoute")})]},"assist-route-field"),ns(w("field.maxSessions"),"maxSessions","4",w("hint.maxSessions")),o("div",{className:"tt_cardField",onBlur:R=>{R.currentTarget.contains(R.relatedTarget)||L(!1)},children:[s("span",{className:"tt_cardLabel",children:w(os?"field.shellWindows":"field.shell")}),s("input",{className:"tt_cardInput",value:p.shell??"",placeholder:w(os?"placeholder.shellWindows":"placeholder.shell"),autoComplete:"off",spellCheck:!1,onFocus:()=>L(!0),onClick:()=>L(!0),onKeyDown:R=>{R.key==="Escape"&&L(!1)},onChange:R=>{j("shell",R.target.value),L(!0)}}),...C?[s("div",{className:"tt_envList tt_shellList",children:(()=>{let R=(p.shell??"").trim().toLowerCase(),z=R===""?U:U.filter(K=>K.toLowerCase().includes(R));return z.length===0?s("span",{className:"tt_envMore",children:w("list.noShellCandidate")}):z.map(K=>s("button",{type:"button",className:"tt_envItem",onMouseDown:ee=>ee.preventDefault(),onClick:()=>{j("shell",K),L(!1)},children:K},K))})()},"shell-list")]:[],s("span",{className:"tt_cardHint",children:w(os?"hint.shellCandidatesWindows":"hint.shellCandidates")})]},"shell-field"),ns("TERM","term","xterm-256color",w("hint.term")),ns("COLORTERM","colorTerm","truecolor",""),ns(w("field.cwd"),"cwd","",w("placeholder.cwd")),ns(w("field.grace"),"reconnectGraceSec","120",w("hint.grace")),H(w("section.ssh")),o("div",{className:"tt_cardField",children:[s("span",{className:"tt_cardLabel",children:w("panel.sshBook")}),...Array.isArray(p.sshHosts)&&p.sshHosts.length>0?[s("div",{className:"tt_hostList","data-editing":he!==null?"":void 0,children:p.sshHosts.map(R=>o("div",{children:[o("div",{className:"tt_sshHostRow",children:[s("div",{className:"tt_sshHostMeta",children:[s("span",{className:"tt_sshHostName",children:R?.name??""}),s("span",{className:"tt_sshHostTarget",children:yo(R??{})})]}),s("button",{type:"button",className:"tt_toolBtn",disabled:xe[R?.name]?.running===!0,onClick:()=>{Vh(R)},title:w("btn.probeRowTitle"),children:xe[R?.name]?.running===!0?w("msg.testing"):w("btn.test")}),s("button",{type:"button",className:"tt_toolBtn",onClick:()=>qh(R),children:w("btn.edit")}),s("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Gh(R?.name),children:w("btn.delete")})]}),xe[R?.name]&&xe[R?.name].text?s("div",{className:"tt_sshProbeResult"+(xe[R?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:xe[R?.name].text}):null,he===R?.name?ld():null]},String(R?.name??"")))})]:[s("span",{className:"tt_cardHint",children:w("list.emptySshHosts")})],o("div",{className:"tt_cardRow",children:[s("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Xh()},children:w("btn.importSshConfig")}),s("span",{className:"tt_cardHint",children:w("hint.importSshConfig")})]}),s("span",{className:"tt_cardHint",children:w("hint.sshBook")})]}),o("div",{className:"tt_cardField",children:[o("div",{className:"tt_cardField",children:[s("span",{className:"tt_cardLabel",children:w("panel.tunnels")}),...Array.isArray(p.tunnels)&&p.tunnels.length>0?[s("div",{children:p.tunnels.map(R=>{let z=tt.find(ie=>ie.name===R?.name),K=z?.state??"stopped",ee=Et!==null&&String(R?.name??"")===Et;return o("div",{className:"tt_sshHostRow","data-editing":ee?"":void 0,children:[s("span",{className:"tt_tunnelDot","data-state":K,title:K}),s("div",{className:"tt_sshHostMeta",children:[s("span",{className:"tt_sshHostName",children:(R?.name??"")+" \xB7 "+Hh(R??{})}),s("span",{className:"tt_sshHostTarget",children:(R?.bookName??"")+(z?.error?" \xB7 "+z.error:"")+(z?.lastForwardError?" \xB7 "+z.lastForwardError:"")})]}),s("input",{type:"checkbox",className:"tt_cardCheckbox",checked:R?.enabled!==!1,title:w("check.tunnelEnabled"),onChange:ie=>$h(R?.name,ie.target.checked)}),s("button",{type:"button",className:"tt_toolBtn",onClick:()=>Fh(R),children:w("btn.edit")}),s("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>jh(R?.name),children:w("btn.delete")})]},String(R?.name??""))})})]:[s("span",{className:"tt_cardHint",children:w("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":w("field.direction"),children:[s("button",{type:"button",className:"tt_segmentedBtn","data-active":it.direction!=="remote"?"":void 0,title:w("option.localForwardTitle"),onClick:()=>jo("direction","local"),children:w("option.localForward")}),s("button",{type:"button",className:"tt_segmentedBtn","data-active":it.direction==="remote"?"":void 0,title:w("option.remoteForwardTitle"),onClick:()=>jo("direction","remote"),children:w("option.remoteForward")})]}),o("select",{className:"tt_cardInput",value:it.bookName,onChange:dr("bookName"),children:[s("option",{value:"",children:w("option.selectBook")}),...Array.isArray(p?.sshHosts)?p.sshHosts.map(R=>s("option",{value:R?.name??"",children:R?.name??""})):[]]})]}),s("span",{className:"tt_cardHint",children:$o!==void 0?w("hint.tunnelViaBook",{book:yo($o)}):w("hint.tunnelBookEmpty")}),it.direction==="local"?o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[s("span",{className:"tt_tunnelEndpointStatic",title:w("hint.localListenFixed"),children:"127.0.0.1"}),s("span",{className:"tt_tunnelColon",children:":"}),s("input",{className:"tt_cardInput tt_tunnelPort",placeholder:w("placeholder.localPort"),value:it.localPort,autoComplete:"off",inputMode:"numeric","aria-label":w("field.localListenPort"),onChange:dr("localPort")})]}),s("span",{className:"tt_tunnelArrow","data-direction":"local",title:w("hint.flowLocalToRemote"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[s("input",{className:"tt_cardInput tt_tunnelHost",placeholder:w("placeholder.remoteHost"),title:w("hint.remoteHostTitle"),value:it.remoteHost,autoComplete:"off","aria-label":w("field.remoteHost"),onChange:dr("remoteHost")}),s("span",{className:"tt_tunnelColon",children:":"}),s("input",{className:"tt_cardInput tt_tunnelPort",placeholder:w("placeholder.port"),value:it.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":w("field.remotePort"),onChange:dr("remotePort")})]})]}):o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[s("input",{className:"tt_cardInput tt_tunnelHost",placeholder:w("placeholder.remoteListenHost"),title:w("hint.remoteListenHost"),value:it.remoteHost,autoComplete:"off","aria-label":w("field.remoteListenHost"),onChange:dr("remoteHost")}),s("span",{className:"tt_tunnelColon",children:":"}),s("input",{className:"tt_cardInput tt_tunnelPort",placeholder:w("placeholder.listenPort"),value:it.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":w("field.remoteListenPort"),onChange:dr("remotePort")})]}),s("span",{className:"tt_tunnelArrow","data-direction":"remote",title:w("hint.flowRemoteToLocal"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[s("span",{className:"tt_tunnelEndpointStatic",title:w("hint.localDialFixed"),children:"127.0.0.1"}),s("span",{className:"tt_tunnelColon",children:":"}),s("input",{className:"tt_cardInput tt_tunnelPort",placeholder:w("placeholder.localTargetPort"),value:it.localTargetPort,autoComplete:"off",inputMode:"numeric","aria-label":w("field.localTargetPort"),onChange:dr("localTargetPort")})]})]}),s("div",{className:"tt_tunnelEndpoints",children:[s("span",{className:"tt_tunnelEndLabel",children:it.direction==="local"?w("hint.tunnelLocalSummary"):w("hint.tunnelRemoteSummary")})]}),s("div",{className:"tt_cardRow tt_tunnelActions",children:[Et===null?s("button",{type:"button",className:"tt_cardSave",onClick:Uh,children:w("btn.addTunnel")}):s("button",{type:"button",className:"tt_cardSave",onClick:zh,children:w("btn.saveEdit")}),Et===null?null:s("button",{type:"button",className:"tt_toolBtn",onClick:Wh,children:w("btn.cancel")}),s("span",{className:"tt_cardHint",children:Et===null?w("hint.tunnelAdd"):w("hint.tunnelEditing",{name:Et})})]})]})]}),o("div",{className:"tt_cardField",children:[s("span",{className:"tt_cardLabel",children:w("panel.hostKeys")}),s("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Jh()},children:w("btn.importKnownHosts")})]}),...Array.isArray(p.hostKeys)&&p.hostKeys.length>0?[s("div",{className:"tt_hostList",children:p.hostKeys.map((R,z)=>o("div",{className:"tt_sshHostRow",children:[s("div",{className:"tt_sshHostMeta",children:[s("span",{className:"tt_sshHostName",children:String(R?.host??"")+":"+String(R?.port??22)}),s("span",{className:"tt_sshHostTarget",children:Yo(R).map(K=>"sha256:"+K).join(" / ")})]}),s("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>{Yh(R)},children:w("btn.delete")})]},String(R?.host??"")+":"+String(R?.port??22)+"#"+String(z)))})]:[s("span",{className:"tt_cardHint",children:w("list.emptyHostKeys")})],s("span",{className:"tt_cardHint",children:w("hint.hostKeys")})]}),o("div",{className:"tt_cardField tt_cardRow",children:[s("button",{className:"tt_cardSave",disabled:f,onClick:()=>{Xo()},children:w(f?"msg.saving":"btn.save")}),s("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=d=>{Np(d),Qc=d.sessions,d.inject(["remote","remote.credentials"],S=>(Ot=S.remote?.credentials??S["remote.credentials"]??null,()=>{Ot=null}));let l=!1,_=()=>{};zi={set(S){if(S!==l){if(l=S,S){_=vm();return}_(),_=()=>{},Os(),br()}}},gh(!0),Uo();let m="@hyzyn/dsh-all",p=[...new Set(a.map(S=>S.split("#")[0]))].find(S=>S!==m),c=!1,u=[];p!==void 0&&d.slots.inject("plugins.bundle.config",()=>{for(c=!0;u.length>0;){let S=u.pop();typeof S=="function"&&S()}return d.slots.register({name:"plugins.bundle.config",key:p},n)});for(let S of a)d.slots.inject("plugins.row.config",()=>{let g=S.split("#")[0]===p;if(g&&c)return;let x=d.slots.register({name:"plugins.row.config",key:S},n);return g&&u.push(x),x});d.slots.inject("settings.kit.item",()=>d.slots.register({name:"settings.kit.item",id:"tty",order:80,label:()=>w("card.name")},n)),d.slots.inject("settings.plugin.item",()=>d.slots.register({name:"settings.plugin.item",key:"tty",order:100},n));let h=d.provide("ttyConnbar",{version:1,addAction:Xi,requestRender(){br()}}),f=d.provide("ttyTerminal",{version:3,open(S){if(!wr)return;let g=oh(S),x=ah(S,g),b=typeof S?.label=="string"&&S.label!==""?S.label:void 0;if(Is(),S?.reuse!==!1){let E=p_(x);if(E!==null)return To(),Yt(E.sid),E}return To(),Ds(x,b)},mount(S,g){return wr?S_(S,g):()=>{}}}),v=d.provide("ttyPanel",{version:2,isOpen(){return ue!==null&&!Ve},mountPane(S){return hh(S)},minimize(){return qi(),ue!==null&&Ve}});return()=>{zi=null,wr=!1,_(),v(),f(),h(),Os()}},t}});})();
3665
+ `;function mo(e){let t=typeof e=="string"?e.trim():"";if(t==="")return;let r=t,i="",n=r.lastIndexOf("@");n>0&&(i=r.slice(0,n).trim(),r=r.slice(n+1).trim());let s=r,o=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&&(o=l)}if(s==="")return;let d={host:s,port:o};return i!==""&&(d.username=i),d}function go(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,n=typeof t.username=="string"&&t.username.trim()!==""?t.username.trim()+"@":"",s=r.includes(":")&&!r.startsWith("[")?`[${r}]`:r;return`${n}${s}${i===22?"":":"+String(i)}`}var vo="\0global";function Gr(e,t){return e===null?vo:typeof e=="string"&&e!==""?e:typeof t=="string"&&t!==""?t:vo}function bo(e,t){return e===vo?!0:typeof t=="string"&&t!==""&&e===t}var u_="/api/dsh-tty/ws";function Lc(e,t){let r=new URL(t??e,e);return(r.protocol==="https:"?"wss:":"ws:")+"//"+r.host+u_}function wo(e){return String(e??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Tc(e,t,r,i){let n=wo(r),s=wo(e);if(n===""||s==="")return"";let o=wo(t),a=["DSH_TTY",n,s];return o!==""&&o!=="22"&&a.push(o),a.push(i),a.join("_")}function As(e){let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=65535?t:0}function Mc(e,t,r){return`${e}-${t==="remote"?"R":"L"}${String(r)}`}function Rc(e,t=[],r=i=>i){let i=e??{},n=String(i.bookName??"")||String(t[0]??"")||"";if(n==="")return{ok:!1,error:r("error.tunnelNoBook")};if(i.direction==="remote"){let d=As(i.remotePort),l=As(i.localTargetPort);return d<1||l<1?{ok:!1,error:r("error.tunnelRemotePortRequired")}:{ok:!0,tunnel:{name:Mc(n,"remote",d),bookName:n,direction:"remote",remotePort:d,localTargetHost:"",localTargetPort:l,enabled:!0}}}let s=As(i.localPort),o=String(i.remoteHost??"").trim(),a=As(i.remotePort);return s<1||o===""||a<1?{ok:!1,error:r("error.tunnelLocalRequired")}:{ok:!0,tunnel:{name:Mc(n,"local",s),bookName:n,direction:"local",localPort:s,remoteHost:o,remotePort:a,enabled:!0}}}function Ac(e,t){return(Array.isArray(e)?e:[]).find(r=>String(r?.name??"")===String(t))}function f_(e,t,r){return(Array.isArray(e)?e:[]).find(i=>String(i?.name??"")!==String(t)&&String(i?.name??"")===String(r))}function Dc(e,t,r,i){let n=Array.isArray(e)?e:[],s=n.find(d=>String(d?.name??"")===String(t));if(s===void 0)return{ok:!1,reason:"missing",error:i("error.tunnelMissing",{name:String(t)})};if(f_(n,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:n.map(d=>String(d?.name??"")===String(t)?a:d)}}function p_(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 __(e){let t=e?.current;return typeof t=="string"&&t!==""?t:p_(e)}function Pc(e){let t=__(e);if(t===void 0)return;let r=e?.byId?.[t]?.cwd;return typeof r=="string"&&r!==""?r:void 0}function m_(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0}function Bc(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||!m_(Number(t.width),Number(t.height))))return{cols:Math.min(500,r),rows:Math.min(200,i)}}function Oc(e){return e!==null&&typeof e=="object"&&e.exited!==!0}function Ic(e){if(!Array.isArray(e))return 0;let t=0;for(let r of e)Oc(r)&&(t+=1);return t}function yo(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)Oc(r)&&typeof r.sid=="string"&&r.sid!==""&&t.add(r.sid);return t}function Nc(e){let t=new Set,r=new Set,i=new Set;if(!Array.isArray(e))return{present:t,retained:r,live:i};for(let n of e){if(n===null||typeof n!="object")continue;let s=typeof n.sid=="string"?n.sid:"";s!==""&&(t.add(s),n.exited===!0?r.add(s):i.add(s))}return{present:t,retained:r,live:i}}function Hc(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 Fc(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 n of e)n===null||typeof n!="object"||n.embedded!==!0&&n.exited!==!0&&(r+=1,n.agentOwned===!0&&(i+=1));return{live:r,agentLive:i,confirm:r>0}}var Ds=Object.freeze({sids:[],live:0,agentLive:0,confirm:!1});function Wc(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 zc(e){return Wc(e).length}function Ps(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 Uc(e,t){let r=Wc(e);if(r.length===0)return{others:Ds,left:Ds,right:Ds,exited:Ds};let i=typeof t=="string"?t:"",n=r.findIndex(s=>s.sid===i);return{others:Ps(n<0?r:r.filter(s=>s.sid!==i)),left:Ps(n<0?[]:r.slice(0,n)),right:Ps(n<0?[]:r.slice(n+1)),exited:Ps(r.filter(s=>s.exited===!0))}}function vr(e){return e!==null&&typeof e=="object"&&e.hidden===!0}function So(e){return!(e===null||typeof e!="object"||e.agentOwned===!0||e.embedded===!0)}function Co(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 $c(e){let t=Number(e?.received),r=Number(e?.attempt),i=Number.isInteger(e?.maxAttempts)?e.maxAttempts:3,n=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"}:n!==null&&Number.isFinite(n)&&n>0&&t>=n?{resume:!1,reason:"complete"}:{resume:!0,offset:t}}function g_(e){return typeof e!="string"||e===""||e==="."||e===".."?!1:e.startsWith(".")}function Bs(e,t){let i=(Array.isArray(e)?e:[]).filter(n=>n!==null&&typeof n=="object"&&typeof n.name=="string"&&n.name!=="");return t===!0?i:i.filter(n=>!g_(n.name))}function qc(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 Kc(e){let t=new Set;for(let r of Array.isArray(e)?e:[]){let i=typeof r?.relPath=="string"?r.relPath:"",n=i.lastIndexOf("/");n<=0||t.add(i.slice(0,n))}return[...t].sort((r,i)=>r.split("/").length-i.split("/").length||r.localeCompare(i))}function Gc(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 Vc(e,t){return typeof e!="string"||e===""?!0:e===t}function Yc(e,t){return e===null?!1:e!==t}var Xc="block",xo="none";function v_(e){return e===Xc}function Jc(e){return e===!0?Xc:xo}function Zc(e){return!v_(e)}function tt(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 Li(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 eh(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function Qc(e,t){return!Number.isFinite(e)||e<0?t("list.none"):e<1024?Math.round(e)+" B/s":Li(e)||t("list.none")}function b_(e,t){if(!Number.isFinite(e)||e<0)return t("list.none");let r=Math.floor(e),i=Math.floor(r/604800),n=Math.floor(r%604800/86400),s=Math.floor(r%86400/3600),o=Math.floor(r%3600/60),a=[];return i>0&&a.push(i+"w"),(i>0||n>0)&&a.push(n+"d"),(i>0||n>0||s>0)&&a.push(s+"h"),(i>0||n>0||s>0||o>0)&&a.push(o+"m"),a.length>0?a.join(""):r+"s"}function w_(e,t,r){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?r("list.none"):(tt(e)||"0 B")+"/"+(tt(t)||"0 B")}function th(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 y_=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function rh(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:y_.some(t=>th(e,t)!==null)}var S_=8e3;function ih(e,t=Date.now()){return t-(e||0)<=S_}var sh=23;function ko(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:sh}]}function nh(e,t){let r=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{},i=s=>th(r,s),n=(s,o,a,d=s.slot)=>({key:s.key,label:s.label,kind:s.kind,slot:d,pct:a??null,value:o,title:s.label+": "+o});return ko(t).map(s=>{if(s.kind==="pct"){let a=i(s.key);return n(s,a===null?t("list.none"):Math.round(a)+"%",a)}if(s.kind==="pair")return n(s,w_(i(s.used),i(s.total),t),null);if(s.kind==="uptime")return n(s,b_(i(s.key),t),null);if(s.kind==="temp"){let a=i(s.key);return n(s,a===null?t("list.none"):a.toFixed(1)+"\xB0C",null)}if(s.kind==="net"){let a=i("rxRate"),d=i("txRate");return a===null&&d===null?n(s,t("list.none"),null,0):n(s,"\u2193"+Qc(a,t)+" \u2191"+Qc(d,t),null,sh)}let o=i(s.key);return n(s,o===null?t("list.none"):String(o),null)})}var Eo="tty",$s={"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\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\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","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\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"},k_={"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. 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 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","check.agentForward":"agent forwarding (the remote side can use local ssh-agent keys, e.g. remote git clone)","hint.hostKeyAlias":"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 E_(e,t){return t===void 0?e:String(e).replace(/\{(\w+)\}/g,(r,i)=>t[i]===void 0?"":String(t[i]))}function mh(e,t){return E_($s[e]!==void 0?$s[e]:e,t)}var b=mh;function L_(e){e.inject(["locale"],t=>{let r=t.locale.register(Eo,"zh",$s),i=t.locale.register(Eo,"en",k_);return b=t.locale.bind(Eo),()=>{i(),r(),b=mh}})}function T_(){return Lc(document.baseURI,globalThis.__DSH_TRANSPORT__?.streamBaseUrl)}function oi(){return Ot!==null&&typeof Ot.describe=="function"?Ot:null}function Jr(e){let t=String(e??"").trim();return t.startsWith("env:")?t.slice(4).trim():""}function M_(){let e=new Set;for(let t of Zt)for(let r of[t?.password,t?.passphrase]){let i=Jr(r);i!==""&&e.add(i)}return[...e]}async function R_(){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 gh(){return[...new Set([...M_(),...await R_()])].sort()}async function vh(e){let t=oi();if(t===null)return{error:b(Ot===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 A_(e,t){let r=oi();if(r===null||typeof r.set!="function")return{error:b("error.credStoreUnavailable")};try{return await r.set(e,t),{value:"env:"+e}}catch(i){return{error:b("error.credStoreFailed",{error:i instanceof Error?i.message:String(i)})}}}async function bh(e){let t=oi();if(t===null||typeof t.unset!="function")return{error:b("error.credClearUnavailable")};try{return await t.unset(e),{}}catch(r){return{error:b("error.credClearFailed",{error:r instanceof Error?r.message:String(r)})}}}async function wh(e,t,r,i,n,s){if(e!==!0)return{};let o=String(t??"").trim();if(o===""||o.startsWith("env:"))return{};let a=Tc(r,i,n,s);return a===""?{error:b("error.credRefNeedsHost")}:A_(a,o)}function on(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var Os;function Yi(){document.getElementById("dsh-tty-style")||(Os=document.createElement("style"),Os.id="dsh-tty-style",Os.textContent=Ec+`
3666
+ `+kc,document.head.appendChild(Os))}var an='<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>',D_='<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>',yh='<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>',P_='<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>',B_='<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>',Sh='<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>',Ch='<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>',O_='<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>',ln='<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>',Xi='<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>',I_='<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>',N_='<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>',H_='<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>',Fi='<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>',xh='<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>',kh='<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>',Xo='<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>',Eh='<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>',F_='<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>',Jo='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.2 2.9l1.9 1.9-7.3 7.3-2.4.5.5-2.4z"/></svg>',Sr='<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>',Zo='<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>',Lh='<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>',Qo='<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>',ea='<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>',W_='<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>',z_='<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>',U_='<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>',j_='<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>',Th='<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>',$_='<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>',Mh='<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>',Rh=null,Re=null,ue=null,qs=null,Wi=null,Ot=null,Cr=null,Tr=null,Ee=null,Bt=null,Ri=null,Ai=null,Ks=null,pt=null,Di=null,Je=null,mt=null,Xt=null,Zr=null,zi=!1,Pi=null,Ge=!1,Xe=null,Ui=null,ai=null,Mr=null,Gs=null,xr=null,Bi=1e3,Vs="dsh-tty:tabs",le=new Map,Ji=new Set,ta=()=>Ji.size>0,Ao=new Set,Se=null,Zi=0,Is=!1,gt=null,Ys=!1,fr=new Map,kr=null,Rr=null,Qr=null,cr=null,Xs=null,nt=null,ei=null,Zt=[],Js=!0,yt=null,It=null,ji="",ti=null,Do=null,St=null,Oi=null,Mi=null,Po=null,Bo=new Set;function cn(e){return Bo.add(e),()=>Bo.delete(e)}cn(({tab:e,addAction:t})=>{Lr&&e.exited&&t(P_,b("btn.reopen"),b("btn.reopenTitle"),()=>qi(e.sid))});cn(({tab:e,addAction:t})=>{Lr&&t(B_,"SFTP",b("btn.sftpTitle"),()=>pn(e.spawnSpec,e.sid))});cn(({bookName:e,addAction:t})=>{if(!Lr)return;let r=e!==""?Zh(e):0;if(r>0){t(Sh,b("btn.tunnels",{count:r}),b("btn.tunnelsTitle"),i=>qh(i.currentTarget,e));return}e!==""&&t(Ch,b("btn.more"),b("btn.moreTitle"),i=>xm(i.currentTarget,e))});function hn(e,t){if(Cr===null)return;Cr.textContent=e.split("\u2014\u2014")[0],Cr.title=e,Tr.dataset.state=t,qs!==null&&(qs.style.display=t==="connected"?"none":""),ai!==null&&(ai.textContent=e),Mr!==null&&(Mr.dataset.state=t);let r=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");r!==null&&(r.dataset.state=t)}function Lo(e,t,r){let i=typeof e=="string"&&e!==""?e:null;if(i!==null){let n=le.get(i);n!==void 0&&(n.statusText=t,n.statusState=r)}Vc(i,Se)&&(Wi=i,hn(t,r))}function Ns(e,t){Wi=null,hn(e,t)}function ra(){if(!Yc(Wi,Se))return;let e=Se===null?void 0:le.get(Se);Wi=e===void 0?null:Se;let t=Gc(e,b);hn(t.text,t.state)}function Pe(e){Re!==null&&Re.readyState===WebSocket.OPEN&&Re.send(JSON.stringify(e))}function q_(){let e=[],t=document.createDocumentFragment();for(let r of ko(b)){let i=document.createElement("span");i.className="tt_statsItem";let n=document.createElement("span");n.className="tt_statsLabel",n.textContent=r.label,i.appendChild(n);let s=null,o=null;r.kind==="pct"&&(s=document.createElement("span"),s.className="tt_statsMeter",o=document.createElement("span"),o.className="tt_statsMeterFill",s.appendChild(o),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:o,slot:null})}return yt!==null&&yt.appendChild(t),e}function K_(e,t){let r=nh(t!==void 0?t.stats:null,b);for(let i=0;i<e.length;i+=1){let n=e[i],s=r[i];if(s!==void 0&&(n.slot!==s.slot&&(n.slot=s.slot,n.value.style.minWidth=s.slot>0?s.slot+"ch":""),n.value.textContent!==s.value&&(n.value.textContent=s.value),n.item.getAttribute("title")!==s.title&&n.item.setAttribute("title",s.title),n.fill!==null&&n.meter!==null)){let o=s.pct===null?"0%":Math.max(0,Math.min(100,s.pct)).toFixed(1)+"%";n.fill.style.width!==o&&(n.fill.style.width=o);let a=eh(s.pct);n.meter.dataset.level!==a&&(n.meter.dataset.level=a)}}}function dn(){Mi=null,Po=null}function G_(){if(ue===null||Ge||!Js)return!1;let e=xt();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:ih(e.statsAt)}function Zs(){if(Ge)return;let e=xt();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&ui(e)}catch{}}}function Ar(){try{V_()}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{yt!==null&&(yt.hidden=!0,yt.textContent=""),dn(),Je!==null&&delete Je.dataset.stats}catch{}}}function V_(){if(Je===null||yt===null)return;let e=G_(),t=Je.dataset.stats!==void 0!==e;if(!e){t&&delete Je.dataset.stats,yt.hidden=!0,Mi!==null&&(yt.textContent="",dn()),t&&Zs();return}yt.hidden=!1,Mi===null&&(Mi=q_());let r=xt(),i=r===void 0?"":r.sid+":"+String(r.statsAt||0);i!==Po&&(Po=i,K_(Mi,r)),t&&(Je.dataset.stats="",Zs())}function Ah(){Oi===null&&(Oi=setInterval(()=>Ar(),1e3))}function Dh(){Oi!==null&&(clearInterval(Oi),Oi=null)}function Ph(){if(ue===null||Ge||!Js)return null;let e=xt();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function Qi(){let e=Ph();e!==St&&(St!==null&&Pe({t:"statsOff",sid:St}),St=e,e!==null&&Pe({t:"statsOn",sid:e}))}function Y_(e){if(e!==Ph()){Qi();return}St!==null&&St!==e&&Pe({t:"statsOff",sid:St}),St=e,Pe({t:"statsOn",sid:e})}function X_(){let e=xt();return e===void 0||e.embedded===!0?null:e.releasePending===!0?{kind:"released",tab:e}:e.exited===!0?{kind:"exited",tab:e}:null}function es(){if(Je===null||It===null)return;let e=X_(),t=e!==null,r=Je.dataset.exited!==void 0!==t;if(!t){It.hidden=!0,It.textContent="",ji="",r&&(delete Je.dataset.exited,Zs());return}It.hidden=!1,J_(e),r&&(Je.dataset.exited="",Zs())}function J_(e){let{kind:t,tab:r}=e,i=typeof r.exitDetail=="string"?r.exitDetail:"",n=t+":"+r.sid+":"+i;if(n===ji)return;ji=n,It.textContent="";let s=document.createElement("span");s.className="tt_exitBarText",s.textContent=t==="released"?b("status.aiEnded"):i===""?b("status.exited"):b("status.exitedWith",{detail:i}),t==="released"&&(s.title=b("hint.aiEndedTab")),It.appendChild(s);let o=document.createElement("span");if(o.className="tt_exitBarSpacer",It.appendChild(o),t==="released"){oh(b("btn.dismiss"),b("btn.dismissTitle"),()=>{Ft(r.sid,{silent:!0})});return}if(r.spawnSpec===null||typeof r.spawnSpec!="object")return;let a=r.agentOwned===!0;oh(b(a?"btn.newLocalTerminal":"btn.reopenSession"),b(a?"hint.reopenAgentLocal":"hint.reopenWithSpec"),()=>qi(r.sid))}function oh(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),It.appendChild(i)}function xt(){return Se!==null?le.get(Se):void 0}function Oo(){try{return Pc(Rh?.list?.getSnapshot?.())}catch{return}}function Z_(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Pe({t:"refresh",sid:e.sid})}}var Hs=null;function Bh(e){Hs!==null&&clearTimeout(Hs),Hs=setTimeout(()=>{Hs=null;let t=xt();t!==void 0&&Z_(t)},e??200)}var Q_=["password","passphrase"];function ah(e){if(e===null||typeof e!="object"||e.t!=="ssh")return e;let t=e.credsStripped===!0,r={...e};for(let i of Q_){let n=r[i];typeof n=="string"&&n!==""&&!n.startsWith("env:")&&(delete r[i],t=!0)}return t&&(r.credsStripped=!0),r}var Oh=1;function Ht(){try{let e=[...le.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:ah(t.spawnSpec),label:t.label}));e.length===0||ue===null?sessionStorage.removeItem(Vs):sessionStorage.setItem(Vs,JSON.stringify({v:Oh,tabs:e})),em([...le.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:ah(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 Io="dsh-tty:persist-specs";function em(e){try{let t=e.filter(r=>rs(r.spawnSpec)).map(r=>({spawnSpec:r.spawnSpec,label:r.label}));t.length===0?localStorage.removeItem(Io):localStorage.setItem(Io,JSON.stringify(t))}catch{}}function tm(){try{let e=localStorage.getItem(Io);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&rs(r.spawnSpec)):[]}catch{return[]}}function rm(){try{let e=sessionStorage.getItem(Vs);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===Oh&&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 Qs(e,t){let r=Re;return new Promise(i=>{let n=null,s=o=>{let a;try{a=JSON.parse(o.data)}catch{return}a.t===e&&(n!==null&&clearTimeout(n),r.removeEventListener("message",s),i(r===Re?a:null))};n=setTimeout(()=>{r.removeEventListener("message",s),i(null)},t),r.addEventListener("message",s)})}function im(e){return e===void 0?null:e.embedded===!0?e.controller!==void 0&&e.controller!==null?e.controller.hostEl:null:e.termEl}function Ih(e){if(e===void 0||e.fit===null||e.fit===void 0)return;let t;try{t=e.fit.proposeDimensions()}catch{return}let r=im(e);return Bc(t,r==null?null:{width:r.clientWidth,height:r.clientHeight})}function ui(e){if(e===void 0||e.fit===void 0)return;let t=Ih(e);t!==void 0&&(e.lastDims=t,Pe({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows}))}function sm(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||ui(e)}function Vr(e,t,r,i){if(e.overlayEl===null||e.overlayEl===void 0)return;let n=e.overlayEl,s=i==="error"||i==="info"?i:"exited";if(s==="exited"&&e.embedded!==!0){n.textContent="";return}if(t===""||t===void 0){n.textContent="";return}n.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?Th:s==="info"?Zo:$_)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(r===void 0||r===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",n.querySelector(".tt_overlayMain").textContent=t,r!==void 0&&r!==""&&(n.querySelector(".tt_overlayHint").textContent=r)}function Te(e,t=""){try{let r=getComputedStyle(document.body).getPropertyValue(e).trim();return r!==""?r:t}catch{return t}}function fi(e){let t=Te("--tt-accent"),r={};r.background=Te("--tt-term-bg"),r.foreground=Te("--tt-term-fg"),r.cursor=t,r.cursorAccent=Te("--tt-term-cursor-accent"),r.selectionBackground=Te("--tt-term-selection"),r.black=Te("--tt-an-black"),r.red=Te("--tt-an-red"),r.green=Te("--tt-an-green"),r.yellow=Te("--tt-an-yellow"),r.blue=Te("--tt-an-blue"),r.magenta=Te("--tt-an-magenta"),r.cyan=Te("--tt-an-cyan"),r.white=Te("--tt-an-white"),r.brightBlack=Te("--tt-an-bright-black"),r.brightRed=Te("--tt-an-bright-red"),r.brightGreen=Te("--tt-an-bright-green"),r.brightYellow=Te("--tt-an-bright-yellow"),r.brightBlue=Te("--tt-an-bright-blue"),r.brightMagenta=Te("--tt-an-bright-magenta"),r.brightCyan=Te("--tt-an-bright-cyan"),r.brightWhite=Te("--tt-an-bright-white");let i=new ph.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}),n=new _h.FitAddon,s=new tl;i.loadAddon(n),i.loadAddon(s),i.loadAddon(new rl);let o=document.createElement("div");o.className="tt_term";let a=document.createElement("div");a.className="tt_overlay",a.addEventListener("click",()=>{a.textContent="",qi(e.sid)}),a.setAttribute("role","button"),a.setAttribute("aria-label",b("btn.reopenSession")),a.tabIndex=0,a.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" "||d.key==="Spacebar")&&(d.preventDefault(),a.textContent="",qi(e.sid))}),o.appendChild(a),i.open(o);try{n.fit()}catch{}try{let d=new xc;d.onContextLoss(()=>{try{d.dispose()}catch{}}),i.loadAddon(d)}catch{}i.onData(d=>{Pe({t:"input",sid:e.sid,d}),fr.delete(e.sid)&&Pr()}),i.onResize(()=>{rs(e.spawnSpec)&&Bh(200)}),i.attachCustomKeyEventHandler(d=>e.embedded===!0?!0:(d.ctrlKey||d.metaKey)&&d.key.toLowerCase()==="f"?(d.preventDefault(),bd(),!1):!0),e.term=i,e.fit=n,e.search=s,e.termEl=o,e.overlayEl=a}function lh(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 nm(e){let t=lh(e);if(t==="")return null;for(let r of le.values())if(r.exited!==!0&&r.embedded!==!0&&lh(r.spawnSpec)===t)return r;return null}function $i(e,t){let r=on(),i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??sg(),label:t};return fi(i),le.set(r,i),Zi+=1,it(),tr(r,{user:!0}),un(i),Ht(),i}function om(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===""||le.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:Oo()},label:"agent"+(t.kind==="ssh"&&typeof t.target=="string"&&t.target!==""?" \xB7 "+t.target:"")};fi(i),le.set(r,i),Zi+=1,it(),Nh()&&i.termEl!==null&&Je!==null&&Se===null&&tr(r),Pe({t:"attach",sid:r}),am()}}function Nh(){return ue!==null&&Ge!==!0}function am(){try{Ht()}catch{}}function lm(e){if(om(e),!Array.isArray(e))return;for(let i of e){if(i===null||typeof i!="object"||i.owner!=="agent")continue;let n=typeof i.sid=="string"?le.get(i.sid):void 0;n!==void 0&&n.embedded!==!0&&n.agentOwned!==!0&&(n.agentOwned=!0)}let t=Nc(e),r=!1;for(let[i,n]of[...le]){let s=Hc(n,t);if(s!=="keep"){if(s==="mark-exited"){n.exited!==!0&&(n.exited=!0,n.live=!1,r=!0);continue}cm(n)||Ft(i,{silent:!0})}}r&&(it(),_n())}function cm(e){return!Nh()||e.watched!==!0||e.sid!==Se?!1:(e.releasePending===!0||(e.releasePending=!0,es()),!0)}function hm(e){if(le.has(e.sid))return le.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};fi(t),le.set(t.sid,t),Zi+=1,it(),tr(t.sid),Pe({t:"attach",sid:t.sid})}function dm(e){if(!(e?.spawnSpec?.credsStripped!==!0||e.term===null))try{e.term.writeln("\x1B[2m[dsh-tty] "+b("msg.passwordNotStored")+"\x1B[0m")}catch{}}function un(e){dm(e);let t=Ih(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(Re===null||Re.readyState!==WebSocket.OPEN){Ao.add({tab:e,frame:i});return}Pe(i)}function um(e,t){let r=le.get(e);if(r===void 0||r.embedded===!0||t===!0&&!So(r))return;let i=t===!0;vr(r.spawnSpec)!==i&&(r.spawnSpec=Co(r.spawnSpec,i),Pe({t:"hidden",sid:e,hidden:i}),Ht(),it(),li())}var fm="\u{1F648}";function Hh(e){let t=le.get(e),r=t===void 0?"":t.label||b("panel.tabLabel",{n:fn(e)});return t===void 0||!vr(t.spawnSpec)?r:`${fm} ${r}`}function ch(e){let t={sid:on(),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};fi(t),le.set(t.sid,t),Zi+=1,it(),tr(t.sid),un(t)}function qi(e){let t=le.get(e);if(t===void 0)return;if(t.embedded===!0){Uh(t);return}let r=t.spawnSpec,i=t.label;if(Pe({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),le.delete(e);let n={sid:on(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:r,label:i};fi(n),le.set(n.sid,n),it(),tr(n.sid,{user:!0}),un(n),Ht()}function Ft(e,t){let r=le.get(e);if(r===void 0)return;let i=t?.silent===!0;if(Ct!==null&&Ct.ownerKey===e&&Ni(!0),i||Pe({t:"kill",sid:e}),le.delete(e),Qt(),Rr===e&&kt(),fr.delete(e),Pr(),Ji.delete(e),r.term!==null)try{r.term.dispose()}catch{}if(r.termEl!==null&&r.termEl.remove(),Se===e){Se=null;let n=[...le.entries()].filter(([,s])=>s.embedded!==!0).map(([s])=>s).pop()??null;n!==null&&tr(n)}it(),ra(),es(),di(),Xe!==null&&_n(),[...le.values()].some(n=>n.embedded!==!0)?Ht():Vi()}function Fh(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error(b("error.terminalNeedsCommand"));if(/[\r\n\0]/.test(t))throw new Error(b("error.terminalCommandSingleLine"));return t}function Wh(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 pm(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&&ui(e)}}),t.observer.observe(t.hostEl))}function zh(e,t,r){let i={sid:on(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:r};return fi(i),le.set(i.sid,i),Ji.add(i.sid),e.hostEl.appendChild(i.termEl),pm(i),un(i),i}function Uh(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||Pe({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),le.delete(e.sid),Ji.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=zh(t,e.spawnSpec,e.label),Se===e.sid&&(Se=t.tab.sid,ra()),t.tab}}function _m(e,t){if(!(e instanceof HTMLElement))throw new Error(b("error.terminalNeedsHost"));let r=Fh(t),i=Wh(t,r),n=typeof t?.label=="string"&&t.label!==""?t.label:void 0;Yi();let s={hostEl:e,tab:null,observer:null,disposed:!1};return s.tab=zh(s,i,n),og(),()=>mm(s)}function mm(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||Pe({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),le.delete(t.sid),Ji.delete(t.sid),e.tab=null}if(ue===null&&!ta()&&Re!==null){zi=!0;try{Re.close()}catch{}Re=null}}var gm=460,vm=280,bm=320,wm=160,Ct=null,Yr=gm,Xr=bm;function ia(){let e=ue!==null?ue.querySelector(".tt_modal"):null,t=e!==null?e:ue;return t!==null?t.getBoundingClientRect():null}var sa=e=>e==="bottom"?wm:vm;function ym(e){let t=ia();if(t===null)return 900;let r=e==="bottom"?t.height:t.width;return Math.max(sa(e),Math.round(r*.72))}function Ii(e,t){return Math.min(ym(e),Math.max(sa(e),Math.round(t)))}function Ws(){let e=Ct;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){Xr=Ii("bottom",Xr),e.el.style.width="",e.el.style.height=String(Xr)+"px",e.el.style.flexBasis=String(Xr)+"px";return}Yr=Ii("right",Yr),e.el.style.height="",e.el.style.width=String(Yr)+"px",e.el.style.flexBasis=String(Yr)+"px"}}function Ni(e){let t=Ct;if(t!==null){if(Ct=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{}mt!==null&&delete mt.dataset.side}}function jh(e){if(Vo(),mt===null)throw new Error(b("error.panelNotReady"));Ct!==null&&Ni(!0),Yi();let t=Gr(e?.ownerSid,Se),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:sa(r)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let c=Ii(r,e.size);r==="bottom"?Xr=c:Yr=c}let n=document.createElement("div");n.className="tt_dockPane",n.dataset.side=r,mt.dataset.side=r,n.innerHTML='<div class="tt_dockPaneResize" title="'+b(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="'+b("btn.closePane")+'">'+ln+'</button></div><div class="tt_dockPaneBody"></div>',mt.appendChild(n);let s=n.querySelector(".tt_dockPaneTitle"),o=n.querySelector(".tt_dockPaneHint"),a=n.querySelector(".tt_dockPaneBody"),d=n.querySelector(".tt_dockPaneFold"),l=n.querySelector(".tt_dockPaneClose"),_=n.querySelector(".tt_dockPaneResize"),m={el:n,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?Xo:W_:m.collapsed?ea:Qo,p=c=>{m.collapsed=c===!0,m.collapsed?n.dataset.collapsed="1":delete n.dataset.collapsed,d.innerHTML=y(),d.title=m.collapsed?b("btn.expandPane"):b("btn.collapsePane"),d.setAttribute("aria-label",d.title),Ws()};return m.setTitle=c=>{s.textContent=typeof c=="string"?c:""},m.setHint=c=>{o.textContent=typeof c=="string"?c:""},m.isCollapsed=()=>m.collapsed===!0,m.collapse=()=>p(!0),m.expand=()=>p(!1),m.toggle=()=>p(!m.collapsed),m.dispose=()=>{m.disposed||Ct!==m||Ni(!1)},_.addEventListener("mousedown",c=>{if(c.button!==0||m.collapsed)return;c.preventDefault();let u=c.clientX,h=c.clientY,f=n.getBoundingClientRect(),v=g=>{r==="bottom"?Xr=Ii("bottom",Math.max(i,f.height+(h-g.clientY))):Yr=Ii("right",Math.max(i,f.width+(u-g.clientX))),Ws()},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)}),_.addEventListener("dblclick",()=>p(!m.collapsed)),d.addEventListener("click",()=>p(!m.collapsed)),l.addEventListener("click",()=>Ni(!0)),m.setTitle(typeof e?.title=="string"?e.title:""),m.setHint(typeof e?.hint=="string"?e.hint:""),p(e?.collapsed===!0),Ct=m,Ws(),$h(),m}function $h(){let e=Ct;if(e!==null){if(bo(e.ownerKey,Se)){delete e.el.dataset.dockHidden,mt!==null&&(mt.dataset.side=e.side);return}e.el.dataset.dockHidden="1",mt!==null&&delete mt.dataset.side}}function tr(e,t){let r=le.get(e);if(r===void 0||r.embedded===!0)return;t?.user===!0&&(r.watched=!0);let i=Se!==null?le.get(Se):void 0;if(!(i!==void 0&&i.releasePending===!0&&i.sid!==e&&le.size>1&&(Ft(i.sid,{silent:!0}),le.get(e)===void 0))){Se=e,kt(),Pr();for(let[n,s]of le)s.embedded!==!0&&s.termEl!==null&&(s.termEl.style.display=n===e?"":"none");r.embedded!==!0&&Je!==null&&r.termEl!==null&&r.termEl.parentElement!==Je&&Je.appendChild(r.termEl),Qi(),Ar(),it(),Er(),$h();try{r.fit.fit()}catch{}r.spawned&&!r.exited&&ui(r),Vr(r,""),es(),ra()}}function To(e){if(Ee===null)return;let t=le.get(e);if(t===void 0)return;let i=Ee.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");if(i==null)return;i.dataset.state=en(t);let n=nt===null?null:nt.querySelector('[data-sid="'+e+'"] .tt_tabDot');n!==null&&(n.dataset.state=en(t))}var Mo=!1;function it(){if(Ee===null)return;if(Ee.querySelector(".tt_tabRename")!==null){Mo||(Mo=!0,setTimeout(()=>{Mo=!1,it()},1e3));return}Ee.textContent="";for(let[t,r]of le){if(r.embedded===!0)continue;let i=document.createElement("button");i.className="tt_tab",i.dataset.sid=t,t===Se&&(i.dataset.active="");let n=document.createElement("span");n.className="tt_tabDot",n.dataset.state=en(r),i.appendChild(n);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=Hh(t),s.addEventListener("dblclick",a=>{a.stopPropagation(),km(t,i)});let o=document.createElement("span");o.className="tt_tabClose",o.title=b("btn.close"),o.innerHTML=Xi,o.setAttribute("role","button"),o.setAttribute("aria-label",b("btn.closeTabAria",{label:r.label||""})),o.tabIndex=0,o.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" "||a.key==="Spacebar")&&(a.preventDefault(),a.stopPropagation(),Ft(t))}),i.title=vr(r.spawnSpec)?`${s.textContent} \u2014 ${b("btn.hiddenMark")}`:s.textContent,i.appendChild(s),i.appendChild(o),i.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),Ft(t);return}tr(t,{user:!0})}),Ee.appendChild(i)}let e=Ee.querySelector("[data-active]");e!==null&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest",inline:"nearest"}),li(),nt!==null&&le.size===0&&vt()}function li(){if(Ee===null)return;let e=Ee.scrollWidth-Ee.clientWidth,t=e>1,r=zc(id()),i=t||ld().length>0||r>=2;if(Bt!==null&&(Bt.hidden=!i,i?Bt.title=b("btn.tabListTitle",{n:String(r)}):nt!==null&&vt()),!t){delete Ee.dataset.edge,nt!==null&&Uo();return}let n=Ee.scrollLeft>1,s=Ee.scrollLeft<e-1;Ee.dataset.edge=n&&s?"both":s?"end":"start",nt!==null&&Uo()}function en(e){return e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting"}function Sm(e){if(Ee===null||Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let t=Ee.scrollWidth-Ee.clientWidth;if(t<=1)return;let r=Math.max(0,Math.min(t,Ee.scrollLeft+e.deltaY));r!==Ee.scrollLeft&&(e.preventDefault(),Ee.scrollLeft=r)}function Cm(e){return e?.direction==="remote"?b("meta.tunnelRemote",{host:e.remoteHost||"127.0.0.1",port:String(e.remotePort??0),local:String(e.localTargetPort??0)}):b("meta.tunnelLocal",{local:String(e?.localPort??0),host:e?.remoteHost??"?",port:String(e?.remotePort??0)})}function Er(){if(Ri===null||Ks===null||Di===null||Ai===null)return;Di.textContent="";let e=xt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){Ri.dataset.hidden="";return}delete Ri.dataset.hidden;let r=Number(t.port);Ks.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:""),pt!==null&&(e.persistTmux===!0?(pt.textContent="tmux",pt.dataset.state="ok",pt.title=b("status.tmuxPersistedTitle")):t.persist===!0&&e.spawned===!0?(pt.textContent=b("status.notPersisted"),pt.dataset.state="warn",pt.title=b("status.tmuxUnavailableTitle")):(pt.textContent="",delete pt.dataset.state,pt.removeAttribute("title")));let i=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";Ai.dataset.state=i,Ai.title=b(i==="connected"?"status.connected":i==="connecting"?"status.connecting":i==="error"?"status.errored":"status.exited");let n=(o,a,d,l)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=d,_.innerHTML=o+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",l),Di.appendChild(_)};if(typeof t.command=="string"&&t.command!=="")return;let s=typeof t.name=="string"?t.name:"";for(let o of Bo)try{o({tab:e,spec:t,bookName:s,addAction:n})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}function xm(e,t){if(ri!==null){zs();return}let r=document.createElement("div");r.className="tt_addMenu tt_connMore",ri=r,Dr(r,b("panel.tunnels"),b("hint.tunnelsSettings"),()=>{zs(),qh(e,t)},void 0,Sh),document.body.appendChild(r);let i=e.getBoundingClientRect(),n=r.offsetWidth,o=i.left+n>window.innerWidth-8?i.right-n:i.left;r.style.left=Math.max(8,Math.min(o,window.innerWidth-n-8))+"px",r.style.top=i.bottom+6+"px";let a=d=>{ri===r&&(r.contains(d.target)||e.contains(d.target)||zs())};js=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0)}function zs(){js!==null&&(document.removeEventListener("mousedown",js,!0),js=null),ri!==null&&(ri.remove(),ri=null)}var wr=null,Us=null,ri=null,js=null;function tn(){Us!==null&&(document.removeEventListener("mousedown",Us,!0),Us=null),wr!==null&&(wr.remove(),wr=null)}function qh(e,t){if(wr!==null){tn();return}let r=document.createElement("div");r.className="tt_tunnelPop";let i=document.createElement("div");i.className="tt_tunnelPopTitle",i.textContent=b("panel.tunnelsFor",{name:t}),r.appendChild(i);let n=document.createElement("div");n.textContent=b("list.loading"),r.appendChild(n);let s=document.createElement("span");s.className="tt_cardHint",s.textContent=b("hint.tunnelsCard"),r.appendChild(s),document.body.appendChild(r),wr=r;let o=e.getBoundingClientRect();r.style.top=String(o.bottom+6)+"px",r.style.left=String(Math.max(8,o.right-340))+"px";let a=d=>{wr===r&&(r.contains(d.target)||e.contains(d.target)||tn())};Us=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let d=[];try{let m=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();m.ok&&Array.isArray(m.tunnels)&&(d=m.tunnels)}catch{}if(wr!==r)return;n.textContent="";let l=na.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(l.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent=b("list.noActiveTunnels"),n.appendChild(_);return}for(let _ of l){let m=d.find(h=>h?.name===_?.name),y=m?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=y==="active"?"connected":y==="error"?"error":"connecting";let u=document.createElement("span");u.className="tt_connTarget",u.title=String(m?.error??m?.lastForwardError??""),u.textContent=Cm(_)+" \xB7 "+y+(m?.fatal===!0?b("status.fatalSuffix"):""),p.appendChild(c),p.appendChild(u),n.appendChild(p)}})()}function fn(e){let t=1;for(let r of le.keys()){if(r===e)return String(t);t+=1}return String(t)}function km(e,t){let r=le.get(e);if(r===void 0||t.querySelector(".tt_tabRename")!==null)return;let i=t.querySelector(".tt_tabLabel");if(i===null)return;let n=document.createElement("input");n.className="tt_tabRename",n.value=r.label||b("panel.tabLabel",{n:fn(e)}),i.replaceWith(n),n.focus(),n.select();let s=!1,o=()=>{if(s)return;s=!0;let d=n.value.trim();r.label=d!==""?d:void 0,it(),Ht()},a=()=>{s||(s=!0,it())};n.addEventListener("keydown",d=>{d.stopPropagation(),d.key==="Enter"?o():d.key==="Escape"&&a()}),n.addEventListener("blur",o),n.addEventListener("click",d=>d.stopPropagation())}var na=[],Kh="dialog",ur="off",Jt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},Gh="dsh-tty:show-hidden",yr=(()=>{try{return localStorage.getItem(Gh)==="1"}catch{return!1}})();function Em(e){yr=e===!0;try{localStorage.setItem(Gh,yr?"1":"0")}catch{}for(let t of No)try{t(yr)}catch{}}var No=new Set,Ho=null,ii=null,Vh=!1,Yh=!1,dr=null,rn=null,Lr=!1;function Xh(e){Lr=e,rn!==null&&rn.set(e)}function Lm(e){Xh(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==Js&&(Js=e.statsEnabled,Qi(),Ar())}function Ki(e){Lm(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(Zt=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(na=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(Kh=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(ur=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(Jt={...Jt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(ii=e.maxSessions),e!==null&&typeof e=="object"&&typeof e.allowProxyCommand=="boolean"&&(Vh=e.allowProxyCommand),e!==null&&typeof e=="object"&&typeof e.assistEnabled=="boolean"&&(Ys=e.assistEnabled,Ys||kt(),Pr()),e!==null&&typeof e=="object"&&typeof e.allowProxyCommandGranted=="boolean"&&(Yh=e.allowProxyCommandGranted)}function Tm(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"?Th:r==="info"?j_:U_)+'</span><span class="tt_toastText"></span>',i.lastElementChild.textContent=e,document.body.appendChild(i),setTimeout(()=>i.remove(),4e3)}async function Jh(){try{Pe({t:"sessions"});let e=await Qs("sessions",3e3);if(e!==null&&Array.isArray(e.list))return dr=Ic(e.list),dr}catch{}return null}async function sn(){if(await Jh(),ii===null||dr===null||dr<ii)return null;let e=[...le.values()].filter(n=>!n.exited).length,t=Math.max(0,dr-e),r=t>0?b("msg.maxSessionsOthers",{count:t}):"",i=b("msg.maxSessions",{live:dr,max:ii,own:e,others:r});return Tm(i),i}function Mm(){return ii!==null&&dr!==null&&dr>=ii}function oa(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Zh(e){return na.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function Fo(e){let t=Number(e?.port),r=Number.isInteger(t)&&t!==22?":"+t:"",i=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",n=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+r+" \xB7 "+i+n}async function Wo(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:b("error.probeHttp",{status:r.status}))}}function zo(e,t){if(!e)return b("msg.probing");let r=e,i=typeof r.tcp?.ms=="number"?r.tcp.ms:null,n=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 _=typeof r.jump.tcp?.ms=="number"?r.jump.tcp.ms:null,m=r.jump.tcp?.ok?_!==null?_+"ms":b("meta.reachable"):b("meta.unreachable");s.push(b("meta.jumpStage",{label:r.jump.label})+" "+m)}r.proxy!==null&&typeof r.proxy=="object"&&s.push(r.proxy.active===!0?b("meta.probeProxy"):b("meta.probeProxyOff")),r.tcp?.ok?s.push("TCP "+(i!==null?i+"ms":b("meta.reachable"))):r.tcp?.skipped===!0&&s.push(b("meta.probeTcpSkipped")),r.banner?.ok&&s.push(b("meta.probeBanner"));let o=r.hostkey?.state;if(o==="matched"?s.push(b("meta.hostKeyMatched")):o==="recorded"?s.push(b("meta.hostKeyRecorded")):o==="mismatch"&&s.push(b("meta.hostKeyMismatch")),r.auth?.ok){let _=n!==null?b("meta.authOkMs",{ms:n}):b("meta.authOk");return b("meta.probeOk",{detail:_+(s.length?" \xB7 "+s.join(" \xB7 "):"")})}let a=r.tcp?.skipped===!0?"":r.tcp?.error,l=(r.auth?.error||a||b("error.unknown"))+(s.length?" \xB7 "+s.join(" \xB7 "):"");return t?.prefix!==void 0?t.prefix+l:b("error.probeFailed",{detail:l})}async function aa(){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=Zt;Ki(t.config),gt!==null&&Zt!==r&&Ko(gt)}}catch{}}function Qh(e){gt!==null&&(e.target instanceof Element&&(gt.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||_t())}function ts(e,t){ed(e,t.getBoundingClientRect())}function ed(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 o=t.bottom+6,a=t.top-i-6;e.style.top=(o+i>window.innerHeight-8&&a>=8?a:Math.min(o,Math.max(8,window.innerHeight-i-8)))+"px"}function Rm(e){if(gt!==null){_t();return}vt(),aa(),Jh().then(()=>{gt!==null&&Ko(gt)});let t=document.createElement("div");t.className="tt_addMenu",gt=t,Ko(t),document.body.appendChild(t),ts(t,e),document.addEventListener("mousedown",Qh,!0)}function _t(){gt!==null&&(document.removeEventListener("mousedown",Qh,!0),gt.remove(),gt=null)}function Am(e){if(nt!==null){vt();return}_t();let t=document.createElement("div");t.className="tt_addMenu tt_tabMenu",nt=t,Uo(),document.body.appendChild(t),ts(t,e),document.addEventListener("mousedown",td,!0),document.addEventListener("keydown",rd,!0)}function vt(){nt!==null&&(document.removeEventListener("mousedown",td,!0),document.removeEventListener("keydown",rd,!0),nt.remove(),nt=null)}function td(e){nt!==null&&(e.target instanceof Element&&(nt.contains(e.target)||e.target.closest(".tt_tabMore")!==null)||vt())}function rd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),vt())}function Uo(){let e=nt;if(e===null)return;e.textContent="";let t=Fm();if(t.length===0){let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=b("list.tabsAllVisible"),e.appendChild(i),jo(e,Se),$o(e);return}for(let[i,n]of t){let s=Hh(i)||n.label||b("panel.tabLabel",{n:fn(i)}),o=Wm(n),a=document.createElement("div");a.className="tt_addMenuRow tt_tabMenuRow",a.dataset.sid=i;let d=document.createElement("button");d.type="button",d.className="tt_addMenuItem tt_tabMenuItem",i===Se&&(d.dataset.active="");let l=document.createElement("span");l.className="tt_tabDot",l.dataset.state=en(n),d.appendChild(l);let _=document.createElement("span");_.className="tt_addMenuText tt_tabMenuText";let m=document.createElement("span");if(m.className="tt_addMenuMain",m.textContent=s,_.appendChild(m),o!==""){let p=document.createElement("span");p.className="tt_tabMenuMeta",p.textContent=o,_.appendChild(p)}d.appendChild(_),d.title=o===""?s:s+" \xB7 "+o,d.addEventListener("click",()=>{tr(i,{user:!0}),vt()}),a.appendChild(d);let y=document.createElement("button");y.type="button",y.className="tt_addMenuEdit",y.innerHTML=Xi,y.title=b("btn.close"),y.setAttribute("aria-label",b("btn.closeTabAria",{label:s})),y.addEventListener("click",()=>{Ft(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"}),jo(e,Se),$o(e)}function id(){return[...le].map(([e,t])=>({sid:e,embedded:t.embedded===!0,exited:t.exited===!0,agentOwned:t.agentOwned===!0}))}function jo(e,t){let r=Uc(id(),t),i=[[b("btn.closeOthers",{n:String(r.others.sids.length)}),r.others,Sr],[b("btn.closeLeft",{n:String(r.left.sids.length)}),r.left,ea],[b("btn.closeRight",{n:String(r.right.sids.length)}),r.right,Qo]].filter(([,s])=>s.sids.length>0);if(i.length===0)return;let n=document.createElement("div");n.className="tt_addMenuSep",e.appendChild(n);for(let[s,o,a]of i)Dr(e,s,o.live>0?b("list.subLive",{n:String(o.live)}):"",()=>{Dm(o)},void 0,a)}function Dm(e){if(Qt(),vt(),e.sids.length===0)return;let t=e.sids.slice(),r=()=>{for(let i of t)Ft(i)};if(e.confirm!==!0){r();return}Cd({title:b("confirm.tabsTitle",{n:String(e.live)}),text:e.agentLive>0?b("confirm.tabsTextAgent",{n:String(e.live),agent:String(e.agentLive)}):b("confirm.tabsText",{n:String(e.live)}),hint:b("confirm.tabsHint"),okLabel:b("confirm.tabsOk",{n:String(e.live)}),onOk:r})}var si=null,sd=null;function Pm(e,t,r){if(le.get(e)===void 0)return;Qt(),_t(),vt();let i=document.createElement("div");i.className="tt_addMenu tt_tabCtxMenu",si=i,sd=e,Bm(i,e),document.body.appendChild(i),ed(i,{left:t,right:t,top:r,bottom:r}),document.addEventListener("mousedown",nd,!0),document.addEventListener("keydown",od,!0)}function Qt(){si!==null&&(document.removeEventListener("mousedown",nd,!0),document.removeEventListener("keydown",od,!0),si.remove(),si=null,sd=null)}function nd(e){si!==null&&(e.target instanceof Element&&si.contains(e.target)||Qt())}function od(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Qt())}function Bm(e,t){let r=le.get(t);if(r===void 0)return;let i=r.label||b("panel.tabLabel",{n:fn(t)});if(Dr(e,b("btn.closeTab"),i,()=>{Qt(),Ft(t)},void 0,Xi),So(r)){let n=vr(r.spawnSpec);Dr(e,b(jc(n)),i,()=>{Qt(),um(t,!n)},void 0,n?N_:I_)}jo(e,t),$o(e)}function Om(e){let t=ad(e.target);if(t===null)return;e.preventDefault();let r=e.clientX,i=e.clientY;if(r===0&&i===0){let n=e.target instanceof Element?e.target.closest(".tt_tab"):null;if(n!==null){let s=n.getBoundingClientRect();r=s.left,i=s.bottom}}Pm(t,r,i)}function Im(e){if(e.button!==1)return;let t=ad(e.target);t!==null&&(e.preventDefault(),Ft(t))}function ad(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===""||!le.has(r)?null:r}function ld(){return[...le.values()].filter(e=>e.embedded!==!0&&e.exited===!0)}function $o(e){let t=ld();if(t.length===0)return;let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r),Dr(e,b("list.cleanExited",{n:String(t.length)}),"",()=>{vt(),Qt();for(let i of t)Ft(i.sid)},void 0,yh)}var Nm=40;function Hm(e,t){let r=e.getBoundingClientRect();return Math.max(0,Math.min(r.right,t.right)-Math.max(r.left,t.left))}function Fm(){let e=[];if(Ee===null)return e;let t=Ee.getBoundingClientRect();for(let[r,i]of le){if(i.embedded===!0)continue;let n=Ee.querySelector('[data-sid="'+r+'"]');n!==null&&Hm(n,t)<Nm&&e.push([r,i])}return e}function Wm(e){return typeof e.target=="string"?e.target:""}function zm(){return b("panel.assistTitle")===$s["panel.assistTitle"]?"zh":"en"}function Um(e){let t=e!=null&&typeof e.exitCode=="number"?String(e.exitCode):"?";return b("badge.assistFailed",{code:t})}function Pr(){if(cr===null)return;let e=Se===null?void 0:fr.get(Se),t=Ys&&e!==void 0&&e.dismissed!==!0;if(cr.hidden=!t,t){let r=cr.querySelector(".tt_assistBadgeText");r!==null&&(r.textContent=Um(e))}}function kt(){Qr!==null&&(Qr.abort(),Qr=null),kr!==null&&(kr.remove(),kr=null),Rr=null,Xs=null}function jm(e){kr!==null&&(e.target instanceof Element&&(kr.contains(e.target)||e.target.closest(".tt_assistBadge")!==null)||kt())}function $m(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),kt())}function qm(e){let t=Se;if(t===null)return;kt();let r=document.createElement("div");r.className="tt_addMenu tt_assistMenu",kr=r,Rr=t,Xs=e,document.body.appendChild(r),document.addEventListener("mousedown",jm,!0),document.addEventListener("keydown",$m,!0),qo(),ts(r,e),Km(t)}async function Km(e){let t=fr.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,qo();let r=new AbortController;Qr=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:zm()}),signal:r.signal}),n=await i.json().catch(()=>null);if(Rr!==e)return;t.busy=!1,i.ok&&n!==null&&n.ok===!0?(t.answer=String(n.answer!==void 0?n.answer:""),t.command=String(n.command!==void 0?n.command:"")):t.error=n!==null&&n.error!==void 0?String(n.error):"HTTP "+String(i.status)}catch(i){if(r.signal.aborted||Rr!==e)return;t.busy=!1,t.error=i instanceof Error?i.message:String(i)}finally{Qr===r&&(Qr=null),t.busy=!1,qo()}}function qo(){let e=kr;if(e===null)return;let t=Rr,r=t===null?void 0:fr.get(t);e.textContent="";let i=document.createElement("div");i.className="tt_assistHead";let n=document.createElement("span");if(n.className="tt_assistTitle",n.textContent=b("panel.assistTitle"),i.appendChild(n),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!=="",o=document.createElement("div");if(o.className="tt_assistBody",r===void 0||r.busy===!0){o.classList.add("tt_assistMuted","tt_assistBusy");let m=document.createElement("span");m.className="tt_assistSpin",o.appendChild(m),o.appendChild(document.createTextNode(b("status.assistThinking")))}else if(s)o.textContent=b("error.assistRequest",{message:r.error}),o.classList.add("tt_assistError");else{let m=r.answer!==null&&r.answer!==void 0?r.answer:"";o.textContent=m,o.classList.add("tt_assistAnswer"),m===""&&(o.hidden=!0)}if(e.appendChild(o),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=b("panel.assistCommand"),m.appendChild(y);let p=document.createElement("div");p.className="tt_assistCmd",p.textContent=r.command,m.appendChild(p),e.appendChild(m)}let d=document.createElement("div");if(d.className="tt_assistFoot",a){let m=document.createElement("button");m.type="button",m.className="tt_toolBtn tt_assistFill",m.textContent=b("btn.assistFill"),m.title=b("hint.assistFillNoEnter"),m.addEventListener("click",Gm),d.appendChild(m)}let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent=b(s?"btn.assistCopyError":"btn.assistCopy"),l.addEventListener("click",()=>{if(s){uh(b("error.assistRequest",{message:r.error}));return}uh(r.answer!==null&&r.answer!==void 0?r.answer:"")}),d.appendChild(l);let _=document.createElement("button");if(_.type="button",_.className="tt_toolBtn tt_assistClose",_.textContent=b("btn.assistClose"),_.addEventListener("click",()=>{kt()}),d.appendChild(_),e.appendChild(d),!s){let m=document.createElement("span");m.className="tt_assistNote",m.textContent=b(a?"hint.assistFillNoEnter":"hint.assistNoCommand"),e.appendChild(m)}Xs!==null&&ts(e,Xs)}function Gm(){let e=Rr,t=e===null?void 0:fr.get(e);if(e===null||t===void 0||t.command==="")return;Pe({t:"input",sid:e,d:""+t.command});let r=le.get(e);kt(),Vm(e),r!==void 0&&r.term!==null&&r.term.focus()}function Vm(e){let t=fr.get(e);t!==void 0&&(t.dismissed=!0),Pr()}function Dr(e,t,r,i,n,s){let o=document.createElement("button");if(o.type="button",o.className="tt_addMenuItem",n===!0&&(o.setAttribute("data-soldout",""),o.title=b("btn.maxSessionsTitle")),s!==void 0){let l=document.createElement("span");l.className="tt_addMenuIcon",l.innerHTML=s,o.appendChild(l)}let a=document.createElement("span");a.className="tt_addMenuText";let d=document.createElement("span");if(d.className="tt_addMenuMain",d.textContent=t,a.appendChild(d),r!==""){let l=document.createElement("span");l.className="tt_addMenuSub",l.textContent=r,a.appendChild(l)}o.appendChild(a),o.addEventListener("click",i),e.appendChild(o)}function Ko(e){e.textContent="";let t=Mm();Dr(e,b("option.localTerminal"),b(ur==="tmux"?"hint.tmuxHosted":"hint.openInSessionCwd"),async()=>{await sn()||(_t(),$i())},t,an);let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r);let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=b("panel.sshBook"),e.appendChild(i);for(let s of Zt){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let o=document.createElement("div");o.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title=b("btn.maxSessionsTitle"));let d=document.createElement("span");d.className="tt_addMenuIcon",d.innerHTML=z_;let l=document.createElement("span");l.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=s.name;let m=document.createElement("span");m.className="tt_addMenuSub";let y=Zh(s.name),p=go(s.jump);m.textContent=Fo(s)+(p===""?"":" "+b("meta.viaJump",{label:p}))+(typeof s.proxyCommand=="string"&&s.proxyCommand.trim()!==""?" "+b("meta.viaProxy"):"")+(y>0?" \xB7 \u21C4"+String(y):""),l.appendChild(_),l.appendChild(m),a.appendChild(d),a.appendChild(l),a.addEventListener("click",async()=>{if(await sn())return;_t();let h=ur==="tmux"&&s.persist!==!1?{persist:!0,persistName:oa()}:{};$i({t:"ssh",name:s.name,...h},s.name)});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title=b("btn.sftpFileBrowse"),c.innerHTML=Fi,c.addEventListener("click",()=>{_t(),pn({name:s.name})});let u=document.createElement("button");u.type="button",u.className="tt_addMenuEdit",u.title=b("btn.editConnection"),u.innerHTML=Jo,u.addEventListener("click",()=>{_t(),hh(s)}),o.appendChild(a),o.appendChild(c),o.appendChild(u),e.appendChild(o)}if(Zt.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent=b("list.emptySshBook"),e.appendChild(s)}let n=document.createElement("div");n.className="tt_addMenuSep",e.appendChild(n),Dr(e,b("option.sshConnect"),b("hint.sshConnect"),()=>{_t(),hh()},!1,Mh)}function hh(e){if(ei!==null)return;let t=e!==null&&typeof e=="object"?e:null,r=t!==null,i=document.createElement("div");i.className="tt_sshBackdrop";let n=document.createElement("div");n.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=Mh+"<span></span>",s.lastElementChild.textContent=r?b("panel.editConnection",{name:String(t.name??"")}):b("panel.sshConnect"),n.appendChild(s);let o=Z=>{let re=document.createElement("div");return re.className="tt_sshSection",re.textContent=Z,re},a={},d=(Z,re,ne)=>{let oe=document.createElement("label");oe.className="tt_sshRow";let ie=document.createElement("span");ie.className="tt_cardLabel",ie.textContent=re,oe.appendChild(ie);let ae;if(ne?.select!==void 0){ae=document.createElement("select");for(let he of ne.select){let ye=document.createElement("option");ye.value=he.value,ye.textContent=he.label,ae.appendChild(ye)}}else ae=document.createElement("input"),ae.type=ne?.type??"text",ae.placeholder=ne?.placeholder??"";return ae.className="tt_cardInput",ae.autocomplete="off",ae.spellcheck=!1,oe.appendChild(ae),a[Z]=ae,oe};n.appendChild(o(b("section.connection")));let l=document.createElement("div");l.className="tt_sshGrid",l.appendChild(d("host",b("field.host"),{placeholder:b("placeholder.host")})),l.appendChild(d("port",b("field.port"),{placeholder:"22"})),n.appendChild(l),n.appendChild(d("username",b("field.username"),{placeholder:"root"})),n.appendChild(o(b("section.auth"))),n.appendChild(d("auth",b("field.authMethod"),{select:[{value:"agent",label:b("option.authAgent")},{value:"key",label:b("option.authKey")},{value:"password",label:b("option.authPassword")}]}));let _=d("keyPath",b("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),m=d("passphrase",b("field.passphrase"),{type:"password"}),y=d("password",b("field.password"),{type:"password"}),p=(Z,re)=>{let ne=document.createElement("div");ne.className="tt_sshRow tt_envRow";let oe=document.createElement("input");oe.type="text",oe.className="tt_cardInput",oe.placeholder=b("placeholder.credRef"),oe.title=b("hint.credRefCandidates"),oe.autocomplete="off",oe.spellcheck=!1;let ie=document.createElement("span");ie.className="tt_cardHint tt_envEmpty",ie.textContent=re,ie.hidden=!0,oe.hidden=!0;let ae=document.createElement("div");ae.className="tt_envList",ae.dataset.hidden="";let he=[],ye=()=>{if(ae.textContent="",he.length===0){let Ae=document.createElement("span");Ae.className="tt_cardHint",Ae.textContent=re,ae.appendChild(Ae);return}let be=oe.value.trim().toUpperCase(),Le=be===""?he:he.filter(Ae=>Ae.toUpperCase().includes(be));for(let Ae of Le.slice(0,30)){let we=document.createElement("button");we.type="button",we.className="tt_envItem",we.textContent=Ae;let Ce="env:"+Ae,Ne=null,Ue=()=>{Ne!==null&&(clearTimeout(Ne),Ne=null),we.textContent=Ae,delete we.dataset.danger};we.addEventListener("mousedown",Wt=>Wt.preventDefault()),we.addEventListener("click",()=>{let Wt=Z.value;if(Wt===""||Wt.startsWith("env:")||Ne!==null){Ue(),Z.value=Ce,Z.focus(),Z.dispatchEvent(new Event("change"));return}we.textContent=b("list.credOverwrite",{name:Ae}),we.dataset.danger="",Ne=setTimeout(Ue,4e3)}),ae.appendChild(we)}if(Le.length>30){let Ae=document.createElement("span");Ae.className="tt_envMore",Ae.textContent=b("list.moreMatches",{count:Le.length-30}),ae.appendChild(Ae)}else if(Le.length===0){let Ae=document.createElement("span");Ae.className="tt_envMore",Ae.textContent=b("list.noCredRef"),ae.appendChild(Ae)}};return oe.addEventListener("input",ye),oe.addEventListener("focus",()=>{he.length>0&&delete ae.dataset.hidden}),oe.addEventListener("blur",()=>{oe.value.trim()===""&&(ae.dataset.hidden="")}),ne.appendChild(oe),ne.appendChild(ie),ne.appendChild(ae),{row:ne,setNames(be){he=Array.isArray(be)?be:[];let Le=he.length>0;oe.hidden=!Le,ie.hidden=Le,ye()}}},c=(Z,re)=>{let ne=document.createElement("div");ne.className="tt_sshRow tt_credRow";let oe=document.createElement("label");oe.className="tt_credToggle";let ie=document.createElement("input");ie.type="checkbox",ie.className="tt_cardCheckbox";let ae=document.createElement("span");ae.textContent=b("check.rememberCredential"),oe.appendChild(ie),oe.appendChild(ae),ie.checked=Ot!==null,oe.title=b("hint.rememberCredential");let he=document.createElement("button");he.type="button",he.className="tt_toolBtn tt_credClear",he.textContent=b("btn.clearCredential"),he.dataset.hidden="";let ye=document.createElement("span");ye.className="tt_credStatus",ne.appendChild(oe),ne.appendChild(he),ne.appendChild(ye);let be=(we,Ce)=>{ye.textContent=we,ye.dataset.kind=Ce},Le=async()=>{let we=Jr(Z.value),Ce=we!=="";if(oe.hidden=Ce,he.hidden=!Ce,ye.hidden=!1,oi()===null){ie.disabled=!0,ie.checked=!1,he.disabled=!0,be(b(Ot===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),"muted");return}if(ie.disabled=!1,!Ce){ye.hidden=!0,be("","plain");return}let Ne=await vh(we);if(Ne.unreported===!0){be(b("status.credUnreported",{ref:we}),"plain");return}if(Ne.error!==void 0){be(b("error.credStatusFailed",{error:Ne.error}),"error");return}let Ue=Ne.view;be(Ue.configured?b("status.credStored",{ref:we,source:Ue.source!==""?b("meta.credSource",{source:Ue.source}):""}):b("status.credUnknown",{ref:we}),Ue.configured?"ok":"plain"),he.disabled=Ue.configured!==!0||Ue.writable!==!0};he.addEventListener("click",()=>{(async()=>{let we=Jr(Z.value);if(we==="")return;let Ce=await bh(we);if(Ce.error!==void 0){be(Ce.error,"error");return}Z.value="",await Le()})()});let Ae=async()=>{let we=await wh(ie.checked===!0,Z.value,a.host.value,a.port.value,a.username.value,re);return we.value!==void 0&&(Z.value=we.value,await Le()),we};return Z.addEventListener("change",()=>{Le()}),{row:ne,refresh:Le,storeIfRequested:Ae}},u=p(a.passphrase,b("hint.noCredRefPassphrase")),h=p(a.password,b("hint.noCredRefPassword")),f=c(a.password,"PASSWORD");(async()=>{let Z=await gh();u.setNames(Z),h.setNames(Z)})(),n.appendChild(_),n.appendChild(m),n.appendChild(u.row),n.appendChild(y),n.appendChild(f.row),n.appendChild(h.row),n.appendChild(o(b("section.jump")));let v=d("jumpHost",b("field.jumpHost"),{placeholder:b("placeholder.jumpHost")});n.appendChild(v);let S=document.createElement("label");S.className="tt_sshRow";let g=document.createElement("input");g.type="checkbox",g.className="tt_cardCheckbox";let x=document.createElement("span");x.className="tt_cardLabel",x.textContent=b("check.jumpOwnCred"),S.appendChild(g),S.appendChild(x),n.appendChild(S);let w=d("jumpUsername",b("field.jumpUsername"),{placeholder:"root"}),E=d("jumpAuth",b("field.jumpAuth"),{select:[{value:"",label:b("option.authInherit")},{value:"agent",label:b("option.authAgent")},{value:"key",label:b("option.authKey")},{value:"password",label:b("option.authPassword")}]}),P=d("jumpKeyPath",b("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),O=d("jumpPassphrase",b("field.passphrase"),{type:"password"}),F=d("jumpPassword",b("field.password"),{type:"password"});for(let Z of[w,E,P,O,F])n.appendChild(Z);let A=document.createElement("div");A.className="tt_cardHint",A.textContent=b("hint.jumpInherit"),n.appendChild(A),n.appendChild(o(b("section.proxyCommand")));let V=d("proxyCommand",b("field.proxyCommand"),{placeholder:b("placeholder.proxyCommand")});n.appendChild(V);let B=document.createElement("div");B.className="tt_cardHint",B.textContent=b("hint.proxyCommand"),n.appendChild(B);let R=document.createElement("div");R.className="tt_cardHint tt_sshProbeWarn",R.textContent=b("hint.proxyCommandDisabled"),n.appendChild(R);let z=()=>{let Z=a.proxyCommand.value.trim()!=="",re=Yh,ne=re&&Vh;R.textContent=b(re?"hint.proxyCommandDisabled":"hint.proxyCommandNotGranted"),R.style.display=Z&&!ne?"":"none"};a.proxyCommand.addEventListener("input",z),z();let I=()=>{let Z=mo(a.jumpHost.value);if(Z===void 0)return;if(g.checked!==!0)return Z;let re={...Z},ne=a.jumpUsername.value.trim();ne!==""&&(re.username=ne);let oe=a.jumpAuth.value;(oe==="agent"||oe==="key"||oe==="password")&&(re.auth=oe);let ie=a.jumpKeyPath.value.trim();return ie!==""&&(re.keyPath=ie),a.jumpPassphrase.value!==""&&(re.passphrase=a.jumpPassphrase.value),a.jumpPassword.value!==""&&(re.password=a.jumpPassword.value),re},C=()=>{let Z=a.proxyCommand.value.trim();return Z===""?void 0:Z},L=()=>{let Z=mo(a.jumpHost.value)!==void 0,re=Z&&g.checked===!0;S.style.display=Z?"":"none";for(let ne of[w,E,P,O,F])ne.style.display=re?"":"none";P.style.display=re&&a.jumpAuth.value==="key"?"":"none",O.style.display=re&&a.jumpAuth.value==="key"?"":"none",F.style.display=re&&a.jumpAuth.value==="password"?"":"none",A.style.display=Z?"":"none"};a.jumpHost.addEventListener("input",L),a.jumpAuth.addEventListener("change",L),g.addEventListener("change",L),n.appendChild(o(b("section.options")));let T=document.createElement("label");T.className="tt_cardRow";let D=document.createElement("input");D.type="checkbox",D.className="tt_cardCheckbox";let N=document.createElement("span");N.className="tt_cardLabel",N.textContent=b("check.agentForward"),T.appendChild(D),T.appendChild(N),n.appendChild(T),n.appendChild(d("hostKeyAlias",b("field.hostKeyAlias"),{placeholder:b("placeholder.hostKeyAlias")}));let G=document.createElement("span");G.className="tt_cardHint",G.textContent=b("hint.hostKeyAlias"),n.appendChild(G);let j=document.createElement("label");j.className="tt_cardRow";let Y=document.createElement("input");Y.type="checkbox",Y.className="tt_cardCheckbox";let H=document.createElement("span");H.className="tt_cardLabel",H.textContent=b("check.persist"),j.appendChild(Y),j.appendChild(H),Y.checked=ur==="tmux",ur==="tmux"&&n.appendChild(j);let k=document.createElement("label");k.className="tt_cardRow";let W=document.createElement("input");W.type="checkbox",W.className="tt_cardCheckbox";let q=document.createElement("span");q.className="tt_cardLabel",q.textContent=b("check.saveToBook"),k.appendChild(W),k.appendChild(q),n.appendChild(k);let $=d("name",b("field.bookName"),{placeholder:b("placeholder.bookName")});if($.style.display="none",n.appendChild($),W.addEventListener("change",()=>{$.style.display=W.checked?"":"none",W.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),W.checked&&a.name.focus()}),r){k.style.display="none",a.name.value=String(t.name??""),$.style.display="",a.host.value=String(t.host??""),a.port.value=String(t.port??22),a.username.value=String(t.username??""),a.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",a.keyPath.value=String(t.keyPath??""),a.passphrase.value=String(t.passphrase??""),a.password.value=String(t.password??"");let Z=t.jump!==null&&typeof t.jump=="object"?t.jump:null;if(a.jumpHost.value=go(Z),Z!==null){let re=Z.auth!==void 0||Z.keyPath!==void 0||Z.password!==void 0||Z.passphrase!==void 0;g.checked=re,re&&(a.jumpUsername.value=String(Z.username??""),a.jumpAuth.value=Z.auth==="key"||Z.auth==="password"?String(Z.auth):"",a.jumpKeyPath.value=String(Z.keyPath??""),a.jumpPassphrase.value=String(Z.passphrase??""),a.jumpPassword.value=String(Z.password??""))}D.checked=t.agentForward===!0,a.hostKeyAlias.value=String(t.hostKeyAlias??""),a.proxyCommand.value=String(t.proxyCommand??""),z(),Y.checked=ur==="tmux"}let X=document.createElement("div");X.className="tt_sshStatus";let J=document.createElement("div");J.className="tt_sshError";let ce=document.createElement("div");ce.className="tt_sshProbeResult",X.appendChild(J),X.appendChild(ce),n.appendChild(X),L();let de=()=>a.hostKeyAlias.value.trim(),me=()=>{J.textContent="";let Z=a.host.value.trim(),re=a.username.value.trim(),ne=Number(a.port.value);if((!Number.isInteger(ne)||ne<1||ne>65535)&&(ne=22),Z===""||re==="")return J.textContent=b("error.hostUserRequired"),null;let oe=a.auth.value,ie={host:Z,port:ne,username:re,auth:oe},ae=I();ae!==void 0&&(ie.jump=ae);let he=C();if(he!==void 0&&(ie.proxyCommand=he),oe==="key"){let be=a.keyPath.value.trim();if(be==="")return J.textContent=b("error.keyPathRequired"),null;ie.keyPath=be;let Le=a.passphrase.value;Le!==""&&(ie.passphrase=Le)}if(oe==="password"){let be=a.password.value;if(be==="")return J.textContent=b("error.passwordRequired"),null;ie.password=be}D.checked&&(ie.agentForward=!0);let ye=de();return ye!==""&&(ie.hostKeyAlias=ye),ie},te=document.createElement("div");te.className="tt_sshActions";let Be=document.createElement("div");Be.className="tt_sshActionsGroup";let fe=document.createElement("div");fe.className="tt_sshActionsGroup",te.appendChild(Be),te.appendChild(fe);let Oe=document.createElement("button");Oe.type="button",Oe.className="tt_toolBtn",Oe.textContent=b("btn.cancel");let We=document.createElement("button");We.type="button",We.className="tt_cardSave",We.textContent=b("btn.connect"),Be.appendChild(Oe);let ke=document.createElement("button");ke.type="button",ke.className="tt_toolBtn",ke.textContent=b("btn.fileBrowse"),ke.title=b("btn.browseTitle"),ke.addEventListener("click",()=>{J.textContent="";let Z=a.host.value.trim(),re=a.username.value.trim(),ne=Number(a.port.value);if((!Number.isInteger(ne)||ne<1||ne>65535)&&(ne=22),Z===""||re===""){J.textContent=b("error.hostUserRequired");return}let oe=a.auth.value,ie={host:Z,port:ne,username:re,auth:oe},ae=I();ae!==void 0&&(ie.jump=ae);let he=C();if(he!==void 0&&(ie.proxyCommand=he),oe==="key"){let be=a.keyPath.value.trim();if(be===""){J.textContent=b("error.keyPathRequired");return}ie.keyPath=be;let Le=a.passphrase.value;Le!==""&&(ie.passphrase=Le)}if(oe==="password"){let be=a.password.value;if(be===""){J.textContent=b("error.passwordRequired");return}ie.password=be}D.checked&&(ie.agentForward=!0);let ye=de();ye!==""&&(ie.hostKeyAlias=ye),hr(),pn(ie)}),Be.appendChild(ke);let ee=null;r&&(ee=document.createElement("button"),ee.type="button",ee.className="tt_toolBtn",ee.textContent=b("btn.saveEdit"),ee.addEventListener("click",()=>{J.textContent="";let Z=a.host.value.trim(),re=a.username.value.trim();if(Z===""||re===""){J.textContent=b("error.hostUserRequired");return}let ne=Number(a.port.value);(!Number.isInteger(ne)||ne<1||ne>65535)&&(ne=22);let oe=a.auth.value,ae={name:a.name.value.trim()||Z,host:Z,port:ne,username:re,auth:oe,keyPath:oe==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:D.checked,hostKeyAlias:de(),persist:Y.checked},he=I();if(he!==void 0&&(ae.jump=he),ae.proxyCommand=a.proxyCommand.value.trim(),oe==="key"&&ae.keyPath===""){J.textContent=b("error.keyPathRequired");return}ee!==null&&(ee.disabled=!0),(async()=>{let ye=await f.storeIfRequested();if(ye.error!==void 0){J.textContent=ye.error,ee!==null&&(ee.disabled=!1);return}ye.value!==void 0&&(ae.password=ye.value);let be=await Xm(String(t.name??""),ae);if(ee!==null&&(ee.disabled=!1),be!==void 0){J.textContent=b("error.saveCredFailed",{error:be});return}hr()})()}),Be.appendChild(ee));let pe=document.createElement("button");pe.type="button",pe.className="tt_toolBtn",pe.textContent=b("btn.probe"),pe.title=b("btn.probeTitle"),pe.addEventListener("click",()=>{let Z=me();Z!==null&&(ce.className="tt_sshProbeResult",ce.textContent=b("msg.probing"),pe.disabled=!0,Wo(Z,!1).then(re=>{pe.disabled=!1,re.result?(ce.className="tt_sshProbeResult"+(re.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),ce.textContent=zo(re.result)):(ce.className="tt_sshProbeResult tt_sshProbeBad",ce.textContent=b("error.probeFailed",{detail:String(re.error||b("error.unknown"))}))}))}),Be.appendChild(pe),fe.appendChild(We),n.appendChild(te);let ve=()=>{_.style.display=a.auth.value==="key"?"":"none",m.style.display=a.auth.value==="key"?"":"none",u.row.style.display=a.auth.value==="key"?"":"none",y.style.display=a.auth.value==="password"?"":"none",h.row.style.display=a.auth.value==="password"?"":"none",f.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",ve),ve(),f.refresh(),Oe.addEventListener("click",()=>hr()),i.addEventListener("mousedown",Z=>{Z.target===i&&hr()}),We.addEventListener("click",async()=>{J.textContent="";let Z=await sn();if(Z!==null){J.textContent=Z;return}let re=a.host.value.trim(),ne=a.username.value.trim(),oe=Number(a.port.value);if((!Number.isInteger(oe)||oe<1||oe>65535)&&(oe=22),re===""||ne===""){J.textContent=b("error.hostUserRequired");return}let ie=a.auth.value,ae={t:"ssh",host:re,port:oe,username:ne,auth:ie},he=I();he!==void 0&&(ae.jump=he);let ye=C();if(ye!==void 0&&(ae.proxyCommand=ye),ie==="key"){let Ce=a.keyPath.value.trim();Ce!==""&&(ae.keyPath=Ce);let Ne=a.passphrase.value;Ne!==""&&(ae.passphrase=Ne)}if(ie==="password"){let Ce=a.password.value;Ce!==""&&(ae.password=Ce)}D.checked&&(ae.agentForward=!0);let be=de();be!==""&&(ae.hostKeyAlias=be),Y.checked&&(ae.persist=!0,ae.persistName=oa());let Le=oe!==22?ne+"@"+re+":"+oe:ne+"@"+re,Ae=Ce=>{hr(),ue!==null&&$i(ae,Ce!==""?Ce:Le)};if(!W.checked){Ae("");return}let we=a.name.value.trim()||re;We.disabled=!0,(async()=>{let Ce=await f.storeIfRequested();if(Ce.error!==void 0){J.textContent=Ce.error,We.disabled=!1;return}let Ne=Ce.value??ae.password??"",Ue=await Ym({name:we,host:re,port:oe,username:ne,auth:ie,keyPath:ae.keyPath??"",passphrase:ae.passphrase??"",password:Ne,agentForward:D.checked,hostKeyAlias:de(),persist:Y.checked,...he!==void 0?{jump:he}:{},proxyCommand:a.proxyCommand.value.trim()});if(We.disabled=!1,Ue!==void 0){J.textContent=b("error.saveBookFailed",{error:Ue});return}Ae(we)})()}),i.appendChild(n),document.body.appendChild(i),ei=i,a.host.focus()}function hr(){ei!==null&&(ei.remove(),ei=null)}async function Ym(e){let t=[...Zt.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);Ki(i.config);return}catch(r){return String(r&&r.message?r.message:r)}}async function Xm(e,t){if(t.name!==e&&Zt.some(i=>i?.name===t.name))return b("error.bookNameTaken",{name:t.name});let r=Zt.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})}),n=await i.json().catch(()=>({}));if(!i.ok||!n.ok)return String(n.error||"HTTP "+i.status);Ki(n.config);return}catch(i){return String(i&&i.message?i.message:i)}}function Jm(e,t,r){let i=Gr(r,Se);if(hd(i))return;let n=document.createElement("div");n.className="tt_sftpDualCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let o=document.createElement("div");o.className="tt_sshTitle",o.innerHTML=Fi+"<span></span>",o.lastElementChild.textContent=b("panel.sftpDual",{label:t});let a=document.createElement("button");a.type="button",a.className="tt_close",a.title=b("btn.close"),a.innerHTML=ln,a.addEventListener("click",()=>hi(i)),s.appendChild(o),s.appendChild(a),n.appendChild(s);let d=document.createElement("div");d.className="tt_sftpStatus";let l=(N,G)=>{d.textContent=N,G===void 0?delete d.dataset.state:d.dataset.state=G},_=!1,m=(N,G)=>{if(!(_||p.local.busy||p.remote.busy)){_=!0;for(let j of[p.local,p.remote])j.setBusy(!0);l(N,"busy"),Promise.resolve().then(G).catch(j=>{(j===null||typeof j!="object"||j.name!=="TransferCanceledError")&&R.fail(b("status.failed")),l(String(j&&j.message?j.message:j),"error")}).finally(()=>{_=!1;for(let j of[p.local,p.remote])j.setBusy(!1)})}},y=N=>{p[N].bar.after(h),h.style.display="",f.focus(),f.select()},p={},c=(N,G)=>{if(N===void 0||N==="")throw new Error(b("error.dirNotReady"));return N.endsWith("/")||N.endsWith("\\")?N+G:N+"/"+G},u=(N,G)=>{let j={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 W=document.createElement("span");W.className="tt_sftpPaneMeta",H.appendChild(k),H.appendChild(W),Y.appendChild(H);let q=document.createElement("div");q.className="tt_sftpBar";let $=document.createElement("input");$.type="text",$.className="tt_sftpPath",$.placeholder=b(N==="local"?"placeholder.localPath":"placeholder.remotePath"),$.spellcheck=!1,$.autocomplete="off";let X=document.createElement("button");X.type="button",X.className="tt_toolBtn",X.innerHTML=Zo+"<span>"+b("btn.refresh")+"</span>";let J=document.createElement("button");J.type="button",J.className="tt_toolBtn",J.innerHTML=Lh+"<span>"+b("btn.mkdir")+"</span>";let ce=document.createElement("button");ce.type="button",ce.className="tt_toolBtn tt_toolToggle",ce.textContent=b("btn.hiddenFiles"),ce.title=b("btn.hiddenFilesTitle"),yr&&(ce.dataset.on=""),q.appendChild($),q.appendChild(X),q.appendChild(J),q.appendChild(ce),Y.appendChild(q);let de=document.createElement("div");de.className="tt_sftpList",Y.appendChild(de),j.bar=q;let me=ee=>{j.busy=ee;for(let pe of[X,J])pe.disabled=ee;$.disabled=ee},te=async(ee,pe)=>{let ve=N==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",Z=N==="local"?pe:{...e,...pe},re=await fetch(ve+ee,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Z)}),ne=await re.json().catch(()=>({}));if(!re.ok||ne.ok!==!0)throw new Error(String(ne.error||"HTTP "+re.status));return ne},Be=(ee,pe)=>{if(!(j.busy||_))return me(!0),l(ee,"busy"),Promise.resolve().then(pe).catch(ve=>l(String(ve&&ve.message?ve.message:ve),"error")).finally(()=>me(!1))},fe=(ee,pe)=>{if(ee===void 0||ee==="")throw new Error(b("error.dirNotReady"));return ee.endsWith("/")||ee.endsWith("\\")?ee+pe:ee+"/"+pe},Oe=ee=>{let pe=fe(j.path,ee.name),ve=[];ee.isDir===!0?ve.push(b("meta.dir")):ve.push(tt(Number(ee.size))||"\u2014");let Z=fd(Number(ee.mtime));Z!==""&&ve.push(Z);let re=w(ee.isDir?Fi:ee.isSymlink?kh:xh,ee.name,ve.join(" \xB7 "),ee.isDir===!0?"dir":ee.isSymlink===!0?"link":"file"),ne=()=>j.loadDir(j.path),oe=N==="local"?p.remote:p.local;return ee.isDir===!0&&re.addEventListener("click",ie=>{ie.target instanceof Element&&ie.target.closest(".tt_sftpAct")!==null||j.loadDir(pe)}),E(re,N==="local"?Qo:ea,b("btn.transferTo",{target:b(N==="local"?"meta.remote":"meta.local"),path:oe.path}),()=>{if(j.path===""||oe.path===""){l(b("error.transferDirsNotReady"),"error");return}R.reset(),R.pulse(0),m(b("msg.transferring",{name:ee.name}),async()=>{let ie=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"?pe:fe(oe.path,ee.name),remotePath:N==="local"?fe(oe.path,ee.name):pe})}),ae=await ie.json().catch(()=>({}));if(!ie.ok||ae.ok!==!0)throw R.fail(b("error.transferFailed")),new Error(String(ae.error||"HTTP "+ie.status));let he=ae.job?.id;if(typeof he!="string"||he==="")throw R.fail(b("error.transferFailed")),new Error(b("error.noTaskId"));await z(he,ee.name)==="canceled"?(R.reset(),l(b("msg.transferCanceled",{name:ee.name}))):(R.done(b("status.done")),setTimeout(()=>R.reset(),1500),l(b("msg.transferred",{name:ee.name}))),await oe.loadDir(oe.path)})}),N!=="local"&&ee.isDir!==!0&&E(re,Eh,b("btn.download",{name:ee.name}),()=>{O(ee,pe)}),E(re,Jo,b("btn.rename",{name:ee.name}),()=>{f.placeholder=b("placeholder.newName"),f.value=ee.name,y(N),g=async()=>{let ie=f.value.trim();ie===""||ie===ee.name||(x(),await j.runTask(b("msg.renaming",{name:ee.name}),async()=>{await te("rename",{from:pe,to:fe(j.path,ie)}),await ne()}))}}),P(re,()=>j.runTask(b("msg.deleting",{name:ee.name}),async()=>{await te("remove",{path:pe,recursive:ee.isDir===!0}),await ne(),l(b("msg.deleted",{name:ee.name}))}),ee),re},We=ee=>{if(de.textContent="",j.path!==""&&j.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(j.path)===!1){let Z=w(Xo,b("list.parentDir"),"","up");Z.addEventListener("click",()=>{let re=N==="local"?eg(j.path):pd(j.path);re!==null&&j.loadDir(re)}),de.appendChild(Z)}let pe=Bs(ee,yr);if(pe.length===0){let Z=document.createElement("div");Z.className="tt_addMenuTitle",Z.textContent=ee.length>0?b("list.hiddenOnly"):b("list.emptyDir"),de.appendChild(Z);return}let ve=500;for(let Z of pe.slice(0,ve))Z===null||typeof Z!="object"||typeof Z.name!="string"||Z.name===""||de.appendChild(Oe(Z));if(pe.length>ve){let Z=document.createElement("div");Z.className="tt_addMenuTitle",Z.textContent=b("list.truncated",{rest:pe.length-ve,total:pe.length}),de.appendChild(Z)}};j.loadDir=async ee=>{try{let pe=await te("list",{path:ee??j.path});j.path=typeof pe.path=="string"&&pe.path!==""?pe.path:j.path,$.value=j.path;let ve=Array.isArray(pe.entries)?pe.entries:[];j.rawEntries=ve,We(ve),W.textContent=b("list.itemCount",{count:Bs(ve,yr).length}),l(j.path)}catch(pe){l(String(pe&&pe.message?pe.message:pe),"error")}},j.runTask=Be,j.setBusy=me,p[N]=j,ce.addEventListener("click",()=>{Em(!yr)});let ke=ee=>{ce!==null&&(ee?ce.dataset.on="":delete ce.dataset.on),j.rawEntries=j.rawEntries??[],We(j.rawEntries),W.textContent=b("list.itemCount",{count:Bs(j.rawEntries,ee).length})};return No.add(ke),j.onShowHidden=ke,X.addEventListener("click",()=>{j.runTask(b("list.loading"),()=>j.loadDir(j.path))}),J.addEventListener("click",()=>{j.busy||_||(f.placeholder=b("placeholder.newDirName"),f.value="",y(N),g=async()=>{let ee=f.value.trim();ee!==""&&(x(),await j.runTask(b("msg.creatingDir",{name:ee}),async()=>{await te("mkdir",{path:fe(j.path,ee),parents:!0}),await j.loadDir(j.path)}))})}),$.addEventListener("keydown",ee=>{if(ee.key!=="Enter"||(ee.preventDefault(),j.busy||_))return;let pe=$.value.trim();pe!==""&&j.runTask(b("list.loading"),()=>j.loadDir(pe))}),Y},h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let f=document.createElement("input");f.type="text",f.className="tt_cardInput",f.spellcheck=!1,f.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=b("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=b("btn.cancel"),h.appendChild(f),h.appendChild(v),h.appendChild(S);let g=null,x=()=>{h.style.display="none",f.value="",g=null};v.addEventListener("click",()=>{g?.()}),S.addEventListener("click",x),f.addEventListener("keydown",N=>{N.key==="Enter"?(N.preventDefault(),g?.()):N.key==="Escape"&&(N.stopPropagation(),x())});let w=(N,G,j,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 W=document.createElement("span");if(W.className="tt_sftpName",W.textContent=G,W.title=G,H.appendChild(k),H.appendChild(W),j!==""){let q=document.createElement("span");q.className="tt_sftpMeta",q.textContent=j,H.appendChild(q)}return H},E=(N,G,j,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=G,H.title=j,H.addEventListener("click",k=>{k.stopPropagation(),Y()}),N.appendChild(H)},P=(N,G,j)=>{let Y=document.createElement("button");Y.type="button",Y.className="tt_sftpAct",Y.innerHTML=Sr,Y.title=j.isDir?b("btn.deleteEntryDir",{name:j.name}):b("btn.deleteEntry",{name:j.name});let H=null;Y.addEventListener("click",k=>{if(k.stopPropagation(),H!==null){clearTimeout(H),H=null,Y.innerHTML=Sr,delete Y.dataset.danger,G();return}Y.textContent=b("btn.confirm"),Y.dataset.danger="",H=setTimeout(()=>{H=null,Y.innerHTML=Sr,delete Y.dataset.danger},4e3)}),N.appendChild(Y)},O=(N,G)=>p.remote.runTask(b("msg.downloading",{name:N.name}),async()=>{R.reset();let j;try{j=await md({makeBody:Y=>({...e,path:G,...Y>0?{offset:Y}:{}}),onProgress:(Y,H)=>R.set(Y,H),maxMb:Jt.maxDownloadMb,registerCancel:Y=>R.setCancel(Y),onResume:Y=>l(b("msg.downloadResuming",{name:N.name,offset:tt(Y)||String(Y)+" B"}),"busy")})}catch(Y){if(ni(Y)){R.reset(),l(b("msg.downloadCanceled",{name:N.name}));return}throw R.fail(b("error.downloadFailed")),Y}R.done(b("status.done")),gd(j,N.name),setTimeout(()=>R.reset(),1500),l(b("msg.downloaded",{name:N.name,size:tt(j.size)||String(j.size)+" B"}))}),F=u("local",b("meta.local")),A=u("remote",b("meta.remote"));p.local.wrap=F,p.remote.wrap=A;let V=document.createElement("div");V.className="tt_sftpDual",V.appendChild(F),V.appendChild(A),n.appendChild(V),n.appendChild(h);let B=document.createElement("div");B.className="tt_sftpFoot";let R=_d();B.appendChild(R.el),B.appendChild(d),n.appendChild(B);let z=async(N,G)=>{let j=!1;R.setCancel(()=>{j||(j=!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(W=>setTimeout(W,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(j)return"canceled";throw new Error(String(H.error||"HTTP "+Y.status))}let k=H.job;if(k===null||typeof k!="object")throw new Error(b("error.invalidTaskState"));if(k.state==="running"){let W=typeof k.current=="string"&&k.current!==""?k.current:G;l(b("msg.transferring",{name:W}),"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||b("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[p.local,p.remote]){let G=N.wrap,j=0;G.addEventListener("dragenter",Y=>{N.kind!=="remote"||!C(Y.dataTransfer)||(Y.preventDefault(),j+=1,I(N,!0))}),G.addEventListener("dragover",Y=>{N.kind==="remote"&&(Y.preventDefault(),Y.dataTransfer!==null&&(Y.dataTransfer.dropEffect="copy"))}),G.addEventListener("dragleave",()=>{j=Math.max(0,j-1),j===0&&I(N,!1)}),G.addEventListener("drop",Y=>{j=0,I(N,!1);let H=qc(N.kind,Y.dataTransfer);if(!H.accept){H.reason==="wrongPane"&&(Y.preventDefault(),l(b("error.dropOnLocalPane"),"error"));return}Y.preventDefault(),!(_||p.remote.busy)&&vd(Y.dataTransfer).then(k=>{(k.length>0||k._limitExceeded===!0)&&L(p.remote,k)})})}let L=async(N,G)=>{let j=Jt;if(j.maxUploadFiles>0&&G.length>j.maxUploadFiles){l(b("error.uploadCountExceeded",{max:j.maxUploadFiles,count:G.length}),"error");return}let Y=j.maxUploadMb>0?j.maxUploadMb*1024*1024:0,H=G.find(k=>Y>0&&(k.file?.size??0)>Y);if(H!==void 0){l(b("error.uploadTooBig",{size:tt(Y),name:String(H.relPath??"")}),"error");return}if(G._limitExceeded===!0){l(b("error.uploadTotalTooBig"),"error");return}await m(b("msg.uploading"),async()=>{if(N.path===""){l(b("error.transferDirsNotReady"),"error");return}for(let q of Kc(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 W=0;try{let q=0;for(let $ of G){if(k.stopped)break;q+=1,k.abort=null;try{await ud($.file,c(N.path,$.relPath),{spec:e,label:`${String(q)}/${String(G.length)} ${$.relPath}`,cancelRef:k,onProgress:(X,J)=>Number.isFinite(J)&&J>0?R.set(X,J):R.pulse(X),onLabel:X=>l(b("msg.uploadingName",{name:X}),"busy")}),W+=1}catch(X){if(ni(X)||k.stopped)break;throw X}}}finally{R.setCancel(null)}k.stopped?(R.reset(),l(b("msg.uploadCanceled",{done:W,total:G.length}))):(R.done(b("status.allDone")),setTimeout(()=>R.reset(),1500),l(b("msg.uploadDoneCount",{count:G.length}))),await N.loadDir(N.path)})},T=ia(),D=T===null?420:Math.round(T.height*.56);dd(n,b("panel.sftpDual",{label:t}),D,i),p.local.loadDir(""),p.remote.loadDir(""),Ho=()=>{for(let N of[p.local,p.remote])N!==void 0&&typeof N.onShowHidden=="function"&&No.delete(N.onShowHidden)}}var er=null,Nt=null;function cd(){return Nt!==null&&bo(Nt.ownerKey,Se)?Nt.ownerKey:Gr(void 0,Se)}var hd=(e=cd())=>er!==null||Nt!==null&&Nt.ownerKey===e;function dd(e,t,r,i){let n=Gr(i,Se),s=Ct!==null&&Ct.ownerKey===n;if(ue!==null&&!Ge&&mt!==null&&!s)try{let a=jh({title:t,side:"bottom",size:r,min:200,ownerSid:n,onClose:()=>hi(n)});a.element.appendChild(e),Nt=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 o=document.createElement("div");o.className="tt_sshBackdrop",o.appendChild(e),o.addEventListener("mousedown",a=>{a.target===o&&hi()}),document.body.appendChild(o),er=o}var Hi=null;function Zm(){let e=Hi;if(Hi=null,e!==null)try{e.click()}catch{}}function Qm(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 ud(e,t,r){let{spec:i,label:n="",cancelRef:s,onProgress:o,onLabel:a,onDone:d}=r;return n!==""&&typeof a=="function"&&a(n),new Promise((l,_)=>{let m=Qm(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",u=>{u.lengthComputable?o(u.loaded,u.total):o(0,NaN)});let p=!1,c=u=>{p||(p=!0,u===null?l():_(u))};y.addEventListener("load",()=>{if(y.status===200){d?.(),c(null);return}if(s.stopped)return;let u="HTTP "+y.status;try{let h=JSON.parse(y.responseText);h!==null&&typeof h=="object"&&typeof h.error=="string"&&(u=h.error)}catch{}c(new Error(u))}),y.addEventListener("error",()=>{if(s.stopped){c(new ci);return}c(new Error(b("error.networkError")))}),y.addEventListener("abort",()=>{c(new ci)}),y.send(e)})}function fd(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 pd(e){let t=String(e).replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function eg(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 n=r[2];if(n==="")return null;let s=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return s<=0?r[1]+"\\":r[1]+n.slice(0,s)}if(t.startsWith("\\\\")||t.startsWith("//")){let n=t.slice(2);if(n.split(/[\\/]/).filter(a=>a!=="").length<=2)return null;let o=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return t.slice(0,2)+n.slice(0,o)}let i=t.lastIndexOf("/");return i<=0?i===0?"/":null:t.slice(0,i)}function Ti(e,t){return e.endsWith("/")?e+t:e+"/"+t}function _d(){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 n=document.createElement("button");n.type="button",n.className="tt_sftpCancel",n.title=b("btn.cancelTransfer"),n.innerHTML=Xi,n.style.display="none";let s=null;n.addEventListener("click",p=>{p.stopPropagation();let c=s;c!==null&&(n.disabled=!0,c())}),e.appendChild(t),e.appendChild(i),e.appendChild(n);let o=p=>{i.textContent=p},a="",d=-1,l=p=>{p!==a&&(a=p,i.textContent=p)},_=p=>{let c=Math.round(p);c!==d&&(d=c,r.style.width=c+"%")},m=()=>{s=null,Hi===n&&(Hi=null),n.style.display="none",n.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",d=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,r.style.width="0%",i.textContent="",m()},setCancel(p){if(p==null){m();return}s=p,Hi=n,n.disabled=!1,n.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let u=Date.now();if(this._last!==void 0&&u>this._lastAt){let h=(p-this._last)/((u-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}if(this._last=p,this._lastAt=u,Number.isFinite(c)&&c>0){let h=Math.min(100,Math.max(0,p/c*100));_(h);let f=this._rate!==void 0&&this._rate>=0?Li(this._rate):"";l(Math.round(h)+"%"+(f!==""?" \xB7 "+f:""))}else{r.style.width="";let h=this._rate!==void 0&&this._rate>=0?Li(this._rate):"";l(tt(p)+(h!==""?" \xB7 "+h:""))}},pulse(p){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=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}this._last=p,this._lastAt=c;let u=this._rate!==void 0&&this._rate>=0?Li(this._rate):"";l((Number.isFinite(p)?tt(p):"\u2026")+(u!==""?" \xB7 "+u:""))},done(p){e.dataset.active="",e.dataset.state="done",r.style.width="100%",d=100,m(),l(p!==void 0&&p!==""?p:b("status.done"))},fail(p){e.dataset.active="",e.dataset.state="error",m(),l(p!==void 0&&p!==""?p:b("status.failed"))},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",i.textContent=""):(e.dataset.active="",r.style.width="",d=-1,l(p))}}}async function tg(e,t,r,i=0,n=null,s=0){let o=i>0?i*1024*1024:0,a=Number.isFinite(s)&&s>0?s:0,d=typeof AbortController=="function"?new AbortController:null,l=!1;d!==null&&(t={...t,signal:d.signal},typeof n=="function"&&n(()=>{l=!0,d.abort()}));let _=a,m=null,y;try{if(y=await fetch(e,t),!y.ok){let S="HTTP "+y.status;try{let g=await y.json();g!==null&&typeof g=="object"&&typeof g.error=="string"&&(S=g.error)}catch{}throw new Error(S)}let p=Number(y.headers.get("content-length")),c=y.headers.get("content-range")??"",u=Number(/\/(\d+)\s*$/.exec(c)?.[1]);Number.isFinite(u)&&u>0?m=u:Number.isFinite(p)&&p>0&&(m=a+p);let h=y.body;if(h===null||typeof h.getReader!="function"){let S=await y.blob();if(o>0&&a+S.size>o)throw new Error(b("error.downloadTooBig",{size:tt(o)}));return m!==null&&r(m,m),S}if(o>0&&m!==null&&m>o){try{await h.cancel()}catch{}throw new Error(b("error.downloadTooBig",{size:tt(o)}))}let f=h.getReader(),v=[];for(;;){let{done:S,value:g}=await f.read();if(S)break;if(g!==void 0&&g.byteLength>0){if(_+=g.byteLength,o>0&&_>o){try{await f.cancel()}catch{}throw new Error(b("error.downloadTooBig",{size:tt(o)}))}v.push(g),r(_,m!==null?m:NaN)}}return new Blob(v,{type:"application/octet-stream"})}catch(p){if(l||p!==null&&typeof p=="object"&&p.name==="AbortError")throw new ci;if(p!==null&&typeof p=="object")throw p.received=_,p.total=m,p;let c=new Error(String(p));throw c.received=_,c.total=m,c}}async function md({url:e="/api/dsh-tty/sftp/download",makeBody:t,onProgress:r,maxMb:i=0,registerCancel:n=null,onResume:s=null}){let o=0,a=0;for(;;)try{return await tg(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t(o))},r,i,n,o)}catch(d){if(ni(d))throw d;a+=1;let l=$c({received:d?.received??0,total:d?.total??null,attempt:a});if(!l.resume)throw d;o=l.offset,typeof s=="function"&&s(o)}}var ci=class extends Error{constructor(){super(b("msg.canceled")),this.name="TransferCanceledError"}};function ni(e){return e instanceof ci}function gd(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 vd(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],r=[];for(let l of t){let _=typeof l.webkitGetAsEntry=="function"?l.webkitGetAsEntry():null;_!==null&&r.push(_)}if(r.length===0)return[...e.files??[]].map(l=>({relPath:l.name,file:l}));let i=[],n=Jt.maxUploadFiles,s=Jt.maxUploadMb>0?Jt.maxUploadMb*1024*1024:0,o=()=>n>0&&i.length>=n,a=0,d=(l,_)=>new Promise(m=>{if(o()){m();return}if(l.isFile===!0){l.file(c=>{s>0&&a+(c.size??0)>s?i._limitExceeded=!0:(i.push({relPath:_+l.name,file:c}),a+=c.size??0),m()},()=>m());return}if(l.isDirectory!==!0){m();return}let y=l.createReader(),p=()=>{y.readEntries(async c=>{if(c.length===0){m();return}for(let u of c){if(o())break;await d(u,_+l.name+"/")}if(o()){m();return}p()},()=>m())};p()});for(let l of r)await d(l,"");return i}function pn(e,t){let r=Gr(t,Se);if(hd(r))return;let i=e!==null&&typeof e=="object"?e:{},n={};if(typeof i.name=="string"&&i.name!=="")n.name=i.name;else{for(let W of["host","username","auth","keyPath","passphrase","password"])typeof i[W]=="string"&&i[W]!==""&&(n[W]=i[W]);let k=Number(i.port);Number.isInteger(k)&&k>=1&&k<=65535&&(n.port=k),i.agentForward===!0&&(n.agentForward=!0)}let s=n.name??(n.username!==void 0?n.username+"@"+String(n.host??""):String(n.host??""));if(Kh==="dual"){Jm(n,s,r);return}let o=document.createElement("div");o.className="tt_sftpCard";let a=document.createElement("div");a.className="tt_sftpTitleRow";let d=document.createElement("div");d.className="tt_sshTitle",d.innerHTML=Fi+"<span></span>",d.lastElementChild.textContent="SFTP \xB7 "+s;let l=document.createElement("button");l.type="button",l.className="tt_close",l.title=b("btn.close"),l.innerHTML=ln,l.addEventListener("click",()=>hi(r)),a.appendChild(d),a.appendChild(l),o.appendChild(a);let _=document.createElement("div");_.className="tt_sftpBar";let m=document.createElement("input");m.type="text",m.className="tt_sftpPath",m.placeholder=b("placeholder.remotePath"),m.spellcheck=!1,m.autocomplete="off";let y=document.createElement("button");y.type="button",y.className="tt_toolBtn",y.innerHTML=Zo+"<span>"+b("btn.refresh")+"</span>";let p=document.createElement("button");p.type="button",p.className="tt_toolBtn",p.innerHTML=Lh+"<span>"+b("btn.mkdir")+"</span>";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.innerHTML=F_+"<span>"+b("btn.upload")+"</span>",c.title=b("btn.uploadTitle");let u=document.createElement("input");u.type="file",u.multiple=!0,u.style.display="none",_.appendChild(m),_.appendChild(y),_.appendChild(p),_.appendChild(c),o.appendChild(_),o.appendChild(u);let h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let f=document.createElement("input");f.type="text",f.className="tt_cardInput",f.spellcheck=!1,f.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=b("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=b("btn.cancel"),h.appendChild(f),h.appendChild(v),h.appendChild(S),o.appendChild(h);let g=null,x=()=>{h.style.display="none",g=null};v.addEventListener("click",()=>{g?.()}),S.addEventListener("click",x),f.addEventListener("keydown",k=>{k.key==="Enter"?(k.preventDefault(),g?.()):k.key==="Escape"&&(k.stopPropagation(),x())});let w=document.createElement("div");w.className="tt_sftpList",o.appendChild(w);let E=document.createElement("div");E.className="tt_sftpFoot";let P=document.createElement("div");P.className="tt_sftpStatus";let O=_d();E.appendChild(O.el),E.appendChild(P),o.appendChild(E);let F={path:"",busy:!1},A=(k,W)=>{P.textContent=k,W===void 0?delete P.dataset.state:P.dataset.state=W},V=k=>{F.busy=k;for(let W of[y,p,c])W.disabled=k;m.disabled=k},B=async(k,W)=>{let q=await fetch("/api/dsh-tty/sftp/"+k,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...n,...W})}),$=await q.json().catch(()=>({}));if(!q.ok||$.ok!==!0)throw new Error(String($.error||"HTTP "+q.status));return $},R=async(k,W)=>{if(!F.busy){V(!0),A(k,"busy");try{await W()}catch(q){A(String(q&&q.message?q.message:q),"error")}finally{V(!1)}}},z=(k,W,q,$)=>{let X=document.createElement("button");X.type="button",X.className="tt_sftpRow";let J=document.createElement("span");J.className="tt_sftpIcon",J.innerHTML=k,$!==void 0&&(J.dataset.kind=$);let ce=document.createElement("span");if(ce.className="tt_sftpName",ce.textContent=W,ce.title=W,X.appendChild(J),X.appendChild(ce),q!==""){let de=document.createElement("span");de.className="tt_sftpMeta",de.textContent=q,X.appendChild(de)}return X},I=(k,W,q,$)=>{let X=document.createElement("button");X.type="button",X.className="tt_sftpAct",X.innerHTML=W,X.title=q,X.addEventListener("click",J=>{J.stopPropagation(),$()}),k.appendChild(X)},C=(k,W,q)=>{let $=document.createElement("button");$.type="button",$.className="tt_sftpAct",$.innerHTML=Sr,$.title=W.isDir?b("btn.deleteEntryDir",{name:W.name}):b("btn.deleteEntry",{name:W.name});let X=null;$.addEventListener("click",J=>{if(J.stopPropagation(),!F.busy){if(X!==null){clearTimeout(X),X=null,$.innerHTML=Sr,delete $.dataset.danger,R(b("msg.deleting",{name:W.name}),async()=>{await B("remove",{path:q,recursive:W.isDir===!0}),await T(F.path),A(b("msg.deleted",{name:W.name}))});return}$.textContent=b("btn.confirm"),$.dataset.danger="",X=setTimeout(()=>{X=null,$.innerHTML=Sr,delete $.dataset.danger},4e3)}}),k.appendChild($)},L=k=>{if(w.textContent="",F.path!==""&&F.path!=="/"){let $=z(Xo,b("list.parentDir"),"","up");$.addEventListener("click",()=>{R(b("list.loading"),()=>T(pd(F.path)))}),w.appendChild($)}let W=Array.isArray(k)?k:[];if(W.length===0){let $=document.createElement("div");$.className="tt_addMenuTitle",$.textContent=b("list.emptyDir"),w.appendChild($);return}let q=500;for(let $ of W.slice(0,q)){if($===null||typeof $!="object"||typeof $.name!="string"||$.name==="")continue;let X=Ti(F.path,$.name),J=[];$.isDir===!0?J.push(b("meta.dir")):J.push(tt(Number($.size))||"\u2014");let ce=fd(Number($.mtime));ce!==""&&J.push(ce);let de=z($.isDir?Fi:$.isSymlink?kh:xh,$.name,J.join(" \xB7 "),$.isDir===!0?"dir":$.isSymlink===!0?"link":"file");$.isDir===!0?de.addEventListener("click",me=>{me.target instanceof Element&&me.target.closest(".tt_sftpAct")!==null||R(b("list.loading"),()=>T(X))}):(de.addEventListener("click",me=>{me.target instanceof Element&&me.target.closest(".tt_sftpAct")!==null||D($,X)}),I(de,Eh,b("btn.download",{name:$.name}),()=>{D($,X)})),I(de,Jo,b("btn.rename",{name:$.name}),()=>{f.placeholder=b("placeholder.newName"),f.value=$.name,h.style.display="",f.focus(),f.select(),g=async()=>{let me=f.value.trim();me===""||me===$.name||(x(),await R(b("msg.renaming",{name:$.name}),async()=>{await B("rename",{from:X,to:Ti(F.path,me)}),await T(F.path)}))}}),C(de,$,X),w.appendChild(de)}if(W.length>q){let $=document.createElement("div");$.className="tt_addMenuTitle",$.textContent=b("list.truncated",{rest:W.length-q,total:W.length}),w.appendChild($)}},T=async k=>{try{let W=await B("list",{path:k??F.path});F.path=typeof W.path=="string"&&W.path!==""?W.path:"/",m.value=F.path;let q=Array.isArray(W.entries)?W.entries.length:0;L(W.entries),A(F.path+" \u2014 "+b("list.itemCount",{count:q}))}catch(W){A(String(W&&W.message?W.message:W),"error")}},D=(k,W)=>R(b("msg.downloading",{name:k.name}),async()=>{O.reset();let q;try{q=await md({makeBody:$=>({...n,path:W,...$>0?{offset:$}:{}}),onProgress:($,X)=>O.set($,X),maxMb:Jt.maxDownloadMb,registerCancel:$=>O.setCancel($),onResume:$=>A(b("msg.downloadResuming",{name:k.name,offset:tt($)||String($)+" B"}),"busy")})}catch($){if(ni($)){O.reset(),A(b("msg.downloadCanceled",{name:k.name}));return}throw O.fail(b("error.downloadFailed")),$}O.done(b("status.done")),gd(q,k.name),setTimeout(()=>O.reset(),1500),A(b("msg.downloaded",{name:k.name,size:tt(q.size)||String(q.size)+" B"}))}),N=(k,W,q,$,X)=>ud(k,Ti(F.path,W),{spec:n,label:($>1?String(q)+"/"+String($)+" ":"")+W,cancelRef:X,onProgress:(J,ce)=>{Number.isFinite(ce)&&ce>0?O.set(J,ce):O.pulse(J)},onLabel:J=>A(b("msg.uploadingName",{name:J}),"busy"),onDone:()=>{$===1&&O.done(b("msg.uploadDone"))}}).catch(J=>{throw ni(J)||O.fail(b("error.uploadFailed")),J}),G=async k=>R(b("msg.uploading"),async()=>{let W=Jt;if(W.maxUploadFiles>0&&k.length>W.maxUploadFiles){A(b("error.uploadCountExceeded",{max:W.maxUploadFiles,count:k.length}),"error"),O.fail(b("status.overLimit"));return}let q=W.maxUploadMb>0?W.maxUploadMb*1024*1024:0,$=k.find(me=>q>0&&(me.file?.size??0)>q);if($!==void 0){A(b("error.uploadTooBig",{size:tt(q),name:String($.relPath??"")}),"error"),O.fail(b("status.overLimit"));return}if(k._limitExceeded===!0){A(b("error.uploadTotalTooBig"),"error"),O.fail(b("status.overLimit"));return}let X=new Set;for(let me of k){let te=me.relPath.lastIndexOf("/");if(te<=0)continue;let Be=me.relPath.slice(0,te);X.has(Be)||(X.add(Be),await B("mkdir",{path:Ti(F.path,Be),parents:!0}).catch(()=>{}))}O.reset();let J={stopped:!1,abort:null};O.setCancel(()=>J.abort?.());let ce=0,de=0;try{for(let me of k){if(J.stopped)break;ce+=1,J.abort=null;try{await N(me.file,me.relPath,ce,k.length,J),de+=1}catch(te){if(ni(te)||J.stopped)break;throw te}}}finally{O.setCancel(null)}if(J.stopped){O.reset(),A(b("msg.uploadCanceled",{done:de,total:k.length})),await T(F.path);return}O.done(b("status.allDone")),setTimeout(()=>O.reset(),1500),A(b("msg.uploadDoneCount",{count:k.length})),await T(F.path)});y.addEventListener("click",()=>{R(b("list.loading"),()=>T(F.path))}),p.addEventListener("click",()=>{F.busy||(f.placeholder=b("placeholder.newDirName"),f.value="",h.style.display="",f.focus(),g=async()=>{let k=f.value.trim();k!==""&&(x(),await R(b("msg.creatingDir",{name:k}),async()=>{await B("mkdir",{path:Ti(F.path,k)}),await T(F.path)}))})}),c.addEventListener("click",()=>{F.busy===!1&&u.click()}),u.addEventListener("change",()=>{let k=[...u.files??[]].map(W=>({relPath:W.name,file:W}));u.value="",k.length>0&&G(k)});let j=0,Y=k=>{k?w.dataset.drag="":delete w.dataset.drag};o.addEventListener("dragenter",k=>{k.preventDefault(),j+=1,Y(!0)}),o.addEventListener("dragover",k=>{k.preventDefault()}),o.addEventListener("dragleave",()=>{j=Math.max(0,j-1),j===0&&Y(!1)}),o.addEventListener("drop",k=>{k.preventDefault(),j=0,Y(!1),!F.busy&&vd(k.dataTransfer).then(W=>{(W.length>0||W._limitExceeded===!0)&&G(W)})}),m.addEventListener("keydown",k=>{if(k.key!=="Enter"||(k.preventDefault(),F.busy))return;let W=m.value.trim();W!==""&&R(b("list.loading"),()=>T(W))});let H=ia();dd(o,"SFTP \xB7 "+s,H===null?340:Math.round(H.height*.46),r),R(b("status.connectingEllipsis"),()=>T(""))}function hi(e){let t=e===void 0?cd():e,r=er,i=Nt!==null&&Nt.ownerKey===t?Nt:null;if(r===null&&i===null)return;Zm();let n=Ho;Ho=null,n?.(),er=null,i!==null&&(Nt=null),r!==null&&r.remove(),i!==null&&i.dispose()}function la(e){if(Xt===null)return;Xt.style.display=Jc(e);let t=ue!==null?ue.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&Xt.focus()}function bd(){Xt!==null&&la(Zc(Xt.style.display))}function rg(){return{matchBackground:Te("--tt-term-search-match"),matchBorder:Te("--tt-term-search-match-border"),activeMatchBackground:Te("--tt-term-search-active"),activeMatchBorder:Te("--tt-term-search-active-border"),matchOverviewRuler:Te("--tt-term-search-match-border"),activeMatchColorOverviewRuler:Te("--tt-term-search-active-border")}}function ig(e){let t=xt();if(t===void 0||t.search===void 0)return;let r=Xt.value;if(r==="")return;let i={decorations:rg()};e?t.search.findPrevious(r,i):t.search.findNext(r,i)}function dh(){zi||ue===null&&!ta()||xr!==null||(xr=setTimeout(()=>{xr=null,nn()},Bi),Bi=Math.min(Bi*2,5e3))}function rs(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Go(e){return rs(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function sg(){return ur==="tmux"?{t:"spawn",cwd:Oo(),persist:!0,persistName:oa()}:{t:"spawn",cwd:Oo()}}async function wd(){if(!Ro){Ro=!0;try{await ng()}finally{Ro=!1}}}var Ro=!1;async function ng(){if(await aa(),ue===null){await ag();return}let e=rm(),t=tm();if(![...le.values()].some(o=>o.embedded!==!0)){if(e.length>0||t.length>0){Pe({t:"sessions"});let o=await Qs("sessions",4e3),a=new Map;if(o!==null&&Array.isArray(o.list))for(let l of o.list)l!==null&&typeof l=="object"&&l.attachable===!0&&a.set(l.sid,l);let d=new Set;for(let l of e){if(a.has(l.sid))hm(l);else if(Go(l.spawnSpec))ch(l);else continue;rs(l.spawnSpec)&&d.add(l.spawnSpec.persistName)}for(let l of t){let _=l.spawnSpec.persistName;d.has(_)||(ch(l),d.add(_))}Ht()}if(![...le.values()].some(o=>o.embedded!==!0)){if(await sn())return;$i()}return}let r=[...le.values()].filter(o=>!o.exited&&(o.embedded!==!0||o.spawned===!0)),i=r.filter(o=>Go(o.spawnSpec)),n=null;if(i.length>0){Pe({t:"sessions"});let o=await Qs("sessions",4e3),a=yo(o!==null?o.list:[]);n=i.filter(d=>!a.has(d.sid));for(let d of n)qi(d.sid)}let s=n!==null?new Set(n.map(o=>o.sid)):new Set;for(let o of r)s.has(o.sid)||Pe({t:"attach",sid:o.sid})}function og(){Re!==null&&(Re.readyState===WebSocket.OPEN||Re.readyState===WebSocket.CONNECTING)||nn()}async function ag(){let e=[...le.values()].filter(i=>i.embedded===!0&&!i.exited);if(e.length===0)return;Pe({t:"sessions"});let t=await Qs("sessions",4e3),r=yo(t!==null?t.list:[]);for(let i of e)i.spawned===!0&&(r.has(i.sid)?Pe({t:"attach",sid:i.sid}):Go(i.spawnSpec)?Uh(i):(i.exited=!0,i.live=!1,Vr(i,b("status.ended"),b("btn.clickRerun"),"exited")))}function nn(){if(Re!==null){try{Re.close()}catch{}Re=null}zi=!1,clearTimeout(xr),xr=null,Is=!0,Ns(b("status.connectingEllipsis"),"");try{Re=new WebSocket(T_())}catch(e){Is=!1,Ns(b("error.connectFailed",{error:e.message}),"error"),dh();return}Re.onopen=()=>{Is=!1,Bi=1e3,St=null,Ns(b("status.connected"),"connected");for(let e of[...Ao])Ao.delete(e),le.has(e.tab.sid)&&Pe(e.frame);wd()},Re.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:"";Lo(r,t.kind==="ssh"?b("status.connectedSsh",{target:i!==""?i+" ":""}):b("status.connectedPid",{pid:t.pid}),"connected");let n=le.get(r);if(n!==void 0){if(n.exited=!1,n.spawned=!0,n.live=!0,n.errored=!1,n.target=i,n.persistTmux=t.persist===!0,t.kind==="ssh"&&i!==""&&!n.label&&(n.label=i,it()),Er(),To(r),Vr(n,""),ui(n),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(o=>setTimeout(o,500))]).then(()=>Bh(150))}di(),Y_(r),vr(n.spawnSpec)&&Pe({t:"hidden",sid:r,hidden:!0}),Ht()}}else if(t.t==="hidden"){let i=le.get(r);if(i!==void 0&&i.embedded!==!0){let n=t.hidden===!0;vr(i.spawnSpec)!==n&&(i.spawnSpec=Co(i.spawnSpec,n),Ht(),it(),li())}}else if(t.t==="sessions")lm(t.list);else if(t.t==="data"){let i=le.get(r);i!==void 0&&i.term!==null&&(i.term.write(String(t.d??"")),dg())}else if(t.t==="exit"){let i=le.get(r);if(i!==void 0){i.exited=!0,i.live=!1,i.stats=null,r===Se&&Ar();let n=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";i.exitDetail=[n,s].filter(Boolean).join(" "),Lo(r,b("status.exitedWith",{detail:i.exitDetail}),""),Er(),To(r),Vr(i,""),es(),li(),di(),_n(),Ht()}}else if(t.t==="stats")try{let i=le.get(r);if(i!==void 0){let n=t.stats;i.stats=rh(n)?n:null,i.statsAt=Date.now(),r===Se&&Ar()}}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(!Ys||t.kind!=="failure"||typeof r!="string"||r==="")return;fr.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===Se&&Pr()}else if(t.t==="error")if(Lo(r,b("status.error",{message:String(t.m??"")}),"error"),typeof r=="string"){let i=le.get(r);i!==void 0&&(i.live||(i.errored=!0),Er(),To(r),Vr(i,b("status.errored"),b("status.retryHint",{message:String(t.m??"")}),"error"))}else lg(b("btn.clickRetry"))},Re.onclose=()=>{if(Is=!1,!zi){Ns(b("status.disconnectedReconnecting"),"error");for(let e of le.values())e.exited||Vr(e,b("status.disconnected"),b("status.reconnecting"),"info");dh()}},Re.onerror=()=>{}}function lg(e){Zr!==null&&(Zr.textContent=e)}function Vo(){(ue===null||Ge)&&Yo()}var Fs="DSH_TTY_ALLOW_PROXY_COMMAND";function cg(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 yd(){return typeof navigator<"u"&&navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText=="function"}async function uh(e){if(yd())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||hn(b("error.copyFailed"),"error"),r}function Yo(){if(ue!==null){Ge&&ca();return}Yi(),ue=document.createElement("div"),ue.className="tt_modalBackdrop",ue.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+an+'</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">'+b("status.initializing")+'</span></div><input class="tt_searchInput" style="display:'+xo+'" placeholder="'+b("placeholder.search")+'" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="'+b("btn.searchTitle")+'">'+D_+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="'+b("btn.clearTitle")+'">'+yh+'</button></span><span class="tt_winGroup"><button class="tt_min" title="'+b("btn.minimizeTitle")+'">'+O_+'</button><button class="tt_close" title="'+b("btn.closePanelTitle")+'">'+ln+'</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(ue),qs=ue.querySelector(".tt_status"),Cr=ue.querySelector(".tt_statusText"),Tr=ue.querySelector(".tt_statusDot"),Ee=ue.querySelector(".tt_tabs");let e=ue.querySelector(".tt_tabAdd");e!==null&&(e.title=b("btn.newTab"),e.innerHTML=H_,e.addEventListener("click",()=>{Rm(e)})),Bt=ue.querySelector(".tt_tabMore"),Bt!==null&&(Bt.innerHTML=Ch,Bt.title=b("btn.tabList"),Bt.addEventListener("click",()=>{Am(Bt)})),Ee.addEventListener("scroll",li),Ee.addEventListener("wheel",Sm,{passive:!1}),Ee.addEventListener("contextmenu",Om),Ee.addEventListener("auxclick",Im),Ri=ue.querySelector(".tt_connbar"),Ai=ue.querySelector(".tt_connDot"),Ks=ue.querySelector(".tt_connTarget"),pt=ue.querySelector(".tt_connBadge"),Di=ue.querySelector(".tt_connActions"),mt=ue.querySelector(".tt_work"),Je=ue.querySelector(".tt_body"),yt=ue.querySelector(".tt_statsBar"),It=ue.querySelector(".tt_exitBar"),ji="",dn(),St=null,Ah(),Zr=ue.querySelector(".tt_body > .tt_overlay"),cr=ue.querySelector(".tt_assistBadge"),cr!==null&&cr.addEventListener("click",()=>{cr!==null&&qm(cr)}),kt(),Pr(),Xt=ue.querySelector(".tt_searchInput"),Zr.addEventListener("click",()=>{Zr.textContent="",nn()}),ue.querySelector("[data-act=search]").addEventListener("click",()=>{bd()}),Xt.addEventListener("keydown",r=>{r.key==="Enter"?(r.preventDefault(),ig(r.shiftKey)):r.key==="Escape"&&(r.stopPropagation(),la(!1))}),ue.querySelector("[data-act=clear]").addEventListener("click",()=>{let r=xt();r!==void 0&&r.term!==null&&r.term.clear()}),ue.querySelector(".tt_min").addEventListener("click",()=>{Gi()}),ue.querySelector(".tt_close").addEventListener("click",()=>{Sd()}),ue.addEventListener("mousedown",r=>{ti===null&&r.target===ue&&Gi()}),document.addEventListener("keydown",xd),Pi=new ResizeObserver(()=>{Ge||(Ws(),sm(xt()),li())}),Pi.observe(Je),it(),Er(),Re!==null&&Re.readyState===WebSocket.OPEN?wd():nn()}function _n(){if(Ui===null)return;let e=[...le.values()].filter(t=>!t.exited).length;Ui.textContent=le.size>0?"\xB7 "+e+"/"+le.size:""}function hg(){Xe=document.createElement("div"),Xe.className="tt_dock",Xe.title=b("btn.restoreDock"),Xe.innerHTML='<span class="tt_dockTitle">'+an+"<span>"+b("panel.title")+'</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="'+b("btn.closePanelTitle")+'">'+Xi+"</button>",Ui=Xe.querySelector(".tt_dockCount"),ai=Xe.querySelector(".tt_dockStatus"),Mr=Xe.querySelector(".tt_dockDot"),_n(),Cr!==null&&(ai.textContent=Cr.textContent),Tr!==null&&(Mr.dataset.state=Tr.dataset.state??""),Xe.addEventListener("click",e=>{if(e.target.closest(".tt_dockClose")!==null){e.stopPropagation(),Sd();return}ca()}),document.body.appendChild(Xe)}function Gi(){ue===null||Ge||(_t(),vt(),kt(),hr(),Ge=!0,er!==null&&(er.style.display="none"),la(!1),ue.dataset.minimized="",Dh(),Qi(),Ar(),document.querySelector("[data-dsh-tty-entry]")!==null?di():(hg(),Xe.classList.add("tt_dockCompact")))}function di(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Ge){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=b("status.minimized");let r=[...le.values()].filter(n=>!n.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=r+"/"+le.size;let i=t.querySelector(".tt_sidebarBadgeDot");i!==null&&Tr!==null&&(i.dataset.state=Tr.dataset.state??"")}function dg(){if(!Ge)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Mr;e!==null&&(e.dataset.active="",clearTimeout(Gs),Gs=setTimeout(()=>{delete e.dataset.active},900))}function ca(){if(ue===null||!Ge)return;Ge=!1,delete ue.dataset.minimized,er!==null&&(er.style.display=""),clearTimeout(Gs),Xe!==null&&(Xe.remove(),Xe=null),Ui=null,ai=null,Mr=null,di(),Ah(),Qi(),Ar(),es();let e=xt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&ui(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Sd(){let e=Fc(le.values());if(!e.confirm){Vi();return}Ge&&ca(),ug(e)}function br(){if(ti===null)return;ti.remove(),ti=null;let e=Do;if(Do=null,e!==null&&typeof e.focus=="function")try{e.focus()}catch{}}function Cd(e){if(ue===null)return;br();let t=ue.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=b("btn.cancel"),i.addEventListener("click",()=>br()),e.minimize===!0){let s=r.querySelector(".tt_confirmMin");s.textContent=b("btn.minimize"),s.addEventListener("click",()=>{br(),Gi()})}let n=r.querySelector(".tt_confirmOk");n.textContent=e.okLabel,n.addEventListener("click",()=>{br(),e.onOk()}),r.addEventListener("mousedown",s=>{s.target===r&&br()}),Do=document.activeElement instanceof HTMLElement?document.activeElement:null,t.appendChild(r),ti=r;try{i.focus()}catch{}}function ug(e){Cd({title:b("confirm.closeTitle",{n:String(e.live)}),text:e.agentLive>0?b("confirm.closeTextAgent",{n:String(e.live),agent:String(e.agentLive)}):b("confirm.closeText",{n:String(e.live)}),hint:b("confirm.closeHint"),okLabel:b("confirm.closeOk",{n:String(e.live)}),onOk:Vi,minimize:!0})}function Vi(){if(ue===null)return;br(),Ni(!0);let e=ta();if(zi=!e,Ge=!1,_t(),vt(),Qt(),kt(),zs(),tn(),hr(),hi(),clearTimeout(Gs),clearTimeout(xr),xr=null,Bi=1e3,Xe!==null&&(Xe.remove(),Xe=null),Ui=null,ai=null,Mr=null,di(),Re!==null){for(let t of le.values())!t.exited&&t.embedded!==!0&&Pe({t:"kill",sid:t.sid});if(!e){try{Re.close()}catch{}Re=null}}Pi!==null&&(Pi.disconnect(),Pi=null);for(let[t,r]of[...le])if(r.embedded!==!0){if(r.term!==null)try{r.term.dispose()}catch{}le.delete(t)}Se=null,Wi=null,document.removeEventListener("keydown",xd),ue.remove(),ue=null,mt=null,qs=null,Cr=null,Tr=null,Ee=null,Bt=null,Ri=null,Ai=null,Ks=null,pt=null,Di=null,tn(),Dh(),yt=null,dn(),St=null,It=null,ji="",Je=null,Zr=null,Xt=null,Zi=0;try{sessionStorage.removeItem(Vs)}catch{}}function xd(e){if(e.key==="Escape"&&ue!==null){if(e.preventDefault(),ti!==null){br();return}if(er!==null){hi();return}if(ei!==null){hr();return}if(gt!==null){_t();return}Gi()}}function fg(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function pg(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 _g(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label",b("panel.title")),e.tabIndex=0,e.innerHTML='<span class="tt_sidebarEntryIcon">'+an+'</span><span class="tt_sidebarEntryLabel">'+b("panel.title")+"</span>",e.addEventListener("click",t=>{t.preventDefault(),Yo()}),e.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" "||t.key==="Spacebar")&&(t.preventDefault(),Yo())}),e}function fh(e,t){let r=pg(e);if(r===void 0)return!1;if(t.parentElement!==e){let i=r.closest('[class*="logoRow"]'),n=i!==null&&i.parentElement===e?i:r,s=Array.from(e.children).filter(o=>o instanceof HTMLElement&&o.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 o=s[s.length-1];e.insertBefore(t,o.nextSibling)}else e.insertBefore(t,n.nextElementSibling)}return!0}function mg(){if(Yi(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=_g(),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=fg()),t!==void 0&&(r=fh(t,e),r&&s.observe(t,{childList:!0,subtree:!0}))},n=new MutationObserver(()=>{i()});n.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=fh(t,e))});return i(),()=>{n.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},r=e("react"),{jsx:i,jsxs:n}=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 o(d){let l=d&&d.view,_=l==="page",[m,y]=r.useState(_),[p,c]=r.useState(null),[u,h]=r.useState(!1),[f,v]=r.useState(!1),[S,g]=r.useState({kind:"",text:""}),[x,w]=r.useState(null),[E,P]=r.useState(""),[O,F]=r.useState(!1),[A,V]=r.useState(Date.now()),B=r.useRef(null),R=r.useRef(null),[z,I]=r.useState([]),[C,L]=r.useState(!1),[T,D]=r.useState({groups:[],loading:!1,failed:!1}),[N,G]=r.useState(!1),j=r.useRef(null),Y=r.useRef(null),H=r.useRef(0),k=M=>i("div",{className:"tt_cardSection",children:M}),W=async()=>{try{let U=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();U.ok&&typeof U.config=="object"&&U.config!==null?(B.current=U.config,R.current=JSON.stringify(de(U.config)),c(U.config),Ki(U.config)):g({kind:"error",text:String(U.error||b("error.configLoadFailed"))})}catch(M){g({kind:"error",text:String(M&&M.message?M.message:M)})}},q=async()=>{try{let U=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();U.ok&&Array.isArray(U.shells)&&I(U.shells)}catch{}},$=(M,U)=>{let K=M.current,Q=K===null||K.parentElement===null?null:K.parentElement.querySelector(U);K===null||Q===null||(Q.style.width=String(Math.round(K.getBoundingClientRect().width))+"px",ts(Q,K))};r.useLayoutEffect(()=>{if(!N&&!C)return;let M=()=>{N&&$(j,".tt_routeList"),C&&$(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,z,p?.shell]);let X=async()=>{let M=H.current+1;H.current=M,D(U=>({...U,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&&!u&&(h(!0),W(),q(),X())},[m]);let J=(M,U)=>c(K=>{let Q={...K||{},[M]:U};return B.current=Q,Q}),ce=new Set(["toolsRegistered","platform","allowProxyCommandGranted","allowProxyCommandGrantSource","allowProxyCommandGrantedAt"]),de=M=>{let U={};for(let[K,Q]of Object.entries(M||{}))ce.has(K)||Q!==void 0&&(U[K]=Q);return U.sshHosts=Array.isArray(M?.sshHosts)?M.sshHosts:[],U.tunnels=Array.isArray(M?.tunnels)?M.tunnels:[],M?.sftpLimits&&typeof M.sftpLimits=="object"&&(U.sftpLimits={maxDownloadMb:Number(M.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(M.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(M.sftpLimits.maxUploadFiles)||0}),U};B.current=p;let me=(M,U)=>c(K=>({...K||{},sftpLimits:{...K?.sftpLimits??{},[M]:U}})),[te,Be]=r.useState(null),[fe,Oe]=r.useState(null),[We,ke]=r.useState(""),[ee,pe]=r.useState(null),[ve,Z]=r.useState(""),[re,ne]=r.useState(""),[oe,ie]=r.useState(""),ae=r.useRef(null),[he,ye]=r.useState(!1),[be,Le]=r.useState({text:"",kind:""}),[Ae,we]=r.useState(!1),[Ce,Ne]=r.useState({running:!1,ok:!1,text:""}),[Ue,Wt]=r.useState({}),[kd,Ed]=r.useState([]),[ot,pr]=r.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""}),[Et,pi]=r.useState(null);r.useEffect(()=>{if(!m)return;let M=!0,U=async()=>{try{let se=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();M&&se.ok&&Array.isArray(se.tunnels)&&Ed(se.tunnels)}catch{}};U();let K=setInterval(U,2e3);return()=>{M=!1,clearInterval(K)}},[m]);let _r=M=>U=>pr(K=>({...K||{},[M]:U.target.value})),ha=(M,U)=>pr(K=>({...K||{},[M]:U})),Ld=M=>M?.direction==="remote"?b("meta.tunnelRemote",{host:M.remoteHost||"127.0.0.1",port:String(M.remotePort??0),local:String(M.localTargetPort??0)}):b("meta.tunnelLocal",{local:String(M?.localPort??0),host:M?.remoteHost??"?",port:String(M?.remotePort??0)}),da=(p?.sshHosts??[]).find(M=>M?.name===ot?.bookName),mn=async M=>{try{let U=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:M})}),K=await U.json().catch(()=>({}));return!U.ok||!K.ok?(g({kind:"error",text:String(K.error||b("error.saveTunnelFailed"))}),{ok:!1,warnings:[]}):{ok:!0,warnings:Array.isArray(K.warnings)?K.warnings.map(se=>String(se)).filter(se=>se!==""):[]}}catch(U){return g({kind:"error",text:String(U&&U.message?U.message:U)}),{ok:!1,warnings:[]}}},ua=(M,U)=>{if(M.warnings.length>0){g({kind:"warn",text:M.warnings.join(" ")});return}g({kind:"ok",text:U})},fa=()=>Rc(ot,(Array.isArray(p?.sshHosts)?p.sshHosts:[]).map(M=>M?.name),b),Td=M=>{g({kind:"",text:""}),pi(String(M?.name??"")),pr({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):""})},Md=()=>{pi(null),g({kind:"",text:""}),pr(M=>({...M||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))},Rd=()=>{g({kind:"",text:""});let M=fa();if(!M.ok){g({kind:"error",text:M.error});return}let U=M.tunnel,K=Array.isArray(p?.tunnels)?p.tunnels:[];if(Ac(K,U.name)!==void 0){g({kind:"error",text:b("error.tunnelNameTaken",{name:U.name})});return}let Q=[...K,U];c(se=>({...se||{},tunnels:Q})),pr(se=>({...se||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),mn(Q).then(se=>{se.ok&&ua(se,b("msg.tunnelApplied",{name:U.name}))})},Ad=()=>{if(Et===null)return;g({kind:"",text:""});let M=fa();if(!M.ok){g({kind:"error",text:M.error});return}let U=Array.isArray(p?.tunnels)?p.tunnels:[],K=Dc(U,Et,M.tunnel,b);if(!K.ok){K.reason==="missing"&&pi(null),g({kind:"error",text:K.error});return}let Q=K.tunnels;c(se=>({...se||{},tunnels:Q})),mn(Q).then(se=>{if(se.ok!==!0){c(_e=>({..._e||{},tunnels:U}));return}pi(null),pr(_e=>({..._e||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),ua(se,b("msg.tunnelUpdated",{name:M.tunnel.name}))})},pa=(M,U)=>{c(K=>({...K||{},tunnels:M})),mn(M).then(K=>{if(K.ok!==!0){c(Q=>({...Q||{},tunnels:U}));return}K.warnings.length>0&&g({kind:"warn",text:K.warnings.join(" ")})})},Dd=M=>{let U=Array.isArray(p?.tunnels)?p.tunnels:[];Et!==null&&String(M??"")===Et&&(pi(null),pr(K=>({...K||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))),pa(U.filter(K=>K?.name!==M),U)},Pd=(M,U)=>{let K=Array.isArray(p?.tunnels)?p.tunnels:[];pa(K.map(Q=>Q?.name===M?{...Q,enabled:U}:Q),K)},Bd=M=>{Be(M?.name??null),ke(""),Ne({running:!1,ok:!1,text:""}),Z(""),ne(""),vn(),ye(Ot!==null),Oe({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}),gh().then(U=>pe(U)),bn(M?.password??"")},_a=()=>{Be(null),Oe(null),ke(""),Ne({running:!1,ok:!1,text:""}),Z(""),ne(""),vn()},Od=async()=>{if(fe===null)return;let M=fe.name.trim(),U=fe.host.trim(),K=fe.username.trim();if(M===""||U===""||K===""){ke(b("error.nameHostUserRequired"));return}let Q=Number(fe.port);if((!Number.isInteger(Q)||Q<1||Q>65535)&&(Q=22),(p?.sshHosts??[]).some(_e=>_e?.name===M&&M!==te)){ke(b("error.bookNameTaken",{name:M}));return}if(fe.auth==="key"&&fe.keyPath.trim()===""){ke(b("error.keyPathRequired"));return}ke("");let se=fe.password;if(fe.auth==="password"){let _e=await wh(he,fe.password,U,Q,K,"PASSWORD");if(_e.error!==void 0){ke(_e.error);return}_e.value!==void 0&&(se=_e.value)}c(_e=>({..._e||{},sshHosts:(Array.isArray(_e?.sshHosts)?_e.sshHosts:[]).map(xe=>xe?.name===te?{name:M,host:U,port:Q,username:K,auth:fe.auth,keyPath:fe.keyPath.trim(),passphrase:fe.passphrase,password:se,agentForward:fe.agentForward,hostKeyAlias:String(fe.hostKeyAlias??"").trim(),persist:fe.persist===!0}:xe)})),Wt(_e=>{let xe={..._e};return delete xe[M],te!==M&&delete xe[te],xe}),Be(null),Oe(null),Ne({running:!1,ok:!1,text:""}),g({kind:"ok",text:b("msg.hostEdited",{name:M})})},Id=M=>{te===M&&_a(),Wt(U=>{let K={...U};return delete K[M],K}),c(U=>({...U||{},sshHosts:(Array.isArray(U?.sshHosts)?U.sshHosts:[]).filter(K=>K?.name!==M)}))},Nd=async M=>{let U=M?.name??"";if(U==="")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:""};Wt(se=>({...se,[U]:{running:!0,text:b("msg.probing")}}));let Q=await Wo(K,!0);Wt(se=>{let _e=se[U]||{};if(Q.result){let xe=Q.result.auth?.ok===!0;return{...se,[U]:{running:!1,ok:xe,text:zo(Q.result)}}}return{...se,[U]:{running:!1,ok:!1,text:b("error.probeFailed",{detail:String(Q.error||b("error.unknown"))})}}})},Hd=async M=>{let U=(Array.isArray(p?.hostKeys)?p.hostKeys:[]).filter(K=>!(K?.host===M?.host&&Number(K?.port)===Number(M?.port)));c(K=>({...K||{},hostKeys:U}));try{let K=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:U})}),Q=await K.json().catch(()=>({}));!K.ok||!Q.ok?g({kind:"error",text:String(Q.error||b("error.hostKeyDeleteFailed"))}):g({kind:"ok",text:b("msg.hostKeyDeleted")})}catch(K){g({kind:"error",text:String(K&&K.message?K.message:K)})}},Fd=async()=>{g({kind:"",text:""});try{let U=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!U.ok){g({kind:"error",text:String(U.error||b("error.sshConfigReadFailed"))});return}let K=Array.isArray(U.entries)?U.entries:[],Q=[...Array.isArray(p?.sshHosts)?p.sshHosts:[]],se=new Set(Q.map(Ie=>Ie?.name)),_e=0,xe=0;for(let Ie of K)if(!(Ie===null||typeof Ie!="object"||typeof Ie.name!="string")){if(se.has(Ie.name)){xe+=1;continue}se.add(Ie.name),Q.push({name:Ie.name,host:String(Ie.host??Ie.name),port:Number(Ie.port)||22,username:String(Ie.username??""),auth:Ie.auth==="key"?"key":"agent",keyPath:String(Ie.keyPath??""),passphrase:"",password:"",agentForward:!1,hostKeyAlias:typeof Ie.hostKeyAlias=="string"?Ie.hostKeyAlias:""}),_e+=1}c(Ie=>({...Ie||{},sshHosts:Q}));let ge=Array.isArray(U.proxy)?U.proxy.filter(Ie=>typeof Ie=="string"):[],Ze=Number.isInteger(U.proxyCount)?U.proxyCount:ge.length,mr=Array.isArray(U.proxyCommand)?U.proxyCommand.filter(Ie=>typeof Ie=="string"):[],rt=Number.isInteger(U.proxyCommandCount)?U.proxyCommandCount:mr.length,Or=Number.isInteger(U.skippedOther)?U.skippedOther:0,rr=Number.isInteger(U.droppedOverflow)?U.droppedOverflow:0,bt=[];Ze>0&&bt.push(b("msg.proxySkipped",{count:Ze,names:ge.slice(0,5).join(b("list.separator"))+(Ze>5?b("meta.etc"):"")})),rt>0&&bt.push(b("msg.proxyCommandSkipped",{count:rt,names:mr.slice(0,5).join(b("list.separator"))+(rt>5?b("meta.etc"):"")})),Or>0&&bt.push(b("msg.skippedNotConcrete",{count:Or})),rr>0&&bt.push(b("msg.importOverflow",{count:rr}));let Ca=bt.length>0?b("list.separatorFull")+bt.join(b("list.separatorFull")):"";if(_e===0){let Ie=xe>0?b("msg.noNewEntries",{count:xe}):b("msg.noImportableHosts");g({kind:bt.length>0?"error":"ok",text:Ie+Ca})}else g({kind:bt.length>0?"error":"ok",text:b("msg.importedHosts",{added:_e,skipped:xe})+Ca})}catch(M){g({kind:"error",text:String(M&&M.message?M.message:M)})}},ma=M=>M===null||typeof M!="object"?[]:Array.isArray(M.fingerprints)?M.fingerprints.filter(U=>typeof U=="string"&&U!==""):typeof M.fingerprint=="string"&&M.fingerprint!==""?[M.fingerprint]:[],Wd=async()=>{g({kind:"",text:""});try{let U=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!U.ok){g({kind:"error",text:String(U.error||b("error.knownHostsReadFailed"))});return}let K=Array.isArray(U.entries)?U.entries:[],Q=[...Array.isArray(p?.hostKeys)?p.hostKeys:[]],se=new Map;for(let ge of Q)ge===null||typeof ge!="object"||se.set(String(ge.host??"")+":"+String(ge.port??22),{record:ge,fps:new Set(ma(ge))});let _e=0,xe=0;for(let ge of K){if(ge===null||typeof ge!="object"||typeof ge.host!="string")continue;let Ze=Array.isArray(ge.fingerprints)?ge.fingerprints.filter(rr=>typeof rr=="string"&&rr!==""):[];if(typeof ge.fingerprint=="string"&&ge.fingerprint!==""&&Ze.push(ge.fingerprint),Ze.length===0)continue;let mr=ge.host+":"+String(ge.port??22),rt=se.get(mr);if(rt!==void 0){let rr=!1;for(let bt of Ze)rt.fps.has(bt)||rt.fps.size>=8||(rt.fps.add(bt),rr=!0);if(!rr){xe+=1;continue}delete rt.record.fingerprint,rt.record.fingerprints=[...rt.fps],_e+=1;continue}let Or={host:ge.host,port:Number(ge.port)||22,fingerprints:[...new Set(Ze)].slice(0,8)};se.set(mr,{record:Or,fps:new Set(Or.fingerprints)}),Q.push(Or),_e+=1}if(_e===0){g({kind:"ok",text:xe>0?b("msg.noNewFingerprints",{count:xe}):b("msg.noImportableKnownHosts")});return}c(ge=>({...ge||{},hostKeys:Q}));try{let ge=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:Q})}),Ze=await ge.json().catch(()=>({}));if(!ge.ok||!Ze.ok){g({kind:"error",text:String(Ze.error||b("error.saveHostKeysFailed"))});return}g({kind:"ok",text:b("msg.importedFingerprints",{added:_e,skipped:xe})+(U.truncated===!0?b("hint.knownHostsTruncated"):"")})}catch(ge){g({kind:"error",text:String(ge&&ge.message?ge.message:ge)})}}catch(M){g({kind:"error",text:String(M&&M.message?M.message:M)})}},ga=async M=>{let U=M??B.current??p;v(!0),g({kind:"",text:""});let K=de(U);try{let Q=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(K)}),se=await Q.json();!Q.ok||!se.ok?g({kind:"error",text:String(se.error||b("error.saveFailed"))}):(g({kind:"ok",text:b("msg.saved")}),R.current=JSON.stringify(K),se.config&&(B.current=se.config,c(se.config),Ki(se.config)))}catch(Q){g({kind:"error",text:String(Q&&Q.message?Q.message:Q)})}v(!1)},gn=M=>"/api/dsh-tty/elevate"+M,va=async()=>{try{let U=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json(),K=U&&typeof U.config=="object"&&U.config!==null?U.config:null;if(K===null)return;c(Q=>{if(Q===null)return Q;let se={...Q,allowProxyCommandGranted:K.allowProxyCommandGranted===!0,allowProxyCommandGrantSource:K.allowProxyCommandGrantSource??null,allowProxyCommandGrantedAt:Number.isFinite(K.allowProxyCommandGrantedAt)?K.allowProxyCommandGrantedAt:null};return B.current=se,se})}catch{}},ba=async()=>{w(null),F(!1);let M=B.current||{},U=R.current!==null&&JSON.stringify(de(M))===R.current,K={...M,allowProxyCommand:!0};B.current=K,c(K),await va(),U?(await ga(K),P(b("elev.granted"))):P(b("elev.grantedNeedSave"))},wa=async()=>{F(!1),P(""),w({phase:"loading"});try{let M=await fetch(gn(""),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Fs})}),U=await M.json().catch(()=>({}));if(!M.ok){w({phase:"error",error:String(U.error||M.status)});return}if(U.status==="granted"){await ba();return}w({phase:"pending",command:String(U.command??""),expiresAt:Number(U.expiresAt)||0})}catch(M){w({phase:"error",error:String(M&&M.message?M.message:M)})}},zd=async()=>{P("");try{let M=await fetch(gn("/revoke"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Fs})}),U=await M.json().catch(()=>({}));if(!M.ok){P(b("elev.error")+String(U.error||M.status));return}await va(),P(b("elev.revoked"))}catch(M){P(b("elev.error")+String(M&&M.message?M.message:M))}},Ud=async()=>{let M=x===null?"":String(x.command??"");if(M!==""){if(yd())try{await navigator.clipboard.writeText(M),F(!0);return}catch{}F(!1),P(b("elev.copyManual"))}};r.useEffect(()=>{if(x===null||x.phase!=="pending")return;let M=setInterval(()=>V(Date.now()),1e3),U=setInterval(()=>{fetch(gn("/status"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Fs})}).then(K=>K.json()).then(K=>{K.status==="granted"&&ba()}).catch(()=>{})},1500);return()=>{clearInterval(M),clearInterval(U)}},[x]);let jd=()=>{if(p.allowProxyCommandGrantSource==="env")return i("span",{className:"tt_cardHint",children:b("elev.viaEnv")});let M=p.allowProxyCommandGrantedAt;return n("span",{className:"tt_capState",children:[Number.isFinite(M)?i("span",{children:b("elev.grantedAt",{time:cg(M)})}):null,i("button",{type:"button",className:"tt_toolBtn tt_capRevoke",onClick:()=>{zd()},children:b("elev.revoke")})]})},$d=()=>{let M=String(x.command??""),U=x.expiresAt>0?Math.max(0,Math.ceil((x.expiresAt-A)/1e3)):0,K=x.phase==="pending"&&x.expiresAt>0&&U===0,Q=()=>{w(null),F(!1)};return n("div",{className:"tt_elevPanel",children:[n("div",{className:"tt_elevHead",children:[i("span",{className:"tt_cardLabel",children:b("elev.title")}),i("button",{type:"button",className:"tt_toolBtn",onClick:Q,children:b("elev.close")})]}),i("span",{className:"tt_cardHint",children:b("elev.lockedWhy")}),x.phase==="error"?i("span",{className:"tt_cardHint tt_sshProbeWarn",children:b("elev.error")+String(x.error??"")}):null,x.phase==="loading"?i("span",{className:"tt_cardHint",children:b("elev.loading")}):null,M===""?null:n("div",{className:"tt_elevSteps",children:[i("span",{className:"tt_cardHint",children:b("elev.step")}),i("div",{className:"tt_elevCommand",children:i("code",{children:M})}),n("div",{className:"tt_elevActions",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Ud()},children:b(O?"elev.copied":"elev.copy")}),K?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{wa()},children:b("elev.regenerate")}):i("span",{className:"tt_cardHint",children:b("elev.expiresIn",{sec:U})})]}),i("span",{className:"tt_cardHint",children:b(K?"elev.expired":"elev.waiting")})]}),p.allowProxyCommand===!0&&p.allowProxyCommandGranted!==!0?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{J("allowProxyCommand",!1),Q()},children:b("elev.disableFirst")}):null,i("span",{className:"tt_cardHint",children:b("elev.otherWay")}),i("span",{className:"tt_cardHint",children:b("elev.envHow",{env:Fs})})]})},qd=()=>{let M=p.allowProxyCommandGranted===!0,U=p.allowProxyCommand===!0;return n("div",{className:"tt_capBlock",children:[n("label",{className:"tt_cardField tt_cardRow tt_cardToggle tt_cardDanger",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:U,onChange:K=>{if(!M){wa();return}J("allowProxyCommand",K.target.checked)}}),i("span",{className:"tt_cardLabel",children:b("check.allowProxyCommand")}),U&&!M?i("span",{className:"tt_badgeWarn",children:b("badge.notEffective")}):null]}),i("span",{className:"tt_cardHint",children:b("hint.allowProxyCommand")}),M?jd():i("span",{className:"tt_cardHint tt_sshProbeWarn",children:b("hint.proxyCommandNotGranted")}),E===""?null:i("span",{className:"tt_cardHint",children:E}),x===null?null:$d()]})},vn=()=>{ae.current!==null&&(clearTimeout(ae.current),ae.current=null),ie("")},bn=async M=>{let U=Jr(M);if(oi()===null){ye(!1),we(!1),Le({text:b(Ot===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),kind:"muted"});return}if(U===""){we(!1),Le({text:"",kind:""});return}let K=await vh(U);if(K.unreported===!0){we(!1),Le({text:b("status.credUnreported",{ref:U}),kind:"plain"});return}if(K.error!==void 0){we(!1),Le({text:b("error.credStatusFailed",{error:K.error}),kind:"error"});return}let Q=K.view;Le({text:Q.configured?b("status.credStored",{ref:U,source:Q.source!==""?b("meta.credSource",{source:Q.source}):""}):b("status.credUnknown",{ref:U}),kind:Q.configured?"ok":"plain"}),we(Q.configured===!0&&Q.writable===!0)},Kd=async()=>{let M=Jr(fe?.password??"");if(M==="")return;let U=await bh(M);if(U.error!==void 0){Le({text:U.error,kind:"error"});return}Oe(K=>({...K||{},password:""})),Le({text:"",kind:""}),we(!1)},Gd=(M,U)=>{let K=String(fe?.[M]??"");if(K===""||K.startsWith("env:")||oe===U){vn(),Oe(Q=>({...Q||{},[M]:"env:"+U})),Z(""),M==="password"&&bn("env:"+U);return}ie(U),ae.current!==null&&clearTimeout(ae.current),ae.current=setTimeout(()=>{ae.current=null,ie("")},4e3)},ya=(M,U)=>{if(ee===null)return null;if(ee.length===0)return i("span",{className:"tt_cardHint",children:U});let K=ve===M,Q=re.trim().toUpperCase(),se=Q===""?ee:ee.filter(_e=>_e.toUpperCase().includes(Q));return n("div",{className:"tt_credPicker",children:[i("input",{className:"tt_cardInput",value:K?re:"",placeholder:b("placeholder.credRef"),title:b("hint.credRefCandidates"),autoComplete:"off",spellCheck:!1,onFocus:()=>{Z(M),ne("")},onBlur:_e=>{_e.currentTarget.parentElement.contains(_e.relatedTarget)||Z("")},onChange:_e=>{ne(_e.target.value),Z(M)}}),...K?[i("div",{className:"tt_envList",children:[...se.length===0?[i("span",{className:"tt_envMore",children:b("list.noCredRef")})]:se.slice(0,30).map(_e=>i("button",{type:"button",className:"tt_envItem","data-danger":oe===_e?"":void 0,onMouseDown:xe=>xe.preventDefault(),onClick:()=>Gd(M,_e),children:oe===_e?b("list.credOverwrite",{name:_e}):_e},_e)),...se.length>30?[i("span",{className:"tt_envMore",children:b("list.moreMatches",{count:se.length-30})})]:[]]},"cred-list-"+M)]:[]]})},Vd=()=>{let U=Jr(fe?.password??"")!=="",K=oi()===null;return n("div",{className:"tt_sshRow tt_credRow",children:[U?i("button",{type:"button",className:"tt_toolBtn tt_credClear",disabled:Ae!==!0,onClick:()=>{Kd()},children:b("btn.clearCredential")}):i("label",{className:"tt_credToggle",title:b("hint.rememberCredentialApply"),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:he,disabled:K,onChange:Q=>ye(Q.target.checked)}),i("span",{children:b("check.rememberCredentialApply")})]}),be.text===""?null:i("span",{className:"tt_credStatus","data-kind":be.kind,children:be.text}),K&&be.text===""?i("span",{className:"tt_credStatus","data-kind":"muted",children:b("error.credPlainUnavailable")}):null]})},Sa=()=>{let M=String(fe?.host??"").trim(),U=String(fe?.username??"").trim(),K=Number(fe?.port);if((!Number.isInteger(K)||K<1||K>65535)&&(K=22),M===""||U==="")return ke(b("error.hostUserRequired")),null;let Q=fe?.auth,se={host:M,port:K,username:U,auth:Q};if(Q==="key"){let xe=String(fe?.keyPath??"").trim();if(xe==="")return ke(b("error.keyPathRequired")),null;se.keyPath=xe,fe?.passphrase!==""&&(se.passphrase=fe.passphrase)}if(Q==="password"){let xe=String(fe?.password??"");if(xe==="")return ke(b("error.passwordRequired")),null;se.password=xe}fe?.agentForward===!0&&(se.agentForward=!0);let _e=String(fe?.hostKeyAlias??"").trim();return _e!==""&&(se.hostKeyAlias=_e),se},Yd=()=>{ke("");let M=Sa();M!==null&&(Ne({running:!0,ok:!1,text:b("msg.probing")}),Wo(M,!1).then(U=>{if(U.result){let K=U.result.auth?.ok===!0;Ne({running:!1,ok:K,text:zo(U.result)});return}Ne({running:!1,ok:!1,text:b("error.probeFailed",{detail:String(U.error||b("error.unknown"))})})}))},Xd=()=>{ke("");let M=Sa();M!==null&&pn(M)},Jd=()=>{if(fe===null)return null;let M=(U,K,Q,se,_e)=>n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:U}),i("input",{className:"tt_cardInput",type:se??"text",value:fe[K]??"",placeholder:Q??"",autoComplete:"off",spellCheck:!1,onChange:xe=>{let ge=xe.target.value;Oe(Ze=>({...Ze||{},[K]:ge}))},..._e??{}})]});return n("div",{className:"tt_sshEdit",children:[i("div",{className:"tt_sshSection",children:b("section.connection")}),n("div",{className:"tt_sshGrid",children:[M(b("field.bookName"),"name",b("hint.bookNameConflict")),M(b("field.port"),"port","22")]}),M(b("field.host"),"host",b("placeholder.host")),M(b("field.username"),"username","root"),i("div",{className:"tt_sshSection",children:b("section.auth")}),n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.authMethod")}),n("select",{className:"tt_cardInput",value:fe.auth,onChange:U=>Oe(K=>({...K||{},auth:U.target.value})),children:[i("option",{value:"agent",children:b("option.authAgent")}),i("option",{value:"key",children:b("option.authKey")}),i("option",{value:"password",children:b("option.authPassword")})]})]}),...fe.auth==="key"?[M(b("field.keyPath"),"keyPath","~/.ssh/id_ed25519"),M(b("field.passphrase"),"passphrase","","password"),ya("passphrase",b("hint.noCredRefPassphrase"))]:[],...fe.auth==="password"?[M(b("field.password"),"password","","password",{onBlur:()=>{bn(fe.password)}}),Vd(),ya("password",b("hint.noCredRefPasswordApply"))]:[],i("div",{className:"tt_sshSection",children:b("section.options")}),n("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:fe.agentForward===!0,onChange:U=>Oe(K=>({...K||{},agentForward:U.target.checked}))}),i("span",{className:"tt_cardLabel",children:b("check.agentForward")})]}),M(b("field.hostKeyAlias"),"hostKeyAlias",b("placeholder.hostKeyAlias")),i("span",{className:"tt_cardHint",children:b("hint.hostKeyAlias")}),ur==="tmux"?n("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:fe.persist===!0,onChange:U=>Oe(K=>({...K||{},persist:U.target.checked}))}),i("span",{className:"tt_cardLabel",children:b("check.persist")})]}):null,Ce.text!==""?i("div",{className:"tt_sshProbeResult"+(!Ce.running&&Ce.ok?" tt_sshProbeOk":"")+(!Ce.running&&!Ce.ok?" tt_sshProbeBad":""),children:Ce.text}):null,We!==""?i("span",{className:"tt_cardMessage tt_cardMessageError",children:We}):null,n("div",{className:"tt_sshActions",children:[n("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:_a,children:b("btn.cancel")}),i("button",{type:"button",className:"tt_toolBtn",title:b("btn.browseTitle"),onClick:Xd,children:b("btn.fileBrowse")}),i("button",{type:"button",className:"tt_toolBtn",disabled:Ce.running,title:b("btn.probeTitle"),onClick:Yd,children:Ce.running?b("msg.probing"):b("btn.probe")})]}),n("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_cardSave",onClick:()=>{Od()},children:b("btn.apply")}),i("span",{className:"tt_cardHint",children:b("hint.appliedOnSave")})]})]})]})},Zd=M=>{let U=typeof M?.assistProvider=="string"?M.assistProvider.trim():"",K=typeof M?.assistModel=="string"?M.assistModel.trim():"";return U!==""&&K!==""?U+"/"+K:U!==""?U:K},Qd=()=>{if(T.loading)return i("span",{className:"tt_envMore",children:b("list.modelLoading")});if(T.failed)return i("span",{className:"tt_envMore",children:b("list.modelCatalogFailed")});let M=[],U=(p?.assistProvider??"")===""&&(p?.assistModel??"")==="";M.push(i("button",{type:"button",className:"tt_envItem",...U?{"data-active":""}:{},onMouseDown:K=>K.preventDefault(),onClick:()=>{c(K=>({...K||{},assistProvider:"",assistModel:""})),G(!1)},children:b("option.followHostModel")},"assist-route-default"));for(let K of T.groups){let Q=String(K.id??"");if(Q==="")continue;let se=String(K.name??Q),_e=Array.isArray(K.models)?K.models:[];if(_e.length!==0){M.push(i("span",{className:"tt_envMore",children:se},"group-"+Q));for(let xe of _e){let ge=String(xe.id??"");if(ge==="")continue;let Ze=String(xe.name??"")===""?ge:String(xe.name),mr=(p?.assistProvider??"")===Q&&(p?.assistModel??"")===ge;M.push(i("button",{type:"button",className:"tt_envItem",...mr?{"data-active":""}:{},title:Q+"/"+ge,onMouseDown:rt=>rt.preventDefault(),onClick:()=>{c(rt=>({...rt||{},assistProvider:Q,assistModel:ge})),G(!1)},children:Ze===ge?ge:Ze},Q+"/"+ge))}}}return T.groups.length===0&&M.push(i("span",{className:"tt_envMore",children:b("list.noModelCandidate")},"assist-route-empty")),M},_i=(M,U,K,Q)=>n("label",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:M}),i("input",{className:"tt_cardInput",value:p[U]??"",placeholder:K??"",onChange:se=>J(U,se.target.value)}),Q?i("span",{className:"tt_cardHint",children:Q}):null]}),Br=(M,U,K,Q)=>n("label",{className:"tt_cardField tt_cardRow tt_cardToggle"+(typeof K=="string"&&K!==""?" "+K:""),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:p[U]===!0,disabled:Q===!0&&p[U]!==!0,onChange:se=>J(U,se.target.checked)}),i("span",{className:"tt_cardLabel",children:M})]}),mi=p?.platform==="win32";return l==="summary"?b("card.desc"):n(_?"div":"li",{className:_?"tt_pageHost":m?"tt_card tt_cardOpen":"tt_card",children:[_?null:n("button",{type:"button",className:"tt_cardHeader","aria-expanded":m,onClick:()=>y(M=>!M),children:[n("span",{className:"tt_cardHeadText",children:[i("span",{className:"tt_cardName",children:b("card.name")}),i("span",{className:"tt_cardDescription",children:b("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"})})]}),_||m?n("div",{className:"tt_cardBody",children:[p===null?i("div",{className:"tt_cardMessage",children:b("list.loadingConfig")}):n("div",{children:[k(b("section.basic")),Br(b("check.enabled"),"enabled"),Br(b("check.announce"),"announceToAgent"),mi?n("div",{className:"tt_cardField",children:[n("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:!1,disabled:!0}),i("span",{className:"tt_cardLabel",children:b("check.shellIntegration")})]}),i("span",{className:"tt_cardHint",children:b("hint.shellIntegrationWindows")})]}):Br(b("check.shellIntegrationWindows"),"shellIntegration"),k(b("section.sftp")),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("field.sftpStyle")}),n("select",{className:"tt_cardInput",value:p.sftpStyle==="dual"?"dual":"dialog",onChange:M=>J("sftpStyle",M.target.value),children:[i("option",{value:"dialog",children:b("option.sftpDialog")}),i("option",{value:"dual",children:b("option.sftpDual")})]}),i("span",{className:"tt_cardHint",children:b("hint.sftpDual")})]}),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("field.sftpLimits")}),n("div",{className:"tt_limitGrid",children:[n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.downloadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxDownloadMb))?Number(p.sftpLimits.maxDownloadMb):1024),onChange:M=>me("maxDownloadMb",Number(M.target.value)||0)})]}),n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.uploadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxUploadMb))?Number(p.sftpLimits.maxUploadMb):2048),onChange:M=>me("maxUploadMb",Number(M.target.value)||0)})]}),n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.uploadCountLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxUploadFiles))?Number(p.sftpLimits.maxUploadFiles):1e3),onChange:M=>me("maxUploadFiles",Number(M.target.value)||0)})]})]}),i("span",{className:"tt_cardHint",children:b("hint.sftpLimits")})]}),k(b("section.session")),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("field.persistence")}),n("select",{className:"tt_cardInput",value:p.persistence==="tmux"?"tmux":"off",onChange:M=>J("persistence",M.target.value),children:[i("option",{value:"off",children:b("option.persistOff")}),i("option",{value:"tmux",children:b("option.persistTmux")})]}),i("span",{className:"tt_cardHint",children:b("hint.persistence")+(mi?b("hint.persistenceWindows"):"")}),Br(b("check.endOnPageClose"),"endOnPageClose"),Br(b("check.statsEnabled"),"statsEnabled"),i("span",{className:"tt_cardHint",children:b("hint.statsEnabled")}),qd()]}),k(b("section.assist")),Br(b("check.assistEnabled"),"assistEnabled"),i("span",{className:"tt_cardHint",children:b("hint.assistEnabled")}),n("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||G(!1)},children:[i("span",{className:"tt_cardLabel",children:b("field.assistRoute")}),i("input",{className:"tt_cardInput tt_routeInput",ref:j,readOnly:!0,value:Zd(p),autoComplete:"off",spellCheck:!1,onFocus:()=>{G(!0),T.groups.length===0&&!T.loading&&X()},onClick:()=>{G(!0),T.groups.length===0&&!T.loading&&X()},onKeyDown:M=>{M.key==="Escape"&&G(!1)}}),...N?[i("div",{className:"tt_envList tt_routeList",children:Qd()},"assist-route-list")]:[],i("span",{className:"tt_cardHint",children:b("hint.assistRoute")})]},"assist-route-field"),_i(b("field.maxSessions"),"maxSessions","4",b("hint.maxSessions")),n("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||L(!1)},children:[i("span",{className:"tt_cardLabel",children:b(mi?"field.shellWindows":"field.shell")}),i("input",{className:"tt_cardInput",ref:Y,value:p.shell??"",placeholder:b(mi?"placeholder.shellWindows":"placeholder.shell"),autoComplete:"off",spellCheck:!1,onFocus:()=>L(!0),onClick:()=>L(!0),onKeyDown:M=>{M.key==="Escape"&&L(!1)},onChange:M=>{J("shell",M.target.value),L(!0)}}),...C?[i("div",{className:"tt_envList tt_shellList",children:(()=>{let M=(p.shell??"").trim().toLowerCase(),U=M===""?z:z.filter(K=>K.toLowerCase().includes(M));return U.length===0?i("span",{className:"tt_envMore",children:b("list.noShellCandidate")}):U.map(K=>i("button",{type:"button",className:"tt_envItem",onMouseDown:Q=>Q.preventDefault(),onClick:()=>{J("shell",K),L(!1)},children:K},K))})()},"shell-list")]:[],i("span",{className:"tt_cardHint",children:b(mi?"hint.shellCandidatesWindows":"hint.shellCandidates")})]},"shell-field"),_i("TERM","term","xterm-256color",b("hint.term")),_i("COLORTERM","colorTerm","truecolor",""),_i(b("field.cwd"),"cwd","",b("placeholder.cwd")),_i(b("field.grace"),"reconnectGraceSec","120",b("hint.grace")),k(b("section.ssh")),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("panel.sshBook")}),...Array.isArray(p.sshHosts)&&p.sshHosts.length>0?[i("div",{className:"tt_hostList","data-editing":te!==null?"":void 0,children:p.sshHosts.map(M=>n("div",{children:[n("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:Fo(M??{})})]}),i("button",{type:"button",className:"tt_toolBtn",disabled:Ue[M?.name]?.running===!0,onClick:()=>{Nd(M)},title:b("btn.probeRowTitle"),children:Ue[M?.name]?.running===!0?b("msg.testing"):b("btn.test")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Bd(M),children:b("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Id(M?.name),children:b("btn.delete")})]}),Ue[M?.name]&&Ue[M?.name].text?i("div",{className:"tt_sshProbeResult"+(Ue[M?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:Ue[M?.name].text}):null,te===M?.name?Jd():null]},String(M?.name??"")))})]:[i("span",{className:"tt_cardHint",children:b("list.emptySshHosts")})],n("div",{className:"tt_cardRow",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Fd()},children:b("btn.importSshConfig")}),i("span",{className:"tt_cardHint",children:b("hint.importSshConfig")})]}),i("span",{className:"tt_cardHint",children:b("hint.sshBook")})]}),n("div",{className:"tt_cardField",children:[n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("panel.tunnels")}),...Array.isArray(p.tunnels)&&p.tunnels.length>0?[i("div",{children:p.tunnels.map(M=>{let U=kd.find(se=>se.name===M?.name),K=U?.state??"stopped",Q=Et!==null&&String(M?.name??"")===Et;return n("div",{className:"tt_sshHostRow","data-editing":Q?"":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 "+Ld(M??{})}),i("span",{className:"tt_sshHostTarget",children:(M?.bookName??"")+(U?.error?" \xB7 "+U.error:"")+(U?.lastForwardError?" \xB7 "+U.lastForwardError:"")})]}),i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:M?.enabled!==!1,title:b("check.tunnelEnabled"),onChange:se=>Pd(M?.name,se.target.checked)}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Td(M),children:b("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Dd(M?.name),children:b("btn.delete")})]},String(M?.name??""))})})]:[i("span",{className:"tt_cardHint",children:b("list.emptyTunnels")})],n("div",{className:"tt_sshEdit",children:[n("div",{className:"tt_cardRow tt_tunnelHead",children:[n("div",{className:"tt_segmented",role:"group","aria-label":b("field.direction"),children:[i("button",{type:"button",className:"tt_segmentedBtn","data-active":ot.direction!=="remote"?"":void 0,title:b("option.localForwardTitle"),onClick:()=>ha("direction","local"),children:b("option.localForward")}),i("button",{type:"button",className:"tt_segmentedBtn","data-active":ot.direction==="remote"?"":void 0,title:b("option.remoteForwardTitle"),onClick:()=>ha("direction","remote"),children:b("option.remoteForward")})]}),n("select",{className:"tt_cardInput",value:ot.bookName,onChange:_r("bookName"),children:[i("option",{value:"",children:b("option.selectBook")}),...Array.isArray(p?.sshHosts)?p.sshHosts.map(M=>i("option",{value:M?.name??"",children:M?.name??""})):[]]})]}),i("span",{className:"tt_cardHint",children:da!==void 0?b("hint.tunnelViaBook",{book:Fo(da)}):b("hint.tunnelBookEmpty")}),ot.direction==="local"?n("div",{className:"tt_tunnelEndpoints",children:[n("div",{className:"tt_tunnelHop",children:[n("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:b("hint.localListenFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.localPort"),value:ot.localPort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.localListenPort"),onChange:_r("localPort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"local",title:b("hint.flowLocalToRemote"),"aria-hidden":"true",children:"\u2192"})]}),n("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:b("placeholder.remoteHost"),title:b("hint.remoteHostTitle"),value:ot.remoteHost,autoComplete:"off","aria-label":b("field.remoteHost"),onChange:_r("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.port"),value:ot.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.remotePort"),onChange:_r("remotePort")})]})]}):n("div",{className:"tt_tunnelEndpoints",children:[n("div",{className:"tt_tunnelHop",children:[n("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:b("placeholder.remoteListenHost"),title:b("hint.remoteListenHost"),value:ot.remoteHost,autoComplete:"off","aria-label":b("field.remoteListenHost"),onChange:_r("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.listenPort"),value:ot.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.remoteListenPort"),onChange:_r("remotePort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"remote",title:b("hint.flowRemoteToLocal"),"aria-hidden":"true",children:"\u2192"})]}),n("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:b("hint.localDialFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.localTargetPort"),value:ot.localTargetPort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.localTargetPort"),onChange:_r("localTargetPort")})]})]}),i("div",{className:"tt_tunnelEndpoints",children:[i("span",{className:"tt_tunnelEndLabel",children:ot.direction==="local"?b("hint.tunnelLocalSummary"):b("hint.tunnelRemoteSummary")})]}),i("div",{className:"tt_cardRow tt_tunnelActions",children:[Et===null?i("button",{type:"button",className:"tt_cardSave",onClick:Rd,children:b("btn.addTunnel")}):i("button",{type:"button",className:"tt_cardSave",onClick:Ad,children:b("btn.saveEdit")}),Et===null?null:i("button",{type:"button",className:"tt_toolBtn",onClick:Md,children:b("btn.cancel")}),i("span",{className:"tt_cardHint",children:Et===null?b("hint.tunnelAdd"):b("hint.tunnelEditing",{name:Et})})]})]})]}),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("panel.hostKeys")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Wd()},children:b("btn.importKnownHosts")})]}),...Array.isArray(p.hostKeys)&&p.hostKeys.length>0?[i("div",{className:"tt_hostList",children:p.hostKeys.map((M,U)=>n("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:ma(M).map(K=>"sha256:"+K).join(" / ")})]}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>{Hd(M)},children:b("btn.delete")})]},String(M?.host??"")+":"+String(M?.port??22)+"#"+String(U)))})]:[i("span",{className:"tt_cardHint",children:b("list.emptyHostKeys")})],i("span",{className:"tt_cardHint",children:b("hint.hostKeys")})]}),n("div",{className:"tt_cardField tt_cardRow",children:[i("button",{className:"tt_cardSave",disabled:f,onClick:()=>{ga()},children:b(f?"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=d=>{L_(d),Rh=d.sessions,d.inject(["remote","remote.credentials"],S=>(Ot=S.remote?.credentials??S["remote.credentials"]??null,()=>{Ot=null}));let l=!1,_=()=>{};rn={set(S){if(S!==l){if(l=S,S){_=mg();return}_(),_=()=>{},Vi(),Er()}}},Xh(!0),aa();let m="@hyzyn/dsh-all",p=[...new Set(a.map(S=>S.split("#")[0]))].find(S=>S!==m),c=!1,u=[];p!==void 0&&d.slots.inject("plugins.bundle.config",()=>{for(c=!0;u.length>0;){let S=u.pop();typeof S=="function"&&S()}return d.slots.register({name:"plugins.bundle.config",key:p},o)});for(let S of a)d.slots.inject("plugins.row.config",()=>{let g=S.split("#")[0]===p;if(g&&c)return;let x=d.slots.register({name:"plugins.row.config",key:S},o);return g&&u.push(x),x});d.slots.inject("settings.kit.item",()=>d.slots.register({name:"settings.kit.item",id:"tty",order:80,label:()=>b("card.name")},o)),d.slots.inject("settings.plugin.item",()=>d.slots.register({name:"settings.plugin.item",key:"tty",order:100},o));let h=d.provide("ttyConnbar",{version:1,addAction:cn,requestRender(){Er()}}),f=d.provide("ttyTerminal",{version:3,open(S){if(!Lr)return;let g=Fh(S),x=Wh(S,g),w=typeof S?.label=="string"&&S.label!==""?S.label:void 0;if(Yi(),S?.reuse!==!1){let E=nm(x);if(E!==null)return Vo(),tr(E.sid,{user:!0}),E}return Vo(),$i(x,w)},mount(S,g){return Lr?_m(S,g):()=>{}}}),v=d.provide("ttyPanel",{version:2,isOpen(){return ue!==null&&!Ge},mountPane(S){return jh(S)},minimize(){return Gi(),ue!==null&&Ge}});return()=>{rn=null,Lr=!1,_(),v(),f(),h(),Vi()}},t}});})();
3488
3667
  /*! Bundled license information:
3489
3668
 
3490
3669
  @xterm/addon-search/lib/addon-search.mjs: