@hyzyn/dsh-tty 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +134 -18
- package/README.md +138 -18
- package/client.js +115 -34
- package/lib/index.d.ts +2 -1
- package/lib/index.js +81 -1
- package/lib/index.js.map +1 -1
- package/lib/probe.js +1 -1
- package/lib/probe.js.map +1 -1
- package/lib/sftp.js +1 -1
- package/lib/sftp.js.map +1 -1
- package/lib/ssh.d.ts +39 -2
- package/lib/ssh.js +54 -12
- package/lib/ssh.js.map +1 -1
- package/lib/tunnels.d.ts +4 -0
- package/lib/tunnels.js +9 -5
- package/lib/tunnels.js.map +1 -1
- package/package.json +5 -4
package/client.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`)))),this.register(this._terminal.onA11yTab((w=>this._handleTab(w)))),this.register(this._terminal.onKey((w=>this._handleKey(w.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,
|
|
3
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),/\p{Control}/u.test(l)||this._charsToConsume.push(l)}_refreshRows(l,u){this._liveRegionDebouncer.refresh(l,u,this._terminal.rows)}_renderRows(l,u){let v=this._terminal.buffer,C=v.lines.length.toString();for(let w=l;w<=u;w++){let y=v.lines.get(v.ydisp+w),m=[],x=y?.translateToString(!0,void 0,void 0,m)||"",T=(v.ydisp+w+1).toString(),I=this._rowElements[w];I&&(x.length===0?(I.innerText="\xA0",this._rowColumns.set(I,[0,1])):(I.textContent=x,this._rowColumns.set(I,m)),I.setAttribute("aria-posinset",T),I.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,u){let v=l.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==C)return;let w,y;if(u===0?(w=v,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(w=this._rowElements.shift(),y=v,this._rowContainer.removeChild(w)),w.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:l.anchorNode,offset:l.anchorOffset},v={node:l.focusNode,offset:l.focusOffset};if((u.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===v.node&&u.offset>v.offset)&&([u,v]=[v,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;let C=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:C,offset:C.textContent?.length??0}),!this._rowContainer.contains(v.node))return;let w=({node:x,offset:T})=>{let I=x instanceof Text?x.parentNode:x,F=parseInt(I?.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;let R=this._rowColumns.get(I);if(!R)return console.warn("columns is null. Race condition?"),null;let z=T<R.length?R[T]:R.slice(-1)[0]+1;return z>=this._terminal.cols&&(++F,z=0),{row:F,column:z}},y=w(u),m=w(v);if(y&&m){if(y.row>m.row||y.row===m.row&&y.column>=m.column)throw new Error("invalid range");this._terminal.select(y.column,y.row,(m.row-y.row)*this._terminal.cols-y.column+m.column)}}_handleResize(l){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=d=a([f(1,p.IInstantiationService),f(2,S.ICoreBrowserService),f(3,S.IRenderService)],d)},3614:(h,s)=>{function r(_){return _.replace(/\r?\n/g,"\r")}function a(_,g){return g?"\x1B[200~"+_+"\x1B[201~":_}function f(_,g,S,p){_=a(_=r(_),S.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(_,!0),g.value=""}function o(_,g,S){let p=S.getBoundingClientRect(),c=_.clientX-p.left-10,d=_.clientY-p.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${c}px`,g.style.top=`${d}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=r,s.bracketTextForPaste=a,s.copyHandler=function(_,g){_.clipboardData&&_.clipboardData.setData("text/plain",g.selectionText),_.preventDefault()},s.handlePasteEvent=function(_,g,S,p){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),g,S,p)},s.paste=f,s.moveTextAreaUnderMouseCursor=o,s.rightClickHandler=function(_,g,S,p,c){o(_,g,S),c&&p.rightClickSelect(_),g.value=p.selectionText,g.select()}},7239:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let a=r(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(f,o,_){this._css.set(f,o,_)}getCss(f,o){return this._css.get(f,o)}setColor(f,o,_){this._color.set(f,o,_)}getColor(f,o){return this._color.get(f,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(r,a,f,o){r.addEventListener(a,f,o);let _=!1;return{dispose:()=>{_||(_=!0,r.removeEventListener(a,f,o))}}}},3551:function(h,s,r){var a=this&&this.__decorate||function(d,l,u,v){var C,w=arguments.length,y=w<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,v){l(u,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let o=r(3656),_=r(8460),g=r(844),S=r(2585),p=r(4725),c=s.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(d,l,u,v,C){super(),this._element=d,this._mouseService=l,this._renderService=u,this._bufferService=v,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(d){this._lastMouseEvent=d;let l=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;let u=d.composedPath();for(let v=0;v<u.length;v++){let C=u[v];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_handleHover(d){if(this._activeLine!==d.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(d,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,d)||(this._clearCurrentLink(),this._askForLink(d,!0))}_askForLink(d,l){this._activeProviderReplies&&l||(this._activeProviderReplies?.forEach((v=>{v?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[v,C]of this._linkProviderService.linkProviders.entries())l?this._activeProviderReplies?.get(v)&&(u=this._checkLinkProviderResult(v,d,u)):C.provideLinks(d.y,(w=>{if(this._isMouseOut)return;let y=w?.map((m=>({link:m})));this._activeProviderReplies?.set(v,y),u=this._checkLinkProviderResult(v,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,l){let u=new Set;for(let v=0;v<l.size;v++){let C=l.get(v);if(C)for(let w=0;w<C.length;w++){let y=C[w],m=y.link.range.start.y<d?0:y.link.range.start.x,x=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let T=m;T<=x;T++){if(u.has(T)){C.splice(w--,1);break}u.add(T)}}}}_checkLinkProviderResult(d,l,u){if(!this._activeProviderReplies)return u;let v=this._activeProviderReplies.get(d),C=!1;for(let w=0;w<d;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(C=!0);if(!C&&v){let w=v.find((y=>this._linkAtPosition(y.link,l)));w&&(u=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let w=0;w<this._activeProviderReplies.size;w++){let y=this._activeProviderReplies.get(w)?.find((m=>this._linkAtPosition(m.link,l)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let l=this._positionFromMouseEvent(d,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,l){this._currentLink&&this._lastMouseEvent&&(!d||!l||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(d.link,l)&&(this._currentLink=d,this._currentLink.state={decorations:{underline:d.link.decorations===void 0||d.link.decorations.underline,pointerCursor:d.link.decorations===void 0||d.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,d.link,this._lastMouseEvent),d.link.decorations={},Object.defineProperties(d.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:u=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:u=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(d.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((u=>{if(!this._currentLink)return;let v=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(v,C),this._lastMouseEvent)){let w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}}))))}_linkHover(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(u,l.text)}_fireUnderlineEvent(d,l){let u=d.range,v=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-v-1,u.end.x,u.end.y-v-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(u,l.text)}_linkAtPosition(d,l){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,v=d.range.end.y*this._bufferService.cols+d.range.end.x,C=l.y*this._bufferService.cols+l.x;return u<=C&&C<=v}_positionFromMouseEvent(d,l,u){let v=u.getCoords(d,l,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,l,u,v,C){return{x1:d,y1:l,x2:u,y2:v,cols:this._bufferService.cols,fg:C}}};s.Linkifier=c=a([f(1,p.IMouseService),f(2,p.IRenderService),f(3,S.IBufferService),f(4,p.ILinkProviderService)],c)},9042:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(h,s,r){var a=this&&this.__decorate||function(p,c,d,l){var u,v=arguments.length,C=v<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(c,d,C):u(c,d))||C);return v>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let o=r(511),_=r(2585),g=s.OscLinkProvider=class{constructor(p,c,d){this._bufferService=p,this._optionsService=c,this._oscLinkService=d}provideLinks(p,c){let d=this._bufferService.buffer.lines.get(p-1);if(!d)return void c(void 0);let l=[],u=this._optionsService.rawOptions.linkHandler,v=new o.CellData,C=d.getTrimmedLength(),w=-1,y=-1,m=!1;for(let x=0;x<C;x++)if(y!==-1||d.hasContent(x)){if(d.loadCell(x,v),v.hasExtendedAttrs()&&v.extended.urlId){if(y===-1){y=x,w=v.extended.urlId;continue}m=v.extended.urlId!==w}else y!==-1&&(m=!0);if(m||y!==-1&&x===C-1){let T=this._oscLinkService.getLinkData(w)?.uri;if(T){let I={start:{x:y+1,y:p},end:{x:x+(m||x!==C-1?0:1),y:p}},F=!1;if(!u?.allowNonHttpProtocols)try{let R=new URL(T);["http:","https:"].includes(R.protocol)||(F=!0)}catch{F=!0}F||l.push({text:T,range:I,activate:(R,z)=>u?u.activate(R,z,I):S(0,z),hover:(R,z)=>u?.hover?.(R,z,I),leave:(R,z)=>u?.leave?.(R,z,I)})}m=!1,v.hasExtendedAttrs()&&v.extended.urlId?(y=x,w=v.extended.urlId):(y=-1,w=-1)}}c(l)}};function S(p,c){if(confirm(`Do you want to navigate to ${c}?
|
|
1
|
+
"use strict";(()=>{var Ol=Object.create;var En=Object.defineProperty;var Il=Object.getOwnPropertyDescriptor;var Nl=Object.getOwnPropertyNames;var Hl=Object.getPrototypeOf,Fl=Object.prototype.hasOwnProperty;var Ln=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Wl=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Nl(t))!Fl.call(e,l)&&l!==i&&En(e,l,{get:()=>t[l],enumerable:!(n=Il(t,l))||n.enumerable});return e};var Mn=(e,t,i)=>(i=e!=null?Ol(Hl(e)):{},Wl(t||!e||!e.__esModule?En(i,"default",{value:e,enumerable:!0}):i,e));var Tn=Ln((tr,ss)=>{(function(e,t){if(typeof tr=="object"&&typeof ss=="object")ss.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var i=t();for(var n in i)(typeof tr=="object"?tr:e)[n]=i[n]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(l,r,s){var a=this&&this.__decorate||function(c,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(c,u,v,C);else for(var x=c.length-1;x>=0;x--)(w=c[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(c,u){return function(v,C){u(v,C,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let o=s(9042),_=s(9924),g=s(844),S=s(4725),p=s(2585),h=s(3656),d=r.AccessibilityManager=class extends g.Disposable{constructor(c,u,v,C){super(),this._terminal=c,this._coreBrowserService=v,this._renderService=C,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let w=0;w<this._terminal.rows;w++)this._rowElements[w]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[w]);if(this._topBoundaryFocusListener=w=>this._handleBoundaryFocus(w,0),this._bottomBoundaryFocusListener=w=>this._handleBoundaryFocus(w,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((w=>this._handleResize(w.rows)))),this.register(this._terminal.onRender((w=>this._refreshRows(w.start,w.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((w=>this._handleChar(w)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2
|
+
`)))),this.register(this._terminal.onA11yTab((w=>this._handleTab(w)))),this.register(this._terminal.onKey((w=>this._handleKey(w.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,h.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,g.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(c){for(let u=0;u<c;u++)this._handleChar(" ")}_handleChar(c){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==c&&(this._charsToAnnounce+=c):this._charsToAnnounce+=c,c===`
|
|
3
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(c){this._clearLiveRegion(),/\p{Control}/u.test(c)||this._charsToConsume.push(c)}_refreshRows(c,u){this._liveRegionDebouncer.refresh(c,u,this._terminal.rows)}_renderRows(c,u){let v=this._terminal.buffer,C=v.lines.length.toString();for(let w=c;w<=u;w++){let y=v.lines.get(v.ydisp+w),m=[],x=y?.translateToString(!0,void 0,void 0,m)||"",A=(v.ydisp+w+1).toString(),I=this._rowElements[w];I&&(x.length===0?(I.innerText="\xA0",this._rowColumns.set(I,[0,1])):(I.textContent=x,this._rowColumns.set(I,m)),I.setAttribute("aria-posinset",A),I.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(c,u){let v=c.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||c.relatedTarget!==C)return;let w,y;if(u===0?(w=v,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(w=this._rowElements.shift(),y=v,this._rowContainer.removeChild(w)),w.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),c.preventDefault(),c.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let c=document.getSelection();if(!c)return;if(c.isCollapsed)return void(this._rowContainer.contains(c.anchorNode)&&this._terminal.clearSelection());if(!c.anchorNode||!c.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:c.anchorNode,offset:c.anchorOffset},v={node:c.focusNode,offset:c.focusOffset};if((u.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===v.node&&u.offset>v.offset)&&([u,v]=[v,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;let C=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:C,offset:C.textContent?.length??0}),!this._rowContainer.contains(v.node))return;let w=({node:x,offset:A})=>{let I=x instanceof Text?x.parentNode:x,F=parseInt(I?.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;let R=this._rowColumns.get(I);if(!R)return console.warn("columns is null. Race condition?"),null;let $=A<R.length?R[A]:R.slice(-1)[0]+1;return $>=this._terminal.cols&&(++F,$=0),{row:F,column:$}},y=w(u),m=w(v);if(y&&m){if(y.row>m.row||y.row===m.row&&y.column>=m.column)throw new Error("invalid range");this._terminal.select(y.column,y.row,(m.row-y.row)*this._terminal.cols-y.column+m.column)}}_handleResize(c){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>c;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let c=this._coreBrowserService.mainDocument.createElement("div");return c.setAttribute("role","listitem"),c.tabIndex=-1,this._refreshRowDimensions(c),c}_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 c=0;c<this._terminal.rows;c++)this._refreshRowDimensions(this._rowElements[c])}}_refreshRowDimensions(c){c.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=d=a([f(1,p.IInstantiationService),f(2,S.ICoreBrowserService),f(3,S.IRenderService)],d)},3614:(l,r)=>{function s(_){return _.replace(/\r?\n/g,"\r")}function a(_,g){return g?"\x1B[200~"+_+"\x1B[201~":_}function f(_,g,S,p){_=a(_=s(_),S.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(_,!0),g.value=""}function o(_,g,S){let p=S.getBoundingClientRect(),h=_.clientX-p.left-10,d=_.clientY-p.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${h}px`,g.style.top=`${d}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=s,r.bracketTextForPaste=a,r.copyHandler=function(_,g){_.clipboardData&&_.clipboardData.setData("text/plain",g.selectionText),_.preventDefault()},r.handlePasteEvent=function(_,g,S,p){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),g,S,p)},r.paste=f,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(_,g,S,p,h){o(_,g,S),h&&p.rightClickSelect(_),g.value=p.selectionText,g.select()}},7239:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let a=s(1505);r.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(f,o,_){this._css.set(f,o,_)}getCss(f,o){return this._css.get(f,o)}setColor(f,o,_){this._color.set(f,o,_)}getColor(f,o){return this._color.get(f,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(s,a,f,o){s.addEventListener(a,f,o);let _=!1;return{dispose:()=>{_||(_=!0,s.removeEventListener(a,f,o))}}}},3551:function(l,r,s){var a=this&&this.__decorate||function(d,c,u,v){var C,w=arguments.length,y=w<3?c:v===null?v=Object.getOwnPropertyDescriptor(c,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,c,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(c,u,y):C(c,u))||y);return w>3&&y&&Object.defineProperty(c,u,y),y},f=this&&this.__param||function(d,c){return function(u,v){c(u,v,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let o=s(3656),_=s(8460),g=s(844),S=s(2585),p=s(4725),h=r.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(d,c,u,v,C){super(),this._element=d,this._mouseService=c,this._renderService=u,this._bufferService=v,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(d){this._lastMouseEvent=d;let c=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!c)return;this._isMouseOut=!1;let u=d.composedPath();for(let v=0;v<u.length;v++){let C=u[v];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&c.x===this._lastBufferCell.x&&c.y===this._lastBufferCell.y||(this._handleHover(c),this._lastBufferCell=c)}_handleHover(d){if(this._activeLine!==d.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(d,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,d)||(this._clearCurrentLink(),this._askForLink(d,!0))}_askForLink(d,c){this._activeProviderReplies&&c||(this._activeProviderReplies?.forEach((v=>{v?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[v,C]of this._linkProviderService.linkProviders.entries())c?this._activeProviderReplies?.get(v)&&(u=this._checkLinkProviderResult(v,d,u)):C.provideLinks(d.y,(w=>{if(this._isMouseOut)return;let y=w?.map((m=>({link:m})));this._activeProviderReplies?.set(v,y),u=this._checkLinkProviderResult(v,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,c){let u=new Set;for(let v=0;v<c.size;v++){let C=c.get(v);if(C)for(let w=0;w<C.length;w++){let y=C[w],m=y.link.range.start.y<d?0:y.link.range.start.x,x=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let A=m;A<=x;A++){if(u.has(A)){C.splice(w--,1);break}u.add(A)}}}}_checkLinkProviderResult(d,c,u){if(!this._activeProviderReplies)return u;let v=this._activeProviderReplies.get(d),C=!1;for(let w=0;w<d;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(C=!0);if(!C&&v){let w=v.find((y=>this._linkAtPosition(y.link,c)));w&&(u=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let w=0;w<this._activeProviderReplies.size;w++){let y=this._activeProviderReplies.get(w)?.find((m=>this._linkAtPosition(m.link,c)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let c=this._positionFromMouseEvent(d,this._element,this._mouseService);c&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,c)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,c){this._currentLink&&this._lastMouseEvent&&(!d||!c||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=c)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._linkAtPosition(d.link,c)&&(this._currentLink=d,this._currentLink.state={decorations:{underline:d.link.decorations===void 0||d.link.decorations.underline,pointerCursor:d.link.decorations===void 0||d.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,d.link,this._lastMouseEvent),d.link.decorations={},Object.defineProperties(d.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:u=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:u=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(d.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((u=>{if(!this._currentLink)return;let v=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(v,C),this._lastMouseEvent)){let w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}}))))}_linkHover(d,c,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(c,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),c.hover&&c.hover(u,c.text)}_fireUnderlineEvent(d,c){let u=d.range,v=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-v-1,u.end.x,u.end.y-v-1,void 0);(c?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(d,c,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(c,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),c.leave&&c.leave(u,c.text)}_linkAtPosition(d,c){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,v=d.range.end.y*this._bufferService.cols+d.range.end.x,C=c.y*this._bufferService.cols+c.x;return u<=C&&C<=v}_positionFromMouseEvent(d,c,u){let v=u.getCoords(d,c,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,c,u,v,C){return{x1:d,y1:c,x2:u,y2:v,cols:this._bufferService.cols,fg:C}}};r.Linkifier=h=a([f(1,p.IMouseService),f(2,p.IRenderService),f(3,S.IBufferService),f(4,p.ILinkProviderService)],h)},9042:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(l,r,s){var a=this&&this.__decorate||function(p,h,d,c){var u,v=arguments.length,C=v<3?h:c===null?c=Object.getOwnPropertyDescriptor(h,d):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,h,d,c);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(h,d,C):u(h,d))||C);return v>3&&C&&Object.defineProperty(h,d,C),C},f=this&&this.__param||function(p,h){return function(d,c){h(d,c,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let o=s(511),_=s(2585),g=r.OscLinkProvider=class{constructor(p,h,d){this._bufferService=p,this._optionsService=h,this._oscLinkService=d}provideLinks(p,h){let d=this._bufferService.buffer.lines.get(p-1);if(!d)return void h(void 0);let c=[],u=this._optionsService.rawOptions.linkHandler,v=new o.CellData,C=d.getTrimmedLength(),w=-1,y=-1,m=!1;for(let x=0;x<C;x++)if(y!==-1||d.hasContent(x)){if(d.loadCell(x,v),v.hasExtendedAttrs()&&v.extended.urlId){if(y===-1){y=x,w=v.extended.urlId;continue}m=v.extended.urlId!==w}else y!==-1&&(m=!0);if(m||y!==-1&&x===C-1){let A=this._oscLinkService.getLinkData(w)?.uri;if(A){let I={start:{x:y+1,y:p},end:{x:x+(m||x!==C-1?0:1),y:p}},F=!1;if(!u?.allowNonHttpProtocols)try{let R=new URL(A);["http:","https:"].includes(R.protocol)||(F=!0)}catch{F=!0}F||c.push({text:A,range:I,activate:(R,$)=>u?u.activate(R,$,I):S(0,$),hover:(R,$)=>u?.hover?.(R,$,I),leave:(R,$)=>u?.leave?.(R,$,I)})}m=!1,v.hasExtendedAttrs()&&v.extended.urlId?(y=x,w=v.extended.urlId):(y=-1,w=-1)}}h(c)}};function S(p,h){if(confirm(`Do you want to navigate to ${h}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){let d=window.open();if(d){try{d.opener=null}catch{}d.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=g=a([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],g)},6193:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(r,a){this._renderCallback=r,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(r){return this._refreshCallbacks.push(r),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(r,a,f){this._rowCount=f,r=r!==void 0?r:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 r=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let r of this._refreshCallbacks)r(0);this._refreshCallbacks=[]}}},3236:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let a=r(3614),f=r(3656),o=r(3551),_=r(9042),g=r(3730),S=r(1680),p=r(3107),c=r(5744),d=r(2950),l=r(1296),u=r(428),v=r(4269),C=r(5114),w=r(8934),y=r(3230),m=r(9312),x=r(4725),T=r(6731),I=r(8055),F=r(8969),R=r(8460),z=r(844),B=r(6114),D=r(8437),O=r(2584),P=r(7399),b=r(5941),E=r(9074),L=r(2585),M=r(5435),$=r(4567),K=r(779);class Y 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(A={}){super(A),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new R.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new R.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new R.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new R.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new R.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new R.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new R.EventEmitter),this._onBlur=this.register(new R.EventEmitter),this._onA11yCharEmitter=this.register(new R.EventEmitter),this._onA11yTabEmitter=this.register(new R.EventEmitter),this._onWillOpen=this.register(new R.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(x.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,N)=>this.refresh(k,N)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((k=>this._reportWindowsOptions(k)))),this.register(this._inputHandler.onColor((k=>this._handleColorEvent(k)))),this.register((0,R.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,R.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((k=>this._afterResize(k.cols,k.rows)))),this.register((0,z.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(A){if(this._themeService)for(let k of A){let N,H="";switch(k.index){case 256:N="foreground",H="10";break;case 257:N="background",H="11";break;case 258:N="cursor",H="12";break;default:N="ansi",H="4;"+k.index}switch(k.type){case 0:let q=I.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${O.C0.ESC}]${H};${(0,b.toRgbString)(q)}${O.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((j=>j.ansi[k.index]=I.channels.toColor(...k.color)));else{let j=N;this._themeService.modifyColors((Q=>Q[j]=I.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(A){A?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(A){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let A=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(A);if(!k)return;let N=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,q=k.getWidth(N),j=this._renderService.dimensions.css.cell.width*q,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,ee=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ee+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=j+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let A=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",A)),this.register((0,f.addDisposableDomListener)(this.element,"paste",A)),B.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(A=>this._keyUp(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(A=>this._keyDown(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(A=>this._keyPress(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(A=>this._compositionHelper.compositionupdate(A)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(A=>this._inputEvent(A)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(A){if(!A)throw new Error("Terminal requires a parent element.");if(A.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=A.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"),A.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,f.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),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(C.CoreBrowserService,this.textarea,A.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(x.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(x.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(x.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(x.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.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(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let A=this,k=this.element;function N(j){let Q=A._mouseService.getMouseReportCoords(j,A.screenElement);if(!Q)return!1;let ee,G;switch(j.overrideType||j.type){case"mousemove":G=32,j.buttons===void 0?(ee=3,j.button!==void 0&&(ee=j.button<3?j.button:3)):ee=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":G=0,ee=j.button<3?j.button:3;break;case"mousedown":G=1,ee=j.button<3?j.button:3;break;case"wheel":if(A._customWheelEventHandler&&A._customWheelEventHandler(j)===!1||A.viewport.getLinesScrolled(j)===0)return!1;G=j.deltaY<0?0:1,ee=4;break;default:return!1}return!(G===void 0||ee===void 0||ee>4)&&A.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:ee,action:G,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},q={mouseup:j=>(N(j),j.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(j)),wheel:j=>(N(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&N(j)},mousemove:j=>{j.buttons||N(j)}};this.register(this.coreMouseService.onProtocolChange((j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&j?H.mousemove||(k.addEventListener("mousemove",q.mousemove),H.mousemove=q.mousemove):(k.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&j?H.wheel||(k.addEventListener("wheel",q.wheel,{passive:!1}),H.wheel=q.wheel):(k.removeEventListener("wheel",H.wheel),H.wheel=null),2&j?H.mouseup||(H.mouseup=q.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&j?H.mousedrag||(H.mousedrag=q.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(k,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return N(j),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(j)}))),this.register((0,f.addDisposableDomListener)(k,"wheel",(j=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let Q=this.viewport.getLinesScrolled(j);if(Q===0)return;let ee=O.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),G="";for(let J=0;J<Math.abs(Q);J++)G+=ee;return this.coreService.triggerDataEvent(G,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(k,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(k,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(A,k){this._renderService?.refreshRows(A,k)}updateCursorStyle(A){this._selectionService?.shouldColumnSelect(A)?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(A,k,N=0){N===1?(super.scrollLines(A,k,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(A)}paste(A){(0,a.paste)(A,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(A){this._customKeyEventHandler=A}attachCustomWheelEventHandler(A){this._customWheelEventHandler=A}registerLinkProvider(A){return this._linkProviderService.registerLinkProvider(A)}registerCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(A);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(A)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(A){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+A)}registerDecoration(A){return this._decorationService.registerDecoration(A)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(A,k,N){this._selectionService.setSelection(A,k,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(A,k){this._selectionService?.selectLines(A,k)}_keyDown(A){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&A.altKey;if(!k&&!this._compositionHelper.keydown(A))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||A.key!=="Dead"&&A.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,P.evaluateKeyboardEvent)(A,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(A),N.type===3||N.type===2){let H=this.rows-1;return this.scrollLines(N.type===2?-H:H),this.cancel(A,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,A)||(N.cancel&&this.cancel(A,!0),!N.key||!!(A.key&&!A.ctrlKey&&!A.altKey&&!A.metaKey&&A.key.length===1&&A.key.charCodeAt(0)>=65&&A.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==O.C0.ETX&&N.key!==O.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||A.altKey||A.ctrlKey?this.cancel(A,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(A,k){let N=A.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||A.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||A.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?N:N&&(!k.keyCode||k.keyCode>47)}_keyUp(A){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(A)||this.focus(),this.updateCursorStyle(A),this._keyPressHandled=!1)}_keyPress(A){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;if(this.cancel(A),A.charCode)k=A.charCode;else if(A.which===null||A.which===void 0)k=A.keyCode;else{if(A.which===0||A.charCode===0)return!1;k=A.which}return!(!k||(A.altKey||A.ctrlKey||A.metaKey)&&!this._isThirdLevelShift(this.browser,A)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(A){if(A.data&&A.inputType==="insertText"&&(!A.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=A.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(A),!0}return!1}resize(A,k){A!==this.cols||k!==this.rows?super.resize(A,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(A,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 A=1;A<this.rows;A++)this.buffer.lines.push(this.buffer.getBlankLine(D.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 A=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=A,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(O.C0.ESC+"[I"):this.coreService.triggerDataEvent(O.C0.ESC+"[O")}_reportWindowsOptions(A){if(this._renderService)switch(A){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[4;${N};${k}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let H=this._renderService.dimensions.css.cell.width.toFixed(0),q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[6;${q};${H}t`)}}cancel(A,k){if(this.options.cancelEvents||k)return A.preventDefault(),A.stopPropagation(),!1}}s.Terminal=Y},9924:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(r,a=1e3){this._renderCallback=r,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(r,a,f){this._rowCount=f,r=r!==void 0?r:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=o-this._lastRefreshMs,g=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let r=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,a)}}},1680:function(h,s,r){var a=this&&this.__decorate||function(d,l,u,v){var C,w=arguments.length,y=w<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,v){l(u,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let o=r(3656),_=r(4725),g=r(8460),S=r(844),p=r(2585),c=s.Viewport=class extends S.Disposable{constructor(d,l,u,v,C,w,y,m){super(),this._viewportElement=d,this._scrollArea=l,this._bufferService=u,this._optionsService=v,this._charSizeService=C,this._renderService=w,this._coreBrowserService=y,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((x=>this._activeBuffer=x.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((x=>this._renderDimensions=x))),this._handleThemeChange(m.colors),this.register(m.onChangeColors((x=>this._handleThemeChange(x)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(d){this._viewportElement.style.backgroundColor=d.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(d){if(d)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(d,l){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let l=this._getPixelsScrolled(d);return l!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let l=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(d,l){let u,v="",C=[],w=l??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<w;m++){let x=y.get(m);if(!x)continue;let T=y.get(m+1)?.isWrapped;if(v+=x.translateToString(!T),!T||m===y.length-1){let I=document.createElement("div");I.textContent=v,C.push(I),v.length>0&&(u=I),v=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(d,l){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&l.altKey||u==="ctrl"&&l.ctrlKey||u==="shift"&&l.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){let l=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}};s.Viewport=c=a([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],c)},3107:function(h,s,r){var a=this&&this.__decorate||function(p,c,d,l){var u,v=arguments.length,C=v<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(c,d,C):u(c,d))||C);return v>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let o=r(4725),_=r(844),g=r(2585),S=s.BufferDecorationRenderer=class extends _.Disposable{constructor(p,c,d,l,u){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=d,this._decorationService=l,this._renderService=u,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((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 d=p.options.x??0;return d&&d>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(p,c),c}_refreshStyle(p){let c=p.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let d=this._decorationElements.get(p);d||(d=this._createElement(p),p.element=d,this._decorationElements.set(p,d),this._container.appendChild(d),p.onDispose((()=>{this._decorationElements.delete(p),d.remove()}))),d.style.top=c*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(d)}}_refreshXPosition(p,c=p.element){if(!c)return;let d=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};s.BufferDecorationRenderer=S=a([f(1,g.IBufferService),f(2,o.ICoreBrowserService),f(3,g.IDecorationService),f(4,o.IRenderService)],S)},5871:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(r){if(r.options.overviewRulerOptions){for(let a of this._zones)if(a.color===r.options.overviewRulerOptions.color&&a.position===r.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,r.marker.line))return;if(this._lineAdjacentToZone(a,r.marker.line,r.options.overviewRulerOptions.position))return void this._addLineToZone(a,r.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=r.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=r.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=r.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=r.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:r.options.overviewRulerOptions.color,position:r.options.overviewRulerOptions.position,startBufferLine:r.marker.line,endBufferLine:r.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(r){this._linePadding=r}_lineIntersectsZone(r,a){return a>=r.startBufferLine&&a<=r.endBufferLine}_lineAdjacentToZone(r,a,f){return a>=r.startBufferLine-this._linePadding[f||"full"]&&a<=r.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(r,a){r.startBufferLine=Math.min(r.startBufferLine,a),r.endBufferLine=Math.max(r.endBufferLine,a)}}},5744:function(h,s,r){var a=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let o=r(5871),_=r(4725),g=r(844),S=r(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},l=s.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,v,C,w,y,m,x){super(),this._viewportElement=u,this._screenElement=v,this._bufferService=C,this._decorationService=w,this._renderService=y,this._optionsService=m,this._coreBrowserService=x,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,g.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let u=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=u,c.center=v,c.right=u,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=c.left,d.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let u=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=v,p.center=v,p.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;let u=this._colorZoneStore.zones;for(let v of u)v.position!=="full"&&this._renderColorZone(v);for(let v of u)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(d[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-p[u.position||"full"]/2),c[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,v){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=l=a([f(2,S.IBufferService),f(3,S.IDecorationService),f(4,_.IRenderService),f(5,S.IOptionsService),f(6,_.ICoreBrowserService)],l)},2950:function(h,s,r){var a=this&&this.__decorate||function(p,c,d,l){var u,v=arguments.length,C=v<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(c,d,C):u(c,d))||C);return v>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let o=r(4725),_=r(2585),g=r(2584),S=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,d,l,u,v){this._textarea=p,this._compositionView=c,this._bufferService=d,this._optionsService=l,this._coreService=u,this._renderService=v,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;let c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,d=c.replace(p,"");this._dataAlreadySent=d,c.length>p.length?this._coreService.triggerDataEvent(d,!0):c.length<p.length?this._coreService.triggerDataEvent(`${g.C0.DEL}`,!0):c.length===p.length&&c!==p&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let v=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=l+"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=S=a([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,o.IRenderService)],S)},9806:(h,s)=>{function r(a,f,o){let _=o.getBoundingClientRect(),g=a.getComputedStyle(o),S=parseInt(g.getPropertyValue("padding-left")),p=parseInt(g.getPropertyValue("padding-top"));return[f.clientX-_.left-S,f.clientY-_.top-p]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=r,s.getCoords=function(a,f,o,_,g,S,p,c,d){if(!S)return;let l=r(a,f,o);return l?(l[0]=Math.ceil((l[0]+(d?p/2:0))/p),l[1]=Math.ceil(l[1]/c),l[0]=Math.min(Math.max(l[0],1),_+(d?1:0)),l[1]=Math.min(Math.max(l[1],1),g),l):void 0}},9504:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let a=r(2584);function f(c,d,l,u){let v=c-o(c,l),C=d-o(d,l),w=Math.abs(v-C)-(function(y,m,x){let T=0,I=y-o(y,x),F=m-o(m,x);for(let R=0;R<Math.abs(I-F);R++){let z=_(y,m)==="A"?-1:1;x.buffer.lines.get(I+z*R)?.isWrapped&&T++}return T})(c,d,l);return p(w,S(_(c,d),u))}function o(c,d){let l=0,u=d.buffer.lines.get(c),v=u?.isWrapped;for(;v&&c>=0&&c<d.rows;)l++,u=d.buffer.lines.get(--c),v=u?.isWrapped;return l}function _(c,d){return c>d?"A":"B"}function g(c,d,l,u,v,C){let w=c,y=d,m="";for(;w!==l||y!==u;)w+=v?1:-1,v&&w>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,c,w),w=0,c=0,y++):!v&&w<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,c+1),w=C.cols-1,c=w,y--);return m+C.buffer.translateBufferLineToString(y,!1,c,w)}function S(c,d){let l=d?"O":"[";return a.C0.ESC+l+c}function p(c,d){c=Math.floor(c);let l="";for(let u=0;u<c;u++)l+=d;return l}s.moveToCellSequence=function(c,d,l,u){let v=l.buffer.x,C=l.buffer.y;if(!l.buffer.hasScrollback)return(function(m,x,T,I,F,R){return f(x,I,F,R).length===0?"":p(g(m,x,m,x-o(x,F),!1,F).length,S("D",R))})(v,C,0,d,l,u)+f(C,d,l,u)+(function(m,x,T,I,F,R){let z;z=f(x,I,F,R).length>0?I-o(I,F):x;let B=I,D=(function(O,P,b,E,L,M){let $;return $=f(b,E,L,M).length>0?E-o(E,L):P,O<b&&$<=E||O>=b&&$<E?"C":"D"})(m,x,T,I,F,R);return p(g(m,z,T,B,D==="C",F).length,S(D,R))})(v,C,c,d,l,u);let w;if(C===d)return w=v>c?"D":"C",p(Math.abs(v-c),S(w,u));w=C>d?"D":"C";let y=Math.abs(C-d);return p((function(m,x){return x.cols-m})(C>d?c:v,l)+(y-1)*l.cols+1+((C>d?v:c)-1),S(w,u))}},1296:function(h,s,r){var a=this&&this.__decorate||function(R,z,B,D){var O,P=arguments.length,b=P<3?z:D===null?D=Object.getOwnPropertyDescriptor(z,B):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(R,z,B,D);else for(var E=R.length-1;E>=0;E--)(O=R[E])&&(b=(P<3?O(b):P>3?O(z,B,b):O(z,B))||b);return P>3&&b&&Object.defineProperty(z,B,b),b},f=this&&this.__param||function(R,z){return function(B,D){z(B,D,R)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let o=r(3787),_=r(2550),g=r(2223),S=r(6171),p=r(6052),c=r(4725),d=r(8055),l=r(8460),u=r(844),v=r(2585),C="xterm-dom-renderer-owner-",w="xterm-rows",y="xterm-fg-",m="xterm-bg-",x="xterm-focus",T="xterm-selection",I=1,F=s.DomRenderer=class extends u.Disposable{constructor(R,z,B,D,O,P,b,E,L,M,$,K,Y){super(),this._terminal=R,this._document=z,this._element=B,this._screenElement=D,this._viewportElement=O,this._helperContainer=P,this._linkifier2=b,this._charSizeService=L,this._optionsService=M,this._bufferService=$,this._coreBrowserService=K,this._themeService=Y,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(w),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((U=>this._injectCss(U)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((U=>this._handleLinkHover(U)))),this.register(this._linkifier2.onHideLinkUnderline((U=>this._handleLinkLeave(U)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let R=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*R,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*R),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/R),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/R),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let 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 z=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(R){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${w} { color: ${R.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${w} .xterm-dim { color: ${d.color.multiplyOpacity(R.foreground,.5).css};}`,z+=`${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}`,D=`blink_bar_${this._terminalClass}`,O=`blink_block_${this._terminalClass}`;z+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${D} { 50% { box-shadow: none; }}`,z+=`@keyframes ${O} { 0% { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css}; } 50% { background-color: inherit; color: ${R.cursor.css}; }}`,z+=`${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${D} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${R.cursor.css} !important; color: ${R.cursorAccent.css} !important;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${R.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${R.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${R.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${R.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${R.selectionInactiveBackgroundOpaque.css};}`;for(let[P,b]of R.ansi.entries())z+=`${this._terminalSelector} .${y}${P} { color: ${b.css}; }${this._terminalSelector} .${y}${P}.xterm-dim { color: ${d.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${m}${P} { background-color: ${b.css}; }`;z+=`${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(R.background).css}; }${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(R.background),.5).css}; }${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR} { background-color: ${R.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){let R=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${R}px`,this._rowFactory.defaultSpacing=R}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(R,z){for(let B=this._rowElements.length;B<=z;B++){let D=this._document.createElement("div");this._rowContainer.appendChild(D),this._rowElements.push(D)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(R,z){this._refreshRowElements(R,z),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(x),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(x),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(R,z,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(R,z,B),this.renderRows(0,this._bufferService.rows-1),!R||!z)return;this._selectionRenderModel.update(this._terminal,R,z,B);let D=this._selectionRenderModel.viewportStartRow,O=this._selectionRenderModel.viewportEndRow,P=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(P>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(B){let L=R[0]>z[0];E.appendChild(this._createSelectionElement(P,L?z[0]:R[0],L?R[0]:z[0],b-P+1))}else{let L=D===P?R[0]:0,M=P===O?z[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(P,L,M));let $=b-P-1;if(E.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,$)),P!==b){let K=O===b?z[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(R,z,B,D=1){let O=this._document.createElement("div"),P=z*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(B-z);return P+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-P),O.style.height=D*this.dimensions.css.cell.height+"px",O.style.top=R*this.dimensions.css.cell.height+"px",O.style.left=`${P}px`,O.style.width=`${b}px`,O}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let R of this._rowElements)R.replaceChildren()}renderRows(R,z){let B=this._bufferService.buffer,D=B.ybase+B.y,O=Math.min(B.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=R;L<=z;L++){let M=L+B.ydisp,$=this._rowElements[L],K=B.lines.get(M);if(!$||!K)break;$.replaceChildren(...this._rowFactory.createRow(K,M,M===D,b,E,O,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!0)}_handleLinkLeave(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!1)}_setCellUnderline(R,z,B,D,O,P){B<0&&(R=0),D<0&&(z=0);let b=this._bufferService.rows-1;B=Math.max(Math.min(B,b),0),D=Math.max(Math.min(D,b),0),O=Math.min(O,this._bufferService.cols);let E=this._bufferService.buffer,L=E.ybase+E.y,M=Math.min(E.x,O-1),$=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let U=B;U<=D;++U){let A=U+E.ydisp,k=this._rowElements[U],N=E.lines.get(A);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,A,A===L,K,Y,M,$,this.dimensions.css.cell.width,this._widthCache,P?U===B?R:0:-1,P?(U===D?z:O)-1:-1))}}};s.DomRenderer=F=a([f(7,v.IInstantiationService),f(8,c.ICharSizeService),f(9,v.IOptionsService),f(10,v.IBufferService),f(11,c.ICoreBrowserService),f(12,c.IThemeService)],F)},3787:function(h,s,r){var a=this&&this.__decorate||function(w,y,m,x){var T,I=arguments.length,F=I<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(w,y,m,x);else for(var R=w.length-1;R>=0;R--)(T=w[R])&&(F=(I<3?T(F):I>3?T(y,m,F):T(y,m))||F);return I>3&&F&&Object.defineProperty(y,m,F),F},f=this&&this.__param||function(w,y){return function(m,x){y(m,x,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let o=r(2223),_=r(643),g=r(511),S=r(2585),p=r(8055),c=r(4725),d=r(4269),l=r(6171),u=r(3734),v=s.DomRendererRowFactory=class{constructor(w,y,m,x,T,I,F){this._document=w,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=x,this._coreService=T,this._decorationService=I,this._themeService=F,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,y,m){this._selectionStart=w,this._selectionEnd=y,this._columnSelectMode=m}createRow(w,y,m,x,T,I,F,R,z,B,D){let O=[],P=this._characterJoinerService.getJoinedCharacters(y),b=this._themeService.colors,E,L=w.getNoBgTrimmedLength();m&&L<I+1&&(L=I+1);let M=0,$="",K=0,Y=0,U=0,A=!1,k=0,N=!1,H=0,q=[],j=B!==-1&&D!==-1;for(let Q=0;Q<L;Q++){w.loadCell(Q,this._workCell);let ee=this._workCell.getWidth();if(ee===0)continue;let G=!1,J=Q,Z=this._workCell;if(P.length>0&&Q===P[0][0]){G=!0;let le=P.shift();Z=new d.JoinedCellData(this._workCell,w.translateToString(!0,le[0],le[1]),le[1]-le[0]),J=le[1]-1,ee=Z.getWidth()}let oe=this._isCellInSelection(Q,y),ae=m&&Q===I,be=j&&Q>=B&&Q<=D,Se=!1;this._decorationService.forEachDecorationAtCell(Q,y,void 0,(le=>{Se=!0}));let fe=Z.getChars()||_.WHITESPACE_CELL_CHAR;if(fe===" "&&(Z.isUnderline()||Z.isOverline())&&(fe="\xA0"),H=ee*R-z.get(fe,Z.isBold(),Z.isItalic()),E){if(M&&(oe&&N||!oe&&!N&&Z.bg===K)&&(oe&&N&&b.selectionForeground||Z.fg===Y)&&Z.extended.ext===U&&be===A&&H===k&&!ae&&!G&&!Se){Z.isInvisible()?$+=_.WHITESPACE_CELL_CHAR:$+=fe,M++;continue}M&&(E.textContent=$),E=this._document.createElement("span"),M=0,$=""}else E=this._document.createElement("span");if(K=Z.bg,Y=Z.fg,U=Z.extended.ext,A=be,k=H,N=oe,G&&I>=Q&&I<=J&&(I=Q),!this._coreService.isCursorHidden&&ae&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&q.push("xterm-cursor-blink"),q.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline")}}if(Z.isBold()&&q.push("xterm-bold"),Z.isItalic()&&q.push("xterm-italic"),Z.isDim()&&q.push("xterm-dim"),$=Z.isInvisible()?_.WHITESPACE_CELL_CHAR:Z.getChars()||_.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(q.push(`xterm-underline-${Z.extended.underlineStyle}`),$===" "&&($="\xA0"),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let le=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&le<8&&(le+=8),E.style.textDecorationColor=b.ansi[le].css}Z.isOverline()&&(q.push("xterm-overline"),$===" "&&($="\xA0")),Z.isStrikethrough()&&q.push("xterm-strikethrough"),be&&(E.style.textDecoration="underline");let W=Z.getFgColor(),V=Z.getFgColorMode(),X=Z.getBgColor(),te=Z.getBgColorMode(),ne=!!Z.isInverse();if(ne){let le=W;W=X,X=le;let Qa=V;V=te,te=Qa}let ce,ve,ie,me=!1;switch(this._decorationService.forEachDecorationAtCell(Q,y,void 0,(le=>{le.options.layer!=="top"&&me||(le.backgroundColorRGB&&(te=50331648,X=le.backgroundColorRGB.rgba>>8&16777215,ce=le.backgroundColorRGB),le.foregroundColorRGB&&(V=50331648,W=le.foregroundColorRGB.rgba>>8&16777215,ve=le.foregroundColorRGB),me=le.options.layer==="top")})),!me&&oe&&(ce=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,X=ce.rgba>>8&16777215,te=50331648,me=!0,b.selectionForeground&&(V=50331648,W=b.selectionForeground.rgba>>8&16777215,ve=b.selectionForeground)),me&&q.push("xterm-decoration-top"),te){case 16777216:case 33554432:ie=b.ansi[X],q.push(`xterm-bg-${X}`);break;case 50331648:ie=p.channels.toColor(X>>16,X>>8&255,255&X),this._addStyle(E,`background-color:#${C((X>>>0).toString(16),"0",6)}`);break;default:ne?(ie=b.foreground,q.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):ie=b.background}switch(ce||Z.isDim()&&(ce=p.color.multiplyOpacity(ie,.5)),V){case 16777216:case 33554432:Z.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(E,ie,b.ansi[W],Z,ce,void 0)||q.push(`xterm-fg-${W}`);break;case 50331648:let le=p.channels.toColor(W>>16&255,W>>8&255,255&W);this._applyMinimumContrast(E,ie,le,Z,ce,ve)||this._addStyle(E,`color:#${C(W.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ie,b.foreground,Z,ce,ve)||ne&&q.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}q.length&&(E.className=q.join(" "),q.length=0),ae||G||Se?E.textContent=$:M++,H!==this.defaultSpacing&&(E.style.letterSpacing=`${H}px`),O.push(E),Q=J}return E&&M&&(E.textContent=$),O}_applyMinimumContrast(w,y,m,x,T,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(x.getCode()))return!1;let F=this._getContrastCache(x),R;if(T||I||(R=F.getColor(y.rgba,m.rgba)),R===void 0){let z=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);R=p.color.ensureContrastRatio(T||y,I||m,z),F.setColor((T||y).rgba,(I||m).rgba,R??null)}return!!R&&(this._addStyle(w,`color:${R.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,y){w.setAttribute("style",`${w.getAttribute("style")||""}${y};`)}_isCellInSelection(w,y){let m=this._selectionStart,x=this._selectionEnd;return!(!m||!x)&&(this._columnSelectMode?m[0]<=x[0]?w>=m[0]&&y>=m[1]&&w<x[0]&&y<=x[1]:w<m[0]&&y>=m[1]&&w>=x[0]&&y<=x[1]:y>m[1]&&y<x[1]||m[1]===x[1]&&y===m[1]&&w>=m[0]&&w<x[0]||m[1]<x[1]&&y===x[1]&&w<x[0]||m[1]<x[1]&&y===m[1]&&w>=m[0])}};function C(w,y,m){for(;w.length<m;)w=y+w;return w}s.DomRendererRowFactory=v=a([f(1,c.ICharacterJoinerService),f(2,S.IOptionsService),f(3,c.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,c.IThemeService)],v)},2550:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(r,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=r.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let f=r.createElement("span");f.classList.add("xterm-char-measure-element");let o=r.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let _=r.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let g=r.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold",g.style.fontStyle="italic",this._measureElements=[f,o,_,g],this._container.appendChild(f),this._container.appendChild(o),this._container.appendChild(_),this._container.appendChild(g),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(r,a,f,o){r===this._font&&a===this._fontSize&&f===this._weight&&o===this._weightBold||(this._font=r,this._fontSize=a,this._weight=f,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(r,a,f){let o=0;if(!a&&!f&&r.length===1&&(o=r.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let S=this._measure(r,0);return S>0&&(this._flat[o]=S),S}let _=r;a&&(_+="B"),f&&(_+="I");let g=this._holey.get(_);if(g===void 0){let S=0;a&&(S|=1),f&&(S|=2),g=this._measure(r,S),g>0&&this._holey.set(_,g)}return g}_measure(r,a){let f=this._measureElements[a];return f.textContent=r.repeat(32),f.offsetWidth/32}}},2223:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let a=r(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(h,s)=>{function r(f){return 57508<=f&&f<=57558}function a(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},s.isPowerlineGlyph=r,s.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},s.isEmoji=a,s.allowRescaling=function(f,o,_,g){return o===1&&_>Math.ceil(1.5*g)&&f!==void 0&&f>255&&!a(f)&&!r(f)&&!(function(S){return 57344<=S&&S<=63743})(f)},s.treatGlyphAsBackgroundColor=function(f){return r(f)||(function(o){return 9472<=o&&o<=9631})(f)},s.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},s.computeNextVariantOffset=function(f,o,_=0){return(f-(2*Math.round(o)-_))%(2*Math.round(o))}},6052:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class r{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,o,_,g=!1){if(this.selectionStart=o,this.selectionEnd=_,!o||!_||o[0]===_[0]&&o[1]===_[1])return void this.clear();let S=f.buffers.active.ydisp,p=o[1]-S,c=_[1]-S,d=Math.max(p,0),l=Math.min(c,f.rows-1);d>=f.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=l,this.startCol=o[0],this.endCol=_[0])}isCellSelected(f,o,_){return!!this.hasSelection&&(_-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&_>=this.viewportCappedStartRow&&o<this.endCol&&_<=this.viewportCappedEndRow:o<this.startCol&&_>=this.viewportCappedStartRow&&o>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol)}}s.createSelectionRenderModel=function(){return new r}},456:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(r){this._bufferService=r,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?r%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)-1]:[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[r,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[Math.max(r,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let r=this.selectionStart,a=this.selectionEnd;return!(!r||!a)&&(r[1]>a[1]||r[1]===a[1]&&r[0]>a[0])}handleTrim(r){return this.selectionStart&&(this.selectionStart[1]-=r),this.selectionEnd&&(this.selectionEnd[1]-=r),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,s,r){var a=this&&this.__decorate||function(l,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,v,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(l,u){return function(v,C){u(v,C,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let o=r(2585),_=r(8460),g=r(844),S=s.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,u,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new c(l,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};s.CharSizeService=S=a([f(2,o.IOptionsService)],S);class p extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,v){u!==void 0&&u>0&&v!==void 0&&v>0&&(this._result.width=u,this._result.height=v)}}class c extends p{constructor(u,v,C){super(),this._document=u,this._parentElement=v,this._optionsService=C,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let v=this._ctx.measureText("W");if(!("width"in v&&"fontBoundingBoxAscent"in v&&"fontBoundingBoxDescent"in v))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(h,s,r){var a=this&&this.__decorate||function(d,l,u,v){var C,w=arguments.length,y=w<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,v){l(u,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let o=r(3734),_=r(643),g=r(511),S=r(2585);class p extends o.AttributeData{constructor(l,u,v){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=u,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=p;let c=s.CharacterJoinerService=class on{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(l){let u={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(u),u.id}deregister(l){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===l)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];let u=this._bufferService.buffer.lines.get(l);if(!u||u.length===0)return[];let v=[],C=u.translateToString(!0),w=0,y=0,m=0,x=u.getFg(0),T=u.getBg(0);for(let I=0;I<u.getTrimmedLength();I++)if(u.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==T){if(I-w>1){let F=this._getJoinedRanges(C,m,y,u,w);for(let R=0;R<F.length;R++)v.push(F[R])}w=I,m=y,x=this._workCell.fg,T=this._workCell.bg}y+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){let I=this._getJoinedRanges(C,m,y,u,w);for(let F=0;F<I.length;F++)v.push(I[F])}return v}_getJoinedRanges(l,u,v,C,w){let y=l.substring(u,v),m=[];try{m=this._characterJoiners[0].handler(y)}catch(x){console.error(x)}for(let x=1;x<this._characterJoiners.length;x++)try{let T=this._characterJoiners[x].handler(y);for(let I=0;I<T.length;I++)on._mergeRanges(m,T[I])}catch(T){console.error(T)}return this._stringRangesToCellRanges(m,C,w),m}_stringRangesToCellRanges(l,u,v){let C=0,w=!1,y=0,m=l[C];if(m){for(let x=v;x<this._bufferService.cols;x++){let T=u.getWidth(x),I=u.getString(x).length||_.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!w&&m[0]<=y&&(m[0]=x,w=!0),m[1]<=y){if(m[1]=x,m=l[++C],!m)break;m[0]<=y?(m[0]=x,w=!0):w=!1}y+=I}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(l,u){let v=!1;for(let C=0;C<l.length;C++){let w=l[C];if(v){if(u[1]<=w[0])return l[C-1][1]=u[1],l;if(u[1]<=w[1])return l[C-1][1]=Math.max(u[1],w[1]),l.splice(C,1),l;l.splice(C,1),C--}else{if(u[1]<=w[0])return l.splice(C,0,u),l;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),l;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),v=!0)}}return v?l[l.length-1][1]=u[1]:l.push(u),l}};s.CharacterJoinerService=c=a([f(0,S.IBufferService)],c)},5114:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let a=r(844),f=r(8460),o=r(3656);class _ extends a.Disposable{constructor(p,c,d){super(),this._textarea=p,this._window=c,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((l=>this._screenDprMonitor.setWindow(l)))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(p){this._window!==p&&(this._window=p,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}s.CoreBrowserService=_;class g extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,a.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,o.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let a=r(844);class f extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let g=this.linkProviders.indexOf(_);g!==-1&&this.linkProviders.splice(g,1)}}}}s.LinkProviderService=f},8934:function(h,s,r){var a=this&&this.__decorate||function(S,p,c,d){var l,u=arguments.length,v=u<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,c):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(S,p,c,d);else for(var C=S.length-1;C>=0;C--)(l=S[C])&&(v=(u<3?l(v):u>3?l(p,c,v):l(p,c))||v);return u>3&&v&&Object.defineProperty(p,c,v),v},f=this&&this.__param||function(S,p){return function(c,d){p(c,d,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let o=r(4725),_=r(9806),g=s.MouseService=class{constructor(S,p){this._renderService=S,this._charSizeService=p}getCoords(S,p,c,d,l){return(0,_.getCoords)(window,S,p,c,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(S,p){let c=(0,_.getCoordsRelativeToElement)(window,S,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=g=a([f(0,o.IRenderService),f(1,o.ICharSizeService)],g)},3230:function(h,s,r){var a=this&&this.__decorate||function(l,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,v,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(l,u){return function(v,C){u(v,C,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let o=r(6193),_=r(4725),g=r(8460),S=r(844),p=r(7226),c=r(2585),d=s.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,v,C,w,y,m,x){super(),this._rowCount=l,this._charSizeService=C,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new S.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer(((T,I)=>this._renderRows(T,I)),m),this.register(this._renderDebouncer),this.register(m.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(y.onResize((()=>this._fullRefresh()))),this.register(y.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(v.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(w.onDecorationRegistered((()=>this._fullRefresh()))),this.register(w.onDecorationRemoved((()=>this._fullRefresh()))),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(y.cols,y.rows),this._fullRefresh()}))),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(y.buffer.y,y.buffer.y,!0)))),this.register(x.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange((T=>this._registerIntersectionObserver(T,u))))}_registerIntersectionObserver(l,u){if("IntersectionObserver"in l){let v=new l.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});v.observe(u),this._observerDisposable.value=(0,S.toDisposable)((()=>v.disconnect()))}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(l,u,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,u){this._rowCount=u,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(l,u))):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(l,u,v){this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(l,u,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=d=a([f(2,c.IOptionsService),f(3,_.ICharSizeService),f(4,c.IDecorationService),f(5,c.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],d)},9312:function(h,s,r){var a=this&&this.__decorate||function(m,x,T,I){var F,R=arguments.length,z=R<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(m,x,T,I);else for(var B=m.length-1;B>=0;B--)(F=m[B])&&(z=(R<3?F(z):R>3?F(x,T,z):F(x,T))||z);return R>3&&z&&Object.defineProperty(x,T,z),z},f=this&&this.__param||function(m,x){return function(T,I){x(T,I,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let o=r(9806),_=r(9504),g=r(456),S=r(4725),p=r(8460),c=r(844),d=r(6114),l=r(4841),u=r(511),v=r(2585),C="\xA0",w=new RegExp(C,"g"),y=s.SelectionService=class extends c.Disposable{constructor(m,x,T,I,F,R,z,B,D){super(),this._element=m,this._screenElement=x,this._linkifier=T,this._bufferService=I,this._coreService=F,this._mouseService=R,this._optionsService=z,this._renderService=B,this._coreBrowserService=D,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=O=>this._handleMouseMove(O),this._mouseUpListener=O=>this._handleMouseUp(O),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((O=>this._handleTrim(O))),this.register(this._bufferService.buffers.onBufferActivate((O=>this._handleBufferActivate(O)))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,c.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!m||!x||m[0]===x[0]&&m[1]===x[1])}get selectionText(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;if(!m||!x)return"";let T=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(m[0]===x[0])return"";let F=m[0]<x[0]?m[0]:x[0],R=m[0]<x[0]?x[0]:m[0];for(let z=m[1];z<=x[1];z++){let B=T.translateBufferLineToString(z,!0,F,R);I.push(B)}}else{let F=m[1]===x[1]?x[0]:void 0;I.push(T.translateBufferLineToString(m[1],!0,m[0],F));for(let R=m[1]+1;R<=x[1]-1;R++){let z=T.lines.get(R),B=T.translateBufferLineToString(R,!0);z?.isWrapped?I[I.length-1]+=B:I.push(B)}if(m[1]!==x[1]){let R=T.lines.get(x[1]),z=T.translateBufferLineToString(x[1],!0,0,x[0]);R&&R.isWrapped?I[I.length-1]+=z:I.push(z)}}return I.map((F=>F.replace(w," "))).join(d.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){let d=window.open();if(d){try{d.opener=null}catch{}d.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=g=a([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],g)},6193:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(s,a){this._renderCallback=s,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(s){return this._refreshCallbacks.push(s),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(s,a,f){this._rowCount=f,s=s!==void 0?s:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let s=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let s of this._refreshCallbacks)s(0);this._refreshCallbacks=[]}}},3236:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let a=s(3614),f=s(3656),o=s(3551),_=s(9042),g=s(3730),S=s(1680),p=s(3107),h=s(5744),d=s(2950),c=s(1296),u=s(428),v=s(4269),C=s(5114),w=s(8934),y=s(3230),m=s(9312),x=s(4725),A=s(6731),I=s(8055),F=s(8969),R=s(8460),$=s(844),B=s(6114),D=s(8437),P=s(2584),O=s(7399),b=s(5941),E=s(9074),L=s(2585),M=s(5435),z=s(4567),K=s(779);class V 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(T={}){super(T),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new $.MutableDisposable),this._onCursorMove=this.register(new R.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new R.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new R.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new R.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new R.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new R.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new R.EventEmitter),this._onBlur=this.register(new R.EventEmitter),this._onA11yCharEmitter=this.register(new R.EventEmitter),this._onA11yTabEmitter=this.register(new R.EventEmitter),this._onWillOpen=this.register(new R.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(x.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,N)=>this.refresh(k,N)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((k=>this._reportWindowsOptions(k)))),this.register(this._inputHandler.onColor((k=>this._handleColorEvent(k)))),this.register((0,R.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,R.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((k=>this._afterResize(k.cols,k.rows)))),this.register((0,$.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(T){if(this._themeService)for(let k of T){let N,H="";switch(k.index){case 256:N="foreground",H="10";break;case 257:N="background",H="11";break;case 258:N="cursor",H="12";break;default:N="ansi",H="4;"+k.index}switch(k.type){case 0:let q=I.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${P.C0.ESC}]${H};${(0,b.toRgbString)(q)}${P.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((U=>U.ansi[k.index]=I.channels.toColor(...k.color)));else{let U=N;this._themeService.modifyColors((Z=>Z[U]=I.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(T){T?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(T){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(P.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(P.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 T=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(T);if(!k)return;let N=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,q=k.getWidth(N),U=this._renderService.dimensions.css.cell.width*q,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,ee=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ee+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=U+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let T=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",T)),this.register((0,f.addDisposableDomListener)(this.element,"paste",T)),B.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(T=>this._keyUp(T)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(T=>this._keyDown(T)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(T=>this._keyPress(T)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(T=>this._compositionHelper.compositionupdate(T)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(T=>this._inputEvent(T)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(T){if(!T)throw new Error("Terminal requires a parent element.");if(T.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=T.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"),T.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,f.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),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(C.CoreBrowserService,this.textarea,T.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(x.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(x.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(A.ThemeService),this._instantiationService.setService(x.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(x.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.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(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(c.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let T=this,k=this.element;function N(U){let Z=T._mouseService.getMouseReportCoords(U,T.screenElement);if(!Z)return!1;let ee,Y;switch(U.overrideType||U.type){case"mousemove":Y=32,U.buttons===void 0?(ee=3,U.button!==void 0&&(ee=U.button<3?U.button:3)):ee=1&U.buttons?0:4&U.buttons?1:2&U.buttons?2:3;break;case"mouseup":Y=0,ee=U.button<3?U.button:3;break;case"mousedown":Y=1,ee=U.button<3?U.button:3;break;case"wheel":if(T._customWheelEventHandler&&T._customWheelEventHandler(U)===!1||T.viewport.getLinesScrolled(U)===0)return!1;Y=U.deltaY<0?0:1,ee=4;break;default:return!1}return!(Y===void 0||ee===void 0||ee>4)&&T.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:ee,action:Y,ctrl:U.ctrlKey,alt:U.altKey,shift:U.shiftKey})}let H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},q={mouseup:U=>(N(U),U.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(U)),wheel:U=>(N(U),this.cancel(U,!0)),mousedrag:U=>{U.buttons&&N(U)},mousemove:U=>{U.buttons||N(U)}};this.register(this.coreMouseService.onProtocolChange((U=>{U?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(U)),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&U?H.mousemove||(k.addEventListener("mousemove",q.mousemove),H.mousemove=q.mousemove):(k.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&U?H.wheel||(k.addEventListener("wheel",q.wheel,{passive:!1}),H.wheel=q.wheel):(k.removeEventListener("wheel",H.wheel),H.wheel=null),2&U?H.mouseup||(H.mouseup=q.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&U?H.mousedrag||(H.mousedrag=q.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(k,"mousedown",(U=>{if(U.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(U))return N(U),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(U)}))),this.register((0,f.addDisposableDomListener)(k,"wheel",(U=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(U)===!1)return!1;if(!this.buffer.hasScrollback){let Z=this.viewport.getLinesScrolled(U);if(Z===0)return;let ee=P.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(U.deltaY<0?"A":"B"),Y="";for(let Q=0;Q<Math.abs(Z);Q++)Y+=ee;return this.coreService.triggerDataEvent(Y,!0),this.cancel(U,!0)}return this.viewport.handleWheel(U)?this.cancel(U):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(k,"touchstart",(U=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(U),this.cancel(U)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(k,"touchmove",(U=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(U)?void 0:this.cancel(U)}),{passive:!1}))}refresh(T,k){this._renderService?.refreshRows(T,k)}updateCursorStyle(T){this._selectionService?.shouldColumnSelect(T)?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(T,k,N=0){N===1?(super.scrollLines(T,k,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(T)}paste(T){(0,a.paste)(T,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(T){this._customKeyEventHandler=T}attachCustomWheelEventHandler(T){this._customWheelEventHandler=T}registerLinkProvider(T){return this._linkProviderService.registerLinkProvider(T)}registerCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(T);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(T)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(T){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+T)}registerDecoration(T){return this._decorationService.registerDecoration(T)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(T,k,N){this._selectionService.setSelection(T,k,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(T,k){this._selectionService?.selectLines(T,k)}_keyDown(T){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&T.altKey;if(!k&&!this._compositionHelper.keydown(T))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||T.key!=="Dead"&&T.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,O.evaluateKeyboardEvent)(T,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(T),N.type===3||N.type===2){let H=this.rows-1;return this.scrollLines(N.type===2?-H:H),this.cancel(T,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,T)||(N.cancel&&this.cancel(T,!0),!N.key||!!(T.key&&!T.ctrlKey&&!T.altKey&&!T.metaKey&&T.key.length===1&&T.key.charCodeAt(0)>=65&&T.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==P.C0.ETX&&N.key!==P.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||T.altKey||T.ctrlKey?this.cancel(T,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(T,k){let N=T.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||T.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||T.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?N:N&&(!k.keyCode||k.keyCode>47)}_keyUp(T){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(T)||this.focus(),this.updateCursorStyle(T),this._keyPressHandled=!1)}_keyPress(T){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(this.cancel(T),T.charCode)k=T.charCode;else if(T.which===null||T.which===void 0)k=T.keyCode;else{if(T.which===0||T.charCode===0)return!1;k=T.which}return!(!k||(T.altKey||T.ctrlKey||T.metaKey)&&!this._isThirdLevelShift(this.browser,T)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(T){if(T.data&&T.inputType==="insertText"&&(!T.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=T.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(T),!0}return!1}resize(T,k){T!==this.cols||k!==this.rows?super.resize(T,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(T,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 T=1;T<this.rows;T++)this.buffer.lines.push(this.buffer.getBlankLine(D.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 T=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=T,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(P.C0.ESC+"[I"):this.coreService.triggerDataEvent(P.C0.ESC+"[O")}_reportWindowsOptions(T){if(this._renderService)switch(T){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${P.C0.ESC}[4;${N};${k}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let H=this._renderService.dimensions.css.cell.width.toFixed(0),q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${P.C0.ESC}[6;${q};${H}t`)}}cancel(T,k){if(this.options.cancelEvents||k)return T.preventDefault(),T.stopPropagation(),!1}}r.Terminal=V},9924:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(s,a=1e3){this._renderCallback=s,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(s,a,f){this._rowCount=f,s=s!==void 0?s:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=o-this._lastRefreshMs,g=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let s=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,a)}}},1680:function(l,r,s){var a=this&&this.__decorate||function(d,c,u,v){var C,w=arguments.length,y=w<3?c:v===null?v=Object.getOwnPropertyDescriptor(c,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,c,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(c,u,y):C(c,u))||y);return w>3&&y&&Object.defineProperty(c,u,y),y},f=this&&this.__param||function(d,c){return function(u,v){c(u,v,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let o=s(3656),_=s(4725),g=s(8460),S=s(844),p=s(2585),h=r.Viewport=class extends S.Disposable{constructor(d,c,u,v,C,w,y,m){super(),this._viewportElement=d,this._scrollArea=c,this._bufferService=u,this._optionsService=v,this._charSizeService=C,this._renderService=w,this._coreBrowserService=y,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((x=>this._activeBuffer=x.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((x=>this._renderDimensions=x))),this._handleThemeChange(m.colors),this.register(m.onChangeColors((x=>this._handleThemeChange(x)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(d){this._viewportElement.style.backgroundColor=d.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(d){if(d)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let c=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==c&&(this._lastRecordedBufferHeight=c,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let c=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:c,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(d,c){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(c<0&&this._viewportElement.scrollTop!==0||c>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let c=this._getPixelsScrolled(d);return c!==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+c:this._smoothScrollState.target+=c,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=c,this._bubbleScroll(d,c))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let c=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+c,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let c=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?c*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(c*=this._currentRowHeight*this._bufferService.rows),c}getBufferElements(d,c){let u,v="",C=[],w=c??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<w;m++){let x=y.get(m);if(!x)continue;let A=y.get(m+1)?.isWrapped;if(v+=x.translateToString(!A),!A||m===y.length-1){let I=document.createElement("div");I.textContent=v,C.push(I),v.length>0&&(u=I),v=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let c=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(c/=this._currentRowHeight+0,this._wheelPartialScroll+=c,c=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(c*=this._bufferService.rows),c}_applyScrollModifier(d,c){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&c.altKey||u==="ctrl"&&c.ctrlKey||u==="shift"&&c.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){let c=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,c!==0&&(this._viewportElement.scrollTop+=c,this._bubbleScroll(d,c))}};r.Viewport=h=a([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],h)},3107:function(l,r,s){var a=this&&this.__decorate||function(p,h,d,c){var u,v=arguments.length,C=v<3?h:c===null?c=Object.getOwnPropertyDescriptor(h,d):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,h,d,c);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(h,d,C):u(h,d))||C);return v>3&&C&&Object.defineProperty(h,d,C),C},f=this&&this.__param||function(p,h){return function(d,c){h(d,c,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let o=s(4725),_=s(844),g=s(2585),S=r.BufferDecorationRenderer=class extends _.Disposable{constructor(p,h,d,c,u){super(),this._screenElement=p,this._bufferService=h,this._coreBrowserService=d,this._decorationService=c,this._renderService=u,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((v=>this._removeDecoration(v)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let h=this._coreBrowserService.mainDocument.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),h.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let d=p.options.x??0;return d&&d>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(p,h),h}_refreshStyle(p){let h=p.marker.line-this._bufferService.buffers.active.ydisp;if(h<0||h>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let d=this._decorationElements.get(p);d||(d=this._createElement(p),p.element=d,this._decorationElements.set(p,d),this._container.appendChild(d),p.onDispose((()=>{this._decorationElements.delete(p),d.remove()}))),d.style.top=h*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(d)}}_refreshXPosition(p,h=p.element){if(!h)return;let d=p.options.x??0;(p.options.anchor||"left")==="right"?h.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":h.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};r.BufferDecorationRenderer=S=a([f(1,g.IBufferService),f(2,o.ICoreBrowserService),f(3,g.IDecorationService),f(4,o.IRenderService)],S)},5871:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(s){if(s.options.overviewRulerOptions){for(let a of this._zones)if(a.color===s.options.overviewRulerOptions.color&&a.position===s.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,s.marker.line))return;if(this._lineAdjacentToZone(a,s.marker.line,s.options.overviewRulerOptions.position))return void this._addLineToZone(a,s.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=s.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=s.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=s.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=s.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:s.options.overviewRulerOptions.color,position:s.options.overviewRulerOptions.position,startBufferLine:s.marker.line,endBufferLine:s.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(s){this._linePadding=s}_lineIntersectsZone(s,a){return a>=s.startBufferLine&&a<=s.endBufferLine}_lineAdjacentToZone(s,a,f){return a>=s.startBufferLine-this._linePadding[f||"full"]&&a<=s.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(s,a){s.startBufferLine=Math.min(s.startBufferLine,a),s.endBufferLine=Math.max(s.endBufferLine,a)}}},5744:function(l,r,s){var a=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var A=u.length-1;A>=0;A--)(y=u[A])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let o=s(5871),_=s(4725),g=s(844),S=s(2585),p={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},c=r.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,v,C,w,y,m,x){super(),this._viewportElement=u,this._screenElement=v,this._bufferService=C,this._decorationService=w,this._renderService=y,this._optionsService=m,this._coreBrowserService=x,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let A=this._canvas.getContext("2d");if(!A)throw new Error("Ctx cannot be null");this._ctx=A,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,g.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let u=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=u,h.center=v,h.right=u,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=h.left,d.right=h.left+h.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let u=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=v,p.center=v,p.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;let u=this._colorZoneStore.zones;for(let v of u)v.position!=="full"&&this._renderColorZone(v);for(let v of u)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(d[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-p[u.position||"full"]/2),h[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,v){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=c=a([f(2,S.IBufferService),f(3,S.IDecorationService),f(4,_.IRenderService),f(5,S.IOptionsService),f(6,_.ICoreBrowserService)],c)},2950:function(l,r,s){var a=this&&this.__decorate||function(p,h,d,c){var u,v=arguments.length,C=v<3?h:c===null?c=Object.getOwnPropertyDescriptor(h,d):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,h,d,c);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(h,d,C):u(h,d))||C);return v>3&&C&&Object.defineProperty(h,d,C),C},f=this&&this.__param||function(p,h){return function(d,c){h(d,c,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let o=s(4725),_=s(2585),g=s(2584),S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,h,d,c,u,v){this._textarea=p,this._compositionView=h,this._bufferService=d,this._optionsService=c,this._coreService=u,this._renderService=v,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let h={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,h.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(h.start,h.end):this._textarea.value.substring(h.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;let h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let h=this._textarea.value,d=h.replace(p,"");this._dataAlreadySent=d,h.length>p.length?this._coreService.triggerDataEvent(d,!0):h.length<p.length?this._coreService.triggerDataEvent(`${g.C0.DEL}`,!0):h.length===p.length&&h!==p&&this._coreService.triggerDataEvent(h,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let h=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,c=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=h*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=c+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let v=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=c+"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)}}};r.CompositionHelper=S=a([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,o.IRenderService)],S)},9806:(l,r)=>{function s(a,f,o){let _=o.getBoundingClientRect(),g=a.getComputedStyle(o),S=parseInt(g.getPropertyValue("padding-left")),p=parseInt(g.getPropertyValue("padding-top"));return[f.clientX-_.left-S,f.clientY-_.top-p]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=s,r.getCoords=function(a,f,o,_,g,S,p,h,d){if(!S)return;let c=s(a,f,o);return c?(c[0]=Math.ceil((c[0]+(d?p/2:0))/p),c[1]=Math.ceil(c[1]/h),c[0]=Math.min(Math.max(c[0],1),_+(d?1:0)),c[1]=Math.min(Math.max(c[1],1),g),c):void 0}},9504:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let a=s(2584);function f(h,d,c,u){let v=h-o(h,c),C=d-o(d,c),w=Math.abs(v-C)-(function(y,m,x){let A=0,I=y-o(y,x),F=m-o(m,x);for(let R=0;R<Math.abs(I-F);R++){let $=_(y,m)==="A"?-1:1;x.buffer.lines.get(I+$*R)?.isWrapped&&A++}return A})(h,d,c);return p(w,S(_(h,d),u))}function o(h,d){let c=0,u=d.buffer.lines.get(h),v=u?.isWrapped;for(;v&&h>=0&&h<d.rows;)c++,u=d.buffer.lines.get(--h),v=u?.isWrapped;return c}function _(h,d){return h>d?"A":"B"}function g(h,d,c,u,v,C){let w=h,y=d,m="";for(;w!==c||y!==u;)w+=v?1:-1,v&&w>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,h,w),w=0,h=0,y++):!v&&w<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,h+1),w=C.cols-1,h=w,y--);return m+C.buffer.translateBufferLineToString(y,!1,h,w)}function S(h,d){let c=d?"O":"[";return a.C0.ESC+c+h}function p(h,d){h=Math.floor(h);let c="";for(let u=0;u<h;u++)c+=d;return c}r.moveToCellSequence=function(h,d,c,u){let v=c.buffer.x,C=c.buffer.y;if(!c.buffer.hasScrollback)return(function(m,x,A,I,F,R){return f(x,I,F,R).length===0?"":p(g(m,x,m,x-o(x,F),!1,F).length,S("D",R))})(v,C,0,d,c,u)+f(C,d,c,u)+(function(m,x,A,I,F,R){let $;$=f(x,I,F,R).length>0?I-o(I,F):x;let B=I,D=(function(P,O,b,E,L,M){let z;return z=f(b,E,L,M).length>0?E-o(E,L):O,P<b&&z<=E||P>=b&&z<E?"C":"D"})(m,x,A,I,F,R);return p(g(m,$,A,B,D==="C",F).length,S(D,R))})(v,C,h,d,c,u);let w;if(C===d)return w=v>h?"D":"C",p(Math.abs(v-h),S(w,u));w=C>d?"D":"C";let y=Math.abs(C-d);return p((function(m,x){return x.cols-m})(C>d?h:v,c)+(y-1)*c.cols+1+((C>d?v:h)-1),S(w,u))}},1296:function(l,r,s){var a=this&&this.__decorate||function(R,$,B,D){var P,O=arguments.length,b=O<3?$:D===null?D=Object.getOwnPropertyDescriptor($,B):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(R,$,B,D);else for(var E=R.length-1;E>=0;E--)(P=R[E])&&(b=(O<3?P(b):O>3?P($,B,b):P($,B))||b);return O>3&&b&&Object.defineProperty($,B,b),b},f=this&&this.__param||function(R,$){return function(B,D){$(B,D,R)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let o=s(3787),_=s(2550),g=s(2223),S=s(6171),p=s(6052),h=s(4725),d=s(8055),c=s(8460),u=s(844),v=s(2585),C="xterm-dom-renderer-owner-",w="xterm-rows",y="xterm-fg-",m="xterm-bg-",x="xterm-focus",A="xterm-selection",I=1,F=r.DomRenderer=class extends u.Disposable{constructor(R,$,B,D,P,O,b,E,L,M,z,K,V){super(),this._terminal=R,this._document=$,this._element=B,this._screenElement=D,this._viewportElement=P,this._helperContainer=O,this._linkifier2=b,this._charSizeService=L,this._optionsService=M,this._bufferService=z,this._coreBrowserService=K,this._themeService=V,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new c.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(w),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(A),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((j=>this._injectCss(j)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((j=>this._handleLinkHover(j)))),this.register(this._linkifier2.onHideLinkUnderline((j=>this._handleLinkLeave(j)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let R=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*R,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*R),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/R),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/R),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let $=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=$,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(R){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let $=`${this._terminalSelector} .${w} { color: ${R.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;$+=`${this._terminalSelector} .${w} .xterm-dim { color: ${d.color.multiplyOpacity(R.foreground,.5).css};}`,$+=`${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}`,D=`blink_bar_${this._terminalClass}`,P=`blink_block_${this._terminalClass}`;$+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,$+=`@keyframes ${D} { 50% { box-shadow: none; }}`,$+=`@keyframes ${P} { 0% { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css}; } 50% { background-color: inherit; color: ${R.cursor.css}; }}`,$+=`${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${D} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${R.cursor.css} !important; color: ${R.cursorAccent.css} !important;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${R.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${R.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${R.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,$+=`${this._terminalSelector} .${A} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${A} div { position: absolute; background-color: ${R.selectionBackgroundOpaque.css};}${this._terminalSelector} .${A} div { position: absolute; background-color: ${R.selectionInactiveBackgroundOpaque.css};}`;for(let[O,b]of R.ansi.entries())$+=`${this._terminalSelector} .${y}${O} { color: ${b.css}; }${this._terminalSelector} .${y}${O}.xterm-dim { color: ${d.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${m}${O} { background-color: ${b.css}; }`;$+=`${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(R.background).css}; }${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(R.background),.5).css}; }${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR} { background-color: ${R.foreground.css}; }`,this._themeStyleElement.textContent=$}_setDefaultSpacing(){let R=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${R}px`,this._rowFactory.defaultSpacing=R}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(R,$){for(let B=this._rowElements.length;B<=$;B++){let D=this._document.createElement("div");this._rowContainer.appendChild(D),this._rowElements.push(D)}for(;this._rowElements.length>$;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(R,$){this._refreshRowElements(R,$),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(x),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(x),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(R,$,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(R,$,B),this.renderRows(0,this._bufferService.rows-1),!R||!$)return;this._selectionRenderModel.update(this._terminal,R,$,B);let D=this._selectionRenderModel.viewportStartRow,P=this._selectionRenderModel.viewportEndRow,O=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(O>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(B){let L=R[0]>$[0];E.appendChild(this._createSelectionElement(O,L?$[0]:R[0],L?R[0]:$[0],b-O+1))}else{let L=D===O?R[0]:0,M=O===P?$[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(O,L,M));let z=b-O-1;if(E.appendChild(this._createSelectionElement(O+1,0,this._bufferService.cols,z)),O!==b){let K=P===b?$[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(R,$,B,D=1){let P=this._document.createElement("div"),O=$*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(B-$);return O+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-O),P.style.height=D*this.dimensions.css.cell.height+"px",P.style.top=R*this.dimensions.css.cell.height+"px",P.style.left=`${O}px`,P.style.width=`${b}px`,P}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let R of this._rowElements)R.replaceChildren()}renderRows(R,$){let B=this._bufferService.buffer,D=B.ybase+B.y,P=Math.min(B.x,this._bufferService.cols-1),O=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=R;L<=$;L++){let M=L+B.ydisp,z=this._rowElements[L],K=B.lines.get(M);if(!z||!K)break;z.replaceChildren(...this._rowFactory.createRow(K,M,M===D,b,E,P,O,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!0)}_handleLinkLeave(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!1)}_setCellUnderline(R,$,B,D,P,O){B<0&&(R=0),D<0&&($=0);let b=this._bufferService.rows-1;B=Math.max(Math.min(B,b),0),D=Math.max(Math.min(D,b),0),P=Math.min(P,this._bufferService.cols);let E=this._bufferService.buffer,L=E.ybase+E.y,M=Math.min(E.x,P-1),z=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,V=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=B;j<=D;++j){let T=j+E.ydisp,k=this._rowElements[j],N=E.lines.get(T);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,T,T===L,K,V,M,z,this.dimensions.css.cell.width,this._widthCache,O?j===B?R:0:-1,O?(j===D?$:P)-1:-1))}}};r.DomRenderer=F=a([f(7,v.IInstantiationService),f(8,h.ICharSizeService),f(9,v.IOptionsService),f(10,v.IBufferService),f(11,h.ICoreBrowserService),f(12,h.IThemeService)],F)},3787:function(l,r,s){var a=this&&this.__decorate||function(w,y,m,x){var A,I=arguments.length,F=I<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(w,y,m,x);else for(var R=w.length-1;R>=0;R--)(A=w[R])&&(F=(I<3?A(F):I>3?A(y,m,F):A(y,m))||F);return I>3&&F&&Object.defineProperty(y,m,F),F},f=this&&this.__param||function(w,y){return function(m,x){y(m,x,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let o=s(2223),_=s(643),g=s(511),S=s(2585),p=s(8055),h=s(4725),d=s(4269),c=s(6171),u=s(3734),v=r.DomRendererRowFactory=class{constructor(w,y,m,x,A,I,F){this._document=w,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=x,this._coreService=A,this._decorationService=I,this._themeService=F,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,y,m){this._selectionStart=w,this._selectionEnd=y,this._columnSelectMode=m}createRow(w,y,m,x,A,I,F,R,$,B,D){let P=[],O=this._characterJoinerService.getJoinedCharacters(y),b=this._themeService.colors,E,L=w.getNoBgTrimmedLength();m&&L<I+1&&(L=I+1);let M=0,z="",K=0,V=0,j=0,T=!1,k=0,N=!1,H=0,q=[],U=B!==-1&&D!==-1;for(let Z=0;Z<L;Z++){w.loadCell(Z,this._workCell);let ee=this._workCell.getWidth();if(ee===0)continue;let Y=!1,Q=Z,X=this._workCell;if(O.length>0&&Z===O[0][0]){Y=!0;let fe=O.shift();X=new d.JoinedCellData(this._workCell,w.translateToString(!0,fe[0],fe[1]),fe[1]-fe[0]),Q=fe[1]-1,ee=X.getWidth()}let ie=this._isCellInSelection(Z,y),ne=m&&Z===I,he=U&&Z>=B&&Z<=D,ce=!1;this._decorationService.forEachDecorationAtCell(Z,y,void 0,(fe=>{ce=!0}));let ge=X.getChars()||_.WHITESPACE_CELL_CHAR;if(ge===" "&&(X.isUnderline()||X.isOverline())&&(ge="\xA0"),H=ee*R-$.get(ge,X.isBold(),X.isItalic()),E){if(M&&(ie&&N||!ie&&!N&&X.bg===K)&&(ie&&N&&b.selectionForeground||X.fg===V)&&X.extended.ext===j&&he===T&&H===k&&!ne&&!Y&&!ce){X.isInvisible()?z+=_.WHITESPACE_CELL_CHAR:z+=ge,M++;continue}M&&(E.textContent=z),E=this._document.createElement("span"),M=0,z=""}else E=this._document.createElement("span");if(K=X.bg,V=X.fg,j=X.extended.ext,T=he,k=H,N=ie,Y&&I>=Z&&I<=Q&&(I=Z),!this._coreService.isCursorHidden&&ne&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&q.push("xterm-cursor-blink"),q.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(A)switch(A){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline")}}if(X.isBold()&&q.push("xterm-bold"),X.isItalic()&&q.push("xterm-italic"),X.isDim()&&q.push("xterm-dim"),z=X.isInvisible()?_.WHITESPACE_CELL_CHAR:X.getChars()||_.WHITESPACE_CELL_CHAR,X.isUnderline()&&(q.push(`xterm-underline-${X.extended.underlineStyle}`),z===" "&&(z="\xA0"),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let fe=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&fe<8&&(fe+=8),E.style.textDecorationColor=b.ansi[fe].css}X.isOverline()&&(q.push("xterm-overline"),z===" "&&(z="\xA0")),X.isStrikethrough()&&q.push("xterm-strikethrough"),he&&(E.style.textDecoration="underline");let Se=X.getFgColor(),Oe=X.getFgColorMode(),Ie=X.getBgColor(),Pt=X.getBgColorMode(),wi=!!X.isInverse();if(wi){let fe=Se;Se=Ie,Ie=fe;let ts=Oe;Oe=Pt,Pt=ts}let Je,Ot,Ze,It=!1;switch(this._decorationService.forEachDecorationAtCell(Z,y,void 0,(fe=>{fe.options.layer!=="top"&&It||(fe.backgroundColorRGB&&(Pt=50331648,Ie=fe.backgroundColorRGB.rgba>>8&16777215,Je=fe.backgroundColorRGB),fe.foregroundColorRGB&&(Oe=50331648,Se=fe.foregroundColorRGB.rgba>>8&16777215,Ot=fe.foregroundColorRGB),It=fe.options.layer==="top")})),!It&&ie&&(Je=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,Ie=Je.rgba>>8&16777215,Pt=50331648,It=!0,b.selectionForeground&&(Oe=50331648,Se=b.selectionForeground.rgba>>8&16777215,Ot=b.selectionForeground)),It&&q.push("xterm-decoration-top"),Pt){case 16777216:case 33554432:Ze=b.ansi[Ie],q.push(`xterm-bg-${Ie}`);break;case 50331648:Ze=p.channels.toColor(Ie>>16,Ie>>8&255,255&Ie),this._addStyle(E,`background-color:#${C((Ie>>>0).toString(16),"0",6)}`);break;default:wi?(Ze=b.foreground,q.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):Ze=b.background}switch(Je||X.isDim()&&(Je=p.color.multiplyOpacity(Ze,.5)),Oe){case 16777216:case 33554432:X.isBold()&&Se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Se+=8),this._applyMinimumContrast(E,Ze,b.ansi[Se],X,Je,void 0)||q.push(`xterm-fg-${Se}`);break;case 50331648:let fe=p.channels.toColor(Se>>16&255,Se>>8&255,255&Se);this._applyMinimumContrast(E,Ze,fe,X,Je,Ot)||this._addStyle(E,`color:#${C(Se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,Ze,b.foreground,X,Je,Ot)||wi&&q.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}q.length&&(E.className=q.join(" "),q.length=0),ne||Y||ce?E.textContent=z:M++,H!==this.defaultSpacing&&(E.style.letterSpacing=`${H}px`),P.push(E),Z=Q}return E&&M&&(E.textContent=z),P}_applyMinimumContrast(w,y,m,x,A,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,c.treatGlyphAsBackgroundColor)(x.getCode()))return!1;let F=this._getContrastCache(x),R;if(A||I||(R=F.getColor(y.rgba,m.rgba)),R===void 0){let $=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);R=p.color.ensureContrastRatio(A||y,I||m,$),F.setColor((A||y).rgba,(I||m).rgba,R??null)}return!!R&&(this._addStyle(w,`color:${R.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,y){w.setAttribute("style",`${w.getAttribute("style")||""}${y};`)}_isCellInSelection(w,y){let m=this._selectionStart,x=this._selectionEnd;return!(!m||!x)&&(this._columnSelectMode?m[0]<=x[0]?w>=m[0]&&y>=m[1]&&w<x[0]&&y<=x[1]:w<m[0]&&y>=m[1]&&w>=x[0]&&y<=x[1]:y>m[1]&&y<x[1]||m[1]===x[1]&&y===m[1]&&w>=m[0]&&w<x[0]||m[1]<x[1]&&y===x[1]&&w<x[0]||m[1]<x[1]&&y===m[1]&&w>=m[0])}};function C(w,y,m){for(;w.length<m;)w=y+w;return w}r.DomRendererRowFactory=v=a([f(1,h.ICharacterJoinerService),f(2,S.IOptionsService),f(3,h.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,h.IThemeService)],v)},2550:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(s,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=s.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let f=s.createElement("span");f.classList.add("xterm-char-measure-element");let o=s.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let _=s.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let g=s.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold",g.style.fontStyle="italic",this._measureElements=[f,o,_,g],this._container.appendChild(f),this._container.appendChild(o),this._container.appendChild(_),this._container.appendChild(g),a.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(s,a,f,o){s===this._font&&a===this._fontSize&&f===this._weight&&o===this._weightBold||(this._font=s,this._fontSize=a,this._weight=f,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(s,a,f){let o=0;if(!a&&!f&&s.length===1&&(o=s.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let S=this._measure(s,0);return S>0&&(this._flat[o]=S),S}let _=s;a&&(_+="B"),f&&(_+="I");let g=this._holey.get(_);if(g===void 0){let S=0;a&&(S|=1),f&&(S|=2),g=this._measure(s,S),g>0&&this._holey.set(_,g)}return g}_measure(s,a){let f=this._measureElements[a];return f.textContent=s.repeat(32),f.offsetWidth/32}}},2223:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let a=s(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(l,r)=>{function s(f){return 57508<=f&&f<=57558}function a(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},r.isPowerlineGlyph=s,r.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},r.isEmoji=a,r.allowRescaling=function(f,o,_,g){return o===1&&_>Math.ceil(1.5*g)&&f!==void 0&&f>255&&!a(f)&&!s(f)&&!(function(S){return 57344<=S&&S<=63743})(f)},r.treatGlyphAsBackgroundColor=function(f){return s(f)||(function(o){return 9472<=o&&o<=9631})(f)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(f,o,_=0){return(f-(2*Math.round(o)-_))%(2*Math.round(o))}},6052:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class s{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,o,_,g=!1){if(this.selectionStart=o,this.selectionEnd=_,!o||!_||o[0]===_[0]&&o[1]===_[1])return void this.clear();let S=f.buffers.active.ydisp,p=o[1]-S,h=_[1]-S,d=Math.max(p,0),c=Math.min(h,f.rows-1);d>=f.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=p,this.viewportEndRow=h,this.viewportCappedStartRow=d,this.viewportCappedEndRow=c,this.startCol=o[0],this.endCol=_[0])}isCellSelected(f,o,_){return!!this.hasSelection&&(_-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&_>=this.viewportCappedStartRow&&o<this.endCol&&_<=this.viewportCappedEndRow:o<this.startCol&&_>=this.viewportCappedStartRow&&o>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&o>=this.startCol)}}r.createSelectionRenderModel=function(){return new s}},456:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(s){this._bufferService=s,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?s%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)-1]:[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[s,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[Math.max(s,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let s=this.selectionStart,a=this.selectionEnd;return!(!s||!a)&&(s[1]>a[1]||s[1]===a[1]&&s[0]>a[0])}handleTrim(s){return this.selectionStart&&(this.selectionStart[1]-=s),this.selectionEnd&&(this.selectionEnd[1]-=s),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(l,r,s){var a=this&&this.__decorate||function(c,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(c,u,v,C);else for(var x=c.length-1;x>=0;x--)(w=c[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(c,u){return function(v,C){u(v,C,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let o=s(2585),_=s(8460),g=s(844),S=r.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(c,u,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new h(c,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let c=this._measureStrategy.measure();c.width===this.width&&c.height===this.height||(this.width=c.width,this.height=c.height,this._onCharSizeChange.fire())}};r.CharSizeService=S=a([f(2,o.IOptionsService)],S);class p extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,v){u!==void 0&&u>0&&v!==void 0&&v>0&&(this._result.width=u,this._result.height=v)}}class h extends p{constructor(u,v,C){super(),this._document=u,this._parentElement=v,this._optionsService=C,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let v=this._ctx.measureText("W");if(!("width"in v&&"fontBoundingBoxAscent"in v&&"fontBoundingBoxDescent"in v))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(l,r,s){var a=this&&this.__decorate||function(d,c,u,v){var C,w=arguments.length,y=w<3?c:v===null?v=Object.getOwnPropertyDescriptor(c,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,c,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(c,u,y):C(c,u))||y);return w>3&&y&&Object.defineProperty(c,u,y),y},f=this&&this.__param||function(d,c){return function(u,v){c(u,v,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let o=s(3734),_=s(643),g=s(511),S=s(2585);class p extends o.AttributeData{constructor(c,u,v){super(),this.content=0,this.combinedData="",this.fg=c.fg,this.bg=c.bg,this.combinedData=u,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(c){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=p;let h=r.CharacterJoinerService=class Rn{constructor(c){this._bufferService=c,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(c){let u={id:this._nextCharacterJoinerId++,handler:c};return this._characterJoiners.push(u),u.id}deregister(c){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===c)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(c){if(this._characterJoiners.length===0)return[];let u=this._bufferService.buffer.lines.get(c);if(!u||u.length===0)return[];let v=[],C=u.translateToString(!0),w=0,y=0,m=0,x=u.getFg(0),A=u.getBg(0);for(let I=0;I<u.getTrimmedLength();I++)if(u.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==A){if(I-w>1){let F=this._getJoinedRanges(C,m,y,u,w);for(let R=0;R<F.length;R++)v.push(F[R])}w=I,m=y,x=this._workCell.fg,A=this._workCell.bg}y+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){let I=this._getJoinedRanges(C,m,y,u,w);for(let F=0;F<I.length;F++)v.push(I[F])}return v}_getJoinedRanges(c,u,v,C,w){let y=c.substring(u,v),m=[];try{m=this._characterJoiners[0].handler(y)}catch(x){console.error(x)}for(let x=1;x<this._characterJoiners.length;x++)try{let A=this._characterJoiners[x].handler(y);for(let I=0;I<A.length;I++)Rn._mergeRanges(m,A[I])}catch(A){console.error(A)}return this._stringRangesToCellRanges(m,C,w),m}_stringRangesToCellRanges(c,u,v){let C=0,w=!1,y=0,m=c[C];if(m){for(let x=v;x<this._bufferService.cols;x++){let A=u.getWidth(x),I=u.getString(x).length||_.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!w&&m[0]<=y&&(m[0]=x,w=!0),m[1]<=y){if(m[1]=x,m=c[++C],!m)break;m[0]<=y?(m[0]=x,w=!0):w=!1}y+=I}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(c,u){let v=!1;for(let C=0;C<c.length;C++){let w=c[C];if(v){if(u[1]<=w[0])return c[C-1][1]=u[1],c;if(u[1]<=w[1])return c[C-1][1]=Math.max(u[1],w[1]),c.splice(C,1),c;c.splice(C,1),C--}else{if(u[1]<=w[0])return c.splice(C,0,u),c;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),c;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),v=!0)}}return v?c[c.length-1][1]=u[1]:c.push(u),c}};r.CharacterJoinerService=h=a([f(0,S.IBufferService)],h)},5114:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let a=s(844),f=s(8460),o=s(3656);class _ extends a.Disposable{constructor(p,h,d){super(),this._textarea=p,this._window=h,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((c=>this._screenDprMonitor.setWindow(c)))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(p){this._window!==p&&(this._window=p,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}r.CoreBrowserService=_;class g extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,a.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,o.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let a=s(844);class f extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let g=this.linkProviders.indexOf(_);g!==-1&&this.linkProviders.splice(g,1)}}}}r.LinkProviderService=f},8934:function(l,r,s){var a=this&&this.__decorate||function(S,p,h,d){var c,u=arguments.length,v=u<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,h):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(S,p,h,d);else for(var C=S.length-1;C>=0;C--)(c=S[C])&&(v=(u<3?c(v):u>3?c(p,h,v):c(p,h))||v);return u>3&&v&&Object.defineProperty(p,h,v),v},f=this&&this.__param||function(S,p){return function(h,d){p(h,d,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let o=s(4725),_=s(9806),g=r.MouseService=class{constructor(S,p){this._renderService=S,this._charSizeService=p}getCoords(S,p,h,d,c){return(0,_.getCoords)(window,S,p,h,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,c)}getMouseReportCoords(S,p){let h=(0,_.getCoordsRelativeToElement)(window,S,p);if(this._charSizeService.hasValidSize)return h[0]=Math.min(Math.max(h[0],0),this._renderService.dimensions.css.canvas.width-1),h[1]=Math.min(Math.max(h[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(h[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(h[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(h[0]),y:Math.floor(h[1])}}};r.MouseService=g=a([f(0,o.IRenderService),f(1,o.ICharSizeService)],g)},3230:function(l,r,s){var a=this&&this.__decorate||function(c,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(c,u,v,C);else for(var x=c.length-1;x>=0;x--)(w=c[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(c,u){return function(v,C){u(v,C,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let o=s(6193),_=s(4725),g=s(8460),S=s(844),p=s(7226),h=s(2585),d=r.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(c,u,v,C,w,y,m,x){super(),this._rowCount=c,this._charSizeService=C,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new S.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer(((A,I)=>this._renderRows(A,I)),m),this.register(this._renderDebouncer),this.register(m.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(y.onResize((()=>this._fullRefresh()))),this.register(y.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(v.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(w.onDecorationRegistered((()=>this._fullRefresh()))),this.register(w.onDecorationRemoved((()=>this._fullRefresh()))),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(y.cols,y.rows),this._fullRefresh()}))),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(y.buffer.y,y.buffer.y,!0)))),this.register(x.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange((A=>this._registerIntersectionObserver(A,u))))}_registerIntersectionObserver(c,u){if("IntersectionObserver"in c){let v=new c.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});v.observe(u),this._observerDisposable.value=(0,S.toDisposable)((()=>v.disconnect()))}}_handleIntersectionChange(c){this._isPaused=c.isIntersecting===void 0?c.intersectionRatio===0:!c.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(c,u,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(c,u,this._rowCount))}_renderRows(c,u){this._renderer.value&&(c=Math.min(c,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(c,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:c,end:u}),this._onRender.fire({start:c,end:u}),this._isNextRenderRedrawOnly=!0)}resize(c,u){this._rowCount=u,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(c){this._renderer.value=c,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(c){return this._renderDebouncer.addRefreshCallback(c)}_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(c,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(c,u))):this._renderer.value.handleResize(c,u),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(c,u,v){this._selectionState.start=c,this._selectionState.end=u,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(c,u,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=d=a([f(2,h.IOptionsService),f(3,_.ICharSizeService),f(4,h.IDecorationService),f(5,h.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],d)},9312:function(l,r,s){var a=this&&this.__decorate||function(m,x,A,I){var F,R=arguments.length,$=R<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,A):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(m,x,A,I);else for(var B=m.length-1;B>=0;B--)(F=m[B])&&($=(R<3?F($):R>3?F(x,A,$):F(x,A))||$);return R>3&&$&&Object.defineProperty(x,A,$),$},f=this&&this.__param||function(m,x){return function(A,I){x(A,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let o=s(9806),_=s(9504),g=s(456),S=s(4725),p=s(8460),h=s(844),d=s(6114),c=s(4841),u=s(511),v=s(2585),C="\xA0",w=new RegExp(C,"g"),y=r.SelectionService=class extends h.Disposable{constructor(m,x,A,I,F,R,$,B,D){super(),this._element=m,this._screenElement=x,this._linkifier=A,this._bufferService=I,this._coreService=F,this._mouseService=R,this._optionsService=$,this._renderService=B,this._coreBrowserService=D,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=P=>this._handleMouseMove(P),this._mouseUpListener=P=>this._handleMouseUp(P),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((P=>this._handleTrim(P))),this.register(this._bufferService.buffers.onBufferActivate((P=>this._handleBufferActivate(P)))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!m||!x||m[0]===x[0]&&m[1]===x[1])}get selectionText(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;if(!m||!x)return"";let A=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(m[0]===x[0])return"";let F=m[0]<x[0]?m[0]:x[0],R=m[0]<x[0]?x[0]:m[0];for(let $=m[1];$<=x[1];$++){let B=A.translateBufferLineToString($,!0,F,R);I.push(B)}}else{let F=m[1]===x[1]?x[0]:void 0;I.push(A.translateBufferLineToString(m[1],!0,m[0],F));for(let R=m[1]+1;R<=x[1]-1;R++){let $=A.lines.get(R),B=A.translateBufferLineToString(R,!0);$?.isWrapped?I[I.length-1]+=B:I.push(B)}if(m[1]!==x[1]){let R=A.lines.get(x[1]),$=A.translateBufferLineToString(x[1],!0,0,x[0]);R&&R.isWrapped?I[I.length-1]+=$:I.push($)}}return I.map((F=>F.replace(w," "))).join(d.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(m){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.isLinux&&m&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(m){let x=this._getMouseBufferCoords(m),T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(T&&I&&x)&&this._areCoordsInSelection(x,T,I)}isCellInSelection(m,x){let T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!T||!I)&&this._areCoordsInSelection([m,x],T,I)}_areCoordsInSelection(m,x,T){return m[1]>x[1]&&m[1]<T[1]||x[1]===T[1]&&m[1]===x[1]&&m[0]>=x[0]&&m[0]<T[0]||x[1]<T[1]&&m[1]===T[1]&&m[0]<T[0]||x[1]<T[1]&&m[1]===x[1]&&m[0]>=x[0]}_selectWordAtCursor(m,x){let T=this._linkifier.currentLink?.link?.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let I=this._getMouseBufferCoords(m);return!!I&&(this._selectWordAt(I,x),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,x){this._model.clearSelection(),m=Math.max(m,0),x=Math.min(x,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,x],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let x=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(x)return x[0]--,x[1]--,x[1]+=this._bufferService.buffer.ydisp,x}_getMouseEventScrollAmount(m){let x=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],T=this._renderService.dimensions.css.canvas.height;return x>=0&&x<=T?0:(x>T&&(x-=T),x=Math.min(Math.max(x,-50),50),x/=50,x/Math.abs(x)+Math.round(14*x))}shouldForceSelection(m){return d.isMac?m.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:m.shiftKey}handleMouseDown(m){if(this._mouseDownTimeStamp=m.timeStamp,(m.button!==2||!this.hasSelection)&&m.button===0){if(!this._enabled){if(!this.shouldForceSelection(m))return;m.stopPropagation()}m.preventDefault(),this._dragScrollAmount=0,this._enabled&&m.shiftKey?this._handleIncrementalClick(m):m.detail===1?this._handleSingleClick(m):m.detail===2?this._handleDoubleClick(m):m.detail===3&&this._handleTripleClick(m),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(m){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(m))}_handleSingleClick(m){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(m)?3:0,this._model.selectionStart=this._getMouseBufferCoords(m),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let x=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);x&&x.length!==this._model.selectionStart[0]&&x.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let x=this._getMouseBufferCoords(m);x&&(this._activeSelectionMode=2,this._selectLineAt(x[1]))}shouldColumnSelect(m){return m.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let x=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(m),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(m),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){let I=T.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}x&&x[0]===this._model.selectionEnd[0]&&x[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let m=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(m.ydisp+this._bufferService.rows,m.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=m.ydisp),this.refresh()}}_handleMouseUp(m){let x=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&x<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let T=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){let I=(0,_.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,T=!(!m||!x||m[0]===x[0]&&m[1]===x[1]);T?m&&x&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&x[0]===this._oldSelectionEnd[0]&&x[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,x,T)):this._oldHasSelection&&this._fireOnSelectionChange(m,x,T)}_fireOnSelectionChange(m,x,T){this._oldSelectionStart=m,this._oldSelectionEnd=x,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((x=>this._handleTrim(x)))}_convertViewportColToCharacterIndex(m,x){let T=x;for(let I=0;x>=I;I++){let F=m.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:F>1&&x!==I&&(T+=F-1)}return T}setSelection(m,x,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,x],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,x,T=!0,I=!0){if(m[0]>=this._bufferService.cols)return;let F=this._bufferService.buffer,R=F.lines.get(m[1]);if(!R)return;let z=F.translateBufferLineToString(m[1],!1),B=this._convertViewportColToCharacterIndex(R,m[0]),D=B,O=m[0]-B,P=0,b=0,E=0,L=0;if(z.charAt(B)===" "){for(;B>0&&z.charAt(B-1)===" ";)B--;for(;D<z.length&&z.charAt(D+1)===" ";)D++}else{let K=m[0],Y=m[0];R.getWidth(K)===0&&(P++,K--),R.getWidth(Y)===2&&(b++,Y++);let U=R.getString(Y).length;for(U>1&&(L+=U-1,D+=U-1);K>0&&B>0&&!this._isCharWordSeparator(R.loadCell(K-1,this._workCell));){R.loadCell(K-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(P++,K--):A>1&&(E+=A-1,B-=A-1),B--,K--}for(;Y<R.length&&D+1<z.length&&!this._isCharWordSeparator(R.loadCell(Y+1,this._workCell));){R.loadCell(Y+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):A>1&&(L+=A-1,D+=A-1),D++,Y++}}D++;let M=B+O-P+E,$=Math.min(this._bufferService.cols,D-B+P+b-E-L);if(x||z.slice(B,D).trim()!==""){if(T&&M===0&&R.getCodePoint(0)!==32){let K=F.lines.get(m[1]-1);if(K&&R.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let Y=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(Y){let U=this._bufferService.cols-Y.start;M-=U,$+=U}}}if(I&&M+$===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){let K=F.lines.get(m[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let Y=this._getWordAt([0,m[1]+1],!1,!1,!0);Y&&($+=Y.length)}}return{start:M,length:$}}}_selectWordAt(m,x){let T=this._getWordAt(m,x);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[T.start,m[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(m){let x=this._getWordAt(m,!0);if(x){let T=m[1];for(;x.start<0;)x.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;x.start+x.length>this._bufferService.cols;)x.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?x.start:x.start+x.length,T]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let x=this._bufferService.buffer.getWrappedRangeForLine(m),T={start:{x:0,y:x.first},end:{x:this._bufferService.cols-1,y:x.last}};this._model.selectionStart=[0,x.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(T,this._bufferService.cols)}};s.SelectionService=y=a([f(3,v.IBufferService),f(4,v.ICoreService),f(5,S.IMouseService),f(6,v.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],y)},4725:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;let a=r(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(h,s,r){var a=this&&this.__decorate||function(y,m,x,T){var I,F=arguments.length,R=F<3?m:T===null?T=Object.getOwnPropertyDescriptor(m,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,m,x,T);else for(var z=y.length-1;z>=0;z--)(I=y[z])&&(R=(F<3?I(R):F>3?I(m,x,R):I(m,x))||R);return F>3&&R&&Object.defineProperty(m,x,R),R},f=this&&this.__param||function(y,m){return function(x,T){m(x,T,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let o=r(7239),_=r(8055),g=r(8460),S=r(844),p=r(2585),c=_.css.toColor("#ffffff"),d=_.css.toColor("#000000"),l=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let y=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],m=[0,95,135,175,215,255];for(let x=0;x<216;x++){let T=m[x/36%6|0],I=m[x/6%6|0],F=m[x%6];y.push({css:_.channels.toCss(T,I,F),rgba:_.channels.toRgba(T,I,F)})}for(let x=0;x<24;x++){let T=8+10*x;y.push({css:_.channels.toCss(T,T,T),rgba:_.channels.toRgba(T,T,T)})}return y})());let C=s.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(y){super(),this._optionsService=y,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:d,cursor:l,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:_.color.blend(d,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:_.color.blend(d,v),ansi:s.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(y={}){let m=this._colors;if(m.foreground=w(y.foreground,c),m.background=w(y.background,d),m.cursor=w(y.cursor,l),m.cursorAccent=w(y.cursorAccent,u),m.selectionBackgroundTransparent=w(y.selectionBackground,v),m.selectionBackgroundOpaque=_.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=w(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=_.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?w(y.selectionForeground,_.NULL_COLOR):void 0,m.selectionForeground===_.NULL_COLOR&&(m.selectionForeground=void 0),_.color.isOpaque(m.selectionBackgroundTransparent)&&(m.selectionBackgroundTransparent=_.color.opacity(m.selectionBackgroundTransparent,.3)),_.color.isOpaque(m.selectionInactiveBackgroundTransparent)&&(m.selectionInactiveBackgroundTransparent=_.color.opacity(m.selectionInactiveBackgroundTransparent,.3)),m.ansi=s.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=w(y.black,s.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=w(y.red,s.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=w(y.green,s.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=w(y.yellow,s.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=w(y.blue,s.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=w(y.magenta,s.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=w(y.cyan,s.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=w(y.white,s.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=w(y.brightBlack,s.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=w(y.brightRed,s.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=w(y.brightGreen,s.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=w(y.brightYellow,s.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=w(y.brightBlue,s.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=w(y.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=w(y.brightCyan,s.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=w(y.brightWhite,s.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let x=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let T=0;T<x;T++)m.ansi[T+16]=w(y.extendedAnsi[T],s.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(y){this._restoreColor(y),this._onChangeColors.fire(this.colors)}_restoreColor(y){if(y!==void 0)switch(y){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[y]=this._restoreColors.ansi[y]}else for(let m=0;m<this._restoreColors.ansi.length;++m)this._colors.ansi[m]=this._restoreColors.ansi[m]}modifyColors(y){y(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function w(y,m){if(y!==void 0)try{return _.css.toColor(y)}catch{}return m}s.ThemeService=C=a([f(0,p.IOptionsService)],C)},6349:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let a=r(8460),f=r(844);class o extends f.Disposable{constructor(g){super(),this._maxLength=g,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(g){if(this._maxLength===g)return;let S=new Array(g);for(let p=0;p<Math.min(g,this.length);p++)S[p]=this._array[this._getCyclicIndex(p)];this._array=S,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let S=this._length;S<g;S++)this._array[S]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,S){this._array[this._getCyclicIndex(g)]=S}push(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(g,S,...p){if(S){for(let c=g;c<this._length-S;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+S)];this._length-=S,this.onDeleteEmitter.fire({index:g,amount:S})}for(let c=this._length-1;c>=g;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(g+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:g,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(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,S,p){if(!(S<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let d=S-1;d>=0;d--)this.set(g+d+p,this.get(g+d));let c=g+S+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<S;c++)this.set(g+c+p,this.get(g+c))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}s.CircularList=o},1439:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function r(a,f=5){if(typeof a!="object")return a;let o=Array.isArray(a)?[]:{};for(let _ in a)o[_]=f<=1?a[_]:a[_]&&r(a[_],f-1);return o}},8055:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let r=0,a=0,f=0,o=0;var _,g,S,p,c;function d(u){let v=u.toString(16);return v.length<2?"0"+v:v}function l(u,v){return u<v?(v+.05)/(u+.05):(u+.05)/(v+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(v,C,w,y){return y!==void 0?`#${d(v)}${d(C)}${d(w)}${d(y)}`:`#${d(v)}${d(C)}${d(w)}`},u.toRgba=function(v,C,w,y=255){return(v<<24|C<<16|w<<8|y)>>>0},u.toColor=function(v,C,w,y){return{css:u.toCss(v,C,w,y),rgba:u.toRgba(v,C,w,y)}}})(_||(s.channels=_={})),(function(u){function v(C,w){return o=Math.round(255*w),[r,a,f]=c.toChannels(C.rgba),{css:_.toCss(r,a,f,o),rgba:_.toRgba(r,a,f,o)}}u.blend=function(C,w){if(o=(255&w.rgba)/255,o===1)return{css:w.css,rgba:w.rgba};let y=w.rgba>>24&255,m=w.rgba>>16&255,x=w.rgba>>8&255,T=C.rgba>>24&255,I=C.rgba>>16&255,F=C.rgba>>8&255;return r=T+Math.round((y-T)*o),a=I+Math.round((m-I)*o),f=F+Math.round((x-F)*o),{css:_.toCss(r,a,f),rgba:_.toRgba(r,a,f)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,w,y){let m=c.ensureContrastRatio(C.rgba,w.rgba,y);if(m)return _.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let w=(255|C.rgba)>>>0;return[r,a,f]=c.toChannels(w),{css:_.toCss(r,a,f),rgba:w}},u.opacity=v,u.multiplyOpacity=function(C,w){return o=255&C.rgba,v(C,o*w/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(g||(s.color=g={})),(function(u){let v,C;try{let w=document.createElement("canvas");w.width=1,w.height=1;let y=w.getContext("2d",{willReadFrequently:!0});y&&(v=y,v.globalCompositeOperation="copy",C=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(w){if(w.match(/#[\da-f]{3,8}/i))switch(w.length){case 4:return r=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),_.toColor(r,a,f);case 5:return r=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),o=parseInt(w.slice(4,5).repeat(2),16),_.toColor(r,a,f,o);case 7:return{css:w,rgba:(parseInt(w.slice(1),16)<<8|255)>>>0};case 9:return{css:w,rgba:parseInt(w.slice(1),16)>>>0}}let y=w.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(y)return r=parseInt(y[1]),a=parseInt(y[2]),f=parseInt(y[3]),o=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),_.toColor(r,a,f,o);if(!v||!C)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=C,v.fillStyle=w,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[r,a,f,o]=v.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(r,a,f,o),css:w}}})(S||(s.css=S={})),(function(u){function v(C,w,y){let m=C/255,x=w/255,T=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}u.relativeLuminance=function(C){return v(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=v})(p||(s.rgb=p={})),(function(u){function v(w,y,m){let x=w>>24&255,T=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,z=y>>8&255,B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));for(;B<m&&(F>0||R>0||z>0);)F-=Math.max(0,Math.ceil(.1*F)),R-=Math.max(0,Math.ceil(.1*R)),z-=Math.max(0,Math.ceil(.1*z)),B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));return(F<<24|R<<16|z<<8|255)>>>0}function C(w,y,m){let x=w>>24&255,T=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,z=y>>8&255,B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));for(;B<m&&(F<255||R<255||z<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),R=Math.min(255,R+Math.ceil(.1*(255-R))),z=Math.min(255,z+Math.ceil(.1*(255-z))),B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));return(F<<24|R<<16|z<<8|255)>>>0}u.blend=function(w,y){if(o=(255&y)/255,o===1)return y;let m=y>>24&255,x=y>>16&255,T=y>>8&255,I=w>>24&255,F=w>>16&255,R=w>>8&255;return r=I+Math.round((m-I)*o),a=F+Math.round((x-F)*o),f=R+Math.round((T-R)*o),_.toRgba(r,a,f)},u.ensureContrastRatio=function(w,y,m){let x=p.relativeLuminance(w>>8),T=p.relativeLuminance(y>>8);if(l(x,T)<m){if(T<x){let R=v(w,y,m),z=l(x,p.relativeLuminance(R>>8));if(z<m){let B=C(w,y,m);return z>l(x,p.relativeLuminance(B>>8))?R:B}return R}let I=C(w,y,m),F=l(x,p.relativeLuminance(I>>8));if(F<m){let R=v(w,y,m);return F>l(x,p.relativeLuminance(R>>8))?I:R}return I}},u.reduceLuminance=v,u.increaseLuminance=C,u.toChannels=function(w){return[w>>24&255,w>>16&255,w>>8&255,255&w]}})(c||(s.rgba=c={})),s.toPaddedHex=d,s.contrastRatio=l},8969:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let a=r(844),f=r(2585),o=r(4348),_=r(7866),g=r(744),S=r(7302),p=r(6975),c=r(8460),d=r(1753),l=r(1480),u=r(7994),v=r(9282),C=r(5435),w=r(5981),y=r(2660),m=!1;class x extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((I=>{this._onScrollApi?.fire(I.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(I){for(let F in I)this.optionsService.options[F]=I[F]}constructor(I){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 o.InstantiationService,this.optionsService=this.register(new S.OptionsService(I)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(y.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,c.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,c.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,c.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,c.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((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 w.WriteBuffer(((F,R)=>this._inputHandler.parse(F,R)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,F){this._writeBuffer.write(I,F)}writeSync(I,F){this._logService.logLevel<=f.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(I,F)}input(I,F=!0){this.coreService.triggerDataEvent(I,F)}resize(I,F){isNaN(I)||isNaN(F)||(I=Math.max(I,g.MINIMUM_COLS),F=Math.max(F,g.MINIMUM_ROWS),this._bufferService.resize(I,F))}scroll(I,F=!1){this._bufferService.scroll(I,F)}scrollLines(I,F,R){this._bufferService.scrollLines(I,F,R)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){let F=I-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(I,F){return this._inputHandler.registerEscHandler(I,F)}registerDcsHandler(I,F){return this._inputHandler.registerDcsHandler(I,F)}registerCsiHandler(I,F){return this._inputHandler.registerCsiHandler(I,F)}registerOscHandler(I,F){return this._inputHandler.registerOscHandler(I,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1,F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?I=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let I=[];I.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let F of I)F.dispose()}))}}}s.CoreTerminal=x},8460:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=r=>(this._listeners.push(r),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===r)return void this._listeners.splice(a,1)}}})),this._event}fire(r,a){let f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,r,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(r,a){return r((f=>a.fire(f)))},s.runAndSubscribe=function(r,a){return a(void 0),r((f=>a(f)))}},5435:function(h,s,r){var a=this&&this.__decorate||function(P,b,E,L){var M,$=arguments.length,K=$<3?b:L===null?L=Object.getOwnPropertyDescriptor(b,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(P,b,E,L);else for(var Y=P.length-1;Y>=0;Y--)(M=P[Y])&&(K=($<3?M(K):$>3?M(b,E,K):M(b,E))||K);return $>3&&K&&Object.defineProperty(b,E,K),K},f=this&&this.__param||function(P,b){return function(E,L){b(E,L,P)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let o=r(2584),_=r(7116),g=r(2015),S=r(844),p=r(482),c=r(8437),d=r(8460),l=r(643),u=r(511),v=r(3734),C=r(2585),w=r(1480),y=r(6242),m=r(6351),x=r(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function F(P,b){if(P>24)return b.setWinLines||!1;switch(P){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.setWinLines}return!1}var R;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(s.WindowsOptionsReportType=R={}));let z=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,L,M,$,K,Y,U,A=new g.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=L,this._logService=M,this._optionsService=$,this._oscLinkService=K,this._coreMouseService=Y,this._unicodeService=U,this._parser=A,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new D(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:N.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,N,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:N,data:H})})),this._parser.setDcsHandlerFallback(((k,N,H)=>{N==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:N,payload:H})})),this._parser.setPrintHandler(((k,N,H)=>this.print(k,N,H))),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(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new y.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new y.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new y.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new y.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new y.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new y.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new y.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new y.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new y.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new y.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new y.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new y.OscHandler((k=>this.restoreCursorColor(k)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let k in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},(()=>this.selectCharset("("+k))),this._parser.registerEscHandler({intermediates:")",final:k},(()=>this.selectCharset(")"+k))),this._parser.registerEscHandler({intermediates:"*",final:k},(()=>this.selectCharset("*"+k))),this._parser.registerEscHandler({intermediates:"+",final:k},(()=>this.selectCharset("+"+k))),this._parser.registerEscHandler({intermediates:"-",final:k},(()=>this.selectCharset("-"+k))),this._parser.registerEscHandler({intermediates:".",final:k},(()=>this.selectCharset("."+k))),this._parser.registerEscHandler({intermediates:"/",final:k},(()=>this.selectCharset("/"+k)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((k=>(this._logService.error("Parsing error: ",k),k))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler(((k,N)=>this.requestStatusString(k,N))))}_preserveStack(b,E,L,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=L,this._parseStack.position=M}_logSlowResolvingAsync(b){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,E){let L,M=this._activeBuffer.x,$=this._activeBuffer.y,K=0,Y=this._parseStack.paused;if(Y){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(L),L;M=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>I&&(K=this._parseStack.position+I)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(k=>String.fromCharCode(k))).join("")}"`),typeof b=="string"?b.split("").map((k=>k.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(b.length,I))),Y||this._dirtyRowTracker.clearRange(),b.length>I)for(let k=K;k<b.length;k+=I){let N=k+I<b.length?k+I:b.length,H=typeof b=="string"?this._stringDecoder.decode(b.substring(k,N),this._parseBuffer):this._utf8Decoder.decode(b.subarray(k,N),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,$,H,k),this._logSlowResolvingAsync(L),L}else if(!Y){let k=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,k))return this._preserveStack(M,$,k,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===M&&this._activeBuffer.y===$||this._onCursorMove.fire();let U=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),A=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);A<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(A,this._bufferService.rows-1),Math.min(U,this._bufferService.rows-1))}print(b,E,L){let M,$,K=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,U=this._bufferService.cols,A=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,N=this._curAttrData,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-E>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let q=this._parser.precedingJoinState;for(let j=E;j<L;++j){if(M=b[j],M<127&&K){let J=K[String.fromCharCode(M)];J&&(M=J.charCodeAt(0))}let Q=this._unicodeService.charProperties(M,q);$=w.UnicodeService.extractWidth(Q);let ee=w.UnicodeService.extractShouldJoin(Q),G=ee?w.UnicodeService.extractWidth(q):0;if(q=Q,Y&&this._onA11yChar.fire((0,p.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-G>U){if(A){let J=H,Z=this._activeBuffer.x-G;for(this._activeBuffer.x=G,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),G>0&&H instanceof c.BufferLine&&H.copyCellsFrom(J,Z,0,G,!1);Z<U;)J.setCellFromCodepoint(Z++,0,1,N)}else if(this._activeBuffer.x=U-1,$===2)continue}if(ee&&this._activeBuffer.x){let J=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-J,M,$);for(let Z=$-G;--Z>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(k&&(H.insertCells(this._activeBuffer.x,$-G,this._activeBuffer.getNullCell(N)),H.getWidth(U-1)===2&&H.setCellFromCodepoint(U-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,N)),H.setCellFromCodepoint(this._activeBuffer.x++,M,$,N),$>0)for(;--$;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=q,this._activeBuffer.x<U&&L-E>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,E){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,E):this._parser.registerCsiHandler(b,(L=>!F(L.params[0],this._optionsService.rawOptions.windowOptions)||E(L)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new m.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,new y.OscHandler(E))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=b,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+E)}cursorUp(b){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let E=b.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let E=b.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,E,L,M=!1,$=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,L,this._activeBuffer.getNullCell(this._eraseAttrData()),$),M&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),L.isWrapped=!1)}eraseInDisplay(b,E=!1){let L;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);L<this._bufferService.rows;L++)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 3:let M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(b,E=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;E--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;E--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let E=b.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(b){let E=b.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(c.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let E=this._parser.precedingJoinState;if(!E)return!0;let L=b.params[0]||1,M=w.UnicodeService.extractWidth(E),$=this._activeBuffer.x-M,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),Y=new Uint32Array(K.length*L),U=0;for(let k=0;k<K.length;){let N=K.codePointAt(k)||0;Y[U++]=N,k+=N>65535?2:1}let A=U;for(let k=1;k<L;++k)Y.copyWithin(A,0,U),A+=U;return this.print(Y,0,A),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.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(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),b.params[E]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(b,E){let L=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:$}=this._coreMouseService,K=this._coreService,{buffers:Y,cols:U}=this._bufferService,{active:A,alt:k}=Y,N=this._optionsService.rawOptions,H=ee=>ee?1:2,q=b.params[0];return j=q,Q=E?q===2?4:q===4?H(K.modes.insertMode):q===12?3:q===20?H(N.convertEol):0:q===1?H(L.applicationCursorKeys):q===3?N.windowOptions.setWinLines?U===80?2:U===132?1:0:0:q===6?H(L.origin):q===7?H(L.wraparound):q===8?3:q===9?H(M==="X10"):q===12?H(N.cursorBlink):q===25?H(!K.isCursorHidden):q===45?H(L.reverseWraparound):q===66?H(L.applicationKeypad):q===67?4:q===1e3?H(M==="VT200"):q===1002?H(M==="DRAG"):q===1003?H(M==="ANY"):q===1004?H(L.sendFocus):q===1005?4:q===1006?H($==="SGR"):q===1015?4:q===1016?H($==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?H(A===k):q===2004?H(L.bracketedPasteMode):0,K.triggerDataEvent(`${o.C0.ESC}[${E?"":"?"}${j};${Q}$y`),!0;var j,Q}_updateAttrColor(b,E,L,M,$){return E===2?(b|=50331648,b&=-16777216,b|=v.AttributeData.fromColorRGB([L,M,$])):E===5&&(b&=-50331904,b|=33554432|255&L),b}_extractColor(b,E,L){let M=[0,0,-1,0,0,0],$=0,K=0;do{if(M[K+$]=b.params[E+K],b.hasSubParams(E+K)){let Y=b.getSubParams(E+K),U=0;do M[1]===5&&($=1),M[K+U+1+$]=Y[U];while(++U<Y.length&&U+K+1+$<M.length);break}if(M[1]===5&&K+$>=2||M[1]===2&&K+$>=5)break;M[1]&&($=1)}while(++K+E<b.length&&K+$<M.length);for(let Y=2;Y<M.length;++Y)M[Y]===-1&&(M[Y]=0);switch(M[0]){case 38:L.fg=this._updateAttrColor(L.fg,M[1],M[3],M[4],M[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,M[1],M[3],M[4],M[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,M[1],M[3],M[4],M[5])}return K}_processUnderline(b,E){E.extended=E.extended.clone(),(!~b||b>5)&&(b=1),E.extended.underlineStyle=b,E.fg|=268435456,b===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(b){b.fg=c.DEFAULT_ATTR_DATA.fg,b.bg=c.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let E=b.length,L,M=this._curAttrData;for(let $=0;$<E;$++)L=b.params[$],L>=30&&L<=37?(M.fg&=-50331904,M.fg|=16777216|L-30):L>=40&&L<=47?(M.bg&=-50331904,M.bg|=16777216|L-40):L>=90&&L<=97?(M.fg&=-50331904,M.fg|=16777224|L-90):L>=100&&L<=107?(M.bg&=-50331904,M.bg|=16777224|L-100):L===0?this._processSGR0(M):L===1?M.fg|=134217728:L===3?M.bg|=67108864:L===4?(M.fg|=268435456,this._processUnderline(b.hasSubParams($)?b.getSubParams($)[0]:1,M)):L===5?M.fg|=536870912:L===7?M.fg|=67108864:L===8?M.fg|=1073741824:L===9?M.fg|=2147483648:L===2?M.bg|=134217728:L===21?this._processUnderline(2,M):L===22?(M.fg&=-134217729,M.bg&=-134217729):L===23?M.bg&=-67108865:L===24?(M.fg&=-268435457,this._processUnderline(0,M)):L===25?M.fg&=-536870913:L===27?M.fg&=-67108865:L===28?M.fg&=-1073741825:L===29?M.fg&=2147483647:L===39?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):L===49?(M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?$+=this._extractColor(b,$,M):L===53?M.bg|=1073741824:L===55?M.bg&=-1073741825:L===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):L===100?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${E};${L}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${E};${L}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(b){let E=b.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let L=E%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(b){let E=b.params[0]||1,L;return(b.length<2||(L=b.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(b){if(!F(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let E=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(R.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(R.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let E=[],L=b.split(";");for(;L.length>1;){let M=L.shift(),$=L.shift();if(/^\d+$/.exec(M)){let K=parseInt(M);if(O(K))if($==="?")E.push({type:0,index:K});else{let Y=(0,x.parseColor)($);Y&&E.push({type:1,index:K,color:Y})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(b){let E=b.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(b,E){this._getCurrentLinkId()&&this._finishHyperlink();let L=b.split(":"),M,$=L.findIndex((K=>K.startsWith("id=")));return $!==-1&&(M=L[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,E){let L=b.split(";");for(let M=0;M<L.length&&!(E>=this._specialColors.length);++M,++E)if(L[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let $=(0,x.parseColor)(L[M]);$&&this._onColor.fire([{type:1,index:this._specialColors[E],color:$}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let E=[],L=b.split(";");for(let M=0;M<L.length;++M)if(/^\d+$/.exec(L[M])){let $=parseInt(L[M]);O($)&&E.push({type:2,index:$})}return E.length&&this._onColor.fire(E),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(T[b[0]],_.CHARSETS[b[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 b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new u.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){let L=this._activeBuffer.ybase+this._activeBuffer.y+E,M=this._activeBuffer.lines.get(L);M&&(M.fill(b),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let L=this._bufferService.buffer,M=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${$}${o.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}s.InputHandler=B;let D=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){P<this.start?this.start=P:P>this.end&&(this.end=P)}markRangeDirty(P,b){P>b&&(z=P,P=b,b=z),P<this.start&&(this.start=P),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function O(P){return 0<=P&&P<256}D=a([f(0,C.IBufferService)],D)},844:(h,s)=>{function r(a){for(let f of a)f.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 f=this._disposables.indexOf(a);f!==-1&&this._disposables.splice(f,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(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=r,s.getDisposeArrayDisposable=function(a){return{dispose:()=>r(a)}}},1505:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class r{constructor(){this._data={}}set(f,o,_){this._data[f]||(this._data[f]={}),this._data[f][o]=_}get(f,o){return this._data[f]?this._data[f][o]:void 0}clear(){this._data={}}}s.TwoKeyMap=r,s.FourKeyMap=class{constructor(){this._data=new r}set(a,f,o,_,g){this._data.get(a,f)||this._data.set(a,f,new r),this._data.get(a,f).set(o,_,g)}get(a,f,o,_){return this._data.get(a,f)?.get(o,_)}clear(){this._data.clear()}}},6114:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;let r=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=r.includes("Firefox"),s.isLegacyEdge=r.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(r),s.getSafariVersion=function(){if(!s.isSafari)return 0;let f=r.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(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(r)},6106:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let r=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(r=this._search(this._getKey(a)),this._array.splice(r,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let f=this._getKey(a);if(f===void 0||(r=this._search(f),r===-1)||this._getKey(this._array[r])!==f)return!1;do if(this._array[r]===a)return this._array.splice(r,1),!0;while(++r<this._array.length&&this._getKey(this._array[r])===f);return!1}*getKeyIterator(a){if(this._array.length!==0&&(r=this._search(a),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===a))do yield this._array[r];while(++r<this._array.length&&this._getKey(this._array[r])===a)}forEachByKey(a,f){if(this._array.length!==0&&(r=this._search(a),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===a))do f(this._array[r]);while(++r<this._array.length&&this._getKey(this._array[r])===a)}values(){return[...this._array].values()}_search(a){let f=0,o=this._array.length-1;for(;o>=f;){let _=f+o>>1,g=this._getKey(this._array[_]);if(g>a)o=_-1;else{if(!(g<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}f=_+1}}return f}}},7226:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let a=r(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(g){this._idleCallback=void 0;let S=0,p=0,c=g.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),p=Math.max(S,p),d=g.timeRemaining(),1.5*p>d)return c-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-S))}ms`),void this._start();c=d}this.clear()}}class o extends f{_requestCallback(g){return setTimeout((()=>g(this._createDeadline(16))))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){let S=Date.now()+g;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}s.PriorityTaskQueue=o,s.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:o,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let a=r(643);s.updateWindowsModeWrappedState=function(f){let o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=o?.get(f.cols-1),g=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);g&&_&&(g.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class r{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){let o=new r;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}s.AttributeData=r;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}get underlineVariantOffset(){let o=(3758096384&this._ext)>>29;return o<0?4294967288^o:o}set underlineVariantOffset(o){this._ext&=536870911,this._ext|=o<<29&3758096384}constructor(o=0,_=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=_}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let a=r(6349),f=r(7226),o=r(3734),_=r(8437),g=r(4634),S=r(511),p=r(643),c=r(4863),d=r(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(l,u,v){this._hasScrollback=l,this._optionsService=u,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,u){return new _.BufferLine(this._bufferService.cols,this.getNullCell(l),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;let u=l+this._optionsService.rawOptions.scrollback;return u>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:u}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=_.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,u){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),C=0,w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<l)for(let m=0;m<this.lines.length;m++)C+=+this.lines.get(m).resize(l,v);let y=0;if(this._rows<u)for(let m=this._rows;m<u;m++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(l,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+y+1?(this.ybase--,y++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(l,v)));else for(let m=this._rows;m>u;m--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){let m=this.lines.length-w;m>0&&(this.lines.trimStart(m),this.ybase=Math.max(this.ybase-m,0),this.ydisp=Math.max(this.ydisp-m,0),this.savedY=Math.max(this.savedY-m,0)),this.lines.maxLength=w}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,u-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(l,u),this._cols>l))for(let y=0;y<this.lines.length;y++)C+=+this.lines.get(y).resize(l,v);this._cols=l,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return l}get _isReflowEnabled(){let l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,u){this._cols!==l&&(l>this._cols?this._reflowLarger(l,u):this._reflowSmaller(l,u))}_reflowLarger(l,u){let v=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(v.length>0){let C=(0,g.reflowLargerCreateNewLayout)(this.lines,v);(0,g.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(l,u,C.countRemoved)}}_reflowLargerAdjustViewport(l,u,v){let C=this.getNullCell(_.DEFAULT_ATTR_DATA),w=v;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new _.BufferLine(l,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(l,u){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),C=[],w=0;for(let y=this.lines.length-1;y>=0;y--){let m=this.lines.get(y);if(!m||!m.isWrapped&&m.getTrimmedLength()<=l)continue;let x=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),x.unshift(m);let T=this.ybase+this.y;if(T>=y&&T<y+x.length)continue;let I=x[x.length-1].getTrimmedLength(),F=(0,g.reflowSmallerGetNewLineLengths)(x,this._cols,l),R=F.length-x.length,z;z=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+R):Math.max(0,this.lines.length-this.lines.maxLength+R);let B=[];for(let L=0;L<R;L++){let M=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(M)}B.length>0&&(C.push({start:y+x.length+w,newLines:B}),w+=B.length),x.push(...B);let D=F.length-1,O=F[D];O===0&&(D--,O=F[D]);let P=x.length-R-1,b=I;for(;P>=0;){let L=Math.min(b,O);if(x[D]===void 0)break;if(x[D].copyCellsFrom(x[P],b-L,O-L,L,!0),O-=L,O===0&&(D--,O=F[D]),b-=L,b===0){P--;let M=Math.max(P,0);b=(0,g.getWrappedLineTrimmedLength)(x,M,this._cols)}}for(let L=0;L<x.length;L++)F[L]<l&&x[L].setCell(F[L],v);let E=R-z;for(;E-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+R,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let D=0;D<this.lines.length;D++)m.push(this.lines.get(D));let x=this.lines.length,T=x-1,I=0,F=C[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let R=0;for(let D=Math.min(this.lines.maxLength-1,x+w-1);D>=0;D--)if(F&&F.start>T+R){for(let O=F.newLines.length-1;O>=0;O--)this.lines.set(D--,F.newLines[O]);D++,y.push({index:T+1,amount:F.newLines.length}),R+=F.newLines.length,F=C[++I]}else this.lines.set(D,m[T--]);let z=0;for(let D=y.length-1;D>=0;D--)y[D].index+=z,this.lines.onInsertEmitter.fire(y[D]),z+=y[D].amount;let B=Math.max(0,x+w-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(l,u,v=0,C){let w=this.lines.get(l);return w?w.translateToString(u,v,C):""}getWrappedRangeForLine(l){let u=l,v=l;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:u,last:v}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===l&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){let u=new c.Marker(l);return this.markers.push(u),u.register(this.lines.onTrim((v=>{u.line-=v,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((v=>{u.line>=v.index&&(u.line+=v.amount)}))),u.register(this.lines.onDelete((v=>{u.line>=v.index&&u.line<v.index+v.amount&&u.dispose(),u.line>v.index&&(u.line-=v.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let a=r(3734),f=r(511),o=r(643),_=r(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let g=0;class S{constructor(c,d,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let u=d||f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let v=0;v<c;++v)this.setCell(v,u);this.length=c}get(c){let d=this._data[3*c+0],l=2097151&d;return[this._data[3*c+1],2097152&d?this._combined[c]:l?(0,_.stringFromCodePoint)(l):"",d>>22,2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):l]}set(c,d){this._data[3*c+1]=d[o.CHAR_DATA_ATTR_INDEX],d[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=d[1],this._data[3*c+0]=2097152|c|d[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=d[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(c){return this._data[3*c+0]>>22}hasWidth(c){return 12582912&this._data[3*c+0]}getFg(c){return this._data[3*c+1]}getBg(c){return this._data[3*c+2]}hasContent(c){return 4194303&this._data[3*c+0]}getCodePoint(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&d}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c]:2097151&d?(0,_.stringFromCodePoint)(2097151&d):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,d){return g=3*c,d.content=this._data[g+0],d.fg=this._data[g+1],d.bg=this._data[g+2],2097152&d.content&&(d.combinedData=this._combined[c]),268435456&d.bg&&(d.extended=this._extendedAttrs[c]),d}setCell(c,d){2097152&d.content&&(this._combined[c]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[c]=d.extended),this._data[3*c+0]=d.content,this._data[3*c+1]=d.fg,this._data[3*c+2]=d.bg}setCellFromCodepoint(c,d,l,u){268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=d|l<<22,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}addCodepointToCell(c,d,l){let u=this._data[3*c+0];2097152&u?this._combined[c]+=(0,_.stringFromCodePoint)(d):2097151&u?(this._combined[c]=(0,_.stringFromCodePoint)(2097151&u)+(0,_.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,l&&(u&=-12582913,u|=l<<22),this._data[3*c+0]=u}insertCells(c,d,l){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length-c){let u=new f.CellData;for(let v=this.length-c-d-1;v>=0;--v)this.setCell(c+d+v,this.loadCell(c+v,u));for(let v=0;v<d;++v)this.setCell(c+v,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(c,d,l){if(c%=this.length,d<this.length-c){let u=new f.CellData;for(let v=0;v<this.length-c-d;++v)this.setCell(c+v,this.loadCell(c+d+v,u));for(let v=this.length-d;v<this.length;++v)this.setCell(v,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,l)}replaceCells(c,d,l,u=!1){if(u)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.isProtected(c)||this.setCell(c,l),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.setCell(c++,l)}resize(c,d){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let l=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{let u=new Uint32Array(l);u.set(this._data),this._data=u}for(let u=this.length;u<c;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,l);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let w=parseInt(u[C],10);w>=c&&delete this._combined[w]}let v=Object.keys(this._extendedAttrs);for(let C=0;C<v.length;C++){let w=parseInt(v[C],10);w>=c&&delete this._extendedAttrs[w]}}return this.length=c,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let c=new Uint32Array(this._data.length);return c.set(this._data),this._data=c,1}return 0}fill(c,d=!1){if(d)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,c);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,c)}}copyFrom(c){this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={};for(let d in c._combined)this._combined[d]=c._combined[d];this._extendedAttrs={};for(let d in c._extendedAttrs)this._extendedAttrs[d]=c._extendedAttrs[d];this.isWrapped=c.isWrapped}clone(){let c=new S(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let d in this._combined)c._combined[d]=this._combined[d];for(let d in this._extendedAttrs)c._extendedAttrs[d]=this._extendedAttrs[d];return c.isWrapped=this.isWrapped,c}getTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0}getNoBgTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0]||50331648&this._data[3*c+2])return c+(this._data[3*c+0]>>22);return 0}copyCellsFrom(c,d,l,u,v){let C=c._data;if(v)for(let y=u-1;y>=0;y--){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}let w=Object.keys(c._combined);for(let y=0;y<w.length;y++){let m=parseInt(w[y],10);m>=d&&(this._combined[m-d+l]=c._combined[m])}}translateToString(c,d,l,u){d=d??0,l=l??this.length,c&&(l=Math.min(l,this.getTrimmedLength())),u&&(u.length=0);let v="";for(;d<l;){let C=this._data[3*d+0],w=2097151&C,y=2097152&C?this._combined[d]:w?(0,_.stringFromCodePoint)(w):o.WHITESPACE_CELL_CHAR;if(v+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),v}}s.BufferLine=S},4841:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(r,a){if(r.start.y>r.end.y)throw new Error(`Buffer range end (${r.end.x}, ${r.end.y}) cannot be before start (${r.start.x}, ${r.start.y})`);return a*(r.end.y-r.start.y)+(r.end.x-r.start.x+1)}},4634:(h,s)=>{function r(a,f,o){if(f===a.length-1)return a[f].getTrimmedLength();let _=!a[f].hasContent(o-1)&&a[f].getWidth(o-1)===1,g=a[f+1].getWidth(0)===2;return _&&g?o-1:o}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(a,f,o,_,g){let S=[];for(let p=0;p<a.length-1;p++){let c=p,d=a.get(++c);if(!d.isWrapped)continue;let l=[a.get(p)];for(;c<a.length&&d.isWrapped;)l.push(d),d=a.get(++c);if(_>=p&&_<c){p+=l.length-1;continue}let u=0,v=r(l,u,f),C=1,w=0;for(;C<l.length;){let m=r(l,C,f),x=m-w,T=o-v,I=Math.min(x,T);l[u].copyCellsFrom(l[C],w,v,I,!1),v+=I,v===o&&(u++,v=0),w+=I,w===m&&(C++,w=0),v===0&&u!==0&&l[u-1].getWidth(o-1)===2&&(l[u].copyCellsFrom(l[u-1],o-1,v++,1,!1),l[u-1].setCell(o-1,g))}l[u].replaceCells(v,o,g);let y=0;for(let m=l.length-1;m>0&&(m>u||l[m].getTrimmedLength()===0);m--)y++;y>0&&(S.push(p+l.length-y),S.push(y)),p+=l.length-1}return S},s.reflowLargerCreateNewLayout=function(a,f){let o=[],_=0,g=f[_],S=0;for(let p=0;p<a.length;p++)if(g===p){let c=f[++_];a.onDeleteEmitter.fire({index:p-S,amount:c}),p+=c-1,S+=c,g=f[++_]}else o.push(p);return{layout:o,countRemoved:S}},s.reflowLargerApplyNewLayout=function(a,f){let o=[];for(let _=0;_<f.length;_++)o.push(a.get(f[_]));for(let _=0;_<o.length;_++)a.set(_,o[_]);a.length=f.length},s.reflowSmallerGetNewLineLengths=function(a,f,o){let _=[],g=a.map(((d,l)=>r(a,l,f))).reduce(((d,l)=>d+l)),S=0,p=0,c=0;for(;c<g;){if(g-c<o){_.push(g-c);break}S+=o;let d=r(a,p,f);S>d&&(S-=d,p++);let l=a[p].getWidth(S-1)===2;l&&S--;let u=l?o-1:o;_.push(u),c+=u}return _},s.getWrappedLineTrimmedLength=r},5295:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let a=r(8460),f=r(844),o=r(9092);class _ extends f.Disposable{constructor(S,p){super(),this._optionsService=S,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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(S,p){this._normal.resize(S,p),this._alt.resize(S,p),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}s.BufferSet=_},511:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let a=r(482),f=r(643),o=r(3734);class _ extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(S){let p=new _;return p.setFromCharData(S),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(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){let c=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let d=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(c-55296)+d-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=_},643:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let a=r(8460),f=r(844);class o{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new a.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}s.Marker=o,o._nextId=1},7116:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},s.CHARSETS.A={"#":"\xA3"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},s.CHARSETS.C=s.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},s.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},s.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},s.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},s.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},s.CHARSETS.E=s.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},s.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},s.CHARSETS.H=s.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},s.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(h,s)=>{var r,a,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
8
|
-
`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="\x7F"})(r||(s.C0=r={})),(function(o){o.PAD="\x80",o.HOP="\x81",o.BPH="\x82",o.NBH="\x83",o.IND="\x84",o.NEL="\x85",o.SSA="\x86",o.ESA="\x87",o.HTS="\x88",o.HTJ="\x89",o.VTS="\x8A",o.PLD="\x8B",o.PLU="\x8C",o.RI="\x8D",o.SS2="\x8E",o.SS3="\x8F",o.DCS="\x90",o.PU1="\x91",o.PU2="\x92",o.STS="\x93",o.CCH="\x94",o.MW="\x95",o.SPA="\x96",o.EPA="\x97",o.SOS="\x98",o.SGCI="\x99",o.SCI="\x9A",o.CSI="\x9B",o.ST="\x9C",o.OSC="\x9D",o.PM="\x9E",o.APC="\x9F"})(a||(s.C1=a={})),(function(o){o.ST=`${r.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let a=r(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};s.evaluateKeyboardEvent=function(o,_,g,S){let p={type:0,cancel:!1,key:void 0},c=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=o.ctrlKey?"\b":a.C0.DEL,o.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(o.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=o.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,o.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(o.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(g?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(o.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(g?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(o.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"A",g||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(o.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"B",g||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:o.shiftKey||o.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:o.shiftKey?p.type=2:o.ctrlKey?p.key=a.C0.ESC+"[5;"+(c+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:o.shiftKey?p.type=3:o.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(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(g&&!S||!o.altKey||o.metaKey)!g||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?p.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(p.key=a.C0.US),o.key==="@"&&(p.key=a.C0.NUL)):o.keyCode===65&&(p.type=1);else{let d=f[o.keyCode],l=d?.[o.shiftKey?1:0];if(l)p.key=a.C0.ESC+l;else if(o.keyCode>=65&&o.keyCode<=90){let u=o.ctrlKey?o.keyCode-64:o.keyCode+32,v=String.fromCharCode(u);o.shiftKey&&(v=v.toUpperCase()),p.key=a.C0.ESC+v}else if(o.keyCode===32)p.key=a.C0.ESC+(o.ctrlKey?a.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let u=o.code.slice(3,4);o.shiftKey||(u=u.toLowerCase()),p.key=a.C0.ESC+u,p.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?p.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?p.key=a.C0.NUL:o.keyCode>=51&&o.keyCode<=55?p.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?p.key=a.C0.DEL:o.keyCode===219?p.key=a.C0.ESC:o.keyCode===220?p.key=a.C0.FS:o.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(r){return r>65535?(r-=65536,String.fromCharCode(55296+(r>>10))+String.fromCharCode(r%1024+56320)):String.fromCharCode(r)},s.utf32ToString=function(r,a=0,f=r.length){let o="";for(let _=a;_<f;++_){let g=r[_];g>65535?(g-=65536,o+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):o+=String.fromCharCode(g)}return o},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(r,a){let f=r.length;if(!f)return 0;let o=0,_=0;if(this._interim){let g=r.charCodeAt(_++);56320<=g&&g<=57343?a[o++]=1024*(this._interim-55296)+g-56320+65536:(a[o++]=this._interim,a[o++]=g),this._interim=0}for(let g=_;g<f;++g){let S=r.charCodeAt(g);if(55296<=S&&S<=56319){if(++g>=f)return this._interim=S,o;let p=r.charCodeAt(g);56320<=p&&p<=57343?a[o++]=1024*(S-55296)+p-56320+65536:(a[o++]=S,a[o++]=p)}else S!==65279&&(a[o++]=S)}return o}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(r,a){let f=r.length;if(!f)return 0;let o,_,g,S,p=0,c=0,d=0;if(this.interim[0]){let v=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,y=0;for(;(w=63&this.interim[++y])&&y<4;)C<<=6,C|=w;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=m-y;for(;d<x;){if(d>=f)return 0;if(w=r[d++],(192&w)!=128){d--,v=!0;break}this.interim[y++]=w,C<<=6,C|=63&w}v||(m===2?C<128?d--:a[p++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(a[p++]=C):C<65536||C>1114111||(a[p++]=C)),this.interim.fill(0)}let l=f-4,u=d;for(;u<f;){for(;!(!(u<l)||128&(o=r[u])||128&(_=r[u+1])||128&(g=r[u+2])||128&(S=r[u+3]));)a[p++]=o,a[p++]=_,a[p++]=g,a[p++]=S,u+=4;if(o=r[u++],o<128)a[p++]=o;else if((224&o)==192){if(u>=f)return this.interim[0]=o,p;if(_=r[u++],(192&_)!=128){u--;continue}if(c=(31&o)<<6|63&_,c<128){u--;continue}a[p++]=c}else if((240&o)==224){if(u>=f)return this.interim[0]=o,p;if(_=r[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=_,p;if(g=r[u++],(192&g)!=128){u--;continue}if(c=(15&o)<<12|(63&_)<<6|63&g,c<2048||c>=55296&&c<=57343||c===65279)continue;a[p++]=c}else if((248&o)==240){if(u>=f)return this.interim[0]=o,p;if(_=r[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=_,p;if(g=r[u++],(192&g)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=_,this.interim[2]=g,p;if(S=r[u++],(192&S)!=128){u--;continue}if(c=(7&o)<<18|(63&_)<<12|(63&g)<<6|63&S,c<65536||c>1114111)continue;a[p++]=c}}return p}}},225:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let a=r(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],o=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],_;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 g=0;g<f.length;++g)_.fill(0,f[g][0],f[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?_[g]:(function(S,p){let c,d=0,l=p.length-1;if(S<p[0][0]||S>p[l][1])return!1;for(;l>=d;)if(c=d+l>>1,S>p[c][1])d=c+1;else{if(!(S<p[c][0]))return!0;l=c-1}return!1})(g,o)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,S){let p=this.wcwidth(g),c=p===0&&S!==0;if(c){let d=a.UnicodeService.extractWidth(S);d===0?c=!1:d>p&&(p=d)}return a.UnicodeService.createPropertyValue(0,p,c)}}},5981:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let a=r(8460),f=r(844);class o extends f.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,S){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(S)}_innerWrite(g=0,S=!0){let p=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],d=this._action(c,S);if(d){let u=v=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(p,v);return void d.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(u)}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-p>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}s.WriteBuffer=o},5941:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let r=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,a=/^[\da-f]+$/;function f(o,_){let g=o.toString(16),S=g.length<2?"0"+g:g;switch(_){case 4:return g[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}s.parseColor=function(o){if(!o)return;let _=o.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let g=r.exec(_);if(g){let S=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/S*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/S*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/S*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let g=_.length/3,S=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(_.slice(g*p,g*p+g),16);S[p]=g===1?c<<4:g===2?c:g===3?c>>4:c>>8}return S}},s.toRgbString=function(o,_=16){let[g,S,p]=o;return`rgb:${f(g,_)}/${f(S,_)}/${f(p,_)}`}},5770:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let a=r(482),f=r(8742),o=r(5770),_=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(S,p){this._handlers[S]===void 0&&(this._handlers[S]=[]);let c=this._handlers[S];return c.push(p),{dispose:()=>{let d=c.indexOf(p);d!==-1&&c.splice(d,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(S,p){if(this.reset(),this._ident=S,this._active=this._handlers[S]||_,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(S,p,c){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(S,p,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(S,p,c))}unhook(S,p=!0){if(this._active.length){let c=!1,d=this._active.length-1,l=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,c=p,l=this._stack.fallThrough,this._stack.paused=!1),!l&&c===!1){for(;d>=0&&(c=this._active[d].unhook(S),c!==!0);d--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,c;d--}for(;d>=0;d--)if(c=this._active[d].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",S);this._active=_,this._ident=0}};let g=new f.Params;g.addParam(0),s.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=g,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():g,this._data="",this._hitLimit=!1}put(S,p,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(S,p,c),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let p=!1;if(this._hitLimit)p=!1;else if(S&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=g,this._data="",this._hitLimit=!1,c)));return this._params=g,this._data="",this._hitLimit=!1,p}}},2015:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let a=r(844),f=r(8742),o=r(6242),_=r(6351);class g{constructor(d){this.table=new Uint8Array(d)}setDefault(d,l){this.table.fill(d<<4|l)}add(d,l,u,v){this.table[l<<8|d]=u<<4|v}addMany(d,l,u,v){for(let C=0;C<d.length;C++)this.table[l<<8|d[C]]=u<<4|v}}s.TransitionTable=g;let S=160;s.VT500_TRANSITION_TABLE=(function(){let c=new g(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),l=(y,m)=>d.slice(y,m),u=l(32,127),v=l(0,24);v.push(25),v.push.apply(v,l(28,32));let C=l(0,14),w;for(w in c.setDefault(1,0),c.addMany(u,0,2,0),C)c.addMany([24,26,153,154],w,3,0),c.addMany(l(128,144),w,3,0),c.addMany(l(144,152),w,3,0),c.add(156,w,0,0),c.add(27,w,11,1),c.add(157,w,4,8),c.addMany([152,158,159],w,0,7),c.add(155,w,11,3),c.add(144,w,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(u,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(l(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(u,7,0,7),c.addMany(v,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(l(64,127),3,7,0),c.addMany(l(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(l(48,60),4,8,4),c.addMany(l(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(l(32,64),6,0,6),c.add(127,6,0,6),c.addMany(l(64,127),6,0,0),c.addMany(l(32,48),3,9,5),c.addMany(l(32,48),5,9,5),c.addMany(l(48,64),5,0,6),c.addMany(l(64,127),5,7,0),c.addMany(l(32,48),4,9,5),c.addMany(l(32,48),1,9,2),c.addMany(l(32,48),2,9,2),c.addMany(l(48,127),2,10,0),c.addMany(l(48,80),1,10,0),c.addMany(l(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(l(96,127),1,10,0),c.add(80,1,11,9),c.addMany(v,9,0,9),c.add(127,9,0,9),c.addMany(l(28,32),9,0,9),c.addMany(l(32,48),9,9,12),c.addMany(l(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(v,11,0,11),c.addMany(l(32,128),11,0,11),c.addMany(l(28,32),11,0,11),c.addMany(v,10,0,10),c.add(127,10,0,10),c.addMany(l(28,32),10,0,10),c.addMany(l(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(l(32,48),10,9,12),c.addMany(v,12,0,12),c.add(127,12,0,12),c.addMany(l(28,32),12,0,12),c.addMany(l(32,48),12,9,12),c.addMany(l(48,64),12,0,11),c.addMany(l(64,127),12,12,13),c.addMany(l(64,127),10,12,13),c.addMany(l(64,127),9,12,13),c.addMany(v,13,13,13),c.addMany(u,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(S,0,2,0),c.add(S,8,5,8),c.add(S,6,0,6),c.add(S,11,0,11),c.add(S,13,13,13),c})();class p extends a.Disposable{constructor(d=s.VT500_TRANSITION_TABLE){super(),this._transitions=d,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(l,u,v)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,u)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,a.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,l=[64,126]){let u=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=d.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<d.intermediates.length;++C){let w=d.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");let v=d.final.charCodeAt(0);if(l[0]>v||v>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return u<<=8,u|=v,u}identToString(d){let l=[];for(;d;)l.push(String.fromCharCode(255&d)),d>>=8;return l.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,l){let u=this._identifier(d,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let v=this._escHandlers[u];return v.push(l),{dispose:()=>{let C=v.indexOf(l);C!==-1&&v.splice(C,1)}}}clearEscHandler(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,l){this._executeHandlers[d.charCodeAt(0)]=l}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,l){let u=this._identifier(d);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let v=this._csiHandlers[u];return v.push(l),{dispose:()=>{let C=v.indexOf(l);C!==-1&&v.splice(C,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,l){return this._dcsParser.registerHandler(this._identifier(d),l)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,l){return this._oscParser.registerHandler(d,l)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(d,l,u,v,C){this._parseStack.state=d,this._parseStack.handlers=l,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=C}parse(d,l,u){let v,C=0,w=0,y=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,y=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let m=this._parseStack.handlers,x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](this._params),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 6:if(C=d[this._parseStack.chunkPos],v=this._dcsParser.unhook(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=d[this._parseStack.chunkPos],v=this._oscParser.end(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,y=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let m=y;m<l;++m){switch(C=d[m],w=this._transitions.table[this.currentState<<8|(C<160?C:S)],w>>4){case 2:for(let R=m+1;;++R){if(R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:m,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let x=this._csiHandlers[this._collect<<8|C],T=x?x.length-1:-1;for(;T>=0&&(v=x[T](this._params),v!==!0);T--)if(v instanceof Promise)return this._preserveStack(3,x,T,w,m),v;T<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++m<l&&(C=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let I=this._escHandlers[this._collect<<8|C],F=I?I.length-1:-1;for(;F>=0&&(v=I[F](),v!==!0);F--)if(v instanceof Promise)return this._preserveStack(4,I,F,w,m),v;F<0&&this._escHandlerFb(this._collect<<8|C),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|C,this._params);break;case 13:for(let R=m+1;;++R)if(R>=l||(C=d[R])===24||C===26||C===27||C>127&&C<S){this._dcsParser.put(d,m,R),m=R-1;break}break;case 14:if(v=this._dcsParser.unhook(C!==24&&C!==26),v)return this._preserveStack(6,[],0,w,m),v;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let R=m+1;;R++)if(R>=l||(C=d[R])<32||C>127&&C<S){this._oscParser.put(d,m,R),m=R-1;break}break;case 6:if(v=this._oscParser.end(C!==24&&C!==26),v)return this._preserveStack(5,[],0,w,m),v;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}s.EscapeSequenceParser=p},6242:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let a=r(5770),f=r(482),o=[];s.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,g){this._handlers[_]===void 0&&(this._handlers[_]=[]);let S=this._handlers[_];return S.push(g),{dispose:()=>{let p=S.indexOf(g);p!==-1&&S.splice(p,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,g,S){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,g,S);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,g,S))}start(){this.reset(),this._state=1}put(_,g,S){if(this._state!==3){if(this._state===1)for(;g<S;){let p=_[g++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&S-g>0&&this._put(_,g,S)}}end(_,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,S=g,c=this._stack.fallThrough,this._stack.paused=!1),!c&&S===!1){for(;p>=0&&(S=this._active[p].end(_),S!==!0);p--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,S;p--}for(;p>=0;p--)if(S=this._active[p].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",_);this._active=o,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,g,S){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,g,S),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let g=!1;if(this._hitLimit)g=!1;else if(_&&(g=this._handler(this._data),g instanceof Promise))return g.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,g}}},8742:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let r=2147483647;class a{static fromArray(o){let _=new a;if(!o.length)return _;for(let g=Array.isArray(o[0])?1:0;g<o.length;++g){let S=o[g];if(Array.isArray(S))for(let p=0;p<S.length;++p)_.addSubParam(S[p]);else _.addParam(S)}return _}constructor(o=32,_=32){if(this.maxLength=o,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new a(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){let o=[];for(let _=0;_<this.length;++_){o.push(this.params[_]);let g=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-g>0&&o.push(Array.prototype.slice.call(this._subParams,g,S))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>r?r:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>r?r:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){let _=this._subParamsIdx[o]>>8,g=255&this._subParamsIdx[o];return g-_>0?this._subParams.subarray(_,g):null}getSubParamsAll(){let o={};for(let _=0;_<this.length;++_){let g=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-g>0&&(o[_]=this._subParams.slice(g,S))}return o}addDigit(o){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let g=this._digitIsSub?this._subParams:this.params,S=g[_-1];g[_-1]=~S?Math.min(10*S+o,r):o}}s.Params=a},5741:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let r=this._addons.length-1;r>=0;r--)this._addons[r].instance.dispose()}loadAddon(r,a){let f={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(f),a.dispose=()=>this._wrappedAddonDispose(f),a.activate(r)}_wrappedAddonDispose(r){if(r.isDisposed)return;let a=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===r){a=f;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");r.isDisposed=!0,r.dispose.apply(r.instance),this._addons.splice(a,1)}}},8771:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let a=r(3785),f=r(511);s.BufferApiView=class{constructor(o,_){this._buffer=o,this.type=_}init(o){return this._buffer=o,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(o){let _=this._buffer.lines.get(o);if(_)return new a.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let a=r(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,o){if(!(f<0||f>=this._line.length))return o?(this._line.loadCell(f,o),o):this._line.loadCell(f,new a.CellData)}translateToString(f,o,_){return this._line.translateToString(f,o,_)}}},8285:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let a=r(8771),f=r(8460),o=r(844);class _ extends o.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new 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:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(r){this._core=r}registerCsiHandler(r,a){return this._core.registerCsiHandler(r,(f=>a(f.toArray())))}addCsiHandler(r,a){return this.registerCsiHandler(r,a)}registerDcsHandler(r,a){return this._core.registerDcsHandler(r,((f,o)=>a(f,o.toArray())))}addDcsHandler(r,a){return this.registerDcsHandler(r,a)}registerEscHandler(r,a){return this._core.registerEscHandler(r,a)}addEscHandler(r,a){return this.registerEscHandler(r,a)}registerOscHandler(r,a){return this._core.registerOscHandler(r,a)}addOscHandler(r,a){return this.registerOscHandler(r,a)}}},7090:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(r){this._core=r}register(r){this._core.unicodeService.register(r)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(r){this._core.unicodeService.activeVersion=r}}},744:function(h,s,r){var a=this&&this.__decorate||function(c,d,l,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(v=c[y])&&(w=(C<3?v(w):C>3?v(d,l,w):v(d,l))||w);return C>3&&w&&Object.defineProperty(d,l,w),w},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let o=r(8460),_=r(844),g=r(5295),S=r(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 o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.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 g.BufferSet(c,this))}resize(c,d){this.cols=c,this.rows=d,this.buffers.resize(c,d),this._onResize.fire({cols:c,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,d=!1){let l=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===c.fg&&u.getBg(0)===c.bg||(u=l.getBlankLine(c,d),this._cachedBlankLine=u),u.isWrapped=d;let v=l.ybase+l.scrollTop,C=l.ybase+l.scrollBottom;if(l.scrollTop===0){let w=l.lines.isFull;C===l.lines.length-1?w?l.lines.recycle().copyFrom(u):l.lines.push(u.clone()):l.lines.splice(C+1,0,u.clone()),w?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{let w=C-v+1;l.lines.shiftElements(v+1,w-1,-1),l.lines.set(C,u.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(c,d,l){let u=this.buffer;if(c<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else c+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+c,u.ybase),0),v!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};s.BufferService=p=a([f(0,S.IOptionsService)],p)},7994:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(r){this.glevel=r,this.charset=this._charsets[r]}setgCharset(r,a){this._charsets[r]=a,this.glevel===r&&(this.charset=a)}}},1753:function(h,s,r){var a=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let o=r(2585),_=r(8460),g=r(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,v){let C=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(C|=64,C|=u.action):(C|=3&u.button,4&u.button&&(C|=64),8&u.button&&(C|=128),u.action===32?C|=32:u.action!==0||v||(C|=3)),C}let c=String.fromCharCode,d={DEFAULT:u=>{let v=[p(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${c(v[0])}${c(v[1])}${c(v[2])}`},SGR:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${v}`}},l=s.CoreMouseService=class extends g.Disposable{constructor(u,v){super(),this._bufferService=u,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(S))this.addProtocol(C,S[C]);for(let C of Object.keys(d))this.addEncoding(C,d[C]);this.reset()}addProtocol(u,v){this._protocols[u]=v}addEncoding(u,v){this._encodings[u]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;let v=this._encodings[this._activeEncoding](u);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,v,C){if(C){if(u.x!==v.x||u.y!==v.y)return!1}else if(u.col!==v.col||u.row!==v.row)return!1;return u.button===v.button&&u.action===v.action&&u.ctrl===v.ctrl&&u.alt===v.alt&&u.shift===v.shift}};s.CoreMouseService=l=a([f(0,o.IBufferService),f(1,o.ICoreService)],l)},6975:function(h,s,r){var a=this&&this.__decorate||function(l,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,v,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(l,u){return function(v,C){u(v,C,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let o=r(1439),_=r(8460),g=r(844),S=r(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=s.CoreService=class extends g.Disposable{constructor(l,u,v){super(),this._bufferService=l,this._logService=u,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(p),this.decPrivateModes=(0,o.clone)(c)}reset(){this.modes=(0,o.clone)(p),this.decPrivateModes=(0,o.clone)(c)}triggerDataEvent(l,u=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(l))}};s.CoreService=d=a([f(0,S.IBufferService),f(1,S.ILogService),f(2,S.IOptionsService)],d)},9074:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let a=r(8055),f=r(8460),o=r(844),_=r(6106),g=0,S=0;class p extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((l=>l?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;let u=new c(l);if(u){let v=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),v.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(let l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,u,v){let C=0,w=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,w=C+(y.options.width??1),l>=C&&l<w&&(!v||(y.options.layer??"bottom")===v)&&(yield y)}forEachDecorationAtCell(l,u,v,C){this._decorations.forEachByKey(u,(w=>{g=w.options.x??0,S=g+(w.options.width??1),l>=g&&l<S&&(!v||(w.options.layer??"bottom")===v)&&C(w)}))}}s.DecorationService=p;class c extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=a.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=a.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let a=r(2585),f=r(8343);class o{constructor(...g){this._entries=new Map;for(let[S,p]of g)this.set(S,p)}set(g,S){let p=this._entries.get(g);return this._entries.set(g,S),p}forEach(g){for(let[S,p]of this._entries.entries())g(S,p)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}s.ServiceCollection=o,s.InstantiationService=class{constructor(){this._services=new o,this._services.set(a.IInstantiationService,this)}setService(_,g){this._services.set(_,g)}getService(_){return this._services.get(_)}createInstance(_,...g){let S=(0,f.getServiceDependencies)(_).sort(((d,l)=>d.index-l.index)),p=[];for(let d of S){let l=this._services.get(d.id);if(!l)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${d.id}.`);p.push(l)}let c=S.length>0?S[0].index:g.length;if(g.length!==c)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${c+1} conflicts with ${g.length} static arguments`);return new _(...g,...p)}}},7866:function(h,s,r){var a=this&&this.__decorate||function(c,d,l,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(v=c[y])&&(w=(C<3?v(w):C>3?v(d,l,w):v(d,l))||w);return C>3&&w&&Object.defineProperty(d,l,w),w},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let o=r(844),_=r(2585),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},S,p=s.LogService=class extends o.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()))),S=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let d=0;d<c.length;d++)typeof c[d]=="function"&&(c[d]=c[d]())}_log(c,d,l){this._evalLazyOptionalParams(l),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...l)}trace(c,...d){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,d)}debug(c,...d){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,d)}info(c,...d){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,d)}warn(c,...d){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,d)}error(c,...d){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,d)}};s.LogService=p=a([f(0,_.IOptionsService)],p),s.setTraceLogger=function(c){S=c},s.traceCall=function(c,d,l){if(typeof l.value!="function")throw new Error("not supported");let u=l.value;l.value=function(...v){if(S.logLevel!==_.LogLevelEnum.TRACE)return u.apply(this,v);S.trace(`GlyphRenderer#${u.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);let C=u.apply(this,v);return S.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let a=r(8460),f=r(844),o=r(6114);s.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let _=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends f.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let d in p)if(d in c)try{let l=p[d];c[d]=this._sanitizeAndValidateOption(d,l)}catch(l){console.error(l)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((d=>{d===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((d=>{p.indexOf(d)!==-1&&c()}))}_setupOptions(){let p=d=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},c=(d,l)=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);l=this._sanitizeAndValidateOption(d,l),this.rawOptions[d]!==l&&(this.rawOptions[d]=l,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let l={get:p.bind(this,d),set:c.bind(this,d)};Object.defineProperty(this.options,d,l)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[p]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${p}`);break;case"wordSeparator":c||(c=s.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=_.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=g},2660:function(h,s,r){var a=this&&this.__decorate||function(g,S,p,c){var d,l=arguments.length,u=l<3?S:c===null?c=Object.getOwnPropertyDescriptor(S,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(g,S,p,c);else for(var v=g.length-1;v>=0;v--)(d=g[v])&&(u=(l<3?d(u):l>3?d(S,p,u):d(S,p))||u);return l>3&&u&&Object.defineProperty(S,p,u),u},f=this&&this.__param||function(g,S){return function(p,c){S(p,c,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let o=r(2585),_=s.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){let S=this._bufferService.buffer;if(g.id===void 0){let v=S.addMarker(S.ybase+S.y),C={data:g,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(C,v))),this._dataByLinkId.set(C.id,C),C.id}let p=g,c=this._getEntryIdKey(p),d=this._entriesWithId.get(c);if(d)return this.addLineToLink(d.id,S.ybase+S.y),d.id;let l=S.addMarker(S.ybase+S.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(u,l))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(g,S){let p=this._dataByLinkId.get(g);if(p&&p.lines.every((c=>c.line!==S))){let c=this._bufferService.buffer.addMarker(S);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(g){return this._dataByLinkId.get(g)?.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,S){let p=g.lines.indexOf(S);p!==-1&&(g.lines.splice(p,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};s.OscLinkService=_=a([f(0,o.IBufferService)],_)},8343:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let r="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(f){return f[a]||[]},s.createDecorator=function(f){if(s.serviceRegistry.has(f))return s.serviceRegistry.get(f);let o=function(_,g,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,d){c[r]===c?c[a].push({id:p,index:d}):(c[a]=[{id:p,index:d}],c[r]=c)})(o,_,S)};return o.toString=()=>f,s.serviceRegistry.set(f,o),o}},2585:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;let a=r(8343);var f;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(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(f||(s.LogLevelEnum=f={})),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:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let a=r(8460),f=r(225);class o{static extractShouldJoin(g){return(1&g)!=0}static extractWidth(g){return g>>1&3}static extractCharKind(g){return g>>3}static createPropertyValue(g,S,p=!1){return(16777215&g)<<3|(3&S)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let g=new f.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(g){if(!this._providers[g])throw new Error(`unknown Unicode version "${g}"`);this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)}register(g){this._providers[g.version]=g}wcwidth(g){return this._activeProvider.wcwidth(g)}getStringCellWidth(g){let S=0,p=0,c=g.length;for(let d=0;d<c;++d){let l=g.charCodeAt(d);if(55296<=l&&l<=56319){if(++d>=c)return S+this.wcwidth(l);let C=g.charCodeAt(d);56320<=C&&C<=57343?l=1024*(l-55296)+C-56320+65536:S+=this.wcwidth(C)}let u=this.charProperties(l,p),v=o.extractWidth(u);o.extractShouldJoin(u)&&(v-=o.extractWidth(p)),S+=v,p=u}return S}charProperties(g,S){return this._activeProvider.charProperties(g,S)}}s.UnicodeService=o}},t={};function i(h){var s=t[h];if(s!==void 0)return s.exports;var r=t[h]={exports:{}};return e[h].call(r.exports,r,r.exports,i),r.exports}var n={};return(()=>{var h=n;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;let s=i(9042),r=i(3236),a=i(844),f=i(5741),o=i(8285),_=i(7975),g=i(7090),S=["cols","rows"];class p extends a.Disposable{constructor(d){super(),this._core=this.register(new r.Terminal(d)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let l=v=>this._core.options[v],u=(v,C)=>{this._checkReadonlyOptions(v),this._core.options[v]=C};for(let v in this._core.options){let C={get:l.bind(this,v),set:u.bind(this,v)};Object.defineProperty(this._publicOptions,v,C)}}_checkReadonlyOptions(d){if(S.includes(d))throw new Error(`Option "${d}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let d=this._core.coreService.decPrivateModes,l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let l in d)this._publicOptions[l]=d[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,l=!0){this._core.input(d,l)}resize(d,l){this._verifyIntegers(d,l),this._core.resize(d,l)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}attachCustomWheelEventHandler(d){this._core.attachCustomWheelEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){return this._checkProposedApi(),this._verifyPositiveIntegers(d.x??0,d.width??0,d.height??0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,l,u){this._verifyIntegers(d,l,u),this._core.select(d,l,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,l){this._verifyIntegers(d,l),this._core.selectLines(d,l)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,l){this._core.write(d,l)}writeln(d,l){this._core.write(d),this._core.write(`\r
|
|
9
|
-
`,
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(m){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.isLinux&&m&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(m){let x=this._getMouseBufferCoords(m),A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(A&&I&&x)&&this._areCoordsInSelection(x,A,I)}isCellInSelection(m,x){let A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!A||!I)&&this._areCoordsInSelection([m,x],A,I)}_areCoordsInSelection(m,x,A){return m[1]>x[1]&&m[1]<A[1]||x[1]===A[1]&&m[1]===x[1]&&m[0]>=x[0]&&m[0]<A[0]||x[1]<A[1]&&m[1]===A[1]&&m[0]<A[0]||x[1]<A[1]&&m[1]===x[1]&&m[0]>=x[0]}_selectWordAtCursor(m,x){let A=this._linkifier.currentLink?.link?.range;if(A)return this._model.selectionStart=[A.start.x-1,A.start.y-1],this._model.selectionStartLength=(0,c.getRangeLength)(A,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let I=this._getMouseBufferCoords(m);return!!I&&(this._selectWordAt(I,x),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,x){this._model.clearSelection(),m=Math.max(m,0),x=Math.min(x,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,x],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let x=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(x)return x[0]--,x[1]--,x[1]+=this._bufferService.buffer.ydisp,x}_getMouseEventScrollAmount(m){let x=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],A=this._renderService.dimensions.css.canvas.height;return x>=0&&x<=A?0:(x>A&&(x-=A),x=Math.min(Math.max(x,-50),50),x/=50,x/Math.abs(x)+Math.round(14*x))}shouldForceSelection(m){return d.isMac?m.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:m.shiftKey}handleMouseDown(m){if(this._mouseDownTimeStamp=m.timeStamp,(m.button!==2||!this.hasSelection)&&m.button===0){if(!this._enabled){if(!this.shouldForceSelection(m))return;m.stopPropagation()}m.preventDefault(),this._dragScrollAmount=0,this._enabled&&m.shiftKey?this._handleIncrementalClick(m):m.detail===1?this._handleSingleClick(m):m.detail===2?this._handleDoubleClick(m):m.detail===3&&this._handleTripleClick(m),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(m){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(m))}_handleSingleClick(m){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(m)?3:0,this._model.selectionStart=this._getMouseBufferCoords(m),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let x=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);x&&x.length!==this._model.selectionStart[0]&&x.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let x=this._getMouseBufferCoords(m);x&&(this._activeSelectionMode=2,this._selectLineAt(x[1]))}shouldColumnSelect(m){return m.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let x=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(m),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(m),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let A=this._bufferService.buffer;if(this._model.selectionEnd[1]<A.lines.length){let I=A.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}x&&x[0]===this._model.selectionEnd[0]&&x[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let m=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(m.ydisp+this._bufferService.rows,m.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=m.ydisp),this.refresh()}}_handleMouseUp(m){let x=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&x<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let A=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(A&&A[0]!==void 0&&A[1]!==void 0){let I=(0,_.moveToCellSequence)(A[0]-1,A[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,A=!(!m||!x||m[0]===x[0]&&m[1]===x[1]);A?m&&x&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&x[0]===this._oldSelectionEnd[0]&&x[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,x,A)):this._oldHasSelection&&this._fireOnSelectionChange(m,x,A)}_fireOnSelectionChange(m,x,A){this._oldSelectionStart=m,this._oldSelectionEnd=x,this._oldHasSelection=A,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((x=>this._handleTrim(x)))}_convertViewportColToCharacterIndex(m,x){let A=x;for(let I=0;x>=I;I++){let F=m.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?A--:F>1&&x!==I&&(A+=F-1)}return A}setSelection(m,x,A){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,x],this._model.selectionStartLength=A,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,x,A=!0,I=!0){if(m[0]>=this._bufferService.cols)return;let F=this._bufferService.buffer,R=F.lines.get(m[1]);if(!R)return;let $=F.translateBufferLineToString(m[1],!1),B=this._convertViewportColToCharacterIndex(R,m[0]),D=B,P=m[0]-B,O=0,b=0,E=0,L=0;if($.charAt(B)===" "){for(;B>0&&$.charAt(B-1)===" ";)B--;for(;D<$.length&&$.charAt(D+1)===" ";)D++}else{let K=m[0],V=m[0];R.getWidth(K)===0&&(O++,K--),R.getWidth(V)===2&&(b++,V++);let j=R.getString(V).length;for(j>1&&(L+=j-1,D+=j-1);K>0&&B>0&&!this._isCharWordSeparator(R.loadCell(K-1,this._workCell));){R.loadCell(K-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?(O++,K--):T>1&&(E+=T-1,B-=T-1),B--,K--}for(;V<R.length&&D+1<$.length&&!this._isCharWordSeparator(R.loadCell(V+1,this._workCell));){R.loadCell(V+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,V++):T>1&&(L+=T-1,D+=T-1),D++,V++}}D++;let M=B+P-O+E,z=Math.min(this._bufferService.cols,D-B+O+b-E-L);if(x||$.slice(B,D).trim()!==""){if(A&&M===0&&R.getCodePoint(0)!==32){let K=F.lines.get(m[1]-1);if(K&&R.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let V=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(V){let j=this._bufferService.cols-V.start;M-=j,z+=j}}}if(I&&M+z===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){let K=F.lines.get(m[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let V=this._getWordAt([0,m[1]+1],!1,!1,!0);V&&(z+=V.length)}}return{start:M,length:z}}}_selectWordAt(m,x){let A=this._getWordAt(m,x);if(A){for(;A.start<0;)A.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[A.start,m[1]],this._model.selectionStartLength=A.length}}_selectToWordAt(m){let x=this._getWordAt(m,!0);if(x){let A=m[1];for(;x.start<0;)x.start+=this._bufferService.cols,A--;if(!this._model.areSelectionValuesReversed())for(;x.start+x.length>this._bufferService.cols;)x.length-=this._bufferService.cols,A++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?x.start:x.start+x.length,A]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let x=this._bufferService.buffer.getWrappedRangeForLine(m),A={start:{x:0,y:x.first},end:{x:this._bufferService.cols-1,y:x.last}};this._model.selectionStart=[0,x.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,c.getRangeLength)(A,this._bufferService.cols)}};r.SelectionService=y=a([f(3,v.IBufferService),f(4,v.ICoreService),f(5,S.IMouseService),f(6,v.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],y)},4725:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;let a=s(8343);r.ICharSizeService=(0,a.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),r.IMouseService=(0,a.createDecorator)("MouseService"),r.IRenderService=(0,a.createDecorator)("RenderService"),r.ISelectionService=(0,a.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,a.createDecorator)("ThemeService"),r.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(l,r,s){var a=this&&this.__decorate||function(y,m,x,A){var I,F=arguments.length,R=F<3?m:A===null?A=Object.getOwnPropertyDescriptor(m,x):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,m,x,A);else for(var $=y.length-1;$>=0;$--)(I=y[$])&&(R=(F<3?I(R):F>3?I(m,x,R):I(m,x))||R);return F>3&&R&&Object.defineProperty(m,x,R),R},f=this&&this.__param||function(y,m){return function(x,A){m(x,A,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let o=s(7239),_=s(8055),g=s(8460),S=s(844),p=s(2585),h=_.css.toColor("#ffffff"),d=_.css.toColor("#000000"),c=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let y=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],m=[0,95,135,175,215,255];for(let x=0;x<216;x++){let A=m[x/36%6|0],I=m[x/6%6|0],F=m[x%6];y.push({css:_.channels.toCss(A,I,F),rgba:_.channels.toRgba(A,I,F)})}for(let x=0;x<24;x++){let A=8+10*x;y.push({css:_.channels.toCss(A,A,A),rgba:_.channels.toRgba(A,A,A)})}return y})());let C=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(y){super(),this._optionsService=y,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:d,cursor:c,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:_.color.blend(d,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:_.color.blend(d,v),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(y={}){let m=this._colors;if(m.foreground=w(y.foreground,h),m.background=w(y.background,d),m.cursor=w(y.cursor,c),m.cursorAccent=w(y.cursorAccent,u),m.selectionBackgroundTransparent=w(y.selectionBackground,v),m.selectionBackgroundOpaque=_.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=w(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=_.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?w(y.selectionForeground,_.NULL_COLOR):void 0,m.selectionForeground===_.NULL_COLOR&&(m.selectionForeground=void 0),_.color.isOpaque(m.selectionBackgroundTransparent)&&(m.selectionBackgroundTransparent=_.color.opacity(m.selectionBackgroundTransparent,.3)),_.color.isOpaque(m.selectionInactiveBackgroundTransparent)&&(m.selectionInactiveBackgroundTransparent=_.color.opacity(m.selectionInactiveBackgroundTransparent,.3)),m.ansi=r.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=w(y.black,r.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=w(y.red,r.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=w(y.green,r.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=w(y.yellow,r.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=w(y.blue,r.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=w(y.magenta,r.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=w(y.cyan,r.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=w(y.white,r.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=w(y.brightBlack,r.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=w(y.brightRed,r.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=w(y.brightGreen,r.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=w(y.brightYellow,r.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=w(y.brightBlue,r.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=w(y.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=w(y.brightCyan,r.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=w(y.brightWhite,r.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let x=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let A=0;A<x;A++)m.ansi[A+16]=w(y.extendedAnsi[A],r.DEFAULT_ANSI_COLORS[A+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(y){this._restoreColor(y),this._onChangeColors.fire(this.colors)}_restoreColor(y){if(y!==void 0)switch(y){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[y]=this._restoreColors.ansi[y]}else for(let m=0;m<this._restoreColors.ansi.length;++m)this._colors.ansi[m]=this._restoreColors.ansi[m]}modifyColors(y){y(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function w(y,m){if(y!==void 0)try{return _.css.toColor(y)}catch{}return m}r.ThemeService=C=a([f(0,p.IOptionsService)],C)},6349:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let a=s(8460),f=s(844);class o extends f.Disposable{constructor(g){super(),this._maxLength=g,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(g){if(this._maxLength===g)return;let S=new Array(g);for(let p=0;p<Math.min(g,this.length);p++)S[p]=this._array[this._getCyclicIndex(p)];this._array=S,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let S=this._length;S<g;S++)this._array[S]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,S){this._array[this._getCyclicIndex(g)]=S}push(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(g,S,...p){if(S){for(let h=g;h<this._length-S;h++)this._array[this._getCyclicIndex(h)]=this._array[this._getCyclicIndex(h+S)];this._length-=S,this.onDeleteEmitter.fire({index:g,amount:S})}for(let h=this._length-1;h>=g;h--)this._array[this._getCyclicIndex(h+p.length)]=this._array[this._getCyclicIndex(h)];for(let h=0;h<p.length;h++)this._array[this._getCyclicIndex(g+h)]=p[h];if(p.length&&this.onInsertEmitter.fire({index:g,amount:p.length}),this._length+p.length>this._maxLength){let h=this._length+p.length-this._maxLength;this._startIndex+=h,this._length=this._maxLength,this.onTrimEmitter.fire(h)}else this._length+=p.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,S,p){if(!(S<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let d=S-1;d>=0;d--)this.set(g+d+p,this.get(g+d));let h=g+S+p-this._length;if(h>0)for(this._length+=h;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let h=0;h<S;h++)this.set(g+h+p,this.get(g+h))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}r.CircularList=o},1439:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function s(a,f=5){if(typeof a!="object")return a;let o=Array.isArray(a)?[]:{};for(let _ in a)o[_]=f<=1?a[_]:a[_]&&s(a[_],f-1);return o}},8055:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let s=0,a=0,f=0,o=0;var _,g,S,p,h;function d(u){let v=u.toString(16);return v.length<2?"0"+v:v}function c(u,v){return u<v?(v+.05)/(u+.05):(u+.05)/(v+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(v,C,w,y){return y!==void 0?`#${d(v)}${d(C)}${d(w)}${d(y)}`:`#${d(v)}${d(C)}${d(w)}`},u.toRgba=function(v,C,w,y=255){return(v<<24|C<<16|w<<8|y)>>>0},u.toColor=function(v,C,w,y){return{css:u.toCss(v,C,w,y),rgba:u.toRgba(v,C,w,y)}}})(_||(r.channels=_={})),(function(u){function v(C,w){return o=Math.round(255*w),[s,a,f]=h.toChannels(C.rgba),{css:_.toCss(s,a,f,o),rgba:_.toRgba(s,a,f,o)}}u.blend=function(C,w){if(o=(255&w.rgba)/255,o===1)return{css:w.css,rgba:w.rgba};let y=w.rgba>>24&255,m=w.rgba>>16&255,x=w.rgba>>8&255,A=C.rgba>>24&255,I=C.rgba>>16&255,F=C.rgba>>8&255;return s=A+Math.round((y-A)*o),a=I+Math.round((m-I)*o),f=F+Math.round((x-F)*o),{css:_.toCss(s,a,f),rgba:_.toRgba(s,a,f)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,w,y){let m=h.ensureContrastRatio(C.rgba,w.rgba,y);if(m)return _.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let w=(255|C.rgba)>>>0;return[s,a,f]=h.toChannels(w),{css:_.toCss(s,a,f),rgba:w}},u.opacity=v,u.multiplyOpacity=function(C,w){return o=255&C.rgba,v(C,o*w/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(g||(r.color=g={})),(function(u){let v,C;try{let w=document.createElement("canvas");w.width=1,w.height=1;let y=w.getContext("2d",{willReadFrequently:!0});y&&(v=y,v.globalCompositeOperation="copy",C=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(w){if(w.match(/#[\da-f]{3,8}/i))switch(w.length){case 4:return s=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),_.toColor(s,a,f);case 5:return s=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),o=parseInt(w.slice(4,5).repeat(2),16),_.toColor(s,a,f,o);case 7:return{css:w,rgba:(parseInt(w.slice(1),16)<<8|255)>>>0};case 9:return{css:w,rgba:parseInt(w.slice(1),16)>>>0}}let y=w.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(y)return s=parseInt(y[1]),a=parseInt(y[2]),f=parseInt(y[3]),o=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),_.toColor(s,a,f,o);if(!v||!C)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=C,v.fillStyle=w,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[s,a,f,o]=v.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(s,a,f,o),css:w}}})(S||(r.css=S={})),(function(u){function v(C,w,y){let m=C/255,x=w/255,A=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.0722*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))}u.relativeLuminance=function(C){return v(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=v})(p||(r.rgb=p={})),(function(u){function v(w,y,m){let x=w>>24&255,A=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,$=y>>8&255,B=c(p.relativeLuminance2(F,R,$),p.relativeLuminance2(x,A,I));for(;B<m&&(F>0||R>0||$>0);)F-=Math.max(0,Math.ceil(.1*F)),R-=Math.max(0,Math.ceil(.1*R)),$-=Math.max(0,Math.ceil(.1*$)),B=c(p.relativeLuminance2(F,R,$),p.relativeLuminance2(x,A,I));return(F<<24|R<<16|$<<8|255)>>>0}function C(w,y,m){let x=w>>24&255,A=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,$=y>>8&255,B=c(p.relativeLuminance2(F,R,$),p.relativeLuminance2(x,A,I));for(;B<m&&(F<255||R<255||$<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),R=Math.min(255,R+Math.ceil(.1*(255-R))),$=Math.min(255,$+Math.ceil(.1*(255-$))),B=c(p.relativeLuminance2(F,R,$),p.relativeLuminance2(x,A,I));return(F<<24|R<<16|$<<8|255)>>>0}u.blend=function(w,y){if(o=(255&y)/255,o===1)return y;let m=y>>24&255,x=y>>16&255,A=y>>8&255,I=w>>24&255,F=w>>16&255,R=w>>8&255;return s=I+Math.round((m-I)*o),a=F+Math.round((x-F)*o),f=R+Math.round((A-R)*o),_.toRgba(s,a,f)},u.ensureContrastRatio=function(w,y,m){let x=p.relativeLuminance(w>>8),A=p.relativeLuminance(y>>8);if(c(x,A)<m){if(A<x){let R=v(w,y,m),$=c(x,p.relativeLuminance(R>>8));if($<m){let B=C(w,y,m);return $>c(x,p.relativeLuminance(B>>8))?R:B}return R}let I=C(w,y,m),F=c(x,p.relativeLuminance(I>>8));if(F<m){let R=v(w,y,m);return F>c(x,p.relativeLuminance(R>>8))?I:R}return I}},u.reduceLuminance=v,u.increaseLuminance=C,u.toChannels=function(w){return[w>>24&255,w>>16&255,w>>8&255,255&w]}})(h||(r.rgba=h={})),r.toPaddedHex=d,r.contrastRatio=c},8969:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let a=s(844),f=s(2585),o=s(4348),_=s(7866),g=s(744),S=s(7302),p=s(6975),h=s(8460),d=s(1753),c=s(1480),u=s(7994),v=s(9282),C=s(5435),w=s(5981),y=s(2660),m=!1;class x extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event((I=>{this._onScrollApi?.fire(I.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(I){for(let F in I)this.optionsService.options[F]=I[F]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new S.OptionsService(I)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(c.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(y.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.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 w.WriteBuffer(((F,R)=>this._inputHandler.parse(F,R)))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,F){this._writeBuffer.write(I,F)}writeSync(I,F){this._logService.logLevel<=f.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(I,F)}input(I,F=!0){this.coreService.triggerDataEvent(I,F)}resize(I,F){isNaN(I)||isNaN(F)||(I=Math.max(I,g.MINIMUM_COLS),F=Math.max(F,g.MINIMUM_ROWS),this._bufferService.resize(I,F))}scroll(I,F=!1){this._bufferService.scroll(I,F)}scrollLines(I,F,R){this._bufferService.scrollLines(I,F,R)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){let F=I-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(I,F){return this._inputHandler.registerEscHandler(I,F)}registerDcsHandler(I,F){return this._inputHandler.registerDcsHandler(I,F)}registerCsiHandler(I,F){return this._inputHandler.registerCsiHandler(I,F)}registerOscHandler(I,F){return this._inputHandler.registerOscHandler(I,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1,F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?I=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let I=[];I.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let F of I)F.dispose()}))}}}r.CoreTerminal=x},8460:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=s=>(this._listeners.push(s),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===s)return void this._listeners.splice(a,1)}}})),this._event}fire(s,a){let f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,s,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(s,a){return s((f=>a.fire(f)))},r.runAndSubscribe=function(s,a){return a(void 0),s((f=>a(f)))}},5435:function(l,r,s){var a=this&&this.__decorate||function(O,b,E,L){var M,z=arguments.length,K=z<3?b:L===null?L=Object.getOwnPropertyDescriptor(b,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(O,b,E,L);else for(var V=O.length-1;V>=0;V--)(M=O[V])&&(K=(z<3?M(K):z>3?M(b,E,K):M(b,E))||K);return z>3&&K&&Object.defineProperty(b,E,K),K},f=this&&this.__param||function(O,b){return function(E,L){b(E,L,O)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let o=s(2584),_=s(7116),g=s(2015),S=s(844),p=s(482),h=s(8437),d=s(8460),c=s(643),u=s(511),v=s(3734),C=s(2585),w=s(1480),y=s(6242),m=s(6351),x=s(5941),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function F(O,b){if(O>24)return b.setWinLines||!1;switch(O){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.setWinLines}return!1}var R;(function(O){O[O.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",O[O.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(r.WindowsOptionsReportType=R={}));let $=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,L,M,z,K,V,j,T=new g.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=L,this._logService=M,this._optionsService=z,this._oscLinkService=K,this._coreMouseService=V,this._unicodeService=j,this._parser=T,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new D(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:N.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,N,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:N,data:H})})),this._parser.setDcsHandlerFallback(((k,N,H)=>{N==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:N,payload:H})})),this._parser.setPrintHandler(((k,N,H)=>this.print(k,N,H))),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(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new y.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new y.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new y.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new y.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new y.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new y.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new y.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new y.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new y.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new y.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new y.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new y.OscHandler((k=>this.restoreCursorColor(k)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let k in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},(()=>this.selectCharset("("+k))),this._parser.registerEscHandler({intermediates:")",final:k},(()=>this.selectCharset(")"+k))),this._parser.registerEscHandler({intermediates:"*",final:k},(()=>this.selectCharset("*"+k))),this._parser.registerEscHandler({intermediates:"+",final:k},(()=>this.selectCharset("+"+k))),this._parser.registerEscHandler({intermediates:"-",final:k},(()=>this.selectCharset("-"+k))),this._parser.registerEscHandler({intermediates:".",final:k},(()=>this.selectCharset("."+k))),this._parser.registerEscHandler({intermediates:"/",final:k},(()=>this.selectCharset("/"+k)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((k=>(this._logService.error("Parsing error: ",k),k))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler(((k,N)=>this.requestStatusString(k,N))))}_preserveStack(b,E,L,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=L,this._parseStack.position=M}_logSlowResolvingAsync(b){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,E){let L,M=this._activeBuffer.x,z=this._activeBuffer.y,K=0,V=this._parseStack.paused;if(V){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(L),L;M=this._parseStack.cursorStartX,z=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>I&&(K=this._parseStack.position+I)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(k=>String.fromCharCode(k))).join("")}"`),typeof b=="string"?b.split("").map((k=>k.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(b.length,I))),V||this._dirtyRowTracker.clearRange(),b.length>I)for(let k=K;k<b.length;k+=I){let N=k+I<b.length?k+I:b.length,H=typeof b=="string"?this._stringDecoder.decode(b.substring(k,N),this._parseBuffer):this._utf8Decoder.decode(b.subarray(k,N),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,z,H,k),this._logSlowResolvingAsync(L),L}else if(!V){let k=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,k))return this._preserveStack(M,z,k,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===M&&this._activeBuffer.y===z||this._onCursorMove.fire();let j=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),T=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);T<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(T,this._bufferService.rows-1),Math.min(j,this._bufferService.rows-1))}print(b,E,L){let M,z,K=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,j=this._bufferService.cols,T=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,N=this._curAttrData,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-E>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let q=this._parser.precedingJoinState;for(let U=E;U<L;++U){if(M=b[U],M<127&&K){let Q=K[String.fromCharCode(M)];Q&&(M=Q.charCodeAt(0))}let Z=this._unicodeService.charProperties(M,q);z=w.UnicodeService.extractWidth(Z);let ee=w.UnicodeService.extractShouldJoin(Z),Y=ee?w.UnicodeService.extractWidth(q):0;if(q=Z,V&&this._onA11yChar.fire((0,p.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+z-Y>j){if(T){let Q=H,X=this._activeBuffer.x-Y;for(this._activeBuffer.x=Y,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Y>0&&H instanceof h.BufferLine&&H.copyCellsFrom(Q,X,0,Y,!1);X<j;)Q.setCellFromCodepoint(X++,0,1,N)}else if(this._activeBuffer.x=j-1,z===2)continue}if(ee&&this._activeBuffer.x){let Q=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-Q,M,z);for(let X=z-Y;--X>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(k&&(H.insertCells(this._activeBuffer.x,z-Y,this._activeBuffer.getNullCell(N)),H.getWidth(j-1)===2&&H.setCellFromCodepoint(j-1,c.NULL_CELL_CODE,c.NULL_CELL_WIDTH,N)),H.setCellFromCodepoint(this._activeBuffer.x++,M,z,N),z>0)for(;--z;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=q,this._activeBuffer.x<j&&L-E>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,E){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,E):this._parser.registerCsiHandler(b,(L=>!F(L.params[0],this._optionsService.rawOptions.windowOptions)||E(L)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new m.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,new y.OscHandler(E))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=b,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+E)}cursorUp(b){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let E=b.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let E=b.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,E,L,M=!1,z=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,L,this._activeBuffer.getNullCell(this._eraseAttrData()),z),M&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),L.isWrapped=!1)}eraseInDisplay(b,E=!1){let L;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);L<this._bufferService.rows;L++)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 3:let M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(b,E=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;E--;)this._activeBuffer.lines.splice(z-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;E--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let E=b.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(b){let E=b.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let E=this._parser.precedingJoinState;if(!E)return!0;let L=b.params[0]||1,M=w.UnicodeService.extractWidth(E),z=this._activeBuffer.x-M,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(z),V=new Uint32Array(K.length*L),j=0;for(let k=0;k<K.length;){let N=K.codePointAt(k)||0;V[j++]=N,k+=N>65535?2:1}let T=j;for(let k=1;k<L;++k)V.copyWithin(T,0,j),T+=j;return this.print(V,0,T),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.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(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),b.params[E]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(b,E){let L=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:z}=this._coreMouseService,K=this._coreService,{buffers:V,cols:j}=this._bufferService,{active:T,alt:k}=V,N=this._optionsService.rawOptions,H=ee=>ee?1:2,q=b.params[0];return U=q,Z=E?q===2?4:q===4?H(K.modes.insertMode):q===12?3:q===20?H(N.convertEol):0:q===1?H(L.applicationCursorKeys):q===3?N.windowOptions.setWinLines?j===80?2:j===132?1:0:0:q===6?H(L.origin):q===7?H(L.wraparound):q===8?3:q===9?H(M==="X10"):q===12?H(N.cursorBlink):q===25?H(!K.isCursorHidden):q===45?H(L.reverseWraparound):q===66?H(L.applicationKeypad):q===67?4:q===1e3?H(M==="VT200"):q===1002?H(M==="DRAG"):q===1003?H(M==="ANY"):q===1004?H(L.sendFocus):q===1005?4:q===1006?H(z==="SGR"):q===1015?4:q===1016?H(z==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?H(T===k):q===2004?H(L.bracketedPasteMode):0,K.triggerDataEvent(`${o.C0.ESC}[${E?"":"?"}${U};${Z}$y`),!0;var U,Z}_updateAttrColor(b,E,L,M,z){return E===2?(b|=50331648,b&=-16777216,b|=v.AttributeData.fromColorRGB([L,M,z])):E===5&&(b&=-50331904,b|=33554432|255&L),b}_extractColor(b,E,L){let M=[0,0,-1,0,0,0],z=0,K=0;do{if(M[K+z]=b.params[E+K],b.hasSubParams(E+K)){let V=b.getSubParams(E+K),j=0;do M[1]===5&&(z=1),M[K+j+1+z]=V[j];while(++j<V.length&&j+K+1+z<M.length);break}if(M[1]===5&&K+z>=2||M[1]===2&&K+z>=5)break;M[1]&&(z=1)}while(++K+E<b.length&&K+z<M.length);for(let V=2;V<M.length;++V)M[V]===-1&&(M[V]=0);switch(M[0]){case 38:L.fg=this._updateAttrColor(L.fg,M[1],M[3],M[4],M[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,M[1],M[3],M[4],M[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,M[1],M[3],M[4],M[5])}return K}_processUnderline(b,E){E.extended=E.extended.clone(),(!~b||b>5)&&(b=1),E.extended.underlineStyle=b,E.fg|=268435456,b===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(b){b.fg=h.DEFAULT_ATTR_DATA.fg,b.bg=h.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let E=b.length,L,M=this._curAttrData;for(let z=0;z<E;z++)L=b.params[z],L>=30&&L<=37?(M.fg&=-50331904,M.fg|=16777216|L-30):L>=40&&L<=47?(M.bg&=-50331904,M.bg|=16777216|L-40):L>=90&&L<=97?(M.fg&=-50331904,M.fg|=16777224|L-90):L>=100&&L<=107?(M.bg&=-50331904,M.bg|=16777224|L-100):L===0?this._processSGR0(M):L===1?M.fg|=134217728:L===3?M.bg|=67108864:L===4?(M.fg|=268435456,this._processUnderline(b.hasSubParams(z)?b.getSubParams(z)[0]:1,M)):L===5?M.fg|=536870912:L===7?M.fg|=67108864:L===8?M.fg|=1073741824:L===9?M.fg|=2147483648:L===2?M.bg|=134217728:L===21?this._processUnderline(2,M):L===22?(M.fg&=-134217729,M.bg&=-134217729):L===23?M.bg&=-67108865:L===24?(M.fg&=-268435457,this._processUnderline(0,M)):L===25?M.fg&=-536870913:L===27?M.fg&=-67108865:L===28?M.fg&=-1073741825:L===29?M.fg&=2147483647:L===39?(M.fg&=-67108864,M.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):L===49?(M.bg&=-67108864,M.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?z+=this._extractColor(b,z,M):L===53?M.bg|=1073741824:L===55?M.bg&=-1073741825:L===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):L===100?(M.fg&=-67108864,M.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${E};${L}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${E};${L}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(b){let E=b.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let L=E%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(b){let E=b.params[0]||1,L;return(b.length<2||(L=b.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(b){if(!F(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let E=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(R.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(R.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let E=[],L=b.split(";");for(;L.length>1;){let M=L.shift(),z=L.shift();if(/^\d+$/.exec(M)){let K=parseInt(M);if(P(K))if(z==="?")E.push({type:0,index:K});else{let V=(0,x.parseColor)(z);V&&E.push({type:1,index:K,color:V})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(b){let E=b.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(b,E){this._getCurrentLinkId()&&this._finishHyperlink();let L=b.split(":"),M,z=L.findIndex((K=>K.startsWith("id=")));return z!==-1&&(M=L[z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,E){let L=b.split(";");for(let M=0;M<L.length&&!(E>=this._specialColors.length);++M,++E)if(L[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let z=(0,x.parseColor)(L[M]);z&&this._onColor.fire([{type:1,index:this._specialColors[E],color:z}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let E=[],L=b.split(";");for(let M=0;M<L.length;++M)if(/^\d+$/.exec(L[M])){let z=parseInt(L[M]);P(z)&&E.push({type:2,index:z})}return E.length&&this._onColor.fire(E),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(A[b[0]],_.CHARSETS[b[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 b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new u.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){let L=this._activeBuffer.ybase+this._activeBuffer.y+E,M=this._activeBuffer.lines.get(L);M&&(M.fill(b),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let L=this._bufferService.buffer,M=this._optionsService.rawOptions;return(z=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${z}${o.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}r.InputHandler=B;let D=class{constructor(O){this._bufferService=O,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(O){O<this.start?this.start=O:O>this.end&&(this.end=O)}markRangeDirty(O,b){O>b&&($=O,O=b,b=$),O<this.start&&(this.start=O),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function P(O){return 0<=O&&O<256}D=a([f(0,C.IBufferService)],D)},844:(l,r)=>{function s(a){for(let f of a)f.dispose();a.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let f=this._disposables.indexOf(a);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(a){this._isDisposed||a===this._value||(this._value?.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(a){return{dispose:a}},r.disposeArray=s,r.getDisposeArrayDisposable=function(a){return{dispose:()=>s(a)}}},1505:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class s{constructor(){this._data={}}set(f,o,_){this._data[f]||(this._data[f]={}),this._data[f][o]=_}get(f,o){return this._data[f]?this._data[f][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=s,r.FourKeyMap=class{constructor(){this._data=new s}set(a,f,o,_,g){this._data.get(a,f)||this._data.set(a,f,new s),this._data.get(a,f).set(o,_,g)}get(a,f,o,_){return this._data.get(a,f)?.get(o,_)}clear(){this._data.clear()}}},6114:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;let s=r.isNode?"node":navigator.userAgent,a=r.isNode?"node":navigator.platform;r.isFirefox=s.includes("Firefox"),r.isLegacyEdge=s.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(s),r.getSafariVersion=function(){if(!r.isSafari)return 0;let f=s.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),r.isIpad=a==="iPad",r.isIphone=a==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),r.isLinux=a.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(s)},6106:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let s=0;r.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(s=this._search(this._getKey(a)),this._array.splice(s,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let f=this._getKey(a);if(f===void 0||(s=this._search(f),s===-1)||this._getKey(this._array[s])!==f)return!1;do if(this._array[s]===a)return this._array.splice(s,1),!0;while(++s<this._array.length&&this._getKey(this._array[s])===f);return!1}*getKeyIterator(a){if(this._array.length!==0&&(s=this._search(a),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===a))do yield this._array[s];while(++s<this._array.length&&this._getKey(this._array[s])===a)}forEachByKey(a,f){if(this._array.length!==0&&(s=this._search(a),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===a))do f(this._array[s]);while(++s<this._array.length&&this._getKey(this._array[s])===a)}values(){return[...this._array].values()}_search(a){let f=0,o=this._array.length-1;for(;o>=f;){let _=f+o>>1,g=this._getKey(this._array[_]);if(g>a)o=_-1;else{if(!(g<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}f=_+1}}return f}}},7226:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let a=s(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(g){this._idleCallback=void 0;let S=0,p=0,h=g.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),p=Math.max(S,p),d=g.timeRemaining(),1.5*p>d)return h-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-S))}ms`),void this._start();h=d}this.clear()}}class o extends f{_requestCallback(g){return setTimeout((()=>g(this._createDeadline(16))))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){let S=Date.now()+g;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let a=s(643);r.updateWindowsModeWrappedState=function(f){let o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=o?.get(f.cols-1),g=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);g&&_&&(g.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class s{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){let o=new s;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=s;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}get underlineVariantOffset(){let o=(3758096384&this._ext)>>29;return o<0?4294967288^o:o}set underlineVariantOffset(o){this._ext&=536870911,this._ext|=o<<29&3758096384}constructor(o=0,_=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=_}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=a},9092:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let a=s(6349),f=s(7226),o=s(3734),_=s(8437),g=s(4634),S=s(511),p=s(643),h=s(4863),d=s(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(c,u,v){this._hasScrollback=c,this._optionsService=u,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(c){return c?(this._nullCell.fg=c.fg,this._nullCell.bg=c.bg,this._nullCell.extended=c.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(c){return c?(this._whitespaceCell.fg=c.fg,this._whitespaceCell.bg=c.bg,this._whitespaceCell.extended=c.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(c,u){return new _.BufferLine(this._bufferService.cols,this.getNullCell(c),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let c=this.ybase+this.y-this.ydisp;return c>=0&&c<this._rows}_getCorrectBufferLength(c){if(!this._hasScrollback)return c;let u=c+this._optionsService.rawOptions.scrollback;return u>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:u}fillViewportRows(c){if(this.lines.length===0){c===void 0&&(c=_.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(c))}}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(c,u){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),C=0,w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<c)for(let m=0;m<this.lines.length;m++)C+=+this.lines.get(m).resize(c,v);let y=0;if(this._rows<u)for(let m=this._rows;m<u;m++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(c,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+y+1?(this.ybase--,y++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(c,v)));else for(let m=this._rows;m>u;m--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){let m=this.lines.length-w;m>0&&(this.lines.trimStart(m),this.ybase=Math.max(this.ybase-m,0),this.ydisp=Math.max(this.ydisp-m,0),this.savedY=Math.max(this.savedY-m,0)),this.lines.maxLength=w}this.x=Math.min(this.x,c-1),this.y=Math.min(this.y,u-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,c-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(c,u),this._cols>c))for(let y=0;y<this.lines.length;y++)C+=+this.lines.get(y).resize(c,v);this._cols=c,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let c=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,c=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return c}get _isReflowEnabled(){let c=this._optionsService.rawOptions.windowsPty;return c&&c.buildNumber?this._hasScrollback&&c.backend==="conpty"&&c.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(c,u){this._cols!==c&&(c>this._cols?this._reflowLarger(c,u):this._reflowSmaller(c,u))}_reflowLarger(c,u){let v=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,c,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(v.length>0){let C=(0,g.reflowLargerCreateNewLayout)(this.lines,v);(0,g.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(c,u,C.countRemoved)}}_reflowLargerAdjustViewport(c,u,v){let C=this.getNullCell(_.DEFAULT_ATTR_DATA),w=v;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new _.BufferLine(c,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(c,u){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),C=[],w=0;for(let y=this.lines.length-1;y>=0;y--){let m=this.lines.get(y);if(!m||!m.isWrapped&&m.getTrimmedLength()<=c)continue;let x=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),x.unshift(m);let A=this.ybase+this.y;if(A>=y&&A<y+x.length)continue;let I=x[x.length-1].getTrimmedLength(),F=(0,g.reflowSmallerGetNewLineLengths)(x,this._cols,c),R=F.length-x.length,$;$=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+R):Math.max(0,this.lines.length-this.lines.maxLength+R);let B=[];for(let L=0;L<R;L++){let M=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(M)}B.length>0&&(C.push({start:y+x.length+w,newLines:B}),w+=B.length),x.push(...B);let D=F.length-1,P=F[D];P===0&&(D--,P=F[D]);let O=x.length-R-1,b=I;for(;O>=0;){let L=Math.min(b,P);if(x[D]===void 0)break;if(x[D].copyCellsFrom(x[O],b-L,P-L,L,!0),P-=L,P===0&&(D--,P=F[D]),b-=L,b===0){O--;let M=Math.max(O,0);b=(0,g.getWrappedLineTrimmedLength)(x,M,this._cols)}}for(let L=0;L<x.length;L++)F[L]<c&&x[L].setCell(F[L],v);let E=R-$;for(;E-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+R,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let D=0;D<this.lines.length;D++)m.push(this.lines.get(D));let x=this.lines.length,A=x-1,I=0,F=C[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let R=0;for(let D=Math.min(this.lines.maxLength-1,x+w-1);D>=0;D--)if(F&&F.start>A+R){for(let P=F.newLines.length-1;P>=0;P--)this.lines.set(D--,F.newLines[P]);D++,y.push({index:A+1,amount:F.newLines.length}),R+=F.newLines.length,F=C[++I]}else this.lines.set(D,m[A--]);let $=0;for(let D=y.length-1;D>=0;D--)y[D].index+=$,this.lines.onInsertEmitter.fire(y[D]),$+=y[D].amount;let B=Math.max(0,x+w-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(c,u,v=0,C){let w=this.lines.get(c);return w?w.translateToString(u,v,C):""}getWrappedRangeForLine(c){let u=c,v=c;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:u,last:v}}setupTabStops(c){for(c!=null?this.tabs[c]||(c=this.prevStop(c)):(this.tabs={},c=0);c<this._cols;c+=this._optionsService.rawOptions.tabStopWidth)this.tabs[c]=!0}prevStop(c){for(c==null&&(c=this.x);!this.tabs[--c]&&c>0;);return c>=this._cols?this._cols-1:c<0?0:c}nextStop(c){for(c==null&&(c=this.x);!this.tabs[++c]&&c<this._cols;);return c>=this._cols?this._cols-1:c<0?0:c}clearMarkers(c){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===c&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let c=0;c<this.markers.length;c++)this.markers[c].dispose(),this.markers.splice(c--,1);this._isClearing=!1}addMarker(c){let u=new h.Marker(c);return this.markers.push(u),u.register(this.lines.onTrim((v=>{u.line-=v,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((v=>{u.line>=v.index&&(u.line+=v.amount)}))),u.register(this.lines.onDelete((v=>{u.line>=v.index&&u.line<v.index+v.amount&&u.dispose(),u.line>v.index&&(u.line-=v.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(c){this._isClearing||this.markers.splice(this.markers.indexOf(c),1)}}},8437:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let a=s(3734),f=s(511),o=s(643),_=s(482);r.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let g=0;class S{constructor(h,d,c=!1){this.isWrapped=c,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*h);let u=d||f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let v=0;v<h;++v)this.setCell(v,u);this.length=h}get(h){let d=this._data[3*h+0],c=2097151&d;return[this._data[3*h+1],2097152&d?this._combined[h]:c?(0,_.stringFromCodePoint)(c):"",d>>22,2097152&d?this._combined[h].charCodeAt(this._combined[h].length-1):c]}set(h,d){this._data[3*h+1]=d[o.CHAR_DATA_ATTR_INDEX],d[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[h]=d[1],this._data[3*h+0]=2097152|h|d[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*h+0]=d[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(h){return this._data[3*h+0]>>22}hasWidth(h){return 12582912&this._data[3*h+0]}getFg(h){return this._data[3*h+1]}getBg(h){return this._data[3*h+2]}hasContent(h){return 4194303&this._data[3*h+0]}getCodePoint(h){let d=this._data[3*h+0];return 2097152&d?this._combined[h].charCodeAt(this._combined[h].length-1):2097151&d}isCombined(h){return 2097152&this._data[3*h+0]}getString(h){let d=this._data[3*h+0];return 2097152&d?this._combined[h]:2097151&d?(0,_.stringFromCodePoint)(2097151&d):""}isProtected(h){return 536870912&this._data[3*h+2]}loadCell(h,d){return g=3*h,d.content=this._data[g+0],d.fg=this._data[g+1],d.bg=this._data[g+2],2097152&d.content&&(d.combinedData=this._combined[h]),268435456&d.bg&&(d.extended=this._extendedAttrs[h]),d}setCell(h,d){2097152&d.content&&(this._combined[h]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[h]=d.extended),this._data[3*h+0]=d.content,this._data[3*h+1]=d.fg,this._data[3*h+2]=d.bg}setCellFromCodepoint(h,d,c,u){268435456&u.bg&&(this._extendedAttrs[h]=u.extended),this._data[3*h+0]=d|c<<22,this._data[3*h+1]=u.fg,this._data[3*h+2]=u.bg}addCodepointToCell(h,d,c){let u=this._data[3*h+0];2097152&u?this._combined[h]+=(0,_.stringFromCodePoint)(d):2097151&u?(this._combined[h]=(0,_.stringFromCodePoint)(2097151&u)+(0,_.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,c&&(u&=-12582913,u|=c<<22),this._data[3*h+0]=u}insertCells(h,d,c){if((h%=this.length)&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,c),d<this.length-h){let u=new f.CellData;for(let v=this.length-h-d-1;v>=0;--v)this.setCell(h+d+v,this.loadCell(h+v,u));for(let v=0;v<d;++v)this.setCell(h+v,c)}else for(let u=h;u<this.length;++u)this.setCell(u,c);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,c)}deleteCells(h,d,c){if(h%=this.length,d<this.length-h){let u=new f.CellData;for(let v=0;v<this.length-h-d;++v)this.setCell(h+v,this.loadCell(h+d+v,u));for(let v=this.length-d;v<this.length;++v)this.setCell(v,c)}else for(let u=h;u<this.length;++u)this.setCell(u,c);h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,c),this.getWidth(h)!==0||this.hasContent(h)||this.setCellFromCodepoint(h,0,1,c)}replaceCells(h,d,c,u=!1){if(u)for(h&&this.getWidth(h-1)===2&&!this.isProtected(h-1)&&this.setCellFromCodepoint(h-1,0,1,c),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,c);h<d&&h<this.length;)this.isProtected(h)||this.setCell(h,c),h++;else for(h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,c),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,c);h<d&&h<this.length;)this.setCell(h++,c)}resize(h,d){if(h===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let c=3*h;if(h>this.length){if(this._data.buffer.byteLength>=4*c)this._data=new Uint32Array(this._data.buffer,0,c);else{let u=new Uint32Array(c);u.set(this._data),this._data=u}for(let u=this.length;u<h;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,c);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let w=parseInt(u[C],10);w>=h&&delete this._combined[w]}let v=Object.keys(this._extendedAttrs);for(let C=0;C<v.length;C++){let w=parseInt(v[C],10);w>=h&&delete this._extendedAttrs[w]}}return this.length=h,4*c*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let h=new Uint32Array(this._data.length);return h.set(this._data),this._data=h,1}return 0}fill(h,d=!1){if(d)for(let c=0;c<this.length;++c)this.isProtected(c)||this.setCell(c,h);else{this._combined={},this._extendedAttrs={};for(let c=0;c<this.length;++c)this.setCell(c,h)}}copyFrom(h){this.length!==h.length?this._data=new Uint32Array(h._data):this._data.set(h._data),this.length=h.length,this._combined={};for(let d in h._combined)this._combined[d]=h._combined[d];this._extendedAttrs={};for(let d in h._extendedAttrs)this._extendedAttrs[d]=h._extendedAttrs[d];this.isWrapped=h.isWrapped}clone(){let h=new S(0);h._data=new Uint32Array(this._data),h.length=this.length;for(let d in this._combined)h._combined[d]=this._combined[d];for(let d in this._extendedAttrs)h._extendedAttrs[d]=this._extendedAttrs[d];return h.isWrapped=this.isWrapped,h}getTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0])return h+(this._data[3*h+0]>>22);return 0}getNoBgTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0]||50331648&this._data[3*h+2])return h+(this._data[3*h+0]>>22);return 0}copyCellsFrom(h,d,c,u,v){let C=h._data;if(v)for(let y=u-1;y>=0;y--){for(let m=0;m<3;m++)this._data[3*(c+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[c+y]=h._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(c+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[c+y]=h._extendedAttrs[d+y])}let w=Object.keys(h._combined);for(let y=0;y<w.length;y++){let m=parseInt(w[y],10);m>=d&&(this._combined[m-d+c]=h._combined[m])}}translateToString(h,d,c,u){d=d??0,c=c??this.length,h&&(c=Math.min(c,this.getTrimmedLength())),u&&(u.length=0);let v="";for(;d<c;){let C=this._data[3*d+0],w=2097151&C,y=2097152&C?this._combined[d]:w?(0,_.stringFromCodePoint)(w):o.WHITESPACE_CELL_CHAR;if(v+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),v}}r.BufferLine=S},4841:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(s,a){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return a*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}},4634:(l,r)=>{function s(a,f,o){if(f===a.length-1)return a[f].getTrimmedLength();let _=!a[f].hasContent(o-1)&&a[f].getWidth(o-1)===1,g=a[f+1].getWidth(0)===2;return _&&g?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(a,f,o,_,g){let S=[];for(let p=0;p<a.length-1;p++){let h=p,d=a.get(++h);if(!d.isWrapped)continue;let c=[a.get(p)];for(;h<a.length&&d.isWrapped;)c.push(d),d=a.get(++h);if(_>=p&&_<h){p+=c.length-1;continue}let u=0,v=s(c,u,f),C=1,w=0;for(;C<c.length;){let m=s(c,C,f),x=m-w,A=o-v,I=Math.min(x,A);c[u].copyCellsFrom(c[C],w,v,I,!1),v+=I,v===o&&(u++,v=0),w+=I,w===m&&(C++,w=0),v===0&&u!==0&&c[u-1].getWidth(o-1)===2&&(c[u].copyCellsFrom(c[u-1],o-1,v++,1,!1),c[u-1].setCell(o-1,g))}c[u].replaceCells(v,o,g);let y=0;for(let m=c.length-1;m>0&&(m>u||c[m].getTrimmedLength()===0);m--)y++;y>0&&(S.push(p+c.length-y),S.push(y)),p+=c.length-1}return S},r.reflowLargerCreateNewLayout=function(a,f){let o=[],_=0,g=f[_],S=0;for(let p=0;p<a.length;p++)if(g===p){let h=f[++_];a.onDeleteEmitter.fire({index:p-S,amount:h}),p+=h-1,S+=h,g=f[++_]}else o.push(p);return{layout:o,countRemoved:S}},r.reflowLargerApplyNewLayout=function(a,f){let o=[];for(let _=0;_<f.length;_++)o.push(a.get(f[_]));for(let _=0;_<o.length;_++)a.set(_,o[_]);a.length=f.length},r.reflowSmallerGetNewLineLengths=function(a,f,o){let _=[],g=a.map(((d,c)=>s(a,c,f))).reduce(((d,c)=>d+c)),S=0,p=0,h=0;for(;h<g;){if(g-h<o){_.push(g-h);break}S+=o;let d=s(a,p,f);S>d&&(S-=d,p++);let c=a[p].getWidth(S-1)===2;c&&S--;let u=c?o-1:o;_.push(u),h+=u}return _},r.getWrappedLineTrimmedLength=s},5295:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let a=s(8460),f=s(844),o=s(9092);class _ extends f.Disposable{constructor(S,p){super(),this._optionsService=S,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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(S,p){this._normal.resize(S,p),this._alt.resize(S,p),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}r.BufferSet=_},511:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let a=s(482),f=s(643),o=s(3734);class _ extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(S){let p=new _;return p.setFromCharData(S),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(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){let h=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){let d=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(h-55296)+d-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},643:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let a=s(8460),f=s(844);class o{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new a.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}r.Marker=o,o._nextId=1},7116:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(l,r)=>{var s,a,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
8
|
+
`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="\x7F"})(s||(r.C0=s={})),(function(o){o.PAD="\x80",o.HOP="\x81",o.BPH="\x82",o.NBH="\x83",o.IND="\x84",o.NEL="\x85",o.SSA="\x86",o.ESA="\x87",o.HTS="\x88",o.HTJ="\x89",o.VTS="\x8A",o.PLD="\x8B",o.PLU="\x8C",o.RI="\x8D",o.SS2="\x8E",o.SS3="\x8F",o.DCS="\x90",o.PU1="\x91",o.PU2="\x92",o.STS="\x93",o.CCH="\x94",o.MW="\x95",o.SPA="\x96",o.EPA="\x97",o.SOS="\x98",o.SGCI="\x99",o.SCI="\x9A",o.CSI="\x9B",o.ST="\x9C",o.OSC="\x9D",o.PM="\x9E",o.APC="\x9F"})(a||(r.C1=a={})),(function(o){o.ST=`${s.ESC}\\`})(f||(r.C1_ESCAPED=f={}))},7399:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let a=s(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(o,_,g,S){let p={type:0,cancel:!1,key:void 0},h=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=o.ctrlKey?"\b":a.C0.DEL,o.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(o.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=o.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,o.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(o.metaKey)break;h?(p.key=a.C0.ESC+"[1;"+(h+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(g?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(o.metaKey)break;h?(p.key=a.C0.ESC+"[1;"+(h+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(g?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(o.metaKey)break;h?(p.key=a.C0.ESC+"[1;"+(h+1)+"A",g||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(o.metaKey)break;h?(p.key=a.C0.ESC+"[1;"+(h+1)+"B",g||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:o.shiftKey||o.ctrlKey||(p.key=a.C0.ESC+"[2~");break;case 46:p.key=h?a.C0.ESC+"[3;"+(h+1)+"~":a.C0.ESC+"[3~";break;case 36:p.key=h?a.C0.ESC+"[1;"+(h+1)+"H":_?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:p.key=h?a.C0.ESC+"[1;"+(h+1)+"F":_?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:o.shiftKey?p.type=2:o.ctrlKey?p.key=a.C0.ESC+"[5;"+(h+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:o.shiftKey?p.type=3:o.ctrlKey?p.key=a.C0.ESC+"[6;"+(h+1)+"~":p.key=a.C0.ESC+"[6~";break;case 112:p.key=h?a.C0.ESC+"[1;"+(h+1)+"P":a.C0.ESC+"OP";break;case 113:p.key=h?a.C0.ESC+"[1;"+(h+1)+"Q":a.C0.ESC+"OQ";break;case 114:p.key=h?a.C0.ESC+"[1;"+(h+1)+"R":a.C0.ESC+"OR";break;case 115:p.key=h?a.C0.ESC+"[1;"+(h+1)+"S":a.C0.ESC+"OS";break;case 116:p.key=h?a.C0.ESC+"[15;"+(h+1)+"~":a.C0.ESC+"[15~";break;case 117:p.key=h?a.C0.ESC+"[17;"+(h+1)+"~":a.C0.ESC+"[17~";break;case 118:p.key=h?a.C0.ESC+"[18;"+(h+1)+"~":a.C0.ESC+"[18~";break;case 119:p.key=h?a.C0.ESC+"[19;"+(h+1)+"~":a.C0.ESC+"[19~";break;case 120:p.key=h?a.C0.ESC+"[20;"+(h+1)+"~":a.C0.ESC+"[20~";break;case 121:p.key=h?a.C0.ESC+"[21;"+(h+1)+"~":a.C0.ESC+"[21~";break;case 122:p.key=h?a.C0.ESC+"[23;"+(h+1)+"~":a.C0.ESC+"[23~";break;case 123:p.key=h?a.C0.ESC+"[24;"+(h+1)+"~":a.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(g&&!S||!o.altKey||o.metaKey)!g||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?p.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(p.key=a.C0.US),o.key==="@"&&(p.key=a.C0.NUL)):o.keyCode===65&&(p.type=1);else{let d=f[o.keyCode],c=d?.[o.shiftKey?1:0];if(c)p.key=a.C0.ESC+c;else if(o.keyCode>=65&&o.keyCode<=90){let u=o.ctrlKey?o.keyCode-64:o.keyCode+32,v=String.fromCharCode(u);o.shiftKey&&(v=v.toUpperCase()),p.key=a.C0.ESC+v}else if(o.keyCode===32)p.key=a.C0.ESC+(o.ctrlKey?a.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let u=o.code.slice(3,4);o.shiftKey||(u=u.toLowerCase()),p.key=a.C0.ESC+u,p.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?p.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?p.key=a.C0.NUL:o.keyCode>=51&&o.keyCode<=55?p.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?p.key=a.C0.DEL:o.keyCode===219?p.key=a.C0.ESC:o.keyCode===220?p.key=a.C0.FS:o.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(s){return s>65535?(s-=65536,String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)},r.utf32ToString=function(s,a=0,f=s.length){let o="";for(let _=a;_<f;++_){let g=s[_];g>65535?(g-=65536,o+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):o+=String.fromCharCode(g)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(s,a){let f=s.length;if(!f)return 0;let o=0,_=0;if(this._interim){let g=s.charCodeAt(_++);56320<=g&&g<=57343?a[o++]=1024*(this._interim-55296)+g-56320+65536:(a[o++]=this._interim,a[o++]=g),this._interim=0}for(let g=_;g<f;++g){let S=s.charCodeAt(g);if(55296<=S&&S<=56319){if(++g>=f)return this._interim=S,o;let p=s.charCodeAt(g);56320<=p&&p<=57343?a[o++]=1024*(S-55296)+p-56320+65536:(a[o++]=S,a[o++]=p)}else S!==65279&&(a[o++]=S)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(s,a){let f=s.length;if(!f)return 0;let o,_,g,S,p=0,h=0,d=0;if(this.interim[0]){let v=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,y=0;for(;(w=63&this.interim[++y])&&y<4;)C<<=6,C|=w;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=m-y;for(;d<x;){if(d>=f)return 0;if(w=s[d++],(192&w)!=128){d--,v=!0;break}this.interim[y++]=w,C<<=6,C|=63&w}v||(m===2?C<128?d--:a[p++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(a[p++]=C):C<65536||C>1114111||(a[p++]=C)),this.interim.fill(0)}let c=f-4,u=d;for(;u<f;){for(;!(!(u<c)||128&(o=s[u])||128&(_=s[u+1])||128&(g=s[u+2])||128&(S=s[u+3]));)a[p++]=o,a[p++]=_,a[p++]=g,a[p++]=S,u+=4;if(o=s[u++],o<128)a[p++]=o;else if((224&o)==192){if(u>=f)return this.interim[0]=o,p;if(_=s[u++],(192&_)!=128){u--;continue}if(h=(31&o)<<6|63&_,h<128){u--;continue}a[p++]=h}else if((240&o)==224){if(u>=f)return this.interim[0]=o,p;if(_=s[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=_,p;if(g=s[u++],(192&g)!=128){u--;continue}if(h=(15&o)<<12|(63&_)<<6|63&g,h<2048||h>=55296&&h<=57343||h===65279)continue;a[p++]=h}else if((248&o)==240){if(u>=f)return this.interim[0]=o,p;if(_=s[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=_,p;if(g=s[u++],(192&g)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=_,this.interim[2]=g,p;if(S=s[u++],(192&S)!=128){u--;continue}if(h=(7&o)<<18|(63&_)<<12|(63&g)<<6|63&S,h<65536||h>1114111)continue;a[p++]=h}}return p}}},225:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let a=s(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],o=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],_;r.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let g=0;g<f.length;++g)_.fill(0,f[g][0],f[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?_[g]:(function(S,p){let h,d=0,c=p.length-1;if(S<p[0][0]||S>p[c][1])return!1;for(;c>=d;)if(h=d+c>>1,S>p[h][1])d=h+1;else{if(!(S<p[h][0]))return!0;c=h-1}return!1})(g,o)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,S){let p=this.wcwidth(g),h=p===0&&S!==0;if(h){let d=a.UnicodeService.extractWidth(S);d===0?h=!1:d>p&&(p=d)}return a.UnicodeService.createPropertyValue(0,p,h)}}},5981:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let a=s(8460),f=s(844);class o extends f.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let h=this._callbacks.shift();h&&h()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,S){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(S)}_innerWrite(g=0,S=!0){let p=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let h=this._writeBuffer[this._bufferOffset],d=this._action(h,S);if(d){let u=v=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(p,v);return void d.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(u)}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=h.length,Date.now()-p>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=o},5941:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;let s=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,a=/^[\da-f]+$/;function f(o,_){let g=o.toString(16),S=g.length<2?"0"+g:g;switch(_){case 4:return g[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}r.parseColor=function(o){if(!o)return;let _=o.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let g=s.exec(_);if(g){let S=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/S*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/S*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/S*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let g=_.length/3,S=[0,0,0];for(let p=0;p<3;++p){let h=parseInt(_.slice(g*p,g*p+g),16);S[p]=g===1?h<<4:g===2?h:g===3?h>>4:h>>8}return S}},r.toRgbString=function(o,_=16){let[g,S,p]=o;return`rgb:${f(g,_)}/${f(S,_)}/${f(p,_)}`}},5770:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let a=s(482),f=s(8742),o=s(5770),_=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(S,p){this._handlers[S]===void 0&&(this._handlers[S]=[]);let h=this._handlers[S];return h.push(p),{dispose:()=>{let d=h.indexOf(p);d!==-1&&h.splice(d,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(S,p){if(this.reset(),this._ident=S,this._active=this._handlers[S]||_,this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(S,p,h){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(S,p,h);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(S,p,h))}unhook(S,p=!0){if(this._active.length){let h=!1,d=this._active.length-1,c=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,h=p,c=this._stack.fallThrough,this._stack.paused=!1),!c&&h===!1){for(;d>=0&&(h=this._active[d].unhook(S),h!==!0);d--)if(h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,h;d--}for(;d>=0;d--)if(h=this._active[d].unhook(!1),h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,h}else this._handlerFb(this._ident,"UNHOOK",S);this._active=_,this._ident=0}};let g=new f.Params;g.addParam(0),r.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=g,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():g,this._data="",this._hitLimit=!1}put(S,p,h){this._hitLimit||(this._data+=(0,a.utf32ToString)(S,p,h),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let p=!1;if(this._hitLimit)p=!1;else if(S&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((h=>(this._params=g,this._data="",this._hitLimit=!1,h)));return this._params=g,this._data="",this._hitLimit=!1,p}}},2015:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let a=s(844),f=s(8742),o=s(6242),_=s(6351);class g{constructor(d){this.table=new Uint8Array(d)}setDefault(d,c){this.table.fill(d<<4|c)}add(d,c,u,v){this.table[c<<8|d]=u<<4|v}addMany(d,c,u,v){for(let C=0;C<d.length;C++)this.table[c<<8|d[C]]=u<<4|v}}r.TransitionTable=g;let S=160;r.VT500_TRANSITION_TABLE=(function(){let h=new g(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),c=(y,m)=>d.slice(y,m),u=c(32,127),v=c(0,24);v.push(25),v.push.apply(v,c(28,32));let C=c(0,14),w;for(w in h.setDefault(1,0),h.addMany(u,0,2,0),C)h.addMany([24,26,153,154],w,3,0),h.addMany(c(128,144),w,3,0),h.addMany(c(144,152),w,3,0),h.add(156,w,0,0),h.add(27,w,11,1),h.add(157,w,4,8),h.addMany([152,158,159],w,0,7),h.add(155,w,11,3),h.add(144,w,11,9);return h.addMany(v,0,3,0),h.addMany(v,1,3,1),h.add(127,1,0,1),h.addMany(v,8,0,8),h.addMany(v,3,3,3),h.add(127,3,0,3),h.addMany(v,4,3,4),h.add(127,4,0,4),h.addMany(v,6,3,6),h.addMany(v,5,3,5),h.add(127,5,0,5),h.addMany(v,2,3,2),h.add(127,2,0,2),h.add(93,1,4,8),h.addMany(u,8,5,8),h.add(127,8,5,8),h.addMany([156,27,24,26,7],8,6,0),h.addMany(c(28,32),8,0,8),h.addMany([88,94,95],1,0,7),h.addMany(u,7,0,7),h.addMany(v,7,0,7),h.add(156,7,0,0),h.add(127,7,0,7),h.add(91,1,11,3),h.addMany(c(64,127),3,7,0),h.addMany(c(48,60),3,8,4),h.addMany([60,61,62,63],3,9,4),h.addMany(c(48,60),4,8,4),h.addMany(c(64,127),4,7,0),h.addMany([60,61,62,63],4,0,6),h.addMany(c(32,64),6,0,6),h.add(127,6,0,6),h.addMany(c(64,127),6,0,0),h.addMany(c(32,48),3,9,5),h.addMany(c(32,48),5,9,5),h.addMany(c(48,64),5,0,6),h.addMany(c(64,127),5,7,0),h.addMany(c(32,48),4,9,5),h.addMany(c(32,48),1,9,2),h.addMany(c(32,48),2,9,2),h.addMany(c(48,127),2,10,0),h.addMany(c(48,80),1,10,0),h.addMany(c(81,88),1,10,0),h.addMany([89,90,92],1,10,0),h.addMany(c(96,127),1,10,0),h.add(80,1,11,9),h.addMany(v,9,0,9),h.add(127,9,0,9),h.addMany(c(28,32),9,0,9),h.addMany(c(32,48),9,9,12),h.addMany(c(48,60),9,8,10),h.addMany([60,61,62,63],9,9,10),h.addMany(v,11,0,11),h.addMany(c(32,128),11,0,11),h.addMany(c(28,32),11,0,11),h.addMany(v,10,0,10),h.add(127,10,0,10),h.addMany(c(28,32),10,0,10),h.addMany(c(48,60),10,8,10),h.addMany([60,61,62,63],10,0,11),h.addMany(c(32,48),10,9,12),h.addMany(v,12,0,12),h.add(127,12,0,12),h.addMany(c(28,32),12,0,12),h.addMany(c(32,48),12,9,12),h.addMany(c(48,64),12,0,11),h.addMany(c(64,127),12,12,13),h.addMany(c(64,127),10,12,13),h.addMany(c(64,127),9,12,13),h.addMany(v,13,13,13),h.addMany(u,13,13,13),h.add(127,13,0,13),h.addMany([27,156,24,26],13,14,0),h.add(S,0,2,0),h.add(S,8,5,8),h.add(S,6,0,6),h.add(S,11,0,11),h.add(S,13,13,13),h})();class p extends a.Disposable{constructor(d=r.VT500_TRANSITION_TABLE){super(),this._transitions=d,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(c,u,v)=>{},this._executeHandlerFb=c=>{},this._csiHandlerFb=(c,u)=>{},this._escHandlerFb=c=>{},this._errorHandlerFb=c=>c,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 o.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,c=[64,126]){let u=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=d.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<d.intermediates.length;++C){let w=d.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");let v=d.final.charCodeAt(0);if(c[0]>v||v>c[1])throw new Error(`final must be in range ${c[0]} .. ${c[1]}`);return u<<=8,u|=v,u}identToString(d){let c=[];for(;d;)c.push(String.fromCharCode(255&d)),d>>=8;return c.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,c){let u=this._identifier(d,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let v=this._escHandlers[u];return v.push(c),{dispose:()=>{let C=v.indexOf(c);C!==-1&&v.splice(C,1)}}}clearEscHandler(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,c){this._executeHandlers[d.charCodeAt(0)]=c}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,c){let u=this._identifier(d);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let v=this._csiHandlers[u];return v.push(c),{dispose:()=>{let C=v.indexOf(c);C!==-1&&v.splice(C,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,c){return this._dcsParser.registerHandler(this._identifier(d),c)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,c){return this._oscParser.registerHandler(d,c)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(d,c,u,v,C){this._parseStack.state=d,this._parseStack.handlers=c,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=C}parse(d,c,u){let v,C=0,w=0,y=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,y=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let m=this._parseStack.handlers,x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](this._params),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 6:if(C=d[this._parseStack.chunkPos],v=this._dcsParser.unhook(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=d[this._parseStack.chunkPos],v=this._oscParser.end(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,y=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let m=y;m<c;++m){switch(C=d[m],w=this._transitions.table[this.currentState<<8|(C<160?C:S)],w>>4){case 2:for(let R=m+1;;++R){if(R>=c||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=c||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=c||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=c||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:m,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let x=this._csiHandlers[this._collect<<8|C],A=x?x.length-1:-1;for(;A>=0&&(v=x[A](this._params),v!==!0);A--)if(v instanceof Promise)return this._preserveStack(3,x,A,w,m),v;A<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++m<c&&(C=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let I=this._escHandlers[this._collect<<8|C],F=I?I.length-1:-1;for(;F>=0&&(v=I[F](),v!==!0);F--)if(v instanceof Promise)return this._preserveStack(4,I,F,w,m),v;F<0&&this._escHandlerFb(this._collect<<8|C),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|C,this._params);break;case 13:for(let R=m+1;;++R)if(R>=c||(C=d[R])===24||C===26||C===27||C>127&&C<S){this._dcsParser.put(d,m,R),m=R-1;break}break;case 14:if(v=this._dcsParser.unhook(C!==24&&C!==26),v)return this._preserveStack(6,[],0,w,m),v;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let R=m+1;;R++)if(R>=c||(C=d[R])<32||C>127&&C<S){this._oscParser.put(d,m,R),m=R-1;break}break;case 6:if(v=this._oscParser.end(C!==24&&C!==26),v)return this._preserveStack(5,[],0,w,m),v;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}r.EscapeSequenceParser=p},6242:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let a=s(5770),f=s(482),o=[];r.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,g){this._handlers[_]===void 0&&(this._handlers[_]=[]);let S=this._handlers[_];return S.push(g),{dispose:()=>{let p=S.indexOf(g);p!==-1&&S.splice(p,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,g,S){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,g,S);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,g,S))}start(){this.reset(),this._state=1}put(_,g,S){if(this._state!==3){if(this._state===1)for(;g<S;){let p=_[g++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&S-g>0&&this._put(_,g,S)}}end(_,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,p=this._active.length-1,h=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,S=g,h=this._stack.fallThrough,this._stack.paused=!1),!h&&S===!1){for(;p>=0&&(S=this._active[p].end(_),S!==!0);p--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,S;p--}for(;p>=0;p--)if(S=this._active[p].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",_);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,g,S){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,g,S),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let g=!1;if(this._hitLimit)g=!1;else if(_&&(g=this._handler(this._data),g instanceof Promise))return g.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,g}}},8742:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let s=2147483647;class a{static fromArray(o){let _=new a;if(!o.length)return _;for(let g=Array.isArray(o[0])?1:0;g<o.length;++g){let S=o[g];if(Array.isArray(S))for(let p=0;p<S.length;++p)_.addSubParam(S[p]);else _.addParam(S)}return _}constructor(o=32,_=32){if(this.maxLength=o,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new a(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){let o=[];for(let _=0;_<this.length;++_){o.push(this.params[_]);let g=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-g>0&&o.push(Array.prototype.slice.call(this._subParams,g,S))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>s?s:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>s?s:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){let _=this._subParamsIdx[o]>>8,g=255&this._subParamsIdx[o];return g-_>0?this._subParams.subarray(_,g):null}getSubParamsAll(){let o={};for(let _=0;_<this.length;++_){let g=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-g>0&&(o[_]=this._subParams.slice(g,S))}return o}addDigit(o){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let g=this._digitIsSub?this._subParams:this.params,S=g[_-1];g[_-1]=~S?Math.min(10*S+o,s):o}}r.Params=a},5741:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let s=this._addons.length-1;s>=0;s--)this._addons[s].instance.dispose()}loadAddon(s,a){let f={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(f),a.dispose=()=>this._wrappedAddonDispose(f),a.activate(s)}_wrappedAddonDispose(s){if(s.isDisposed)return;let a=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===s){a=f;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");s.isDisposed=!0,s.dispose.apply(s.instance),this._addons.splice(a,1)}}},8771:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let a=s(3785),f=s(511);r.BufferApiView=class{constructor(o,_){this._buffer=o,this.type=_}init(o){return this._buffer=o,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(o){let _=this._buffer.lines.get(o);if(_)return new a.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let a=s(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,o){if(!(f<0||f>=this._line.length))return o?(this._line.loadCell(f,o),o):this._line.loadCell(f,new a.CellData)}translateToString(f,o,_){return this._line.translateToString(f,o,_)}}},8285:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let a=s(8771),f=s(8460),o=s(844);class _ extends o.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new a.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new a.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=_},7975:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(s){this._core=s}registerCsiHandler(s,a){return this._core.registerCsiHandler(s,(f=>a(f.toArray())))}addCsiHandler(s,a){return this.registerCsiHandler(s,a)}registerDcsHandler(s,a){return this._core.registerDcsHandler(s,((f,o)=>a(f,o.toArray())))}addDcsHandler(s,a){return this.registerDcsHandler(s,a)}registerEscHandler(s,a){return this._core.registerEscHandler(s,a)}addEscHandler(s,a){return this.registerEscHandler(s,a)}registerOscHandler(s,a){return this._core.registerOscHandler(s,a)}addOscHandler(s,a){return this.registerOscHandler(s,a)}}},7090:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(s){this._core=s}register(s){this._core.unicodeService.register(s)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(s){this._core.unicodeService.activeVersion=s}}},744:function(l,r,s){var a=this&&this.__decorate||function(h,d,c,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,c):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,d,c,u);else for(var y=h.length-1;y>=0;y--)(v=h[y])&&(w=(C<3?v(w):C>3?v(d,c,w):v(d,c))||w);return C>3&&w&&Object.defineProperty(d,c,w),w},f=this&&this.__param||function(h,d){return function(c,u){d(c,u,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let o=s(8460),_=s(844),g=s(5295),S=s(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let p=r.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(h){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(h.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(h.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(h,this))}resize(h,d){this.cols=h,this.rows=d,this.buffers.resize(h,d),this._onResize.fire({cols:h,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(h,d=!1){let c=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===h.fg&&u.getBg(0)===h.bg||(u=c.getBlankLine(h,d),this._cachedBlankLine=u),u.isWrapped=d;let v=c.ybase+c.scrollTop,C=c.ybase+c.scrollBottom;if(c.scrollTop===0){let w=c.lines.isFull;C===c.lines.length-1?w?c.lines.recycle().copyFrom(u):c.lines.push(u.clone()):c.lines.splice(C+1,0,u.clone()),w?this.isUserScrolling&&(c.ydisp=Math.max(c.ydisp-1,0)):(c.ybase++,this.isUserScrolling||c.ydisp++)}else{let w=C-v+1;c.lines.shiftElements(v+1,w-1,-1),c.lines.set(C,u.clone())}this.isUserScrolling||(c.ydisp=c.ybase),this._onScroll.fire(c.ydisp)}scrollLines(h,d,c){let u=this.buffer;if(h<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else h+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+h,u.ybase),0),v!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};r.BufferService=p=a([f(0,S.IOptionsService)],p)},7994:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(s){this.glevel=s,this.charset=this._charsets[s]}setgCharset(s,a){this._charsets[s]=a,this.glevel===s&&(this.charset=a)}}},1753:function(l,r,s){var a=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var A=u.length-1;A>=0;A--)(y=u[A])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let o=s(2585),_=s(8460),g=s(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,v){let C=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(C|=64,C|=u.action):(C|=3&u.button,4&u.button&&(C|=64),8&u.button&&(C|=128),u.action===32?C|=32:u.action!==0||v||(C|=3)),C}let h=String.fromCharCode,d={DEFAULT:u=>{let v=[p(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${h(v[0])}${h(v[1])}${h(v[2])}`},SGR:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${v}`}},c=r.CoreMouseService=class extends g.Disposable{constructor(u,v){super(),this._bufferService=u,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(S))this.addProtocol(C,S[C]);for(let C of Object.keys(d))this.addEncoding(C,d[C]);this.reset()}addProtocol(u,v){this._protocols[u]=v}addEncoding(u,v){this._encodings[u]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;let v=this._encodings[this._activeEncoding](u);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,v,C){if(C){if(u.x!==v.x||u.y!==v.y)return!1}else if(u.col!==v.col||u.row!==v.row)return!1;return u.button===v.button&&u.action===v.action&&u.ctrl===v.ctrl&&u.alt===v.alt&&u.shift===v.shift}};r.CoreMouseService=c=a([f(0,o.IBufferService),f(1,o.ICoreService)],c)},6975:function(l,r,s){var a=this&&this.__decorate||function(c,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(c,u,v,C);else for(var x=c.length-1;x>=0;x--)(w=c[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(c,u){return function(v,C){u(v,C,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let o=s(1439),_=s(8460),g=s(844),S=s(2585),p=Object.freeze({insertMode:!1}),h=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=r.CoreService=class extends g.Disposable{constructor(c,u,v){super(),this._bufferService=c,this._logService=u,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(p),this.decPrivateModes=(0,o.clone)(h)}reset(){this.modes=(0,o.clone)(p),this.decPrivateModes=(0,o.clone)(h)}triggerDataEvent(c,u=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${c}"`,(()=>c.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(c)}triggerBinaryEvent(c){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${c}"`,(()=>c.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(c))}};r.CoreService=d=a([f(0,S.IBufferService),f(1,S.ILogService),f(2,S.IOptionsService)],d)},9074:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let a=s(8055),f=s(8460),o=s(844),_=s(6106),g=0,S=0;class p extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((c=>c?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(c){if(c.marker.isDisposed)return;let u=new h(c);if(u){let v=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),v.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(let c of this._decorations.values())c.dispose();this._decorations.clear()}*getDecorationsAtCell(c,u,v){let C=0,w=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,w=C+(y.options.width??1),c>=C&&c<w&&(!v||(y.options.layer??"bottom")===v)&&(yield y)}forEachDecorationAtCell(c,u,v,C){this._decorations.forEachByKey(u,(w=>{g=w.options.x??0,S=g+(w.options.width??1),c>=g&&c<S&&(!v||(w.options.layer??"bottom")===v)&&C(w)}))}}r.DecorationService=p;class h extends o.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(c){super(),this.options=c,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=c.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let a=s(2585),f=s(8343);class o{constructor(...g){this._entries=new Map;for(let[S,p]of g)this.set(S,p)}set(g,S){let p=this._entries.get(g);return this._entries.set(g,S),p}forEach(g){for(let[S,p]of this._entries.entries())g(S,p)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(a.IInstantiationService,this)}setService(_,g){this._services.set(_,g)}getService(_){return this._services.get(_)}createInstance(_,...g){let S=(0,f.getServiceDependencies)(_).sort(((d,c)=>d.index-c.index)),p=[];for(let d of S){let c=this._services.get(d.id);if(!c)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${d.id}.`);p.push(c)}let h=S.length>0?S[0].index:g.length;if(g.length!==h)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${h+1} conflicts with ${g.length} static arguments`);return new _(...g,...p)}}},7866:function(l,r,s){var a=this&&this.__decorate||function(h,d,c,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,c):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,d,c,u);else for(var y=h.length-1;y>=0;y--)(v=h[y])&&(w=(C<3?v(w):C>3?v(d,c,w):v(d,c))||w);return C>3&&w&&Object.defineProperty(d,c,w),w},f=this&&this.__param||function(h,d){return function(c,u){d(c,u,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let o=s(844),_=s(2585),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},S,p=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),S=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let d=0;d<h.length;d++)typeof h[d]=="function"&&(h[d]=h[d]())}_log(h,d,c){this._evalLazyOptionalParams(c),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...c)}trace(h,...d){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,h,d)}debug(h,...d){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,h,d)}info(h,...d){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,h,d)}warn(h,...d){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,h,d)}error(h,...d){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,h,d)}};r.LogService=p=a([f(0,_.IOptionsService)],p),r.setTraceLogger=function(h){S=h},r.traceCall=function(h,d,c){if(typeof c.value!="function")throw new Error("not supported");let u=c.value;c.value=function(...v){if(S.logLevel!==_.LogLevelEnum.TRACE)return u.apply(this,v);S.trace(`GlyphRenderer#${u.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);let C=u.apply(this,v);return S.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let a=s(8460),f=s(844),o=s(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let _=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends f.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let h={...r.DEFAULT_OPTIONS};for(let d in p)if(d in h)try{let c=p[d];h[d]=this._sanitizeAndValidateOption(d,c)}catch(c){console.error(c)}this.rawOptions=h,this.options={...h},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,h){return this.onOptionChange((d=>{d===p&&h(this.rawOptions[p])}))}onMultipleOptionChange(p,h){return this.onOptionChange((d=>{p.indexOf(d)!==-1&&h()}))}_setupOptions(){let p=d=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},h=(d,c)=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);c=this._sanitizeAndValidateOption(d,c),this.rawOptions[d]!==c&&(this.rawOptions[d]=c,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let c={get:p.bind(this,d),set:h.bind(this,d)};Object.defineProperty(this.options,d,c)}}_sanitizeAndValidateOption(p,h){switch(p){case"cursorStyle":if(h||(h=r.DEFAULT_OPTIONS[p]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(h))throw new Error(`"${h}" is not a valid value for ${p}`);break;case"wordSeparator":h||(h=r.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof h=="number"&&1<=h&&h<=1e3)break;h=_.includes(h)?h:r.DEFAULT_OPTIONS[p];break;case"cursorWidth":h=Math.floor(h);case"lineHeight":case"tabStopWidth":if(h<1)throw new Error(`${p} cannot be less than 1, value: ${h}`);break;case"minimumContrastRatio":h=Math.max(1,Math.min(21,Math.round(10*h)/10));break;case"scrollback":if((h=Math.min(h,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${h}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(h<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${h}`);break;case"rows":case"cols":if(!h&&h!==0)throw new Error(`${p} must be numeric, value: ${h}`);break;case"windowsPty":h=h??{}}return h}}r.OptionsService=g},2660:function(l,r,s){var a=this&&this.__decorate||function(g,S,p,h){var d,c=arguments.length,u=c<3?S:h===null?h=Object.getOwnPropertyDescriptor(S,p):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(g,S,p,h);else for(var v=g.length-1;v>=0;v--)(d=g[v])&&(u=(c<3?d(u):c>3?d(S,p,u):d(S,p))||u);return c>3&&u&&Object.defineProperty(S,p,u),u},f=this&&this.__param||function(g,S){return function(p,h){S(p,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let o=s(2585),_=r.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){let S=this._bufferService.buffer;if(g.id===void 0){let v=S.addMarker(S.ybase+S.y),C={data:g,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(C,v))),this._dataByLinkId.set(C.id,C),C.id}let p=g,h=this._getEntryIdKey(p),d=this._entriesWithId.get(h);if(d)return this.addLineToLink(d.id,S.ybase+S.y),d.id;let c=S.addMarker(S.ybase+S.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[c]};return c.onDispose((()=>this._removeMarkerFromLink(u,c))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(g,S){let p=this._dataByLinkId.get(g);if(p&&p.lines.every((h=>h.line!==S))){let h=this._bufferService.buffer.addMarker(S);p.lines.push(h),h.onDispose((()=>this._removeMarkerFromLink(p,h)))}}getLinkData(g){return this._dataByLinkId.get(g)?.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,S){let p=g.lines.indexOf(S);p!==-1&&(g.lines.splice(p,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};r.OscLinkService=_=a([f(0,o.IBufferService)],_)},8343:(l,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let s="di$target",a="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[a]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);let o=function(_,g,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,h,d){h[s]===h?h[a].push({id:p,index:d}):(h[a]=[{id:p,index:d}],h[s]=h)})(o,_,S)};return o.toString=()=>f,r.serviceRegistry.set(f,o),o}},2585:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;let a=s(8343);var f;r.IBufferService=(0,a.createDecorator)("BufferService"),r.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),r.ICoreService=(0,a.createDecorator)("CoreService"),r.ICharsetService=(0,a.createDecorator)("CharsetService"),r.IInstantiationService=(0,a.createDecorator)("InstantiationService"),(function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(f||(r.LogLevelEnum=f={})),r.ILogService=(0,a.createDecorator)("LogService"),r.IOptionsService=(0,a.createDecorator)("OptionsService"),r.IOscLinkService=(0,a.createDecorator)("OscLinkService"),r.IUnicodeService=(0,a.createDecorator)("UnicodeService"),r.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(l,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let a=s(8460),f=s(225);class o{static extractShouldJoin(g){return(1&g)!=0}static extractWidth(g){return g>>1&3}static extractCharKind(g){return g>>3}static createPropertyValue(g,S,p=!1){return(16777215&g)<<3|(3&S)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let g=new f.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(g){if(!this._providers[g])throw new Error(`unknown Unicode version "${g}"`);this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)}register(g){this._providers[g.version]=g}wcwidth(g){return this._activeProvider.wcwidth(g)}getStringCellWidth(g){let S=0,p=0,h=g.length;for(let d=0;d<h;++d){let c=g.charCodeAt(d);if(55296<=c&&c<=56319){if(++d>=h)return S+this.wcwidth(c);let C=g.charCodeAt(d);56320<=C&&C<=57343?c=1024*(c-55296)+C-56320+65536:S+=this.wcwidth(C)}let u=this.charProperties(c,p),v=o.extractWidth(u);o.extractShouldJoin(u)&&(v-=o.extractWidth(p)),S+=v,p=u}return S}charProperties(g,S){return this._activeProvider.charProperties(g,S)}}r.UnicodeService=o}},t={};function i(l){var r=t[l];if(r!==void 0)return r.exports;var s=t[l]={exports:{}};return e[l].call(s.exports,s,s.exports,i),s.exports}var n={};return(()=>{var l=n;Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;let r=i(9042),s=i(3236),a=i(844),f=i(5741),o=i(8285),_=i(7975),g=i(7090),S=["cols","rows"];class p extends a.Disposable{constructor(d){super(),this._core=this.register(new s.Terminal(d)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let c=v=>this._core.options[v],u=(v,C)=>{this._checkReadonlyOptions(v),this._core.options[v]=C};for(let v in this._core.options){let C={get:c.bind(this,v),set:u.bind(this,v)};Object.defineProperty(this._publicOptions,v,C)}}_checkReadonlyOptions(d){if(S.includes(d))throw new Error(`Option "${d}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let d=this._core.coreService.decPrivateModes,c="none";switch(this._core.coreMouseService.activeProtocol){case"X10":c="x10";break;case"VT200":c="vt200";break;case"DRAG":c="drag";break;case"ANY":c="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:c,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let c in d)this._publicOptions[c]=d[c]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,c=!0){this._core.input(d,c)}resize(d,c){this._verifyIntegers(d,c),this._core.resize(d,c)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}attachCustomWheelEventHandler(d){this._core.attachCustomWheelEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){return this._checkProposedApi(),this._verifyPositiveIntegers(d.x??0,d.width??0,d.height??0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,c,u){this._verifyIntegers(d,c,u),this._core.select(d,c,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,c){this._verifyIntegers(d,c),this._core.selectLines(d,c)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,c){this._core.write(d,c)}writeln(d,c){this._core.write(d),this._core.write(`\r
|
|
9
|
+
`,c)}paste(d){this._core.paste(d)}refresh(d,c){this._verifyIntegers(d,c),this._core.refresh(d,c)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return r}_verifyIntegers(...d){for(let c of d)if(c===1/0||isNaN(c)||c%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(let c of d)if(c&&(c===1/0||isNaN(c)||c%1!=0||c<0))throw new Error("This API only accepts positive integers")}}l.Terminal=p})(),n})()))});var An=Ln((ir,ns)=>{(function(e,t){typeof ir=="object"&&typeof ns=="object"?ns.exports=t():typeof define=="function"&&define.amd?define([],t):typeof ir=="object"?ir.FitAddon=t():e.FitAddon=t()})(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){let i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;let n=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(n._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let i=this._terminal._core,n=i._renderService.dimensions;if(n.css.cell.width===0||n.css.cell.height===0)return;let l=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),o=s-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),_=a-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-l;return{cols:Math.max(2,Math.floor(_/n.css.cell.width)),rows:Math.max(1,Math.floor(o/n.css.cell.height))}}}})(),e})()))});var Wa=Mn(Tn(),1),$a=Mn(An(),1);var $l=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Dn.isErrorNoTelemetry(e)?new Dn(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)}},
|
|
14
|
-
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return o(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let
|
|
15
|
-
`),f)}n.sort(
|
|
16
|
-
`)).size}/${n.length} leaks) at ${S}`;let p=
|
|
17
|
-
`)),
|
|
13
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},zl=new $l;function os(e){Ul(e)||zl.onUnexpectedError(e)}var cs="Canceled";function Ul(e){return e instanceof jl?!0:e instanceof Error&&e.name===cs&&e.message===cs}var jl=class extends Error{constructor(){super(cs),this.name=this.message}},Dn=class hs extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof hs)return t;let i=new hs;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function ql(e,t,i=0,n=e.length){let l=i,r=n;for(;l<r;){let s=Math.floor((l+r)/2);t(e[s])?l=s+1:r=s}return l-1}var Kl=class jn{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(jn.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!t(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=ql(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Kl.assertInvariants=!1;var ds;(e=>{function t(r){return r<0}e.isLessThan=t;function i(r){return r<=0}e.isLessThanOrEqual=i;function n(r){return r>0}e.isGreaterThan=n;function l(r){return r===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ds||(ds={}));function Gl(e,t){return(i,n)=>t(e(i),e(n))}var Vl=(e,t)=>e-t,Bn=class us{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new us(i=>this.iterate(n=>t(n)?i(n):!0))}map(t){return new us(i=>this.iterate(n=>i(t(n))))}some(t){let i=!1;return this.iterate(n=>(i=t(n),!i)),i}findFirst(t){let i;return this.iterate(n=>t(n)?(i=n,!1):!0),i}findLast(t){let i;return this.iterate(n=>(t(n)&&(i=n),!0)),i}findLastMaxBy(t){let i,n=!0;return this.iterate(l=>((n||ds.isGreaterThan(t(l,i)))&&(n=!1,i=l),!0)),i}};Bn.empty=new Bn(e=>{});function Yl(e,t){let i=Object.create(null);for(let n of e){let l=t(n),r=i[l];r||(r=i[l]=[]),r.push(n)}return i}var Pn,On,c_=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Pn]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[(On=Symbol.iterator,Pn=Symbol.toStringTag,On)](){return this.values()}},Xl=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function Jl(e,t){let i=this,n=!1,l;return function(){if(n)return l;if(n=!0,t)try{l=e.apply(i,arguments)}finally{t()}else l=e.apply(i,arguments);return l}}var fs;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*l(w){yield w}e.single=l;function r(w){return t(w)?w:l(w)}e.wrap=r;function s(w){return w||i}e.from=s;function*a(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=a;function f(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=f;function o(w){return w[Symbol.iterator]().next().value}e.first=o;function _(w,y){let m=0;for(let x of w)if(y(x,m++))return!0;return!1}e.some=_;function g(w,y){for(let m of w)if(y(m))return m}e.find=g;function*S(w,y){for(let m of w)y(m)&&(yield m)}e.filter=S;function*p(w,y){let m=0;for(let x of w)yield y(x,m++)}e.map=p;function*h(w,y){let m=0;for(let x of w)yield*y(x,m++)}e.flatMap=h;function*d(...w){for(let y of w)yield*y}e.concat=d;function c(w,y,m){let x=m;for(let A of w)x=y(x,A);return x}e.reduce=c;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let x=w[Symbol.iterator]();for(let A=0;A<y;A++){let I=x.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(fs||(fs={}));var Zl=!1,Zt=null,Ql=class qn{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:qn.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=new Error().stack)}setParent(t,i){let n=this.getDisposableData(t);n.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let n=i.get(t);if(n)return n;let l=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,l),l}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let n;if(i)n=i;else{let f=new Map,o=[...this.livingDisposables.values()].filter(g=>g.source!==null&&!this.getRootParent(g,f).isSingleton);if(o.length===0)return;let _=new Set(o.map(g=>g.value));if(n=o.filter(g=>!(g.parent&&_.has(g.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function l(f){function o(g,S){for(;g.length>0&&S.some(p=>typeof p=="string"?p===g[0]:g[0].match(p));)g.shift()}let _=f.source.split(`
|
|
14
|
+
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return o(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let r=new Xl;for(let f of n){let o=l(f);for(let _=0;_<=o.length;_++)r.add(o.slice(0,_).join(`
|
|
15
|
+
`),f)}n.sort(Gl(f=>f.idx,Vl));let s="",a=0;for(let f of n.slice(0,t)){a++;let o=l(f),_=[];for(let g=0;g<o.length;g++){let S=o[g];S=`(shared with ${r.get(o.slice(0,g+1).join(`
|
|
16
|
+
`)).size}/${n.length} leaks) at ${S}`;let p=r.get(o.slice(0,g).join(`
|
|
17
|
+
`)),h=Yl([...p].map(d=>l(d)[g]),d=>d);delete h[o[g]];for(let[d,c]of Object.entries(h))_.unshift(` - stacktraces of ${c.length} other leaks continue with ${d}`);_.unshift(S)}s+=`
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
==================== Leaking disposable ${a}/${n.length}: ${f.value.constructor.name} ====================
|
|
@@ -22,25 +22,25 @@ ${_.join(`
|
|
|
22
22
|
`)}
|
|
23
23
|
============================================================
|
|
24
24
|
|
|
25
|
-
`}return n.length>t&&(
|
|
25
|
+
`}return n.length>t&&(s+=`
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
... and ${n.length-t} more leaking disposables
|
|
29
29
|
|
|
30
|
-
`),{leaks:n,details:
|
|
30
|
+
`),{leaks:n,details:s}}};Ql.idx=0;function ec(e){Zt=e}if(Zl){let e="__is_disposable_tracked__";ec(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==et.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==et.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function hr(e){return Zt?.trackDisposable(e),e}function dr(e){Zt?.markAsDisposed(e)}function xi(e,t){Zt?.setParent(e,t)}function tc(e,t){if(Zt)for(let i of e)Zt.setParent(i,t)}function yi(e){if(fs.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}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 Kn(...e){let t=Qt(()=>yi(e));return tc(e,t),t}function Qt(e){let t=hr({dispose:Jl(()=>{dr(t),e()})});return t}var Gn=class Vn{constructor(){this._toDispose=new Set,this._isDisposed=!1,hr(this)}dispose(){this._isDisposed||(dr(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{yi(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?Vn.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))}};Gn.DISABLE_DISPOSED_WARNING=!1;var ws=Gn,et=class{constructor(){this._store=new ws,hr(this),xi(this._store,this)}dispose(){dr(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};et.None=Object.freeze({dispose(){}});var lr=class{constructor(){this._isDisposed=!1,hr(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,dr(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&xi(e,null),e}},In=class _s{constructor(t){this.element=t,this.next=_s.Undefined,this.prev=_s.Undefined}};In.Undefined=new In(void 0);var ic=globalThis.performance&&typeof globalThis.performance.now=="function",rc=class Yn{static create(t){return new Yn(t)}constructor(t){this._now=ic&&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}},sc=!1,Nn=!1,nc=!1,cr;(e=>{e.None=()=>et.None;function t(B){if(nc){let{onDidAddListener:D}=B,P=vs.create(),O=0;B.onDidAddListener=()=>{++O===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),P.print()),D?.()}}}function i(B,D){return S(B,()=>{},0,void 0,!0,void 0,D)}e.defer=i;function n(B){return(D,P=null,O)=>{let b=!1,E;return E=B(L=>{if(!b)return E?E.dispose():b=!0,D.call(P,L)},null,O),b&&E.dispose(),E}}e.once=n;function l(B,D,P){return _((O,b=null,E)=>B(L=>O.call(b,D(L)),null,E),P)}e.map=l;function r(B,D,P){return _((O,b=null,E)=>B(L=>{D(L),O.call(b,L)},null,E),P)}e.forEach=r;function s(B,D,P){return _((O,b=null,E)=>B(L=>D(L)&&O.call(b,L),null,E),P)}e.filter=s;function a(B){return B}e.signal=a;function f(...B){return(D,P=null,O)=>{let b=Kn(...B.map(E=>E(L=>D.call(P,L))));return g(b,O)}}e.any=f;function o(B,D,P,O){let b=P;return l(B,E=>(b=D(b,E),b),O)}e.reduce=o;function _(B,D){let P,O={onWillAddFirstListener(){P=B(b.fire,b)},onDidRemoveLastListener(){P?.dispose()}};D||t(O);let b=new Qe(O);return D?.add(b),b.event}function g(B,D){return D instanceof Array?D.push(B):D&&D.add(B),B}function S(B,D,P=100,O=!1,b=!1,E,L){let M,z,K,V=0,j,T={leakWarningThreshold:E,onWillAddFirstListener(){M=B(N=>{V++,z=D(z,N),O&&!K&&(k.fire(z),z=void 0),j=()=>{let H=z;z=void 0,K=void 0,(!O||V>1)&&k.fire(H),V=0},typeof P=="number"?(clearTimeout(K),K=setTimeout(j,P)):K===void 0&&(K=0,queueMicrotask(j))})},onWillRemoveListener(){b&&V>0&&j?.()},onDidRemoveLastListener(){j=void 0,M.dispose()}};L||t(T);let k=new Qe(T);return L?.add(k),k.event}e.debounce=S;function p(B,D=0,P){return e.debounce(B,(O,b)=>O?(O.push(b),O):[b],D,void 0,!0,void 0,P)}e.accumulate=p;function h(B,D=(O,b)=>O===b,P){let O=!0,b;return s(B,E=>{let L=O||!D(E,b);return O=!1,b=E,L},P)}e.latch=h;function d(B,D,P){return[e.filter(B,D,P),e.filter(B,O=>!D(O),P)]}e.split=d;function c(B,D=!1,P=[],O){let b=P.slice(),E=B(z=>{b?b.push(z):M.fire(z)});O&&O.add(E);let L=()=>{b?.forEach(z=>M.fire(z)),b=null},M=new Qe({onWillAddFirstListener(){E||(E=B(z=>M.fire(z)),O&&O.add(E))},onDidAddFirstListener(){b&&(D?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return O&&O.add(M),M.event}e.buffer=c;function u(B,D){return(P,O,b)=>{let E=D(new C);return B(function(L){let M=E.evaluate(L);M!==v&&P.call(O,M)},void 0,b)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(P=>(D(P),P)),this}filter(D){return this.steps.push(P=>D(P)?P:v),this}reduce(D,P){let O=P;return this.steps.push(b=>(O=D(O,b),O)),this}latch(D=(P,O)=>P===O){let P=!0,O;return this.steps.push(b=>{let E=P||!D(b,O);return P=!1,O=b,E?b:v}),this}evaluate(D){for(let P of this.steps)if(D=P(D),D===v)break;return D}}function w(B,D,P=O=>O){let O=(...M)=>L.fire(P(...M)),b=()=>B.on(D,O),E=()=>B.removeListener(D,O),L=new Qe({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=w;function y(B,D,P=O=>O){let O=(...M)=>L.fire(P(...M)),b=()=>B.addEventListener(D,O),E=()=>B.removeEventListener(D,O),L=new Qe({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(D=>n(B)(D))}e.toPromise=m;function x(B){let D=new Qe;return B.then(P=>{D.fire(P)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=x;function A(B,D){return B(P=>D.fire(P))}e.forward=A;function I(B,D,P){return D(P),B(O=>D(O))}e.runAndSubscribe=I;class F{constructor(D,P){this._observable=D,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};P||t(O),this.emitter=new Qe(O),P&&P.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,P){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,D){return new F(B,D).emitter.event}e.fromObservable=R;function $(B){return(D,P,O)=>{let b=0,E=!1,L={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,D.call(P)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let M={dispose(){B.removeObserver(L)}};return O instanceof ws?O.add(M):Array.isArray(O)&&O.push(M),M}}e.fromObservableLight=$})(cr||(cr={}));var ps=class gs{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${gs._idPool++}`,gs.all.add(this)}start(t){this._stopWatch=new rc,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}}};ps.all=new Set,ps._idPool=0;var oc=ps,Hn=-1,Xn=class Jn{constructor(t,i,n=(Jn._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[r,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(r);let f=new lc(a,r);this._errorHandler(f)}return()=>{let r=this._stacks.get(t.value)||0;this._stacks.set(t.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[n,l]of this._stacks)(!t||i<l)&&(t=[n,l],i=l);return t}};Xn._idPool=1;var ac=Xn,vs=class Zn{constructor(t){this.value=t}static create(){let t=new Error;return new Zn(t.stack??"")}print(){console.warn(this.value.split(`
|
|
31
31
|
`).slice(2).join(`
|
|
32
|
-
`))}},
|
|
33
|
-
`)),e.length=0)},3e3),
|
|
32
|
+
`))}},lc=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},cc=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},hc=0,sr=class{constructor(e){this.value=e,this.id=hc++}},dc=2,uc=(e,t)=>{if(e instanceof sr)t(e);else for(let i=0;i<e.length;i++){let n=e[i];n&&t(n)}},nr;if(sc){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),nr=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Qe=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Hn>0||this._options?.leakWarningThreshold?new ac(e?.onListenerError??os,this._options?.leakWarningThreshold??Hn):void 0,this._perfMon=this._options?._profName?new oc(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(Nn){let e=this._listeners;queueMicrotask(()=>{uc(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],o=new cc(`${a}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||os)(o),et.None}if(this._disposed)return et.None;t&&(e=e.bind(t));let n=new sr(e),l,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=vs.create(),l=this._leakageMon.check(n.stack,this._size+1)),Nn&&(n.stack=r??vs.create()),this._listeners?this._listeners instanceof sr?(this._deliveryQueue??(this._deliveryQueue=new fc),this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=Qt(()=>{nr?.unregister(s),l?.(),this._removeListener(n)});if(i instanceof ws?i.add(s):Array.isArray(i)&&i.push(s),nr){let a=new Error().stack.split(`
|
|
34
34
|
`).slice(2,3).join(`
|
|
35
|
-
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);ji.register(r,f?.[2]??a,r)}return r}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*Tl<=t.length){let h=0;for(let s=0;s<t.length;s++)t[s]?t[h++]=t[s]:n&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Ws;if(!i){e.value(t);return}try{e.value(t)}catch(n){i(n)}}_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 Ui)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}},Dl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Tn=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),gn;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Bl?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Tn})})(gn||(gn={}));var Bl=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?Tn:(this._emitter||(this._emitter=new Ve),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Wt="en",Zs=!1,Qs=!1,qi=!1,Pl=!1,Ol=!1,An=!1,Il=!1,Nl=!1,Hl=!1,Fl=!1,zi,Ki=Wt,vn=Wt,Wl,nt,ot=globalThis,Be;typeof ot.vscode<"u"&&typeof ot.vscode.process<"u"?Be=ot.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Be=process);var Dn=typeof Be?.versions?.electron=="string",$l=Dn&&Be?.type==="renderer";if(typeof Be=="object"){Zs=Be.platform==="win32",Qs=Be.platform==="darwin",qi=Be.platform==="linux",Pl=qi&&!!Be.env.SNAP&&!!Be.env.SNAP_REVISION,Il=Dn,Hl=!!Be.env.CI||!!Be.env.BUILD_ARTIFACTSTAGINGDIRECTORY,zi=Wt,Ki=Wt;let e=Be.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);zi=t.userLocale,vn=t.osLocale,Ki=t.resolvedLanguage||Wt,Wl=t.languagePack?.translationsConfigFile}catch{}Ol=!0}else typeof navigator=="object"&&!$l?(nt=navigator.userAgent,Zs=nt.indexOf("Windows")>=0,Qs=nt.indexOf("Macintosh")>=0,Nl=(nt.indexOf("Macintosh")>=0||nt.indexOf("iPad")>=0||nt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,qi=nt.indexOf("Linux")>=0,Fl=nt?.indexOf("Mobi")>=0,An=!0,Ki=globalThis._VSCODE_NLS_LANGUAGE||Wt,zi=navigator.language.toLowerCase(),vn=zi):console.error("Unable to resolve platform.");var $s=0;Qs?$s=1:Zs?$s=3:qi&&($s=2);var zl=An&&typeof ot.importScripts=="function",xf=zl?ot.origin:void 0,Xe=nt,pt=Ki,mn;(e=>{function t(){return pt}e.value=t;function i(){return pt.length===2?pt==="en":pt.length>=3?pt[0]==="e"&&pt[1]==="n"&&pt[2]==="-":!1}e.isDefaultVariant=i;function n(){return pt==="en"}e.isDefault=n})(mn||(mn={}));var Ul=typeof ot.postMessage=="function"&&!ot.importScripts,jl=(()=>{if(Ul){let e=[];ot.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,h=e.length;n<h;n++){let s=e[n];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),ot.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),ql=!!(Xe&&Xe.indexOf("Chrome")>=0),kf=!!(Xe&&Xe.indexOf("Firefox")>=0),Ef=!!(!ql&&Xe&&Xe.indexOf("Safari")>=0),Lf=!!(Xe&&Xe.indexOf("Edg/")>=0),Mf=!!(Xe&&Xe.indexOf("Android")>=0);function Bn(e,t=0,i){let n=setTimeout(()=>{e(),i&&h.dispose()},t),h=zt(()=>{clearTimeout(n),i?.deleteAndLeak(h)});return i?.add(h),h}var Kl,zs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?zs=(e,t)=>{jl(()=>{if(i)return;let n=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:zs=(e,t,i)=>{let n=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(n))}}},Kl=e=>zs(globalThis,e)})();var bn;(e=>{async function t(n){let h,s=await Promise.all(n.map(r=>r.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return s}e.settled=t;function i(n){return new Promise(async(h,s)=>{try{await n(h,s)}catch(r){s(r)}})}e.withAsyncBody=i})(bn||(bn={}));var wn=class Ne{static fromArray(t){return new Ne(i=>{i.emitMany(t)})}static fromPromise(t){return new Ne(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Ne(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new Ne(async i=>{await Promise.all(t.map(async n=>{for await(let h of n)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Ve,queueMicrotask(async()=>{let n={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(n)),this.resolve()}catch(h){this.reject(h)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 Vi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ne(async n=>{for await(let h of t)n.emitOne(i(h))})}map(t){return Ne.map(this,t)}static filter(t,i){return new Ne(async n=>{for await(let h of t)i(h)&&n.emitOne(h)})}filter(t){return Ne.filter(this,t)}static coalesce(t){return Ne.filter(t,i=>!!i)}coalesce(){return Ne.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return Ne.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())}};wn.EMPTY=wn.fromArray([]);var Gl=class extends Ye{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Gi),this._linesCacheDisposables=this._register(new Gi),this._register(zt(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=yn(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Bn(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],n=[0],h=this._terminal.buffer.active.getLine(e);for(;h;){let s=this._terminal.buffer.active.getLine(e+1),r=s?s.isWrapped:!1,a=h.translateToString(!r&&t);if(r&&s){let f=h.getCell(h.length-1);f&&f.getCode()===0&&f.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),r)n.push(n[n.length-1]+a.length);else break;e++,h=s}return[i.join(""),n]}},Vl=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}},Yl=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,n){if(!e||e.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let h={startRow:t,startCol:i},s=this._findInLine(e,h,n);if(!s)for(let r=t+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=r,h.startCol=0,s=this._findInLine(e,h,n),!s);r++);return s}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,s=0;n&&(i===e?(h=n.end.x,s=n.end.y):(h=n.start.x,s=n.start.y)),this._lineCache.initLinesCache();let r={startRow:s,startCol:h},a=this._findInLine(e,r,t);if(!a)for(let f=s+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=f,r.startCol=0,a=this._findInLine(e,r,t),!a);f++);if(!a&&s!==0)for(let f=0;f<s&&(r.startRow=f,r.startCol=0,a=this._findInLine(e,r,t),!a);f++);return!a&&n&&(r.startRow=n.start.y,r.startCol=0,a=this._findInLine(e,r,t)),a}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,r=!0;this._lineCache.initLinesCache();let a={startRow:h,startCol:s},f;if(n&&(a.startRow=h=n.start.y,a.startCol=s=n.start.x,i!==e&&(f=this._findInLine(e,a,t,!1),f||(a.startRow=h=n.end.y,a.startCol=s=n.end.x))),f||(f=this._findInLine(e,a,t,r)),!f){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let o=h-1;o>=0&&(a.startRow=o,f=this._findInLine(e,a,t,r),!f);o--);}if(!f&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let o=this._terminal.buffer.active.baseY+this._terminal.rows-1;o>=h&&(a.startRow=o,f=this._findInLine(e,a,t,r),!f);o--);return f}_isWholeWord(e,t,i){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},n=!1){let h=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(h)?.isWrapped){if(n){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let r=this._lineCache.getLineFromCache(h);r||(r=this._lineCache.translateBufferLineToStringWithWrap(h,!0),this._lineCache.setLineInCache(h,r));let[a,f]=r,o=this._bufferColsToStringOffset(h,s),_=e,g=a;i.regex||(_=i.caseSensitive?e:e.toLowerCase(),g=i.caseSensitive?a:a.toLowerCase());let S=-1;if(i.regex){let p=RegExp(_,i.caseSensitive?"g":"gi"),c;if(n)for(;c=p.exec(g.slice(0,o));)S=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(g.slice(o)),c&&c[0].length>0&&(S=o+(p.lastIndex-c[0].length),e=c[0])}else n?o-_.length>=0&&(S=g.lastIndexOf(_,o-_.length)):S=g.indexOf(_,o);if(S>=0){if(i.wholeWord&&!this._isWholeWord(S,g,e))return;let p=0;for(;p<f.length-1&&S>=f[p+1];)p++;let c=p;for(;c<f.length-1&&S+e.length>=f[c+1];)c++;let d=S-f[p],l=S+e.length-f[c],u=this._stringLengthToBufferSize(h+p,d),v=this._stringLengthToBufferSize(h+c,l)-u+this._terminal.cols*(c-p);return{term:e,col:u,row:h+p,size:v}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let n=0;n<t;n++){let h=i.getCell(n);if(!h)break;let s=h.getChars();s.length>1&&(t-=s.length-1);let r=i.getCell(n+1);r&&r.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,n=0,h=this._terminal.buffer.active.getLine(i);for(;t>0&&h;){for(let s=0;s<t&&s<this._terminal.cols;s++){let r=h.getCell(s);if(!r)break;r.getWidth()&&(n+=r.getCode()===0?1:r.getChars().length)}if(i++,h=this._terminal.buffer.active.getLine(i),h&&!h.isWrapped)break;t-=this._terminal.cols}return n}},Xl=class extends Ye{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(zt(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let n=this._createResultDecorations(i,t,!1);if(n)for(let h of n)this._storeDecoration(h,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){ci(i)}}}clearHighlightDecorations(){ci(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let n=[],h=e.col,s=e.size,r=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let f=Math.min(this._terminal.cols-h,s);n.push([r,h,f]),h=0,s-=f,r++}let a=[];for(let f of n){let o=this._terminal.registerMarker(f[0]),_=this._terminal.registerDecoration({marker:o,x:f[1],width:f[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(o.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let g=[];g.push(o),g.push(_.onRender(S=>this._applyStyles(S,i?t.activeMatchBorder:t.matchBorder,!1))),g.push(_.onDispose(()=>ci(g))),a.push(_)}}return a.length===0?void 0:a}},Jl=class extends Ye{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Ve)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Pn=class extends Ye{constructor(e){super(),this._highlightTimeout=this._register(new Gi),this._lineCache=this._register(new Gi),this._state=new Vl,this._resultTracker=this._register(new Jl),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Gl(e),this._engine=new Yl(e,this._lineCache.value),this._decorationManager=new Xl(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(zt(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Bn(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let n=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,n}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],n,h=this._engine.find(e,0,0,t);for(;h&&(n?.row!==h.row||n?.col!==h.col)&&!(i.length>=this._highlightLimit);)n=h,i.push(n),h=this._engine.find(e,n.col+n.term.length>=this._terminal.cols?n.row+1:n.row,n.col+n.term.length>=this._terminal.cols?0:n.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let n=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(n,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let n=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,n}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let n=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(n,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let n=e.row-this._terminal.buffer.active.viewportY;n-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(n)}return!0}};var Zl=class{constructor(e,t,i,n={}){this._terminal=e,this._regex=t,this._handler=i,this._options=n}provideLinks(e,t){let i=ec.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,n)=>{if(this._options.hover){let{range:h}=t;this._options.hover(i,n,h)}},t))}};function Ql(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var ec=class Ji{static computeLink(t,i,n,h){let s=new RegExp(i.source,(i.flags||"")+"g"),[r,a]=Ji._getWindowedLineStrings(t-1,n),f=r.join(""),o,_=[];for(;o=s.exec(f);){let g=o[0];if(!Ql(g))continue;let[S,p]=Ji._mapStrIdx(n,a,0,o.index),[c,d]=Ji._mapStrIdx(n,S,p,g.length);if(S===-1||p===-1||c===-1||d===-1)continue;let l={start:{x:p+1,y:S+1},end:{x:d,y:c+1}};_.push({range:l,text:g,activate:h})}return _}static _getWindowedLineStrings(t,i){let n,h=t,s=t,r=0,a="",f=[];if(n=i.buffer.active.getLine(t)){let o=n.translateToString(!0);if(n.isWrapped&&o[0]!==" "){for(r=0;(n=i.buffer.active.getLine(--h))&&r<2048&&(a=n.translateToString(!0),r+=a.length,f.push(a),!(!n.isWrapped||a.indexOf(" ")!==-1)););f.reverse()}for(f.push(o),r=0;(n=i.buffer.active.getLine(++s))&&n.isWrapped&&r<2048&&(a=n.translateToString(!0),r+=a.length,f.push(a),a.indexOf(" ")===-1););}return[f,h]}static _mapStrIdx(t,i,n,h){let s=t.buffer.active,r=s.getNullCell(),a=n;for(;h;){let f=s.getLine(i);if(!f)return[-1,-1];for(let o=a;o<f.length;++o){f.getCell(o,r);let _=r.getChars();if(r.getWidth()&&(h-=_.length||1,o===f.length-1&&_==="")){let g=s.getLine(i+1);g&&g.isWrapped&&(g.getCell(0,r),r.getWidth()===2&&(h+=1))}if(h<0)return[i,o]}i++,a=0}return[i,a]}},tc=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function ic(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var On=class{constructor(e=ic,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||tc;this._linkProvider=this._terminal.registerLinkProvider(new Zl(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var sc=Object.defineProperty,rc=Object.getOwnPropertyDescriptor,nc=(e,t,i,n)=>{for(var h=n>1?void 0:n?rc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(h=(n?r(t,i,h):r(h))||h);return n&&h&&sc(t,i,h),h},oc=(e,t)=>(i,n)=>t(i,n,e),ac=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?In.isErrorNoTelemetry(e)?new In(e.message+`
|
|
35
|
+
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);nr.register(s,f?.[2]??a,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*dc<=t.length){let l=0;for(let r=0;r<t.length;r++)t[r]?t[l++]=t[r]:n&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||os;if(!i){e.value(t);return}try{e.value(t)}catch(n){i(n)}}_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 sr)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}},fc=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Qn=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Fn;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof _c?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:cr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Qn})})(Fn||(Fn={}));var _c=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?Qn:(this._emitter||(this._emitter=new Qe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Jt="en",ms=!1,bs=!1,or=!1,pc=!1,gc=!1,eo=!1,vc=!1,mc=!1,bc=!1,wc=!1,rr,ar=Jt,Wn=Jt,Sc,dt,ut=globalThis,Ne;typeof ut.vscode<"u"&&typeof ut.vscode.process<"u"?Ne=ut.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ne=process);var to=typeof Ne?.versions?.electron=="string",Cc=to&&Ne?.type==="renderer";if(typeof Ne=="object"){ms=Ne.platform==="win32",bs=Ne.platform==="darwin",or=Ne.platform==="linux",pc=or&&!!Ne.env.SNAP&&!!Ne.env.SNAP_REVISION,vc=to,bc=!!Ne.env.CI||!!Ne.env.BUILD_ARTIFACTSTAGINGDIRECTORY,rr=Jt,ar=Jt;let e=Ne.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);rr=t.userLocale,Wn=t.osLocale,ar=t.resolvedLanguage||Jt,Sc=t.languagePack?.translationsConfigFile}catch{}gc=!0}else typeof navigator=="object"&&!Cc?(dt=navigator.userAgent,ms=dt.indexOf("Windows")>=0,bs=dt.indexOf("Macintosh")>=0,mc=(dt.indexOf("Macintosh")>=0||dt.indexOf("iPad")>=0||dt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,or=dt.indexOf("Linux")>=0,wc=dt?.indexOf("Mobi")>=0,eo=!0,ar=globalThis._VSCODE_NLS_LANGUAGE||Jt,rr=navigator.language.toLowerCase(),Wn=rr):console.error("Unable to resolve platform.");var as=0;bs?as=1:ms?as=3:or&&(as=2);var yc=eo&&typeof ut.importScripts=="function",h_=yc?ut.origin:void 0,tt=dt,yt=ar,$n;(e=>{function t(){return yt}e.value=t;function i(){return yt.length===2?yt==="en":yt.length>=3?yt[0]==="e"&&yt[1]==="n"&&yt[2]==="-":!1}e.isDefaultVariant=i;function n(){return yt==="en"}e.isDefault=n})($n||($n={}));var xc=typeof ut.postMessage=="function"&&!ut.importScripts,kc=(()=>{if(xc){let e=[];ut.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,l=e.length;n<l;n++){let r=e[n];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),ut.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),Ec=!!(tt&&tt.indexOf("Chrome")>=0),d_=!!(tt&&tt.indexOf("Firefox")>=0),u_=!!(!Ec&&tt&&tt.indexOf("Safari")>=0),f_=!!(tt&&tt.indexOf("Edg/")>=0),__=!!(tt&&tt.indexOf("Android")>=0);function io(e,t=0,i){let n=setTimeout(()=>{e(),i&&l.dispose()},t),l=Qt(()=>{clearTimeout(n),i?.deleteAndLeak(l)});return i?.add(l),l}var Lc,ls;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?ls=(e,t)=>{kc(()=>{if(i)return;let n=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:ls=(e,t,i)=>{let n=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),l=!1;return{dispose(){l||(l=!0,e.cancelIdleCallback(n))}}},Lc=e=>ls(globalThis,e)})();var zn;(e=>{async function t(n){let l,r=await Promise.all(n.map(s=>s.then(a=>a,a=>{l||(l=a)})));if(typeof l<"u")throw l;return r}e.settled=t;function i(n){return new Promise(async(l,r)=>{try{await n(l,r)}catch(s){r(s)}})}e.withAsyncBody=i})(zn||(zn={}));var Un=class We{static fromArray(t){return new We(i=>{i.emitMany(t)})}static fromPromise(t){return new We(async i=>{i.emitMany(await t)})}static fromPromises(t){return new We(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new We(async i=>{await Promise.all(t.map(async n=>{for await(let l of n)i.emitOne(l)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Qe,queueMicrotask(async()=>{let n={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(n)),this.resolve()}catch(l){this.reject(l)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 cr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new We(async n=>{for await(let l of t)n.emitOne(i(l))})}map(t){return We.map(this,t)}static filter(t,i){return new We(async n=>{for await(let l of t)i(l)&&n.emitOne(l)})}filter(t){return We.filter(this,t)}static coalesce(t){return We.filter(t,i=>!!i)}coalesce(){return We.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return We.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())}};Un.EMPTY=Un.fromArray([]);var Mc=class extends et{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new lr),this._linesCacheDisposables=this._register(new lr),this._register(Qt(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Kn(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=io(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],n=[0],l=this._terminal.buffer.active.getLine(e);for(;l;){let r=this._terminal.buffer.active.getLine(e+1),s=r?r.isWrapped:!1,a=l.translateToString(!s&&t);if(s&&r){let f=l.getCell(l.length-1);f&&f.getCode()===0&&f.getWidth()===1&&r.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),s)n.push(n[n.length-1]+a.length);else break;e++,l=r}return[i.join(""),n]}},Rc=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}},Tc=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,n){if(!e||e.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let l={startRow:t,startCol:i},r=this._findInLine(e,l,n);if(!r)for(let s=t+1;s<this._terminal.buffer.active.baseY+this._terminal.rows&&(l.startRow=s,l.startCol=0,r=this._findInLine(e,l,n),!r);s++);return r}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=0,r=0;n&&(i===e?(l=n.end.x,r=n.end.y):(l=n.start.x,r=n.start.y)),this._lineCache.initLinesCache();let s={startRow:r,startCol:l},a=this._findInLine(e,s,t);if(!a)for(let f=r+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=f,s.startCol=0,a=this._findInLine(e,s,t),!a);f++);if(!a&&r!==0)for(let f=0;f<r&&(s.startRow=f,s.startCol=0,a=this._findInLine(e,s,t),!a);f++);return!a&&n&&(s.startRow=n.start.y,s.startCol=0,a=this._findInLine(e,s,t)),a}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols,s=!0;this._lineCache.initLinesCache();let a={startRow:l,startCol:r},f;if(n&&(a.startRow=l=n.start.y,a.startCol=r=n.start.x,i!==e&&(f=this._findInLine(e,a,t,!1),f||(a.startRow=l=n.end.y,a.startCol=r=n.end.x))),f||(f=this._findInLine(e,a,t,s)),!f){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let o=l-1;o>=0&&(a.startRow=o,f=this._findInLine(e,a,t,s),!f);o--);}if(!f&&l!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let o=this._terminal.buffer.active.baseY+this._terminal.rows-1;o>=l&&(a.startRow=o,f=this._findInLine(e,a,t,s),!f);o--);return f}_isWholeWord(e,t,i){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},n=!1){let l=t.startRow,r=t.startCol;if(this._terminal.buffer.active.getLine(l)?.isWrapped){if(n){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let s=this._lineCache.getLineFromCache(l);s||(s=this._lineCache.translateBufferLineToStringWithWrap(l,!0),this._lineCache.setLineInCache(l,s));let[a,f]=s,o=this._bufferColsToStringOffset(l,r),_=e,g=a;i.regex||(_=i.caseSensitive?e:e.toLowerCase(),g=i.caseSensitive?a:a.toLowerCase());let S=-1;if(i.regex){let p=RegExp(_,i.caseSensitive?"g":"gi"),h;if(n)for(;h=p.exec(g.slice(0,o));)S=p.lastIndex-h[0].length,e=h[0],p.lastIndex-=e.length-1;else h=p.exec(g.slice(o)),h&&h[0].length>0&&(S=o+(p.lastIndex-h[0].length),e=h[0])}else n?o-_.length>=0&&(S=g.lastIndexOf(_,o-_.length)):S=g.indexOf(_,o);if(S>=0){if(i.wholeWord&&!this._isWholeWord(S,g,e))return;let p=0;for(;p<f.length-1&&S>=f[p+1];)p++;let h=p;for(;h<f.length-1&&S+e.length>=f[h+1];)h++;let d=S-f[p],c=S+e.length-f[h],u=this._stringLengthToBufferSize(l+p,d),v=this._stringLengthToBufferSize(l+h,c)-u+this._terminal.cols*(h-p);return{term:e,col:u,row:l+p,size:v}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let n=0;n<t;n++){let l=i.getCell(n);if(!l)break;let r=l.getChars();r.length>1&&(t-=r.length-1);let s=i.getCell(n+1);s&&s.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,n=0,l=this._terminal.buffer.active.getLine(i);for(;t>0&&l;){for(let r=0;r<t&&r<this._terminal.cols;r++){let s=l.getCell(r);if(!s)break;s.getWidth()&&(n+=s.getCode()===0?1:s.getChars().length)}if(i++,l=this._terminal.buffer.active.getLine(i),l&&!l.isWrapped)break;t-=this._terminal.cols}return n}},Ac=class extends et{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Qt(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let n=this._createResultDecorations(i,t,!1);if(n)for(let l of n)this._storeDecoration(l,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){yi(i)}}}clearHighlightDecorations(){yi(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let n=[],l=e.col,r=e.size,s=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;r>0;){let f=Math.min(this._terminal.cols-l,r);n.push([s,l,f]),l=0,r-=f,s++}let a=[];for(let f of n){let o=this._terminal.registerMarker(f[0]),_=this._terminal.registerDecoration({marker:o,x:f[1],width:f[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(o.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let g=[];g.push(o),g.push(_.onRender(S=>this._applyStyles(S,i?t.activeMatchBorder:t.matchBorder,!1))),g.push(_.onDispose(()=>yi(g))),a.push(_)}}return a.length===0?void 0:a}},Dc=class extends et{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Qe)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},ro=class extends et{constructor(e){super(),this._highlightTimeout=this._register(new lr),this._lineCache=this._register(new lr),this._state=new Rc,this._resultTracker=this._register(new Dc),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Mc(e),this._engine=new Tc(e,this._lineCache.value),this._decorationManager=new Ac(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Qt(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=io(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let n=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,n}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],n,l=this._engine.find(e,0,0,t);for(;l&&(n?.row!==l.row||n?.col!==l.col)&&!(i.length>=this._highlightLimit);)n=l,i.push(n),l=this._engine.find(e,n.col+n.term.length>=this._terminal.cols?n.row+1:n.row,n.col+n.term.length>=this._terminal.cols?0:n.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let n=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(n,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let n=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,n}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let n=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(n,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let n=e.row-this._terminal.buffer.active.viewportY;n-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(n)}return!0}};var Bc=class{constructor(e,t,i,n={}){this._terminal=e,this._regex=t,this._handler=i,this._options=n}provideLinks(e,t){let i=Oc.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,n)=>{if(this._options.hover){let{range:l}=t;this._options.hover(i,n,l)}},t))}};function Pc(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Oc=class ur{static computeLink(t,i,n,l){let r=new RegExp(i.source,(i.flags||"")+"g"),[s,a]=ur._getWindowedLineStrings(t-1,n),f=s.join(""),o,_=[];for(;o=r.exec(f);){let g=o[0];if(!Pc(g))continue;let[S,p]=ur._mapStrIdx(n,a,0,o.index),[h,d]=ur._mapStrIdx(n,S,p,g.length);if(S===-1||p===-1||h===-1||d===-1)continue;let c={start:{x:p+1,y:S+1},end:{x:d,y:h+1}};_.push({range:c,text:g,activate:l})}return _}static _getWindowedLineStrings(t,i){let n,l=t,r=t,s=0,a="",f=[];if(n=i.buffer.active.getLine(t)){let o=n.translateToString(!0);if(n.isWrapped&&o[0]!==" "){for(s=0;(n=i.buffer.active.getLine(--l))&&s<2048&&(a=n.translateToString(!0),s+=a.length,f.push(a),!(!n.isWrapped||a.indexOf(" ")!==-1)););f.reverse()}for(f.push(o),s=0;(n=i.buffer.active.getLine(++r))&&n.isWrapped&&s<2048&&(a=n.translateToString(!0),s+=a.length,f.push(a),a.indexOf(" ")===-1););}return[f,l]}static _mapStrIdx(t,i,n,l){let r=t.buffer.active,s=r.getNullCell(),a=n;for(;l;){let f=r.getLine(i);if(!f)return[-1,-1];for(let o=a;o<f.length;++o){f.getCell(o,s);let _=s.getChars();if(s.getWidth()&&(l-=_.length||1,o===f.length-1&&_==="")){let g=r.getLine(i+1);g&&g.isWrapped&&(g.getCell(0,s),s.getWidth()===2&&(l+=1))}if(l<0)return[i,o]}i++,a=0}return[i,a]}},Ic=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Nc(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var so=class{constructor(e=Nc,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||Ic;this._linkProvider=this._terminal.registerLinkProvider(new Bc(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var Hc=Object.defineProperty,Fc=Object.getOwnPropertyDescriptor,Wc=(e,t,i,n)=>{for(var l=n>1?void 0:n?Fc(t,i):t,r=e.length-1,s;r>=0;r--)(s=e[r])&&(l=(n?s(t,i,l):s(l))||l);return n&&l&&Hc(t,i,l),l},$c=(e,t)=>(i,n)=>t(i,n,e),zc=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?no.isErrorNoTelemetry(e)?new no(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)}},
|
|
40
|
-
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return o(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let
|
|
41
|
-
`),f)}n.sort(
|
|
42
|
-
`)).size}/${n.length} leaks) at ${S}`;let p=
|
|
43
|
-
`)),
|
|
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)}},Uc=new zc;function vr(e){jc(e)||Uc.onUnexpectedError(e)}var Os="Canceled";function jc(e){return e instanceof qc?!0:e instanceof Error&&e.name===Os&&e.message===Os}var qc=class extends Error{constructor(){super(Os),this.name=this.message}},no=class Is extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Is)return t;let i=new Is;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Kc(e,t,i=0,n=e.length){let l=i,r=n;for(;l<r;){let s=Math.floor((l+r)/2);t(e[s])?l=s+1:r=s}return l-1}var Gc=class Vo{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Vo.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!t(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=Kc(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Gc.assertInvariants=!1;var Ns;(e=>{function t(r){return r<0}e.isLessThan=t;function i(r){return r<=0}e.isLessThanOrEqual=i;function n(r){return r>0}e.isGreaterThan=n;function l(r){return r===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ns||(Ns={}));function Vc(e,t){return(i,n)=>t(e(i),e(n))}var Yc=(e,t)=>e-t,oo=class Hs{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new Hs(i=>this.iterate(n=>t(n)?i(n):!0))}map(t){return new Hs(i=>this.iterate(n=>i(t(n))))}some(t){let i=!1;return this.iterate(n=>(i=t(n),!i)),i}findFirst(t){let i;return this.iterate(n=>t(n)?(i=n,!1):!0),i}findLast(t){let i;return this.iterate(n=>(t(n)&&(i=n),!0)),i}findLastMaxBy(t){let i,n=!0;return this.iterate(l=>((n||Ns.isGreaterThan(t(l,i)))&&(n=!1,i=l),!0)),i}};oo.empty=new oo(e=>{});function Xc(e,t){let i=Object.create(null);for(let n of e){let l=t(n),r=i[l];r||(r=i[l]=[]),r.push(n)}return i}var ao,lo,H_=class{constructor(e,t){this.toKey=t,this._map=new Map,this[ao]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[(lo=Symbol.iterator,ao=Symbol.toStringTag,lo)](){return this.values()}},Jc=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function Zc(e,t){let i=this,n=!1,l;return function(){if(n)return l;if(n=!0,t)try{l=e.apply(i,arguments)}finally{t()}else l=e.apply(i,arguments);return l}}var Fs;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*l(w){yield w}e.single=l;function r(w){return t(w)?w:l(w)}e.wrap=r;function s(w){return w||i}e.from=s;function*a(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=a;function f(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=f;function o(w){return w[Symbol.iterator]().next().value}e.first=o;function _(w,y){let m=0;for(let x of w)if(y(x,m++))return!0;return!1}e.some=_;function g(w,y){for(let m of w)if(y(m))return m}e.find=g;function*S(w,y){for(let m of w)y(m)&&(yield m)}e.filter=S;function*p(w,y){let m=0;for(let x of w)yield y(x,m++)}e.map=p;function*h(w,y){let m=0;for(let x of w)yield*y(x,m++)}e.flatMap=h;function*d(...w){for(let y of w)yield*y}e.concat=d;function c(w,y,m){let x=m;for(let A of w)x=y(x,A);return x}e.reduce=c;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let x=w[Symbol.iterator]();for(let A=0;A<y;A++){let I=x.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Fs||(Fs={}));var Qc=!1,oi=null,eh=class Yo{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:Yo.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=new Error().stack)}setParent(t,i){let n=this.getDisposableData(t);n.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let n=i.get(t);if(n)return n;let l=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,l),l}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let n;if(i)n=i;else{let f=new Map,o=[...this.livingDisposables.values()].filter(g=>g.source!==null&&!this.getRootParent(g,f).isSingleton);if(o.length===0)return;let _=new Set(o.map(g=>g.value));if(n=o.filter(g=>!(g.parent&&_.has(g.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function l(f){function o(g,S){for(;g.length>0&&S.some(p=>typeof p=="string"?p===g[0]:g[0].match(p));)g.shift()}let _=f.source.split(`
|
|
40
|
+
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return o(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let r=new Jc;for(let f of n){let o=l(f);for(let _=0;_<=o.length;_++)r.add(o.slice(0,_).join(`
|
|
41
|
+
`),f)}n.sort(Vc(f=>f.idx,Yc));let s="",a=0;for(let f of n.slice(0,t)){a++;let o=l(f),_=[];for(let g=0;g<o.length;g++){let S=o[g];S=`(shared with ${r.get(o.slice(0,g+1).join(`
|
|
42
|
+
`)).size}/${n.length} leaks) at ${S}`;let p=r.get(o.slice(0,g).join(`
|
|
43
|
+
`)),h=Xc([...p].map(d=>l(d)[g]),d=>d);delete h[o[g]];for(let[d,c]of Object.entries(h))_.unshift(` - stacktraces of ${c.length} other leaks continue with ${d}`);_.unshift(S)}s+=`
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
==================== Leaking disposable ${a}/${n.length}: ${f.value.constructor.name} ====================
|
|
@@ -48,17 +48,17 @@ ${_.join(`
|
|
|
48
48
|
`)}
|
|
49
49
|
============================================================
|
|
50
50
|
|
|
51
|
-
`}return n.length>t&&(
|
|
51
|
+
`}return n.length>t&&(s+=`
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
... and ${n.length-t} more leaking disposables
|
|
55
55
|
|
|
56
|
-
`),{leaks:n,details:r}}};bc.idx=0;function wc(e){Yt=e}if(mc){let e="__is_disposable_tracked__";wc(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==Oe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Oe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function us(e){return Yt?.trackDisposable(e),e}function fs(e){Yt?.markAsDisposed(e)}function gi(e,t){Yt?.setParent(e,t)}function Sc(e,t){if(Yt)for(let i of e)Yt.setParent(i,t)}function Lo(e){if(br.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}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 Mo(...e){let t=Le(()=>Lo(e));return Sc(e,t),t}function Le(e){let t=us({dispose:vc(()=>{fs(t),e()})});return t}var Ro=class To{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{Lo(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 gi(t,this),this._isDisposed?To.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),gi(t,null))}};Ro.DISABLE_DISPOSED_WARNING=!1;var Vt=Ro,Oe=class{constructor(){this._store=new Vt,us(this),gi(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)}};Oe.None=Object.freeze({dispose(){}});var di=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&&gi(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&&gi(e,null),e}},Mr=typeof process<"u"&&"title"in process,mi=Mr?"node":navigator.userAgent,Rr=Mr?"node":navigator.platform,Cc=mi.includes("Firefox"),yc=mi.includes("Edge"),Ao=/^((?!chrome|android).)*safari/i.test(mi);function xc(){if(!Ao)return 0;let e=mi.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Qf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Rr),e_=["Windows","Win16","Win32","WinCE"].includes(Rr),t_=Rr.indexOf("Linux")>=0,i_=/\bCrOS\b/.test(mi),kc="",ye=0,xe=0,ke=0,pe=0,He={css:"#00000000",rgba:0},Re;(e=>{function t(h,s,r,a){return a!==void 0?`#${Lt(h)}${Lt(s)}${Lt(r)}${Lt(a)}`:`#${Lt(h)}${Lt(s)}${Lt(r)}`}e.toCss=t;function i(h,s,r,a=255){return(h<<24|s<<16|r<<8|a)>>>0}e.toRgba=i;function n(h,s,r,a){return{css:e.toCss(h,s,r,a),rgba:e.toRgba(h,s,r,a)}}e.toColor=n})(Re||(Re={}));var qt;(e=>{function t(f,o){if(pe=(o.rgba&255)/255,pe===1)return{css:o.css,rgba:o.rgba};let _=o.rgba>>24&255,g=o.rgba>>16&255,S=o.rgba>>8&255,p=f.rgba>>24&255,c=f.rgba>>16&255,d=f.rgba>>8&255;ye=p+Math.round((_-p)*pe),xe=c+Math.round((g-c)*pe),ke=d+Math.round((S-d)*pe);let l=Re.toCss(ye,xe,ke),u=Re.toRgba(ye,xe,ke);return{css:l,rgba:u}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function n(f,o,_){let g=wt.ensureContrastRatio(f.rgba,o.rgba,_);if(g)return Re.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function h(f){let o=(f.rgba|255)>>>0;return[ye,xe,ke]=wt.toChannels(o),{css:Re.toCss(ye,xe,ke),rgba:o}}e.opaque=h;function s(f,o){return pe=Math.round(o*255),[ye,xe,ke]=wt.toChannels(f.rgba),{css:Re.toCss(ye,xe,ke,pe),rgba:Re.toRgba(ye,xe,ke,pe)}}e.opacity=s;function r(f,o){return pe=f.rgba&255,s(f,pe*o/255)}e.multiplyOpacity=r;function a(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=a})(qt||(qt={}));var Wn;(e=>{let t,i;try{let h=document.createElement("canvas");h.width=1,h.height=1;let s=h.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function n(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return ye=parseInt(h.slice(1,2).repeat(2),16),xe=parseInt(h.slice(2,3).repeat(2),16),ke=parseInt(h.slice(3,4).repeat(2),16),Re.toColor(ye,xe,ke);case 5:return ye=parseInt(h.slice(1,2).repeat(2),16),xe=parseInt(h.slice(2,3).repeat(2),16),ke=parseInt(h.slice(3,4).repeat(2),16),pe=parseInt(h.slice(4,5).repeat(2),16),Re.toColor(ye,xe,ke,pe);case 7:return{css:h,rgba:(parseInt(h.slice(1),16)<<8|255)>>>0};case 9:return{css:h,rgba:parseInt(h.slice(1),16)>>>0}}let s=h.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return ye=parseInt(s[1]),xe=parseInt(s[2]),ke=parseInt(s[3]),pe=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Re.toColor(ye,xe,ke,pe);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=h,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ye,xe,ke,pe]=t.getImageData(0,0,1,1).data,pe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Re.toRgba(ye,xe,ke,pe),css:h}}e.toColor=n})(Wn||(Wn={}));var Me;(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,h,s){let r=n/255,a=h/255,f=s/255,o=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return o*.2126+_*.7152+g*.0722}e.relativeLuminance2=i})(Me||(Me={}));var wt;(e=>{function t(r,a){if(pe=(a&255)/255,pe===1)return a;let f=a>>24&255,o=a>>16&255,_=a>>8&255,g=r>>24&255,S=r>>16&255,p=r>>8&255;return ye=g+Math.round((f-g)*pe),xe=S+Math.round((o-S)*pe),ke=p+Math.round((_-p)*pe),Re.toRgba(ye,xe,ke)}e.blend=t;function i(r,a,f){let o=Me.relativeLuminance(r>>8),_=Me.relativeLuminance(a>>8);if(at(o,_)<f){if(_<o){let p=n(r,a,f),c=at(o,Me.relativeLuminance(p>>8));if(c<f){let d=h(r,a,f),l=at(o,Me.relativeLuminance(d>>8));return c>l?p:d}return p}let g=h(r,a,f),S=at(o,Me.relativeLuminance(g>>8));if(S<f){let p=n(r,a,f),c=at(o,Me.relativeLuminance(p>>8));return S>c?g:p}return g}}e.ensureContrastRatio=i;function n(r,a,f){let o=r>>24&255,_=r>>16&255,g=r>>8&255,S=a>>24&255,p=a>>16&255,c=a>>8&255,d=at(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(o,_,g));for(;d<f&&(S>0||p>0||c>0);)S-=Math.max(0,Math.ceil(S*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),d=at(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(o,_,g));return(S<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=n;function h(r,a,f){let o=r>>24&255,_=r>>16&255,g=r>>8&255,S=a>>24&255,p=a>>16&255,c=a>>8&255,d=at(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(o,_,g));for(;d<f&&(S<255||p<255||c<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),d=at(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(o,_,g));return(S<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=h;function s(r){return[r>>24&255,r>>16&255,r>>8&255,r&255]}e.toChannels=s})(wt||(wt={}));function Lt(e){let t=e.toString(16);return t.length<2?"0"+t:t}function at(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 Tr(e){return 57508<=e&&e<=57558}function Ec(e){return 57520<=e&&e<=57527}function Lc(e){return 57344<=e&&e<=63743}function Mc(e){return 9472<=e&&e<=9631}function Rc(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 Tc(e,t,i,n){return t===1&&i>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!Rc(e)&&!Tr(e)&&!Lc(e)}function Do(e){return Tr(e)||Mc(e)}function Ac(){return{css:{canvas:Zi(),cell:Zi()},device:{canvas:Zi(),cell:Zi(),char:{width:0,height:0,left:0,top:0}}}}function Zi(){return{width:0,height:0}}function Dc(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Ee=0,Ce=0,Je=!1,lt=!1,Qi=!1,Ae,tr=0,Bc=class{constructor(e,t,i,n,h,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=n,this._coreBrowserService=h,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,n){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Ce=0,Ee=0,lt=!1,Je=!1,Qi=!1,Ae=this._themeService.colors,tr=0,e.getCode()!==0&&e.extended.underlineStyle===4){let h=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));tr=t*n%(Math.round(h)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",h=>{h.backgroundColorRGB&&(Ce=h.backgroundColorRGB.rgba>>8&16777215,lt=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Je=!0)}),Qi=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Qi){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ce=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ce=(this.result.fg&16777215)<<8|255;break;default:Ce=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ce=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ce=(this.result.bg&16777215)<<8|255;break}Ce=wt.blend(Ce,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ce=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(lt=!0,Ae.selectionForeground&&(Ee=Ae.selectionForeground.rgba>>8&16777215,Je=!0),Do(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ee=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ee=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ee=(this.result.fg&16777215)<<8|255;break;default:Ee=this._themeService.colors.foreground.rgba}Ee=wt.blend(Ee,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Je=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",h=>{h.backgroundColorRGB&&(Ce=h.backgroundColorRGB.rgba>>8&16777215,lt=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Je=!0)}),lt&&(Qi?Ce=e.bg&-16777216&-134217729|Ce|50331648:Ce=e.bg&-16777216|Ce|50331648),Je&&(Ee=e.fg&-16777216&-67108865|Ee|50331648),this.result.fg&67108864&&(lt&&!Je&&((this.result.bg&50331648)===0?Ee=this.result.fg&-134217728|Ae.background.rgba>>8&16777215&16777215|50331648:Ee=this.result.fg&-134217728|this.result.bg&67108863,Je=!0),!lt&&Je&&((this.result.fg&50331648)===0?Ce=this.result.bg&-67108864|Ae.foreground.rgba>>8&16777215&16777215|50331648:Ce=this.result.bg&-67108864|this.result.fg&67108863,lt=!0)),Ae=void 0,this.result.bg=lt?Ce:this.result.bg,this.result.fg=Je?Ee:this.result.fg,this.result.ext&=536870911,this.result.ext|=tr<<29&3758096384}},Pc=.5,Bo=Cc||yc?"bottom":"ideographic",Oc={"\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}]},Ic={"\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]]},Nc={"\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`}},vi={"\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}};vi["\uE0BB"]=vi["\uE0BD"];vi["\uE0BF"]=vi["\uE0B9"];function Hc(e,t,i,n,h,s,r,a){let f=Oc[t];if(f)return Fc(e,f,i,n,h,s),!0;let o=Ic[t];if(o)return Wc(e,o,i,n,h,s),!0;let _=Nc[t];if(_)return $c(e,_,i,n,h,s,a),!0;let g=vi[t];return g?(zc(e,g,i,n,h,s,r,a),!0):!1}function Fc(e,t,i,n,h,s){for(let r=0;r<t.length;r++){let a=t[r],f=h/8,o=s/8;e.fillRect(i+a.x*f,n+a.y*o,a.w*f,a.h*o)}}var $n=new Map;function Wc(e,t,i,n,h,s){let r=$n.get(t);r||(r=new Map,$n.set(t,r));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let f=r.get(a);if(!f){let o=t[0].length,_=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=o,g.height=_;let S=we(g.getContext("2d")),p=new ImageData(o,_),c,d,l,u;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),d=parseInt(a.slice(3,5),16),l=parseInt(a.slice(5,7),16),u=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,d,l,u]=a.substring(5,a.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let v=0;v<_;v++)for(let C=0;C<o;C++)p.data[(v*o+C)*4]=c,p.data[(v*o+C)*4+1]=d,p.data[(v*o+C)*4+2]=l,p.data[(v*o+C)*4+3]=t[v][C]*(u*255);S.putImageData(p,0,0),f=we(e.createPattern(g,null)),r.set(a,f)}e.fillStyle=f,e.fillRect(i,n,h,s)}function $c(e,t,i,n,h,s,r){e.strokeStyle=e.fillStyle;for(let[a,f]of Object.entries(t)){e.beginPath(),e.lineWidth=r*Number.parseInt(a);let o;if(typeof f=="function"){let _=.15/s*h;o=f(.15,_)}else o=f;for(let _ of o.split(" ")){let g=_[0],S=Po[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,Oo(p,h,s,i,n,!0,r))}e.stroke(),e.closePath()}}function zc(e,t,i,n,h,s,r,a){let f=new Path2D;f.rect(i,n,h,s),e.clip(f),e.beginPath();let o=r/12;e.lineWidth=a*o;for(let _ of t.d.split(" ")){let g=_[0],S=Po[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,Oo(p,h,s,i,n,!1,a,(t.leftPadding??0)*(o/2),(t.rightPadding??0)*(o/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function zn(e,t,i=0){return Math.max(Math.min(e,t),i)}var Po={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 Oo(e,t,i,n,h,s,r,a=0,f=0){let o=e.map(_=>parseFloat(_)||parseInt(_));if(o.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<o.length;_+=2)o[_]*=t-a*r-f*r,s&&o[_]!==0&&(o[_]=zn(Math.round(o[_]+.5)-.5,t,0)),o[_]+=n+a*r;for(let _=1;_<o.length;_+=2)o[_]*=i,s&&o[_]!==0&&(o[_]=zn(Math.round(o[_]+.5)-.5,i,0)),o[_]+=h;return o}var Un=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},jn=class{constructor(){this._data=new Un}set(e,t,i,n,h){this._data.get(e,t)||this._data.set(e,t,new Un),this._data.get(e,t).set(i,n,h)}get(e,t,i,n){return this._data.get(e,t)?.get(i,n)}clear(){this._data.clear()}},Io=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,n=e.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),h=e.timeRemaining(),i*1.5>h){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=h}this.clear()}},Uc=class extends Io{_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())}}},jc=class extends Io{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},qc=!Mr&&"requestIdleCallback"in window?jc:Uc,Kt=class No{constructor(){this.fg=0,this.bg=0,this.extended=new Ho}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 No;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}},Ho=class Fo{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Fo(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},qn=class wr{constructor(t){this.element=t,this.next=wr.Undefined,this.prev=wr.Undefined}};qn.Undefined=new qn(void 0);var Kc=globalThis.performance&&typeof globalThis.performance.now=="function",Gc=class Wo{static create(t){return new Wo(t)}constructor(t){this._now=Kc&&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}},Vc=!1,Kn=!1,Yc=!1,Ze;(e=>{e.None=()=>Oe.None;function t(B){if(Yc){let{onDidAddListener:D}=B,O=yr.create(),P=0;B.onDidAddListener=()=>{++P===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),D?.()}}}function i(B,D){return S(B,()=>{},0,void 0,!0,void 0,D)}e.defer=i;function n(B){return(D,O=null,P)=>{let b=!1,E;return E=B(L=>{if(!b)return E?E.dispose():b=!0,D.call(O,L)},null,P),b&&E.dispose(),E}}e.once=n;function h(B,D,O){return _((P,b=null,E)=>B(L=>P.call(b,D(L)),null,E),O)}e.map=h;function s(B,D,O){return _((P,b=null,E)=>B(L=>{D(L),P.call(b,L)},null,E),O)}e.forEach=s;function r(B,D,O){return _((P,b=null,E)=>B(L=>D(L)&&P.call(b,L),null,E),O)}e.filter=r;function a(B){return B}e.signal=a;function f(...B){return(D,O=null,P)=>{let b=Mo(...B.map(E=>E(L=>D.call(O,L))));return g(b,P)}}e.any=f;function o(B,D,O,P){let b=O;return h(B,E=>(b=D(b,E),b),P)}e.reduce=o;function _(B,D){let O,P={onWillAddFirstListener(){O=B(b.fire,b)},onDidRemoveLastListener(){O?.dispose()}};D||t(P);let b=new de(P);return D?.add(b),b.event}function g(B,D){return D instanceof Array?D.push(B):D&&D.add(B),B}function S(B,D,O=100,P=!1,b=!1,E,L){let M,$,K,Y=0,U,A={leakWarningThreshold:E,onWillAddFirstListener(){M=B(N=>{Y++,$=D($,N),P&&!K&&(k.fire($),$=void 0),U=()=>{let H=$;$=void 0,K=void 0,(!P||Y>1)&&k.fire(H),Y=0},typeof O=="number"?(clearTimeout(K),K=setTimeout(U,O)):K===void 0&&(K=0,queueMicrotask(U))})},onWillRemoveListener(){b&&Y>0&&U?.()},onDidRemoveLastListener(){U=void 0,M.dispose()}};L||t(A);let k=new de(A);return L?.add(k),k.event}e.debounce=S;function p(B,D=0,O){return e.debounce(B,(P,b)=>P?(P.push(b),P):[b],D,void 0,!0,void 0,O)}e.accumulate=p;function c(B,D=(P,b)=>P===b,O){let P=!0,b;return r(B,E=>{let L=P||!D(E,b);return P=!1,b=E,L},O)}e.latch=c;function d(B,D,O){return[e.filter(B,D,O),e.filter(B,P=>!D(P),O)]}e.split=d;function l(B,D=!1,O=[],P){let b=O.slice(),E=B($=>{b?b.push($):M.fire($)});P&&P.add(E);let L=()=>{b?.forEach($=>M.fire($)),b=null},M=new de({onWillAddFirstListener(){E||(E=B($=>M.fire($)),P&&P.add(E))},onDidAddFirstListener(){b&&(D?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return P&&P.add(M),M.event}e.buffer=l;function u(B,D){return(O,P,b)=>{let E=D(new C);return B(function(L){let M=E.evaluate(L);M!==v&&O.call(P,M)},void 0,b)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(O=>(D(O),O)),this}filter(D){return this.steps.push(O=>D(O)?O:v),this}reduce(D,O){let P=O;return this.steps.push(b=>(P=D(P,b),P)),this}latch(D=(O,P)=>O===P){let O=!0,P;return this.steps.push(b=>{let E=O||!D(b,P);return O=!1,P=b,E?b:v}),this}evaluate(D){for(let O of this.steps)if(D=O(D),D===v)break;return D}}function w(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.on(D,P),E=()=>B.removeListener(D,P),L=new de({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=w;function y(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.addEventListener(D,P),E=()=>B.removeEventListener(D,P),L=new de({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(D=>n(B)(D))}e.toPromise=m;function x(B){let D=new de;return B.then(O=>{D.fire(O)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=x;function T(B,D){return B(O=>D.fire(O))}e.forward=T;function I(B,D,O){return D(O),B(P=>D(P))}e.runAndSubscribe=I;class F{constructor(D,O){this._observable=D,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};O||t(P),this.emitter=new de(P),O&&O.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,O){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,D){return new F(B,D).emitter.event}e.fromObservable=R;function z(B){return(D,O,P)=>{let b=0,E=!1,L={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,D.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let M={dispose(){B.removeObserver(L)}};return P instanceof Vt?P.add(M):Array.isArray(P)&&P.push(M),M}}e.fromObservableLight=z})(Ze||(Ze={}));var Sr=class Cr{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Cr._idPool++}`,Cr.all.add(this)}start(t){this._stopWatch=new Gc,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Sr.all=new Set,Sr._idPool=0;var Xc=Sr,Gn=-1,$o=class zo{constructor(t,i,n=(zo._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,r]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${r}):`;console.warn(a),console.warn(s);let f=new Zc(a,s);this._errorHandler(f)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[n,h]of this._stacks)(!t||i<h)&&(t=[n,h],i=h);return t}};$o._idPool=1;var Jc=$o,yr=class Uo{constructor(t){this.value=t}static create(){let t=new Error;return new Uo(t.stack??"")}print(){console.warn(this.value.split(`
|
|
56
|
+
`),{leaks:n,details:s}}};eh.idx=0;function th(e){oi=e}if(Qc){let e="__is_disposable_tracked__";th(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==Fe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Fe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Lr(e){return oi?.trackDisposable(e),e}function Mr(e){oi?.markAsDisposed(e)}function Ti(e,t){oi?.setParent(e,t)}function ih(e,t){if(oi)for(let i of e)oi.setParent(i,t)}function Xo(e){if(Fs.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}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 Jo(...e){let t=Me(()=>Xo(e));return ih(e,t),t}function Me(e){let t=Lr({dispose:Zc(()=>{Mr(t),e()})});return t}var Zo=class Qo{constructor(){this._toDispose=new Set,this._isDisposed=!1,Lr(this)}dispose(){this._isDisposed||(Mr(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Xo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return Ti(t,this),this._isDisposed?Qo.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),Ti(t,null))}};Zo.DISABLE_DISPOSED_WARNING=!1;var ni=Zo,Fe=class{constructor(){this._store=new ni,Lr(this),Ti(this._store,this)}dispose(){Mr(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Fe.None=Object.freeze({dispose(){}});var ki=class{constructor(){this._isDisposed=!1,Lr(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ti(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Mr(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ti(e,null),e}},Vs=typeof process<"u"&&"title"in process,Di=Vs?"node":navigator.userAgent,Ys=Vs?"node":navigator.platform,rh=Di.includes("Firefox"),sh=Di.includes("Edge"),ea=/^((?!chrome|android).)*safari/i.test(Di);function nh(){if(!ea)return 0;let e=Di.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var F_=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ys),W_=["Windows","Win16","Win32","WinCE"].includes(Ys),$_=Ys.indexOf("Linux")>=0,z_=/\bCrOS\b/.test(Di),oh="",ye=0,xe=0,ke=0,me=0,$e={css:"#00000000",rgba:0},Te;(e=>{function t(l,r,s,a){return a!==void 0?`#${Nt(l)}${Nt(r)}${Nt(s)}${Nt(a)}`:`#${Nt(l)}${Nt(r)}${Nt(s)}`}e.toCss=t;function i(l,r,s,a=255){return(l<<24|r<<16|s<<8|a)>>>0}e.toRgba=i;function n(l,r,s,a){return{css:e.toCss(l,r,s,a),rgba:e.toRgba(l,r,s,a)}}e.toColor=n})(Te||(Te={}));var ii;(e=>{function t(f,o){if(me=(o.rgba&255)/255,me===1)return{css:o.css,rgba:o.rgba};let _=o.rgba>>24&255,g=o.rgba>>16&255,S=o.rgba>>8&255,p=f.rgba>>24&255,h=f.rgba>>16&255,d=f.rgba>>8&255;ye=p+Math.round((_-p)*me),xe=h+Math.round((g-h)*me),ke=d+Math.round((S-d)*me);let c=Te.toCss(ye,xe,ke),u=Te.toRgba(ye,xe,ke);return{css:c,rgba:u}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function n(f,o,_){let g=Mt.ensureContrastRatio(f.rgba,o.rgba,_);if(g)return Te.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function l(f){let o=(f.rgba|255)>>>0;return[ye,xe,ke]=Mt.toChannels(o),{css:Te.toCss(ye,xe,ke),rgba:o}}e.opaque=l;function r(f,o){return me=Math.round(o*255),[ye,xe,ke]=Mt.toChannels(f.rgba),{css:Te.toCss(ye,xe,ke,me),rgba:Te.toRgba(ye,xe,ke,me)}}e.opacity=r;function s(f,o){return me=f.rgba&255,r(f,me*o/255)}e.multiplyOpacity=s;function a(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=a})(ii||(ii={}));var co;(e=>{let t,i;try{let l=document.createElement("canvas");l.width=1,l.height=1;let r=l.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function n(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return ye=parseInt(l.slice(1,2).repeat(2),16),xe=parseInt(l.slice(2,3).repeat(2),16),ke=parseInt(l.slice(3,4).repeat(2),16),Te.toColor(ye,xe,ke);case 5:return ye=parseInt(l.slice(1,2).repeat(2),16),xe=parseInt(l.slice(2,3).repeat(2),16),ke=parseInt(l.slice(3,4).repeat(2),16),me=parseInt(l.slice(4,5).repeat(2),16),Te.toColor(ye,xe,ke,me);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let r=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return ye=parseInt(r[1]),xe=parseInt(r[2]),ke=parseInt(r[3]),me=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Te.toColor(ye,xe,ke,me);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ye,xe,ke,me]=t.getImageData(0,0,1,1).data,me!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Te.toRgba(ye,xe,ke,me),css:l}}e.toColor=n})(co||(co={}));var Re;(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,l,r){let s=n/255,a=l/255,f=r/255,o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return o*.2126+_*.7152+g*.0722}e.relativeLuminance2=i})(Re||(Re={}));var Mt;(e=>{function t(s,a){if(me=(a&255)/255,me===1)return a;let f=a>>24&255,o=a>>16&255,_=a>>8&255,g=s>>24&255,S=s>>16&255,p=s>>8&255;return ye=g+Math.round((f-g)*me),xe=S+Math.round((o-S)*me),ke=p+Math.round((_-p)*me),Te.toRgba(ye,xe,ke)}e.blend=t;function i(s,a,f){let o=Re.relativeLuminance(s>>8),_=Re.relativeLuminance(a>>8);if(ft(o,_)<f){if(_<o){let p=n(s,a,f),h=ft(o,Re.relativeLuminance(p>>8));if(h<f){let d=l(s,a,f),c=ft(o,Re.relativeLuminance(d>>8));return h>c?p:d}return p}let g=l(s,a,f),S=ft(o,Re.relativeLuminance(g>>8));if(S<f){let p=n(s,a,f),h=ft(o,Re.relativeLuminance(p>>8));return S>h?g:p}return g}}e.ensureContrastRatio=i;function n(s,a,f){let o=s>>24&255,_=s>>16&255,g=s>>8&255,S=a>>24&255,p=a>>16&255,h=a>>8&255,d=ft(Re.relativeLuminance2(S,p,h),Re.relativeLuminance2(o,_,g));for(;d<f&&(S>0||p>0||h>0);)S-=Math.max(0,Math.ceil(S*.1)),p-=Math.max(0,Math.ceil(p*.1)),h-=Math.max(0,Math.ceil(h*.1)),d=ft(Re.relativeLuminance2(S,p,h),Re.relativeLuminance2(o,_,g));return(S<<24|p<<16|h<<8|255)>>>0}e.reduceLuminance=n;function l(s,a,f){let o=s>>24&255,_=s>>16&255,g=s>>8&255,S=a>>24&255,p=a>>16&255,h=a>>8&255,d=ft(Re.relativeLuminance2(S,p,h),Re.relativeLuminance2(o,_,g));for(;d<f&&(S<255||p<255||h<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),h=Math.min(255,h+Math.ceil((255-h)*.1)),d=ft(Re.relativeLuminance2(S,p,h),Re.relativeLuminance2(o,_,g));return(S<<24|p<<16|h<<8|255)>>>0}e.increaseLuminance=l;function r(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]}e.toChannels=r})(Mt||(Mt={}));function Nt(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 Xs(e){return 57508<=e&&e<=57558}function ah(e){return 57520<=e&&e<=57527}function lh(e){return 57344<=e&&e<=63743}function ch(e){return 9472<=e&&e<=9631}function hh(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 dh(e,t,i,n){return t===1&&i>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!hh(e)&&!Xs(e)&&!lh(e)}function ta(e){return Xs(e)||ch(e)}function uh(){return{css:{canvas:fr(),cell:fr()},device:{canvas:fr(),cell:fr(),char:{width:0,height:0,left:0,top:0}}}}function fr(){return{width:0,height:0}}function fh(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Le=0,Ce=0,it=!1,_t=!1,_r=!1,Be,Ss=0,_h=class{constructor(e,t,i,n,l,r){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=n,this._coreBrowserService=l,this._themeService=r,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,n){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Ce=0,Le=0,_t=!1,it=!1,_r=!1,Be=this._themeService.colors,Ss=0,e.getCode()!==0&&e.extended.underlineStyle===4){let l=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Ss=t*n%(Math.round(l)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",l=>{l.backgroundColorRGB&&(Ce=l.backgroundColorRGB.rgba>>8&16777215,_t=!0),l.foregroundColorRGB&&(Le=l.foregroundColorRGB.rgba>>8&16777215,it=!0)}),_r=this._selectionRenderModel.isCellSelected(this._terminal,t,i),_r){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ce=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ce=(this.result.fg&16777215)<<8|255;break;default:Ce=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ce=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ce=(this.result.bg&16777215)<<8|255;break}Ce=Mt.blend(Ce,(this._coreBrowserService.isFocused?Be.selectionBackgroundOpaque:Be.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ce=(this._coreBrowserService.isFocused?Be.selectionBackgroundOpaque:Be.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(_t=!0,Be.selectionForeground&&(Le=Be.selectionForeground.rgba>>8&16777215,it=!0),ta(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Le=(this._coreBrowserService.isFocused?Be.selectionBackgroundOpaque:Be.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Le=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Le=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Le=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Le=(this.result.fg&16777215)<<8|255;break;default:Le=this._themeService.colors.foreground.rgba}Le=Mt.blend(Le,(this._coreBrowserService.isFocused?Be.selectionBackgroundOpaque:Be.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}it=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",l=>{l.backgroundColorRGB&&(Ce=l.backgroundColorRGB.rgba>>8&16777215,_t=!0),l.foregroundColorRGB&&(Le=l.foregroundColorRGB.rgba>>8&16777215,it=!0)}),_t&&(_r?Ce=e.bg&-16777216&-134217729|Ce|50331648:Ce=e.bg&-16777216|Ce|50331648),it&&(Le=e.fg&-16777216&-67108865|Le|50331648),this.result.fg&67108864&&(_t&&!it&&((this.result.bg&50331648)===0?Le=this.result.fg&-134217728|Be.background.rgba>>8&16777215&16777215|50331648:Le=this.result.fg&-134217728|this.result.bg&67108863,it=!0),!_t&&it&&((this.result.fg&50331648)===0?Ce=this.result.bg&-67108864|Be.foreground.rgba>>8&16777215&16777215|50331648:Ce=this.result.bg&-67108864|this.result.fg&67108863,_t=!0)),Be=void 0,this.result.bg=_t?Ce:this.result.bg,this.result.fg=it?Le:this.result.fg,this.result.ext&=536870911,this.result.ext|=Ss<<29&3758096384}},ph=.5,ia=rh||sh?"bottom":"ideographic",gh={"\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}]},vh={"\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]]},mh={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2551":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2552":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u2553":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"\u2554":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2555":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"\u2556":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"\u2557":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"\u2558":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"\u2559":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u255A":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"\u255B":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"\u255C":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"\u255D":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"\u255E":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u255F":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"\u2560":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2561":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"\u2562":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2563":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"\u2564":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"\u2565":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"\u2566":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2567":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2568":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u2569":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u256A":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u256B":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u256C":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"\u256E":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"\u256F":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"\u2570":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Ai={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Ai["\uE0BB"]=Ai["\uE0BD"];Ai["\uE0BF"]=Ai["\uE0B9"];function bh(e,t,i,n,l,r,s,a){let f=gh[t];if(f)return wh(e,f,i,n,l,r),!0;let o=vh[t];if(o)return Sh(e,o,i,n,l,r),!0;let _=mh[t];if(_)return Ch(e,_,i,n,l,r,a),!0;let g=Ai[t];return g?(yh(e,g,i,n,l,r,s,a),!0):!1}function wh(e,t,i,n,l,r){for(let s=0;s<t.length;s++){let a=t[s],f=l/8,o=r/8;e.fillRect(i+a.x*f,n+a.y*o,a.w*f,a.h*o)}}var ho=new Map;function Sh(e,t,i,n,l,r){let s=ho.get(t);s||(s=new Map,ho.set(t,s));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let f=s.get(a);if(!f){let o=t[0].length,_=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=o,g.height=_;let S=we(g.getContext("2d")),p=new ImageData(o,_),h,d,c,u;if(a.startsWith("#"))h=parseInt(a.slice(1,3),16),d=parseInt(a.slice(3,5),16),c=parseInt(a.slice(5,7),16),u=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[h,d,c,u]=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 C=0;C<o;C++)p.data[(v*o+C)*4]=h,p.data[(v*o+C)*4+1]=d,p.data[(v*o+C)*4+2]=c,p.data[(v*o+C)*4+3]=t[v][C]*(u*255);S.putImageData(p,0,0),f=we(e.createPattern(g,null)),s.set(a,f)}e.fillStyle=f,e.fillRect(i,n,l,r)}function Ch(e,t,i,n,l,r,s){e.strokeStyle=e.fillStyle;for(let[a,f]of Object.entries(t)){e.beginPath(),e.lineWidth=s*Number.parseInt(a);let o;if(typeof f=="function"){let _=.15/r*l;o=f(.15,_)}else o=f;for(let _ of o.split(" ")){let g=_[0],S=ra[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,sa(p,l,r,i,n,!0,s))}e.stroke(),e.closePath()}}function yh(e,t,i,n,l,r,s,a){let f=new Path2D;f.rect(i,n,l,r),e.clip(f),e.beginPath();let o=s/12;e.lineWidth=a*o;for(let _ of t.d.split(" ")){let g=_[0],S=ra[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,sa(p,l,r,i,n,!1,a,(t.leftPadding??0)*(o/2),(t.rightPadding??0)*(o/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function uo(e,t,i=0){return Math.max(Math.min(e,t),i)}var ra={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 sa(e,t,i,n,l,r,s,a=0,f=0){let o=e.map(_=>parseFloat(_)||parseInt(_));if(o.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<o.length;_+=2)o[_]*=t-a*s-f*s,r&&o[_]!==0&&(o[_]=uo(Math.round(o[_]+.5)-.5,t,0)),o[_]+=n+a*s;for(let _=1;_<o.length;_+=2)o[_]*=i,r&&o[_]!==0&&(o[_]=uo(Math.round(o[_]+.5)-.5,i,0)),o[_]+=l;return o}var fo=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},_o=class{constructor(){this._data=new fo}set(e,t,i,n,l){this._data.get(e,t)||this._data.set(e,t,new fo),this._data.get(e,t).set(i,n,l)}get(e,t,i,n){return this._data.get(e,t)?.get(i,n)}clear(){this._data.clear()}},na=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,n=e.timeRemaining(),l=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),l=e.timeRemaining(),i*1.5>l){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=l}this.clear()}},xh=class extends na{_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())}}},kh=class extends na{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Eh=!Vs&&"requestIdleCallback"in window?kh:xh,ri=class oa{constructor(){this.fg=0,this.bg=0,this.extended=new aa}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 oa;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}},aa=class la{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new la(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},po=class Ws{constructor(t){this.element=t,this.next=Ws.Undefined,this.prev=Ws.Undefined}};po.Undefined=new po(void 0);var Lh=globalThis.performance&&typeof globalThis.performance.now=="function",Mh=class ca{static create(t){return new ca(t)}constructor(t){this._now=Lh&&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}},Rh=!1,go=!1,Th=!1,rt;(e=>{e.None=()=>Fe.None;function t(B){if(Th){let{onDidAddListener:D}=B,P=Us.create(),O=0;B.onDidAddListener=()=>{++O===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),P.print()),D?.()}}}function i(B,D){return S(B,()=>{},0,void 0,!0,void 0,D)}e.defer=i;function n(B){return(D,P=null,O)=>{let b=!1,E;return E=B(L=>{if(!b)return E?E.dispose():b=!0,D.call(P,L)},null,O),b&&E.dispose(),E}}e.once=n;function l(B,D,P){return _((O,b=null,E)=>B(L=>O.call(b,D(L)),null,E),P)}e.map=l;function r(B,D,P){return _((O,b=null,E)=>B(L=>{D(L),O.call(b,L)},null,E),P)}e.forEach=r;function s(B,D,P){return _((O,b=null,E)=>B(L=>D(L)&&O.call(b,L),null,E),P)}e.filter=s;function a(B){return B}e.signal=a;function f(...B){return(D,P=null,O)=>{let b=Jo(...B.map(E=>E(L=>D.call(P,L))));return g(b,O)}}e.any=f;function o(B,D,P,O){let b=P;return l(B,E=>(b=D(b,E),b),O)}e.reduce=o;function _(B,D){let P,O={onWillAddFirstListener(){P=B(b.fire,b)},onDidRemoveLastListener(){P?.dispose()}};D||t(O);let b=new ue(O);return D?.add(b),b.event}function g(B,D){return D instanceof Array?D.push(B):D&&D.add(B),B}function S(B,D,P=100,O=!1,b=!1,E,L){let M,z,K,V=0,j,T={leakWarningThreshold:E,onWillAddFirstListener(){M=B(N=>{V++,z=D(z,N),O&&!K&&(k.fire(z),z=void 0),j=()=>{let H=z;z=void 0,K=void 0,(!O||V>1)&&k.fire(H),V=0},typeof P=="number"?(clearTimeout(K),K=setTimeout(j,P)):K===void 0&&(K=0,queueMicrotask(j))})},onWillRemoveListener(){b&&V>0&&j?.()},onDidRemoveLastListener(){j=void 0,M.dispose()}};L||t(T);let k=new ue(T);return L?.add(k),k.event}e.debounce=S;function p(B,D=0,P){return e.debounce(B,(O,b)=>O?(O.push(b),O):[b],D,void 0,!0,void 0,P)}e.accumulate=p;function h(B,D=(O,b)=>O===b,P){let O=!0,b;return s(B,E=>{let L=O||!D(E,b);return O=!1,b=E,L},P)}e.latch=h;function d(B,D,P){return[e.filter(B,D,P),e.filter(B,O=>!D(O),P)]}e.split=d;function c(B,D=!1,P=[],O){let b=P.slice(),E=B(z=>{b?b.push(z):M.fire(z)});O&&O.add(E);let L=()=>{b?.forEach(z=>M.fire(z)),b=null},M=new ue({onWillAddFirstListener(){E||(E=B(z=>M.fire(z)),O&&O.add(E))},onDidAddFirstListener(){b&&(D?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return O&&O.add(M),M.event}e.buffer=c;function u(B,D){return(P,O,b)=>{let E=D(new C);return B(function(L){let M=E.evaluate(L);M!==v&&P.call(O,M)},void 0,b)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(P=>(D(P),P)),this}filter(D){return this.steps.push(P=>D(P)?P:v),this}reduce(D,P){let O=P;return this.steps.push(b=>(O=D(O,b),O)),this}latch(D=(P,O)=>P===O){let P=!0,O;return this.steps.push(b=>{let E=P||!D(b,O);return P=!1,O=b,E?b:v}),this}evaluate(D){for(let P of this.steps)if(D=P(D),D===v)break;return D}}function w(B,D,P=O=>O){let O=(...M)=>L.fire(P(...M)),b=()=>B.on(D,O),E=()=>B.removeListener(D,O),L=new ue({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=w;function y(B,D,P=O=>O){let O=(...M)=>L.fire(P(...M)),b=()=>B.addEventListener(D,O),E=()=>B.removeEventListener(D,O),L=new ue({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(D=>n(B)(D))}e.toPromise=m;function x(B){let D=new ue;return B.then(P=>{D.fire(P)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=x;function A(B,D){return B(P=>D.fire(P))}e.forward=A;function I(B,D,P){return D(P),B(O=>D(O))}e.runAndSubscribe=I;class F{constructor(D,P){this._observable=D,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};P||t(O),this.emitter=new ue(O),P&&P.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,P){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,D){return new F(B,D).emitter.event}e.fromObservable=R;function $(B){return(D,P,O)=>{let b=0,E=!1,L={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,D.call(P)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let M={dispose(){B.removeObserver(L)}};return O instanceof ni?O.add(M):Array.isArray(O)&&O.push(M),M}}e.fromObservableLight=$})(rt||(rt={}));var $s=class zs{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${zs._idPool++}`,zs.all.add(this)}start(t){this._stopWatch=new Mh,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}}};$s.all=new Set,$s._idPool=0;var Ah=$s,vo=-1,ha=class da{constructor(t,i,n=(da._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[r,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(r);let f=new Bh(a,r);this._errorHandler(f)}return()=>{let r=this._stacks.get(t.value)||0;this._stacks.set(t.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[n,l]of this._stacks)(!t||i<l)&&(t=[n,l],i=l);return t}};ha._idPool=1;var Dh=ha,Us=class ua{constructor(t){this.value=t}static create(){let t=new Error;return new ua(t.stack??"")}print(){console.warn(this.value.split(`
|
|
57
57
|
`).slice(2).join(`
|
|
58
|
-
`))}},
|
|
59
|
-
`)),e.length=0)},3e3),
|
|
58
|
+
`))}},Bh=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Ph=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Oh=0,mr=class{constructor(e){this.value=e,this.id=Oh++}},Ih=2,Nh=(e,t)=>{if(e instanceof mr)t(e);else for(let i=0;i<e.length;i++){let n=e[i];n&&t(n)}},br;if(Rh){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),br=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var ue=class{constructor(e){this._size=0,this._options=e,this._leakageMon=vo>0||this._options?.leakWarningThreshold?new Dh(e?.onListenerError??vr,this._options?.leakWarningThreshold??vo):void 0,this._perfMon=this._options?._profName?new Ah(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(go){let e=this._listeners;queueMicrotask(()=>{Nh(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],o=new Ph(`${a}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||vr)(o),Fe.None}if(this._disposed)return Fe.None;t&&(e=e.bind(t));let n=new mr(e),l,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=Us.create(),l=this._leakageMon.check(n.stack,this._size+1)),go&&(n.stack=r??Us.create()),this._listeners?this._listeners instanceof mr?(this._deliveryQueue??(this._deliveryQueue=new Hh),this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=Me(()=>{br?.unregister(s),l?.(),this._removeListener(n)});if(i instanceof ni?i.add(s):Array.isArray(i)&&i.push(s),br){let a=new Error().stack.split(`
|
|
60
60
|
`).slice(2,3).join(`
|
|
61
|
-
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);rs.register(r,f?.[2]??a,r)}return r}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*th<=t.length){let h=0;for(let s=0;s<t.length;s++)t[s]?t[h++]=t[s]:n&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||is;if(!i){e.value(t);return}try{e.value(t)}catch(n){i(n)}}_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 ss)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}},sh=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Vn={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}},ui=2,fi,mt=class jt{constructor(t,i,n){this._document=t,this._config=i,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new jn,this._cacheMapCombined=new jn,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Kt,this._textureSize=512,this._onAddTextureAtlasCanvas=new de,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new de,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=jo(t,this._config.deviceCellWidth*4+ui*2,this._config.deviceCellHeight+ui*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 qc;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let n=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,n)}})}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(jt.maxAtlasPages&&this._pages.length>=Math.max(4,jt.maxAtlasPages)){let i=this._pages.filter(o=>o.canvas.width*2<=(jt.maxTextureSize||4096)).sort((o,_)=>_.canvas.width!==o.canvas.width?_.canvas.width-o.canvas.width:_.percentageUsed-o.percentageUsed),n=-1,h=0;for(let o=0;o<i.length;o++)if(i[o].canvas.width!==h)n=o,h=i[o].canvas.width;else if(o-n===3)break;let s=i.slice(n,n+4),r=s.map(o=>o.glyphs[0].texturePage).sort((o,_)=>o>_?1:-1),a=this.pages.length-s.length,f=this._mergePages(s,a);f.version++;for(let o=r.length-1;o>=0;o--)this._deletePage(r[o]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new ir(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let n=t[0].canvas.width*2,h=new ir(this._document,n,t);for(let[s,r]of t.entries()){let a=s*r.canvas.width%n,f=Math.floor(s/2)*r.canvas.height;h.ctx.drawImage(r.canvas,a,f);for(let _ of r.glyphs)_.texturePage=i,_.sizeClipSpace.x=_.size.x/n,_.sizeClipSpace.y=_.size.y/n,_.texturePosition.x+=a,_.texturePosition.y+=f,_.texturePositionClipSpace.x=_.texturePosition.x/n,_.texturePositionClipSpace.y=_.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(r.canvas);let o=this._activePages.indexOf(r);o!==-1&&this._activePages.splice(o,1)}return h}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let n=this._pages[i];for(let h of n.glyphs)h.texturePage--;n.version++}}getRasterizedGlyphCombinedChar(t,i,n,h,s,r){return this._getFromCacheMap(this._cacheMapCombined,t,i,n,h,s,r)}getRasterizedGlyph(t,i,n,h,s,r){return this._getFromCacheMap(this._cacheMap,t,i,n,h,s,r)}_getFromCacheMap(t,i,n,h,s,r,a){return fi=t.get(i,n,h,s),fi||(fi=this._drawToCache(i,n,h,s,r,a),t.set(i,n,h,s,fi)),fi}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,n,h){if(this._config.allowTransparency)return He;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(i);break;case 50331648:let r=Kt.toColorRGB(i);s=Re.toColor(r[0],r[1],r[2]);break;default:n?s=qt.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=qt.opaque(s)),s}_getForegroundColor(t,i,n,h,s,r,a,f,o,_){let g=this._getMinimumContrastColor(t,i,n,h,s,r,a,o,f,_);if(g)return g;let S;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&o&&r<8&&(r+=8),S=this._getColorFromAnsiIndex(r);break;case 50331648:let p=Kt.toColorRGB(r);S=Re.toColor(p[0],p[1],p[2]);break;default:a?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=qt.opaque(S)),f&&(S=qt.multiplyOpacity(S,Pc)),S}_resolveBackgroundRgba(t,i,n){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,n,h){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&h&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,n,h,s,r,a,f,o,_){if(this._config.minimumContrastRatio===1||_)return;let g=this._getContrastCache(o),S=g.getColor(t,h);if(S!==void 0)return S||void 0;let p=this._resolveBackgroundRgba(i,n,a),c=this._resolveForegroundRgba(s,r,a,f),d=wt.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(o?2:1));if(!d){g.setColor(t,h,null);return}let l=Re.toColor(d>>24&255,d>>16&255,d>>8&255);return g.setColor(t,h,l),l}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,n,h,s,r){let a=typeof t=="number"?String.fromCharCode(t):t;r&&this._tmpCanvas.parentElement!==r&&(this._tmpCanvas.style.display="none",r.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+ui*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let o=Math.min(this._config.deviceCellHeight+ui*4,this._textureSize);if(this._tmpCanvas.height<o&&(this._tmpCanvas.height=o),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=h,!!this._workAttributeData.isInvisible())return Vn;let _=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),l=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),w=this._workAttributeData.getBgColorMode();if(g){let M=u;u=C,C=M;let $=v;v=w,w=$}let y=this._getBackgroundColor(w,C,g,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let m=_?this._config.fontWeightBold:this._config.fontWeight,x=p?"italic":"";this._tmpCtx.font=`${x} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Bo;let T=a.length===1&&Tr(a.charCodeAt(0)),I=a.length===1&&Ec(a.charCodeAt(0)),F=this._getForegroundColor(i,w,C,n,v,u,g,S,_,Do(a.charCodeAt(0)));this._tmpCtx.fillStyle=F.css;let R=I?0:ui*2,z=!1;this._config.customGlyphs!==!1&&(z=Hc(this._tmpCtx,a,R,R,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!T,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=M%2===1?.5:0;if(this._tmpCtx.lineWidth=M,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${Kt.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let N=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&N<8&&(N+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(N).css}this._tmpCtx.beginPath();let K=R,Y=Math.ceil(R+this._config.deviceCharHeight)-$-(s?M*2:0),U=Y+M,A=Y+M*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let N=0;N<D;N++){this._tmpCtx.save();let H=K+N*this._config.deviceCellWidth,q=K+(N+1)*this._config.deviceCellWidth,j=H+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y),this._tmpCtx.moveTo(H,A),this._tmpCtx.lineTo(q,A);break;case 3:let Q=M<=1?A:Math.ceil(R+this._config.deviceCharHeight-M/2)-$,ee=M<=1?Y:Math.ceil(R+this._config.deviceCharHeight+M/2)-$,G=new Path2D;G.rect(H,Y,this._config.deviceCellWidth,A-Y),this._tmpCtx.clip(G),this._tmpCtx.moveTo(H-this._config.deviceCellWidth/2,U),this._tmpCtx.bezierCurveTo(H-this._config.deviceCellWidth/2,ee,H,ee,H,U),this._tmpCtx.bezierCurveTo(H,Q,j,Q,j,U),this._tmpCtx.bezierCurveTo(j,ee,q,ee,q,U),this._tmpCtx.bezierCurveTo(q,Q,q+this._config.deviceCellWidth/2,Q,q+this._config.deviceCellWidth/2,U);break;case 4:let J=k===0?0:k>=M?M*2-k:M-k;k>=M||J===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H+J,Y),this._tmpCtx.lineTo(q,Y)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(H+J,Y),this._tmpCtx.moveTo(H+J+M,Y),this._tmpCtx.lineTo(q,Y)),k=Dc(q-H,M,k);break;case 5:let Z=.6,oe=.3,ae=q-H,be=Math.floor(Z*ae),Se=Math.floor(oe*ae),fe=ae-be-Se;this._tmpCtx.setLineDash([be,Se,fe]),this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y);break;default:this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!z&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let N=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in N&&N.actualBoundingBoxDescent>0){this._tmpCtx.save();let H=new Path2D;H.rect(K,Y-Math.ceil(M/2),this._config.deviceCellWidth*D,A-Y+Math.ceil(M/2)),this._tmpCtx.clip(H),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(a,R,R+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(l){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+$),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+$),this._tmpCtx.stroke()}if(z||this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let M=sr(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B);if(M)for(let $=1;$<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight-$),M=sr(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B),!!M);$++);}if(d){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),$=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.stroke()}this._tmpCtx.restore();let O=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),P;if(this._config.allowTransparency?P=rh(O):P=sr(O,y,F,B),P)return Vn;let b=this._findGlyphBoundingBox(O,this._workBoundingBox,f,I,z,R),E,L;for(;;){if(this._activePages.length===0){let M=this._createNewPage();E=M,L=M.currentRow,L.height=b.size.y;break}E=this._activePages[this._activePages.length-1],L=E.currentRow;for(let M of this._activePages)b.size.y<=M.currentRow.height&&(E=M,L=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let $ of this._activePages[M].fixedRows)$.height<=L.height&&b.size.y<=$.height&&(E=this._activePages[M],L=$);if(b.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ir(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+b.size.x>=E.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+b.size.y>=E.canvas.height||L.height>b.size.y+2){let M=!1;if(E.currentRow.y+E.currentRow.height+b.size.y>=E.canvas.height){let $;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+b.size.y<K.canvas.height){$=K;break}if($)E=$;else if(jt.maxAtlasPages&&this._pages.length>=jt.maxAtlasPages&&L.y+b.size.y<=E.canvas.height&&L.height>=b.size.y&&L.x+b.size.x<=E.canvas.width)M=!0;else{let K=this._createNewPage();E=K,L=K.currentRow,L.height=b.size.y,M=!0}}M||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),L={x:0,y:E.currentRow.y+E.currentRow.height,height:b.size.y},E.fixedRows.push(L),E.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+b.size.x<=E.canvas.width)break;L===E.currentRow?(L.x=0,L.y+=L.height,L.height=0):E.fixedRows.splice(E.fixedRows.indexOf(L),1)}return b.texturePage=this._pages.indexOf(E),b.texturePosition.x=L.x,b.texturePosition.y=L.y,b.texturePositionClipSpace.x=L.x/E.canvas.width,b.texturePositionClipSpace.y=L.y/E.canvas.height,b.sizeClipSpace.x/=E.canvas.width,b.sizeClipSpace.y/=E.canvas.height,L.height=Math.max(L.height,b.size.y),L.x+=b.size.x,E.ctx.putImageData(O,b.texturePosition.x-this._workBoundingBox.left,b.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,b.size.x,b.size.y),E.addGlyph(b),E.version++,b}_findGlyphBoundingBox(t,i,n,h,s,r){i.top=0;let a=h?this._config.deviceCellHeight:this._tmpCanvas.height,f=h?this._config.deviceCellWidth:n,o=!1;for(let _=0;_<a;_++){for(let g=0;g<f;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.top=_,o=!0;break}}if(o)break}i.left=0,o=!1;for(let _=0;_<r+f;_++){for(let g=0;g<a;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.left=_,o=!0;break}}if(o)break}i.right=f,o=!1;for(let _=r+f-1;_>=r;_--){for(let g=0;g<a;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.right=_,o=!0;break}}if(o)break}i.bottom=a,o=!1;for(let _=a-1;_>=0;_--){for(let g=0;g<f;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.bottom=_,o=!0;break}}if(o)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+r+(h||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+r+(h||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},ir=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let n of i)this._glyphs.push(...n.glyphs),this._usedPixels+=n._usedPixels;this.canvas=jo(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 sr(e,t,i,n){let h=t.rgba>>>24,s=t.rgba>>>16&255,r=t.rgba>>>8&255,a=i.rgba>>>24,f=i.rgba>>>16&255,o=i.rgba>>>8&255,_=Math.floor((Math.abs(h-a)+Math.abs(s-f)+Math.abs(r-o))/12),g=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===h&&e.data[S+1]===s&&e.data[S+2]===r||n&&Math.abs(e.data[S]-h)+Math.abs(e.data[S+1]-s)+Math.abs(e.data[S+2]-r)<_?e.data[S+3]=0:g=!1;return g}function rh(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function jo(e,t,i){let n=e.createElement("canvas");return n.width=t,n.height=i,n}function nh(e,t,i,n,h,s,r,a){let f={foreground:s.foreground,background:s.background,cursor:He,cursorAccent:He,selectionForeground:He,selectionBackgroundTransparent:He,selectionBackgroundOpaque:He,selectionInactiveBackgroundTransparent:He,selectionInactiveBackgroundOpaque:He,overviewRulerBorder:He,scrollbarSliderBackground:He,scrollbarSliderHoverBackground:He,scrollbarSliderActiveBackground:He,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:h.customGlyphs,devicePixelRatio:r,deviceMaxTextureSize:a,letterSpacing:h.letterSpacing,lineHeight:h.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:n,fontFamily:h.fontFamily,fontSize:h.fontSize,fontWeight:h.fontWeight,fontWeightBold:h.fontWeightBold,allowTransparency:h.allowTransparency,drawBoldTextInBrightColors:h.drawBoldTextInBrightColors,minimumContrastRatio:h.minimumContrastRatio,colors:f}}function Yn(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function oh(e){return(e&50331648)===16777216||(e&50331648)===33554432}var We=[];function qo(e,t,i,n,h,s,r,a,f){let o=nh(n,h,s,r,t,i,a,f);for(let S=0;S<We.length;S++){let p=We[S],c=p.ownedBy.indexOf(e);if(c>=0){if(Yn(p.config,o))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),We.splice(S,1)):p.ownedBy.splice(c,1);break}}for(let S=0;S<We.length;S++){let p=We[S];if(Yn(p.config,o))return p.ownedBy.push(e),p.atlas}let _=e._core,g={atlas:new mt(document,o,_.unicodeService),config:o,ownedBy:[e]};return We.push(g),g.atlas}function Xn(e){for(let t=0;t<We.length;t++){let i=We[t].ownedBy.indexOf(e);if(i!==-1){We[t].ownedBy.length===1?(We[t].atlas.dispose(),We.splice(t,1)):We[t].ownedBy.splice(i,1);break}}}var es=600,ah=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=es){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=es-(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=es-(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})},es)},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 Jn(e,t,i){let n=new t.ResizeObserver(h=>{let s=h.find(f=>f.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){n?.disconnect(),n=void 0;return}let r=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;r>0&&a>0&&i(r,a)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return Le(()=>n?.disconnect())}function lh(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Zn=class Ko extends Kt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ho,this.combinedData=""}static fromCharData(t){let i=new Ko;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?lh(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let h=t[1].charCodeAt(1);56320<=h&&h<=57343?this.content=(n-55296)*1024+h-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Go=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Vo(e,t,i){let n=we(e.createProgram());if(e.attachShader(n,we(Qn(e,e.VERTEX_SHADER,t))),e.attachShader(n,we(Qn(e,e.FRAGMENT_SHADER,i))),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS))return n;console.error(e.getProgramInfoLog(n)),e.deleteProgram(n)}function Qn(e,t,i){let n=we(e.createShader(t));if(e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))return n;console.error(e.getShaderInfoLog(n)),e.deleteShader(n)}function ch(e,t){let i=Math.min(e.length*2,t),n=new Float32Array(i);for(let h=0;h<e.length;h++)n[h]=e[h];return n}var hh=class{constructor(e){this.texture=e,this.version=-1}},dh=`#version 300 es
|
|
61
|
+
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);br.register(s,f?.[2]??a,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*Ih<=t.length){let l=0;for(let r=0;r<t.length;r++)t[r]?t[l++]=t[r]:n&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||vr;if(!i){e.value(t);return}try{e.value(t)}catch(n){i(n)}}_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 mr)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}},Hh=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},mo={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}},Ei=2,Li,Et=class ti{constructor(t,i,n){this._document=t,this._config=i,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new _o,this._cacheMapCombined=new _o,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new ri,this._textureSize=512,this._onAddTextureAtlasCanvas=new ue,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ue,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=fa(t,this._config.deviceCellWidth*4+Ei*2,this._config.deviceCellHeight+Ei*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 Eh;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let n=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,n)}})}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(ti.maxAtlasPages&&this._pages.length>=Math.max(4,ti.maxAtlasPages)){let i=this._pages.filter(o=>o.canvas.width*2<=(ti.maxTextureSize||4096)).sort((o,_)=>_.canvas.width!==o.canvas.width?_.canvas.width-o.canvas.width:_.percentageUsed-o.percentageUsed),n=-1,l=0;for(let o=0;o<i.length;o++)if(i[o].canvas.width!==l)n=o,l=i[o].canvas.width;else if(o-n===3)break;let r=i.slice(n,n+4),s=r.map(o=>o.glyphs[0].texturePage).sort((o,_)=>o>_?1:-1),a=this.pages.length-r.length,f=this._mergePages(r,a);f.version++;for(let o=s.length-1;o>=0;o--)this._deletePage(s[o]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new Cs(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let n=t[0].canvas.width*2,l=new Cs(this._document,n,t);for(let[r,s]of t.entries()){let a=r*s.canvas.width%n,f=Math.floor(r/2)*s.canvas.height;l.ctx.drawImage(s.canvas,a,f);for(let _ of s.glyphs)_.texturePage=i,_.sizeClipSpace.x=_.size.x/n,_.sizeClipSpace.y=_.size.y/n,_.texturePosition.x+=a,_.texturePosition.y+=f,_.texturePositionClipSpace.x=_.texturePosition.x/n,_.texturePositionClipSpace.y=_.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(s.canvas);let o=this._activePages.indexOf(s);o!==-1&&this._activePages.splice(o,1)}return l}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let n=this._pages[i];for(let l of n.glyphs)l.texturePage--;n.version++}}getRasterizedGlyphCombinedChar(t,i,n,l,r,s){return this._getFromCacheMap(this._cacheMapCombined,t,i,n,l,r,s)}getRasterizedGlyph(t,i,n,l,r,s){return this._getFromCacheMap(this._cacheMap,t,i,n,l,r,s)}_getFromCacheMap(t,i,n,l,r,s,a){return Li=t.get(i,n,l,r),Li||(Li=this._drawToCache(i,n,l,r,s,a),t.set(i,n,l,r,Li)),Li}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,n,l){if(this._config.allowTransparency)return $e;let r;switch(t){case 16777216:case 33554432:r=this._getColorFromAnsiIndex(i);break;case 50331648:let s=ri.toColorRGB(i);r=Te.toColor(s[0],s[1],s[2]);break;default:n?r=ii.opaque(this._config.colors.foreground):r=this._config.colors.background;break}return this._config.allowTransparency||(r=ii.opaque(r)),r}_getForegroundColor(t,i,n,l,r,s,a,f,o,_){let g=this._getMinimumContrastColor(t,i,n,l,r,s,a,o,f,_);if(g)return g;let S;switch(r){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&o&&s<8&&(s+=8),S=this._getColorFromAnsiIndex(s);break;case 50331648:let p=ri.toColorRGB(s);S=Te.toColor(p[0],p[1],p[2]);break;default:a?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=ii.opaque(S)),f&&(S=ii.multiplyOpacity(S,ph)),S}_resolveBackgroundRgba(t,i,n){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,n,l){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&l&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,n,l,r,s,a,f,o,_){if(this._config.minimumContrastRatio===1||_)return;let g=this._getContrastCache(o),S=g.getColor(t,l);if(S!==void 0)return S||void 0;let p=this._resolveBackgroundRgba(i,n,a),h=this._resolveForegroundRgba(r,s,a,f),d=Mt.ensureContrastRatio(p,h,this._config.minimumContrastRatio/(o?2:1));if(!d){g.setColor(t,l,null);return}let c=Te.toColor(d>>24&255,d>>16&255,d>>8&255);return g.setColor(t,l,c),c}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,n,l,r,s){let a=typeof t=="number"?String.fromCharCode(t):t;s&&this._tmpCanvas.parentElement!==s&&(this._tmpCanvas.style.display="none",s.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+Ei*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let o=Math.min(this._config.deviceCellHeight+Ei*4,this._textureSize);if(this._tmpCanvas.height<o&&(this._tmpCanvas.height=o),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=l,!!this._workAttributeData.isInvisible())return mo;let _=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),h=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),c=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),w=this._workAttributeData.getBgColorMode();if(g){let M=u;u=C,C=M;let z=v;v=w,w=z}let y=this._getBackgroundColor(w,C,g,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let m=_?this._config.fontWeightBold:this._config.fontWeight,x=p?"italic":"";this._tmpCtx.font=`${x} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ia;let A=a.length===1&&Xs(a.charCodeAt(0)),I=a.length===1&&ah(a.charCodeAt(0)),F=this._getForegroundColor(i,w,C,n,v,u,g,S,_,ta(a.charCodeAt(0)));this._tmpCtx.fillStyle=F.css;let R=I?0:Ei*2,$=!1;this._config.customGlyphs!==!1&&($=bh(this._tmpCtx,a,R,R,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!A,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),h){this._tmpCtx.save();let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),z=M%2===1?.5:0;if(this._tmpCtx.lineWidth=M,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${ri.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let N=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&N<8&&(N+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(N).css}this._tmpCtx.beginPath();let K=R,V=Math.ceil(R+this._config.deviceCharHeight)-z-(r?M*2:0),j=V+M,T=V+M*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let N=0;N<D;N++){this._tmpCtx.save();let H=K+N*this._config.deviceCellWidth,q=K+(N+1)*this._config.deviceCellWidth,U=H+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(H,V),this._tmpCtx.lineTo(q,V),this._tmpCtx.moveTo(H,T),this._tmpCtx.lineTo(q,T);break;case 3:let Z=M<=1?T:Math.ceil(R+this._config.deviceCharHeight-M/2)-z,ee=M<=1?V:Math.ceil(R+this._config.deviceCharHeight+M/2)-z,Y=new Path2D;Y.rect(H,V,this._config.deviceCellWidth,T-V),this._tmpCtx.clip(Y),this._tmpCtx.moveTo(H-this._config.deviceCellWidth/2,j),this._tmpCtx.bezierCurveTo(H-this._config.deviceCellWidth/2,ee,H,ee,H,j),this._tmpCtx.bezierCurveTo(H,Z,U,Z,U,j),this._tmpCtx.bezierCurveTo(U,ee,q,ee,q,j),this._tmpCtx.bezierCurveTo(q,Z,q+this._config.deviceCellWidth/2,Z,q+this._config.deviceCellWidth/2,j);break;case 4:let Q=k===0?0:k>=M?M*2-k:M-k;k>=M||Q===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H+Q,V),this._tmpCtx.lineTo(q,V)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H,V),this._tmpCtx.lineTo(H+Q,V),this._tmpCtx.moveTo(H+Q+M,V),this._tmpCtx.lineTo(q,V)),k=fh(q-H,M,k);break;case 5:let X=.6,ie=.3,ne=q-H,he=Math.floor(X*ne),ce=Math.floor(ie*ne),ge=ne-he-ce;this._tmpCtx.setLineDash([he,ce,ge]),this._tmpCtx.moveTo(H,V),this._tmpCtx.lineTo(q,V);break;default:this._tmpCtx.moveTo(H,V),this._tmpCtx.lineTo(q,V);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!$&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let N=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in N&&N.actualBoundingBoxDescent>0){this._tmpCtx.save();let H=new Path2D;H.rect(K,V-Math.ceil(M/2),this._config.deviceCellWidth*D,T-V+Math.ceil(M/2)),this._tmpCtx.clip(H),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(a,R,R+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(c){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),z=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+z),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+z),this._tmpCtx.stroke()}if($||this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let M=ys(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B);if(M)for(let z=1;z<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight-z),M=ys(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B),!!M);z++);}if(d){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),z=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+Math.floor(this._config.deviceCharHeight/2)-z),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+Math.floor(this._config.deviceCharHeight/2)-z),this._tmpCtx.stroke()}this._tmpCtx.restore();let P=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),O;if(this._config.allowTransparency?O=Fh(P):O=ys(P,y,F,B),O)return mo;let b=this._findGlyphBoundingBox(P,this._workBoundingBox,f,I,$,R),E,L;for(;;){if(this._activePages.length===0){let M=this._createNewPage();E=M,L=M.currentRow,L.height=b.size.y;break}E=this._activePages[this._activePages.length-1],L=E.currentRow;for(let M of this._activePages)b.size.y<=M.currentRow.height&&(E=M,L=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let z of this._activePages[M].fixedRows)z.height<=L.height&&b.size.y<=z.height&&(E=this._activePages[M],L=z);if(b.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Cs(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+b.size.x>=E.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+b.size.y>=E.canvas.height||L.height>b.size.y+2){let M=!1;if(E.currentRow.y+E.currentRow.height+b.size.y>=E.canvas.height){let z;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+b.size.y<K.canvas.height){z=K;break}if(z)E=z;else if(ti.maxAtlasPages&&this._pages.length>=ti.maxAtlasPages&&L.y+b.size.y<=E.canvas.height&&L.height>=b.size.y&&L.x+b.size.x<=E.canvas.width)M=!0;else{let K=this._createNewPage();E=K,L=K.currentRow,L.height=b.size.y,M=!0}}M||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),L={x:0,y:E.currentRow.y+E.currentRow.height,height:b.size.y},E.fixedRows.push(L),E.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+b.size.x<=E.canvas.width)break;L===E.currentRow?(L.x=0,L.y+=L.height,L.height=0):E.fixedRows.splice(E.fixedRows.indexOf(L),1)}return b.texturePage=this._pages.indexOf(E),b.texturePosition.x=L.x,b.texturePosition.y=L.y,b.texturePositionClipSpace.x=L.x/E.canvas.width,b.texturePositionClipSpace.y=L.y/E.canvas.height,b.sizeClipSpace.x/=E.canvas.width,b.sizeClipSpace.y/=E.canvas.height,L.height=Math.max(L.height,b.size.y),L.x+=b.size.x,E.ctx.putImageData(P,b.texturePosition.x-this._workBoundingBox.left,b.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,b.size.x,b.size.y),E.addGlyph(b),E.version++,b}_findGlyphBoundingBox(t,i,n,l,r,s){i.top=0;let a=l?this._config.deviceCellHeight:this._tmpCanvas.height,f=l?this._config.deviceCellWidth:n,o=!1;for(let _=0;_<a;_++){for(let g=0;g<f;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.top=_,o=!0;break}}if(o)break}i.left=0,o=!1;for(let _=0;_<s+f;_++){for(let g=0;g<a;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.left=_,o=!0;break}}if(o)break}i.right=f,o=!1;for(let _=s+f-1;_>=s;_--){for(let g=0;g<a;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.right=_,o=!0;break}}if(o)break}i.bottom=a,o=!1;for(let _=a-1;_>=0;_--){for(let g=0;g<f;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.bottom=_,o=!0;break}}if(o)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+s+(l||r?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+s+(l||r?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Cs=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let n of i)this._glyphs.push(...n.glyphs),this._usedPixels+=n._usedPixels;this.canvas=fa(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 ys(e,t,i,n){let l=t.rgba>>>24,r=t.rgba>>>16&255,s=t.rgba>>>8&255,a=i.rgba>>>24,f=i.rgba>>>16&255,o=i.rgba>>>8&255,_=Math.floor((Math.abs(l-a)+Math.abs(r-f)+Math.abs(s-o))/12),g=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===l&&e.data[S+1]===r&&e.data[S+2]===s||n&&Math.abs(e.data[S]-l)+Math.abs(e.data[S+1]-r)+Math.abs(e.data[S+2]-s)<_?e.data[S+3]=0:g=!1;return g}function Fh(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function fa(e,t,i){let n=e.createElement("canvas");return n.width=t,n.height=i,n}function Wh(e,t,i,n,l,r,s,a){let f={foreground:r.foreground,background:r.background,cursor:$e,cursorAccent:$e,selectionForeground:$e,selectionBackgroundTransparent:$e,selectionBackgroundOpaque:$e,selectionInactiveBackgroundTransparent:$e,selectionInactiveBackgroundOpaque:$e,overviewRulerBorder:$e,scrollbarSliderBackground:$e,scrollbarSliderHoverBackground:$e,scrollbarSliderActiveBackground:$e,ansi:r.ansi.slice(),contrastCache:r.contrastCache,halfContrastCache:r.halfContrastCache};return{customGlyphs:l.customGlyphs,devicePixelRatio:s,deviceMaxTextureSize:a,letterSpacing:l.letterSpacing,lineHeight:l.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:n,fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:l.fontWeight,fontWeightBold:l.fontWeightBold,allowTransparency:l.allowTransparency,drawBoldTextInBrightColors:l.drawBoldTextInBrightColors,minimumContrastRatio:l.minimumContrastRatio,colors:f}}function bo(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function $h(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Ue=[];function _a(e,t,i,n,l,r,s,a,f){let o=Wh(n,l,r,s,t,i,a,f);for(let S=0;S<Ue.length;S++){let p=Ue[S],h=p.ownedBy.indexOf(e);if(h>=0){if(bo(p.config,o))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),Ue.splice(S,1)):p.ownedBy.splice(h,1);break}}for(let S=0;S<Ue.length;S++){let p=Ue[S];if(bo(p.config,o))return p.ownedBy.push(e),p.atlas}let _=e._core,g={atlas:new Et(document,o,_.unicodeService),config:o,ownedBy:[e]};return Ue.push(g),g.atlas}function wo(e){for(let t=0;t<Ue.length;t++){let i=Ue[t].ownedBy.indexOf(e);if(i!==-1){Ue[t].ownedBy.length===1?(Ue[t].atlas.dispose(),Ue.splice(t,1)):Ue[t].ownedBy.splice(i,1);break}}}var pr=600,zh=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=pr){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=pr-(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=pr-(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})},pr)},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 So(e,t,i){let n=new t.ResizeObserver(l=>{let r=l.find(f=>f.target===e);if(!r)return;if(!("devicePixelContentBoxSize"in r)){n?.disconnect(),n=void 0;return}let s=r.devicePixelContentBoxSize[0].inlineSize,a=r.devicePixelContentBoxSize[0].blockSize;s>0&&a>0&&i(s,a)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return Me(()=>n?.disconnect())}function Uh(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Co=class pa extends ri{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new aa,this.combinedData=""}static fromCharData(t){let i=new pa;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Uh(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(n-55296)*1024+l-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ga=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function va(e,t,i){let n=we(e.createProgram());if(e.attachShader(n,we(yo(e,e.VERTEX_SHADER,t))),e.attachShader(n,we(yo(e,e.FRAGMENT_SHADER,i))),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS))return n;console.error(e.getProgramInfoLog(n)),e.deleteProgram(n)}function yo(e,t,i){let n=we(e.createShader(t));if(e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))return n;console.error(e.getShaderInfoLog(n)),e.deleteShader(n)}function jh(e,t){let i=Math.min(e.length*2,t),n=new Float32Array(i);for(let l=0;l<e.length;l++)n[l]=e[l];return n}var qh=class{constructor(e){this.texture=e,this.version=-1}},Kh=`#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
|
|
81
|
+
}`;function Gh(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
|
|
82
82
|
precision lowp float;
|
|
83
83
|
|
|
84
84
|
in vec2 v_texcoord;
|
|
@@ -92,7 +92,7 @@ void main() {
|
|
|
92
92
|
if (v_texpage == 0) {
|
|
93
93
|
outColor = texture(u_texture[0], v_texcoord);
|
|
94
94
|
} ${t}
|
|
95
|
-
}`}var
|
|
95
|
+
}`}var Lt=11,ei=Lt*Float32Array.BYTES_PER_ELEMENT,Vh=2,ve=0,pe,xs=0,Mi=0,Yh=class extends Fe{constructor(e,t,i,n){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=n,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let l=this._gl;Et.maxAtlasPages===void 0&&(Et.maxAtlasPages=Math.min(32,we(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),Et.maxTextureSize=we(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=we(va(l,Kh,Gh(Et.maxAtlasPages))),this._register(Me(()=>l.deleteProgram(this._program))),this._projectionLocation=we(l.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=we(l.getUniformLocation(this._program,"u_resolution")),this._textureLocation=we(l.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let r=new Float32Array([0,0,1,0,0,1,1,1]),s=l.createBuffer();this._register(Me(()=>l.deleteBuffer(s))),l.bindBuffer(l.ARRAY_BUFFER,s),l.bufferData(l.ARRAY_BUFFER,r,l.STATIC_DRAW),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=l.createBuffer();this._register(Me(()=>l.deleteBuffer(f))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f),l.bufferData(l.ELEMENT_ARRAY_BUFFER,a,l.STATIC_DRAW),this._attributesBuffer=we(l.createBuffer()),this._register(Me(()=>l.deleteBuffer(this._attributesBuffer))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,2,l.FLOAT,!1,ei,0),l.vertexAttribDivisor(2,1),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,l.FLOAT,!1,ei,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(3,1),l.enableVertexAttribArray(4),l.vertexAttribPointer(4,1,l.FLOAT,!1,ei,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(4,1),l.enableVertexAttribArray(5),l.vertexAttribPointer(5,2,l.FLOAT,!1,ei,5*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(5,1),l.enableVertexAttribArray(6),l.vertexAttribPointer(6,2,l.FLOAT,!1,ei,7*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(6,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,ei,9*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.useProgram(this._program);let o=new Int32Array(Et.maxAtlasPages);for(let _=0;_<Et.maxAtlasPages;_++)o[_]=_;l.uniform1iv(this._textureLocation,o),l.uniformMatrix4fv(this._projectionLocation,!1,ga),this._atlasTextures=[];for(let _=0;_<Et.maxAtlasPages;_++){let g=new qh(we(l.createTexture()));this._register(Me(()=>l.deleteTexture(g.texture))),l.activeTexture(l.TEXTURE0+_),l.bindTexture(l.TEXTURE_2D,g.texture),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,1,1,0,l.RGBA,l.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=g}l.enable(l.BLEND),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,n,l,r,s,a,f){this._updateCell(this._vertices.attributes,e,t,i,n,l,r,s,a,f)}_updateCell(e,t,i,n,l,r,s,a,f,o){if(ve=(i*this._terminal.cols+t)*Lt,n===0||n===void 0){e.fill(0,ve,ve+Lt-1-Vh);return}this._atlas&&(a&&a.length>1?pe=this._atlas.getRasterizedGlyphCombinedChar(a,l,r,s,!1,this._terminal.element):pe=this._atlas.getRasterizedGlyph(n,l,r,s,!1,this._terminal.element),xs=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),l!==o&&pe.offset.x>xs?(Mi=pe.offset.x-xs,e[ve]=-(pe.offset.x-Mi)+this._dimensions.device.char.left,e[ve+1]=-pe.offset.y+this._dimensions.device.char.top,e[ve+2]=(pe.size.x-Mi)/this._dimensions.device.canvas.width,e[ve+3]=pe.size.y/this._dimensions.device.canvas.height,e[ve+4]=pe.texturePage,e[ve+5]=pe.texturePositionClipSpace.x+Mi/this._atlas.pages[pe.texturePage].canvas.width,e[ve+6]=pe.texturePositionClipSpace.y,e[ve+7]=pe.sizeClipSpace.x-Mi/this._atlas.pages[pe.texturePage].canvas.width,e[ve+8]=pe.sizeClipSpace.y):(e[ve]=-pe.offset.x+this._dimensions.device.char.left,e[ve+1]=-pe.offset.y+this._dimensions.device.char.top,e[ve+2]=pe.size.x/this._dimensions.device.canvas.width,e[ve+3]=pe.size.y/this._dimensions.device.canvas.height,e[ve+4]=pe.texturePage,e[ve+5]=pe.texturePositionClipSpace.x,e[ve+6]=pe.texturePositionClipSpace.y,e[ve+7]=pe.sizeClipSpace.x,e[ve+8]=pe.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&dh(n,f,pe.size.x,this._dimensions.device.cell.width)&&(e[ve+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*Lt;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let n=0;n<e.rows;n++)for(let l=0;l<e.cols;l++)this._vertices.attributes[i+9]=l/e.cols,this._vertices.attributes[i+10]=n/e.rows,i+=Lt}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],n=0;for(let l=0;l<e.lineLengths.length;l++){let r=l*this._terminal.cols*Lt,s=this._vertices.attributes.subarray(r,r+e.lineLengths[l]*Lt);i.set(s,n),n+=s.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,n),t.STREAM_DRAW);for(let l=0;l<this._atlas.pages.length;l++)this._atlas.pages[l].version!==this._atlasTextures[l].version&&this._bindAtlasPageTexture(t,this._atlas,l);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,n/Lt)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},Xh=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,n=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let l=e.buffers.active.ydisp,r=t[1]-l,s=i[1]-l,a=Math.max(r,0),f=Math.min(s,e.rows-1);if(a>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=r,this.viewportEndRow=s,this.viewportCappedStartRow=a,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Jh(){return new Xh}var Er=4,wr=1,Sr=2,ks=3,Zh=2147483648,Qh=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Jh()}resize(e,t){let i=e*t*Er;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},ed=`#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
|
-
}`,
|
|
109
|
+
}`,td=`#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
|
-
}`,dt=8,or=dt*Float32Array.BYTES_PER_ELEMENT,Sh=20*dt,eo=class{constructor(){this.attributes=new Float32Array(Sh),this.count=0}},ct=0,to=0,io=0,so=0,ro=0,no=0,oo=0,Ch=class extends Oe{constructor(e,t,i,n){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=n,this._vertices=new eo,this._verticesCursor=new eo;let h=this._gl;this._program=we(Vo(h,bh,wh)),this._register(Le(()=>h.deleteProgram(this._program))),this._projectionLocation=we(h.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),r=h.createBuffer();this._register(Le(()=>h.deleteBuffer(r))),h.bindBuffer(h.ARRAY_BUFFER,r),h.bufferData(h.ARRAY_BUFFER,s,h.STATIC_DRAW),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=h.createBuffer();this._register(Le(()=>h.deleteBuffer(f))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f),h.bufferData(h.ELEMENT_ARRAY_BUFFER,a,h.STATIC_DRAW),this._attributesBuffer=we(h.createBuffer()),this._register(Le(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,or,0),h.vertexAttribDivisor(0,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,or,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,or,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(2,1),this._updateCachedColors(n.colors),this._register(this._themeService.onChangeColors(o=>{this._updateCachedColors(o),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,Go),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,n=1,h,s,r,a,f,o,_,g,S,p,c;for(h=0;h<t.rows;h++){for(r=-1,a=0,f=0,o=!1,s=0;s<t.cols;s++)_=(h*t.cols+s)*ds,g=e.cells[_+ns],S=e.cells[_+os],p=!!(S&67108864),(g!==a||S!==f&&(o||p))&&((a!==0||o&&f!==0)&&(c=n++*dt,this._updateRectangle(i,c,f,a,r,s,h)),r=s,a=g,f=S,o=p);(a!==0||o&&f!==0)&&(c=n++*dt,this._updateRectangle(i,c,f,a,r,t.cols,h))}i.count=n}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let n,h=0;(i.style==="bar"||i.style==="outline")&&(n=h++*dt,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(n=h++*dt,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(n=h++*dt,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),n=h++*dt,this._addRectangleFloat(t.attributes,n,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=h}_updateRectangle(e,t,i,n,h,s,r){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:ct=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:ct=(i&16777215)<<8;break;default:ct=this._themeService.colors.foreground.rgba}else switch(n&50331648){case 16777216:case 33554432:ct=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:ct=(n&16777215)<<8;break;default:ct=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=ch(e.attributes,this._terminal.rows*this._terminal.cols*dt)),to=h*this._dimensions.device.cell.width,io=r*this._dimensions.device.cell.height,so=(ct>>24&255)/255,ro=(ct>>16&255)/255,no=(ct>>8&255)/255,oo=1,this._addRectangle(e.attributes,t,to,io,(s-h)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,so,ro,no,oo)}_addRectangle(e,t,i,n,h,s,r,a,f,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=n/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=r,e[t+5]=a,e[t+6]=f,e[t+7]=o}_addRectangleFloat(e,t,i,n,h,s,r){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=n/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=r[0],e[t+5]=r[1],e[t+6]=r[2],e[t+7]=r[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},yh=class extends Oe{constructor(e,t,i,n,h,s,r,a){super(),this._container=t,this._alpha=h,this._coreBrowserService=s,this._optionsService=r,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(e,f),this.reset(e)})),this._register(Le(()=>{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,i){}handleSelectionChanged(e,t,i,n=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=qo(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,n){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,n){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Bo,this._clipCell(i,n,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let n=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${n} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},xh=class extends yh{constructor(e,t,i,n,h,s,r){super(i,e,"link",t,!0,h,s,r),this._register(n.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(n.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&&oh(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()}},Ke=typeof window=="object"?window:globalThis,xr=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new de,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new de,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};xr.INSTANCE=new xr;var Yo=xr;function kh(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var r_=Yo.INSTANCE.onDidChangeZoomLevel,n_=Yo.INSTANCE.onDidChangeFullscreen,Xt=typeof navigator=="object"?navigator.userAgent:"",o_=Xt.indexOf("Firefox")>=0,ar=Xt.indexOf("AppleWebKit")>=0,Eh=Xt.indexOf("Chrome")>=0,Lh=!Eh&&Xt.indexOf("Safari")>=0,a_=Xt.indexOf("Electron/")>=0,l_=Xt.indexOf("Android")>=0,as=!1;if(typeof Ke.matchMedia=="function"){let e=Ke.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ke.matchMedia("(display-mode: fullscreen)");as=e.matches,kh(Ke,e,({matches:i})=>{as&&t.matches||(as=i)})}function Mh(){return as}var Gt="en",kr=!1,Er=!1,ls=!1,Rh=!1,Xo=!1,Jo=!1,Th=!1,Ah=!1,Dh=!1,Bh=!1,ts,cs=Gt,ao=Gt,Ph,ht,ft=globalThis,Pe;typeof ft.vscode<"u"&&typeof ft.vscode.process<"u"?Pe=ft.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Pe=process);var Zo=typeof Pe?.versions?.electron=="string",Oh=Zo&&Pe?.type==="renderer";if(typeof Pe=="object"){kr=Pe.platform==="win32",Er=Pe.platform==="darwin",ls=Pe.platform==="linux",Rh=ls&&!!Pe.env.SNAP&&!!Pe.env.SNAP_REVISION,Th=Zo,Dh=!!Pe.env.CI||!!Pe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ts=Gt,cs=Gt;let e=Pe.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ts=t.userLocale,ao=t.osLocale,cs=t.resolvedLanguage||Gt,Ph=t.languagePack?.translationsConfigFile}catch{}Xo=!0}else typeof navigator=="object"&&!Oh?(ht=navigator.userAgent,kr=ht.indexOf("Windows")>=0,Er=ht.indexOf("Macintosh")>=0,Ah=(ht.indexOf("Macintosh")>=0||ht.indexOf("iPad")>=0||ht.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ls=ht.indexOf("Linux")>=0,Bh=ht?.indexOf("Mobi")>=0,Jo=!0,cs=globalThis._VSCODE_NLS_LANGUAGE||Gt,ts=navigator.language.toLowerCase(),ao=ts):console.error("Unable to resolve platform.");var lr=0;Er?lr=1:kr?lr=3:ls&&(lr=2);var cr=Xo,Ih=Jo&&typeof ft.importScripts=="function",c_=Ih?ft.origin:void 0,Qe=ht,gt=cs,lo;(e=>{function t(){return gt}e.value=t;function i(){return gt.length===2?gt==="en":gt.length>=3?gt[0]==="e"&>[1]==="n"&>[2]==="-":!1}e.isDefaultVariant=i;function n(){return gt==="en"}e.isDefault=n})(lo||(lo={}));var Nh=typeof ft.postMessage=="function"&&!ft.importScripts,Hh=(()=>{if(Nh){let e=[];ft.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,h=e.length;n<h;n++){let s=e[n];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),ft.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),Fh=!!(Qe&&Qe.indexOf("Chrome")>=0),h_=!!(Qe&&Qe.indexOf("Firefox")>=0),d_=!!(!Fh&&Qe&&Qe.indexOf("Safari")>=0),u_=!!(Qe&&Qe.indexOf("Edg/")>=0),f_=!!(Qe&&Qe.indexOf("Android")>=0),vt=typeof navigator=="object"?navigator:{},__={clipboard:{writeText:cr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(vt&&vt.clipboard&&vt.clipboard.writeText),readText:cr||!!(vt&&vt.clipboard&&vt.clipboard.readText)},keyboard:cr||Mh()?0:vt.keyboard||Lh?1:2,touch:"ontouchstart"in Ke||vt.maxTouchPoints>0,pointerEvents:Ke.PointerEvent&&("ontouchstart"in Ke||navigator.maxTouchPoints>0)},Ar=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}},hr=new Ar,co=new Ar,ho=new Ar,p_=new Array(230),uo;(e=>{function t(a){return hr.keyCodeToStr(a)}e.toString=t;function i(a){return hr.strToKeyCode(a)}e.fromString=i;function n(a){return co.keyCodeToStr(a)}e.toUserSettingsUS=n;function h(a){return ho.keyCodeToStr(a)}e.toUserSettingsGeneral=h;function s(a){return co.strToKeyCode(a)||ho.strToKeyCode(a)}e.fromUserSettings=s;function r(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 hr.keyCodeToStr(a)}e.toElectronAccelerator=r})(uo||(uo={}));var Qo=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),fo;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Wh?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ze.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Qo})})(fo||(fo={}));var Wh=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?Qo:(this._emitter||(this._emitter=new de),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var $h,dr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?dr=(e,t)=>{Hh(()=>{if(i)return;let n=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:dr=(e,t,i)=>{let n=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(n))}}},$h=e=>dr(globalThis,e)})();var _o;(e=>{async function t(n){let h,s=await Promise.all(n.map(r=>r.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return s}e.settled=t;function i(n){return new Promise(async(h,s)=>{try{await n(h,s)}catch(r){s(r)}})}e.withAsyncBody=i})(_o||(_o={}));var po=class Fe{static fromArray(t){return new Fe(i=>{i.emitMany(t)})}static fromPromise(t){return new Fe(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Fe(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new Fe(async i=>{await Promise.all(t.map(async n=>{for await(let h of n)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new de,queueMicrotask(async()=>{let n={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(n)),this.resolve()}catch(h){this.reject(h)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 Ze.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Fe(async n=>{for await(let h of t)n.emitOne(i(h))})}map(t){return Fe.map(this,t)}static filter(t,i){return new Fe(async n=>{for await(let h of t)i(h)&&n.emitOne(h)})}filter(t){return Fe.filter(this,t)}static coalesce(t){return Fe.filter(t,i=>!!i)}coalesce(){return Fe.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return Fe.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())}};po.EMPTY=po.fromArray([]);function zh(e){return 55296<=e&&e<=56319}function go(e){return 56320<=e&&e<=57343}function Uh(e,t){return(e-55296<<10)+(t-56320)+65536}function jh(e){return Dr(e,0)}function Dr(e,t){switch(typeof e){case"object":return e===null?ut(349,t):Array.isArray(e)?Kh(e,t):Gh(e,t);case"string":return ea(e,t);case"boolean":return qh(e,t);case"number":return ut(e,t);case"undefined":return ut(937,t);default:return ut(617,t)}}function ut(e,t){return(t<<5)-t+e|0}function qh(e,t){return ut(e?433:863,t)}function ea(e,t){t=ut(149417,t);for(let i=0,n=e.length;i<n;i++)t=ut(e.charCodeAt(i),t);return t}function Kh(e,t){return t=ut(104579,t),e.reduce((i,n)=>Dr(n,i),t)}function Gh(e,t){return t=ut(181387,t),Object.keys(e).sort().reduce((i,n)=>(i=ea(n,i),Dr(e[n],i)),t)}function ur(e,t,i=32){let n=i-t,h=~((1<<n)-1);return(e<<t|(h&e)>>>n)>>>0}function vo(e,t=0,i=e.byteLength,n=0){for(let h=0;h<i;h++)e[t+h]=n}function Vh(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function pi(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):Vh((e>>>0).toString(16),t/4)}var Yh=class ta{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let n=this._buff,h=this._buffLen,s=this._leftoverHighSurrogate,r,a;for(s!==0?(r=s,a=-1,s=0):(r=t.charCodeAt(0),a=0);;){let f=r;if(zh(r))if(a+1<i){let o=t.charCodeAt(a+1);go(o)?(a++,f=Uh(r,o)):f=65533}else{s=r;break}else go(r)&&(f=65533);if(h=this._push(n,h,f),a++,a<i)r=t.charCodeAt(a);else break}this._buffLen=h,this._leftoverHighSurrogate=s}_push(t,i,n){return n<128?t[i++]=n:n<2048?(t[i++]=192|(n&1984)>>>6,t[i++]=128|(n&63)>>>0):n<65536?(t[i++]=224|(n&61440)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0):(t[i++]=240|(n&1835008)>>>18,t[i++]=128|(n&258048)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),pi(this._h0)+pi(this._h1)+pi(this._h2)+pi(this._h3)+pi(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,vo(this._buff,this._buffLen),this._buffLen>56&&(this._step(),vo(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=ta._bigBlock32,i=this._buffDV;for(let g=0;g<64;g+=4)t.setUint32(g,i.getUint32(g,!1),!1);for(let g=64;g<320;g+=4)t.setUint32(g,ur(t.getUint32(g-12,!1)^t.getUint32(g-32,!1)^t.getUint32(g-56,!1)^t.getUint32(g-64,!1),1),!1);let n=this._h0,h=this._h1,s=this._h2,r=this._h3,a=this._h4,f,o,_;for(let g=0;g<80;g++)g<20?(f=h&s|~h&r,o=1518500249):g<40?(f=h^s^r,o=1859775393):g<60?(f=h&s|h&r|s&r,o=2400959708):(f=h^s^r,o=3395469782),_=ur(n,5)+f+a+o+t.getUint32(g*4,!1)&4294967295,a=r,r=s,s=ur(h,30),h=n,n=_;this._h0=this._h0+n&4294967295,this._h1=this._h1+h&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+a&4294967295}};Yh._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:g_,getWindow:Xh,getDocument:v_,getWindows:m_,getWindowsCount:b_,getWindowId:mo,getWindowById:w_,hasWindow:S_,onDidRegisterWindow:C_,onWillUnregisterWindow:y_,onDidUnregisterWindow:x_}=(function(){let e=new Map,t={window:Ke,disposables:new Vt};e.set(Ke.vscodeWindowId,t);let i=new de,n=new de,h=new de;function s(r,a){return(typeof r=="number"?e.get(r):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:h.event,onDidUnregisterWindow:n.event,registerWindow(r){if(e.has(r.vscodeWindowId))return Oe.None;let a=new Vt,f={window:r,disposables:a.add(new Vt)};return e.set(r.vscodeWindowId,f),a.add(Le(()=>{e.delete(r.vscodeWindowId),n.fire(r)})),a.add(Lr(r,Qh.BEFORE_UNLOAD,()=>{h.fire(r)})),i.fire(f),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return e.has(r)},getWindowById:s,getWindow(r){let a=r;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let f=r;return f?.view?f.view.window:Ke},getDocument(r){return Xh(r).document}}})(),Jh=class{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!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 Lr(e,t,i,n){return new Jh(e,t,i,n)}var Zh,bo,fr=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){is(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,n=new Map,h=s=>{i.set(s,!1);let r=e.get(s)??[];for(t.set(s,r),e.set(s,[]),n.set(s,!0);r.length>0;)r.sort(fr.sort),r.shift().execute();n.set(s,!1)};bo=(s,r,a=0)=>{let f=mo(s),o=new fr(r,a),_=e.get(f);return _||(_=[],e.set(f,_)),_.push(o),i.get(f)||(i.set(f,!0),s.requestAnimationFrame(()=>h(f))),o},Zh=(s,r,a)=>{let f=mo(s);if(n.get(f)){let o=new fr(r,a),_=t.get(f);return _||(_=[],t.set(f,_)),_.push(o),o}else return bo(s,r,a)}})();var wo=class hs{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new hs(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof hs?t:new hs(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};wo.None=new wo(0,0);var k_=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let n=this.mutationObservers.get(e);n||(n=new Map,this.mutationObservers.set(e,n));let h=jh(i),s=n.get(h);if(s)s.users+=1;else{let r=new de,a=new MutationObserver(o=>r.fire(o));a.observe(e,i);let f=s={users:1,observer:a,onDidMutate:r.event};t.add(Le(()=>{f.users-=1,f.users===0&&(r.dispose(),a.disconnect(),n?.delete(h),n?.size===0&&this.mutationObservers.delete(e))})),n.set(h,s)}return s.onDidMutate}},Qh={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:ar?"webkitAnimationStart":"animationstart",ANIMATION_END:ar?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:ar?"webkitAnimationIteration":"animationiteration"},ed=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function ia(e,t,i,...n){let h=ed.exec(t);if(!h)throw new Error("Bad use of emmet");let s=h[1]||"div",r;return e!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(e,s):r=document.createElement(s),h[3]&&(r.id=h[3]),h[4]&&(r.className=h[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,f])=>{typeof f>"u"||(/^on\w+$/.test(a)?r[a]=f:a==="selected"?f&&r.setAttribute(a,"true"):r.setAttribute(a,f))}),r.append(...n),r}function td(e,t,...i){return ia("http://www.w3.org/1999/xhtml",e,t,...i)}td.SVG=function(e,t,...i){return ia("http://www.w3.org/2000/svg",e,t,...i)};var id=class extends Oe{constructor(e,t,i,n,h,s,r,a,f){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=n,this._coreService=h,this._decorationService=s,this._optionsService=r,this._themeService=a,this._cursorBlinkStateManager=new di,this._charAtlasDisposable=this._register(new di),this._observerDisposable=this._register(new di),this._model=new mh,this._workCell=new Zn,this._workCell2=new Zn,this._rectangleRenderer=this._register(new di),this._glyphRenderer=this._register(new di),this._onChangeTextureAtlas=this._register(new de),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new de),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new de),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new de),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new de),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let o={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",o),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Bc(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new xh(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,r,this._themeService)],this.dimensions=Ac(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(r.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Lr(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(Lr(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Xn(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Jn(this._canvas,this._coreBrowserService.window,(_,g)=>this._setCanvasDevicePixelDimensions(_,g)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=Jn(this._canvas,_,(g,S)=>this._setCanvasDevicePixelDimensions(g,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Le(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),Xn(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Ch(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new _h(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=qo(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=Mo(Ze.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ze.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new ah(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,n=this._workCell,h,s,r,a,f,o,_=0,g=!0,S,p,c,d,l,u,v,C,w;e=So(e,i.rows-1,0),t=So(t,i.rows-1,0);let y=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=m-i.buffer.ydisp,T=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,F=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let R=!1;for(s=e;s<=t;s++)for(r=s+i.buffer.ydisp,a=i.buffer.lines.get(r),this._model.lineLengths[s]=0,c=m===r,_=0,f=this._characterJoinerService.getJoinedCharacters(r),C=0;C<i.cols;C++){if(h=this._cellColorResolver.result.bg,a.loadCell(C,n),C===0&&(h=this._cellColorResolver.result.bg),o=!1,g=C>=_,S=C,f.length>0&&C===f[0][0]&&g){p=f.shift();let z=this._model.selection.isCellSelected(this._terminal,p[0],r);for(v=p[0]+1;v<p[1];v++)g&&(g=z===this._model.selection.isCellSelected(this._terminal,v,r));g&&(g=!c||T<p[0]||T>=p[1]),g?(o=!0,n=new sd(n,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),S=p[1]-1):_=p[1]}if(d=n.getChars(),l=n.getCode(),v=(s*i.cols+C)*ds,this._cellColorResolver.resolve(n,C,r,this.dimensions.device.cell.width),F&&r===m&&(C===T&&(this._model.cursor={x:T,y:x,width:n.getWidth(),style:this._coreBrowserService.isFocused?y:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=T+n.getWidth()-1),C>=T&&C<=I&&(this._coreBrowserService.isFocused&&y==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),l!==0&&(this._model.lineLengths[s]=C+1),!(this._model.cells[v]===l&&this._model.cells[v+ns]===this._cellColorResolver.result.bg&&this._model.cells[v+os]===this._cellColorResolver.result.fg&&this._model.cells[v+nr]===this._cellColorResolver.result.ext)&&(R=!0,d.length>1&&(l|=vh),this._model.cells[v]=l,this._model.cells[v+ns]=this._cellColorResolver.result.bg,this._model.cells[v+os]=this._cellColorResolver.result.fg,this._model.cells[v+nr]=this._cellColorResolver.result.ext,u=n.getWidth(),this._glyphRenderer.value.updateCell(C,s,l,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,h),o)){for(n=this._workCell,C++;C<=S;C++)w=(s*i.cols+C)*ds,this._glyphRenderer.value.updateCell(C,s,0,0,0,0,kc,0,0),this._model.cells[w]=0,this._model.cells[w+ns]=this._cellColorResolver.result.bg,this._model.cells[w+os]=this._cellColorResolver.result.fg,this._model.cells[w+nr]=this._cellColorResolver.result.ext;C--}}R&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},sd=class extends Kt{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function So(e,t,i=0){return Math.max(Math.min(e,t),i)}var Co="di$target",yo="di$dependencies",_r=new Map;function et(e){if(_r.has(e))return _r.get(e);let t=function(i,n,h){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");rd(t,i,h)};return t._id=e,_r.set(e,t),t}function rd(e,t,i){t[Co]===t?t[yo].push({id:e,index:i}):(t[yo]=[{id:e,index:i}],t[Co]=t)}var E_=et("BufferService"),L_=et("CoreMouseService"),M_=et("CoreService"),R_=et("CharsetService"),T_=et("InstantiationService"),A_=et("LogService"),nd=et("OptionsService"),D_=et("OscLinkService"),B_=et("UnicodeService"),P_=et("DecorationService"),od={trace:0,debug:1,info:2,warn:3,error:4,off:5},ad="xterm.js: ",xo=class extends Oe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),sa=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=od[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":ad)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};xo=nc([oc(0,nd)],xo);var sa;function ld(e){sa=e}var ra=class extends Oe{constructor(e){if(Ao&&xc()<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 de),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new de),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new de),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new de),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,n=t.optionsService,h=t,s=h._renderService,r=h._characterJoinerService,a=h._charSizeService,f=h._coreBrowserService,o=h._decorationService,_=h._logService,g=h._themeService;ld(_),this._renderer=this._register(new id(e,r,a,f,i,o,n,g,this._preserveDrawingBuffer)),this._register(Ze.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ze.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ze.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ze.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(Le(()=>{if(this._terminal._core._store._isDisposed)return;let S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var na=`/**
|
|
118
|
+
}`,vt=8,Es=vt*Float32Array.BYTES_PER_ELEMENT,id=20*vt,xo=class{constructor(){this.attributes=new Float32Array(id),this.count=0}},pt=0,ko=0,Eo=0,Lo=0,Mo=0,Ro=0,To=0,rd=class extends Fe{constructor(e,t,i,n){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=n,this._vertices=new xo,this._verticesCursor=new xo;let l=this._gl;this._program=we(va(l,ed,td)),this._register(Me(()=>l.deleteProgram(this._program))),this._projectionLocation=we(l.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let r=new Float32Array([0,0,1,0,0,1,1,1]),s=l.createBuffer();this._register(Me(()=>l.deleteBuffer(s))),l.bindBuffer(l.ARRAY_BUFFER,s),l.bufferData(l.ARRAY_BUFFER,r,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=l.createBuffer();this._register(Me(()=>l.deleteBuffer(f))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f),l.bufferData(l.ELEMENT_ARRAY_BUFFER,a,l.STATIC_DRAW),this._attributesBuffer=we(l.createBuffer()),this._register(Me(()=>l.deleteBuffer(this._attributesBuffer))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,Es,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,Es,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,Es,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(n.colors),this._register(this._themeService.onChangeColors(o=>{this._updateCachedColors(o),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,ga),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,n=1,l,r,s,a,f,o,_,g,S,p,h;for(l=0;l<t.rows;l++){for(s=-1,a=0,f=0,o=!1,r=0;r<t.cols;r++)_=(l*t.cols+r)*Er,g=e.cells[_+wr],S=e.cells[_+Sr],p=!!(S&67108864),(g!==a||S!==f&&(o||p))&&((a!==0||o&&f!==0)&&(h=n++*vt,this._updateRectangle(i,h,f,a,s,r,l)),s=r,a=g,f=S,o=p);(a!==0||o&&f!==0)&&(h=n++*vt,this._updateRectangle(i,h,f,a,s,t.cols,l))}i.count=n}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let n,l=0;(i.style==="bar"||i.style==="outline")&&(n=l++*vt,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(n=l++*vt,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(n=l++*vt,this._addRectangleFloat(t.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),n=l++*vt,this._addRectangleFloat(t.attributes,n,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=l}_updateRectangle(e,t,i,n,l,r,s){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:pt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:pt=(i&16777215)<<8;break;default:pt=this._themeService.colors.foreground.rgba}else switch(n&50331648){case 16777216:case 33554432:pt=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:pt=(n&16777215)<<8;break;default:pt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=jh(e.attributes,this._terminal.rows*this._terminal.cols*vt)),ko=l*this._dimensions.device.cell.width,Eo=s*this._dimensions.device.cell.height,Lo=(pt>>24&255)/255,Mo=(pt>>16&255)/255,Ro=(pt>>8&255)/255,To=1,this._addRectangle(e.attributes,t,ko,Eo,(r-l)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Lo,Mo,Ro,To)}_addRectangle(e,t,i,n,l,r,s,a,f,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=n/this._dimensions.device.canvas.height,e[t+2]=l/this._dimensions.device.canvas.width,e[t+3]=r/this._dimensions.device.canvas.height,e[t+4]=s,e[t+5]=a,e[t+6]=f,e[t+7]=o}_addRectangleFloat(e,t,i,n,l,r,s){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=n/this._dimensions.device.canvas.height,e[t+2]=l/this._dimensions.device.canvas.width,e[t+3]=r/this._dimensions.device.canvas.height,e[t+4]=s[0],e[t+5]=s[1],e[t+6]=s[2],e[t+7]=s[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},sd=class extends Fe{constructor(e,t,i,n,l,r,s,a){super(),this._container=t,this._alpha=l,this._coreBrowserService=r,this._optionsService=s,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(e,f),this.reset(e)})),this._register(Me(()=>{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,i){}handleSelectionChanged(e,t,i,n=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=_a(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,n){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,n){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ia,this._clipCell(i,n,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let n=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${n} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},nd=class extends sd{constructor(e,t,i,n,l,r,s){super(i,e,"link",t,!0,l,r,s),this._register(n.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(n.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&&$h(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()}},Ye=typeof window=="object"?window:globalThis,js=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};js.INSTANCE=new js;var ma=js;function od(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var j_=ma.INSTANCE.onDidChangeZoomLevel,q_=ma.INSTANCE.onDidChangeFullscreen,ai=typeof navigator=="object"?navigator.userAgent:"",K_=ai.indexOf("Firefox")>=0,Ls=ai.indexOf("AppleWebKit")>=0,ad=ai.indexOf("Chrome")>=0,ld=!ad&&ai.indexOf("Safari")>=0,G_=ai.indexOf("Electron/")>=0,V_=ai.indexOf("Android")>=0,Cr=!1;if(typeof Ye.matchMedia=="function"){let e=Ye.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ye.matchMedia("(display-mode: fullscreen)");Cr=e.matches,od(Ye,e,({matches:i})=>{Cr&&t.matches||(Cr=i)})}function cd(){return Cr}var si="en",qs=!1,Ks=!1,yr=!1,hd=!1,ba=!1,wa=!1,dd=!1,ud=!1,fd=!1,_d=!1,gr,xr=si,Ao=si,pd,gt,bt=globalThis,He;typeof bt.vscode<"u"&&typeof bt.vscode.process<"u"?He=bt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(He=process);var Sa=typeof He?.versions?.electron=="string",gd=Sa&&He?.type==="renderer";if(typeof He=="object"){qs=He.platform==="win32",Ks=He.platform==="darwin",yr=He.platform==="linux",hd=yr&&!!He.env.SNAP&&!!He.env.SNAP_REVISION,dd=Sa,fd=!!He.env.CI||!!He.env.BUILD_ARTIFACTSTAGINGDIRECTORY,gr=si,xr=si;let e=He.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);gr=t.userLocale,Ao=t.osLocale,xr=t.resolvedLanguage||si,pd=t.languagePack?.translationsConfigFile}catch{}ba=!0}else typeof navigator=="object"&&!gd?(gt=navigator.userAgent,qs=gt.indexOf("Windows")>=0,Ks=gt.indexOf("Macintosh")>=0,ud=(gt.indexOf("Macintosh")>=0||gt.indexOf("iPad")>=0||gt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,yr=gt.indexOf("Linux")>=0,_d=gt?.indexOf("Mobi")>=0,wa=!0,xr=globalThis._VSCODE_NLS_LANGUAGE||si,gr=navigator.language.toLowerCase(),Ao=gr):console.error("Unable to resolve platform.");var Ms=0;Ks?Ms=1:qs?Ms=3:yr&&(Ms=2);var Rs=ba,vd=wa&&typeof bt.importScripts=="function",Y_=vd?bt.origin:void 0,st=gt,xt=xr,Do;(e=>{function t(){return xt}e.value=t;function i(){return xt.length===2?xt==="en":xt.length>=3?xt[0]==="e"&&xt[1]==="n"&&xt[2]==="-":!1}e.isDefaultVariant=i;function n(){return xt==="en"}e.isDefault=n})(Do||(Do={}));var md=typeof bt.postMessage=="function"&&!bt.importScripts,bd=(()=>{if(md){let e=[];bt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,l=e.length;n<l;n++){let r=e[n];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),bt.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),wd=!!(st&&st.indexOf("Chrome")>=0),X_=!!(st&&st.indexOf("Firefox")>=0),J_=!!(!wd&&st&&st.indexOf("Safari")>=0),Z_=!!(st&&st.indexOf("Edg/")>=0),Q_=!!(st&&st.indexOf("Android")>=0),kt=typeof navigator=="object"?navigator:{},ep={clipboard:{writeText:Rs||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(kt&&kt.clipboard&&kt.clipboard.writeText),readText:Rs||!!(kt&&kt.clipboard&&kt.clipboard.readText)},keyboard:Rs||cd()?0:kt.keyboard||ld?1:2,touch:"ontouchstart"in Ye||kt.maxTouchPoints>0,pointerEvents:Ye.PointerEvent&&("ontouchstart"in Ye||navigator.maxTouchPoints>0)},Js=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ts=new Js,Bo=new Js,Po=new Js,tp=new Array(230),Oo;(e=>{function t(a){return Ts.keyCodeToStr(a)}e.toString=t;function i(a){return Ts.strToKeyCode(a)}e.fromString=i;function n(a){return Bo.keyCodeToStr(a)}e.toUserSettingsUS=n;function l(a){return Po.keyCodeToStr(a)}e.toUserSettingsGeneral=l;function r(a){return Bo.strToKeyCode(a)||Po.strToKeyCode(a)}e.fromUserSettings=r;function s(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ts.keyCodeToStr(a)}e.toElectronAccelerator=s})(Oo||(Oo={}));var Ca=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Io;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Sd?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:rt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ca})})(Io||(Io={}));var Sd=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?Ca:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Cd,As;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?As=(e,t)=>{bd(()=>{if(i)return;let n=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:As=(e,t,i)=>{let n=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),l=!1;return{dispose(){l||(l=!0,e.cancelIdleCallback(n))}}},Cd=e=>As(globalThis,e)})();var No;(e=>{async function t(n){let l,r=await Promise.all(n.map(s=>s.then(a=>a,a=>{l||(l=a)})));if(typeof l<"u")throw l;return r}e.settled=t;function i(n){return new Promise(async(l,r)=>{try{await n(l,r)}catch(s){r(s)}})}e.withAsyncBody=i})(No||(No={}));var Ho=class ze{static fromArray(t){return new ze(i=>{i.emitMany(t)})}static fromPromise(t){return new ze(async i=>{i.emitMany(await t)})}static fromPromises(t){return new ze(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new ze(async i=>{await Promise.all(t.map(async n=>{for await(let l of n)i.emitOne(l)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ue,queueMicrotask(async()=>{let n={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(n)),this.resolve()}catch(l){this.reject(l)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 rt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new ze(async n=>{for await(let l of t)n.emitOne(i(l))})}map(t){return ze.map(this,t)}static filter(t,i){return new ze(async n=>{for await(let l of t)i(l)&&n.emitOne(l)})}filter(t){return ze.filter(this,t)}static coalesce(t){return ze.filter(t,i=>!!i)}coalesce(){return ze.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return ze.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())}};Ho.EMPTY=Ho.fromArray([]);function yd(e){return 55296<=e&&e<=56319}function Fo(e){return 56320<=e&&e<=57343}function xd(e,t){return(e-55296<<10)+(t-56320)+65536}function kd(e){return Zs(e,0)}function Zs(e,t){switch(typeof e){case"object":return e===null?mt(349,t):Array.isArray(e)?Ld(e,t):Md(e,t);case"string":return ya(e,t);case"boolean":return Ed(e,t);case"number":return mt(e,t);case"undefined":return mt(937,t);default:return mt(617,t)}}function mt(e,t){return(t<<5)-t+e|0}function Ed(e,t){return mt(e?433:863,t)}function ya(e,t){t=mt(149417,t);for(let i=0,n=e.length;i<n;i++)t=mt(e.charCodeAt(i),t);return t}function Ld(e,t){return t=mt(104579,t),e.reduce((i,n)=>Zs(n,i),t)}function Md(e,t){return t=mt(181387,t),Object.keys(e).sort().reduce((i,n)=>(i=ya(n,i),Zs(e[n],i)),t)}function Ds(e,t,i=32){let n=i-t,l=~((1<<n)-1);return(e<<t|(l&e)>>>n)>>>0}function Wo(e,t=0,i=e.byteLength,n=0){for(let l=0;l<i;l++)e[t+l]=n}function Rd(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function Ri(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):Rd((e>>>0).toString(16),t/4)}var Td=class xa{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let n=this._buff,l=this._buffLen,r=this._leftoverHighSurrogate,s,a;for(r!==0?(s=r,a=-1,r=0):(s=t.charCodeAt(0),a=0);;){let f=s;if(yd(s))if(a+1<i){let o=t.charCodeAt(a+1);Fo(o)?(a++,f=xd(s,o)):f=65533}else{r=s;break}else Fo(s)&&(f=65533);if(l=this._push(n,l,f),a++,a<i)s=t.charCodeAt(a);else break}this._buffLen=l,this._leftoverHighSurrogate=r}_push(t,i,n){return n<128?t[i++]=n:n<2048?(t[i++]=192|(n&1984)>>>6,t[i++]=128|(n&63)>>>0):n<65536?(t[i++]=224|(n&61440)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0):(t[i++]=240|(n&1835008)>>>18,t[i++]=128|(n&258048)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Ri(this._h0)+Ri(this._h1)+Ri(this._h2)+Ri(this._h3)+Ri(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Wo(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Wo(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=xa._bigBlock32,i=this._buffDV;for(let g=0;g<64;g+=4)t.setUint32(g,i.getUint32(g,!1),!1);for(let g=64;g<320;g+=4)t.setUint32(g,Ds(t.getUint32(g-12,!1)^t.getUint32(g-32,!1)^t.getUint32(g-56,!1)^t.getUint32(g-64,!1),1),!1);let n=this._h0,l=this._h1,r=this._h2,s=this._h3,a=this._h4,f,o,_;for(let g=0;g<80;g++)g<20?(f=l&r|~l&s,o=1518500249):g<40?(f=l^r^s,o=1859775393):g<60?(f=l&r|l&s|r&s,o=2400959708):(f=l^r^s,o=3395469782),_=Ds(n,5)+f+a+o+t.getUint32(g*4,!1)&4294967295,a=s,s=r,r=Ds(l,30),l=n,n=_;this._h0=this._h0+n&4294967295,this._h1=this._h1+l&4294967295,this._h2=this._h2+r&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};Td._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:ip,getWindow:Ad,getDocument:rp,getWindows:sp,getWindowsCount:np,getWindowId:$o,getWindowById:op,hasWindow:ap,onDidRegisterWindow:lp,onWillUnregisterWindow:cp,onDidUnregisterWindow:hp}=(function(){let e=new Map,t={window:Ye,disposables:new ni};e.set(Ye.vscodeWindowId,t);let i=new ue,n=new ue,l=new ue;function r(s,a){return(typeof s=="number"?e.get(s):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:n.event,registerWindow(s){if(e.has(s.vscodeWindowId))return Fe.None;let a=new ni,f={window:s,disposables:a.add(new ni)};return e.set(s.vscodeWindowId,f),a.add(Me(()=>{e.delete(s.vscodeWindowId),n.fire(s)})),a.add(Gs(s,Pd.BEFORE_UNLOAD,()=>{l.fire(s)})),i.fire(f),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(s){return s.vscodeWindowId},hasWindow(s){return e.has(s)},getWindowById:r,getWindow(s){let a=s;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let f=s;return f?.view?f.view.window:Ye},getDocument(s){return Ad(s).document}}})(),Dd=class{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!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 Gs(e,t,i,n){return new Dd(e,t,i,n)}var Bd,zo,Bs=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){vr(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,n=new Map,l=r=>{i.set(r,!1);let s=e.get(r)??[];for(t.set(r,s),e.set(r,[]),n.set(r,!0);s.length>0;)s.sort(Bs.sort),s.shift().execute();n.set(r,!1)};zo=(r,s,a=0)=>{let f=$o(r),o=new Bs(s,a),_=e.get(f);return _||(_=[],e.set(f,_)),_.push(o),i.get(f)||(i.set(f,!0),r.requestAnimationFrame(()=>l(f))),o},Bd=(r,s,a)=>{let f=$o(r);if(n.get(f)){let o=new Bs(s,a),_=t.get(f);return _||(_=[],t.set(f,_)),_.push(o),o}else return zo(r,s,a)}})();var Uo=class kr{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new kr(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof kr?t:new kr(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};Uo.None=new Uo(0,0);var dp=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let n=this.mutationObservers.get(e);n||(n=new Map,this.mutationObservers.set(e,n));let l=kd(i),r=n.get(l);if(r)r.users+=1;else{let s=new ue,a=new MutationObserver(o=>s.fire(o));a.observe(e,i);let f=r={users:1,observer:a,onDidMutate:s.event};t.add(Me(()=>{f.users-=1,f.users===0&&(s.dispose(),a.disconnect(),n?.delete(l),n?.size===0&&this.mutationObservers.delete(e))})),n.set(l,r)}return r.onDidMutate}},Pd={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:Ls?"webkitAnimationStart":"animationstart",ANIMATION_END:Ls?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Ls?"webkitAnimationIteration":"animationiteration"},Od=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function ka(e,t,i,...n){let l=Od.exec(t);if(!l)throw new Error("Bad use of emmet");let r=l[1]||"div",s;return e!=="http://www.w3.org/1999/xhtml"?s=document.createElementNS(e,r):s=document.createElement(r),l[3]&&(s.id=l[3]),l[4]&&(s.className=l[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,f])=>{typeof f>"u"||(/^on\w+$/.test(a)?s[a]=f:a==="selected"?f&&s.setAttribute(a,"true"):s.setAttribute(a,f))}),s.append(...n),s}function Id(e,t,...i){return ka("http://www.w3.org/1999/xhtml",e,t,...i)}Id.SVG=function(e,t,...i){return ka("http://www.w3.org/2000/svg",e,t,...i)};var Nd=class extends Fe{constructor(e,t,i,n,l,r,s,a,f){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=n,this._coreService=l,this._decorationService=r,this._optionsService=s,this._themeService=a,this._cursorBlinkStateManager=new ki,this._charAtlasDisposable=this._register(new ki),this._observerDisposable=this._register(new ki),this._model=new Qh,this._workCell=new Co,this._workCell2=new Co,this._rectangleRenderer=this._register(new ki),this._glyphRenderer=this._register(new ki),this._onChangeTextureAtlas=this._register(new ue),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ue),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ue),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ue),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ue),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let o={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",o),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new _h(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new nd(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,s,this._themeService)],this.dimensions=uh(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(s.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Gs(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(Gs(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,wo(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=So(this._canvas,this._coreBrowserService.window,(_,g)=>this._setCanvasDevicePixelDimensions(_,g)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=So(this._canvas,_,(g,S)=>this._setCanvasDevicePixelDimensions(g,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Me(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),wo(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new rd(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Yh(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=_a(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=Jo(rt.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),rt.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new zh(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,n=this._workCell,l,r,s,a,f,o,_=0,g=!0,S,p,h,d,c,u,v,C,w;e=jo(e,i.rows-1,0),t=jo(t,i.rows-1,0);let y=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=m-i.buffer.ydisp,A=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,F=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let R=!1;for(r=e;r<=t;r++)for(s=r+i.buffer.ydisp,a=i.buffer.lines.get(s),this._model.lineLengths[r]=0,h=m===s,_=0,f=this._characterJoinerService.getJoinedCharacters(s),C=0;C<i.cols;C++){if(l=this._cellColorResolver.result.bg,a.loadCell(C,n),C===0&&(l=this._cellColorResolver.result.bg),o=!1,g=C>=_,S=C,f.length>0&&C===f[0][0]&&g){p=f.shift();let $=this._model.selection.isCellSelected(this._terminal,p[0],s);for(v=p[0]+1;v<p[1];v++)g&&(g=$===this._model.selection.isCellSelected(this._terminal,v,s));g&&(g=!h||A<p[0]||A>=p[1]),g?(o=!0,n=new Hd(n,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),S=p[1]-1):_=p[1]}if(d=n.getChars(),c=n.getCode(),v=(r*i.cols+C)*Er,this._cellColorResolver.resolve(n,C,s,this.dimensions.device.cell.width),F&&s===m&&(C===A&&(this._model.cursor={x:A,y:x,width:n.getWidth(),style:this._coreBrowserService.isFocused?y:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=A+n.getWidth()-1),C>=A&&C<=I&&(this._coreBrowserService.isFocused&&y==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),c!==0&&(this._model.lineLengths[r]=C+1),!(this._model.cells[v]===c&&this._model.cells[v+wr]===this._cellColorResolver.result.bg&&this._model.cells[v+Sr]===this._cellColorResolver.result.fg&&this._model.cells[v+ks]===this._cellColorResolver.result.ext)&&(R=!0,d.length>1&&(c|=Zh),this._model.cells[v]=c,this._model.cells[v+wr]=this._cellColorResolver.result.bg,this._model.cells[v+Sr]=this._cellColorResolver.result.fg,this._model.cells[v+ks]=this._cellColorResolver.result.ext,u=n.getWidth(),this._glyphRenderer.value.updateCell(C,r,c,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,l),o)){for(n=this._workCell,C++;C<=S;C++)w=(r*i.cols+C)*Er,this._glyphRenderer.value.updateCell(C,r,0,0,0,0,oh,0,0),this._model.cells[w]=0,this._model.cells[w+wr]=this._cellColorResolver.result.bg,this._model.cells[w+Sr]=this._cellColorResolver.result.fg,this._model.cells[w+ks]=this._cellColorResolver.result.ext;C--}}R&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Hd=class extends ri{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function jo(e,t,i=0){return Math.max(Math.min(e,t),i)}var qo="di$target",Ko="di$dependencies",Ps=new Map;function nt(e){if(Ps.has(e))return Ps.get(e);let t=function(i,n,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Fd(t,i,l)};return t._id=e,Ps.set(e,t),t}function Fd(e,t,i){t[qo]===t?t[Ko].push({id:e,index:i}):(t[Ko]=[{id:e,index:i}],t[qo]=t)}var up=nt("BufferService"),fp=nt("CoreMouseService"),_p=nt("CoreService"),pp=nt("CharsetService"),gp=nt("InstantiationService"),vp=nt("LogService"),Wd=nt("OptionsService"),mp=nt("OscLinkService"),bp=nt("UnicodeService"),wp=nt("DecorationService"),$d={trace:0,debug:1,info:2,warn:3,error:4,off:5},zd="xterm.js: ",Go=class extends Fe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Ea=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=$d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":zd)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Go=Wc([$c(0,Wd)],Go);var Ea;function Ud(e){Ea=e}var La=class extends Fe{constructor(e){if(ea&&nh()<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 ue),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ue),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ue),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ue),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,n=t.optionsService,l=t,r=l._renderService,s=l._characterJoinerService,a=l._charSizeService,f=l._coreBrowserService,o=l._decorationService,_=l._logService,g=l._themeService;Ud(_),this._renderer=this._register(new Nd(e,s,a,f,i,o,n,g,this._preserveDrawingBuffer)),this._register(rt.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(rt.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(rt.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(rt.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this._register(Me(()=>{if(this._terminal._core._store._isDisposed)return;let S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Ma=`/**
|
|
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
|
|
336
|
+
`;var Ra=`/* eslint-disable */
|
|
337
337
|
/**
|
|
338
338
|
* @hyzyn/dsh-tty \u2014 \u9762\u677F\u6837\u5F0F\u8868\u3002
|
|
339
339
|
*
|
|
@@ -1770,7 +1770,73 @@ void main() {
|
|
|
1770
1770
|
display: flex;
|
|
1771
1771
|
flex-direction: column;
|
|
1772
1772
|
gap: 5px;
|
|
1773
|
+
/* env \u53D8\u91CF\u9009\u62E9\u5668\u7684\u6D6E\u5C42\u57FA\u51C6\uFF08\u89C1\u4E0B\u9762 .tt_sshRow > .tt_envList\uFF09 */
|
|
1774
|
+
position: relative;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
/*
|
|
1778
|
+
* \u5BF9\u8BDD\u6846\u91CC\u7684 env \u53D8\u91CF\u9009\u62E9\u5668\u505A\u6210**\u6D6E\u5C42**\uFF1A\u5C55\u5F00\u65F6\u4E0D\u518D\u628A\u300C\u9009\u9879 / \u8FDE\u63A5\u7C3F\u540D\u79F0 / \u5E95\u90E8\u6309\u94AE\u300D\u63A8\u4E0B\u53BB\u3002
|
|
1779
|
+
* \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
|
|
1780
|
+
* flex \u5B50\u9879\uFF0C\u957F\u4E00\u622A\u5C31\u6491\u957F\u6574\u5F20\u5361\u7247\u3002
|
|
1781
|
+
*
|
|
1782
|
+
* \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
|
|
1783
|
+
* \u5019\u9009\uFF0C\u90A3\u91CC\u63A8\u52A8\u5185\u5BB9\u662F\u6B63\u5E38\u7684\uFF0C\u522B\u4E00\u8D77\u6539\u3002
|
|
1784
|
+
*
|
|
1785
|
+
* \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
|
|
1786
|
+
* \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\`
|
|
1787
|
+
* + \`getBoundingClientRect()\` \u5B9A\u4F4D\u2014\u2014\u90A3\u53CD\u800C\u5929\u7136\u9003\u51FA\u5361\u7247\u7684 overflow\uFF08backdrop \u6709
|
|
1788
|
+
* \`backdrop-filter\`\uFF0Cfixed \u4F1A\u4EE5\u5B83\u4E3A\u5305\u542B\u5757\uFF09\u3002
|
|
1789
|
+
*/
|
|
1790
|
+
.tt_sshRow > .tt_envList {
|
|
1791
|
+
position: absolute;
|
|
1792
|
+
top: 100%;
|
|
1793
|
+
left: 0;
|
|
1794
|
+
right: 0;
|
|
1795
|
+
z-index: 3;
|
|
1796
|
+
margin-top: 4px;
|
|
1797
|
+
max-height: 180px;
|
|
1798
|
+
background: var(--tt-surface-2);
|
|
1799
|
+
box-shadow: var(--tt-shadow);
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
/* ---- \u8FDE\u63A5\u5BF9\u8BDD\u6846\u91CC\u7684\u300C\u51ED\u636E\u5B58\u50A8\u300D\u884C\uFF08\u660E\u6587\u6001\u4E00\u884C / \u5F15\u7528\u6001\u4E00\u884C\uFF09 ---- */
|
|
1803
|
+
.tt_credRow {
|
|
1804
|
+
gap: 4px;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/* \u7528 hidden \u5C5E\u6027\u63A7\u663E\u9690\u65F6\uFF0C\u522B\u88AB display \u89C4\u5219\u76D6\u6389 */
|
|
1808
|
+
.tt_credRow > [hidden],
|
|
1809
|
+
.tt_envRow > [hidden] {
|
|
1810
|
+
display: none;
|
|
1773
1811
|
}
|
|
1812
|
+
|
|
1813
|
+
.tt_credToggle {
|
|
1814
|
+
display: inline-flex;
|
|
1815
|
+
align-items: center;
|
|
1816
|
+
gap: 6px;
|
|
1817
|
+
color: var(--tt-label-2);
|
|
1818
|
+
font-size: 12px;
|
|
1819
|
+
cursor: pointer;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
.tt_credToggle > input {
|
|
1823
|
+
margin: 0;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
.tt_credStatus {
|
|
1827
|
+
font-size: 11px;
|
|
1828
|
+
line-height: 1.5;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
.tt_credStatus[data-kind="ok"] { color: var(--tt-success); }
|
|
1832
|
+
.tt_credStatus[data-kind="plain"] { color: var(--tt-label-3); }
|
|
1833
|
+
.tt_credStatus[data-kind="muted"] { color: var(--tt-label-3); }
|
|
1834
|
+
.tt_credStatus[data-kind="error"] { color: var(--tt-danger); }
|
|
1835
|
+
|
|
1836
|
+
.tt_credClear {
|
|
1837
|
+
align-self: flex-start;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1774
1840
|
.tt_sshSection {
|
|
1775
1841
|
margin: 4px 0 -2px;
|
|
1776
1842
|
color: var(--tt-label-3);
|
|
@@ -1883,6 +1949,11 @@ void main() {
|
|
|
1883
1949
|
max-height: 208px;
|
|
1884
1950
|
overflow-y: auto;
|
|
1885
1951
|
}
|
|
1952
|
+
/* \u5C55\u5F00\u7F16\u8F91\u8868\u5355\u65F6\u653E\u5F00\u9AD8\u5EA6\uFF1A\u8868\u5355\u6BD4\u5217\u8868\u9AD8\u5F97\u591A\uFF0C\u56F0\u5728 208px \u6EDA\u52A8\u5BB9\u5668\u91CC\u4F1A\u88AB\u88C1\u6389\u5E95\u90E8\u6309\u94AE */
|
|
1953
|
+
.tt_hostList[data-editing] {
|
|
1954
|
+
max-height: none;
|
|
1955
|
+
overflow: visible;
|
|
1956
|
+
}
|
|
1886
1957
|
.tt_limitGrid {
|
|
1887
1958
|
display: grid;
|
|
1888
1959
|
grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
|
|
@@ -1965,6 +2036,16 @@ void main() {
|
|
|
1965
2036
|
.tt_shellList {
|
|
1966
2037
|
margin-top: 6px;
|
|
1967
2038
|
}
|
|
2039
|
+
/*
|
|
2040
|
+
* \u8BBE\u7F6E\u5361\u7247\uFF08React \u4FA7\uFF09\u7F16\u8F91\u8868\u5355\u91CC\u7684\u5F15\u7528\u9009\u62E9\u5668\uFF1A**\u5185\u8054**\u5019\u9009\u5217\u8868\uFF0C\u4E0D\u505A\u6D6E\u5C42\u3002
|
|
2041
|
+
* \u5BF9\u8BDD\u6846\u90A3\u8FB9\u9760 \`.tt_sshRow > .tt_envList\` \u505A\u6D6E\u5C42\uFF08\u89C1\u4E0A\uFF09\uFF1B\u8FD9\u91CC\u523B\u610F\u4E0D\u590D\u7528 \`.tt_sshRow\`
|
|
2042
|
+
* \u5305\u4E00\u5C42\uFF0C\u514D\u5F97\u5217\u8868\u88AB\u5361\u7247/\u5217\u8868\u7684 overflow \u88C1\u6389\u3002
|
|
2043
|
+
*/
|
|
2044
|
+
.tt_credPicker {
|
|
2045
|
+
display: flex;
|
|
2046
|
+
flex-direction: column;
|
|
2047
|
+
gap: 5px;
|
|
2048
|
+
}
|
|
1968
2049
|
|
|
1969
2050
|
/* ======================= SFTP ======================= */
|
|
1970
2051
|
|
|
@@ -2458,8 +2539,8 @@ void main() {
|
|
|
2458
2539
|
transition: none !important;
|
|
2459
2540
|
}
|
|
2460
2541
|
}
|
|
2461
|
-
`;var
|
|
2462
|
-
`+na,document.head.appendChild(_s))}var Bs='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',fd='<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>',_d='<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>',pd='<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>',gd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3" width="9" height="11" rx="1.4"/><rect x="5.5" y="1.5" width="5" height="3" rx="1" fill="var(--dsw-alias-bg-base,#fff)"/></svg>',vd='<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>',md='<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>',bd='<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>',wd='<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>',Ps='<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>',Sd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.6v8.8"/><path d="M3.6 8h8.8"/></svg>',Mi='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/></svg>',ma='<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>',ba='<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>',Ur='<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>',wa='<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>',Cd='<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>',jr='<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>',ei='<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>',qr='<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>',Sa='<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>',Ca='<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>',ya='<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>',yd='<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>',xd='<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>',kd='<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>',Ed='<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>',xa='<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>',Ld='<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>',ka='<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>',Ea=null,he=null,se=null,Ss=null,ri=null,Ot=null,Ct=null,wi=null,Si=null,Cs=null,$e=null,Ci=null,ze=null,xt=null,De=null,ti=null,Ri=!1,yi=null,Ie=!1,Te=null,ys=null,ni=null,It=null,xs=null,Tt=null,xi=1e3,ks="dsh-tty:tabs",re=new Map,Ii=new Set,Kr=()=>Ii.size>0,Pr=new Set,_t=null,Os=0,ps=!1,Ue=null,ii=null,Et=[],Es=!0,it=null,Ge=null,ki=null,Md=3e3,Or=new Set;function Is(e){return Or.add(e),()=>Or.delete(e)}Is(({tab:e,addAction:t})=>{Pt&&e.exited&&t(vd,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>Gr(e.sid))});Is(({tab:e,addAction:t})=>{Pt&&t(md,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>en(e.spawnSpec))});Is(({bookName:e,addAction:t})=>{if(!Pt)return;let i=e!==""?Fa(e):0;i>0&&t(bd,"\u96A7\u9053 "+i,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",n=>iu(n.currentTarget,e))});function Mt(e,t){if(ri===null)return;ri.textContent=e,Ot.dataset.state=t,Ss!==null&&(Ss.style.display=t==="connected"?"none":""),ni!==null&&(ni.textContent=e),It!==null&&(It.dataset.state=t);let i=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");i!==null&&(i.dataset.state=t)}function ge(e){he!==null&&he.readyState===WebSocket.OPEN&&he.send(JSON.stringify(e))}function Rd(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function aa(e){return!Number.isFinite(e)||e<0?"\u65E0":e<1024?Math.round(e)+" B/s":ws(e)||"\u65E0"}function Td(e){if(!Number.isFinite(e)||e<0)return"\u65E0";let t=Math.floor(e),i=Math.floor(t/604800),n=Math.floor(t%604800/86400),h=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),r=[];return i>0&&r.push(i+"w"),(i>0||n>0)&&r.push(n+"d"),(i>0||n>0||h>0)&&r.push(h+"h"),(i>0||n>0||h>0||s>0)&&r.push(s+"m"),r.length>0?r.join(""):t+"s"}function tt(e,t,i){let n=Number.isFinite(i)?'<span class="tt_statsMeter" data-level="'+Rd(i)+'"><span class="tt_statsMeterFill" style="width:'+Math.max(0,Math.min(100,i)).toFixed(1)+'%"></span></span>':"";return'<span class="tt_statsItem"><span class="tt_statsLabel">'+e+"</span>"+n+'<span class="tt_statsValue">'+t+"</span></span>"}function la(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?"\u65E0":(qe(e)||"0 B")+"/"+(qe(t)||"0 B")}function La(e,t){let i=e[t];return Number.isFinite(i)?t==="tempC"?i>-100&&i<200?i:null:t==="cores"?i>=1&&i<=4096?i:null:t==="cpuPct"||t==="memPct"||t==="diskPct"?i>=0&&i<=100?i:null:t==="uptimeSec"?i>=0&&i<=100*365*24*3600?i:null:t==="tcpConns"?i>=0&&i<=1e7?i:null:t==="rxRate"||t==="txRate"?i>=0&&i<=2**40?i:null:i>=0&&i<=2**50?i:null:null}var Ad=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function Dd(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:Ad.some(t=>La(e,t)!==null)}function Bd(e){let t=e!==void 0&&e.stats!==null&&typeof e.stats=="object"?e.stats:{},i=f=>La(t,f),n=f=>{let o=i(f);return o===null?"\u65E0":Math.round(o)+"%"},h=[tt("CPU",n("cpuPct"),i("cpuPct")),tt("\u5185\u5B58",n("memPct"),i("memPct")),tt("\u78C1\u76D8",n("diskPct"),i("diskPct")),tt("\u6838\u5FC3",i("cores")===null?"\u65E0":String(i("cores")),null),tt("\u5185\u5B58",la(i("memUsed"),i("memTotal")),null),tt("\u5728\u7EBF",Td(i("uptimeSec")),null),tt("TCP",i("tcpConns")===null?"\u65E0":String(i("tcpConns")),null),tt("\u78C1\u76D8",la(i("diskUsed"),i("diskTotal")),null),tt("CPU\u6E29\u5EA6",i("tempC")===null?"\u65E0":i("tempC").toFixed(1)+"\xB0C",null)],s=i("rxRate"),r=i("txRate"),a=s===null&&r===null?"\u65E0":"\u2193"+aa(s)+" \u2191"+aa(r);return h.push(tt("\u7F51\u7EDC",a,null)),h.join("")}function Pd(){if(se===null||Ie||!Es)return!1;let e=je();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:Date.now()-(e.statsAt||0)<=Md}function ca(){let e=je();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&ai(e)}catch{}}}function Nt(){try{Od()}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{it!==null&&(it.hidden=!0,it.textContent=""),ze!==null&&delete ze.dataset.stats}catch{}}}function Od(){if(ze===null||it===null)return;let e=Pd(),t=ze.dataset.stats!==void 0!==e;if(!e){t&&delete ze.dataset.stats,it.hidden=!0,it.textContent="",t&&ca();return}it.hidden=!1,it.innerHTML=Bd(je()),t&&(ze.dataset.stats="",ca())}function Id(){ki===null&&(ki=setInterval(()=>Nt(),1e3))}function Nd(){ki!==null&&(clearInterval(ki),ki=null)}function Ma(){if(se===null||Ie||!Es)return null;let e=je();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function Ni(){let e=Ma();e!==Ge&&(Ge!==null&&ge({t:"statsOff",sid:Ge}),Ge=e,e!==null&&ge({t:"statsOn",sid:e}))}function Hd(e){if(e!==Ma()){Ni();return}Ge!==null&&Ge!==e&&ge({t:"statsOff",sid:Ge}),Ge=e,ge({t:"statsOn",sid:e})}function je(){return _t!==null?re.get(_t):void 0}function ha(){try{let e=Ea?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function Fd(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),ge({t:"refresh",sid:e.sid})}}var gs=null;function Ra(e){gs!==null&&clearTimeout(gs),gs=setTimeout(()=>{gs=null;let t=je();t!==void 0&&Fd(t)},e??200)}function Ht(){try{let e=[...re.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||se===null?sessionStorage.removeItem(ks):sessionStorage.setItem(ks,JSON.stringify(e)),Wd([...re.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var Ir="dsh-tty:persist-specs";function Wd(e){try{let t=e.filter(i=>Fi(i.spawnSpec)).map(i=>({spawnSpec:i.spawnSpec,label:i.label}));t.length===0?localStorage.removeItem(Ir):localStorage.setItem(Ir,JSON.stringify(t))}catch{}}function $d(){try{let e=localStorage.getItem(Ir);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&Fi(i.spawnSpec)):[]}catch{return[]}}function zd(){try{let e=sessionStorage.getItem(ks);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&typeof i.sid=="string"&&i.sid!==""&&i.spawnSpec!==null&&typeof i.spawnSpec=="object"):[]}catch{return[]}}function Ls(e,t){return new Promise(i=>{let n=s=>{let r;try{r=JSON.parse(s.data)}catch{return}r.t===e&&(clearTimeout(h),he.removeEventListener("message",n),i(r))},h=setTimeout(()=>{he.removeEventListener("message",n),i(null)},t);he.addEventListener("message",n)})}function ai(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&ge({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function Ud(e){if(e===void 0||e.fit===void 0)return;let t=e.term,i=t!==null&&t.buffer!==void 0?t.buffer.active:null,n=i==null?null:{atBottom:i.viewportY>=i.baseY,line:i.viewportY};try{e.fit.fit()}catch{return}if(n!==null)try{n.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(n.line,t.buffer.active.baseY))}catch{}e.exited||ai(e)}function Jt(e,t,i,n){if(e.overlayEl===null||e.overlayEl===void 0)return;let h=e.overlayEl;if(t===""||t===void 0){h.textContent="";return}let s=n==="error"||n==="info"?n:"exited";h.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?xa:s==="info"?qr:Ld)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(i===void 0||i===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",h.querySelector(".tt_overlayMain").textContent=t,i!==void 0&&i!==""&&(h.querySelector(".tt_overlayHint").textContent=i)}function jd(e,t){try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i!==""?i:t}catch{return t}}function Hi(e){let t=jd("--dsw-alias-state-business-primary","#7c9cff"),i=new ga.Terminal({cursorBlink:!0,cursorStyle:"bar",cursorInactiveStyle:"outline",fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontWeight:400,fontWeightBold:600,lineHeight:1.35,scrollback:5e3,convertEol:!1,allowProposedApi:!0,theme:{background:"#0b0e14",foreground:"#d7dce5",cursor:t,cursorAccent:"#0b0e14",selectionBackground:"rgba(124, 156, 255, .30)",black:"#1b2028",red:"#f07178",green:"#7ec699",yellow:"#e6b673",blue:"#7aa2f7",magenta:"#c792ea",cyan:"#7fdbca",white:"#c8d0dc",brightBlack:"#556070",brightRed:"#ff8b92",brightGreen:"#9fe0b4",brightYellow:"#f5cc8c",brightBlue:"#9ab8ff",brightMagenta:"#dbb3ff",brightCyan:"#a3f0e2",brightWhite:"#eef2f8"}}),n=new va.FitAddon,h=new Pn;i.loadAddon(n),i.loadAddon(h),i.loadAddon(new On);let s=document.createElement("div");s.className="tt_term";let r=document.createElement("div");r.className="tt_overlay",r.addEventListener("click",()=>{r.textContent="",Gr(e.sid)}),s.appendChild(r),i.open(s);try{n.fit()}catch{}try{let a=new ra;a.onContextLoss(()=>{try{a.dispose()}catch{}}),i.loadAddon(a)}catch{}i.onData(a=>{ge({t:"input",sid:e.sid,d:a})}),i.onResize(()=>{Fi(e.spawnSpec)&&Ra(200)}),i.attachCustomKeyEventHandler(a=>e.embedded===!0?!0:(a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="f"?(a.preventDefault(),Ya(),!1):!0),e.term=i,e.fit=n,e.search=h,e.termEl=s,e.overlayEl=r}function Ti(e,t){let i=Ds(),n={sid:i,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??gu(),label:t};return Hi(n),re.set(i,n),Os+=1,rt(),li(i),Ns(n),Ht(),n}function qd(e){let t={sid:e.sid,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};Hi(t),re.set(t.sid,t),Os+=1,rt(),li(t.sid),ge({t:"attach",sid:t.sid})}function Ns(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0,i={...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24};if(he===null||he.readyState!==WebSocket.OPEN){Pr.add({tab:e,frame:i});return}ge(i)}function da(e){let t={sid:Ds(),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};Hi(t),re.set(t.sid,t),Os+=1,rt(),li(t.sid),Ns(t)}function Gr(e){let t=re.get(e);if(t===void 0)return;if(t.embedded===!0){Ba(t);return}let i=t.spawnSpec,n=t.label;if(t.exited||ge({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),re.delete(e);let h={sid:Ds(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:i,label:n};Hi(h),re.set(h.sid,h),rt(),li(h.sid),Ns(h),Ht()}function Kd(e){let t=re.get(e);if(t!==void 0){if(t.exited||ge({t:"kill",sid:e}),re.delete(e),Ii.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),_t===e){_t=null;let i=[...re.keys()].pop()??null;i!==null&&li(i)}rt(),[...re.values()].some(i=>i.embedded!==!0)?Ht():Pi()}}function Ta(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error("ttyTerminal \u9700\u8981 command");if(/[\r\n\0]/.test(t))throw new Error("command \u5FC5\u987B\u662F\u5355\u884C");return t}function Aa(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 Gd(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&&ai(e)}}),t.observer.observe(t.hostEl))}function Da(e,t,i){let n={sid:Ds(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:i};return Hi(n),re.set(n.sid,n),Ii.add(n.sid),e.hostEl.appendChild(n.termEl),Gd(n),Ns(n),n}function Ba(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||ge({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),re.delete(e.sid),Ii.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=Da(t,e.spawnSpec,e.label),t.tab}}function Vd(e,t){if(!(e instanceof HTMLElement))throw new Error("ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9");let i=Ta(t),n=Aa(t,i),h=typeof t?.label=="string"&&t.label!==""?t.label:void 0;Oi();let s={hostEl:e,tab:null,observer:null,disposed:!1};return s.tab=Da(s,n,h),vu(),()=>Yd(s)}function Yd(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||ge({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),re.delete(t.sid),Ii.delete(t.sid),e.tab=null}if(se===null&&!Kr()&&he!==null){Ri=!0;try{he.close()}catch{}he=null}}var Xd=460,Jd=280,Zd=320,Qd=160,At=null,Zt=Xd,Qt=Zd;function Vr(){let e=se!==null?se.querySelector(".tt_modal"):null,t=e!==null?e:se;return t!==null?t.getBoundingClientRect():null}var Yr=e=>e==="bottom"?Qd:Jd;function eu(e){let t=Vr();if(t===null)return 900;let i=e==="bottom"?t.height:t.width;return Math.max(Yr(e),Math.round(i*.72))}function Ei(e,t){return Math.min(eu(e),Math.max(Yr(e),Math.round(t)))}function vs(){let e=At;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){Qt=Ei("bottom",Qt),e.el.style.width="",e.el.style.height=String(Qt)+"px",e.el.style.flexBasis=String(Qt)+"px";return}Zt=Ei("right",Zt),e.el.style.height="",e.el.style.width=String(Zt)+"px",e.el.style.flexBasis=String(Zt)+"px"}}function ms(e){let t=At;if(t!==null){if(At=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(i){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(i instanceof Error?i.message:String(i)))}try{t.el.remove()}catch{}xt!==null&&delete xt.dataset.side}}function Pa(e){if(se===null&&tn(),xt===null)throw new Error("ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA");At!==null&&ms(!0),Oi();let t=e?.side==="bottom"?"bottom":"right",i=Math.max(t==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:Yr(t)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let p=Ei(t,e.size);t==="bottom"?Qt=p:Zt=p}let n=document.createElement("div");n.className="tt_dockPane",n.dataset.side=t,xt.dataset.side=t,n.innerHTML='<div class="tt_dockPaneResize" title="'+(t==="bottom"?"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6")+'"></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="\u5173\u95ED\u4FA7\u680F">'+Ps+'</button></div><div class="tt_dockPaneBody"></div>',xt.appendChild(n);let h=n.querySelector(".tt_dockPaneTitle"),s=n.querySelector(".tt_dockPaneHint"),r=n.querySelector(".tt_dockPaneBody"),a=n.querySelector(".tt_dockPaneFold"),f=n.querySelector(".tt_dockPaneClose"),o=n.querySelector(".tt_dockPaneResize"),_={el:n,element:r,disposed:!1,collapsed:!1,side:t,minSize:i,onClose:typeof e?.onClose=="function"?e.onClose:null},g=()=>t==="bottom"?_.collapsed?Ur:yd:_.collapsed?ya:Ca,S=p=>{_.collapsed=p===!0,_.collapsed?n.dataset.collapsed="1":delete n.dataset.collapsed,a.innerHTML=g(),a.title=_.collapsed?"\u5C55\u5F00\u4FA7\u680F":"\u6536\u8D77\u4FA7\u680F",a.setAttribute("aria-label",a.title),vs()};return _.setTitle=p=>{h.textContent=typeof p=="string"?p:""},_.setHint=p=>{s.textContent=typeof p=="string"?p:""},_.isCollapsed=()=>_.collapsed===!0,_.collapse=()=>S(!0),_.expand=()=>S(!1),_.toggle=()=>S(!_.collapsed),_.dispose=()=>{_.disposed||At!==_||ms(!1)},o.addEventListener("mousedown",p=>{if(p.button!==0||_.collapsed)return;p.preventDefault();let c=p.clientX,d=p.clientY,l=n.getBoundingClientRect(),u=C=>{t==="bottom"?Qt=Ei("bottom",Math.max(i,l.height+(d-C.clientY))):Zt=Ei("right",Math.max(i,l.width+(c-C.clientX))),vs()},v=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",v),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",u),document.addEventListener("mouseup",v)}),o.addEventListener("dblclick",()=>S(!_.collapsed)),a.addEventListener("click",()=>S(!_.collapsed)),f.addEventListener("click",()=>ms(!0)),_.setTitle(typeof e?.title=="string"?e.title:""),_.setHint(typeof e?.hint=="string"?e.hint:""),S(e?.collapsed===!0),At=_,vs(),_}function li(e){let t=re.get(e);if(t!==void 0){_t=e;for(let[i,n]of re)n.embedded!==!0&&n.termEl!==null&&(n.termEl.style.display=i===e?"":"none");t.embedded!==!0&&ze!==null&&t.termEl!==null&&t.termEl.parentElement!==ze&&ze.appendChild(t.termEl),Ni(),Nt(),rt(),Dt();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&ai(t),Jt(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA":"",t.exited?"\u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"","exited")}}function Br(e){if(Ct===null)return;let t=re.get(e);if(t===void 0)return;let n=Ct.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");n!=null&&(n.dataset.state=t.exited?"exited":t.live===!0?"connected":t.errored===!0?"error":"connecting")}function rt(){if(Ct===null)return;Ct.textContent="";for(let[t,i]of re){if(i.embedded===!0)continue;let n=document.createElement("button");n.className="tt_tab",n.dataset.sid=t,t===_t&&(n.dataset.active="");let h=document.createElement("span");h.className="tt_tabDot",h.dataset.state=i.exited?"exited":i.live===!0?"connected":i.errored===!0?"error":"connecting",n.appendChild(h);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=i.label||"\u7EC8\u7AEF "+Oa(t),s.addEventListener("dblclick",a=>{a.stopPropagation(),su(t,n)});let r=document.createElement("span");r.className="tt_tabClose",r.title="\u5173\u95ED",r.textContent="\u2715",n.title=s.textContent,n.appendChild(s),n.appendChild(r),n.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),Kd(t);return}li(t)}),Ct.appendChild(n)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.innerHTML=Sd,e.addEventListener("click",()=>{au(e)}),Ct.appendChild(e)}function tu(e){return e?.direction==="remote"?`\u8FDC\u7A0B:${e.remoteHost||"127.0.0.1"}:${String(e.remotePort??0)} \u2192 \u672C\u673A:${String(e.localTargetPort??0)}`:`\u672C\u673A:${String(e?.localPort??0)} \u2192 ${e?.remoteHost??"?"}:${String(e?.remotePort??0)}`}function Dt(){if(wi===null||Cs===null||Ci===null||Si===null)return;Ci.textContent="";let e=je(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){wi.dataset.hidden="";return}delete wi.dataset.hidden;let i=Number(t.port);Cs.textContent=typeof e.target=="string"&&e.target!==""?e.target:typeof t.name=="string"&&t.name!==""?t.name:String(t.username??"")+"@"+String(t.host??"")+(Number.isInteger(i)&&i!==22?":"+i:""),$e!==null&&(e.persistTmux===!0?($e.textContent="tmux",$e.dataset.state="ok",$e.title="\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A"):t.persist===!0&&e.spawned===!0?($e.textContent="\u672A\u6301\u4E45\u5316",$e.dataset.state="warn",$e.title="\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD"):($e.textContent="",delete $e.dataset.state,$e.removeAttribute("title")));let n=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";Si.dataset.state=n,Si.title=n==="connected"?"\u5DF2\u8FDE\u63A5":n==="connecting"?"\u8FDE\u63A5\u4E2D":n==="error"?"\u8FDE\u63A5\u51FA\u9519":"\u4F1A\u8BDD\u5DF2\u9000\u51FA";let h=(r,a,f,o)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=f,_.innerHTML=r+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",o),Ci.appendChild(_)},s=typeof t.name=="string"?t.name:"";for(let r of Or)try{r({tab:e,spec:t,bookName:s,addAction:h})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}var Rt=null,bs=null;function Nr(){bs!==null&&(document.removeEventListener("mousedown",bs,!0),bs=null),Rt!==null&&(Rt.remove(),Rt=null)}function iu(e,t){if(Rt!==null){Nr();return}let i=document.createElement("div");i.className="tt_tunnelPop";let n=document.createElement("div");n.className="tt_tunnelPopTitle",n.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,i.appendChild(n);let h=document.createElement("div");h.textContent="\u52A0\u8F7D\u4E2D\u2026",i.appendChild(h);let s=document.createElement("span");s.className="tt_cardHint",s.textContent="\u589E\u5220/\u542F\u505C\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4",i.appendChild(s),document.body.appendChild(i),Rt=i;let r=e.getBoundingClientRect();i.style.top=String(r.bottom+6)+"px",i.style.left=String(Math.max(8,r.right-340))+"px";let a=f=>{Rt===i&&(i.contains(f.target)||e.contains(f.target)||Nr())};bs=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let f=[];try{let g=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();g.ok&&Array.isArray(g.tunnels)&&(f=g.tunnels)}catch{}if(Rt!==i)return;h.textContent="";let o=Xr.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(o.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent="\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053",h.appendChild(_);return}for(let _ of o){let g=f.find(l=>l?.name===_?.name),S=g?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=S==="active"?"connected":S==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(g?.error??g?.lastForwardError??""),d.textContent=tu(_)+" \xB7 "+S,p.appendChild(c),p.appendChild(d),h.appendChild(p)}})()}function Oa(e){let t=1;for(let i of re.keys()){if(i===e)return String(t);t+=1}return String(t)}function su(e,t){let i=re.get(e);if(i===void 0||t.querySelector(".tt_tabRename")!==null)return;let n=t.querySelector(".tt_tabLabel");if(n===null)return;let h=document.createElement("input");h.className="tt_tabRename",h.value=i.label||"\u7EC8\u7AEF "+Oa(e),n.replaceWith(h),h.focus(),h.select();let s=!1,r=()=>{if(s)return;s=!0;let f=h.value.trim();i.label=f!==""?f:void 0,rt(),Ht()},a=()=>{s||(s=!0,rt())};h.addEventListener("keydown",f=>{f.stopPropagation(),f.key==="Enter"?r():f.key==="Escape"&&a()}),h.addEventListener("blur",r),h.addEventListener("click",f=>f.stopPropagation())}var Xr=[],Ia="dialog",Bt="off",kt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},si=null,yt=null,Ms=null,Pt=!1;function Na(e){Pt=e,Ms!==null&&Ms.set(e)}function ru(e){Na(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==Es&&(Es=e.statsEnabled,Ni(),Nt())}function Ai(e){ru(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(Et=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(Xr=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(Ia=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(Bt=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&&(si=e.maxSessions)}function nu(e,t){let i=t==="error"||t==="info"?t:"warn",n=document.createElement("div");n.className="tt_toast",n.dataset.kind=i,n.innerHTML='<span class="tt_toastIcon">'+(i==="error"?xa:i==="info"?Ed:kd)+'</span><span class="tt_toastText"></span>',n.lastElementChild.textContent=e,document.body.appendChild(n),setTimeout(()=>n.remove(),4e3)}async function Ha(){try{ge({t:"sessions"});let e=await Ls("sessions",3e3);if(e!==null&&Array.isArray(e.list))return yt=e.list.length,yt}catch{}return null}async function Rs(){if(await Ha(),si===null||yt===null||yt<si)return null;let e=[...re.values()].filter(n=>!n.exited).length,t=Math.max(0,yt-e),i=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${yt} \u4E2A / \u4E0A\u9650 ${si}\uFF1A\u672C\u7A97\u53E3 ${e} \u4E2A${t>0?" + \u5176\u4ED6\u7A97\u53E3 "+t+" \u4E2A":""}\uFF09\u2014\u2014\u5173\u95ED\u4E0D\u7528\u7684\u7A97\u53E3/\u6807\u7B7E\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\u300D`;return nu(i),i}function ou(){return si!==null&&yt!==null&&yt>=si}function Jr(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Fa(e){return Xr.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function Hr(e){let t=Number(e?.port),i=Number.isInteger(t)&&t!==22?":"+t:"",n=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",h=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+i+" \xB7 "+n+h}async function Wa(e,t){let i=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),n=await i.json().catch(()=>({}));return n&&n.ok===!1&&n.error?{error:String(n.error)}:n&&n.result?{result:n.result}:{error:String(n&&n.error?n.error:"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP "+i.status+"\uFF09")}}function $a(e,t){if(!e)return"\u8FDE\u63A5\u6D4B\u8BD5\u2026";let i=e,n=typeof i.tcp?.ms=="number"?i.tcp.ms:null,h=typeof i.auth?.ms=="number"?i.auth.ms:null,s=[];i.tcp?.ok&&s.push("TCP "+(n!==null?n+"ms":"\u901A")),i.banner?.ok&&s.push("banner \u6B63\u5E38");let r=i.hostkey?.state;if(r==="matched"?s.push("\u4E3B\u673A\u5BC6\u94A5\u5339\u914D"):r==="recorded"?s.push("\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09"):r==="mismatch"&&s.push("\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01"),i.auth?.ok)return"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A"+(h!==null?"\u8BA4\u8BC1\u901A\u8FC7\uFF08"+h+"ms\uFF09":"\u8BA4\u8BC1\u901A\u8FC7")+(s.length?" \xB7 "+s.join(" \xB7 "):"");let a=i.auth?.error||i.tcp?.error||"\u672A\u77E5\u9519\u8BEF";return(t?.prefix||"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A")+a+(s.length?" \xB7 "+s.join(" \xB7 "):"")}async function Zr(){try{let t=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(t.ok&&typeof t.config=="object"&&t.config!==null){let i=Et;Ai(t.config),Ue!==null&&Et!==i&&Fr(Ue)}}catch{}}function za(e){Ue!==null&&(e.target instanceof Element&&(Ue.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||st())}function au(e){if(Ue!==null){st();return}Zr(),Ha().then(()=>{Ue!==null&&Fr(Ue)});let t=document.createElement("div");t.className="tt_addMenu",Ue=t,Fr(t),document.body.appendChild(t);let i=e.getBoundingClientRect(),n=t.offsetWidth,s=i.left+n>window.innerWidth-8?i.right-n:i.left;t.style.left=Math.max(8,Math.min(s,window.innerWidth-n-8))+"px",t.style.top=i.bottom+6+"px",document.addEventListener("mousedown",za,!0)}function st(){Ue!==null&&(document.removeEventListener("mousedown",za,!0),Ue.remove(),Ue=null)}function ua(e,t,i,n,h,s){let r=document.createElement("button");if(r.type="button",r.className="tt_addMenuItem",h===!0&&(r.setAttribute("data-soldout",""),r.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E"),s!==void 0){let o=document.createElement("span");o.className="tt_addMenuIcon",o.innerHTML=s,r.appendChild(o)}let a=document.createElement("span");a.className="tt_addMenuText";let f=document.createElement("span");if(f.className="tt_addMenuMain",f.textContent=t,a.appendChild(f),i!==""){let o=document.createElement("span");o.className="tt_addMenuSub",o.textContent=i,a.appendChild(o)}r.appendChild(a),r.addEventListener("click",n),e.appendChild(r)}function Fr(e){e.textContent="";let t=ou();ua(e,"\u672C\u5730\u7EC8\u7AEF",Bt==="tmux"?"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",async()=>{await Rs()||(st(),Ti())},t,Bs);let i=document.createElement("div");i.className="tt_addMenuSep",e.appendChild(i);let n=document.createElement("div");n.className="tt_addMenuTitle",n.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(n);for(let s of Et){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let r=document.createElement("div");r.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let f=document.createElement("span");f.className="tt_addMenuIcon",f.innerHTML=xd;let o=document.createElement("span");o.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=s.name;let g=document.createElement("span");g.className="tt_addMenuSub";let S=Fa(s.name);g.textContent=Hr(s)+(S>0?" \xB7 \u21C4"+String(S):""),o.appendChild(_),o.appendChild(g),a.appendChild(f),a.appendChild(o),a.addEventListener("click",async()=>{if(await Rs())return;st();let d=Bt==="tmux"?{persist:!0,persistName:Jr()}:{};Ti({t:"ssh",name:s.name,...d},s.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.innerHTML=Mi,p.addEventListener("click",()=>{st(),en({name:s.name})});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title="\u7F16\u8F91\u8FDE\u63A5",c.innerHTML=jr,c.addEventListener("click",()=>{st(),fa(s)}),r.appendChild(a),r.appendChild(p),r.appendChild(c),e.appendChild(r)}if(Et.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(s)}let h=document.createElement("div");h.className="tt_addMenuSep",e.appendChild(h),ua(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{st(),fa()},!1,ka)}function fa(e){if(ii!==null)return;let t=e!==null&&typeof e=="object"?e:null,i=t!==null,n=document.createElement("div");n.className="tt_sshBackdrop";let h=document.createElement("div");h.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=ka+"<span></span>",s.lastElementChild.textContent=i?"\u7F16\u8F91\u8FDE\u63A5 \xB7 "+String(t.name??""):"SSH \u8FDE\u63A5",h.appendChild(s);let r=A=>{let k=document.createElement("div");return k.className="tt_sshSection",k.textContent=A,k},a={},f=(A,k,N)=>{let H=document.createElement("label");H.className="tt_sshRow";let q=document.createElement("span");q.className="tt_cardLabel",q.textContent=k,H.appendChild(q);let j;if(N?.select!==void 0){j=document.createElement("select");for(let Q of N.select){let ee=document.createElement("option");ee.value=Q.value,ee.textContent=Q.label,j.appendChild(ee)}}else j=document.createElement("input"),j.type=N?.type??"text",j.placeholder=N?.placeholder??"";return j.className="tt_cardInput",j.autocomplete="off",j.spellcheck=!1,H.appendChild(j),a[A]=j,H};h.appendChild(r("\u8FDE\u63A5"));let o=document.createElement("div");o.className="tt_sshGrid",o.appendChild(f("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),o.appendChild(f("port","\u7AEF\u53E3",{placeholder:"22"})),h.appendChild(o),h.appendChild(f("username","\u7528\u6237\u540D",{placeholder:"root"})),h.appendChild(r("\u8BA4\u8BC1")),h.appendChild(f("auth","\u8BA4\u8BC1\u65B9\u5F0F",{select:[{value:"agent",label:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"},{value:"key",label:"key \u2014 \u79C1\u94A5\u6587\u4EF6"},{value:"password",label:"password \u2014 \u5BC6\u7801"}]}));let _=f("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),g=f("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),S=f("password","\u5BC6\u7801",{type:"password"}),p=A=>{let k=document.createElement("div");k.className="tt_sshRow";let N=document.createElement("input");N.type="text",N.className="tt_cardInput",N.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",N.autocomplete="off",N.spellcheck=!1;let H=document.createElement("div");H.className="tt_envList",H.dataset.hidden="";let q=[],j=()=>{if(H.textContent="",q.length===0){let G=document.createElement("span");G.className="tt_cardHint",G.textContent="env \u63D2\u4EF6\u8FD8\u6CA1\u6709\u6258\u7BA1\u53D8\u91CF \u2014 \u5728\u5176\u8BBE\u7F6E\u5361\u7247\u6DFB\u52A0\u540E\u8FD9\u91CC\u53EF\u9009\uFF0C\u4E5F\u53EF\u624B\u8F93 env:NAME",H.appendChild(G);return}let Q=N.value.trim().toUpperCase(),ee=Q===""?q:q.filter(G=>G.toUpperCase().includes(Q));for(let G of ee.slice(0,30)){let J=document.createElement("button");J.type="button",J.className="tt_envItem",J.textContent=G;let Z="env:"+G,oe=null,ae=()=>{oe!==null&&(clearTimeout(oe),oe=null),J.textContent=G,delete J.dataset.danger};J.addEventListener("mousedown",be=>be.preventDefault()),J.addEventListener("click",()=>{let be=A.value;if(be===""||be.startsWith("env:")||oe!==null){ae(),A.value=Z,A.focus();return}J.textContent=G+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",J.dataset.danger="",oe=setTimeout(ae,4e3)}),H.appendChild(J)}if(ee.length>30){let G=document.createElement("span");G.className="tt_envMore",G.textContent="\u8FD8\u6709 "+(ee.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",H.appendChild(G)}else if(ee.length===0){let G=document.createElement("span");G.className="tt_envMore",G.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",H.appendChild(G)}};return N.addEventListener("input",j),N.addEventListener("focus",()=>{delete H.dataset.hidden}),N.addEventListener("blur",()=>{N.value.trim()===""&&(H.dataset.hidden="")}),k.appendChild(N),k.appendChild(H),{row:k,setNames(Q){q=Array.isArray(Q)?Q:[],j()}}},c=p(a.passphrase),d=p(a.password),l=!1;(async()=>{if(!l){l=!0;try{let k=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();k.ok&&Array.isArray(k.names)&&(c.setNames(k.names),d.setNames(k.names))}catch{}}})(),h.appendChild(_),h.appendChild(g),h.appendChild(c.row),h.appendChild(S),h.appendChild(d.row),h.appendChild(r("\u9009\u9879"));let v=document.createElement("label");v.className="tt_cardRow";let C=document.createElement("input");C.type="checkbox",C.className="tt_cardCheckbox";let w=document.createElement("span");w.className="tt_cardLabel",w.textContent="agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09",v.appendChild(C),v.appendChild(w),h.appendChild(v);let y=document.createElement("label");y.className="tt_cardRow";let m=document.createElement("input");m.type="checkbox",m.className="tt_cardCheckbox";let x=document.createElement("span");x.className="tt_cardLabel",x.textContent="\u6301\u4E45\u4F1A\u8BDD\uFF08tmux \u6258\u7BA1\uFF0C\u65AD\u7EBF/\u91CD\u542F\u540E\u6062\u590D\u73B0\u573A\uFF1B\u8FDC\u7A0B\u9700\u5B89\u88C5 tmux\uFF09",y.appendChild(m),y.appendChild(x),m.checked=Bt==="tmux",Bt==="tmux"&&h.appendChild(y);let T=document.createElement("label");T.className="tt_cardRow";let I=document.createElement("input");I.type="checkbox",I.className="tt_cardCheckbox";let F=document.createElement("span");F.className="tt_cardLabel",F.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",T.appendChild(I),T.appendChild(F),h.appendChild(T);let R=f("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});R.style.display="none",h.appendChild(R),I.addEventListener("change",()=>{R.style.display=I.checked?"":"none",I.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),I.checked&&a.name.focus()}),i&&(T.style.display="none",a.name.value=String(t.name??""),R.style.display="",a.host.value=String(t.host??""),a.port.value=String(t.port??22),a.username.value=String(t.username??""),a.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",a.keyPath.value=String(t.keyPath??""),a.passphrase.value=String(t.passphrase??""),a.password.value=String(t.password??""),C.checked=t.agentForward===!0,m.checked=Bt==="tmux");let z=document.createElement("div");z.className="tt_sshStatus";let B=document.createElement("div");B.className="tt_sshError";let D=document.createElement("div");D.className="tt_sshProbeResult",z.appendChild(B),z.appendChild(D),h.appendChild(z);let O=()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),A===""||k==="")return B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B",null;let H=a.auth.value,q={host:A,port:N,username:k,auth:H};if(H==="key"){let j=a.keyPath.value.trim();if(j==="")return B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84",null;q.keyPath=j;let Q=a.passphrase.value;Q!==""&&(q.passphrase=Q)}if(H==="password"){let j=a.password.value;if(j==="")return B.textContent="auth=password \u9700\u8981\u5BC6\u7801",null;q.password=j}return C.checked&&(q.agentForward=!0),q},P=document.createElement("div");P.className="tt_sshActions";let b=document.createElement("div");b.className="tt_sshActionsGroup";let E=document.createElement("div");E.className="tt_sshActionsGroup",P.appendChild(b),P.appendChild(E);let L=document.createElement("button");L.type="button",L.className="tt_toolBtn",L.textContent="\u53D6\u6D88";let M=document.createElement("button");M.type="button",M.className="tt_cardSave",M.textContent="\u8FDE\u63A5",b.appendChild(L);let $=document.createElement("button");$.type="button",$.className="tt_toolBtn",$.textContent="\u6587\u4EF6\u6D4F\u89C8",$.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",$.addEventListener("click",()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),A===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let H=a.auth.value,q={host:A,port:N,username:k,auth:H};if(H==="key"){let j=a.keyPath.value.trim();if(j===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}q.keyPath=j;let Q=a.passphrase.value;Q!==""&&(q.passphrase=Q)}if(H==="password"){let j=a.password.value;if(j===""){B.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}q.password=j}C.checked&&(q.agentForward=!0),St(),en(q)}),b.appendChild($);let K=null;i&&(K=document.createElement("button"),K.type="button",K.className="tt_toolBtn",K.textContent="\u4FDD\u5B58\u4FEE\u6539",K.addEventListener("click",()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim();if(A===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let N=Number(a.port.value);(!Number.isInteger(N)||N<1||N>65535)&&(N=22);let H=a.auth.value,j={name:a.name.value.trim()||A,host:A,port:N,username:k,auth:H,keyPath:H==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:C.checked,persist:m.checked};if(H==="key"&&j.keyPath===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}K!==null&&(K.disabled=!0),cu(String(t.name??""),j).then(Q=>{if(K!==null&&(K.disabled=!1),Q!==void 0){B.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+Q;return}St()})}),b.appendChild(K));let Y=document.createElement("button");Y.type="button",Y.className="tt_toolBtn",Y.textContent="\u8BD5\u8FDE",Y.title="\u6309\u5F53\u524D\u586B\u5199\u8BCA\u65AD\u8FDE\u63A5\uFF08TCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\uFF09\uFF1B\u4E0D\u4F1A\u65B0\u5EFA\u4F1A\u8BDD\uFF0C\u4E5F\u4E0D\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9",Y.addEventListener("click",()=>{let A=O();A!==null&&(D.className="tt_sshProbeResult",D.textContent="\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026",Y.disabled=!0,Wa(A,!1).then(k=>{Y.disabled=!1,k.result?(D.className="tt_sshProbeResult"+(k.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),D.textContent=$a(k.result)):(D.className="tt_sshProbeResult tt_sshProbeBad",D.textContent="\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(k.error||"\u672A\u77E5\u9519\u8BEF"))}))}),b.appendChild(Y),E.appendChild(M),h.appendChild(P);let U=()=>{_.style.display=a.auth.value==="key"?"":"none",g.style.display=a.auth.value==="key"?"":"none",c.row.style.display=a.auth.value==="key"?"":"none",S.style.display=a.auth.value==="password"?"":"none",d.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",U),U(),L.addEventListener("click",()=>St()),n.addEventListener("mousedown",A=>{A.target===n&&St()}),M.addEventListener("click",async()=>{B.textContent="";let A=await Rs();if(A!==null){B.textContent=A;return}let k=a.host.value.trim(),N=a.username.value.trim(),H=Number(a.port.value);if((!Number.isInteger(H)||H<1||H>65535)&&(H=22),k===""||N===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let q=a.auth.value,j={t:"ssh",host:k,port:H,username:N,auth:q};if(q==="key"){let J=a.keyPath.value.trim();J!==""&&(j.keyPath=J);let Z=a.passphrase.value;Z!==""&&(j.passphrase=Z)}if(q==="password"){let J=a.password.value;J!==""&&(j.password=J)}C.checked&&(j.agentForward=!0),m.checked&&(j.persist=!0,j.persistName=Jr());let Q=H!==22?N+"@"+k+":"+H:N+"@"+k,ee=J=>{St(),se!==null&&Ti(j,J!==""?J:Q)};if(!I.checked){ee("");return}let G=a.name.value.trim()||k;M.disabled=!0,lu({name:G,host:k,port:H,username:N,auth:q,keyPath:j.keyPath??"",passphrase:j.passphrase??"",password:j.password??"",agentForward:C.checked,persist:m.checked}).then(J=>{if(M.disabled=!1,J!==void 0){B.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+J;return}ee(G)})}),n.appendChild(h),document.body.appendChild(n),ii=n,a.host.focus()}function St(){ii!==null&&(ii.remove(),ii=null)}async function lu(e){let t=[...Et.filter(i=>i?.name!==e.name),e];try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),n=await i.json().catch(()=>({}));if(!i.ok||!n.ok)return String(n.error||"HTTP "+i.status);Ai(n.config);return}catch(i){return String(i&&i.message?i.message:i)}}async function cu(e,t){if(t.name!==e&&Et.some(n=>n?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let i=Et.map(n=>n?.name===e?t:n);try{let n=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:i})}),h=await n.json().catch(()=>({}));if(!n.ok||!h.ok)return String(h.error||"HTTP "+n.status);Ai(h.config);return}catch(n){return String(n&&n.message?n.message:n)}}function hu(e,t){if(Qr())return;let i=document.createElement("div");i.className="tt_sftpDualCard";let n=document.createElement("div");n.className="tt_sftpTitleRow";let h=document.createElement("div");h.className="tt_sshTitle",h.innerHTML=Mi+"<span></span>",h.lastElementChild.textContent="SFTP \u53CC\u680F \xB7 "+t;let s=document.createElement("button");s.type="button",s.className="tt_close",s.title="\u5173\u95ED",s.innerHTML=Ps,s.addEventListener("click",Ft),n.appendChild(h),n.appendChild(s),i.appendChild(n);let r=document.createElement("div");r.className="tt_sftpStatus";let a=(O,P)=>{r.textContent=O,P===void 0?delete r.dataset.state:r.dataset.state=P},f=!1,o=(O,P)=>{if(!(f||g.local.busy||g.remote.busy)){f=!0;for(let b of[g.local,g.remote])b.setBusy(!0);a(O,"busy"),Promise.resolve().then(P).catch(b=>{(b===null||typeof b!="object"||b.name!=="TransferCanceledError")&&R.fail("\u5931\u8D25"),a(String(b&&b.message?b.message:b),"error")}).finally(()=>{f=!1;for(let b of[g.local,g.remote])b.setBusy(!1)})}},_=O=>{g[O].bar.after(p),p.style.display="",c.focus(),c.select()},g={},S=(O,P)=>{let b={kind:O,path:"",busy:!1},E=document.createElement("div");E.className="tt_sftpPane";let L=document.createElement("div");L.className="tt_sftpPaneHead";let M=document.createElement("span");M.textContent=P;let $=document.createElement("span");$.className="tt_sftpPaneMeta",L.appendChild(M),L.appendChild($),E.appendChild(L);let K=document.createElement("div");K.className="tt_sftpBar";let Y=document.createElement("input");Y.type="text",Y.className="tt_sftpPath",Y.placeholder=O==="local"?"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",Y.spellcheck=!1,Y.autocomplete="off";let U=document.createElement("button");U.type="button",U.className="tt_toolBtn",U.innerHTML=qr+"<span>\u5237\u65B0</span>";let A=document.createElement("button");A.type="button",A.className="tt_toolBtn",A.innerHTML=Sa+"<span>\u65B0\u5EFA\u76EE\u5F55</span>",K.appendChild(Y),K.appendChild(U),K.appendChild(A),E.appendChild(K);let k=document.createElement("div");k.className="tt_sftpList",E.appendChild(k),b.bar=K;let N=G=>{b.busy=G;for(let J of[U,A])J.disabled=G;Y.disabled=G},H=async(G,J)=>{let Z=O==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",oe=O==="local"?J:{...e,...J},ae=await fetch(Z+G,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(oe)}),be=await ae.json().catch(()=>({}));if(!ae.ok||be.ok!==!0)throw new Error(String(be.error||"HTTP "+ae.status));return be},q=(G,J)=>{if(!(b.busy||f))return N(!0),a(G,"busy"),Promise.resolve().then(J).catch(Z=>a(String(Z&&Z.message?Z.message:Z),"error")).finally(()=>N(!1))},j=(G,J)=>G.endsWith("/")||G.endsWith("\\")?G+J:G+"/"+J,Q=G=>{let J=j(b.path,G.name),Z=[];G.isDir===!0?Z.push("\u76EE\u5F55"):Z.push(qe(Number(G.size))||"\u2014");let oe=ja(Number(G.mtime));oe!==""&&Z.push(oe);let ae=C(G.isDir?Mi:G.isSymlink?ba:ma,G.name,Z.join(" \xB7 "),G.isDir===!0?"dir":G.isSymlink===!0?"link":"file"),be=()=>b.loadDir(b.path),Se=O==="local"?g.remote:g.local;return G.isDir===!0&&ae.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||b.loadDir(J)}),w(ae,O==="local"?Ca:ya,"\u4F20\u8F93\u5230"+(O==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+Se.path,()=>{R.reset(),R.pulse(0),o("\u4F20\u8F93 "+G.name+"\u2026",async()=>{let fe=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:O==="local"?"up":"down",...e,localPath:O==="local"?J:j(Se.path,G.name),remotePath:O==="local"?j(Se.path,G.name):J})}),W=await fe.json().catch(()=>({}));if(!fe.ok||W.ok!==!0)throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error(String(W.error||"HTTP "+fe.status));let V=W.job?.id;if(typeof V!="string"||V==="")throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id");await z(V,G.name)==="canceled"?(R.reset(),a("\u5DF2\u53D6\u6D88\u4F20\u8F93 "+G.name)):(R.done("\u5B8C\u6210"),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4F20\u8F93 "+G.name)),await Se.loadDir(Se.path)})}),O!=="local"&&G.isDir!==!0&&w(ae,wa,"\u4E0B\u8F7D "+G.name,()=>{m(G,J)}),w(ae,jr,"\u91CD\u547D\u540D "+G.name,()=>{c.placeholder="\u65B0\u540D\u79F0",c.value=G.name,_(O),u=async()=>{let fe=c.value.trim();fe===""||fe===G.name||(v(),await b.runTask("\u91CD\u547D\u540D "+G.name+"\u2026",async()=>{await H("rename",{from:J,to:j(b.path,fe)}),await be()}))}}),y(ae,()=>b.runTask("\u5220\u9664 "+G.name+"\u2026",async()=>{await H("remove",{path:J,recursive:G.isDir===!0}),await be(),a("\u5DF2\u5220\u9664 "+G.name)}),G),ae},ee=G=>{if(k.textContent="",b.path!==""&&b.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(b.path)===!1){let Z=C(Ur,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");Z.addEventListener("click",()=>{b.loadDir(qa(b.path))}),k.appendChild(Z)}let J=Array.isArray(G)?G:[];if(J.length===0){let Z=document.createElement("div");Z.className="tt_addMenuTitle",Z.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",k.appendChild(Z);return}for(let Z of J)Z===null||typeof Z!="object"||typeof Z.name!="string"||Z.name===""||k.appendChild(Q(Z))};return b.loadDir=async G=>{try{let J=await H("list",{path:G??b.path});b.path=typeof J.path=="string"&&J.path!==""?J.path:b.path,Y.value=b.path;let Z=Array.isArray(J.entries)?J.entries.length:0;ee(J.entries),$.textContent=String(Z)+" \u9879",a(b.path)}catch(J){a(String(J&&J.message?J.message:J),"error")}},b.runTask=q,b.setBusy=N,g[O]=b,U.addEventListener("click",()=>{b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(b.path))}),A.addEventListener("click",()=>{b.busy||f||(c.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",c.value="",_(O),u=async()=>{let G=c.value.trim();G!==""&&(v(),await b.runTask("\u521B\u5EFA\u76EE\u5F55 "+G+"\u2026",async()=>{await H("mkdir",{path:j(b.path,G),parents:!0}),await b.loadDir(b.path)}))})}),Y.addEventListener("keydown",G=>{if(G.key!=="Enter"||(G.preventDefault(),b.busy||f))return;let J=Y.value.trim();J!==""&&b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(J))}),E},p=document.createElement("div");p.className="tt_sftpEditor",p.style.display="none";let c=document.createElement("input");c.type="text",c.className="tt_cardInput",c.spellcheck=!1,c.autocomplete="off";let d=document.createElement("button");d.type="button",d.className="tt_toolBtn",d.textContent="\u786E\u5B9A";let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent="\u53D6\u6D88",p.appendChild(c),p.appendChild(d),p.appendChild(l);let u=null,v=()=>{p.style.display="none",c.value="",u=null};d.addEventListener("click",()=>{u?.()}),l.addEventListener("click",v),c.addEventListener("keydown",O=>{O.key==="Enter"?(O.preventDefault(),u?.()):O.key==="Escape"&&(O.stopPropagation(),v())});let C=(O,P,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpRow";let M=document.createElement("span");M.className="tt_sftpIcon",M.innerHTML=O,E!==void 0&&(M.dataset.kind=E);let $=document.createElement("span");if($.className="tt_sftpName",$.textContent=P,$.title=P,L.appendChild(M),L.appendChild($),b!==""){let K=document.createElement("span");K.className="tt_sftpMeta",K.textContent=b,L.appendChild(K)}return L},w=(O,P,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpAct",L.innerHTML=P,L.title=b,L.addEventListener("click",M=>{M.stopPropagation(),E()}),O.appendChild(L)},y=(O,P,b)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpAct",E.innerHTML=ei,E.title="\u5220\u9664 "+b.name+(b.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let L=null;E.addEventListener("click",M=>{if(M.stopPropagation(),L!==null){clearTimeout(L),L=null,E.innerHTML=ei,delete E.dataset.danger,P();return}E.textContent="\u786E\u8BA4?",E.dataset.danger="",L=setTimeout(()=>{L=null,E.innerHTML=ei,delete E.dataset.danger},4e3)}),O.appendChild(E)},m=(O,P)=>g.remote.runTask("\u4E0B\u8F7D "+O.name+"\u2026",async()=>{R.reset();let b;try{b=await Ga("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:P})},(E,L)=>{R.set(E,L)},kt.maxDownloadMb,E=>R.setCancel(E))}catch(E){if(Wr(E)){R.reset(),a("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+O.name);return}throw R.fail("\u4E0B\u8F7D\u5931\u8D25"),E}R.done("\u5B8C\u6210"),Va(b,O.name),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4E0B\u8F7D "+O.name+"\uFF08"+(qe(b.size)||String(b.size)+" B")+"\uFF09")}),x=S("local","\u672C\u673A"),T=S("remote","\u8FDC\u7A0B");g.local.wrap=x,g.remote.wrap=T;let I=document.createElement("div");I.className="tt_sftpDual",I.appendChild(x),I.appendChild(T),i.appendChild(I),i.appendChild(p);let F=document.createElement("div");F.className="tt_sftpFoot";let R=Ka();F.appendChild(R.el),F.appendChild(r),i.appendChild(F);let z=async(O,P)=>{let b=!1;R.setCancel(()=>{b||(b=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:O})}).catch(()=>{}))});try{for(;;){await new Promise($=>setTimeout($,400));let E=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:O})}),L=await E.json().catch(()=>({}));if(!E.ok||L.ok!==!0){if(b)return"canceled";throw new Error(String(L.error||"HTTP "+E.status))}let M=L.job;if(M===null||typeof M!="object")throw new Error("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001");if(M.state==="running"){let $=typeof M.current=="string"&&M.current!==""?M.current:P;a("\u4F20\u8F93 "+$+"\u2026","busy"),Number.isFinite(M.total)&&M.total>0?R.set(Number(M.bytes)||0,M.total):R.pulse(Number(M.bytes)||0);continue}if(M.state==="canceled")return"canceled";if(M.state!=="done")throw new Error(String(M.error||"\u4F20\u8F93\u5931\u8D25"));return"done"}}finally{R.setCancel(null)}},B=Vr(),D=B===null?420:Math.round(B.height*.56);Ua(i,"SFTP \u53CC\u680F \xB7 "+t,D),g.local.loadDir(""),g.remote.loadDir("")}var Di=null,Ts=null,Qr=()=>Di!==null||Ts!==null;function Ua(e,t,i){if(se!==null&&!Ie&&xt!==null&&At===null)try{let h=Pa({title:t,side:"bottom",size:i,min:200,onClose:()=>Ft()});h.element.appendChild(e),Ts=h;return}catch(h){console.warn("[dsh-tty] SFTP \u6302\u5230\u53F3\u4FA7\u4FA7\u680F\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(h instanceof Error?h.message:String(h)))}let n=document.createElement("div");n.className="tt_sshBackdrop",n.appendChild(e),n.addEventListener("mousedown",h=>{h.target===n&&Ft()}),document.body.appendChild(n),Di=n}var Li=null;function du(){let e=Li;if(Li=null,e!==null)try{e.click()}catch{}}function uu(e){let t=new TextEncoder().encode(e),i="";for(let n of t)i+=String.fromCharCode(n);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function qe(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],i=e,n=-1;do i/=1024,n+=1;while(i>=1024&&n<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[n]}function ws(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],i=e,n=-1;do i/=1024,n+=1;while(i>=1024&&n<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[n]+"/s"}function ja(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let i=n=>String(n).padStart(2,"0");return t.getFullYear()+"-"+i(t.getMonth()+1)+"-"+i(t.getDate())+" "+i(t.getHours())+":"+i(t.getMinutes())}function qa(e){let t=String(e).replace(/\/+$/,""),i=t.lastIndexOf("/");return i<=0?"/":t.slice(0,i)}function bi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function Ka(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let i=document.createElement("div");i.className="tt_sftpFill",t.appendChild(i);let n=document.createElement("span");n.className="tt_sftpPct",n.textContent="";let h=document.createElement("button");h.type="button",h.className="tt_sftpCancel",h.title="\u53D6\u6D88\u4F20\u8F93",h.textContent="\u2715",h.style.display="none";let s=null;h.addEventListener("click",p=>{p.stopPropagation();let c=s;c!==null&&(h.disabled=!0,c())}),e.appendChild(t),e.appendChild(n),e.appendChild(h);let r=p=>{n.textContent=p},a="",f=-1,o=p=>{p!==a&&(a=p,n.textContent=p)},_=p=>{let c=Math.round(p);c!==f&&(f=c,i.style.width=c+"%")},g=()=>{s=null,Li===h&&(Li=null),h.style.display="none",h.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",f=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,i.style.width="0%",n.textContent="",g()},setCancel(p){if(p==null){g();return}s=p,Li=h,h.disabled=!1,h.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let d=Date.now();if(this._last!==void 0&&d>this._lastAt){let l=(p-this._last)/((d-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}if(this._last=p,this._lastAt=d,Number.isFinite(c)&&c>0){let l=Math.min(100,Math.max(0,p/c*100));_(l);let u=this._rate!==void 0&&this._rate>=0?ws(this._rate):"";o(Math.round(l)+"%"+(u!==""?" \xB7 "+u:""))}else{i.style.width="";let l=this._rate!==void 0&&this._rate>=0?ws(this._rate):"";o(qe(p)+(l!==""?" \xB7 "+l:""))}},pulse(p){e.dataset.active="",delete e.dataset.state,i.style.width="45%",i.style.transition="none",setTimeout(()=>{i.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let l=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}this._last=p,this._lastAt=c;let d=this._rate!==void 0&&this._rate>=0?ws(this._rate):"";o((Number.isFinite(p)?qe(p):"\u2026")+(d!==""?" \xB7 "+d:""))},done(p){e.dataset.active="",e.dataset.state="done",i.style.width="100%",f=100,g(),o(p!==void 0&&p!==""?p:"\u5B8C\u6210")},fail(p){e.dataset.active="",e.dataset.state="error",g(),o(p!==void 0&&p!==""?p:"\u5931\u8D25")},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",n.textContent=""):(e.dataset.active="",i.style.width="",f=-1,o(p))}}}async function Ga(e,t,i,n=0,h=null){let s=n>0?n*1024*1024:0,r=typeof AbortController=="function"?new AbortController:null,a=!1;r!==null&&(t={...t,signal:r.signal},typeof h=="function"&&h(()=>{a=!0,r.abort()}));let f=await fetch(e,t);if(!f.ok){let d="HTTP "+f.status;try{let l=await f.json();l!==null&&typeof l=="object"&&typeof l.error=="string"&&(d=l.error)}catch{}throw new Error(d)}let o=Number(f.headers.get("content-length")),_=Number.isFinite(o)&&o>0;if(s>0&&_&&o>s){try{await f.body?.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+qe(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}let g=f.body;if(g===null||typeof g.getReader!="function"){let d=await f.blob();if(s>0&&d.size>s)throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+qe(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync");return _&&i(o,o),d}let S=g.getReader(),p=[],c=0;try{for(;;){let{done:d,value:l}=await S.read();if(d)break;if(l!==void 0&&l.byteLength>0){if(c+=l.byteLength,s>0&&c>s){try{await S.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+qe(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}p.push(l),i(c,_?o:NaN)}}}catch(d){if(a||d!==null&&typeof d=="object"&&d.name==="AbortError"){try{await S.cancel()}catch{}throw new oi}throw d}return new Blob(p,{type:"application/octet-stream"})}var oi=class extends Error{constructor(){super("\u5DF2\u53D6\u6D88"),this.name="TransferCanceledError"}};function Wr(e){return e instanceof oi}function Va(e,t){let i=URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}async function fu(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],i=[];for(let o of t){let _=typeof o.webkitGetAsEntry=="function"?o.webkitGetAsEntry():null;_!==null&&i.push(_)}if(i.length===0)return[...e.files??[]].map(o=>({relPath:o.name,file:o}));let n=[],h=kt.maxUploadFiles,s=kt.maxUploadMb>0?kt.maxUploadMb*1024*1024:0,r=()=>h>0&&n.length>=h,a=0,f=(o,_)=>new Promise(g=>{if(r()){g();return}if(o.isFile===!0){o.file(c=>{s>0&&a+(c.size??0)>s?n._limitExceeded=!0:(n.push({relPath:_+o.name,file:c}),a+=c.size??0),g()},()=>g());return}if(o.isDirectory!==!0){g();return}let S=o.createReader(),p=()=>{S.readEntries(async c=>{if(c.length===0){g();return}for(let d of c){if(r())break;await f(d,_+o.name+"/")}if(r()){g();return}p()},()=>g())};p()});for(let o of i)await f(o,"");return n}function en(e){if(Qr())return;let t=e!==null&&typeof e=="object"?e:{},i={};if(typeof t.name=="string"&&t.name!=="")i.name=t.name;else{for(let A of["host","username","auth","keyPath","passphrase","password"])typeof t[A]=="string"&&t[A]!==""&&(i[A]=t[A]);let U=Number(t.port);Number.isInteger(U)&&U>=1&&U<=65535&&(i.port=U),t.agentForward===!0&&(i.agentForward=!0)}let n=i.name??(i.username!==void 0?i.username+"@"+String(i.host??""):String(i.host??""));if(Ia==="dual"){hu(i,n);return}let h=document.createElement("div");h.className="tt_sftpCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let r=document.createElement("div");r.className="tt_sshTitle",r.innerHTML=Mi+"<span></span>",r.lastElementChild.textContent="SFTP \xB7 "+n;let a=document.createElement("button");a.type="button",a.className="tt_close",a.title="\u5173\u95ED",a.innerHTML=Ps,a.addEventListener("click",Ft),s.appendChild(r),s.appendChild(a),h.appendChild(s);let f=document.createElement("div");f.className="tt_sftpBar";let o=document.createElement("input");o.type="text",o.className="tt_sftpPath",o.placeholder="\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",o.spellcheck=!1,o.autocomplete="off";let _=document.createElement("button");_.type="button",_.className="tt_toolBtn",_.innerHTML=qr+"<span>\u5237\u65B0</span>";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.innerHTML=Sa+"<span>\u65B0\u5EFA\u76EE\u5F55</span>";let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.innerHTML=Cd+"<span>\u4E0A\u4F20</span>",S.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let p=document.createElement("input");p.type="file",p.multiple=!0,p.style.display="none",f.appendChild(o),f.appendChild(_),f.appendChild(g),f.appendChild(S),h.appendChild(f),h.appendChild(p);let c=document.createElement("div");c.className="tt_sftpEditor",c.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",c.appendChild(d),c.appendChild(l),c.appendChild(u),h.appendChild(c);let v=null,C=()=>{c.style.display="none",v=null};l.addEventListener("click",()=>{v?.()}),u.addEventListener("click",C),d.addEventListener("keydown",U=>{U.key==="Enter"?(U.preventDefault(),v?.()):U.key==="Escape"&&(U.stopPropagation(),C())});let w=document.createElement("div");w.className="tt_sftpList",h.appendChild(w);let y=document.createElement("div");y.className="tt_sftpFoot";let m=document.createElement("div");m.className="tt_sftpStatus";let x=Ka();y.appendChild(x.el),y.appendChild(m),h.appendChild(y);let T={path:"",busy:!1},I=(U,A)=>{m.textContent=U,A===void 0?delete m.dataset.state:m.dataset.state=A},F=U=>{T.busy=U;for(let A of[_,g,S])A.disabled=U;o.disabled=U},R=async(U,A)=>{let k=await fetch("/api/dsh-tty/sftp/"+U,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,...A})}),N=await k.json().catch(()=>({}));if(!k.ok||N.ok!==!0)throw new Error(String(N.error||"HTTP "+k.status));return N},z=async(U,A)=>{if(!T.busy){F(!0),I(U,"busy");try{await A()}catch(k){I(String(k&&k.message?k.message:k),"error")}finally{F(!1)}}},B=(U,A,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let q=document.createElement("span");q.className="tt_sftpIcon",q.innerHTML=U,N!==void 0&&(q.dataset.kind=N);let j=document.createElement("span");if(j.className="tt_sftpName",j.textContent=A,j.title=A,H.appendChild(q),H.appendChild(j),k!==""){let Q=document.createElement("span");Q.className="tt_sftpMeta",Q.textContent=k,H.appendChild(Q)}return H},D=(U,A,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=A,H.title=k,H.addEventListener("click",q=>{q.stopPropagation(),N()}),U.appendChild(H)},O=(U,A,k)=>{let N=document.createElement("button");N.type="button",N.className="tt_sftpAct",N.innerHTML=ei,N.title="\u5220\u9664 "+A.name+(A.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let H=null;N.addEventListener("click",q=>{if(q.stopPropagation(),!T.busy){if(H!==null){clearTimeout(H),H=null,N.innerHTML=ei,delete N.dataset.danger,z("\u5220\u9664 "+A.name+"\u2026",async()=>{await R("remove",{path:k,recursive:A.isDir===!0}),await b(T.path),I("\u5DF2\u5220\u9664 "+A.name)});return}N.textContent="\u786E\u8BA4?",N.dataset.danger="",H=setTimeout(()=>{H=null,N.innerHTML=ei,delete N.dataset.danger},4e3)}}),U.appendChild(N)},P=U=>{if(w.textContent="",T.path!==""&&T.path!=="/"){let k=B(Ur,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");k.addEventListener("click",()=>{z("\u52A0\u8F7D\u4E2D\u2026",()=>b(qa(T.path)))}),w.appendChild(k)}let A=Array.isArray(U)?U:[];if(A.length===0){let k=document.createElement("div");k.className="tt_addMenuTitle",k.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",w.appendChild(k);return}for(let k of A){if(k===null||typeof k!="object"||typeof k.name!="string"||k.name==="")continue;let N=bi(T.path,k.name),H=[];k.isDir===!0?H.push("\u76EE\u5F55"):H.push(qe(Number(k.size))||"\u2014");let q=ja(Number(k.mtime));q!==""&&H.push(q);let j=B(k.isDir?Mi:k.isSymlink?ba:ma,k.name,H.join(" \xB7 "),k.isDir===!0?"dir":k.isSymlink===!0?"link":"file");k.isDir===!0?j.addEventListener("click",Q=>{Q.target instanceof Element&&Q.target.closest(".tt_sftpAct")!==null||z("\u52A0\u8F7D\u4E2D\u2026",()=>b(N))}):(j.addEventListener("click",Q=>{Q.target instanceof Element&&Q.target.closest(".tt_sftpAct")!==null||E(k,N)}),D(j,wa,"\u4E0B\u8F7D "+k.name,()=>{E(k,N)})),D(j,jr,"\u91CD\u547D\u540D "+k.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=k.name,c.style.display="",d.focus(),d.select(),v=async()=>{let Q=d.value.trim();Q===""||Q===k.name||(C(),await z("\u91CD\u547D\u540D "+k.name+"\u2026",async()=>{await R("rename",{from:N,to:bi(T.path,Q)}),await b(T.path)}))}}),O(j,k,N),w.appendChild(j)}},b=async U=>{try{let A=await R("list",{path:U??T.path});T.path=typeof A.path=="string"&&A.path!==""?A.path:"/",o.value=T.path;let k=Array.isArray(A.entries)?A.entries.length:0;P(A.entries),I(T.path+" \u2014 "+String(k)+" \u9879")}catch(A){I(String(A&&A.message?A.message:A),"error")}},E=(U,A)=>z("\u4E0B\u8F7D "+U.name+"\u2026",async()=>{x.reset();let k;try{k=await Ga("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,path:A})},(N,H)=>{x.set(N,H)},kt.maxDownloadMb,N=>x.setCancel(N))}catch(N){if(Wr(N)){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+U.name);return}throw x.fail("\u4E0B\u8F7D\u5931\u8D25"),N}x.done("\u5B8C\u6210"),Va(k,U.name),setTimeout(()=>x.reset(),1500),I("\u5DF2\u4E0B\u8F7D "+U.name+"\uFF08"+(qe(k.size)||String(k.size)+" B")+"\uFF09")}),L=(U,A,k,N,H)=>new Promise((q,j)=>{let Q=uu(JSON.stringify({...i,path:bi(T.path,A)})),ee=new XMLHttpRequest;H.abort=()=>{H.stopped=!0,ee.abort()},ee.open("POST","/api/dsh-tty/sftp/upload"),ee.setRequestHeader("x-dsh-sftp-meta",Q);let G=N>1?String(k)+"/"+String(N)+" ":"";I("\u4E0A\u4F20 "+G+A,"busy"),ee.upload.addEventListener("progress",oe=>{oe.lengthComputable?x.set(oe.loaded,oe.total):x.pulse(0)});let J=!1,Z=oe=>{J||(J=!0,oe===null?q():j(oe))};ee.addEventListener("load",()=>{if(ee.status===200){N===1&&x.done("\u4E0A\u4F20\u5B8C\u6210"),Z(null);return}if(H.stopped)return;x.fail("\u4E0A\u4F20\u5931\u8D25");let oe="HTTP "+ee.status;try{let ae=JSON.parse(ee.responseText);ae!==null&&typeof ae=="object"&&typeof ae.error=="string"&&(oe=ae.error)}catch{}Z(new Error(oe))}),ee.addEventListener("error",()=>{if(H.stopped){Z(new oi);return}x.fail("\u4E0A\u4F20\u5931\u8D25"),Z(new Error("\u7F51\u7EDC\u9519\u8BEF"))}),ee.addEventListener("abort",()=>{Z(new oi)}),ee.send(U)}),M=async U=>z("\u4E0A\u4F20\u4E2D\u2026",async()=>{let A=kt;if(A.maxUploadFiles>0&&U.length>A.maxUploadFiles){I("\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08"+String(A.maxUploadFiles)+"\uFF09\uFF1A\u672C\u6B21 "+String(U.length)+" \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","error"),x.fail("\u8D85\u9650");return}let k=A.maxUploadMb>0?A.maxUploadMb*1024*1024:0,N=U.find(ee=>k>0&&(ee.file?.size??0)>k);if(N!==void 0){I("\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08"+qe(k)+"\uFF09\uFF1A"+String(N.relPath??"")+"\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error"),x.fail("\u8D85\u9650");return}if(U._limitExceeded===!0){I("\u6587\u4EF6\u603B\u5927\u5C0F\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF1A\u8BF7\u5206\u6279\u4E0A\u4F20\uFF08\u6216\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\uFF09","error"),x.fail("\u8D85\u9650");return}let H=new Set;for(let ee of U){let G=ee.relPath.lastIndexOf("/");if(G<=0)continue;let J=ee.relPath.slice(0,G);H.has(J)||(H.add(J),await R("mkdir",{path:bi(T.path,J),parents:!0}).catch(()=>{}))}x.reset();let q={stopped:!1,abort:null};x.setCancel(()=>q.abort?.());let j=0,Q=0;try{for(let ee of U){if(q.stopped)break;j+=1,q.abort=null;try{await L(ee.file,ee.relPath,j,U.length,q),Q+=1}catch(G){if(Wr(G)||q.stopped)break;throw G}}}finally{x.setCancel(null)}if(q.stopped){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 "+String(Q)+"/"+String(U.length)+" \u4E2A\uFF09"),await b(T.path);return}x.done("\u5168\u90E8\u5B8C\u6210"),setTimeout(()=>x.reset(),1500),I("\u4E0A\u4F20\u5B8C\u6210 "+String(U.length)+" \u4E2A\u6587\u4EF6"),await b(T.path)});_.addEventListener("click",()=>{z("\u52A0\u8F7D\u4E2D\u2026",()=>b(T.path))}),g.addEventListener("click",()=>{T.busy||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",c.style.display="",d.focus(),v=async()=>{let U=d.value.trim();U!==""&&(C(),await z("\u521B\u5EFA\u76EE\u5F55 "+U+"\u2026",async()=>{await R("mkdir",{path:bi(T.path,U)}),await b(T.path)}))})}),S.addEventListener("click",()=>{T.busy===!1&&p.click()}),p.addEventListener("change",()=>{let U=[...p.files??[]].map(A=>({relPath:A.name,file:A}));p.value="",U.length>0&&M(U)});let $=0,K=U=>{U?w.dataset.drag="":delete w.dataset.drag};h.addEventListener("dragenter",U=>{U.preventDefault(),$+=1,K(!0)}),h.addEventListener("dragover",U=>{U.preventDefault()}),h.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&K(!1)}),h.addEventListener("drop",U=>{U.preventDefault(),$=0,K(!1),!T.busy&&fu(U.dataTransfer).then(A=>{(A.length>0||A._limitExceeded===!0)&&M(A)})}),o.addEventListener("keydown",U=>{if(U.key!=="Enter"||(U.preventDefault(),T.busy))return;let A=o.value.trim();A!==""&&z("\u52A0\u8F7D\u4E2D\u2026",()=>b(A))});let Y=Vr();Ua(h,"SFTP \xB7 "+n,Y===null?340:Math.round(Y.height*.46)),z("\u8FDE\u63A5\u4E2D\u2026",()=>b(""))}function Ft(){if(!Qr())return;du();let e=Di,t=Ts;Di=null,Ts=null,e!==null&&e.remove(),t!==null&&t.dispose()}function Ya(){if(De===null)return;let e=De.style.display==="none"||De.style.display==="";De.style.display=e?"":"none";let t=se!==null?se.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&De.focus()}var _u={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function pu(e){let t=je();if(t===void 0||t.search===void 0)return;let i=De.value;if(i==="")return;let n={decorations:_u};e?t.search.findPrevious(i,n):t.search.findNext(i,n)}function _a(){Ri||se===null&&!Kr()||Tt!==null||(Tt=setTimeout(()=>{Tt=null,As()},xi),xi=Math.min(xi*2,5e3))}function Fi(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function $r(e){return Fi(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function gu(){return Bt==="tmux"?{t:"spawn",cwd:ha(),persist:!0,persistName:Jr()}:{t:"spawn",cwd:ha()}}async function Xa(){if(await Zr(),se===null){await mu();return}let e=zd(),t=$d();if(![...re.values()].some(r=>r.embedded!==!0)){if(e.length>0||t.length>0){ge({t:"sessions"});let r=await Ls("sessions",4e3),a=new Map;if(r!==null&&Array.isArray(r.list))for(let o of r.list)o!==null&&typeof o=="object"&&o.attachable===!0&&a.set(o.sid,o);let f=new Set;for(let o of e){if(a.has(o.sid))qd(o);else if($r(o.spawnSpec))da(o);else continue;Fi(o.spawnSpec)&&f.add(o.spawnSpec.persistName)}for(let o of t){let _=o.spawnSpec.persistName;f.has(_)||(da(o),f.add(_))}Ht()}if(![...re.values()].some(r=>r.embedded!==!0)){if(await Rs())return;Ti()}return}let i=[...re.values()].filter(r=>!r.exited&&(r.embedded!==!0||r.spawned===!0)),n=i.filter(r=>$r(r.spawnSpec)),h=null;if(n.length>0){ge({t:"sessions"});let r=await Ls("sessions",4e3),a=new Set((r!==null&&Array.isArray(r.list)?r.list:[]).map(f=>f?.sid).filter(f=>typeof f=="string"));h=n.filter(f=>!a.has(f.sid));for(let f of h)Gr(f.sid)}let s=h!==null?new Set(h.map(r=>r.sid)):new Set;for(let r of i)s.has(r.sid)||ge({t:"attach",sid:r.sid})}function vu(){he!==null&&(he.readyState===WebSocket.OPEN||he.readyState===WebSocket.CONNECTING)||As()}async function mu(){let e=[...re.values()].filter(n=>n.embedded===!0&&!n.exited);if(e.length===0)return;ge({t:"sessions"});let t=await Ls("sessions",4e3),i=new Set((t!==null&&Array.isArray(t.list)?t.list:[]).map(n=>n?.sid).filter(n=>typeof n=="string"));for(let n of e)n.spawned===!0&&(i.has(n.sid)?ge({t:"attach",sid:n.sid}):$r(n.spawnSpec)?Ba(n):(n.exited=!0,n.live=!1,Jt(n,"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","\u70B9\u51FB\u91CD\u65B0\u6267\u884C","exited")))}function As(){if(he!==null){try{he.close()}catch{}he=null}Ri=!1,clearTimeout(Tt),Tt=null,ps=!0,Mt("\u8FDE\u63A5\u4E2D\u2026","");try{he=new WebSocket(ud())}catch(e){ps=!1,Mt("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),_a();return}he.onopen=()=>{ps=!1,xi=1e3,Ge=null,Mt("\u5DF2\u8FDE\u63A5","connected");for(let e of[...Pr])Pr.delete(e),re.has(e.tab.sid)&&ge(e.frame);Xa()},he.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let i=t.sid;if(t.t==="ready"){let n=typeof t.target=="string"?t.target:"";Mt(t.kind==="ssh"?"SSH "+(n!==""?n+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let h=re.get(i);if(h!==void 0){if(h.exited=!1,h.spawned=!0,h.live=!0,h.errored=!1,h.target=n,h.persistTmux=t.persist===!0,t.kind==="ssh"&&n!==""&&!h.label&&(h.label=n,rt()),Dt(),Br(i),Jt(h,""),ai(h),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(r=>setTimeout(r,500))]).then(()=>Ra(150))}Bi(),Hd(i),Ht()}}else if(t.t==="data"){let n=re.get(i);n!==void 0&&n.term!==null&&(n.term.write(String(t.d??"")),Su())}else if(t.t==="exit"){let n=re.get(i);if(n!==void 0){n.exited=!0,n.live=!1,n.stats=null,i===_t&&Nt();let h=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";Mt("\u5DF2\u9000\u51FA "+[h,s].filter(Boolean).join(" "),""),Dt(),Br(i),Jt(n,"\u4F1A\u8BDD\u5DF2\u9000\u51FA","\u70B9\u51FB\u91CD\u65B0\u6253\u5F00","exited"),Bi(),Ht()}}else if(t.t==="stats")try{let n=re.get(i);if(n!==void 0){let h=t.stats;n.stats=Dd(h)?h:null,n.statsAt=Date.now(),i===_t&&Nt()}}catch(n){console.warn("[dsh-tty] stats \u5E27\u5904\u7406\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: "+(n instanceof Error?n.message:String(n)))}else if(t.t==="error")if(Mt("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof i=="string"){let n=re.get(i);n!==void 0&&(n.live||(n.errored=!0),Dt(),Br(i),Jt(n,"\u8FDE\u63A5\u51FA\u9519",String(t.m??"")+" \xB7 \u70B9\u51FB\u91CD\u8BD5","error"))}else bu("\u70B9\u51FB\u91CD\u8BD5")},he.onclose=()=>{if(ps=!1,!Ri){Mt("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of re.values())e.exited||Jt(e,"\u8FDE\u63A5\u65AD\u5F00","\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","info");_a()}},he.onerror=()=>{}}function bu(e){ti!==null&&(ti.textContent=e)}function tn(){if(se!==null){Ie&&Ja();return}Oi(),se=document.createElement("div"),se.className="tt_modalBackdrop",se.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+Bs+'</span><div class="tt_tabs"></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+fd+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+_d+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+pd+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+gd+'</button></span><span class="tt_winGroup"><button class="tt_min" title="\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09">'+wd+'</button><button class="tt_close" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">'+Ps+'</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_overlay"></div></div></div></div>',document.body.appendChild(se),Ss=se.querySelector(".tt_status"),ri=se.querySelector(".tt_statusText"),Ot=se.querySelector(".tt_statusDot"),Ct=se.querySelector(".tt_tabs"),wi=se.querySelector(".tt_connbar"),Si=se.querySelector(".tt_connDot"),Cs=se.querySelector(".tt_connTarget"),$e=se.querySelector(".tt_connBadge"),Ci=se.querySelector(".tt_connActions"),xt=se.querySelector(".tt_work"),ze=se.querySelector(".tt_body"),it=se.querySelector(".tt_statsBar"),Ge=null,Id(),ti=se.querySelector(".tt_body > .tt_overlay"),De=se.querySelector(".tt_searchInput"),ti.addEventListener("click",()=>{ti.textContent="",As()});let e=se.querySelector("[data-act=search]");e.addEventListener("click",()=>{Ya(),De.style.display!=="none"&&De.focus()}),e.dataset.on="",De.addEventListener("keydown",t=>{t.key==="Enter"?(t.preventDefault(),pu(t.shiftKey)):t.key==="Escape"&&(t.stopPropagation(),De.style.display="none")}),se.querySelector("[data-act=clear]").addEventListener("click",()=>{let t=je();t!==void 0&&t.term!==null&&t.term.clear()}),se.querySelector("[data-act=copy]").addEventListener("click",()=>{let t=je();if(t===void 0||t.term===null)return;let i=t.term.getSelection();i!==""&&navigator.clipboard.writeText(i).catch(()=>{})}),se.querySelector("[data-act=paste]").addEventListener("click",()=>{let t=je();t!==void 0&&navigator.clipboard.readText().then(i=>{ge({t:"input",sid:t.sid,d:i})}).catch(()=>{})}),se.querySelector(".tt_min").addEventListener("click",()=>{zr()}),se.querySelector(".tt_close").addEventListener("click",()=>{Pi()}),se.addEventListener("mousedown",t=>{t.target===se&&zr()}),document.addEventListener("keydown",Za),yi=new ResizeObserver(()=>{Ie||(vs(),Ud(je()))}),yi.observe(ze),rt(),Dt(),he!==null&&he.readyState===WebSocket.OPEN?Xa():As()}function wu(){Te=document.createElement("div"),Te.className="tt_dock",Te.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",Te.innerHTML='<span class="tt_dockTitle">'+Bs+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button>',ys=Te.querySelector(".tt_dockCount"),ni=Te.querySelector(".tt_dockStatus"),It=Te.querySelector(".tt_dockDot");let e=[...re.values()].filter(t=>!t.exited).length;ys.textContent=re.size>0?"\xB7 "+e+"/"+re.size:"",ri!==null&&(ni.textContent=ri.textContent),Ot!==null&&(It.dataset.state=Ot.dataset.state??""),Te.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),Pi();return}Ja()}),document.body.appendChild(Te)}function zr(){se===null||Ie||(st(),St(),Ft(),Ie=!0,De!==null&&(De.style.display="none"),se.dataset.minimized="",Ni(),Nt(),document.querySelector("[data-dsh-tty-entry]")!==null?Bi():(wu(),Te.classList.add("tt_dockCompact")))}function Bi(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Ie){t!==null&&t.remove(),delete e.dataset.minimized,e.removeAttribute("title");return}t===null&&(t=document.createElement("span"),t.className="tt_sidebarEntryBadge",t.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',e.appendChild(t)),e.dataset.minimized="",e.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let i=[...re.values()].filter(h=>!h.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=i+"/"+re.size;let n=t.querySelector(".tt_sidebarBadgeDot");n!==null&&Ot!==null&&(n.dataset.state=Ot.dataset.state??"")}function Su(){if(!Ie)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??It;e!==null&&(e.dataset.active="",clearTimeout(xs),xs=setTimeout(()=>{delete e.dataset.active},900))}function Ja(){if(se===null||!Ie)return;Ie=!1,delete se.dataset.minimized,clearTimeout(xs),Te!==null&&(Te.remove(),Te=null),ys=null,ni=null,It=null,Bi(),Ni(),Nt();let e=je();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&ai(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Pi(){if(se===null)return;ms(!0);let e=Kr();if(Ri=!e,Ie=!1,st(),St(),Ft(),clearTimeout(xs),clearTimeout(Tt),Tt=null,xi=1e3,Te!==null&&(Te.remove(),Te=null),ys=null,ni=null,It=null,Bi(),he!==null){for(let t of re.values())!t.exited&&t.embedded!==!0&&ge({t:"kill",sid:t.sid});if(!e){try{he.close()}catch{}he=null}}yi!==null&&(yi.disconnect(),yi=null);for(let[t,i]of[...re])if(i.embedded!==!0){if(i.term!==null)try{i.term.dispose()}catch{}re.delete(t)}_t=null,document.removeEventListener("keydown",Za),se.remove(),se=null,xt=null,Ss=null,ri=null,Ot=null,Ct=null,wi=null,Si=null,Cs=null,$e=null,Ci=null,Nr(),Nd(),it=null,Ge=null,ze=null,ti=null,De=null,Os=0;try{sessionStorage.removeItem(ks)}catch{}}function Za(e){if(e.key==="Escape"&&se!==null){if(e.preventDefault(),Di!==null){Ft();return}if(ii!==null){St();return}if(Ue!==null){st();return}zr()}}function Cu(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function yu(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let i of e.children)if(i.tagName==="BUTTON")return i}function xu(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label","\u7EC8\u7AEF"),e.innerHTML='<span class="tt_sidebarEntryIcon">'+Bs+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),tn()}),e}function pa(e,t){let i=yu(e);if(i===void 0)return!1;if(t.parentElement!==e){let n=i.closest('[class*="logoRow"]'),h=n!==null&&n.parentElement===e?n:i,s=Array.from(e.children).filter(r=>r instanceof HTMLElement&&r.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(s.length>0){let r=s[s.length-1];e.insertBefore(t,r.nextSibling)}else e.insertBefore(t,h.nextElementSibling)}return!0}function ku(){if(Oi(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=xu(),t,i=!1,n=()=>{if(t!==void 0&&!t.isConnected&&(s.disconnect(),t=void 0,i=!1),i){if(document.body.contains(e))return;s.disconnect(),t=void 0,i=!1}t??(t=Cu()),t!==void 0&&(i=pa(t,e),i&&s.observe(t,{childList:!0,subtree:!0}))},h=new MutationObserver(()=>{n()});h.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){i=!1,n();return}t.contains(e)||(i=pa(t,e))});return n(),()=>{h.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},i=e("react"),{jsx:n,jsxs:h}=e("react/jsx-runtime"),s="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function r(){let[a,f]=i.useState(!1),[o,_]=i.useState(null),[g,S]=i.useState(!1),[p,c]=i.useState(!1),[d,l]=i.useState({kind:"",text:""}),[u,v]=i.useState([]),[C,w]=i.useState(!1),y=W=>n("div",{className:"tt_cardSection",children:W}),m=async()=>{try{let V=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();V.ok&&typeof V.config=="object"&&V.config!==null?(_(V.config),Ai(V.config)):l({kind:"error",text:String(V.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},x=async()=>{try{let V=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();V.ok&&Array.isArray(V.shells)&&v(V.shells)}catch{}};i.useEffect(()=>{a&&!g&&(S(!0),m(),x())},[a]);let T=(W,V)=>_(X=>({...X||{},[W]:V})),I=(W,V)=>_(X=>({...X||{},sftpLimits:{...X?.sftpLimits??{},[W]:V}})),[F,R]=i.useState(null),[z,B]=i.useState(null),[D,O]=i.useState(""),[P,b]=i.useState({}),[E,L]=i.useState([]),[M,$]=i.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});i.useEffect(()=>{if(!a)return;let W=!0,V=async()=>{try{let ne=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();W&&ne.ok&&Array.isArray(ne.tunnels)&&L(ne.tunnels)}catch{}};V();let X=setInterval(V,2e3);return()=>{W=!1,clearInterval(X)}},[a]);let K=W=>V=>$(X=>({...X||{},[W]:V.target.value})),Y=W=>W?.direction==="remote"?`\u8FDC\u7A0B:${W.remoteHost||"127.0.0.1"}:${String(W.remotePort??0)} \u2192 \u672C\u673A:${String(W.localTargetPort??0)}`:`\u672C\u673A:${String(W?.localPort??0)} \u2192 ${W?.remoteHost??"?"}:${String(W?.remotePort??0)}`,U=(o?.sshHosts??[]).find(W=>W?.name===M?.bookName),A=async W=>{try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:W})}),X=await V.json().catch(()=>({}));return!V.ok||!X.ok?(l({kind:"error",text:String(X.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(V){return l({kind:"error",text:String(V&&V.message?V.message:V)}),!1}},k=()=>{l({kind:"",text:""});let W=M||{},V=W.bookName||(Array.isArray(o?.sshHosts)?o.sshHosts[0]?.name:"")||"";if(V===""){l({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let X=me=>{let le=Number(me);return Number.isInteger(le)&&le>=1&&le<=65535?le:0},te;if(W.direction==="remote"){if(te={name:"",bookName:V,direction:"remote",remotePort:X(W.remotePort),localTargetHost:"",localTargetPort:X(W.localTargetPort),enabled:!0},te.remotePort<1||te.localTargetPort<1){l({kind:"error",text:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09"});return}te.name=`${V}-R${String(te.remotePort)}`}else{if(te={name:"",bookName:V,direction:"local",localPort:X(W.localPort),remoteHost:W.remoteHost.trim(),remotePort:X(W.remotePort),enabled:!0},te.localPort<1||te.remoteHost===""||te.remotePort<1){l({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}te.name=`${V}-L${String(te.localPort)}`}let ne=new Set((Array.isArray(o?.tunnels)?o.tunnels:[]).map(me=>me?.name)),ce=te.name,ve=2;for(;ne.has(ce);)ce=`${te.name}-${String(ve)}`,ve+=1;te.name=ce;let ie=[...Array.isArray(o?.tunnels)?o.tunnels:[],te];_(me=>({...me||{},tunnels:ie})),$(me=>({...me||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),A(ie).then(me=>{me&&l({kind:"ok",text:`\u96A7\u9053\u300C${ce}\u300D\u5DF2\u751F\u6548`})})},N=W=>{let V=(Array.isArray(o?.tunnels)?o.tunnels:[]).filter(X=>X?.name!==W);_(X=>({...X||{},tunnels:V})),A(V)},H=(W,V)=>{let X=(Array.isArray(o?.tunnels)?o.tunnels:[]).map(te=>te?.name===W?{...te,enabled:V}:te);_(te=>({...te||{},tunnels:X})),A(X)},q=W=>{R(W?.name??null),O(""),B({name:W?.name??"",host:W?.host??"",port:String(W?.port??22),username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0})},j=()=>{R(null),B(null),O("")},Q=()=>{if(z===null)return;let W=z.name.trim(),V=z.host.trim(),X=z.username.trim();if(W===""||V===""||X===""){O("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let te=Number(z.port);if((!Number.isInteger(te)||te<1||te>65535)&&(te=22),(o?.sshHosts??[]).some(ne=>ne?.name===W&&W!==F)){O("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+W);return}if(z.auth==="key"&&z.keyPath.trim()===""){O("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}_(ne=>({...ne||{},sshHosts:(Array.isArray(ne?.sshHosts)?ne.sshHosts:[]).map(ce=>ce?.name===F?{name:W,host:V,port:te,username:X,auth:z.auth,keyPath:z.keyPath.trim(),passphrase:z.passphrase,password:z.password,agentForward:z.agentForward}:ce)})),R(null),B(null),O(""),l({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+W+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},ee=W=>{F===W&&j(),b(V=>{let X={...V};return delete X[W],X}),_(V=>({...V||{},sshHosts:(Array.isArray(V?.sshHosts)?V.sshHosts:[]).filter(X=>X?.name!==W)}))},G=async W=>{let V=W?.name??"";if(V==="")return;let X={host:W?.host??"",port:Number(W?.port)||22,username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0};b(ne=>({...ne,[V]:{running:!0,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}}));let te=await Wa(X,!0);b(ne=>{let ce=ne[V]||{};if(te.result){let ve=te.result.auth?.ok===!0;return{...ne,[V]:{running:!1,ok:ve,text:$a(te.result)}}}return{...ne,[V]:{running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(te.error||"\u672A\u77E5\u9519\u8BEF")}}})},J=async W=>{let V=(Array.isArray(o?.hostKeys)?o.hostKeys:[]).filter(X=>!(X?.host===W?.host&&Number(X?.port)===Number(W?.port)));_(X=>({...X||{},hostKeys:V}));try{let X=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:V})}),te=await X.json().catch(()=>({}));!X.ok||!te.ok?l({kind:"error",text:String(te.error||"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25")}):l({kind:"ok",text:"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09"})}catch(X){l({kind:"error",text:String(X&&X.message?X.message:X)})}},Z=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(o?.sshHosts)?o.sshHosts:[]],ne=new Set(te.map(ie=>ie?.name)),ce=0,ve=0;for(let ie of X)if(!(ie===null||typeof ie!="object"||typeof ie.name!="string")){if(ne.has(ie.name)){ve+=1;continue}ne.add(ie.name),te.push({name:ie.name,host:String(ie.host??ie.name),port:Number(ie.port)||22,username:String(ie.username??""),auth:ie.auth==="key"?"key":"agent",keyPath:String(ie.keyPath??""),passphrase:"",password:"",agentForward:!1}),ce+=1}_(ie=>({...ie||{},sshHosts:te})),l(ce===0?{kind:"ok",text:ve>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${ve} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09`:"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"}:{kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ce} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${ve} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},oe=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(o?.hostKeys)?o.hostKeys:[]],ne=new Set(te.map(ie=>String(ie?.host??"")+":"+String(ie?.port??22))),ce=0,ve=0;for(let ie of X){if(ie===null||typeof ie!="object"||typeof ie.host!="string"||typeof ie.fingerprint!="string")continue;let me=ie.host+":"+String(ie.port??22);if(ne.has(me)){ve+=1;continue}ne.add(me),te.push({host:ie.host,port:Number(ie.port)||22,fingerprint:ie.fingerprint}),ce+=1}if(ce===0){l({kind:"ok",text:ve>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${ve} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}_(ie=>({...ie||{},hostKeys:te}));try{let ie=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:te})}),me=await ie.json().catch(()=>({}));if(!ie.ok||!me.ok){l({kind:"error",text:String(me.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}l({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ce} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${ve} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(ie){l({kind:"error",text:String(ie&&ie.message?ie.message:ie)})}}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},ae=async()=>{c(!0),l({kind:"",text:""});let W={};for(let V of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose","statsEnabled"]){let X=(o||{})[V];X!==void 0&&X!==""&&(W[V]=X)}W.sshHosts=Array.isArray(o?.sshHosts)?o.sshHosts:[],W.tunnels=Array.isArray(o?.tunnels)?o.tunnels:[],o?.sftpLimits&&typeof o.sftpLimits=="object"&&(W.sftpLimits={maxDownloadMb:Number(o.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(o.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(o.sftpLimits.maxUploadFiles)||0});try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(W)}),X=await V.json();!V.ok||!X.ok?l({kind:"error",text:String(X.error||"\u4FDD\u5B58\u5931\u8D25")}):(l({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),X.config&&(_(X.config),Ai(X.config)))}catch(V){l({kind:"error",text:String(V&&V.message?V.message:V)})}c(!1)},be=()=>{if(z===null)return null;let W=(V,X,te,ne)=>h("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:V}),n("input",{className:"tt_cardInput",type:ne??"text",value:z[X]??"",placeholder:te??"",autoComplete:"off",spellCheck:!1,onChange:ce=>B(ve=>({...ve||{},[X]:ce.target.value}))})]});return h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_sshGrid",children:[W("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),W("\u7AEF\u53E3","port","22")]}),W("\u4E3B\u673A","host","example.com \u6216 IP"),W("\u7528\u6237\u540D","username","root"),h("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),h("select",{className:"tt_cardInput",value:z.auth,onChange:V=>B(X=>({...X||{},auth:V.target.value})),children:[n("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),n("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),n("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...z.auth==="key"?[W("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),W("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...z.auth==="password"?[W("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],h("label",{className:"tt_cardRow",children:[n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z.agentForward===!0,onChange:V=>B(X=>({...X||{},agentForward:V.target.checked}))}),n("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),D!==""?n("span",{className:"tt_cardMessage tt_cardMessageError",children:D}):null,h("div",{className:"tt_cardRow",children:[n("button",{type:"button",className:"tt_cardSave",onClick:Q,children:"\u5E94\u7528"}),n("button",{type:"button",className:"tt_toolBtn",onClick:j,children:"\u53D6\u6D88"})]})]})},Se=(W,V,X,te)=>h("label",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:W}),n("input",{className:"tt_cardInput",value:o[V]??"",placeholder:X??"",onChange:ne=>T(V,ne.target.value)}),te?n("span",{className:"tt_cardHint",children:te}):null]}),fe=(W,V)=>h("label",{className:"tt_cardField tt_cardRow",children:[n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:o[V]===!0,onChange:X=>T(V,X.target.checked)}),n("span",{className:"tt_cardLabel",children:W})]});return h("li",{className:a?"tt_card tt_cardOpen":"tt_card",children:[h("button",{type:"button",className:"tt_cardHeader","aria-expanded":a,onClick:()=>f(W=>!W),children:[h("span",{className:"tt_cardHeadText",children:[n("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),n("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\u3001SSH \u8FDE\u63A5\u7C3F\u4E0E\u4E3B\u673A\u6307\u7EB9\u9489\u624E\u3001tmux \u4F1A\u8BDD\u6301\u4E45\u5316\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),n("span",{className:"dshkit_badge",children:"Kit"}),n("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:n("path",{d:s,fill:"currentColor"})})]}),a?h("div",{className:"tt_cardBody",children:[o===null?n("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):h("div",{children:[y("\u57FA\u7840"),fe("\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","enabled"),fe("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),fe("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),y("SFTP \u6587\u4EF6\u4F20\u8F93"),h("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),h("select",{className:"tt_cardInput",value:o.sftpStyle==="dual"?"dual":"dialog",onChange:W=>T("sftpStyle",W.target.value),children:[n("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),n("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),n("span",{className:"tt_cardHint",children:"\u53CC\u680F\u5728\u672C\u673A\u4E0E\u8FDC\u7A0B\u4E4B\u95F4\u5BF9\u62F7\u6587\u4EF6\uFF08\u76EE\u5F55\u9012\u5F52\u3001\u540C\u540D\u8986\u76D6\uFF09\uFF1B\u91CD\u65B0\u6253\u5F00 SFTP \u540E\u751F\u6548"})]}),h("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09"}),h("div",{className:"tt_limitGrid",children:[h("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u4E0B\u8F7D\u4E0A\u9650 (MB)"}),n("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(o?.sftpLimits?.maxDownloadMb))?Number(o.sftpLimits.maxDownloadMb):1024),onChange:W=>I("maxDownloadMb",Number(W.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u4E0A\u4F20\u4E0A\u9650 (MB)"}),n("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(o?.sftpLimits?.maxUploadMb))?Number(o.sftpLimits.maxUploadMb):2048),onChange:W=>I("maxUploadMb",Number(W.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650"}),n("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(o?.sftpLimits?.maxUploadFiles))?Number(o.sftpLimits.maxUploadFiles):1e3),onChange:W=>I("maxUploadFiles",Number(W.target.value)||0)})]})]}),n("span",{className:"tt_cardHint",children:"\u6D4F\u89C8\u5668\u4FA7\u4FDD\u62A4\uFF1A\u5355\u4E2A\u6587\u4EF6\u8D85\u8FC7\u4E0A\u9650\u65F6\u4E2D\u6B62\u4E0B\u8F7D/\u4E0A\u4F20\uFF08\u5927\u6587\u4EF6\u8BF7\u7528\u53CC\u680F \u21E8/\u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync\uFF0C\u4E0D\u5360\u6D4F\u89C8\u5668\u5185\u5B58\uFF09\uFF1B\u6587\u4EF6\u6570\u4E0A\u9650\u9488\u5BF9\u4E00\u6B21\u6279\u91CF/\u62D6\u62FD\u4E0A\u4F20\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"})]}),y("\u4F1A\u8BDD"),h("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),h("select",{className:"tt_cardInput",value:o.persistence==="tmux"?"tmux":"off",onChange:W=>T("persistence",W.target.value),children:[n("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),n("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),n("span",{className:"tt_cardHint",children:"\u5F00\u542F\u540E\u6240\u6709\u65B0\u6807\u7B7E\uFF08\u672C\u5730/SSH \u8FDE\u63A5\u7C3F/SSH \u8FDE\u63A5\u5BF9\u8BDD\u6846\uFF09\u9ED8\u8BA4\u7531 tmux \u6258\u7BA1\u3001\u53EF\u8DE8\u5BBF\u4E3B\u91CD\u542F\u6062\u590D\uFF1B\u9700\u672C\u673A/\u8FDC\u7A0B\u5B89\u88C5 tmux\uFF1BSSH \u5BF9\u8BDD\u6846\u53EF\u5BF9\u5355\u6B21\u8FDE\u63A5\u53D6\u6D88\u52FE\u9009\uFF1B\u5DF2\u6709\u6807\u7B7E\u4E0D\u53D7\u5F71\u54CD"}),fe("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),fe("\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","statsEnabled"),n("span",{className:"tt_cardHint",children:"\u9ED8\u8BA4\u5173\u95ED\uFF1A\u6574\u4E2A\u9875\u9762\u5173\u95ED\u65F6\u6301\u4E45\u4F1A\u8BDD\u7559\u5B58\uFF08\u4FDD\u6D3B\u671F\u540E\u53EF\u518D\u6062\u590D\uFF09\uFF1B\u5F00\u542F\u5219\u9875\u9762\u65AD\u5F00\u4E14\u4FDD\u6D3B\u671F\u7ED3\u675F\u65F6\u8FDE tmux \u4F1A\u8BDD\u4E00\u8D77\u7ED3\u675F\u2014\u2014\u6CE8\u610F\u5237\u65B0\u9875\u9762\u5728\u4FDD\u6D3B\u671F\u5185\u4E0D\u53D7\u5F71\u54CD"})]}),Se("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),h("div",{className:"tt_cardField",onBlur:W=>{W.currentTarget.contains(W.relatedTarget)||w(!1)},children:[n("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),n("input",{className:"tt_cardInput",value:o.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>w(!0),onClick:()=>w(!0),onKeyDown:W=>{W.key==="Escape"&&w(!1)},onChange:W=>{T("shell",W.target.value),w(!0)}}),...C?[n("div",{className:"tt_envList tt_shellList",children:(()=>{let W=(o.shell??"").trim().toLowerCase(),V=W===""?u:u.filter(X=>X.toLowerCase().includes(W));return V.length===0?n("span",{className:"tt_envMore",children:"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF"}):V.map(X=>n("button",{type:"button",className:"tt_envItem",onMouseDown:te=>te.preventDefault(),onClick:()=>{T("shell",X),w(!1)},children:X},X))})()},"shell-list")]:[],n("span",{className:"tt_cardHint",children:"\u53EF\u4E0B\u62C9\u9009\u62E9\u672C\u673A\u5DF2\u5B89\u88C5 shell\uFF08$SHELL \u4F18\u5148\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bzsh / bash \u652F\u6301 shell \u96C6\u6210"})]},"shell-field"),Se("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),Se("COLORTERM","colorTerm","truecolor",""),Se("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),Se("\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","reconnectGraceSec","120","\u5237\u65B0\u9875\u9762/\u7F51\u7EDC\u6296\u52A8\u540E\u4F1A\u8BDD\u4FDD\u6D3B\u7B49\u5F85\u91CD\u8FDE\uFF0C\u8D85\u65F6\u540E\u7ED3\u675F\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),y("SSH \u8FDE\u63A5"),h("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(o.sshHosts)&&o.sshHosts.length>0?[n("div",{className:"tt_hostList",children:o.sshHosts.map(W=>h("div",{children:[h("div",{className:"tt_sshHostRow",children:[n("div",{className:"tt_sshHostMeta",children:[n("span",{className:"tt_sshHostName",children:W?.name??""}),n("span",{className:"tt_sshHostTarget",children:Hr(W??{})})]}),n("button",{type:"button",className:"tt_toolBtn",disabled:P[W?.name]?.running===!0,onClick:()=>{G(W)},title:"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD",children:P[W?.name]?.running===!0?"\u6D4B\u8BD5\u4E2D\u2026":"\u6D4B\u8BD5"}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>q(W),children:"\u7F16\u8F91"}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>ee(W?.name),children:"\u5220\u9664"})]}),P[W?.name]&&P[W?.name].text?n("div",{className:"tt_sshProbeResult"+(P[W?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:P[W?.name].text}):null,F===W?.name?be():null]},String(W?.name??"")))})]:[n("span",{className:"tt_cardHint",children:"\u6682\u65E0\u6761\u76EE \u2014 \u7EC8\u7AEF\u9762\u677F\u300C+\u300D\u2192 SSH \u8FDE\u63A5\u2026 \u52FE\u9009\u300C\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\u300D\u5373\u53EF\u6DFB\u52A0"})],h("div",{className:"tt_cardRow",children:[n("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Z()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),n("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),n("span",{className:"tt_cardHint",children:"\u968F\u300C\u4FDD\u5B58\u300D\u4E00\u5E76\u5199\u5165\u914D\u7F6E\uFF1B\u5BC6\u7801/\u53E3\u4EE4\u652F\u6301 env:VAR \u5F15\u7528\uFF0C\u907F\u514D\u660E\u6587\u5165\u5E93"})]}),h("div",{className:"tt_cardField",children:[h("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(o.tunnels)&&o.tunnels.length>0?[n("div",{children:o.tunnels.map(W=>{let V=E.find(te=>te.name===W?.name),X=V?.state??"stopped";return h("div",{className:"tt_sshHostRow",children:[n("span",{className:"tt_tunnelDot","data-state":X,title:X}),n("div",{className:"tt_sshHostMeta",children:[n("span",{className:"tt_sshHostName",children:(W?.name??"")+" \xB7 "+Y(W??{})}),n("span",{className:"tt_sshHostTarget",children:(W?.bookName??"")+(V?.error?" \xB7 "+V.error:"")+(V?.lastForwardError?" \xB7 "+V.lastForwardError:"")})]}),n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:W?.enabled!==!1,title:"\u542F\u7528",onChange:te=>H(W?.name,te.target.checked)}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>N(W?.name),children:"\u5220\u9664"})]},String(W?.name??""))})})]:[n("span",{className:"tt_cardHint",children:"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3"})],h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_cardRow",children:[h("select",{className:"tt_cardInput",value:M.direction,onChange:K("direction"),children:[n("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),n("option",{value:"remote",children:"\u8FDC\u7A0B\u8F6C\u53D1\uFF08-R\uFF09\uFF1A\u8FDC\u7A0B\u7AEF\u53E3 \u2192 \u672C\u673A\u670D\u52A1"})]}),h("select",{className:"tt_cardInput",value:M.bookName,onChange:K("bookName"),children:[n("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(o?.sshHosts)?o.sshHosts.map(W=>n("option",{value:W?.name??"",children:W?.name??""})):[]]})]}),n("span",{className:"tt_cardHint",children:U!==void 0?"\u7ECF "+Hr(U)+" \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE":"\u9009\u62E9\u8FD9\u6761\u96A7\u9053\u8981\u8D70\u54EA\u53F0 SSH \u8FDE\u63A5\uFF08\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8FDE\u63A5\u7C3F\uFF09"}),M.direction==="local"?h("div",{className:"tt_tunnelGridLocal",children:[n("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:M.localPort,autoComplete:"off",onChange:K("localPort")}),n("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:M.remoteHost,autoComplete:"off",onChange:K("remoteHost")}),n("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:K("remotePort")})]}):h("div",{className:"tt_tunnelGrid",children:[n("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:K("remotePort")}),n("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:M.localTargetPort,autoComplete:"off",onChange:K("localTargetPort")})]}),n("div",{className:"tt_cardRow",children:[n("button",{type:"button",className:"tt_cardSave",onClick:k,children:"\u6DFB\u52A0\u96A7\u9053"}),n("span",{className:"tt_cardHint",children:"\u6DFB\u52A0\u540E\u7ACB\u5373\u751F\u6548\uFF1B\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\uFF1B\u672C\u5730\u7AEF\u53E3\u5EFA\u8BAE 1024 \u4EE5\u4E0A\uFF1B\u8FDC\u7A0B\u4E3B\u673A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF08127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09"})]})]})]}),h("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>{oe()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(o.hostKeys)&&o.hostKeys.length>0?[n("div",{className:"tt_hostList",children:o.hostKeys.map(W=>h("div",{className:"tt_sshHostRow",children:[n("div",{className:"tt_sshHostMeta",children:[n("span",{className:"tt_sshHostName",children:String(W?.host??"")+":"+String(W?.port??22)}),n("span",{className:"tt_sshHostTarget",children:"sha256:"+String(W?.fingerprint??"")})]}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>{J(W)},children:"\u5220\u9664"})]},String(W?.host??"")+":"+String(W?.port??22)))})]:[n("span",{className:"tt_cardHint",children:"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9"})],n("span",{className:"tt_cardHint",children:"\u4E3B\u673A\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF1B\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE"})]}),h("div",{className:"tt_cardField tt_cardRow",children:[n("button",{className:"tt_cardSave",disabled:p,onClick:()=>{ae()},children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),n("span",{className:"tt_cardMessage"+(d.kind==="ok"?" tt_cardMessageOk":d.kind==="error"?" tt_cardMessageError":""),children:d.text})]})]})]}):null]})}return t.inject=["slots","sessions"],t.apply=a=>{Ea=a.sessions;let f=!1,o=()=>{};Ms={set(p){if(p!==f){if(f=p,p){o=ku();return}o(),o=()=>{},Pi(),Dt()}}},Na(!0),Zr(),a.slots.inject("settings.plugin.item",()=>a.slots.register({name:"settings.plugin.item",key:"tty",order:100},r));let _=a.provide("ttyConnbar",{version:1,addAction:Is,requestRender(){Dt()}}),g=a.provide("ttyTerminal",{version:2,open(p){if(!Pt)return;let c=Ta(p),d=Aa(p,c),l=typeof p?.label=="string"&&p.label!==""?p.label:void 0;Oi(),se===null&&tn(),Ti(d,l)},mount(p,c){return Pt?Vd(p,c):()=>{}}}),S=a.provide("ttyPanel",{version:1,isOpen(){return se!==null&&!Ie},mountPane(p){return Pa(p)}});return()=>{Ms=null,Pt=!1,o(),S(),g(),_(),Pi()}},t}});})();
|
|
2542
|
+
`;var Kd="/api/dsh-tty/ws";function Gd(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+Kd}function Qs(e){return String(e??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Vd(e,t,i,n){let l=Qs(i),r=Qs(e);if(l===""||r==="")return"";let s=Qs(t),a=["DSH_TTY",l,r];return s!==""&&s!=="22"&&a.push(s),a.push(n),a.join("_")}function gi(){return ct!==null&&typeof ct.describe=="function"?ct:null}function di(e){let t=String(e??"").trim();return t.startsWith("env:")?t.slice(4).trim():""}function Yd(){let e=new Set;for(let t of Ct)for(let i of[t?.password,t?.passphrase]){let n=di(i);n!==""&&e.add(n)}return[...e]}async function Xd(){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(i=>typeof i=="string"&&i!=="")}catch{}return[]}async function za(){return[...new Set([...Yd(),...await Xd()])].sort()}async function Ua(e){let t=gi();if(t===null)return{error:ct===null?"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574"};try{let i=await t.describe([e]),n=i?.ok===!0?i.value?.[e]:void 0;return n===void 0?{unreported:!0}:{view:{configured:n.configured===!0,writable:n.writable===!0,source:typeof n.source=="string"?n.source:""}}}catch(i){return{error:i instanceof Error?i.message:String(i)}}}async function Jd(e,t){let i=gi();if(i===null||typeof i.set!="function")return{error:"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u5B58\u5165"};try{return await i.set(e,t),{value:"env:"+e}}catch(n){return{error:"\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u5931\u8D25\uFF1A"+(n instanceof Error?n.message:String(n))}}}async function ja(e){let t=gi();if(t===null||typeof t.unset!="function")return{error:"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u6E05\u9664"};try{return await t.unset(e),{}}catch(i){return{error:"\u6E05\u9664\u5931\u8D25\uFF1A"+(i instanceof Error?i.message:String(i))}}}async function qa(e,t,i,n,l,r){if(e!==!0)return{};let s=String(t??"").trim();if(s===""||s.startsWith("env:"))return{};let a=Vd(i,n,l,r);return a===""?{error:"\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"}:Jd(a,s)}function Vr(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var Rr;function Yi(){document.getElementById("dsh-tty-style")||(Rr=document.createElement("style"),Rr.id="dsh-tty-style",Rr.textContent=Ra+`
|
|
2543
|
+
`+Ma,document.head.appendChild(Rr))}var Yr='<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>',Zd='<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>',Qd='<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>',eu='<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>',tu='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3" width="9" height="11" rx="1.4"/><rect x="5.5" y="1.5" width="5" height="3" rx="1" fill="var(--dsw-alias-bg-base,#fff)"/></svg>',iu='<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>',ru='<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>',su='<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>',nu='<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>',Xr='<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>',ou='<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>',zi='<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>',Ka='<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>',Ga='<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>',fn='<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>',Va='<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>',au='<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>',_n='<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>',ui='<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>',pn='<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>',Ya='<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>',Xa='<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>',Ja='<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>',lu='<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>',cu='<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>',hu='<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>',du='<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>',Za='<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>',uu='<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>',Qa='<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>',el=null,de=null,re=null,Ir=null,ct=null,Wt=null,qt=null,wt=null,Pi=null,Oi=null,Nr=null,je=null,Ii=null,qe=null,At=null,Pe=null,fi=null,Ui=!1,Ni=null,De=!1,Ae=null,Hr=null,vi=null,Kt=null,Fr=null,$t=null,Hi=1e3,Wr="dsh-tty:tabs",ae=new Map,Xi=new Set,gn=()=>Xi.size>0,tn=new Set,St=null,Jr=0,Tr=!1,Ke=null,_i=null,Ct=[],$r=!0,at=null,Xe=null,Fi=null,fu=3e3,rn=new Set;function Zr(e){return rn.add(e),()=>rn.delete(e)}Zr(({tab:e,addAction:t})=>{jt&&e.exited&&t(iu,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>vn(e.sid))});Zr(({tab:e,addAction:t})=>{jt&&t(ru,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>es(e.spawnSpec))});Zr(({bookName:e,addAction:t})=>{if(!jt)return;let i=e!==""?fl(e):0;i>0&&t(su,"\u96A7\u9053 "+i,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",n=>zu(n.currentTarget,e))});function Ht(e,t){if(Wt===null)return;Wt.textContent=e.split("\u2014\u2014")[0],Wt.title=e,qt.dataset.state=t,Ir!==null&&(Ir.style.display=t==="connected"?"none":""),vi!==null&&(vi.textContent=e),Kt!==null&&(Kt.dataset.state=t);let i=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");i!==null&&(i.dataset.state=t)}function be(e){de!==null&&de.readyState===WebSocket.OPEN&&de.send(JSON.stringify(e))}function _u(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function Ta(e){return!Number.isFinite(e)||e<0?"\u65E0":e<1024?Math.round(e)+" B/s":Or(e)||"\u65E0"}function pu(e){if(!Number.isFinite(e)||e<0)return"\u65E0";let t=Math.floor(e),i=Math.floor(t/604800),n=Math.floor(t%604800/86400),l=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),s=[];return i>0&&s.push(i+"w"),(i>0||n>0)&&s.push(n+"d"),(i>0||n>0||l>0)&&s.push(l+"h"),(i>0||n>0||l>0||r>0)&&s.push(r+"m"),s.length>0?s.join(""):t+"s"}function ot(e,t,i){let n=Number.isFinite(i)?'<span class="tt_statsMeter" data-level="'+_u(i)+'"><span class="tt_statsMeterFill" style="width:'+Math.max(0,Math.min(100,i)).toFixed(1)+'%"></span></span>':"";return'<span class="tt_statsItem"><span class="tt_statsLabel">'+e+"</span>"+n+'<span class="tt_statsValue">'+t+"</span></span>"}function Aa(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?"\u65E0":(Ve(e)||"0 B")+"/"+(Ve(t)||"0 B")}function tl(e,t){let i=e[t];return Number.isFinite(i)?t==="tempC"?i>-100&&i<200?i:null:t==="cores"?i>=1&&i<=4096?i:null:t==="cpuPct"||t==="memPct"||t==="diskPct"?i>=0&&i<=100?i:null:t==="uptimeSec"?i>=0&&i<=100*365*24*3600?i:null:t==="tcpConns"?i>=0&&i<=1e7?i:null:t==="rxRate"||t==="txRate"?i>=0&&i<=2**40?i:null:i>=0&&i<=2**50?i:null:null}var gu=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function vu(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:gu.some(t=>tl(e,t)!==null)}function mu(e){let t=e!==void 0&&e.stats!==null&&typeof e.stats=="object"?e.stats:{},i=f=>tl(t,f),n=f=>{let o=i(f);return o===null?"\u65E0":Math.round(o)+"%"},l=[ot("CPU",n("cpuPct"),i("cpuPct")),ot("\u5185\u5B58",n("memPct"),i("memPct")),ot("\u78C1\u76D8",n("diskPct"),i("diskPct")),ot("\u6838\u5FC3",i("cores")===null?"\u65E0":String(i("cores")),null),ot("\u5185\u5B58",Aa(i("memUsed"),i("memTotal")),null),ot("\u5728\u7EBF",pu(i("uptimeSec")),null),ot("TCP",i("tcpConns")===null?"\u65E0":String(i("tcpConns")),null),ot("\u78C1\u76D8",Aa(i("diskUsed"),i("diskTotal")),null),ot("CPU\u6E29\u5EA6",i("tempC")===null?"\u65E0":i("tempC").toFixed(1)+"\xB0C",null)],r=i("rxRate"),s=i("txRate"),a=r===null&&s===null?"\u65E0":"\u2193"+Ta(r)+" \u2191"+Ta(s);return l.push(ot("\u7F51\u7EDC",a,null)),l.join("")}function bu(){if(re===null||De||!$r)return!1;let e=Ge();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:Date.now()-(e.statsAt||0)<=fu}function Da(){let e=Ge();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&bi(e)}catch{}}}function Gt(){try{wu()}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{at!==null&&(at.hidden=!0,at.textContent=""),qe!==null&&delete qe.dataset.stats}catch{}}}function wu(){if(qe===null||at===null)return;let e=bu(),t=qe.dataset.stats!==void 0!==e;if(!e){t&&delete qe.dataset.stats,at.hidden=!0,at.textContent="",t&&Da();return}at.hidden=!1,at.innerHTML=mu(Ge()),t&&(qe.dataset.stats="",Da())}function Su(){Fi===null&&(Fi=setInterval(()=>Gt(),1e3))}function Cu(){Fi!==null&&(clearInterval(Fi),Fi=null)}function il(){if(re===null||De||!$r)return null;let e=Ge();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function Ji(){let e=il();e!==Xe&&(Xe!==null&&be({t:"statsOff",sid:Xe}),Xe=e,e!==null&&be({t:"statsOn",sid:e}))}function yu(e){if(e!==il()){Ji();return}Xe!==null&&Xe!==e&&be({t:"statsOff",sid:Xe}),Xe=e,be({t:"statsOn",sid:e})}function Ge(){return St!==null?ae.get(St):void 0}function Ba(){try{let e=el?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function xu(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),be({t:"refresh",sid:e.sid})}}var Ar=null;function rl(e){Ar!==null&&clearTimeout(Ar),Ar=setTimeout(()=>{Ar=null;let t=Ge();t!==void 0&&xu(t)},e??200)}function Vt(){try{let e=[...ae.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||re===null?sessionStorage.removeItem(Wr):sessionStorage.setItem(Wr,JSON.stringify(e)),ku([...ae.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var sn="dsh-tty:persist-specs";function ku(e){try{let t=e.filter(i=>Qi(i.spawnSpec)).map(i=>({spawnSpec:i.spawnSpec,label:i.label}));t.length===0?localStorage.removeItem(sn):localStorage.setItem(sn,JSON.stringify(t))}catch{}}function Eu(){try{let e=localStorage.getItem(sn);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&Qi(i.spawnSpec)):[]}catch{return[]}}function Lu(){try{let e=sessionStorage.getItem(Wr);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&typeof i.sid=="string"&&i.sid!==""&&i.spawnSpec!==null&&typeof i.spawnSpec=="object"):[]}catch{return[]}}function zr(e,t){return new Promise(i=>{let n=r=>{let s;try{s=JSON.parse(r.data)}catch{return}s.t===e&&(clearTimeout(l),de.removeEventListener("message",n),i(s))},l=setTimeout(()=>{de.removeEventListener("message",n),i(null)},t);de.addEventListener("message",n)})}function bi(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&be({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function Mu(e){if(e===void 0||e.fit===void 0)return;let t=e.term,i=t!==null&&t.buffer!==void 0?t.buffer.active:null,n=i==null?null:{atBottom:i.viewportY>=i.baseY,line:i.viewportY};try{e.fit.fit()}catch{return}if(n!==null)try{n.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(n.line,t.buffer.active.baseY))}catch{}e.exited||bi(e)}function li(e,t,i,n){if(e.overlayEl===null||e.overlayEl===void 0)return;let l=e.overlayEl;if(t===""||t===void 0){l.textContent="";return}let r=n==="error"||n==="info"?n:"exited";l.innerHTML='<div class="tt_overlayCard" data-kind="'+r+'"><span class="tt_overlayIcon">'+(r==="error"?Za:r==="info"?pn:uu)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(i===void 0||i===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",l.querySelector(".tt_overlayMain").textContent=t,i!==void 0&&i!==""&&(l.querySelector(".tt_overlayHint").textContent=i)}function Ru(e,t){try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i!==""?i:t}catch{return t}}function Zi(e){let t=Ru("--dsw-alias-state-business-primary","#7c9cff"),i=new Wa.Terminal({cursorBlink:!0,cursorStyle:"bar",cursorInactiveStyle:"outline",fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontWeight:400,fontWeightBold:600,lineHeight:1.35,scrollback:5e3,convertEol:!1,allowProposedApi:!0,theme:{background:"#0b0e14",foreground:"#d7dce5",cursor:t,cursorAccent:"#0b0e14",selectionBackground:"rgba(124, 156, 255, .30)",black:"#1b2028",red:"#f07178",green:"#7ec699",yellow:"#e6b673",blue:"#7aa2f7",magenta:"#c792ea",cyan:"#7fdbca",white:"#c8d0dc",brightBlack:"#556070",brightRed:"#ff8b92",brightGreen:"#9fe0b4",brightYellow:"#f5cc8c",brightBlue:"#9ab8ff",brightMagenta:"#dbb3ff",brightCyan:"#a3f0e2",brightWhite:"#eef2f8"}}),n=new $a.FitAddon,l=new ro;i.loadAddon(n),i.loadAddon(l),i.loadAddon(new so);let r=document.createElement("div");r.className="tt_term";let s=document.createElement("div");s.className="tt_overlay",s.addEventListener("click",()=>{s.textContent="",vn(e.sid)}),r.appendChild(s),i.open(r);try{n.fit()}catch{}try{let a=new La;a.onContextLoss(()=>{try{a.dispose()}catch{}}),i.loadAddon(a)}catch{}i.onData(a=>{be({t:"input",sid:e.sid,d:a})}),i.onResize(()=>{Qi(e.spawnSpec)&&rl(200)}),i.attachCustomKeyEventHandler(a=>e.embedded===!0?!0:(a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="f"?(a.preventDefault(),Sl(),!1):!0),e.term=i,e.fit=n,e.search=l,e.termEl=r,e.overlayEl=s}function Pa(e){return e===null||typeof e!="object"?"":["t","name","host","port","username","command","cwd","persist","persistName"].map(i=>i+"="+String(e[i]??"")).join("\0")}function Tu(e){let t=Pa(e);if(t==="")return null;for(let i of ae.values())if(i.exited!==!0&&i.embedded!==!0&&Pa(i.spawnSpec)===t)return i;return null}function ji(e,t){let i=Vr(),n={sid:i,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??rf(),label:t};return Zi(n),ae.set(i,n),Jr+=1,ht(),Xt(i),Qr(n),Vt(),n}function Au(e){let t={sid:e.sid,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};Zi(t),ae.set(t.sid,t),Jr+=1,ht(),Xt(t.sid),be({t:"attach",sid:t.sid})}function Qr(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0,i={...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24};if(de===null||de.readyState!==WebSocket.OPEN){tn.add({tab:e,frame:i});return}be(i)}function Oa(e){let t={sid:Vr(),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};Zi(t),ae.set(t.sid,t),Jr+=1,ht(),Xt(t.sid),Qr(t)}function vn(e){let t=ae.get(e);if(t===void 0)return;if(t.embedded===!0){al(t);return}let i=t.spawnSpec,n=t.label;if(t.exited||be({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),ae.delete(e);let l={sid:Vr(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:i,label:n};Zi(l),ae.set(l.sid,l),ht(),Xt(l.sid),Qr(l),Vt()}function Du(e){let t=ae.get(e);if(t!==void 0){if(t.exited||be({t:"kill",sid:e}),ae.delete(e),Xi.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),St===e){St=null;let i=[...ae.keys()].pop()??null;i!==null&&Xt(i)}ht(),[...ae.values()].some(i=>i.embedded!==!0)?Vt():Vi()}}function sl(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error("ttyTerminal \u9700\u8981 command");if(/[\r\n\0]/.test(t))throw new Error("command \u5FC5\u987B\u662F\u5355\u884C");return t}function nl(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 Bu(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&&bi(e)}}),t.observer.observe(t.hostEl))}function ol(e,t,i){let n={sid:Vr(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:i};return Zi(n),ae.set(n.sid,n),Xi.add(n.sid),e.hostEl.appendChild(n.termEl),Bu(n),Qr(n),n}function al(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||be({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),ae.delete(e.sid),Xi.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=ol(t,e.spawnSpec,e.label),t.tab}}function Pu(e,t){if(!(e instanceof HTMLElement))throw new Error("ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9");let i=sl(t),n=nl(t,i),l=typeof t?.label=="string"&&t.label!==""?t.label:void 0;Yi();let r={hostEl:e,tab:null,observer:null,disposed:!1};return r.tab=ol(r,n,l),sf(),()=>Ou(r)}function Ou(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||be({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),ae.delete(t.sid),Xi.delete(t.sid),e.tab=null}if(re===null&&!gn()&&de!==null){Ui=!0;try{de.close()}catch{}de=null}}var Iu=460,Nu=280,Hu=320,Fu=160,zt=null,ci=Iu,hi=Hu;function mn(){let e=re!==null?re.querySelector(".tt_modal"):null,t=e!==null?e:re;return t!==null?t.getBoundingClientRect():null}var bn=e=>e==="bottom"?Fu:Nu;function Wu(e){let t=mn();if(t===null)return 900;let i=e==="bottom"?t.height:t.width;return Math.max(bn(e),Math.round(i*.72))}function Wi(e,t){return Math.min(Wu(e),Math.max(bn(e),Math.round(t)))}function Dr(){let e=zt;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){hi=Wi("bottom",hi),e.el.style.width="",e.el.style.height=String(hi)+"px",e.el.style.flexBasis=String(hi)+"px";return}ci=Wi("right",ci),e.el.style.height="",e.el.style.width=String(ci)+"px",e.el.style.flexBasis=String(ci)+"px"}}function Br(e){let t=zt;if(t!==null){if(zt=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(i){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(i instanceof Error?i.message:String(i)))}try{t.el.remove()}catch{}At!==null&&delete At.dataset.side}}function ll(e){if(un(),At===null)throw new Error("ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA");zt!==null&&Br(!0),Yi();let t=e?.side==="bottom"?"bottom":"right",i=Math.max(t==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:bn(t)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let p=Wi(t,e.size);t==="bottom"?hi=p:ci=p}let n=document.createElement("div");n.className="tt_dockPane",n.dataset.side=t,At.dataset.side=t,n.innerHTML='<div class="tt_dockPaneResize" title="'+(t==="bottom"?"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6")+'"></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="\u5173\u95ED\u4FA7\u680F">'+Xr+'</button></div><div class="tt_dockPaneBody"></div>',At.appendChild(n);let l=n.querySelector(".tt_dockPaneTitle"),r=n.querySelector(".tt_dockPaneHint"),s=n.querySelector(".tt_dockPaneBody"),a=n.querySelector(".tt_dockPaneFold"),f=n.querySelector(".tt_dockPaneClose"),o=n.querySelector(".tt_dockPaneResize"),_={el:n,element:s,disposed:!1,collapsed:!1,side:t,minSize:i,onClose:typeof e?.onClose=="function"?e.onClose:null},g=()=>t==="bottom"?_.collapsed?fn:lu:_.collapsed?Ja:Xa,S=p=>{_.collapsed=p===!0,_.collapsed?n.dataset.collapsed="1":delete n.dataset.collapsed,a.innerHTML=g(),a.title=_.collapsed?"\u5C55\u5F00\u4FA7\u680F":"\u6536\u8D77\u4FA7\u680F",a.setAttribute("aria-label",a.title),Dr()};return _.setTitle=p=>{l.textContent=typeof p=="string"?p:""},_.setHint=p=>{r.textContent=typeof p=="string"?p:""},_.isCollapsed=()=>_.collapsed===!0,_.collapse=()=>S(!0),_.expand=()=>S(!1),_.toggle=()=>S(!_.collapsed),_.dispose=()=>{_.disposed||zt!==_||Br(!1)},o.addEventListener("mousedown",p=>{if(p.button!==0||_.collapsed)return;p.preventDefault();let h=p.clientX,d=p.clientY,c=n.getBoundingClientRect(),u=C=>{t==="bottom"?hi=Wi("bottom",Math.max(i,c.height+(d-C.clientY))):ci=Wi("right",Math.max(i,c.width+(h-C.clientX))),Dr()},v=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",v),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",u),document.addEventListener("mouseup",v)}),o.addEventListener("dblclick",()=>S(!_.collapsed)),a.addEventListener("click",()=>S(!_.collapsed)),f.addEventListener("click",()=>Br(!0)),_.setTitle(typeof e?.title=="string"?e.title:""),_.setHint(typeof e?.hint=="string"?e.hint:""),S(e?.collapsed===!0),zt=_,Dr(),_}function Xt(e){let t=ae.get(e);if(t!==void 0){St=e;for(let[i,n]of ae)n.embedded!==!0&&n.termEl!==null&&(n.termEl.style.display=i===e?"":"none");t.embedded!==!0&&qe!==null&&t.termEl!==null&&t.termEl.parentElement!==qe&&qe.appendChild(t.termEl),Ji(),Gt(),ht(),Ut();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&bi(t),li(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA":"",t.exited?"\u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"","exited")}}function en(e){if(wt===null)return;let t=ae.get(e);if(t===void 0)return;let n=wt.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");n!=null&&(n.dataset.state=t.exited?"exited":t.live===!0?"connected":t.errored===!0?"error":"connecting")}function ht(){if(wt===null)return;wt.textContent="";for(let[i,n]of ae){if(n.embedded===!0)continue;let l=document.createElement("button");l.className="tt_tab",l.dataset.sid=i,i===St&&(l.dataset.active="");let r=document.createElement("span");r.className="tt_tabDot",r.dataset.state=n.exited?"exited":n.live===!0?"connected":n.errored===!0?"error":"connecting",l.appendChild(r);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=n.label||"\u7EC8\u7AEF "+cl(i),s.addEventListener("dblclick",f=>{f.stopPropagation(),Uu(i,l)});let a=document.createElement("span");a.className="tt_tabClose",a.title="\u5173\u95ED",a.textContent="\u2715",l.title=s.textContent,l.appendChild(s),l.appendChild(a),l.addEventListener("click",f=>{if(f.target.closest(".tt_tabClose")!==null){f.stopPropagation(),Du(i);return}Xt(i)}),wt.appendChild(l)}let e=wt.querySelector("[data-active]");e!==null&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest",inline:"nearest"});let t=document.createElement("button");t.className="tt_tabAdd",t.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",t.innerHTML=ou,t.addEventListener("click",()=>{Gu(t)}),wt.appendChild(t)}function $u(e){return e?.direction==="remote"?`\u8FDC\u7A0B:${e.remoteHost||"127.0.0.1"}:${String(e.remotePort??0)} \u2192 \u672C\u673A:${String(e.localTargetPort??0)}`:`\u672C\u673A:${String(e?.localPort??0)} \u2192 ${e?.remoteHost??"?"}:${String(e?.remotePort??0)}`}function Ut(){if(Pi===null||Nr===null||Ii===null||Oi===null)return;Ii.textContent="";let e=Ge(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){Pi.dataset.hidden="";return}delete Pi.dataset.hidden;let i=Number(t.port);Nr.textContent=typeof e.target=="string"&&e.target!==""?e.target:typeof t.name=="string"&&t.name!==""?t.name:String(t.username??"")+"@"+String(t.host??"")+(Number.isInteger(i)&&i!==22?":"+i:""),je!==null&&(e.persistTmux===!0?(je.textContent="tmux",je.dataset.state="ok",je.title="\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A"):t.persist===!0&&e.spawned===!0?(je.textContent="\u672A\u6301\u4E45\u5316",je.dataset.state="warn",je.title="\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD"):(je.textContent="",delete je.dataset.state,je.removeAttribute("title")));let n=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";Oi.dataset.state=n,Oi.title=n==="connected"?"\u5DF2\u8FDE\u63A5":n==="connecting"?"\u8FDE\u63A5\u4E2D":n==="error"?"\u8FDE\u63A5\u51FA\u9519":"\u4F1A\u8BDD\u5DF2\u9000\u51FA";let l=(s,a,f,o)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=f,_.innerHTML=s+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",o),Ii.appendChild(_)};if(typeof t.command=="string"&&t.command!=="")return;let r=typeof t.name=="string"?t.name:"";for(let s of rn)try{s({tab:e,spec:t,bookName:r,addAction:l})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}var Ft=null,Pr=null;function nn(){Pr!==null&&(document.removeEventListener("mousedown",Pr,!0),Pr=null),Ft!==null&&(Ft.remove(),Ft=null)}function zu(e,t){if(Ft!==null){nn();return}let i=document.createElement("div");i.className="tt_tunnelPop";let n=document.createElement("div");n.className="tt_tunnelPopTitle",n.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,i.appendChild(n);let l=document.createElement("div");l.textContent="\u52A0\u8F7D\u4E2D\u2026",i.appendChild(l);let r=document.createElement("span");r.className="tt_cardHint",r.textContent="\u589E\u5220/\u542F\u505C\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4",i.appendChild(r),document.body.appendChild(i),Ft=i;let s=e.getBoundingClientRect();i.style.top=String(s.bottom+6)+"px",i.style.left=String(Math.max(8,s.right-340))+"px";let a=f=>{Ft===i&&(i.contains(f.target)||e.contains(f.target)||nn())};Pr=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let f=[];try{let g=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();g.ok&&Array.isArray(g.tunnels)&&(f=g.tunnels)}catch{}if(Ft!==i)return;l.textContent="";let o=wn.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(o.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent="\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053",l.appendChild(_);return}for(let _ of o){let g=f.find(c=>c?.name===_?.name),S=g?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let h=document.createElement("span");h.className="tt_connDot",h.dataset.state=S==="active"?"connected":S==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(g?.error??g?.lastForwardError??""),d.textContent=$u(_)+" \xB7 "+S,p.appendChild(h),p.appendChild(d),l.appendChild(p)}})()}function cl(e){let t=1;for(let i of ae.keys()){if(i===e)return String(t);t+=1}return String(t)}function Uu(e,t){let i=ae.get(e);if(i===void 0||t.querySelector(".tt_tabRename")!==null)return;let n=t.querySelector(".tt_tabLabel");if(n===null)return;let l=document.createElement("input");l.className="tt_tabRename",l.value=i.label||"\u7EC8\u7AEF "+cl(e),n.replaceWith(l),l.focus(),l.select();let r=!1,s=()=>{if(r)return;r=!0;let f=l.value.trim();i.label=f!==""?f:void 0,ht(),Vt()},a=()=>{r||(r=!0,ht())};l.addEventListener("keydown",f=>{f.stopPropagation(),f.key==="Enter"?s():f.key==="Escape"&&a()}),l.addEventListener("blur",s),l.addEventListener("click",f=>f.stopPropagation())}var wn=[],hl="dialog",Dt="off",Bt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},pi=null,Tt=null,Ur=null,jt=!1;function dl(e){jt=e,Ur!==null&&Ur.set(e)}function ju(e){dl(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==$r&&($r=e.statsEnabled,Ji(),Gt())}function qi(e){ju(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(Ct=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(wn=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(hl=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(Dt=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(Bt={...Bt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(pi=e.maxSessions)}function qu(e,t){let i=t==="error"||t==="info"?t:"warn",n=document.createElement("div");n.className="tt_toast",n.dataset.kind=i,n.innerHTML='<span class="tt_toastIcon">'+(i==="error"?Za:i==="info"?du:hu)+'</span><span class="tt_toastText"></span>',n.lastElementChild.textContent=e,document.body.appendChild(n),setTimeout(()=>n.remove(),4e3)}async function ul(){try{be({t:"sessions"});let e=await zr("sessions",3e3);if(e!==null&&Array.isArray(e.list))return Tt=e.list.length,Tt}catch{}return null}async function jr(){if(await ul(),pi===null||Tt===null||Tt<pi)return null;let e=[...ae.values()].filter(n=>!n.exited).length,t=Math.max(0,Tt-e),i=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${Tt} \u4E2A / \u4E0A\u9650 ${pi}\uFF1A\u672C\u7A97\u53E3 ${e} \u4E2A${t>0?" + \u5176\u4ED6\u7A97\u53E3 "+t+" \u4E2A":""}\uFF09\u2014\u2014\u5173\u95ED\u4E0D\u7528\u7684\u7A97\u53E3/\u6807\u7B7E\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\u300D`;return qu(i),i}function Ku(){return pi!==null&&Tt!==null&&Tt>=pi}function Sn(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function fl(e){return wn.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function on(e){let t=Number(e?.port),i=Number.isInteger(t)&&t!==22?":"+t:"",n=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",l=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+i+" \xB7 "+n+l}async function an(e,t){let i=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),n=await i.json().catch(()=>({}));return n&&n.ok===!1&&n.error?{error:String(n.error)}:n&&n.result?{result:n.result}:{error:String(n&&n.error?n.error:"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP "+i.status+"\uFF09")}}function ln(e,t){if(!e)return"\u8FDE\u63A5\u6D4B\u8BD5\u2026";let i=e,n=typeof i.tcp?.ms=="number"?i.tcp.ms:null,l=typeof i.auth?.ms=="number"?i.auth.ms:null,r=[];i.tcp?.ok&&r.push("TCP "+(n!==null?n+"ms":"\u901A")),i.banner?.ok&&r.push("banner \u6B63\u5E38");let s=i.hostkey?.state;if(s==="matched"?r.push("\u4E3B\u673A\u5BC6\u94A5\u5339\u914D"):s==="recorded"?r.push("\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09"):s==="mismatch"&&r.push("\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01"),i.auth?.ok)return"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A"+(l!==null?"\u8BA4\u8BC1\u901A\u8FC7\uFF08"+l+"ms\uFF09":"\u8BA4\u8BC1\u901A\u8FC7")+(r.length?" \xB7 "+r.join(" \xB7 "):"");let a=i.auth?.error||i.tcp?.error||"\u672A\u77E5\u9519\u8BEF";return(t?.prefix||"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A")+a+(r.length?" \xB7 "+r.join(" \xB7 "):"")}async function Cn(){try{let t=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(t.ok&&typeof t.config=="object"&&t.config!==null){let i=Ct;qi(t.config),Ke!==null&&Ct!==i&&cn(Ke)}}catch{}}function _l(e){Ke!==null&&(e.target instanceof Element&&(Ke.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||lt())}function Gu(e){if(Ke!==null){lt();return}Cn(),ul().then(()=>{Ke!==null&&cn(Ke)});let t=document.createElement("div");t.className="tt_addMenu",Ke=t,cn(t),document.body.appendChild(t);let i=e.getBoundingClientRect(),n=t.offsetWidth,r=i.left+n>window.innerWidth-8?i.right-n:i.left;t.style.left=Math.max(8,Math.min(r,window.innerWidth-n-8))+"px",t.style.top=i.bottom+6+"px",document.addEventListener("mousedown",_l,!0)}function lt(){Ke!==null&&(document.removeEventListener("mousedown",_l,!0),Ke.remove(),Ke=null)}function Ia(e,t,i,n,l,r){let s=document.createElement("button");if(s.type="button",s.className="tt_addMenuItem",l===!0&&(s.setAttribute("data-soldout",""),s.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E"),r!==void 0){let o=document.createElement("span");o.className="tt_addMenuIcon",o.innerHTML=r,s.appendChild(o)}let a=document.createElement("span");a.className="tt_addMenuText";let f=document.createElement("span");if(f.className="tt_addMenuMain",f.textContent=t,a.appendChild(f),i!==""){let o=document.createElement("span");o.className="tt_addMenuSub",o.textContent=i,a.appendChild(o)}s.appendChild(a),s.addEventListener("click",n),e.appendChild(s)}function cn(e){e.textContent="";let t=Ku();Ia(e,"\u672C\u5730\u7EC8\u7AEF",Dt==="tmux"?"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",async()=>{await jr()||(lt(),ji())},t,Yr);let i=document.createElement("div");i.className="tt_addMenuSep",e.appendChild(i);let n=document.createElement("div");n.className="tt_addMenuTitle",n.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(n);for(let r of Ct){if(r===null||typeof r!="object"||typeof r.name!="string"||r.name==="")continue;let s=document.createElement("div");s.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let f=document.createElement("span");f.className="tt_addMenuIcon",f.innerHTML=cu;let o=document.createElement("span");o.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=r.name;let g=document.createElement("span");g.className="tt_addMenuSub";let S=fl(r.name);g.textContent=on(r)+(S>0?" \xB7 \u21C4"+String(S):""),o.appendChild(_),o.appendChild(g),a.appendChild(f),a.appendChild(o),a.addEventListener("click",async()=>{if(await jr())return;lt();let d=Dt==="tmux"&&r.persist!==!1?{persist:!0,persistName:Sn()}:{};ji({t:"ssh",name:r.name,...d},r.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.innerHTML=zi,p.addEventListener("click",()=>{lt(),es({name:r.name})});let h=document.createElement("button");h.type="button",h.className="tt_addMenuEdit",h.title="\u7F16\u8F91\u8FDE\u63A5",h.innerHTML=_n,h.addEventListener("click",()=>{lt(),Na(r)}),s.appendChild(a),s.appendChild(p),s.appendChild(h),e.appendChild(s)}if(Ct.length===0){let r=document.createElement("div");r.className="tt_addMenuTitle",r.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(r)}let l=document.createElement("div");l.className="tt_addMenuSep",e.appendChild(l),Ia(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{lt(),Na()},!1,Qa)}function Na(e){if(_i!==null)return;let t=e!==null&&typeof e=="object"?e:null,i=t!==null,n=document.createElement("div");n.className="tt_sshBackdrop";let l=document.createElement("div");l.className="tt_sshCard";let r=document.createElement("div");r.className="tt_sshTitle",r.innerHTML=Qa+"<span></span>",r.lastElementChild.textContent=i?"\u7F16\u8F91\u8FDE\u63A5 \xB7 "+String(t.name??""):"SSH \u8FDE\u63A5",l.appendChild(r);let s=T=>{let k=document.createElement("div");return k.className="tt_sshSection",k.textContent=T,k},a={},f=(T,k,N)=>{let H=document.createElement("label");H.className="tt_sshRow";let q=document.createElement("span");q.className="tt_cardLabel",q.textContent=k,H.appendChild(q);let U;if(N?.select!==void 0){U=document.createElement("select");for(let Z of N.select){let ee=document.createElement("option");ee.value=Z.value,ee.textContent=Z.label,U.appendChild(ee)}}else U=document.createElement("input"),U.type=N?.type??"text",U.placeholder=N?.placeholder??"";return U.className="tt_cardInput",U.autocomplete="off",U.spellcheck=!1,H.appendChild(U),a[T]=U,H};l.appendChild(s("\u8FDE\u63A5"));let o=document.createElement("div");o.className="tt_sshGrid",o.appendChild(f("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),o.appendChild(f("port","\u7AEF\u53E3",{placeholder:"22"})),l.appendChild(o),l.appendChild(f("username","\u7528\u6237\u540D",{placeholder:"root"})),l.appendChild(s("\u8BA4\u8BC1")),l.appendChild(f("auth","\u8BA4\u8BC1\u65B9\u5F0F",{select:[{value:"agent",label:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"},{value:"key",label:"key \u2014 \u79C1\u94A5\u6587\u4EF6"},{value:"password",label:"password \u2014 \u5BC6\u7801"}]}));let _=f("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),g=f("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),S=f("password","\u5BC6\u7801",{type:"password"}),p=(T,k)=>{let N=document.createElement("div");N.className="tt_sshRow tt_envRow";let H=document.createElement("input");H.type="text",H.className="tt_cardInput",H.placeholder="\u6216\uFF1A\u9009\u62E9\u51ED\u636E\u5B58\u50A8\u91CC\u7684\u5F15\u7528\u540D",H.title="\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",H.autocomplete="off",H.spellcheck=!1;let q=document.createElement("span");q.className="tt_cardHint tt_envEmpty",q.textContent=k,q.hidden=!0,H.hidden=!0;let U=document.createElement("div");U.className="tt_envList",U.dataset.hidden="";let Z=[],ee=()=>{if(U.textContent="",Z.length===0){let X=document.createElement("span");X.className="tt_cardHint",X.textContent=k,U.appendChild(X);return}let Y=H.value.trim().toUpperCase(),Q=Y===""?Z:Z.filter(X=>X.toUpperCase().includes(Y));for(let X of Q.slice(0,30)){let ie=document.createElement("button");ie.type="button",ie.className="tt_envItem",ie.textContent=X;let ne="env:"+X,he=null,ce=()=>{he!==null&&(clearTimeout(he),he=null),ie.textContent=X,delete ie.dataset.danger};ie.addEventListener("mousedown",ge=>ge.preventDefault()),ie.addEventListener("click",()=>{let ge=T.value;if(ge===""||ge.startsWith("env:")||he!==null){ce(),T.value=ne,T.focus(),T.dispatchEvent(new Event("change"));return}ie.textContent=X+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",ie.dataset.danger="",he=setTimeout(ce,4e3)}),U.appendChild(ie)}if(Q.length>30){let X=document.createElement("span");X.className="tt_envMore",X.textContent="\u8FD8\u6709 "+(Q.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",U.appendChild(X)}else if(Q.length===0){let X=document.createElement("span");X.className="tt_envMore",X.textContent="\u6CA1\u6709\u5339\u914D\u7684\u5F15\u7528",U.appendChild(X)}};return H.addEventListener("input",ee),H.addEventListener("focus",()=>{Z.length>0&&delete U.dataset.hidden}),H.addEventListener("blur",()=>{H.value.trim()===""&&(U.dataset.hidden="")}),N.appendChild(H),N.appendChild(q),N.appendChild(U),{row:N,setNames(Y){Z=Array.isArray(Y)?Y:[];let Q=Z.length>0;H.hidden=!Q,q.hidden=Q,ee()}}},h=(T,k)=>{let N=document.createElement("div");N.className="tt_sshRow tt_credRow";let H=document.createElement("label");H.className="tt_credToggle";let q=document.createElement("input");q.type="checkbox",q.className="tt_cardCheckbox";let U=document.createElement("span");U.textContent="\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8",H.appendChild(q),H.appendChild(U),q.checked=ct!==null,H.title="\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";let Z=document.createElement("button");Z.type="button",Z.className="tt_toolBtn tt_credClear",Z.textContent="\u6E05\u9664\u5DF2\u5B58\u51ED\u636E",Z.dataset.hidden="";let ee=document.createElement("span");ee.className="tt_credStatus",N.appendChild(H),N.appendChild(Z),N.appendChild(ee);let Y=(ie,ne)=>{ee.textContent=ie,ee.dataset.kind=ne},Q=async()=>{let ie=di(T.value),ne=ie!=="";if(H.hidden=ne,Z.hidden=!ne,ee.hidden=!1,gi()===null){q.disabled=!0,q.checked=!1,Z.disabled=!0,Y(ct===null?"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","muted");return}if(q.disabled=!1,!ne){ee.hidden=!0,Y("","plain");return}let he=await Ua(ie);if(he.unreported===!0){Y("\u5F15\u7528 "+ie+"\uFF1A\u5BBF\u4E3B\u672A\u62A5\u544A\u72B6\u6001","plain");return}if(he.error!==void 0){Y("\u8BFB\u53D6\u51ED\u636E\u72B6\u6001\u5931\u8D25\uFF1A"+he.error,"error");return}let ce=he.view;Y(ce.configured?"\u5DF2\u5B58\u5165"+(ce.source!==""?"\uFF08\u6765\u6E90 "+ce.source+"\uFF09":"")+" \xB7 "+ie:"\u5F15\u7528 "+ie+"\uFF1A\u5B58\u50A8\u91CC\u8FD8\u6CA1\u6709\u8FD9\u4E2A\u503C",ce.configured?"ok":"plain"),Z.disabled=ce.configured!==!0||ce.writable!==!0};Z.addEventListener("click",()=>{(async()=>{let ie=di(T.value);if(ie==="")return;let ne=await ja(ie);if(ne.error!==void 0){Y(ne.error,"error");return}T.value="",await Q()})()});let X=async()=>{let ie=await qa(q.checked===!0,T.value,a.host.value,a.port.value,a.username.value,k);return ie.value!==void 0&&(T.value=ie.value,await Q()),ie};return T.addEventListener("change",()=>{Q()}),{row:N,refresh:Q,storeIfRequested:X}},d=p(a.passphrase,"\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"),c=p(a.password,"\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"),u=h(a.password,"PASSWORD");(async()=>{let T=await za();d.setNames(T),c.setNames(T)})(),l.appendChild(_),l.appendChild(g),l.appendChild(d.row),l.appendChild(S),l.appendChild(u.row),l.appendChild(c.row),l.appendChild(s("\u9009\u9879"));let v=document.createElement("label");v.className="tt_cardRow";let C=document.createElement("input");C.type="checkbox",C.className="tt_cardCheckbox";let w=document.createElement("span");w.className="tt_cardLabel",w.textContent="agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09",v.appendChild(C),v.appendChild(w),l.appendChild(v);let y=document.createElement("label");y.className="tt_cardRow";let m=document.createElement("input");m.type="checkbox",m.className="tt_cardCheckbox";let x=document.createElement("span");x.className="tt_cardLabel",x.textContent="\u6301\u4E45\u4F1A\u8BDD\uFF08tmux \u6258\u7BA1\uFF0C\u65AD\u7EBF/\u91CD\u542F\u540E\u6062\u590D\u73B0\u573A\uFF1B\u8FDC\u7A0B\u9700\u5B89\u88C5 tmux\uFF09",y.appendChild(m),y.appendChild(x),m.checked=Dt==="tmux",Dt==="tmux"&&l.appendChild(y);let A=document.createElement("label");A.className="tt_cardRow";let I=document.createElement("input");I.type="checkbox",I.className="tt_cardCheckbox";let F=document.createElement("span");F.className="tt_cardLabel",F.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",A.appendChild(I),A.appendChild(F),l.appendChild(A);let R=f("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});R.style.display="none",l.appendChild(R),I.addEventListener("change",()=>{R.style.display=I.checked?"":"none",I.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),I.checked&&a.name.focus()}),i&&(A.style.display="none",a.name.value=String(t.name??""),R.style.display="",a.host.value=String(t.host??""),a.port.value=String(t.port??22),a.username.value=String(t.username??""),a.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",a.keyPath.value=String(t.keyPath??""),a.passphrase.value=String(t.passphrase??""),a.password.value=String(t.password??""),C.checked=t.agentForward===!0,m.checked=Dt==="tmux");let $=document.createElement("div");$.className="tt_sshStatus";let B=document.createElement("div");B.className="tt_sshError";let D=document.createElement("div");D.className="tt_sshProbeResult",$.appendChild(B),$.appendChild(D),l.appendChild($);let P=()=>{B.textContent="";let T=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),T===""||k==="")return B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B",null;let H=a.auth.value,q={host:T,port:N,username:k,auth:H};if(H==="key"){let U=a.keyPath.value.trim();if(U==="")return B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84",null;q.keyPath=U;let Z=a.passphrase.value;Z!==""&&(q.passphrase=Z)}if(H==="password"){let U=a.password.value;if(U==="")return B.textContent="auth=password \u9700\u8981\u5BC6\u7801",null;q.password=U}return C.checked&&(q.agentForward=!0),q},O=document.createElement("div");O.className="tt_sshActions";let b=document.createElement("div");b.className="tt_sshActionsGroup";let E=document.createElement("div");E.className="tt_sshActionsGroup",O.appendChild(b),O.appendChild(E);let L=document.createElement("button");L.type="button",L.className="tt_toolBtn",L.textContent="\u53D6\u6D88";let M=document.createElement("button");M.type="button",M.className="tt_cardSave",M.textContent="\u8FDE\u63A5",b.appendChild(L);let z=document.createElement("button");z.type="button",z.className="tt_toolBtn",z.textContent="\u6587\u4EF6\u6D4F\u89C8",z.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",z.addEventListener("click",()=>{B.textContent="";let T=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),T===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let H=a.auth.value,q={host:T,port:N,username:k,auth:H};if(H==="key"){let U=a.keyPath.value.trim();if(U===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}q.keyPath=U;let Z=a.passphrase.value;Z!==""&&(q.passphrase=Z)}if(H==="password"){let U=a.password.value;if(U===""){B.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}q.password=U}C.checked&&(q.agentForward=!0),Rt(),es(q)}),b.appendChild(z);let K=null;i&&(K=document.createElement("button"),K.type="button",K.className="tt_toolBtn",K.textContent="\u4FDD\u5B58\u4FEE\u6539",K.addEventListener("click",()=>{B.textContent="";let T=a.host.value.trim(),k=a.username.value.trim();if(T===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let N=Number(a.port.value);(!Number.isInteger(N)||N<1||N>65535)&&(N=22);let H=a.auth.value,U={name:a.name.value.trim()||T,host:T,port:N,username:k,auth:H,keyPath:H==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:C.checked,persist:m.checked};if(H==="key"&&U.keyPath===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}K!==null&&(K.disabled=!0),(async()=>{let Z=await u.storeIfRequested();if(Z.error!==void 0){B.textContent=Z.error,K!==null&&(K.disabled=!1);return}Z.value!==void 0&&(U.password=Z.value);let ee=await Yu(String(t.name??""),U);if(K!==null&&(K.disabled=!1),ee!==void 0){B.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+ee;return}Rt()})()}),b.appendChild(K));let V=document.createElement("button");V.type="button",V.className="tt_toolBtn",V.textContent="\u8BD5\u8FDE",V.title="\u6309\u5F53\u524D\u586B\u5199\u8BCA\u65AD\u8FDE\u63A5\uFF08TCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\uFF09\uFF1B\u4E0D\u4F1A\u65B0\u5EFA\u4F1A\u8BDD\uFF0C\u4E5F\u4E0D\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9",V.addEventListener("click",()=>{let T=P();T!==null&&(D.className="tt_sshProbeResult",D.textContent="\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026",V.disabled=!0,an(T,!1).then(k=>{V.disabled=!1,k.result?(D.className="tt_sshProbeResult"+(k.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),D.textContent=ln(k.result)):(D.className="tt_sshProbeResult tt_sshProbeBad",D.textContent="\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(k.error||"\u672A\u77E5\u9519\u8BEF"))}))}),b.appendChild(V),E.appendChild(M),l.appendChild(O);let j=()=>{_.style.display=a.auth.value==="key"?"":"none",g.style.display=a.auth.value==="key"?"":"none",d.row.style.display=a.auth.value==="key"?"":"none",S.style.display=a.auth.value==="password"?"":"none",c.row.style.display=a.auth.value==="password"?"":"none",u.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",j),j(),u.refresh(),L.addEventListener("click",()=>Rt()),n.addEventListener("mousedown",T=>{T.target===n&&Rt()}),M.addEventListener("click",async()=>{B.textContent="";let T=await jr();if(T!==null){B.textContent=T;return}let k=a.host.value.trim(),N=a.username.value.trim(),H=Number(a.port.value);if((!Number.isInteger(H)||H<1||H>65535)&&(H=22),k===""||N===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let q=a.auth.value,U={t:"ssh",host:k,port:H,username:N,auth:q};if(q==="key"){let Q=a.keyPath.value.trim();Q!==""&&(U.keyPath=Q);let X=a.passphrase.value;X!==""&&(U.passphrase=X)}if(q==="password"){let Q=a.password.value;Q!==""&&(U.password=Q)}C.checked&&(U.agentForward=!0),m.checked&&(U.persist=!0,U.persistName=Sn());let Z=H!==22?N+"@"+k+":"+H:N+"@"+k,ee=Q=>{Rt(),re!==null&&ji(U,Q!==""?Q:Z)};if(!I.checked){ee("");return}let Y=a.name.value.trim()||k;M.disabled=!0,(async()=>{let Q=await u.storeIfRequested();if(Q.error!==void 0){B.textContent=Q.error,M.disabled=!1;return}let X=Q.value??U.password??"",ie=await Vu({name:Y,host:k,port:H,username:N,auth:q,keyPath:U.keyPath??"",passphrase:U.passphrase??"",password:X,agentForward:C.checked,persist:m.checked});if(M.disabled=!1,ie!==void 0){B.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+ie;return}ee(Y)})()}),n.appendChild(l),document.body.appendChild(n),_i=n,a.host.focus()}function Rt(){_i!==null&&(_i.remove(),_i=null)}async function Vu(e){let t=[...Ct.filter(i=>i?.name!==e.name),e];try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),n=await i.json().catch(()=>({}));if(!i.ok||!n.ok)return String(n.error||"HTTP "+i.status);qi(n.config);return}catch(i){return String(i&&i.message?i.message:i)}}async function Yu(e,t){if(t.name!==e&&Ct.some(n=>n?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let i=Ct.map(n=>n?.name===e?t:n);try{let n=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:i})}),l=await n.json().catch(()=>({}));if(!n.ok||!l.ok)return String(l.error||"HTTP "+n.status);qi(l.config);return}catch(n){return String(n&&n.message?n.message:n)}}function Xu(e,t){if(yn())return;let i=document.createElement("div");i.className="tt_sftpDualCard";let n=document.createElement("div");n.className="tt_sftpTitleRow";let l=document.createElement("div");l.className="tt_sshTitle",l.innerHTML=zi+"<span></span>",l.lastElementChild.textContent="SFTP \u53CC\u680F \xB7 "+t;let r=document.createElement("button");r.type="button",r.className="tt_close",r.title="\u5173\u95ED",r.innerHTML=Xr,r.addEventListener("click",Yt),n.appendChild(l),n.appendChild(r),i.appendChild(n);let s=document.createElement("div");s.className="tt_sftpStatus";let a=(P,O)=>{s.textContent=P,O===void 0?delete s.dataset.state:s.dataset.state=O},f=!1,o=(P,O)=>{if(!(f||g.local.busy||g.remote.busy)){f=!0;for(let b of[g.local,g.remote])b.setBusy(!0);a(P,"busy"),Promise.resolve().then(O).catch(b=>{(b===null||typeof b!="object"||b.name!=="TransferCanceledError")&&R.fail("\u5931\u8D25"),a(String(b&&b.message?b.message:b),"error")}).finally(()=>{f=!1;for(let b of[g.local,g.remote])b.setBusy(!1)})}},_=P=>{g[P].bar.after(p),p.style.display="",h.focus(),h.select()},g={},S=(P,O)=>{let b={kind:P,path:"",busy:!1},E=document.createElement("div");E.className="tt_sftpPane";let L=document.createElement("div");L.className="tt_sftpPaneHead";let M=document.createElement("span");M.textContent=O;let z=document.createElement("span");z.className="tt_sftpPaneMeta",L.appendChild(M),L.appendChild(z),E.appendChild(L);let K=document.createElement("div");K.className="tt_sftpBar";let V=document.createElement("input");V.type="text",V.className="tt_sftpPath",V.placeholder=P==="local"?"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",V.spellcheck=!1,V.autocomplete="off";let j=document.createElement("button");j.type="button",j.className="tt_toolBtn",j.innerHTML=pn+"<span>\u5237\u65B0</span>";let T=document.createElement("button");T.type="button",T.className="tt_toolBtn",T.innerHTML=Ya+"<span>\u65B0\u5EFA\u76EE\u5F55</span>",K.appendChild(V),K.appendChild(j),K.appendChild(T),E.appendChild(K);let k=document.createElement("div");k.className="tt_sftpList",E.appendChild(k),b.bar=K;let N=Y=>{b.busy=Y;for(let Q of[j,T])Q.disabled=Y;V.disabled=Y},H=async(Y,Q)=>{let X=P==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",ie=P==="local"?Q:{...e,...Q},ne=await fetch(X+Y,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ie)}),he=await ne.json().catch(()=>({}));if(!ne.ok||he.ok!==!0)throw new Error(String(he.error||"HTTP "+ne.status));return he},q=(Y,Q)=>{if(!(b.busy||f))return N(!0),a(Y,"busy"),Promise.resolve().then(Q).catch(X=>a(String(X&&X.message?X.message:X),"error")).finally(()=>N(!1))},U=(Y,Q)=>Y.endsWith("/")||Y.endsWith("\\")?Y+Q:Y+"/"+Q,Z=Y=>{let Q=U(b.path,Y.name),X=[];Y.isDir===!0?X.push("\u76EE\u5F55"):X.push(Ve(Number(Y.size))||"\u2014");let ie=gl(Number(Y.mtime));ie!==""&&X.push(ie);let ne=C(Y.isDir?zi:Y.isSymlink?Ga:Ka,Y.name,X.join(" \xB7 "),Y.isDir===!0?"dir":Y.isSymlink===!0?"link":"file"),he=()=>b.loadDir(b.path),ce=P==="local"?g.remote:g.local;return Y.isDir===!0&&ne.addEventListener("click",ge=>{ge.target instanceof Element&&ge.target.closest(".tt_sftpAct")!==null||b.loadDir(Q)}),w(ne,P==="local"?Xa:Ja,"\u4F20\u8F93\u5230"+(P==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+ce.path,()=>{R.reset(),R.pulse(0),o("\u4F20\u8F93 "+Y.name+"\u2026",async()=>{let ge=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:P==="local"?"up":"down",...e,localPath:P==="local"?Q:U(ce.path,Y.name),remotePath:P==="local"?U(ce.path,Y.name):Q})}),Se=await ge.json().catch(()=>({}));if(!ge.ok||Se.ok!==!0)throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error(String(Se.error||"HTTP "+ge.status));let Oe=Se.job?.id;if(typeof Oe!="string"||Oe==="")throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id");await $(Oe,Y.name)==="canceled"?(R.reset(),a("\u5DF2\u53D6\u6D88\u4F20\u8F93 "+Y.name)):(R.done("\u5B8C\u6210"),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4F20\u8F93 "+Y.name)),await ce.loadDir(ce.path)})}),P!=="local"&&Y.isDir!==!0&&w(ne,Va,"\u4E0B\u8F7D "+Y.name,()=>{m(Y,Q)}),w(ne,_n,"\u91CD\u547D\u540D "+Y.name,()=>{h.placeholder="\u65B0\u540D\u79F0",h.value=Y.name,_(P),u=async()=>{let ge=h.value.trim();ge===""||ge===Y.name||(v(),await b.runTask("\u91CD\u547D\u540D "+Y.name+"\u2026",async()=>{await H("rename",{from:Q,to:U(b.path,ge)}),await he()}))}}),y(ne,()=>b.runTask("\u5220\u9664 "+Y.name+"\u2026",async()=>{await H("remove",{path:Q,recursive:Y.isDir===!0}),await he(),a("\u5DF2\u5220\u9664 "+Y.name)}),Y),ne},ee=Y=>{if(k.textContent="",b.path!==""&&b.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(b.path)===!1){let X=C(fn,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");X.addEventListener("click",()=>{b.loadDir(vl(b.path))}),k.appendChild(X)}let Q=Array.isArray(Y)?Y:[];if(Q.length===0){let X=document.createElement("div");X.className="tt_addMenuTitle",X.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",k.appendChild(X);return}for(let X of Q)X===null||typeof X!="object"||typeof X.name!="string"||X.name===""||k.appendChild(Z(X))};return b.loadDir=async Y=>{try{let Q=await H("list",{path:Y??b.path});b.path=typeof Q.path=="string"&&Q.path!==""?Q.path:b.path,V.value=b.path;let X=Array.isArray(Q.entries)?Q.entries.length:0;ee(Q.entries),z.textContent=String(X)+" \u9879",a(b.path)}catch(Q){a(String(Q&&Q.message?Q.message:Q),"error")}},b.runTask=q,b.setBusy=N,g[P]=b,j.addEventListener("click",()=>{b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(b.path))}),T.addEventListener("click",()=>{b.busy||f||(h.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",h.value="",_(P),u=async()=>{let Y=h.value.trim();Y!==""&&(v(),await b.runTask("\u521B\u5EFA\u76EE\u5F55 "+Y+"\u2026",async()=>{await H("mkdir",{path:U(b.path,Y),parents:!0}),await b.loadDir(b.path)}))})}),V.addEventListener("keydown",Y=>{if(Y.key!=="Enter"||(Y.preventDefault(),b.busy||f))return;let Q=V.value.trim();Q!==""&&b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(Q))}),E},p=document.createElement("div");p.className="tt_sftpEditor",p.style.display="none";let h=document.createElement("input");h.type="text",h.className="tt_cardInput",h.spellcheck=!1,h.autocomplete="off";let d=document.createElement("button");d.type="button",d.className="tt_toolBtn",d.textContent="\u786E\u5B9A";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.textContent="\u53D6\u6D88",p.appendChild(h),p.appendChild(d),p.appendChild(c);let u=null,v=()=>{p.style.display="none",h.value="",u=null};d.addEventListener("click",()=>{u?.()}),c.addEventListener("click",v),h.addEventListener("keydown",P=>{P.key==="Enter"?(P.preventDefault(),u?.()):P.key==="Escape"&&(P.stopPropagation(),v())});let C=(P,O,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpRow";let M=document.createElement("span");M.className="tt_sftpIcon",M.innerHTML=P,E!==void 0&&(M.dataset.kind=E);let z=document.createElement("span");if(z.className="tt_sftpName",z.textContent=O,z.title=O,L.appendChild(M),L.appendChild(z),b!==""){let K=document.createElement("span");K.className="tt_sftpMeta",K.textContent=b,L.appendChild(K)}return L},w=(P,O,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpAct",L.innerHTML=O,L.title=b,L.addEventListener("click",M=>{M.stopPropagation(),E()}),P.appendChild(L)},y=(P,O,b)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpAct",E.innerHTML=ui,E.title="\u5220\u9664 "+b.name+(b.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let L=null;E.addEventListener("click",M=>{if(M.stopPropagation(),L!==null){clearTimeout(L),L=null,E.innerHTML=ui,delete E.dataset.danger,O();return}E.textContent="\u786E\u8BA4?",E.dataset.danger="",L=setTimeout(()=>{L=null,E.innerHTML=ui,delete E.dataset.danger},4e3)}),P.appendChild(E)},m=(P,O)=>g.remote.runTask("\u4E0B\u8F7D "+P.name+"\u2026",async()=>{R.reset();let b;try{b=await bl("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:O})},(E,L)=>{R.set(E,L)},Bt.maxDownloadMb,E=>R.setCancel(E))}catch(E){if(hn(E)){R.reset(),a("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+P.name);return}throw R.fail("\u4E0B\u8F7D\u5931\u8D25"),E}R.done("\u5B8C\u6210"),wl(b,P.name),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4E0B\u8F7D "+P.name+"\uFF08"+(Ve(b.size)||String(b.size)+" B")+"\uFF09")}),x=S("local","\u672C\u673A"),A=S("remote","\u8FDC\u7A0B");g.local.wrap=x,g.remote.wrap=A;let I=document.createElement("div");I.className="tt_sftpDual",I.appendChild(x),I.appendChild(A),i.appendChild(I),i.appendChild(p);let F=document.createElement("div");F.className="tt_sftpFoot";let R=ml();F.appendChild(R.el),F.appendChild(s),i.appendChild(F);let $=async(P,O)=>{let b=!1;R.setCancel(()=>{b||(b=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:P})}).catch(()=>{}))});try{for(;;){await new Promise(z=>setTimeout(z,400));let E=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:P})}),L=await E.json().catch(()=>({}));if(!E.ok||L.ok!==!0){if(b)return"canceled";throw new Error(String(L.error||"HTTP "+E.status))}let M=L.job;if(M===null||typeof M!="object")throw new Error("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001");if(M.state==="running"){let z=typeof M.current=="string"&&M.current!==""?M.current:O;a("\u4F20\u8F93 "+z+"\u2026","busy"),Number.isFinite(M.total)&&M.total>0?R.set(Number(M.bytes)||0,M.total):R.pulse(Number(M.bytes)||0);continue}if(M.state==="canceled")return"canceled";if(M.state!=="done")throw new Error(String(M.error||"\u4F20\u8F93\u5931\u8D25"));return"done"}}finally{R.setCancel(null)}},B=mn(),D=B===null?420:Math.round(B.height*.56);pl(i,"SFTP \u53CC\u680F \xB7 "+t,D),g.local.loadDir(""),g.remote.loadDir("")}var Ki=null,qr=null,yn=()=>Ki!==null||qr!==null;function pl(e,t,i){if(re!==null&&!De&&At!==null&&zt===null)try{let l=ll({title:t,side:"bottom",size:i,min:200,onClose:()=>Yt()});l.element.appendChild(e),qr=l;return}catch(l){console.warn("[dsh-tty] SFTP \u6302\u5230\u53F3\u4FA7\u4FA7\u680F\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(l instanceof Error?l.message:String(l)))}let n=document.createElement("div");n.className="tt_sshBackdrop",n.appendChild(e),n.addEventListener("mousedown",l=>{l.target===n&&Yt()}),document.body.appendChild(n),Ki=n}var $i=null;function Ju(){let e=$i;if($i=null,e!==null)try{e.click()}catch{}}function Zu(e){let t=new TextEncoder().encode(e),i="";for(let n of t)i+=String.fromCharCode(n);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ve(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],i=e,n=-1;do i/=1024,n+=1;while(i>=1024&&n<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[n]}function Or(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],i=e,n=-1;do i/=1024,n+=1;while(i>=1024&&n<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[n]+"/s"}function gl(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let i=n=>String(n).padStart(2,"0");return t.getFullYear()+"-"+i(t.getMonth()+1)+"-"+i(t.getDate())+" "+i(t.getHours())+":"+i(t.getMinutes())}function vl(e){let t=String(e).replace(/\/+$/,""),i=t.lastIndexOf("/");return i<=0?"/":t.slice(0,i)}function Bi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function ml(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let i=document.createElement("div");i.className="tt_sftpFill",t.appendChild(i);let n=document.createElement("span");n.className="tt_sftpPct",n.textContent="";let l=document.createElement("button");l.type="button",l.className="tt_sftpCancel",l.title="\u53D6\u6D88\u4F20\u8F93",l.textContent="\u2715",l.style.display="none";let r=null;l.addEventListener("click",p=>{p.stopPropagation();let h=r;h!==null&&(l.disabled=!0,h())}),e.appendChild(t),e.appendChild(n),e.appendChild(l);let s=p=>{n.textContent=p},a="",f=-1,o=p=>{p!==a&&(a=p,n.textContent=p)},_=p=>{let h=Math.round(p);h!==f&&(f=h,i.style.width=h+"%")},g=()=>{r=null,$i===l&&($i=null),l.style.display="none",l.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",f=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,i.style.width="0%",n.textContent="",g()},setCancel(p){if(p==null){g();return}r=p,$i=l,l.disabled=!1,l.style.display=""},set(p,h){e.dataset.active="",delete e.dataset.state;let d=Date.now();if(this._last!==void 0&&d>this._lastAt){let c=(p-this._last)/((d-this._lastAt)/1e3);this._rate=this._rate===void 0?c:this._rate*.7+c*.3}if(this._last=p,this._lastAt=d,Number.isFinite(h)&&h>0){let c=Math.min(100,Math.max(0,p/h*100));_(c);let u=this._rate!==void 0&&this._rate>=0?Or(this._rate):"";o(Math.round(c)+"%"+(u!==""?" \xB7 "+u:""))}else{i.style.width="";let c=this._rate!==void 0&&this._rate>=0?Or(this._rate):"";o(Ve(p)+(c!==""?" \xB7 "+c:""))}},pulse(p){e.dataset.active="",delete e.dataset.state,i.style.width="45%",i.style.transition="none",setTimeout(()=>{i.style.transition="width .15s linear"},30);let h=Date.now();if(this._last!==void 0&&h>this._lastAt){let c=(p-this._last)/((h-this._lastAt)/1e3);this._rate=this._rate===void 0?c:this._rate*.7+c*.3}this._last=p,this._lastAt=h;let d=this._rate!==void 0&&this._rate>=0?Or(this._rate):"";o((Number.isFinite(p)?Ve(p):"\u2026")+(d!==""?" \xB7 "+d:""))},done(p){e.dataset.active="",e.dataset.state="done",i.style.width="100%",f=100,g(),o(p!==void 0&&p!==""?p:"\u5B8C\u6210")},fail(p){e.dataset.active="",e.dataset.state="error",g(),o(p!==void 0&&p!==""?p:"\u5931\u8D25")},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",n.textContent=""):(e.dataset.active="",i.style.width="",f=-1,o(p))}}}async function bl(e,t,i,n=0,l=null){let r=n>0?n*1024*1024:0,s=typeof AbortController=="function"?new AbortController:null,a=!1;s!==null&&(t={...t,signal:s.signal},typeof l=="function"&&l(()=>{a=!0,s.abort()}));let f=await fetch(e,t);if(!f.ok){let d="HTTP "+f.status;try{let c=await f.json();c!==null&&typeof c=="object"&&typeof c.error=="string"&&(d=c.error)}catch{}throw new Error(d)}let o=Number(f.headers.get("content-length")),_=Number.isFinite(o)&&o>0;if(r>0&&_&&o>r){try{await f.body?.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ve(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}let g=f.body;if(g===null||typeof g.getReader!="function"){let d=await f.blob();if(r>0&&d.size>r)throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ve(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync");return _&&i(o,o),d}let S=g.getReader(),p=[],h=0;try{for(;;){let{done:d,value:c}=await S.read();if(d)break;if(c!==void 0&&c.byteLength>0){if(h+=c.byteLength,r>0&&h>r){try{await S.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ve(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}p.push(c),i(h,_?o:NaN)}}}catch(d){if(a||d!==null&&typeof d=="object"&&d.name==="AbortError"){try{await S.cancel()}catch{}throw new mi}throw d}return new Blob(p,{type:"application/octet-stream"})}var mi=class extends Error{constructor(){super("\u5DF2\u53D6\u6D88"),this.name="TransferCanceledError"}};function hn(e){return e instanceof mi}function wl(e,t){let i=URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}async function Qu(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],i=[];for(let o of t){let _=typeof o.webkitGetAsEntry=="function"?o.webkitGetAsEntry():null;_!==null&&i.push(_)}if(i.length===0)return[...e.files??[]].map(o=>({relPath:o.name,file:o}));let n=[],l=Bt.maxUploadFiles,r=Bt.maxUploadMb>0?Bt.maxUploadMb*1024*1024:0,s=()=>l>0&&n.length>=l,a=0,f=(o,_)=>new Promise(g=>{if(s()){g();return}if(o.isFile===!0){o.file(h=>{r>0&&a+(h.size??0)>r?n._limitExceeded=!0:(n.push({relPath:_+o.name,file:h}),a+=h.size??0),g()},()=>g());return}if(o.isDirectory!==!0){g();return}let S=o.createReader(),p=()=>{S.readEntries(async h=>{if(h.length===0){g();return}for(let d of h){if(s())break;await f(d,_+o.name+"/")}if(s()){g();return}p()},()=>g())};p()});for(let o of i)await f(o,"");return n}function es(e){if(yn())return;let t=e!==null&&typeof e=="object"?e:{},i={};if(typeof t.name=="string"&&t.name!=="")i.name=t.name;else{for(let T of["host","username","auth","keyPath","passphrase","password"])typeof t[T]=="string"&&t[T]!==""&&(i[T]=t[T]);let j=Number(t.port);Number.isInteger(j)&&j>=1&&j<=65535&&(i.port=j),t.agentForward===!0&&(i.agentForward=!0)}let n=i.name??(i.username!==void 0?i.username+"@"+String(i.host??""):String(i.host??""));if(hl==="dual"){Xu(i,n);return}let l=document.createElement("div");l.className="tt_sftpCard";let r=document.createElement("div");r.className="tt_sftpTitleRow";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=zi+"<span></span>",s.lastElementChild.textContent="SFTP \xB7 "+n;let a=document.createElement("button");a.type="button",a.className="tt_close",a.title="\u5173\u95ED",a.innerHTML=Xr,a.addEventListener("click",Yt),r.appendChild(s),r.appendChild(a),l.appendChild(r);let f=document.createElement("div");f.className="tt_sftpBar";let o=document.createElement("input");o.type="text",o.className="tt_sftpPath",o.placeholder="\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",o.spellcheck=!1,o.autocomplete="off";let _=document.createElement("button");_.type="button",_.className="tt_toolBtn",_.innerHTML=pn+"<span>\u5237\u65B0</span>";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.innerHTML=Ya+"<span>\u65B0\u5EFA\u76EE\u5F55</span>";let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.innerHTML=au+"<span>\u4E0A\u4F20</span>",S.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let p=document.createElement("input");p.type="file",p.multiple=!0,p.style.display="none",f.appendChild(o),f.appendChild(_),f.appendChild(g),f.appendChild(S),l.appendChild(f),l.appendChild(p);let h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",h.appendChild(d),h.appendChild(c),h.appendChild(u),l.appendChild(h);let v=null,C=()=>{h.style.display="none",v=null};c.addEventListener("click",()=>{v?.()}),u.addEventListener("click",C),d.addEventListener("keydown",j=>{j.key==="Enter"?(j.preventDefault(),v?.()):j.key==="Escape"&&(j.stopPropagation(),C())});let w=document.createElement("div");w.className="tt_sftpList",l.appendChild(w);let y=document.createElement("div");y.className="tt_sftpFoot";let m=document.createElement("div");m.className="tt_sftpStatus";let x=ml();y.appendChild(x.el),y.appendChild(m),l.appendChild(y);let A={path:"",busy:!1},I=(j,T)=>{m.textContent=j,T===void 0?delete m.dataset.state:m.dataset.state=T},F=j=>{A.busy=j;for(let T of[_,g,S])T.disabled=j;o.disabled=j},R=async(j,T)=>{let k=await fetch("/api/dsh-tty/sftp/"+j,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,...T})}),N=await k.json().catch(()=>({}));if(!k.ok||N.ok!==!0)throw new Error(String(N.error||"HTTP "+k.status));return N},$=async(j,T)=>{if(!A.busy){F(!0),I(j,"busy");try{await T()}catch(k){I(String(k&&k.message?k.message:k),"error")}finally{F(!1)}}},B=(j,T,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let q=document.createElement("span");q.className="tt_sftpIcon",q.innerHTML=j,N!==void 0&&(q.dataset.kind=N);let U=document.createElement("span");if(U.className="tt_sftpName",U.textContent=T,U.title=T,H.appendChild(q),H.appendChild(U),k!==""){let Z=document.createElement("span");Z.className="tt_sftpMeta",Z.textContent=k,H.appendChild(Z)}return H},D=(j,T,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=T,H.title=k,H.addEventListener("click",q=>{q.stopPropagation(),N()}),j.appendChild(H)},P=(j,T,k)=>{let N=document.createElement("button");N.type="button",N.className="tt_sftpAct",N.innerHTML=ui,N.title="\u5220\u9664 "+T.name+(T.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let H=null;N.addEventListener("click",q=>{if(q.stopPropagation(),!A.busy){if(H!==null){clearTimeout(H),H=null,N.innerHTML=ui,delete N.dataset.danger,$("\u5220\u9664 "+T.name+"\u2026",async()=>{await R("remove",{path:k,recursive:T.isDir===!0}),await b(A.path),I("\u5DF2\u5220\u9664 "+T.name)});return}N.textContent="\u786E\u8BA4?",N.dataset.danger="",H=setTimeout(()=>{H=null,N.innerHTML=ui,delete N.dataset.danger},4e3)}}),j.appendChild(N)},O=j=>{if(w.textContent="",A.path!==""&&A.path!=="/"){let k=B(fn,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");k.addEventListener("click",()=>{$("\u52A0\u8F7D\u4E2D\u2026",()=>b(vl(A.path)))}),w.appendChild(k)}let T=Array.isArray(j)?j:[];if(T.length===0){let k=document.createElement("div");k.className="tt_addMenuTitle",k.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",w.appendChild(k);return}for(let k of T){if(k===null||typeof k!="object"||typeof k.name!="string"||k.name==="")continue;let N=Bi(A.path,k.name),H=[];k.isDir===!0?H.push("\u76EE\u5F55"):H.push(Ve(Number(k.size))||"\u2014");let q=gl(Number(k.mtime));q!==""&&H.push(q);let U=B(k.isDir?zi:k.isSymlink?Ga:Ka,k.name,H.join(" \xB7 "),k.isDir===!0?"dir":k.isSymlink===!0?"link":"file");k.isDir===!0?U.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest(".tt_sftpAct")!==null||$("\u52A0\u8F7D\u4E2D\u2026",()=>b(N))}):(U.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest(".tt_sftpAct")!==null||E(k,N)}),D(U,Va,"\u4E0B\u8F7D "+k.name,()=>{E(k,N)})),D(U,_n,"\u91CD\u547D\u540D "+k.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=k.name,h.style.display="",d.focus(),d.select(),v=async()=>{let Z=d.value.trim();Z===""||Z===k.name||(C(),await $("\u91CD\u547D\u540D "+k.name+"\u2026",async()=>{await R("rename",{from:N,to:Bi(A.path,Z)}),await b(A.path)}))}}),P(U,k,N),w.appendChild(U)}},b=async j=>{try{let T=await R("list",{path:j??A.path});A.path=typeof T.path=="string"&&T.path!==""?T.path:"/",o.value=A.path;let k=Array.isArray(T.entries)?T.entries.length:0;O(T.entries),I(A.path+" \u2014 "+String(k)+" \u9879")}catch(T){I(String(T&&T.message?T.message:T),"error")}},E=(j,T)=>$("\u4E0B\u8F7D "+j.name+"\u2026",async()=>{x.reset();let k;try{k=await bl("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,path:T})},(N,H)=>{x.set(N,H)},Bt.maxDownloadMb,N=>x.setCancel(N))}catch(N){if(hn(N)){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+j.name);return}throw x.fail("\u4E0B\u8F7D\u5931\u8D25"),N}x.done("\u5B8C\u6210"),wl(k,j.name),setTimeout(()=>x.reset(),1500),I("\u5DF2\u4E0B\u8F7D "+j.name+"\uFF08"+(Ve(k.size)||String(k.size)+" B")+"\uFF09")}),L=(j,T,k,N,H)=>new Promise((q,U)=>{let Z=Zu(JSON.stringify({...i,path:Bi(A.path,T)})),ee=new XMLHttpRequest;H.abort=()=>{H.stopped=!0,ee.abort()},ee.open("POST","/api/dsh-tty/sftp/upload"),ee.setRequestHeader("x-dsh-sftp-meta",Z);let Y=N>1?String(k)+"/"+String(N)+" ":"";I("\u4E0A\u4F20 "+Y+T,"busy"),ee.upload.addEventListener("progress",ie=>{ie.lengthComputable?x.set(ie.loaded,ie.total):x.pulse(0)});let Q=!1,X=ie=>{Q||(Q=!0,ie===null?q():U(ie))};ee.addEventListener("load",()=>{if(ee.status===200){N===1&&x.done("\u4E0A\u4F20\u5B8C\u6210"),X(null);return}if(H.stopped)return;x.fail("\u4E0A\u4F20\u5931\u8D25");let ie="HTTP "+ee.status;try{let ne=JSON.parse(ee.responseText);ne!==null&&typeof ne=="object"&&typeof ne.error=="string"&&(ie=ne.error)}catch{}X(new Error(ie))}),ee.addEventListener("error",()=>{if(H.stopped){X(new mi);return}x.fail("\u4E0A\u4F20\u5931\u8D25"),X(new Error("\u7F51\u7EDC\u9519\u8BEF"))}),ee.addEventListener("abort",()=>{X(new mi)}),ee.send(j)}),M=async j=>$("\u4E0A\u4F20\u4E2D\u2026",async()=>{let T=Bt;if(T.maxUploadFiles>0&&j.length>T.maxUploadFiles){I("\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08"+String(T.maxUploadFiles)+"\uFF09\uFF1A\u672C\u6B21 "+String(j.length)+" \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","error"),x.fail("\u8D85\u9650");return}let k=T.maxUploadMb>0?T.maxUploadMb*1024*1024:0,N=j.find(ee=>k>0&&(ee.file?.size??0)>k);if(N!==void 0){I("\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08"+Ve(k)+"\uFF09\uFF1A"+String(N.relPath??"")+"\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error"),x.fail("\u8D85\u9650");return}if(j._limitExceeded===!0){I("\u6587\u4EF6\u603B\u5927\u5C0F\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF1A\u8BF7\u5206\u6279\u4E0A\u4F20\uFF08\u6216\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\uFF09","error"),x.fail("\u8D85\u9650");return}let H=new Set;for(let ee of j){let Y=ee.relPath.lastIndexOf("/");if(Y<=0)continue;let Q=ee.relPath.slice(0,Y);H.has(Q)||(H.add(Q),await R("mkdir",{path:Bi(A.path,Q),parents:!0}).catch(()=>{}))}x.reset();let q={stopped:!1,abort:null};x.setCancel(()=>q.abort?.());let U=0,Z=0;try{for(let ee of j){if(q.stopped)break;U+=1,q.abort=null;try{await L(ee.file,ee.relPath,U,j.length,q),Z+=1}catch(Y){if(hn(Y)||q.stopped)break;throw Y}}}finally{x.setCancel(null)}if(q.stopped){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 "+String(Z)+"/"+String(j.length)+" \u4E2A\uFF09"),await b(A.path);return}x.done("\u5168\u90E8\u5B8C\u6210"),setTimeout(()=>x.reset(),1500),I("\u4E0A\u4F20\u5B8C\u6210 "+String(j.length)+" \u4E2A\u6587\u4EF6"),await b(A.path)});_.addEventListener("click",()=>{$("\u52A0\u8F7D\u4E2D\u2026",()=>b(A.path))}),g.addEventListener("click",()=>{A.busy||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",h.style.display="",d.focus(),v=async()=>{let j=d.value.trim();j!==""&&(C(),await $("\u521B\u5EFA\u76EE\u5F55 "+j+"\u2026",async()=>{await R("mkdir",{path:Bi(A.path,j)}),await b(A.path)}))})}),S.addEventListener("click",()=>{A.busy===!1&&p.click()}),p.addEventListener("change",()=>{let j=[...p.files??[]].map(T=>({relPath:T.name,file:T}));p.value="",j.length>0&&M(j)});let z=0,K=j=>{j?w.dataset.drag="":delete w.dataset.drag};l.addEventListener("dragenter",j=>{j.preventDefault(),z+=1,K(!0)}),l.addEventListener("dragover",j=>{j.preventDefault()}),l.addEventListener("dragleave",()=>{z=Math.max(0,z-1),z===0&&K(!1)}),l.addEventListener("drop",j=>{j.preventDefault(),z=0,K(!1),!A.busy&&Qu(j.dataTransfer).then(T=>{(T.length>0||T._limitExceeded===!0)&&M(T)})}),o.addEventListener("keydown",j=>{if(j.key!=="Enter"||(j.preventDefault(),A.busy))return;let T=o.value.trim();T!==""&&$("\u52A0\u8F7D\u4E2D\u2026",()=>b(T))});let V=mn();pl(l,"SFTP \xB7 "+n,V===null?340:Math.round(V.height*.46)),$("\u8FDE\u63A5\u4E2D\u2026",()=>b(""))}function Yt(){if(!yn())return;Ju();let e=Ki,t=qr;Ki=null,qr=null,e!==null&&e.remove(),t!==null&&t.dispose()}function Sl(){if(Pe===null)return;let e=Pe.style.display==="none"||Pe.style.display==="";Pe.style.display=e?"":"none";let t=re!==null?re.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&Pe.focus()}var ef={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function tf(e){let t=Ge();if(t===void 0||t.search===void 0)return;let i=Pe.value;if(i==="")return;let n={decorations:ef};e?t.search.findPrevious(i,n):t.search.findNext(i,n)}function Ha(){Ui||re===null&&!gn()||$t!==null||($t=setTimeout(()=>{$t=null,Kr()},Hi),Hi=Math.min(Hi*2,5e3))}function Qi(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function dn(e){return Qi(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function rf(){return Dt==="tmux"?{t:"spawn",cwd:Ba(),persist:!0,persistName:Sn()}:{t:"spawn",cwd:Ba()}}async function Cl(){if(await Cn(),re===null){await nf();return}let e=Lu(),t=Eu();if(![...ae.values()].some(s=>s.embedded!==!0)){if(e.length>0||t.length>0){be({t:"sessions"});let s=await zr("sessions",4e3),a=new Map;if(s!==null&&Array.isArray(s.list))for(let o of s.list)o!==null&&typeof o=="object"&&o.attachable===!0&&a.set(o.sid,o);let f=new Set;for(let o of e){if(a.has(o.sid))Au(o);else if(dn(o.spawnSpec))Oa(o);else continue;Qi(o.spawnSpec)&&f.add(o.spawnSpec.persistName)}for(let o of t){let _=o.spawnSpec.persistName;f.has(_)||(Oa(o),f.add(_))}Vt()}if(![...ae.values()].some(s=>s.embedded!==!0)){if(await jr())return;ji()}return}let i=[...ae.values()].filter(s=>!s.exited&&(s.embedded!==!0||s.spawned===!0)),n=i.filter(s=>dn(s.spawnSpec)),l=null;if(n.length>0){be({t:"sessions"});let s=await zr("sessions",4e3),a=new Set((s!==null&&Array.isArray(s.list)?s.list:[]).map(f=>f?.sid).filter(f=>typeof f=="string"));l=n.filter(f=>!a.has(f.sid));for(let f of l)vn(f.sid)}let r=l!==null?new Set(l.map(s=>s.sid)):new Set;for(let s of i)r.has(s.sid)||be({t:"attach",sid:s.sid})}function sf(){de!==null&&(de.readyState===WebSocket.OPEN||de.readyState===WebSocket.CONNECTING)||Kr()}async function nf(){let e=[...ae.values()].filter(n=>n.embedded===!0&&!n.exited);if(e.length===0)return;be({t:"sessions"});let t=await zr("sessions",4e3),i=new Set((t!==null&&Array.isArray(t.list)?t.list:[]).map(n=>n?.sid).filter(n=>typeof n=="string"));for(let n of e)n.spawned===!0&&(i.has(n.sid)?be({t:"attach",sid:n.sid}):dn(n.spawnSpec)?al(n):(n.exited=!0,n.live=!1,li(n,"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","\u70B9\u51FB\u91CD\u65B0\u6267\u884C","exited")))}function Kr(){if(de!==null){try{de.close()}catch{}de=null}Ui=!1,clearTimeout($t),$t=null,Tr=!0,Ht("\u8FDE\u63A5\u4E2D\u2026","");try{de=new WebSocket(Gd())}catch(e){Tr=!1,Ht("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),Ha();return}de.onopen=()=>{Tr=!1,Hi=1e3,Xe=null,Ht("\u5DF2\u8FDE\u63A5","connected");for(let e of[...tn])tn.delete(e),ae.has(e.tab.sid)&&be(e.frame);Cl()},de.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let i=t.sid;if(t.t==="ready"){let n=typeof t.target=="string"?t.target:"";Ht(t.kind==="ssh"?"SSH "+(n!==""?n+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let l=ae.get(i);if(l!==void 0){if(l.exited=!1,l.spawned=!0,l.live=!0,l.errored=!1,l.target=n,l.persistTmux=t.persist===!0,t.kind==="ssh"&&n!==""&&!l.label&&(l.label=n,ht()),Ut(),en(i),li(l,""),bi(l),t.persist===!0){let r=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([r,new Promise(s=>setTimeout(s,500))]).then(()=>rl(150))}Gi(),yu(i),Vt()}}else if(t.t==="data"){let n=ae.get(i);n!==void 0&&n.term!==null&&(n.term.write(String(t.d??"")),lf())}else if(t.t==="exit"){let n=ae.get(i);if(n!==void 0){n.exited=!0,n.live=!1,n.stats=null,i===St&&Gt();let l=t.code!==null&&t.code!==void 0?"code="+t.code:"",r=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";Ht("\u5DF2\u9000\u51FA "+[l,r].filter(Boolean).join(" "),""),Ut(),en(i),li(n,"\u4F1A\u8BDD\u5DF2\u9000\u51FA","\u70B9\u51FB\u91CD\u65B0\u6253\u5F00","exited"),Gi(),Vt()}}else if(t.t==="stats")try{let n=ae.get(i);if(n!==void 0){let l=t.stats;n.stats=vu(l)?l:null,n.statsAt=Date.now(),i===St&&Gt()}}catch(n){console.warn("[dsh-tty] stats \u5E27\u5904\u7406\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: "+(n instanceof Error?n.message:String(n)))}else if(t.t==="error")if(Ht("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof i=="string"){let n=ae.get(i);n!==void 0&&(n.live||(n.errored=!0),Ut(),en(i),li(n,"\u8FDE\u63A5\u51FA\u9519",String(t.m??"")+" \xB7 \u70B9\u51FB\u91CD\u8BD5","error"))}else of("\u70B9\u51FB\u91CD\u8BD5")},de.onclose=()=>{if(Tr=!1,!Ui){Ht("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of ae.values())e.exited||li(e,"\u8FDE\u63A5\u65AD\u5F00","\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","info");Ha()}},de.onerror=()=>{}}function of(e){fi!==null&&(fi.textContent=e)}function un(){(re===null||De)&&yl()}function yl(){if(re!==null){De&&xl();return}Yi(),re=document.createElement("div"),re.className="tt_modalBackdrop",re.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+Yr+'</span><div class="tt_tabs"></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+Zd+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+Qd+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+eu+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+tu+'</button></span><span class="tt_winGroup"><button class="tt_min" title="\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09">'+nu+'</button><button class="tt_close" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">'+Xr+'</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_overlay"></div></div></div></div>',document.body.appendChild(re),Ir=re.querySelector(".tt_status"),Wt=re.querySelector(".tt_statusText"),qt=re.querySelector(".tt_statusDot"),wt=re.querySelector(".tt_tabs"),Pi=re.querySelector(".tt_connbar"),Oi=re.querySelector(".tt_connDot"),Nr=re.querySelector(".tt_connTarget"),je=re.querySelector(".tt_connBadge"),Ii=re.querySelector(".tt_connActions"),At=re.querySelector(".tt_work"),qe=re.querySelector(".tt_body"),at=re.querySelector(".tt_statsBar"),Xe=null,Su(),fi=re.querySelector(".tt_body > .tt_overlay"),Pe=re.querySelector(".tt_searchInput"),fi.addEventListener("click",()=>{fi.textContent="",Kr()});let e=re.querySelector("[data-act=search]");e.addEventListener("click",()=>{Sl(),Pe.style.display!=="none"&&Pe.focus()}),e.dataset.on="",Pe.addEventListener("keydown",t=>{t.key==="Enter"?(t.preventDefault(),tf(t.shiftKey)):t.key==="Escape"&&(t.stopPropagation(),Pe.style.display="none")}),re.querySelector("[data-act=clear]").addEventListener("click",()=>{let t=Ge();t!==void 0&&t.term!==null&&t.term.clear()}),re.querySelector("[data-act=copy]").addEventListener("click",()=>{let t=Ge();if(t===void 0||t.term===null)return;let i=t.term.getSelection();i!==""&&navigator.clipboard.writeText(i).catch(()=>{})}),re.querySelector("[data-act=paste]").addEventListener("click",()=>{let t=Ge();t!==void 0&&navigator.clipboard.readText().then(i=>{be({t:"input",sid:t.sid,d:i})}).catch(()=>{})}),re.querySelector(".tt_min").addEventListener("click",()=>{Gr()}),re.querySelector(".tt_close").addEventListener("click",()=>{Vi()}),re.addEventListener("mousedown",t=>{t.target===re&&Gr()}),document.addEventListener("keydown",kl),Ni=new ResizeObserver(()=>{De||(Dr(),Mu(Ge()))}),Ni.observe(qe),ht(),Ut(),de!==null&&de.readyState===WebSocket.OPEN?Cl():Kr()}function af(){Ae=document.createElement("div"),Ae.className="tt_dock",Ae.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",Ae.innerHTML='<span class="tt_dockTitle">'+Yr+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button>',Hr=Ae.querySelector(".tt_dockCount"),vi=Ae.querySelector(".tt_dockStatus"),Kt=Ae.querySelector(".tt_dockDot");let e=[...ae.values()].filter(t=>!t.exited).length;Hr.textContent=ae.size>0?"\xB7 "+e+"/"+ae.size:"",Wt!==null&&(vi.textContent=Wt.textContent),qt!==null&&(Kt.dataset.state=qt.dataset.state??""),Ae.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),Vi();return}xl()}),document.body.appendChild(Ae)}function Gr(){re===null||De||(lt(),Rt(),Yt(),De=!0,Pe!==null&&(Pe.style.display="none"),re.dataset.minimized="",Ji(),Gt(),document.querySelector("[data-dsh-tty-entry]")!==null?Gi():(af(),Ae.classList.add("tt_dockCompact")))}function Gi(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!De){t!==null&&t.remove(),delete e.dataset.minimized,e.removeAttribute("title");return}t===null&&(t=document.createElement("span"),t.className="tt_sidebarEntryBadge",t.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',e.appendChild(t)),e.dataset.minimized="",e.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let i=[...ae.values()].filter(l=>!l.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=i+"/"+ae.size;let n=t.querySelector(".tt_sidebarBadgeDot");n!==null&&qt!==null&&(n.dataset.state=qt.dataset.state??"")}function lf(){if(!De)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Kt;e!==null&&(e.dataset.active="",clearTimeout(Fr),Fr=setTimeout(()=>{delete e.dataset.active},900))}function xl(){if(re===null||!De)return;De=!1,delete re.dataset.minimized,clearTimeout(Fr),Ae!==null&&(Ae.remove(),Ae=null),Hr=null,vi=null,Kt=null,Gi(),Ji(),Gt();let e=Ge();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&bi(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Vi(){if(re===null)return;Br(!0);let e=gn();if(Ui=!e,De=!1,lt(),Rt(),Yt(),clearTimeout(Fr),clearTimeout($t),$t=null,Hi=1e3,Ae!==null&&(Ae.remove(),Ae=null),Hr=null,vi=null,Kt=null,Gi(),de!==null){for(let t of ae.values())!t.exited&&t.embedded!==!0&&be({t:"kill",sid:t.sid});if(!e){try{de.close()}catch{}de=null}}Ni!==null&&(Ni.disconnect(),Ni=null);for(let[t,i]of[...ae])if(i.embedded!==!0){if(i.term!==null)try{i.term.dispose()}catch{}ae.delete(t)}St=null,document.removeEventListener("keydown",kl),re.remove(),re=null,At=null,Ir=null,Wt=null,qt=null,wt=null,Pi=null,Oi=null,Nr=null,je=null,Ii=null,nn(),Cu(),at=null,Xe=null,qe=null,fi=null,Pe=null,Jr=0;try{sessionStorage.removeItem(Wr)}catch{}}function kl(e){if(e.key==="Escape"&&re!==null){if(e.preventDefault(),Ki!==null){Yt();return}if(_i!==null){Rt();return}if(Ke!==null){lt();return}Gr()}}function cf(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function hf(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let i of e.children)if(i.tagName==="BUTTON")return i}function df(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label","\u7EC8\u7AEF"),e.innerHTML='<span class="tt_sidebarEntryIcon">'+Yr+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),yl()}),e}function Fa(e,t){let i=hf(e);if(i===void 0)return!1;if(t.parentElement!==e){let n=i.closest('[class*="logoRow"]'),l=n!==null&&n.parentElement===e?n:i,r=Array.from(e.children).filter(s=>s instanceof HTMLElement&&s.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(r.length>0){let s=r[r.length-1];e.insertBefore(t,s.nextSibling)}else e.insertBefore(t,l.nextElementSibling)}return!0}function uf(){if(Yi(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=df(),t,i=!1,n=()=>{if(t!==void 0&&!t.isConnected&&(r.disconnect(),t=void 0,i=!1),i){if(document.body.contains(e))return;r.disconnect(),t=void 0,i=!1}t??(t=cf()),t!==void 0&&(i=Fa(t,e),i&&r.observe(t,{childList:!0,subtree:!0}))},l=new MutationObserver(()=>{n()});l.observe(document.body,{childList:!0,subtree:!0});let r=new MutationObserver(()=>{if(t===void 0||!t.isConnected){i=!1,n();return}t.contains(e)||(i=Fa(t,e))});return n(),()=>{l.disconnect(),r.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},i=e("react"),{jsx:n,jsxs:l}=e("react/jsx-runtime"),r="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function s(){let[a,f]=i.useState(!1),[o,_]=i.useState(null),[g,S]=i.useState(!1),[p,h]=i.useState(!1),[d,c]=i.useState({kind:"",text:""}),[u,v]=i.useState([]),[C,w]=i.useState(!1),y=W=>n("div",{className:"tt_cardSection",children:W}),m=async()=>{try{let G=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();G.ok&&typeof G.config=="object"&&G.config!==null?(_(G.config),qi(G.config)):c({kind:"error",text:String(G.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(W){c({kind:"error",text:String(W&&W.message?W.message:W)})}},x=async()=>{try{let G=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();G.ok&&Array.isArray(G.shells)&&v(G.shells)}catch{}};i.useEffect(()=>{a&&!g&&(S(!0),m(),x())},[a]);let A=(W,G)=>_(J=>({...J||{},[W]:G})),I=(W,G)=>_(J=>({...J||{},sftpLimits:{...J?.sftpLimits??{},[W]:G}})),[F,R]=i.useState(null),[$,B]=i.useState(null),[D,P]=i.useState(""),[O,b]=i.useState(null),[E,L]=i.useState(""),[M,z]=i.useState(""),[K,V]=i.useState(""),j=i.useRef(null),[T,k]=i.useState(!1),[N,H]=i.useState({text:"",kind:""}),[q,U]=i.useState(!1),[Z,ee]=i.useState({running:!1,ok:!1,text:""}),[Y,Q]=i.useState({}),[X,ie]=i.useState([]),[ne,he]=i.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});i.useEffect(()=>{if(!a)return;let W=!0,G=async()=>{try{let le=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();W&&le.ok&&Array.isArray(le.tunnels)&&ie(le.tunnels)}catch{}};G();let J=setInterval(G,2e3);return()=>{W=!1,clearInterval(J)}},[a]);let ce=W=>G=>he(J=>({...J||{},[W]:G.target.value})),ge=W=>W?.direction==="remote"?`\u8FDC\u7A0B:${W.remoteHost||"127.0.0.1"}:${String(W.remotePort??0)} \u2192 \u672C\u673A:${String(W.localTargetPort??0)}`:`\u672C\u673A:${String(W?.localPort??0)} \u2192 ${W?.remoteHost??"?"}:${String(W?.remotePort??0)}`,Se=(o?.sshHosts??[]).find(W=>W?.name===ne?.bookName),Oe=async W=>{try{let G=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:W})}),J=await G.json().catch(()=>({}));return!G.ok||!J.ok?(c({kind:"error",text:String(J.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(G){return c({kind:"error",text:String(G&&G.message?G.message:G)}),!1}},Ie=()=>{c({kind:"",text:""});let W=ne||{},G=W.bookName||(Array.isArray(o?.sshHosts)?o.sshHosts[0]?.name:"")||"";if(G===""){c({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let J=Ee=>{let er=Number(Ee);return Number.isInteger(er)&&er>=1&&er<=65535?er:0},te;if(W.direction==="remote"){if(te={name:"",bookName:G,direction:"remote",remotePort:J(W.remotePort),localTargetHost:"",localTargetPort:J(W.localTargetPort),enabled:!0},te.remotePort<1||te.localTargetPort<1){c({kind:"error",text:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09"});return}te.name=`${G}-R${String(te.remotePort)}`}else{if(te={name:"",bookName:G,direction:"local",localPort:J(W.localPort),remoteHost:W.remoteHost.trim(),remotePort:J(W.remotePort),enabled:!0},te.localPort<1||te.remoteHost===""||te.remotePort<1){c({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}te.name=`${G}-L${String(te.localPort)}`}let le=new Set((Array.isArray(o?.tunnels)?o.tunnels:[]).map(Ee=>Ee?.name)),se=te.name,_e=2;for(;le.has(se);)se=`${te.name}-${String(_e)}`,_e+=1;te.name=se;let oe=[...Array.isArray(o?.tunnels)?o.tunnels:[],te];_(Ee=>({...Ee||{},tunnels:oe})),he(Ee=>({...Ee||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),Oe(oe).then(Ee=>{Ee&&c({kind:"ok",text:`\u96A7\u9053\u300C${se}\u300D\u5DF2\u751F\u6548`})})},Pt=W=>{let G=(Array.isArray(o?.tunnels)?o.tunnels:[]).filter(J=>J?.name!==W);_(J=>({...J||{},tunnels:G})),Oe(G)},wi=(W,G)=>{let J=(Array.isArray(o?.tunnels)?o.tunnels:[]).map(te=>te?.name===W?{...te,enabled:G}:te);_(te=>({...te||{},tunnels:J})),Oe(J)},Je=W=>{R(W?.name??null),P(""),ee({running:!1,ok:!1,text:""}),L(""),z(""),is(),k(ct!==null),B({name:W?.name??"",host:W?.host??"",port:String(W?.port??22),username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0,persist:W?.persist!==!1}),za().then(G=>b(G)),rs(W?.password??"")},Ot=()=>{R(null),B(null),P(""),ee({running:!1,ok:!1,text:""}),L(""),z(""),is()},Ze=async()=>{if($===null)return;let W=$.name.trim(),G=$.host.trim(),J=$.username.trim();if(W===""||G===""||J===""){P("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let te=Number($.port);if((!Number.isInteger(te)||te<1||te>65535)&&(te=22),(o?.sshHosts??[]).some(se=>se?.name===W&&W!==F)){P("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+W);return}if($.auth==="key"&&$.keyPath.trim()===""){P("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}P("");let le=$.password;if($.auth==="password"){let se=await qa(T,$.password,G,te,J,"PASSWORD");if(se.error!==void 0){P(se.error);return}se.value!==void 0&&(le=se.value)}_(se=>({...se||{},sshHosts:(Array.isArray(se?.sshHosts)?se.sshHosts:[]).map(_e=>_e?.name===F?{name:W,host:G,port:te,username:J,auth:$.auth,keyPath:$.keyPath.trim(),passphrase:$.passphrase,password:le,agentForward:$.agentForward,persist:$.persist===!0}:_e)})),Q(se=>{let _e={...se};return delete _e[W],F!==W&&delete _e[F],_e}),R(null),B(null),ee({running:!1,ok:!1,text:""}),c({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+W+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},It=W=>{F===W&&Ot(),Q(G=>{let J={...G};return delete J[W],J}),_(G=>({...G||{},sshHosts:(Array.isArray(G?.sshHosts)?G.sshHosts:[]).filter(J=>J?.name!==W)}))},fe=async W=>{let G=W?.name??"";if(G==="")return;let J={host:W?.host??"",port:Number(W?.port)||22,username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0};Q(le=>({...le,[G]:{running:!0,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}}));let te=await an(J,!0);Q(le=>{let se=le[G]||{};if(te.result){let _e=te.result.auth?.ok===!0;return{...le,[G]:{running:!1,ok:_e,text:ln(te.result)}}}return{...le,[G]:{running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(te.error||"\u672A\u77E5\u9519\u8BEF")}}})},ts=async W=>{let G=(Array.isArray(o?.hostKeys)?o.hostKeys:[]).filter(J=>!(J?.host===W?.host&&Number(J?.port)===Number(W?.port)));_(J=>({...J||{},hostKeys:G}));try{let J=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:G})}),te=await J.json().catch(()=>({}));!J.ok||!te.ok?c({kind:"error",text:String(te.error||"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25")}):c({kind:"ok",text:"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09"})}catch(J){c({kind:"error",text:String(J&&J.message?J.message:J)})}},El=async()=>{c({kind:"",text:""});try{let G=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!G.ok){c({kind:"error",text:String(G.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let J=Array.isArray(G.entries)?G.entries:[],te=[...Array.isArray(o?.sshHosts)?o.sshHosts:[]],le=new Set(te.map(oe=>oe?.name)),se=0,_e=0;for(let oe of J)if(!(oe===null||typeof oe!="object"||typeof oe.name!="string")){if(le.has(oe.name)){_e+=1;continue}le.add(oe.name),te.push({name:oe.name,host:String(oe.host??oe.name),port:Number(oe.port)||22,username:String(oe.username??""),auth:oe.auth==="key"?"key":"agent",keyPath:String(oe.keyPath??""),passphrase:"",password:"",agentForward:!1}),se+=1}_(oe=>({...oe||{},sshHosts:te})),c(se===0?{kind:"ok",text:_e>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${_e} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09`:"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"}:{kind:"ok",text:`\u5DF2\u5BFC\u5165 ${se} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${_e} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch(W){c({kind:"error",text:String(W&&W.message?W.message:W)})}},Ll=async()=>{c({kind:"",text:""});try{let G=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!G.ok){c({kind:"error",text:String(G.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let J=Array.isArray(G.entries)?G.entries:[],te=[...Array.isArray(o?.hostKeys)?o.hostKeys:[]],le=new Set(te.map(oe=>String(oe?.host??"")+":"+String(oe?.port??22))),se=0,_e=0;for(let oe of J){if(oe===null||typeof oe!="object"||typeof oe.host!="string"||typeof oe.fingerprint!="string")continue;let Ee=oe.host+":"+String(oe.port??22);if(le.has(Ee)){_e+=1;continue}le.add(Ee),te.push({host:oe.host,port:Number(oe.port)||22,fingerprint:oe.fingerprint}),se+=1}if(se===0){c({kind:"ok",text:_e>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${_e} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}_(oe=>({...oe||{},hostKeys:te}));try{let oe=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:te})}),Ee=await oe.json().catch(()=>({}));if(!oe.ok||!Ee.ok){c({kind:"error",text:String(Ee.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}c({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${se} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${_e} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(oe){c({kind:"error",text:String(oe&&oe.message?oe.message:oe)})}}catch(W){c({kind:"error",text:String(W&&W.message?W.message:W)})}},Ml=async()=>{h(!0),c({kind:"",text:""});let W={};for(let G of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose","statsEnabled"]){let J=(o||{})[G];J!==void 0&&J!==""&&(W[G]=J)}W.sshHosts=Array.isArray(o?.sshHosts)?o.sshHosts:[],W.tunnels=Array.isArray(o?.tunnels)?o.tunnels:[],o?.sftpLimits&&typeof o.sftpLimits=="object"&&(W.sftpLimits={maxDownloadMb:Number(o.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(o.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(o.sftpLimits.maxUploadFiles)||0});try{let G=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(W)}),J=await G.json();!G.ok||!J.ok?c({kind:"error",text:String(J.error||"\u4FDD\u5B58\u5931\u8D25")}):(c({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),J.config&&(_(J.config),qi(J.config)))}catch(G){c({kind:"error",text:String(G&&G.message?G.message:G)})}h(!1)},is=()=>{j.current!==null&&(clearTimeout(j.current),j.current=null),V("")},rs=async W=>{let G=di(W);if(gi()===null){k(!1),U(!1),H({text:ct===null?"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58",kind:"muted"});return}if(G===""){U(!1),H({text:"",kind:""});return}let J=await Ua(G);if(J.unreported===!0){U(!1),H({text:"\u5F15\u7528 "+G+"\uFF1A\u5BBF\u4E3B\u672A\u62A5\u544A\u72B6\u6001",kind:"plain"});return}if(J.error!==void 0){U(!1),H({text:"\u8BFB\u53D6\u51ED\u636E\u72B6\u6001\u5931\u8D25\uFF1A"+J.error,kind:"error"});return}let te=J.view;H({text:te.configured?"\u5DF2\u5B58\u5165"+(te.source!==""?"\uFF08\u6765\u6E90 "+te.source+"\uFF09":"")+" \xB7 "+G:"\u5F15\u7528 "+G+"\uFF1A\u5B58\u50A8\u91CC\u8FD8\u6CA1\u6709\u8FD9\u4E2A\u503C",kind:te.configured?"ok":"plain"}),U(te.configured===!0&&te.writable===!0)},Rl=async()=>{let W=di($?.password??"");if(W==="")return;let G=await ja(W);if(G.error!==void 0){H({text:G.error,kind:"error"});return}B(J=>({...J||{},password:""})),H({text:"",kind:""}),U(!1)},Tl=(W,G)=>{let J=String($?.[W]??"");if(J===""||J.startsWith("env:")||K===G){is(),B(te=>({...te||{},[W]:"env:"+G})),L(""),W==="password"&&rs("env:"+G);return}V(G),j.current!==null&&clearTimeout(j.current),j.current=setTimeout(()=>{j.current=null,V("")},4e3)},xn=(W,G)=>{if(O===null)return null;if(O.length===0)return n("span",{className:"tt_cardHint",children:G});let J=E===W,te=M.trim().toUpperCase(),le=te===""?O:O.filter(se=>se.toUpperCase().includes(te));return l("div",{className:"tt_credPicker",children:[n("input",{className:"tt_cardInput",value:J?M:"",placeholder:"\u6216\uFF1A\u9009\u62E9\u51ED\u636E\u5B58\u50A8\u91CC\u7684\u5F15\u7528\u540D",title:"\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",autoComplete:"off",spellCheck:!1,onFocus:()=>{L(W),z("")},onBlur:se=>{se.currentTarget.parentElement.contains(se.relatedTarget)||L("")},onChange:se=>{z(se.target.value),L(W)}}),...J?[n("div",{className:"tt_envList",children:[...le.length===0?[n("span",{className:"tt_envMore",children:"\u6CA1\u6709\u5339\u914D\u7684\u5F15\u7528"})]:le.slice(0,30).map(se=>n("button",{type:"button",className:"tt_envItem","data-danger":K===se?"":void 0,onMouseDown:_e=>_e.preventDefault(),onClick:()=>Tl(W,se),children:K===se?se+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09":se},se)),...le.length>30?[n("span",{className:"tt_envMore",children:"\u8FD8\u6709 "+(le.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009"})]:[]]},"cred-list-"+W)]:[]]})},Al=()=>{let G=di($?.password??"")!=="",J=gi()===null;return l("div",{className:"tt_sshRow tt_credRow",children:[G?n("button",{type:"button",className:"tt_toolBtn tt_credClear",disabled:q!==!0,onClick:()=>{Rl()},children:"\u6E05\u9664\u5DF2\u5B58\u51ED\u636E"}):n("label",{className:"tt_credToggle",title:"\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",children:[n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:T,disabled:J,onChange:te=>k(te.target.checked)}),n("span",{children:"\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8"})]}),N.text===""?null:n("span",{className:"tt_credStatus","data-kind":N.kind,children:N.text}),J&&N.text===""?n("span",{className:"tt_credStatus","data-kind":"muted",children:"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58"}):null]})},kn=()=>{let W=String($?.host??"").trim(),G=String($?.username??"").trim(),J=Number($?.port);if((!Number.isInteger(J)||J<1||J>65535)&&(J=22),W===""||G==="")return P("\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B"),null;let te=$?.auth,le={host:W,port:J,username:G,auth:te};if(te==="key"){let se=String($?.keyPath??"").trim();if(se==="")return P("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84"),null;le.keyPath=se,$?.passphrase!==""&&(le.passphrase=$.passphrase)}if(te==="password"){let se=String($?.password??"");if(se==="")return P("auth=password \u9700\u8981\u5BC6\u7801"),null;le.password=se}return $?.agentForward===!0&&(le.agentForward=!0),le},Dl=()=>{P("");let W=kn();W!==null&&(ee({running:!0,ok:!1,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}),an(W,!1).then(G=>{if(G.result){let J=G.result.auth?.ok===!0;ee({running:!1,ok:J,text:ln(G.result)});return}ee({running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(G.error||"\u672A\u77E5\u9519\u8BEF")})}))},Bl=()=>{P("");let W=kn();W!==null&&es(W)},Pl=()=>{if($===null)return null;let W=(G,J,te,le,se)=>l("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:G}),n("input",{className:"tt_cardInput",type:le??"text",value:$[J]??"",placeholder:te??"",autoComplete:"off",spellCheck:!1,onChange:_e=>{let oe=_e.target.value;B(Ee=>({...Ee||{},[J]:oe}))},...se??{}})]});return l("div",{className:"tt_sshEdit",children:[n("div",{className:"tt_sshSection",children:"\u8FDE\u63A5"}),l("div",{className:"tt_sshGrid",children:[W("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),W("\u7AEF\u53E3","port","22")]}),W("\u4E3B\u673A","host","example.com \u6216 IP"),W("\u7528\u6237\u540D","username","root"),n("div",{className:"tt_sshSection",children:"\u8BA4\u8BC1"}),l("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),l("select",{className:"tt_cardInput",value:$.auth,onChange:G=>B(J=>({...J||{},auth:G.target.value})),children:[n("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),n("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),n("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...$.auth==="key"?[W("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),W("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09","passphrase","","password"),xn("passphrase","\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")]:[],...$.auth==="password"?[W("\u5BC6\u7801","password","","password",{onBlur:()=>{rs($.password)}}),Al(),xn("password","\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")]:[],n("div",{className:"tt_sshSection",children:"\u9009\u9879"}),l("label",{className:"tt_cardRow",children:[n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:$.agentForward===!0,onChange:G=>B(J=>({...J||{},agentForward:G.target.checked}))}),n("span",{className:"tt_cardLabel",children:"agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09"})]}),Dt==="tmux"?l("label",{className:"tt_cardRow",children:[n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:$.persist===!0,onChange:G=>B(J=>({...J||{},persist:G.target.checked}))}),n("span",{className:"tt_cardLabel",children:"\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"})]}):null,Z.text!==""?n("div",{className:"tt_sshProbeResult"+(!Z.running&&Z.ok?" tt_sshProbeOk":"")+(!Z.running&&!Z.ok?" tt_sshProbeBad":""),children:Z.text}):null,D!==""?n("span",{className:"tt_cardMessage tt_cardMessageError",children:D}):null,l("div",{className:"tt_sshActions",children:[l("div",{className:"tt_sshActionsGroup",children:[n("button",{type:"button",className:"tt_toolBtn",onClick:Ot,children:"\u53D6\u6D88"}),n("button",{type:"button",className:"tt_toolBtn",title:"\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",onClick:Bl,children:"\u6587\u4EF6\u6D4F\u89C8"}),n("button",{type:"button",className:"tt_toolBtn",disabled:Z.running,title:"\u6309\u5F53\u524D\u586B\u5199\u8BCA\u65AD\u8FDE\u63A5\uFF08TCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\uFF09\uFF1B\u4E0D\u4F1A\u65B0\u5EFA\u4F1A\u8BDD\uFF0C\u4E5F\u4E0D\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9",onClick:Dl,children:Z.running?"\u8BD5\u8FDE\u4E2D\u2026":"\u8BD5\u8FDE"})]}),l("div",{className:"tt_sshActionsGroup",children:[n("button",{type:"button",className:"tt_cardSave",onClick:()=>{Ze()},children:"\u5E94\u7528"}),n("span",{className:"tt_cardHint",children:"\u968F\u5361\u7247\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]})]})]})},Si=(W,G,J,te)=>l("label",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:W}),n("input",{className:"tt_cardInput",value:o[G]??"",placeholder:J??"",onChange:le=>A(G,le.target.value)}),te?n("span",{className:"tt_cardHint",children:te}):null]}),Ci=(W,G)=>l("label",{className:"tt_cardField tt_cardRow",children:[n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:o[G]===!0,onChange:J=>A(G,J.target.checked)}),n("span",{className:"tt_cardLabel",children:W})]});return l("li",{className:a?"tt_card tt_cardOpen":"tt_card",children:[l("button",{type:"button",className:"tt_cardHeader","aria-expanded":a,onClick:()=>f(W=>!W),children:[l("span",{className:"tt_cardHeadText",children:[n("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),n("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\u3001SSH \u8FDE\u63A5\u7C3F\u4E0E\u4E3B\u673A\u6307\u7EB9\u9489\u624E\u3001tmux \u4F1A\u8BDD\u6301\u4E45\u5316\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),n("span",{className:"dshkit_badge",children:"Kit"}),n("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:n("path",{d:r,fill:"currentColor"})})]}),a?l("div",{className:"tt_cardBody",children:[o===null?n("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):l("div",{children:[y("\u57FA\u7840"),Ci("\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","enabled"),Ci("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),Ci("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),y("SFTP \u6587\u4EF6\u4F20\u8F93"),l("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),l("select",{className:"tt_cardInput",value:o.sftpStyle==="dual"?"dual":"dialog",onChange:W=>A("sftpStyle",W.target.value),children:[n("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),n("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),n("span",{className:"tt_cardHint",children:"\u53CC\u680F\u5728\u672C\u673A\u4E0E\u8FDC\u7A0B\u4E4B\u95F4\u5BF9\u62F7\u6587\u4EF6\uFF08\u76EE\u5F55\u9012\u5F52\u3001\u540C\u540D\u8986\u76D6\uFF09\uFF1B\u91CD\u65B0\u6253\u5F00 SFTP \u540E\u751F\u6548"})]}),l("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09"}),l("div",{className:"tt_limitGrid",children:[l("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u4E0B\u8F7D\u4E0A\u9650 (MB)"}),n("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(o?.sftpLimits?.maxDownloadMb))?Number(o.sftpLimits.maxDownloadMb):1024),onChange:W=>I("maxDownloadMb",Number(W.target.value)||0)})]}),l("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u4E0A\u4F20\u4E0A\u9650 (MB)"}),n("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(o?.sftpLimits?.maxUploadMb))?Number(o.sftpLimits.maxUploadMb):2048),onChange:W=>I("maxUploadMb",Number(W.target.value)||0)})]}),l("label",{className:"tt_sshRow",children:[n("span",{className:"tt_cardLabel",children:"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650"}),n("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(o?.sftpLimits?.maxUploadFiles))?Number(o.sftpLimits.maxUploadFiles):1e3),onChange:W=>I("maxUploadFiles",Number(W.target.value)||0)})]})]}),n("span",{className:"tt_cardHint",children:"\u6D4F\u89C8\u5668\u4FA7\u4FDD\u62A4\uFF1A\u5355\u4E2A\u6587\u4EF6\u8D85\u8FC7\u4E0A\u9650\u65F6\u4E2D\u6B62\u4E0B\u8F7D/\u4E0A\u4F20\uFF08\u5927\u6587\u4EF6\u8BF7\u7528\u53CC\u680F \u21E8/\u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync\uFF0C\u4E0D\u5360\u6D4F\u89C8\u5668\u5185\u5B58\uFF09\uFF1B\u6587\u4EF6\u6570\u4E0A\u9650\u9488\u5BF9\u4E00\u6B21\u6279\u91CF/\u62D6\u62FD\u4E0A\u4F20\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"})]}),y("\u4F1A\u8BDD"),l("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),l("select",{className:"tt_cardInput",value:o.persistence==="tmux"?"tmux":"off",onChange:W=>A("persistence",W.target.value),children:[n("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),n("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),n("span",{className:"tt_cardHint",children:"\u5F00\u542F\u540E\u6240\u6709\u65B0\u6807\u7B7E\uFF08\u672C\u5730/SSH \u8FDE\u63A5\u7C3F/SSH \u8FDE\u63A5\u5BF9\u8BDD\u6846\uFF09\u9ED8\u8BA4\u7531 tmux \u6258\u7BA1\u3001\u53EF\u8DE8\u5BBF\u4E3B\u91CD\u542F\u6062\u590D\uFF1B\u9700\u672C\u673A/\u8FDC\u7A0B\u5B89\u88C5 tmux\uFF1BSSH \u5BF9\u8BDD\u6846\u53EF\u5BF9\u5355\u6B21\u8FDE\u63A5\u53D6\u6D88\u52FE\u9009\uFF1B\u5DF2\u6709\u6807\u7B7E\u4E0D\u53D7\u5F71\u54CD"}),Ci("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),Ci("\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","statsEnabled"),n("span",{className:"tt_cardHint",children:"\u9ED8\u8BA4\u5173\u95ED\uFF1A\u6574\u4E2A\u9875\u9762\u5173\u95ED\u65F6\u6301\u4E45\u4F1A\u8BDD\u7559\u5B58\uFF08\u4FDD\u6D3B\u671F\u540E\u53EF\u518D\u6062\u590D\uFF09\uFF1B\u5F00\u542F\u5219\u9875\u9762\u65AD\u5F00\u4E14\u4FDD\u6D3B\u671F\u7ED3\u675F\u65F6\u8FDE tmux \u4F1A\u8BDD\u4E00\u8D77\u7ED3\u675F\u2014\u2014\u6CE8\u610F\u5237\u65B0\u9875\u9762\u5728\u4FDD\u6D3B\u671F\u5185\u4E0D\u53D7\u5F71\u54CD"})]}),Si("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),l("div",{className:"tt_cardField",onBlur:W=>{W.currentTarget.contains(W.relatedTarget)||w(!1)},children:[n("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),n("input",{className:"tt_cardInput",value:o.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>w(!0),onClick:()=>w(!0),onKeyDown:W=>{W.key==="Escape"&&w(!1)},onChange:W=>{A("shell",W.target.value),w(!0)}}),...C?[n("div",{className:"tt_envList tt_shellList",children:(()=>{let W=(o.shell??"").trim().toLowerCase(),G=W===""?u:u.filter(J=>J.toLowerCase().includes(W));return G.length===0?n("span",{className:"tt_envMore",children:"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF"}):G.map(J=>n("button",{type:"button",className:"tt_envItem",onMouseDown:te=>te.preventDefault(),onClick:()=>{A("shell",J),w(!1)},children:J},J))})()},"shell-list")]:[],n("span",{className:"tt_cardHint",children:"\u53EF\u4E0B\u62C9\u9009\u62E9\u672C\u673A\u5DF2\u5B89\u88C5 shell\uFF08$SHELL \u4F18\u5148\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bzsh / bash \u652F\u6301 shell \u96C6\u6210"})]},"shell-field"),Si("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),Si("COLORTERM","colorTerm","truecolor",""),Si("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),Si("\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","reconnectGraceSec","120","\u5237\u65B0\u9875\u9762/\u7F51\u7EDC\u6296\u52A8\u540E\u4F1A\u8BDD\u4FDD\u6D3B\u7B49\u5F85\u91CD\u8FDE\uFF0C\u8D85\u65F6\u540E\u7ED3\u675F\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),y("SSH \u8FDE\u63A5"),l("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(o.sshHosts)&&o.sshHosts.length>0?[n("div",{className:"tt_hostList","data-editing":F!==null?"":void 0,children:o.sshHosts.map(W=>l("div",{children:[l("div",{className:"tt_sshHostRow",children:[n("div",{className:"tt_sshHostMeta",children:[n("span",{className:"tt_sshHostName",children:W?.name??""}),n("span",{className:"tt_sshHostTarget",children:on(W??{})})]}),n("button",{type:"button",className:"tt_toolBtn",disabled:Y[W?.name]?.running===!0,onClick:()=>{fe(W)},title:"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD",children:Y[W?.name]?.running===!0?"\u6D4B\u8BD5\u4E2D\u2026":"\u6D4B\u8BD5"}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>Je(W),children:"\u7F16\u8F91"}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>It(W?.name),children:"\u5220\u9664"})]}),Y[W?.name]&&Y[W?.name].text?n("div",{className:"tt_sshProbeResult"+(Y[W?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:Y[W?.name].text}):null,F===W?.name?Pl():null]},String(W?.name??"")))})]:[n("span",{className:"tt_cardHint",children:"\u6682\u65E0\u6761\u76EE \u2014 \u7EC8\u7AEF\u9762\u677F\u300C+\u300D\u2192 SSH \u8FDE\u63A5\u2026 \u52FE\u9009\u300C\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\u300D\u5373\u53EF\u6DFB\u52A0"})],l("div",{className:"tt_cardRow",children:[n("button",{type:"button",className:"tt_toolBtn",onClick:()=>{El()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),n("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),n("span",{className:"tt_cardHint",children:"\u968F\u300C\u4FDD\u5B58\u300D\u4E00\u5E76\u5199\u5165\u914D\u7F6E\uFF1B\u5BC6\u7801/\u53E3\u4EE4\u652F\u6301 env:VAR \u5F15\u7528\uFF0C\u907F\u514D\u660E\u6587\u5165\u5E93"})]}),l("div",{className:"tt_cardField",children:[l("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(o.tunnels)&&o.tunnels.length>0?[n("div",{children:o.tunnels.map(W=>{let G=X.find(te=>te.name===W?.name),J=G?.state??"stopped";return l("div",{className:"tt_sshHostRow",children:[n("span",{className:"tt_tunnelDot","data-state":J,title:J}),n("div",{className:"tt_sshHostMeta",children:[n("span",{className:"tt_sshHostName",children:(W?.name??"")+" \xB7 "+ge(W??{})}),n("span",{className:"tt_sshHostTarget",children:(W?.bookName??"")+(G?.error?" \xB7 "+G.error:"")+(G?.lastForwardError?" \xB7 "+G.lastForwardError:"")})]}),n("input",{type:"checkbox",className:"tt_cardCheckbox",checked:W?.enabled!==!1,title:"\u542F\u7528",onChange:te=>wi(W?.name,te.target.checked)}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>Pt(W?.name),children:"\u5220\u9664"})]},String(W?.name??""))})})]:[n("span",{className:"tt_cardHint",children:"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3"})],l("div",{className:"tt_sshEdit",children:[l("div",{className:"tt_cardRow",children:[l("select",{className:"tt_cardInput",value:ne.direction,onChange:ce("direction"),children:[n("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),n("option",{value:"remote",children:"\u8FDC\u7A0B\u8F6C\u53D1\uFF08-R\uFF09\uFF1A\u8FDC\u7A0B\u7AEF\u53E3 \u2192 \u672C\u673A\u670D\u52A1"})]}),l("select",{className:"tt_cardInput",value:ne.bookName,onChange:ce("bookName"),children:[n("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(o?.sshHosts)?o.sshHosts.map(W=>n("option",{value:W?.name??"",children:W?.name??""})):[]]})]}),n("span",{className:"tt_cardHint",children:Se!==void 0?"\u7ECF "+on(Se)+" \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE":"\u9009\u62E9\u8FD9\u6761\u96A7\u9053\u8981\u8D70\u54EA\u53F0 SSH \u8FDE\u63A5\uFF08\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8FDE\u63A5\u7C3F\uFF09"}),ne.direction==="local"?l("div",{className:"tt_tunnelGridLocal",children:[n("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:ne.localPort,autoComplete:"off",onChange:ce("localPort")}),n("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:ne.remoteHost,autoComplete:"off",onChange:ce("remoteHost")}),n("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:ne.remotePort,autoComplete:"off",onChange:ce("remotePort")})]}):l("div",{className:"tt_tunnelGrid",children:[n("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:ne.remotePort,autoComplete:"off",onChange:ce("remotePort")}),n("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:ne.localTargetPort,autoComplete:"off",onChange:ce("localTargetPort")})]}),n("div",{className:"tt_cardRow",children:[n("button",{type:"button",className:"tt_cardSave",onClick:Ie,children:"\u6DFB\u52A0\u96A7\u9053"}),n("span",{className:"tt_cardHint",children:"\u6DFB\u52A0\u540E\u7ACB\u5373\u751F\u6548\uFF1B\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\uFF1B\u672C\u5730\u7AEF\u53E3\u5EFA\u8BAE 1024 \u4EE5\u4E0A\uFF1B\u8FDC\u7A0B\u4E3B\u673A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF08127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09"})]})]})]}),l("div",{className:"tt_cardField",children:[n("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Ll()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(o.hostKeys)&&o.hostKeys.length>0?[n("div",{className:"tt_hostList",children:o.hostKeys.map(W=>l("div",{className:"tt_sshHostRow",children:[n("div",{className:"tt_sshHostMeta",children:[n("span",{className:"tt_sshHostName",children:String(W?.host??"")+":"+String(W?.port??22)}),n("span",{className:"tt_sshHostTarget",children:"sha256:"+String(W?.fingerprint??"")})]}),n("button",{type:"button",className:"tt_toolBtn",onClick:()=>{ts(W)},children:"\u5220\u9664"})]},String(W?.host??"")+":"+String(W?.port??22)))})]:[n("span",{className:"tt_cardHint",children:"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9"})],n("span",{className:"tt_cardHint",children:"\u4E3B\u673A\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF1B\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE"})]}),l("div",{className:"tt_cardField tt_cardRow",children:[n("button",{className:"tt_cardSave",disabled:p,onClick:()=>{Ml()},children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),n("span",{className:"tt_cardMessage"+(d.kind==="ok"?" tt_cardMessageOk":d.kind==="error"?" tt_cardMessageError":""),children:d.text})]})]})]}):null]})}return t.inject=["slots","sessions"],t.apply=a=>{el=a.sessions,a.inject(["remote","remote.credentials"],p=>(ct=p.remote?.credentials??p["remote.credentials"]??null,()=>{ct=null}));let f=!1,o=()=>{};Ur={set(p){if(p!==f){if(f=p,p){o=uf();return}o(),o=()=>{},Vi(),Ut()}}},dl(!0),Cn(),a.slots.inject("settings.plugin.item",()=>a.slots.register({name:"settings.plugin.item",key:"tty",order:100},s));let _=a.provide("ttyConnbar",{version:1,addAction:Zr,requestRender(){Ut()}}),g=a.provide("ttyTerminal",{version:3,open(p){if(!jt)return;let h=sl(p),d=nl(p,h),c=typeof p?.label=="string"&&p.label!==""?p.label:void 0;if(Yi(),p?.reuse!==!1){let u=Tu(d);if(u!==null)return un(),Xt(u.sid),u}un(),ji(d,c)},mount(p,h){return jt?Pu(p,h):()=>{}}}),S=a.provide("ttyPanel",{version:2,isOpen(){return re!==null&&!De},mountPane(p){return ll(p)},minimize(){return Gr(),re!==null&&De}});return()=>{Ur=null,jt=!1,o(),S(),g(),_(),Vi()}},t}});})();
|
|
2463
2544
|
/*! Bundled license information:
|
|
2464
2545
|
|
|
2465
2546
|
@xterm/addon-search/lib/addon-search.mjs:
|