dsh-zterm 0.1.16 → 0.1.18
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/USERGUIDE.zh-CN.md +13 -2
- package/lib/client.js +12 -12
- package/lib/index.js +49 -13
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "dsh-zterm", factory: (require) => { var module = { exports: {} }; var exports = module.exports;
|
|
2
|
-
"use strict";var
|
|
3
|
-
`)))),this.register(this._terminal.onA11yTab((
|
|
4
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,r){this._liveRegionDebouncer.refresh(e,r,this._terminal.rows)}_renderRows(e,r){let l=this._terminal.buffer,p=l.lines.length.toString();for(let v=e;v<=r;v++){let g=l.lines.get(l.ydisp+v),u=[],m=g?.translateToString(!0,void 0,void 0,u)||"",y=(l.ydisp+v+1).toString(),x=this._rowElements[v];x&&(m.length===0?(x.innerText="\xA0",this._rowColumns.set(x,[0,1])):(x.textContent=m,this._rowColumns.set(x,u)),x.setAttribute("aria-posinset",y),x.setAttribute("aria-setsize",p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,r){let l=e.target,p=this._rowElements[r===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==p)return;let v,g;if(r===0?(v=l,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(v=this._rowElements.shift(),g=l,this._rowContainer.removeChild(v)),v.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:e.anchorNode,offset:e.anchorOffset},l={node:e.focusNode,offset:e.focusOffset};if((r.node.compareDocumentPosition(l.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===l.node&&r.offset>l.offset)&&([r,l]=[l,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;let p=this._rowElements.slice(-1)[0];if(l.node.compareDocumentPosition(p)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(l={node:p,offset:p.textContent?.length??0}),!this._rowContainer.contains(l.node))return;let v=({node:m,offset:y})=>{let x=m instanceof Text?m.parentNode:m,C=parseInt(x?.getAttribute("aria-posinset"),10)-1;if(isNaN(C))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(x);if(!w)return console.warn("columns is null. Race condition?"),null;let A=y<w.length?w[y]:w.slice(-1)[0]+1;return A>=this._terminal.cols&&(++C,A=0),{row:C,column:A}},g=v(r),u=v(l);if(g&&u){if(g.row>u.row||g.row===u.row&&g.column>=u.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(u.row-g.row)*this._terminal.cols-g.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_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 e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=t=c([f(1,h.IInstantiationService),f(2,_.ICoreBrowserService),f(3,_.IRenderService)],t)},3614:(D,s)=>{function o(n){return n.replace(/\r?\n/g,"\r")}function c(n,d){return d?"\x1B[200~"+n+"\x1B[201~":n}function f(n,d,_,h){n=c(n=o(n),_.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),_.triggerDataEvent(n,!0),d.value=""}function a(n,d,_){let h=_.getBoundingClientRect(),i=n.clientX-h.left-10,t=n.clientY-h.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${i}px`,d.style.top=`${t}px`,d.style.zIndex="1000",d.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=c,s.copyHandler=function(n,d){n.clipboardData&&n.clipboardData.setData("text/plain",d.selectionText),n.preventDefault()},s.handlePasteEvent=function(n,d,_,h){n.stopPropagation(),n.clipboardData&&f(n.clipboardData.getData("text/plain"),d,_,h)},s.paste=f,s.moveTextAreaUnderMouseCursor=a,s.rightClickHandler=function(n,d,_,h,i){a(n,d,_),i&&h.rightClickSelect(n),d.value=h.selectionText,d.select()}},7239:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let c=o(1505);s.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,a,n){this._css.set(f,a,n)}getCss(f,a){return this._css.get(f,a)}setColor(f,a,n){this._color.set(f,a,n)}getColor(f,a){return this._color.get(f,a)}clear(){this._color.clear(),this._css.clear()}}},3656:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,c,f,a){o.addEventListener(c,f,a);let n=!1;return{dispose:()=>{n||(n=!0,o.removeEventListener(c,f,a))}}}},3551:function(D,s,o){var c=this&&this.__decorate||function(t,e,r,l){var p,v=arguments.length,g=v<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(p=t[u])&&(g=(v<3?p(g):v>3?p(e,r,g):p(e,r))||g);return v>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let a=o(3656),n=o(8460),d=o(844),_=o(2585),h=o(4725),i=s.Linkifier=class extends d.Disposable{get currentLink(){return this._currentLink}constructor(t,e,r,l,p){super(),this._element=t,this._mouseService=e,this._renderService=r,this._bufferService=l,this._linkProviderService=p,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new n.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new n.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,d.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let r=t.composedPath();for(let l=0;l<r.length;l++){let p=r[l];if(p.classList.contains("xterm"))break;if(p.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(t,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((l=>{l?.forEach((p=>{p.link.dispose&&p.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=t.y);let r=!1;for(let[l,p]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(l)&&(r=this._checkLinkProviderResult(l,t,r)):p.provideLinks(t.y,(v=>{if(this._isMouseOut)return;let g=v?.map((u=>({link:u})));this._activeProviderReplies?.set(l,g),r=this._checkLinkProviderResult(l,t,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)}))}_removeIntersectingLinks(t,e){let r=new Set;for(let l=0;l<e.size;l++){let p=e.get(l);if(p)for(let v=0;v<p.length;v++){let g=p[v],u=g.link.range.start.y<t?0:g.link.range.start.x,m=g.link.range.end.y>t?this._bufferService.cols:g.link.range.end.x;for(let y=u;y<=m;y++){if(r.has(y)){p.splice(v--,1);break}r.add(y)}}}}_checkLinkProviderResult(t,e,r){if(!this._activeProviderReplies)return r;let l=this._activeProviderReplies.get(t),p=!1;for(let v=0;v<t;v++)this._activeProviderReplies.has(v)&&!this._activeProviderReplies.get(v)||(p=!0);if(!p&&l){let v=l.find((g=>this._linkAtPosition(g.link,e)));v&&(r=!0,this._handleNewLink(v))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let v=0;v<this._activeProviderReplies.size;v++){let g=this._activeProviderReplies.get(v)?.find((u=>this._linkAtPosition(u.link,e)));if(g){r=!0,this._handleNewLink(g);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){this._currentLink&&this._lastMouseEvent&&(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,d.disposeArray)(this._linkCacheDisposables))}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0||t.link.decorations.underline,pointerCursor:t.link.decorations===void 0||t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((r=>{if(!this._currentLink)return;let l=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,p=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=p&&(this._clearCurrentLink(l,p),this._lastMouseEvent)){let v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._askForLink(v,!1)}}))))}_linkHover(t,e,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(r,e.text)}_fireUnderlineEvent(t,e){let r=t.range,l=this._bufferService.buffer.ydisp,p=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-l-1,r.end.x,r.end.y-l-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(p)}_linkLeave(t,e,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(r,e.text)}_linkAtPosition(t,e){let r=t.range.start.y*this._bufferService.cols+t.range.start.x,l=t.range.end.y*this._bufferService.cols+t.range.end.x,p=e.y*this._bufferService.cols+e.x;return r<=p&&p<=l}_positionFromMouseEvent(t,e,r){let l=r.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,r,l,p){return{x1:t,y1:e,x2:r,y2:l,cols:this._bufferService.cols,fg:p}}};s.Linkifier=i=c([f(1,h.IMouseService),f(2,h.IRenderService),f(3,_.IBufferService),f(4,h.ILinkProviderService)],i)},9042:(D,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(D,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,p=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(h,i,t,e);else for(var v=h.length-1;v>=0;v--)(r=h[v])&&(p=(l<3?r(p):l>3?r(i,t,p):r(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let a=o(511),n=o(2585),d=s.OscLinkProvider=class{constructor(h,i,t){this._bufferService=h,this._optionsService=i,this._oscLinkService=t}provideLinks(h,i){let t=this._bufferService.buffer.lines.get(h-1);if(!t)return void i(void 0);let e=[],r=this._optionsService.rawOptions.linkHandler,l=new a.CellData,p=t.getTrimmedLength(),v=-1,g=-1,u=!1;for(let m=0;m<p;m++)if(g!==-1||t.hasContent(m)){if(t.loadCell(m,l),l.hasExtendedAttrs()&&l.extended.urlId){if(g===-1){g=m,v=l.extended.urlId;continue}u=l.extended.urlId!==v}else g!==-1&&(u=!0);if(u||g!==-1&&m===p-1){let y=this._oscLinkService.getLinkData(v)?.uri;if(y){let x={start:{x:g+1,y:h},end:{x:m+(u||m!==p-1?0:1),y:h}},C=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(C=!0)}catch{C=!0}C||e.push({text:y,range:x,activate:(w,A)=>r?r.activate(w,A,x):_(0,A),hover:(w,A)=>r?.hover?.(w,A,x),leave:(w,A)=>r?.leave?.(w,A,x)})}u=!1,l.hasExtendedAttrs()&&l.extended.urlId?(g=m,v=l.extended.urlId):(g=-1,v=-1)}}i(e)}};function _(h,i){if(confirm(`Do you want to navigate to ${i}?
|
|
2
|
+
"use strict";var li=Object.create;var tt=Object.defineProperty;var hi=Object.getOwnPropertyDescriptor;var ci=Object.getOwnPropertyNames;var di=Object.getPrototypeOf,ui=Object.prototype.hasOwnProperty;var pt=(T,R)=>()=>(R||T((R={exports:{}}).exports,R),R.exports),fi=(T,R)=>{for(var O in R)tt(T,O,{get:R[O],enumerable:!0})},Lt=(T,R,O,W)=>{if(R&&typeof R=="object"||typeof R=="function")for(let L of ci(R))!ui.call(T,L)&&L!==O&&tt(T,L,{get:()=>R[L],enumerable:!(W=hi(R,L))||W.enumerable});return T};var vt=(T,R,O)=>(O=T!=null?li(di(T)):{},Lt(R||!T||!T.__esModule?tt(O,"default",{value:T,enumerable:!0}):O,T)),_i=T=>Lt(tt({},"__esModule",{value:!0}),T);var Bt=pt((st,gt)=>{(function(T,R){if(typeof st=="object"&&typeof gt=="object")gt.exports=R();else if(typeof define=="function"&&define.amd)define([],R);else{var O=R();for(var W in O)(typeof st=="object"?st:T)[W]=O[W]}})(globalThis,(()=>(()=>{"use strict";var T={4567:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let a=o(9042),n=o(9924),d=o(844),_=o(4725),h=o(2585),i=o(3656),t=s.AccessibilityManager=class extends d.Disposable{constructor(e,r,l,v){super(),this._terminal=e,this._coreBrowserService=l,this._renderService=v,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 p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,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 n.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((p=>this._handleResize(p.rows)))),this.register(this._terminal.onRender((p=>this._refreshRows(p.start,p.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((p=>this._handleChar(p)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
3
|
+
`)))),this.register(this._terminal.onA11yTab((p=>this._handleTab(p)))),this.register(this._terminal.onKey((p=>this._handleKey(p.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,i.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,d.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let r=0;r<e;r++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
4
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,r){this._liveRegionDebouncer.refresh(e,r,this._terminal.rows)}_renderRows(e,r){let l=this._terminal.buffer,v=l.lines.length.toString();for(let p=e;p<=r;p++){let g=l.lines.get(l.ydisp+p),u=[],m=g?.translateToString(!0,void 0,void 0,u)||"",y=(l.ydisp+p+1).toString(),x=this._rowElements[p];x&&(m.length===0?(x.innerText="\xA0",this._rowColumns.set(x,[0,1])):(x.textContent=m,this._rowColumns.set(x,u)),x.setAttribute("aria-posinset",y),x.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,r){let l=e.target,v=this._rowElements[r===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==v)return;let p,g;if(r===0?(p=l,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(p=this._rowElements.shift(),g=l,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:e.anchorNode,offset:e.anchorOffset},l={node:e.focusNode,offset:e.focusOffset};if((r.node.compareDocumentPosition(l.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===l.node&&r.offset>l.offset)&&([r,l]=[l,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;let v=this._rowElements.slice(-1)[0];if(l.node.compareDocumentPosition(v)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(l={node:v,offset:v.textContent?.length??0}),!this._rowContainer.contains(l.node))return;let p=({node:m,offset:y})=>{let x=m instanceof Text?m.parentNode:m,S=parseInt(x?.getAttribute("aria-posinset"),10)-1;if(isNaN(S))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(x);if(!w)return console.warn("columns is null. Race condition?"),null;let A=y<w.length?w[y]:w.slice(-1)[0]+1;return A>=this._terminal.cols&&(++S,A=0),{row:S,column:A}},g=p(r),u=p(l);if(g&&u){if(g.row>u.row||g.row===u.row&&g.column>=u.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(u.row-g.row)*this._terminal.cols-g.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_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 e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=t=c([f(1,h.IInstantiationService),f(2,_.ICoreBrowserService),f(3,_.IRenderService)],t)},3614:(L,s)=>{function o(n){return n.replace(/\r?\n/g,"\r")}function c(n,d){return d?"\x1B[200~"+n+"\x1B[201~":n}function f(n,d,_,h){n=c(n=o(n),_.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),_.triggerDataEvent(n,!0),d.value=""}function a(n,d,_){let h=_.getBoundingClientRect(),i=n.clientX-h.left-10,t=n.clientY-h.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${i}px`,d.style.top=`${t}px`,d.style.zIndex="1000",d.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=c,s.copyHandler=function(n,d){n.clipboardData&&n.clipboardData.setData("text/plain",d.selectionText),n.preventDefault()},s.handlePasteEvent=function(n,d,_,h){n.stopPropagation(),n.clipboardData&&f(n.clipboardData.getData("text/plain"),d,_,h)},s.paste=f,s.moveTextAreaUnderMouseCursor=a,s.rightClickHandler=function(n,d,_,h,i){a(n,d,_),i&&h.rightClickSelect(n),d.value=h.selectionText,d.select()}},7239:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let c=o(1505);s.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,a,n){this._css.set(f,a,n)}getCss(f,a){return this._css.get(f,a)}setColor(f,a,n){this._color.set(f,a,n)}getColor(f,a){return this._color.get(f,a)}clear(){this._color.clear(),this._css.clear()}}},3656:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,c,f,a){o.addEventListener(c,f,a);let n=!1;return{dispose:()=>{n||(n=!0,o.removeEventListener(c,f,a))}}}},3551:function(L,s,o){var c=this&&this.__decorate||function(t,e,r,l){var v,p=arguments.length,g=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(v=t[u])&&(g=(p<3?v(g):p>3?v(e,r,g):v(e,r))||g);return p>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let a=o(3656),n=o(8460),d=o(844),_=o(2585),h=o(4725),i=s.Linkifier=class extends d.Disposable{get currentLink(){return this._currentLink}constructor(t,e,r,l,v){super(),this._element=t,this._mouseService=e,this._renderService=r,this._bufferService=l,this._linkProviderService=v,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new n.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new n.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,d.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let r=t.composedPath();for(let l=0;l<r.length;l++){let v=r[l];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(t,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((l=>{l?.forEach((v=>{v.link.dispose&&v.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=t.y);let r=!1;for(let[l,v]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(l)&&(r=this._checkLinkProviderResult(l,t,r)):v.provideLinks(t.y,(p=>{if(this._isMouseOut)return;let g=p?.map((u=>({link:u})));this._activeProviderReplies?.set(l,g),r=this._checkLinkProviderResult(l,t,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)}))}_removeIntersectingLinks(t,e){let r=new Set;for(let l=0;l<e.size;l++){let v=e.get(l);if(v)for(let p=0;p<v.length;p++){let g=v[p],u=g.link.range.start.y<t?0:g.link.range.start.x,m=g.link.range.end.y>t?this._bufferService.cols:g.link.range.end.x;for(let y=u;y<=m;y++){if(r.has(y)){v.splice(p--,1);break}r.add(y)}}}}_checkLinkProviderResult(t,e,r){if(!this._activeProviderReplies)return r;let l=this._activeProviderReplies.get(t),v=!1;for(let p=0;p<t;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(v=!0);if(!v&&l){let p=l.find((g=>this._linkAtPosition(g.link,e)));p&&(r=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let p=0;p<this._activeProviderReplies.size;p++){let g=this._activeProviderReplies.get(p)?.find((u=>this._linkAtPosition(u.link,e)));if(g){r=!0,this._handleNewLink(g);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){this._currentLink&&this._lastMouseEvent&&(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,d.disposeArray)(this._linkCacheDisposables))}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0||t.link.decorations.underline,pointerCursor:t.link.decorations===void 0||t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((r=>{if(!this._currentLink)return;let l=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,v=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(l,v),this._lastMouseEvent)){let p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!1)}}))))}_linkHover(t,e,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(r,e.text)}_fireUnderlineEvent(t,e){let r=t.range,l=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-l-1,r.end.x,r.end.y-l-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(t,e,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(r,e.text)}_linkAtPosition(t,e){let r=t.range.start.y*this._bufferService.cols+t.range.start.x,l=t.range.end.y*this._bufferService.cols+t.range.end.x,v=e.y*this._bufferService.cols+e.x;return r<=v&&v<=l}_positionFromMouseEvent(t,e,r){let l=r.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,r,l,v){return{x1:t,y1:e,x2:r,y2:l,cols:this._bufferService.cols,fg:v}}};s.Linkifier=i=c([f(1,h.IMouseService),f(2,h.IRenderService),f(3,_.IBufferService),f(4,h.ILinkProviderService)],i)},9042:(L,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(L,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,v=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(h,i,t,e);else for(var p=h.length-1;p>=0;p--)(r=h[p])&&(v=(l<3?r(v):l>3?r(i,t,v):r(i,t))||v);return l>3&&v&&Object.defineProperty(i,t,v),v},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let a=o(511),n=o(2585),d=s.OscLinkProvider=class{constructor(h,i,t){this._bufferService=h,this._optionsService=i,this._oscLinkService=t}provideLinks(h,i){let t=this._bufferService.buffer.lines.get(h-1);if(!t)return void i(void 0);let e=[],r=this._optionsService.rawOptions.linkHandler,l=new a.CellData,v=t.getTrimmedLength(),p=-1,g=-1,u=!1;for(let m=0;m<v;m++)if(g!==-1||t.hasContent(m)){if(t.loadCell(m,l),l.hasExtendedAttrs()&&l.extended.urlId){if(g===-1){g=m,p=l.extended.urlId;continue}u=l.extended.urlId!==p}else g!==-1&&(u=!0);if(u||g!==-1&&m===v-1){let y=this._oscLinkService.getLinkData(p)?.uri;if(y){let x={start:{x:g+1,y:h},end:{x:m+(u||m!==v-1?0:1),y:h}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||e.push({text:y,range:x,activate:(w,A)=>r?r.activate(w,A,x):_(0,A),hover:(w,A)=>r?.hover?.(w,A,x),leave:(w,A)=>r?.leave?.(w,A,x)})}u=!1,l.hasExtendedAttrs()&&l.extended.urlId?(g=m,p=l.extended.urlId):(g=-1,p=-1)}}i(e)}};function _(h,i){if(confirm(`Do you want to navigate to ${i}?
|
|
5
5
|
|
|
6
|
-
WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=d=c([f(0,n.IBufferService),f(1,n.IOptionsService),f(2,n.IOscLinkService)],d)},6193:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let c=o(3614),f=o(3656),a=o(3551),n=o(9042),d=o(3730),_=o(1680),h=o(3107),i=o(5744),t=o(2950),e=o(1296),r=o(428),l=o(4269),p=o(5114),v=o(8934),g=o(3230),u=o(9312),m=o(4725),y=o(6731),x=o(8055),C=o(8969),w=o(8460),A=o(844),P=o(6114),U=o(8437),q=o(2584),$=o(7399),b=o(5941),E=o(9074),k=o(2585),L=o(5435),H=o(4567),K=o(779);class X extends C.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=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new A.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(d.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((S,z)=>this.refresh(S,z)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((S=>this._reportWindowsOptions(S)))),this.register(this._inputHandler.onColor((S=>this._handleColorEvent(S)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((S=>this._afterResize(S.cols,S.rows)))),this.register((0,A.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(T){if(this._themeService)for(let S of T){let z,N="";switch(S.index){case 256:z="foreground",N="10";break;case 257:z="background",N="11";break;case 258:z="cursor",N="12";break;default:z="ansi",N="4;"+S.index}switch(S.type){case 0:let V=x.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[S.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${q.C0.ESC}]${N};${(0,b.toRgbString)(V)}${q.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors((j=>j.ansi[S.index]=x.channels.toColor(...S.color)));else{let j=z;this._themeService.modifyColors((te=>te[j]=x.channels.toColor(...S.color)))}break;case 2:this._themeService.restoreColor(S.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(H.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(T){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.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(q.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,S=this.buffer.lines.get(T);if(!S)return;let z=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,V=S.getWidth(z),j=this._renderService.dimensions.css.cell.width*V,te=this.buffer.y*this._renderService.dimensions.css.cell.height,ne=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ne+"px",this.textarea.style.top=te+"px",this.textarea.style.width=j+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(S=>{this.hasSelection()&&(0,c.copyHandler)(S,this._selectionService)})));let T=S=>(0,c.handlePasteEvent)(S,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",T)),this.register((0,f.addDisposableDomListener)(this.element,"paste",T)),P.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(S=>{S.button===2&&(0,c.rightClickHandler)(S,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(S=>{(0,c.rightClickHandler)(S,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(S=>{S.button===1&&(0,c.moveTextAreaUnderMouseCursor)(S,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 S=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),S.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",(z=>this.updateCursorStyle(z)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),S.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",n.promptLabel),P.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(p.CoreBrowserService,this.textarea,T.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(z=>this._handleTextAreaFocus(z)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(r.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(l.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((z=>this._onRender.fire(z)))),this.onResize((z=>this._renderService.resize(z.cols,z.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(t.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(v.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(S);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(_.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((z=>this.scrollLines(z.amount,z.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(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((z=>this.scrollLines(z.amount,z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((z=>this._renderService.handleSelectionChanged(z.start,z.end,z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((z=>{this.textarea.value=z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(h.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(z=>this._selectionService.handleMouseDown(z)))),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(H.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(z=>this._handleScreenReaderModeOptionChange(z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(z=>{!this._overviewRulerRenderer&&z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let T=this,S=this.element;function z(j){let te=T._mouseService.getMouseReportCoords(j,T.screenElement);if(!te)return!1;let ne,oe;switch(j.overrideType||j.type){case"mousemove":oe=32,j.buttons===void 0?(ne=3,j.button!==void 0&&(ne=j.button<3?j.button:3)):ne=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":oe=0,ne=j.button<3?j.button:3;break;case"mousedown":oe=1,ne=j.button<3?j.button:3;break;case"wheel":if(T._customWheelEventHandler&&T._customWheelEventHandler(j)===!1||T.viewport.getLinesScrolled(j)===0)return!1;oe=j.deltaY<0?0:1,ne=4;break;default:return!1}return!(oe===void 0||ne===void 0||ne>4)&&T.coreMouseService.triggerMouseEvent({col:te.col,row:te.row,x:te.x,y:te.y,button:ne,action:oe,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:j=>(z(j),j.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(j)),wheel:j=>(z(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&z(j)},mousemove:j=>{j.buttons||z(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?N.mousemove||(S.addEventListener("mousemove",V.mousemove),N.mousemove=V.mousemove):(S.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&j?N.wheel||(S.addEventListener("wheel",V.wheel,{passive:!1}),N.wheel=V.wheel):(S.removeEventListener("wheel",N.wheel),N.wheel=null),2&j?N.mouseup||(N.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&j?N.mousedrag||(N.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(S,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return z(j),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(j)}))),this.register((0,f.addDisposableDomListener)(S,"wheel",(j=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let te=this.viewport.getLinesScrolled(j);if(te===0)return;let ne=q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),oe="";for(let fe=0;fe<Math.abs(te);fe++)oe+=ne;return this.coreService.triggerDataEvent(oe,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(S,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(S,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(T,S){this._renderService?.refreshRows(T,S)}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,S,z=0){z===1?(super.scrollLines(T,S,z),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(T)}paste(T){(0,c.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 S=this._characterJoinerService.register(T);return this.refresh(0,this.rows-1),S}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,S,z){this._selectionService.setSelection(T,S,z)}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,S){this._selectionService?.selectLines(T,S)}_keyDown(T){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;let S=this.browser.isMac&&this.options.macOptionIsMeta&&T.altKey;if(!S&&!this._compositionHelper.keydown(T))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;S||T.key!=="Dead"&&T.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let z=(0,$.evaluateKeyboardEvent)(T,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(T),z.type===3||z.type===2){let N=this.rows-1;return this.scrollLines(z.type===2?-N:N),this.cancel(T,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,T)||(z.cancel&&this.cancel(T,!0),!z.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):(z.key!==q.C0.ETX&&z.key!==q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||T.altKey||T.ctrlKey?this.cancel(T,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(T,S){let z=T.isMac&&!this.options.macOptionIsMeta&&S.altKey&&!S.ctrlKey&&!S.metaKey||T.isWindows&&S.altKey&&S.ctrlKey&&!S.metaKey||T.isWindows&&S.getModifierState("AltGraph");return S.type==="keypress"?z:z&&(!S.keyCode||S.keyCode>47)}_keyUp(T){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1||((function(S){return S.keyCode===16||S.keyCode===17||S.keyCode===18})(T)||this.focus(),this.updateCursorStyle(T),this._keyPressHandled=!1)}_keyPress(T){let S;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(this.cancel(T),T.charCode)S=T.charCode;else if(T.which===null||T.which===void 0)S=T.keyCode;else{if(T.which===0||T.charCode===0)return!1;S=T.which}return!(!S||(T.altKey||T.ctrlKey||T.metaKey)&&!this._isThirdLevelShift(this.browser,T)||(S=String.fromCharCode(S),this._onKey.fire({key:S,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(S,!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 S=T.data;return this.coreService.triggerDataEvent(S,!0),this.cancel(T),!0}return!1}resize(T,S){T!==this.cols||S!==this.rows?super.resize(T,S):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(T,S){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(U.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(q.C0.ESC+"[I"):this.coreService.triggerDataEvent(q.C0.ESC+"[O")}_reportWindowsOptions(T){if(this._renderService)switch(T){case L.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let S=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${q.C0.ESC}[4;${z};${S}t`);break;case L.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let N=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${q.C0.ESC}[6;${V};${N}t`)}}cancel(T,S){if(this.options.cancelEvents||S)return T.preventDefault(),T.stopPropagation(),!1}}s.Terminal=X},9924:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;let a=Date.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=a-this._lastRefreshMs,d=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(D,s,o){var c=this&&this.__decorate||function(t,e,r,l){var p,v=arguments.length,g=v<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(p=t[u])&&(g=(v<3?p(g):v>3?p(e,r,g):p(e,r))||g);return v>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let a=o(3656),n=o(4725),d=o(8460),_=o(844),h=o(2585),i=s.Viewport=class extends _.Disposable{constructor(t,e,r,l,p,v,g,u){super(),this._viewportElement=t,this._scrollArea=e,this._bufferService=r,this._optionsService=l,this._charSizeService=p,this._renderService=v,this._coreBrowserService=g,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 d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((m=>this._renderDimensions=m))),this._handleThemeChange(u.colors),this.register(u.onChangeColors((m=>this._handleThemeChange(m)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(t){this._viewportElement.style.backgroundColor=t.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(t){if(t)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 e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null}syncScrollArea(t=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(t);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(t)}_handleScroll(t){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 e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let t=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(t*(this._smoothScrollState.target-this._smoothScrollState.origin)),t<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(t,e){let r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&r<this._lastRecordedBufferHeight)||(t.cancelable&&t.preventDefault(),!1)}handleWheel(t){let e=this._getPixelsScrolled(t);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}scrollLines(t){if(t!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=t*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!1})}_getPixelsScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(t,e){let r,l="",p=[],v=e??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let u=t;u<v;u++){let m=g.get(u);if(!m)continue;let y=g.get(u+1)?.isWrapped;if(l+=m.translateToString(!y),!y||u===g.length-1){let x=document.createElement("div");x.textContent=l,p.push(x),l.length>0&&(r=x),l=""}}return{bufferElements:p,cursorElement:r}}getLinesScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(t,e){let r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&e.altKey||r==="ctrl"&&e.ctrlKey||r==="shift"&&e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(t){this._lastTouchY=t.touches[0].pageY}handleTouchMove(t){let e=this._lastTouchY-t.touches[0].pageY;return this._lastTouchY=t.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}};s.Viewport=i=c([f(2,h.IBufferService),f(3,h.IOptionsService),f(4,n.ICharSizeService),f(5,n.IRenderService),f(6,n.ICoreBrowserService),f(7,n.IThemeService)],i)},3107:function(D,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,p=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(h,i,t,e);else for(var v=h.length-1;v>=0;v--)(r=h[v])&&(p=(l<3?r(p):l>3?r(i,t,p):r(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let a=o(4725),n=o(844),d=o(2585),_=s.BufferDecorationRenderer=class extends n.Disposable{constructor(h,i,t,e,r){super(),this._screenElement=h,this._bufferService=i,this._coreBrowserService=t,this._decorationService=e,this._renderService=r,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((l=>this._removeDecoration(l)))),this.register((0,n.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 h of this._decorationService.decorations)this._renderDecoration(h);this._dimensionsChanged=!1}_renderDecoration(h){this._refreshStyle(h),this._dimensionsChanged&&this._refreshXPosition(h)}_createElement(h){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",h?.options?.layer==="top"),i.style.width=`${Math.round((h.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(h.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(h.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let t=h.options.x??0;return t&&t>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(h,i),i}_refreshStyle(h){let i=h.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)h.element&&(h.element.style.display="none",h.onRenderEmitter.fire(h.element));else{let t=this._decorationElements.get(h);t||(t=this._createElement(h),h.element=t,this._decorationElements.set(h,t),this._container.appendChild(t),h.onDispose((()=>{this._decorationElements.delete(h),t.remove()}))),t.style.top=i*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",h.onRenderEmitter.fire(t)}}_refreshXPosition(h,i=h.element){if(!i)return;let t=h.options.x??0;(h.options.anchor||"left")==="right"?i.style.right=t?t*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=t?t*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(h){this._decorationElements.get(h)?.remove(),this._decorationElements.delete(h),h.dispose()}};s.BufferDecorationRenderer=_=c([f(1,d.IBufferService),f(2,a.ICoreBrowserService),f(3,d.IDecorationService),f(4,a.IRenderService)],_)},5871:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(let c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,f){return c>=o.startBufferLine-this._linePadding[f||"full"]&&c<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(D,s,o){var c=this&&this.__decorate||function(r,l,p,v){var g,u=arguments.length,m=u<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,l,p,v);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(l,p,m):g(l,p))||m);return u>3&&m&&Object.defineProperty(l,p,m),m},f=this&&this.__param||function(r,l){return function(p,v){l(p,v,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let a=o(5871),n=o(4725),d=o(844),_=o(2585),h={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},e=s.OverviewRulerRenderer=class extends d.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,l,p,v,g,u,m){super(),this._viewportElement=r,this._screenElement=l,this._bufferService=p,this._decorationService=v,this._renderService=g,this._optionsService=u,this._coreBrowserService=m,this._colorZoneStore=new a.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 y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,d.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 r=Math.floor(this._canvas.width/3),l=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=r,i.center=l,i.right=r,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=i.left,t.right=i.left+i.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);let r=this._canvas.height/this._bufferService.buffer.lines.length,l=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);h.left=l,h.center=l,h.right=l}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.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 l of this._decorationService.decorations)this._colorZoneStore.addDecoration(l);this._ctx.lineWidth=1;let r=this._colorZoneStore.zones;for(let l of r)l.position!=="full"&&this._renderColorZone(l);for(let l of r)l.position==="full"&&this._renderColorZone(l);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(t[r.position||"full"],Math.round((this._canvas.height-1)*(r.startBufferLine/this._bufferService.buffers.active.lines.length)-h[r.position||"full"]/2),i[r.position||"full"],Math.round((this._canvas.height-1)*((r.endBufferLine-r.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[r.position||"full"]))}_queueRefresh(r,l){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=l||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=e=c([f(2,_.IBufferService),f(3,_.IDecorationService),f(4,n.IRenderService),f(5,_.IOptionsService),f(6,n.ICoreBrowserService)],e)},2950:function(D,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,p=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(h,i,t,e);else for(var v=h.length-1;v>=0;v--)(r=h[v])&&(p=(l<3?r(p):l>3?r(i,t,p):r(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let a=o(4725),n=o(2585),d=o(2584),_=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(h,i,t,e,r,l){this._textarea=h,this._compositionView=i,this._bufferService=t,this._optionsService=e,this._coreService=r,this._renderService=l,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(h){this._compositionView.textContent=h.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(h){if(this._isComposing||this._isSendingComposition){if(h.keyCode===229||h.keyCode===16||h.keyCode===17||h.keyCode===18)return!1;this._finalizeComposition(!1)}return h.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(h){if(this._compositionView.classList.remove("active"),this._isComposing=!1,h){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let h=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,t=i.replace(h,"");this._dataAlreadySent=t,i.length>h.length?this._coreService.triggerDataEvent(t,!0):i.length<h.length?this._coreService.triggerDataEvent(`${d.C0.DEL}`,!0):i.length===h.length&&i!==h&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(h){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}h||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=_=c([f(2,n.IBufferService),f(3,n.IOptionsService),f(4,n.ICoreService),f(5,a.IRenderService)],_)},9806:(D,s)=>{function o(c,f,a){let n=a.getBoundingClientRect(),d=c.getComputedStyle(a),_=parseInt(d.getPropertyValue("padding-left")),h=parseInt(d.getPropertyValue("padding-top"));return[f.clientX-n.left-_,f.clientY-n.top-h]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(c,f,a,n,d,_,h,i,t){if(!_)return;let e=o(c,f,a);return e?(e[0]=Math.ceil((e[0]+(t?h/2:0))/h),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),n+(t?1:0)),e[1]=Math.min(Math.max(e[1],1),d),e):void 0}},9504:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let c=o(2584);function f(i,t,e,r){let l=i-a(i,e),p=t-a(t,e),v=Math.abs(l-p)-(function(g,u,m){let y=0,x=g-a(g,m),C=u-a(u,m);for(let w=0;w<Math.abs(x-C);w++){let A=n(g,u)==="A"?-1:1;m.buffer.lines.get(x+A*w)?.isWrapped&&y++}return y})(i,t,e);return h(v,_(n(i,t),r))}function a(i,t){let e=0,r=t.buffer.lines.get(i),l=r?.isWrapped;for(;l&&i>=0&&i<t.rows;)e++,r=t.buffer.lines.get(--i),l=r?.isWrapped;return e}function n(i,t){return i>t?"A":"B"}function d(i,t,e,r,l,p){let v=i,g=t,u="";for(;v!==e||g!==r;)v+=l?1:-1,l&&v>p.cols-1?(u+=p.buffer.translateBufferLineToString(g,!1,i,v),v=0,i=0,g++):!l&&v<0&&(u+=p.buffer.translateBufferLineToString(g,!1,0,i+1),v=p.cols-1,i=v,g--);return u+p.buffer.translateBufferLineToString(g,!1,i,v)}function _(i,t){let e=t?"O":"[";return c.C0.ESC+e+i}function h(i,t){i=Math.floor(i);let e="";for(let r=0;r<i;r++)e+=t;return e}s.moveToCellSequence=function(i,t,e,r){let l=e.buffer.x,p=e.buffer.y;if(!e.buffer.hasScrollback)return(function(u,m,y,x,C,w){return f(m,x,C,w).length===0?"":h(d(u,m,u,m-a(m,C),!1,C).length,_("D",w))})(l,p,0,t,e,r)+f(p,t,e,r)+(function(u,m,y,x,C,w){let A;A=f(m,x,C,w).length>0?x-a(x,C):m;let P=x,U=(function(q,$,b,E,k,L){let H;return H=f(b,E,k,L).length>0?E-a(E,k):$,q<b&&H<=E||q>=b&&H<E?"C":"D"})(u,m,y,x,C,w);return h(d(u,A,y,P,U==="C",C).length,_(U,w))})(l,p,i,t,e,r);let v;if(p===t)return v=l>i?"D":"C",h(Math.abs(l-i),_(v,r));v=p>t?"D":"C";let g=Math.abs(p-t);return h((function(u,m){return m.cols-u})(p>t?i:l,e)+(g-1)*e.cols+1+((p>t?l:i)-1),_(v,r))}},1296:function(D,s,o){var c=this&&this.__decorate||function(w,A,P,U){var q,$=arguments.length,b=$<3?A:U===null?U=Object.getOwnPropertyDescriptor(A,P):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(w,A,P,U);else for(var E=w.length-1;E>=0;E--)(q=w[E])&&(b=($<3?q(b):$>3?q(A,P,b):q(A,P))||b);return $>3&&b&&Object.defineProperty(A,P,b),b},f=this&&this.__param||function(w,A){return function(P,U){A(P,U,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let a=o(3787),n=o(2550),d=o(2223),_=o(6171),h=o(6052),i=o(4725),t=o(8055),e=o(8460),r=o(844),l=o(2585),p="xterm-dom-renderer-owner-",v="xterm-rows",g="xterm-fg-",u="xterm-bg-",m="xterm-focus",y="xterm-selection",x=1,C=s.DomRenderer=class extends r.Disposable{constructor(w,A,P,U,q,$,b,E,k,L,H,K,X){super(),this._terminal=w,this._document=A,this._element=P,this._screenElement=U,this._viewportElement=q,this._helperContainer=$,this._linkifier2=b,this._charSizeService=k,this._optionsService=L,this._bufferService=H,this._coreBrowserService=K,this._themeService=X,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,h.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(v),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,_.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Z=>this._injectCss(Z)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Z=>this._handleLinkHover(Z)))),this.register(this._linkifier2.onHideLinkUnderline((Z=>this._handleLinkLeave(Z)))),this.register((0,r.toDisposable)((()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new n.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 w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),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/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let P of this._rowElements)P.style.width=`${this.dimensions.css.canvas.width}px`,P.style.height=`${this.dimensions.css.cell.height}px`,P.style.lineHeight=`${this.dimensions.css.cell.height}px`,P.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let A=`${this._terminalSelector} .${v} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=A,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(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let A=`${this._terminalSelector} .${v} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;A+=`${this._terminalSelector} .${v} .xterm-dim { color: ${t.color.multiplyOpacity(w.foreground,.5).css};}`,A+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let P=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,q=`blink_block_${this._terminalClass}`;A+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,A+=`@keyframes ${U} { 50% { box-shadow: none; }}`,A+=`@keyframes ${q} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,A+=`${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,A+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(let[$,b]of w.ansi.entries())A+=`${this._terminalSelector} .${g}${$} { color: ${b.css}; }${this._terminalSelector} .${g}${$}.xterm-dim { color: ${t.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${u}${$} { background-color: ${b.css}; }`;A+=`${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR} { color: ${t.color.opaque(w.background).css}; }${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${t.color.multiplyOpacity(t.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${u}${d.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=A}_setDefaultSpacing(){let w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,A){for(let P=this._rowElements.length;P<=A;P++){let U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>A;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,A){this._refreshRowElements(w,A),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(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,A,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,A,P),this.renderRows(0,this._bufferService.rows-1),!w||!A)return;this._selectionRenderModel.update(this._terminal,w,A,P);let U=this._selectionRenderModel.viewportStartRow,q=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(P){let k=w[0]>A[0];E.appendChild(this._createSelectionElement($,k?A[0]:w[0],k?w[0]:A[0],b-$+1))}else{let k=U===$?w[0]:0,L=$===q?A[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement($,k,L));let H=b-$-1;if(E.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,H)),$!==b){let K=q===b?A[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(w,A,P,U=1){let q=this._document.createElement("div"),$=A*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(P-A);return $+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-$),q.style.height=U*this.dimensions.css.cell.height+"px",q.style.top=w*this.dimensions.css.cell.height+"px",q.style.left=`${$}px`,q.style.width=`${b}px`,q}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 w of this._rowElements)w.replaceChildren()}renderRows(w,A){let P=this._bufferService.buffer,U=P.ybase+P.y,q=Math.min(P.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=w;k<=A;k++){let L=k+P.ydisp,H=this._rowElements[k],K=P.lines.get(L);if(!H||!K)break;H.replaceChildren(...this._rowFactory.createRow(K,L,L===U,b,E,q,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,A,P,U,q,$){P<0&&(w=0),U<0&&(A=0);let b=this._bufferService.rows-1;P=Math.max(Math.min(P,b),0),U=Math.max(Math.min(U,b),0),q=Math.min(q,this._bufferService.cols);let E=this._bufferService.buffer,k=E.ybase+E.y,L=Math.min(E.x,q-1),H=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=P;Z<=U;++Z){let T=Z+E.ydisp,S=this._rowElements[Z],z=E.lines.get(T);if(!S||!z)break;S.replaceChildren(...this._rowFactory.createRow(z,T,T===k,K,X,L,H,this.dimensions.css.cell.width,this._widthCache,$?Z===P?w:0:-1,$?(Z===U?A:q)-1:-1))}}};s.DomRenderer=C=c([f(7,l.IInstantiationService),f(8,i.ICharSizeService),f(9,l.IOptionsService),f(10,l.IBufferService),f(11,i.ICoreBrowserService),f(12,i.IThemeService)],C)},3787:function(D,s,o){var c=this&&this.__decorate||function(v,g,u,m){var y,x=arguments.length,C=x<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(v,g,u,m);else for(var w=v.length-1;w>=0;w--)(y=v[w])&&(C=(x<3?y(C):x>3?y(g,u,C):y(g,u))||C);return x>3&&C&&Object.defineProperty(g,u,C),C},f=this&&this.__param||function(v,g){return function(u,m){g(u,m,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let a=o(2223),n=o(643),d=o(511),_=o(2585),h=o(8055),i=o(4725),t=o(4269),e=o(6171),r=o(3734),l=s.DomRendererRowFactory=class{constructor(v,g,u,m,y,x,C){this._document=v,this._characterJoinerService=g,this._optionsService=u,this._coreBrowserService=m,this._coreService=y,this._decorationService=x,this._themeService=C,this._workCell=new d.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(v,g,u){this._selectionStart=v,this._selectionEnd=g,this._columnSelectMode=u}createRow(v,g,u,m,y,x,C,w,A,P,U){let q=[],$=this._characterJoinerService.getJoinedCharacters(g),b=this._themeService.colors,E,k=v.getNoBgTrimmedLength();u&&k<x+1&&(k=x+1);let L=0,H="",K=0,X=0,Z=0,T=!1,S=0,z=!1,N=0,V=[],j=P!==-1&&U!==-1;for(let te=0;te<k;te++){v.loadCell(te,this._workCell);let ne=this._workCell.getWidth();if(ne===0)continue;let oe=!1,fe=te,J=this._workCell;if($.length>0&&te===$[0][0]){oe=!0;let Y=$.shift();J=new t.JoinedCellData(this._workCell,v.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),fe=Y[1]-1,ne=J.getWidth()}let Ce=this._isCellInSelection(te,g),We=u&&te===x,Be=j&&te>=P&&te<=U,Ue=!1;this._decorationService.forEachDecorationAtCell(te,g,void 0,(Y=>{Ue=!0}));let Ie=J.getChars()||n.WHITESPACE_CELL_CHAR;if(Ie===" "&&(J.isUnderline()||J.isOverline())&&(Ie="\xA0"),N=ne*w-A.get(Ie,J.isBold(),J.isItalic()),E){if(L&&(Ce&&z||!Ce&&!z&&J.bg===K)&&(Ce&&z&&b.selectionForeground||J.fg===X)&&J.extended.ext===Z&&Be===T&&N===S&&!We&&!oe&&!Ue){J.isInvisible()?H+=n.WHITESPACE_CELL_CHAR:H+=Ie,L++;continue}L&&(E.textContent=H),E=this._document.createElement("span"),L=0,H=""}else E=this._document.createElement("span");if(K=J.bg,X=J.fg,Z=J.extended.ext,T=Be,S=N,z=Ce,oe&&x>=te&&x<=fe&&(x=te),!this._coreService.isCursorHidden&&We&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)C&&V.push("xterm-cursor-blink"),V.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(y)switch(y){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(J.isBold()&&V.push("xterm-bold"),J.isItalic()&&V.push("xterm-italic"),J.isDim()&&V.push("xterm-dim"),H=J.isInvisible()?n.WHITESPACE_CELL_CHAR:J.getChars()||n.WHITESPACE_CELL_CHAR,J.isUnderline()&&(V.push(`xterm-underline-${J.extended.underlineStyle}`),H===" "&&(H="\xA0"),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(J.getUnderlineColor()).join(",")})`;else{let Y=J.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&J.isBold()&&Y<8&&(Y+=8),E.style.textDecorationColor=b.ansi[Y].css}J.isOverline()&&(V.push("xterm-overline"),H===" "&&(H="\xA0")),J.isStrikethrough()&&V.push("xterm-strikethrough"),Be&&(E.style.textDecoration="underline");let me=J.getFgColor(),ke=J.getFgColorMode(),we=J.getBgColor(),Te=J.getBgColorMode(),Ge=!!J.isInverse();if(Ge){let Y=me;me=we,we=Y;let xe=ke;ke=Te,Te=xe}let se,ye,le,Le=!1;switch(this._decorationService.forEachDecorationAtCell(te,g,void 0,(Y=>{Y.options.layer!=="top"&&Le||(Y.backgroundColorRGB&&(Te=50331648,we=Y.backgroundColorRGB.rgba>>8&16777215,se=Y.backgroundColorRGB),Y.foregroundColorRGB&&(ke=50331648,me=Y.foregroundColorRGB.rgba>>8&16777215,ye=Y.foregroundColorRGB),Le=Y.options.layer==="top")})),!Le&&Ce&&(se=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,we=se.rgba>>8&16777215,Te=50331648,Le=!0,b.selectionForeground&&(ke=50331648,me=b.selectionForeground.rgba>>8&16777215,ye=b.selectionForeground)),Le&&V.push("xterm-decoration-top"),Te){case 16777216:case 33554432:le=b.ansi[we],V.push(`xterm-bg-${we}`);break;case 50331648:le=h.channels.toColor(we>>16,we>>8&255,255&we),this._addStyle(E,`background-color:#${p((we>>>0).toString(16),"0",6)}`);break;default:Ge?(le=b.foreground,V.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):le=b.background}switch(se||J.isDim()&&(se=h.color.multiplyOpacity(le,.5)),ke){case 16777216:case 33554432:J.isBold()&&me<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(me+=8),this._applyMinimumContrast(E,le,b.ansi[me],J,se,void 0)||V.push(`xterm-fg-${me}`);break;case 50331648:let Y=h.channels.toColor(me>>16&255,me>>8&255,255&me);this._applyMinimumContrast(E,le,Y,J,se,ye)||this._addStyle(E,`color:#${p(me.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,le,b.foreground,J,se,ye)||Ge&&V.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}V.length&&(E.className=V.join(" "),V.length=0),We||oe||Ue?E.textContent=H:L++,N!==this.defaultSpacing&&(E.style.letterSpacing=`${N}px`),q.push(E),te=fe}return E&&L&&(E.textContent=H),q}_applyMinimumContrast(v,g,u,m,y,x){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let C=this._getContrastCache(m),w;if(y||x||(w=C.getColor(g.rgba,u.rgba)),w===void 0){let A=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);w=h.color.ensureContrastRatio(y||g,x||u,A),C.setColor((y||g).rgba,(x||u).rgba,w??null)}return!!w&&(this._addStyle(v,`color:${w.css}`),!0)}_getContrastCache(v){return v.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(v,g){v.setAttribute("style",`${v.getAttribute("style")||""}${g};`)}_isCellInSelection(v,g){let u=this._selectionStart,m=this._selectionEnd;return!(!u||!m)&&(this._columnSelectMode?u[0]<=m[0]?v>=u[0]&&g>=u[1]&&v<m[0]&&g<=m[1]:v<u[0]&&g>=u[1]&&v>=m[0]&&g<=m[1]:g>u[1]&&g<m[1]||u[1]===m[1]&&g===u[1]&&v>=u[0]&&v<m[0]||u[1]<m[1]&&g===m[1]&&v<m[0]||u[1]<m[1]&&g===u[1]&&v>=u[0])}};function p(v,g,u){for(;v.length<u;)v=g+v;return v}s.DomRendererRowFactory=l=c([f(1,i.ICharacterJoinerService),f(2,_.IOptionsService),f(3,i.ICoreBrowserService),f(4,_.ICoreService),f(5,_.IDecorationService),f(6,i.IThemeService)],l)},2550:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let f=o.createElement("span");f.classList.add("xterm-char-measure-element");let a=o.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let n=o.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let d=o.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[f,a,n,d],this._container.appendChild(f),this._container.appendChild(a),this._container.appendChild(n),this._container.appendChild(d),c.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(o,c,f,a){o===this._font&&c===this._fontSize&&f===this._weight&&a===this._weightBold||(this._font=o,this._fontSize=c,this._weight=f,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(o,c,f){let a=0;if(!c&&!f&&o.length===1&&(a=o.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let _=this._measure(o,0);return _>0&&(this._flat[a]=_),_}let n=o;c&&(n+="B"),f&&(n+="I");let d=this._holey.get(n);if(d===void 0){let _=0;c&&(_|=1),f&&(_|=2),d=this._measure(o,_),d>0&&this._holey.set(n,d)}return d}_measure(o,c){let f=this._measureElements[c];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let c=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(D,s)=>{function o(f){return 57508<=f&&f<=57558}function c(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=o,s.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},s.isEmoji=c,s.allowRescaling=function(f,a,n,d){return a===1&&n>Math.ceil(1.5*d)&&f!==void 0&&f>255&&!c(f)&&!o(f)&&!(function(_){return 57344<=_&&_<=63743})(f)},s.treatGlyphAsBackgroundColor=function(f){return o(f)||(function(a){return 9472<=a&&a<=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,a,n=0){return(f-(2*Math.round(a)-n))%(2*Math.round(a))}},6052:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,a,n,d=!1){if(this.selectionStart=a,this.selectionEnd=n,!a||!n||a[0]===n[0]&&a[1]===n[1])return void this.clear();let _=f.buffers.active.ydisp,h=a[1]-_,i=n[1]-_,t=Math.max(h,0),e=Math.min(i,f.rows-1);t>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=h,this.viewportEndRow=i,this.viewportCappedStartRow=t,this.viewportCappedEndRow=e,this.startCol=a[0],this.endCol=n[0])}isCellSelected(f,a,n){return!!this.hasSelection&&(n-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?a>=this.startCol&&n>=this.viewportCappedStartRow&&a<this.endCol&&n<=this.viewportCappedEndRow:a<this.startCol&&n>=this.viewportCappedStartRow&&a>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&a>=this.startCol&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&a>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(D,s,o){var c=this&&this.__decorate||function(e,r,l,p){var v,g=arguments.length,u=g<3?r:p===null?p=Object.getOwnPropertyDescriptor(r,l):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,p);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(u=(g<3?v(u):g>3?v(r,l,u):v(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,p){r(l,p,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let a=o(2585),n=o(8460),d=o(844),_=s.CharSizeService=class extends d.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,r,l){super(),this._optionsService=l,this.width=0,this.height=0,this._onCharSizeChange=this.register(new n.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new t(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};s.CharSizeService=_=c([f(2,a.IOptionsService)],_);class h extends d.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,l){r!==void 0&&r>0&&l!==void 0&&l>0&&(this._result.width=r,this._result.height=l)}}class i extends h{constructor(r,l,p){super(),this._document=r,this._parentElement=l,this._optionsService=p,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 t extends h{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let l=this._ctx.measureText("W");if(!("width"in l&&"fontBoundingBoxAscent"in l&&"fontBoundingBoxDescent"in l))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let r=this._ctx.measureText("W");return this._validateAndSet(r.width,r.fontBoundingBoxAscent+r.fontBoundingBoxDescent),this._result}}},4269:function(D,s,o){var c=this&&this.__decorate||function(t,e,r,l){var p,v=arguments.length,g=v<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(p=t[u])&&(g=(v<3?p(g):v>3?p(e,r,g):p(e,r))||g);return v>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let a=o(3734),n=o(643),d=o(511),_=o(2585);class h extends a.AttributeData{constructor(e,r,l){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=r,this._width=l}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()]}}s.JoinedCellData=h;let i=s.CharacterJoinerService=class Rt{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(e){let r={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(r),r.id}deregister(e){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===e)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let r=this._bufferService.buffer.lines.get(e);if(!r||r.length===0)return[];let l=[],p=r.translateToString(!0),v=0,g=0,u=0,m=r.getFg(0),y=r.getBg(0);for(let x=0;x<r.getTrimmedLength();x++)if(r.loadCell(x,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==y){if(x-v>1){let C=this._getJoinedRanges(p,u,g,r,v);for(let w=0;w<C.length;w++)l.push(C[w])}v=x,u=g,m=this._workCell.fg,y=this._workCell.bg}g+=this._workCell.getChars().length||n.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-v>1){let x=this._getJoinedRanges(p,u,g,r,v);for(let C=0;C<x.length;C++)l.push(x[C])}return l}_getJoinedRanges(e,r,l,p,v){let g=e.substring(r,l),u=[];try{u=this._characterJoiners[0].handler(g)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{let y=this._characterJoiners[m].handler(g);for(let x=0;x<y.length;x++)Rt._mergeRanges(u,y[x])}catch(y){console.error(y)}return this._stringRangesToCellRanges(u,p,v),u}_stringRangesToCellRanges(e,r,l){let p=0,v=!1,g=0,u=e[p];if(u){for(let m=l;m<this._bufferService.cols;m++){let y=r.getWidth(m),x=r.getString(m).length||n.WHITESPACE_CELL_CHAR.length;if(y!==0){if(!v&&u[0]<=g&&(u[0]=m,v=!0),u[1]<=g){if(u[1]=m,u=e[++p],!u)break;u[0]<=g?(u[0]=m,v=!0):v=!1}g+=x}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,r){let l=!1;for(let p=0;p<e.length;p++){let v=e[p];if(l){if(r[1]<=v[0])return e[p-1][1]=r[1],e;if(r[1]<=v[1])return e[p-1][1]=Math.max(r[1],v[1]),e.splice(p,1),e;e.splice(p,1),p--}else{if(r[1]<=v[0])return e.splice(p,0,r),e;if(r[1]<=v[1])return v[0]=Math.min(r[0],v[0]),e;r[0]<v[1]&&(v[0]=Math.min(r[0],v[0]),l=!0)}}return l?e[e.length-1][1]=r[1]:e.push(r),e}};s.CharacterJoinerService=i=c([f(0,_.IBufferService)],i)},5114:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let c=o(844),f=o(8460),a=o(3656);class n extends c.Disposable{constructor(h,i,t){super(),this._textarea=h,this._window=i,this.mainDocument=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new d(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((e=>this._screenDprMonitor.setWindow(e)))),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(h){this._window!==h&&(this._window=h,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=n;class d extends c.Disposable{constructor(h){super(),this._parentWindow=h,this._windowResizeListener=this.register(new c.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,c.toDisposable)((()=>this.clearListener())))}setWindow(h){this._parentWindow=h,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.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:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let c=o(844);class f extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(n){return this.linkProviders.push(n),{dispose:()=>{let d=this.linkProviders.indexOf(n);d!==-1&&this.linkProviders.splice(d,1)}}}}s.LinkProviderService=f},8934:function(D,s,o){var c=this&&this.__decorate||function(_,h,i,t){var e,r=arguments.length,l=r<3?h:t===null?t=Object.getOwnPropertyDescriptor(h,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(_,h,i,t);else for(var p=_.length-1;p>=0;p--)(e=_[p])&&(l=(r<3?e(l):r>3?e(h,i,l):e(h,i))||l);return r>3&&l&&Object.defineProperty(h,i,l),l},f=this&&this.__param||function(_,h){return function(i,t){h(i,t,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let a=o(4725),n=o(9806),d=s.MouseService=class{constructor(_,h){this._renderService=_,this._charSizeService=h}getCoords(_,h,i,t,e){return(0,n.getCoords)(window,_,h,i,t,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(_,h){let i=(0,n.getCoordsRelativeToElement)(window,_,h);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};s.MouseService=d=c([f(0,a.IRenderService),f(1,a.ICharSizeService)],d)},3230:function(D,s,o){var c=this&&this.__decorate||function(e,r,l,p){var v,g=arguments.length,u=g<3?r:p===null?p=Object.getOwnPropertyDescriptor(r,l):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,p);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(u=(g<3?v(u):g>3?v(r,l,u):v(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,p){r(l,p,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let a=o(6193),n=o(4725),d=o(8460),_=o(844),h=o(7226),i=o(2585),t=s.RenderService=class extends _.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,r,l,p,v,g,u,m){super(),this._rowCount=e,this._charSizeService=p,this._renderer=this.register(new _.MutableDisposable),this._pausedResizeTask=new h.DebouncedIdleTask,this._observerDisposable=this.register(new _.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 d.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new d.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new d.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new d.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((y,x)=>this._renderRows(y,x)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(g.onResize((()=>this._fullRefresh()))),this.register(g.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(l.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(v.onDecorationRegistered((()=>this._fullRefresh()))),this.register(v.onDecorationRemoved((()=>this._fullRefresh()))),this.register(l.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(l.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(g.buffer.y,g.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,r),this.register(u.onWindowChange((y=>this._registerIntersectionObserver(y,r))))}_registerIntersectionObserver(e,r){if("IntersectionObserver"in e){let l=new e.IntersectionObserver((p=>this._handleIntersectionChange(p[p.length-1])),{threshold:0});l.observe(r),this._observerDisposable.value=(0,_.toDisposable)((()=>l.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,r,l=!1){this._isPaused?this._needsFullRefresh=!0:(l||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,r,this._rowCount))}_renderRows(e,r){this._renderer.value&&(e=Math.min(e,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(e,r),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:r}),this._onRender.fire({start:e,end:r}),this._isNextRenderRedrawOnly=!0)}resize(e,r){this._rowCount=r,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((r=>this.refreshRows(r.start,r.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_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(e,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,r))):this._renderer.value.handleResize(e,r),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,r,l){this._selectionState.start=e,this._selectionState.end=r,this._selectionState.columnSelectMode=l,this._renderer.value?.handleSelectionChanged(e,r,l)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=t=c([f(2,i.IOptionsService),f(3,n.ICharSizeService),f(4,i.IDecorationService),f(5,i.IBufferService),f(6,n.ICoreBrowserService),f(7,n.IThemeService)],t)},9312:function(D,s,o){var c=this&&this.__decorate||function(u,m,y,x){var C,w=arguments.length,A=w<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,m,y,x);else for(var P=u.length-1;P>=0;P--)(C=u[P])&&(A=(w<3?C(A):w>3?C(m,y,A):C(m,y))||A);return w>3&&A&&Object.defineProperty(m,y,A),A},f=this&&this.__param||function(u,m){return function(y,x){m(y,x,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let a=o(9806),n=o(9504),d=o(456),_=o(4725),h=o(8460),i=o(844),t=o(6114),e=o(4841),r=o(511),l=o(2585),p="\xA0",v=new RegExp(p,"g"),g=s.SelectionService=class extends i.Disposable{constructor(u,m,y,x,C,w,A,P,U){super(),this._element=u,this._screenElement=m,this._linkifier=y,this._bufferService=x,this._coreService=C,this._mouseService=w,this._optionsService=A,this._renderService=P,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new r.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new h.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new h.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new h.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=q=>this._handleMouseMove(q),this._mouseUpListener=q=>this._handleMouseUp(q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((q=>this._handleTrim(q))),this.register(this._bufferService.buffers.onBufferActivate((q=>this._handleBufferActivate(q)))),this.enable(),this._model=new d.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.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 u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!u||!m||u[0]===m[0]&&u[1]===m[1])}get selectionText(){let u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!u||!m)return"";let y=this._bufferService.buffer,x=[];if(this._activeSelectionMode===3){if(u[0]===m[0])return"";let C=u[0]<m[0]?u[0]:m[0],w=u[0]<m[0]?m[0]:u[0];for(let A=u[1];A<=m[1];A++){let P=y.translateBufferLineToString(A,!0,C,w);x.push(P)}}else{let C=u[1]===m[1]?m[0]:void 0;x.push(y.translateBufferLineToString(u[1],!0,u[0],C));for(let w=u[1]+1;w<=m[1]-1;w++){let A=y.lines.get(w),P=y.translateBufferLineToString(w,!0);A?.isWrapped?x[x.length-1]+=P:x.push(P)}if(u[1]!==m[1]){let w=y.lines.get(m[1]),A=y.translateBufferLineToString(m[1],!0,0,m[0]);w&&w.isWrapped?x[x.length-1]+=A:x.push(A)}}return x.map((C=>C.replace(v," "))).join(t.isWindows?`\r
|
|
6
|
+
WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=d=c([f(0,n.IBufferService),f(1,n.IOptionsService),f(2,n.IOscLinkService)],d)},6193:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let c=o(3614),f=o(3656),a=o(3551),n=o(9042),d=o(3730),_=o(1680),h=o(3107),i=o(5744),t=o(2950),e=o(1296),r=o(428),l=o(4269),v=o(5114),p=o(8934),g=o(3230),u=o(9312),m=o(4725),y=o(6731),x=o(8055),S=o(8969),w=o(8460),A=o(844),z=o(6114),U=o(8437),q=o(2584),$=o(7399),b=o(5941),E=o(9074),k=o(2585),D=o(5435),P=o(4567),K=o(779);class Y extends S.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(M={}){super(M),this.browser=z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new A.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(d.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((C,H)=>this.refresh(C,H)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((C=>this._reportWindowsOptions(C)))),this.register(this._inputHandler.onColor((C=>this._handleColorEvent(C)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((C=>this._afterResize(C.cols,C.rows)))),this.register((0,A.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(M){if(this._themeService)for(let C of M){let H,N="";switch(C.index){case 256:H="foreground",N="10";break;case 257:H="background",N="11";break;case 258:H="cursor",N="12";break;default:H="ansi",N="4;"+C.index}switch(C.type){case 0:let V=x.color.toColorRGB(H==="ansi"?this._themeService.colors.ansi[C.index]:this._themeService.colors[H]);this.coreService.triggerDataEvent(`${q.C0.ESC}]${N};${(0,b.toRgbString)(V)}${q.C1_ESCAPED.ST}`);break;case 1:if(H==="ansi")this._themeService.modifyColors((j=>j.ansi[C.index]=x.channels.toColor(...C.color)));else{let j=H;this._themeService.modifyColors((te=>te[j]=x.channels.toColor(...C.color)))}break;case 2:this._themeService.restoreColor(C.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(M){M?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(P.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(M){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.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(q.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 M=this.buffer.ybase+this.buffer.y,C=this.buffer.lines.get(M);if(!C)return;let H=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,V=C.getWidth(H),j=this._renderService.dimensions.css.cell.width*V,te=this.buffer.y*this._renderService.dimensions.css.cell.height,ne=H*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ne+"px",this.textarea.style.top=te+"px",this.textarea.style.width=j+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(C=>{this.hasSelection()&&(0,c.copyHandler)(C,this._selectionService)})));let M=C=>(0,c.handlePasteEvent)(C,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",M)),this.register((0,f.addDisposableDomListener)(this.element,"paste",M)),z.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(C=>{C.button===2&&(0,c.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(C=>{(0,c.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),z.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(C=>{C.button===1&&(0,c.moveTextAreaUnderMouseCursor)(C,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(M=>this._keyUp(M)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(M=>this._keyDown(M)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(M=>this._keyPress(M)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(M=>this._compositionHelper.compositionupdate(M)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(M=>this._inputEvent(M)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(M){if(!M)throw new Error("Terminal requires a parent element.");if(M.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=M.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"),M.appendChild(this.element);let C=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),C.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,f.addDisposableDomListener)(this.screenElement,"mousemove",(H=>this.updateCursorStyle(H)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),C.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",n.promptLabel),z.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(v.CoreBrowserService,this.textarea,M.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(H=>this._handleTextAreaFocus(H)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(r.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(l.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((H=>this._onRender.fire(H)))),this.onResize((H=>this._renderService.resize(H.cols,H.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(t.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(C);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(_.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((H=>this.scrollLines(H.amount,H.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((H=>this.scrollLines(H.amount,H.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(h.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(H=>this._selectionService.handleMouseDown(H)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(P.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(H=>this._handleScreenReaderModeOptionChange(H)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let M=this,C=this.element;function H(j){let te=M._mouseService.getMouseReportCoords(j,M.screenElement);if(!te)return!1;let ne,oe;switch(j.overrideType||j.type){case"mousemove":oe=32,j.buttons===void 0?(ne=3,j.button!==void 0&&(ne=j.button<3?j.button:3)):ne=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":oe=0,ne=j.button<3?j.button:3;break;case"mousedown":oe=1,ne=j.button<3?j.button:3;break;case"wheel":if(M._customWheelEventHandler&&M._customWheelEventHandler(j)===!1||M.viewport.getLinesScrolled(j)===0)return!1;oe=j.deltaY<0?0:1,ne=4;break;default:return!1}return!(oe===void 0||ne===void 0||ne>4)&&M.coreMouseService.triggerMouseEvent({col:te.col,row:te.row,x:te.x,y:te.y,button:ne,action:oe,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:j=>(H(j),j.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(j)),wheel:j=>(H(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&H(j)},mousemove:j=>{j.buttons||H(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?N.mousemove||(C.addEventListener("mousemove",V.mousemove),N.mousemove=V.mousemove):(C.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&j?N.wheel||(C.addEventListener("wheel",V.wheel,{passive:!1}),N.wheel=V.wheel):(C.removeEventListener("wheel",N.wheel),N.wheel=null),2&j?N.mouseup||(N.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&j?N.mousedrag||(N.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(C,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return H(j),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(j)}))),this.register((0,f.addDisposableDomListener)(C,"wheel",(j=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let te=this.viewport.getLinesScrolled(j);if(te===0)return;let ne=q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),oe="";for(let fe=0;fe<Math.abs(te);fe++)oe+=ne;return this.coreService.triggerDataEvent(oe,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(C,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(C,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(M,C){this._renderService?.refreshRows(M,C)}updateCursorStyle(M){this._selectionService?.shouldColumnSelect(M)?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(M,C,H=0){H===1?(super.scrollLines(M,C,H),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(M)}paste(M){(0,c.paste)(M,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(M){this._customKeyEventHandler=M}attachCustomWheelEventHandler(M){this._customWheelEventHandler=M}registerLinkProvider(M){return this._linkProviderService.registerLinkProvider(M)}registerCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let C=this._characterJoinerService.register(M);return this.refresh(0,this.rows-1),C}deregisterCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(M)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(M){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+M)}registerDecoration(M){return this._decorationService.registerDecoration(M)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(M,C,H){this._selectionService.setSelection(M,C,H)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(M,C){this._selectionService?.selectLines(M,C)}_keyDown(M){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;let C=this.browser.isMac&&this.options.macOptionIsMeta&&M.altKey;if(!C&&!this._compositionHelper.keydown(M))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;C||M.key!=="Dead"&&M.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let H=(0,$.evaluateKeyboardEvent)(M,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(M),H.type===3||H.type===2){let N=this.rows-1;return this.scrollLines(H.type===2?-N:N),this.cancel(M,!0)}return H.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,M)||(H.cancel&&this.cancel(M,!0),!H.key||!!(M.key&&!M.ctrlKey&&!M.altKey&&!M.metaKey&&M.key.length===1&&M.key.charCodeAt(0)>=65&&M.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(H.key!==q.C0.ETX&&H.key!==q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:H.key,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(H.key,!0),!this.optionsService.rawOptions.screenReaderMode||M.altKey||M.ctrlKey?this.cancel(M,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(M,C){let H=M.isMac&&!this.options.macOptionIsMeta&&C.altKey&&!C.ctrlKey&&!C.metaKey||M.isWindows&&C.altKey&&C.ctrlKey&&!C.metaKey||M.isWindows&&C.getModifierState("AltGraph");return C.type==="keypress"?H:H&&(!C.keyCode||C.keyCode>47)}_keyUp(M){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1||((function(C){return C.keyCode===16||C.keyCode===17||C.keyCode===18})(M)||this.focus(),this.updateCursorStyle(M),this._keyPressHandled=!1)}_keyPress(M){let C;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;if(this.cancel(M),M.charCode)C=M.charCode;else if(M.which===null||M.which===void 0)C=M.keyCode;else{if(M.which===0||M.charCode===0)return!1;C=M.which}return!(!C||(M.altKey||M.ctrlKey||M.metaKey)&&!this._isThirdLevelShift(this.browser,M)||(C=String.fromCharCode(C),this._onKey.fire({key:C,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(C,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(M){if(M.data&&M.inputType==="insertText"&&(!M.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let C=M.data;return this.coreService.triggerDataEvent(C,!0),this.cancel(M),!0}return!1}resize(M,C){M!==this.cols||C!==this.rows?super.resize(M,C):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(M,C){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 M=1;M<this.rows;M++)this.buffer.lines.push(this.buffer.getBlankLine(U.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 M=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=M,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(q.C0.ESC+"[I"):this.coreService.triggerDataEvent(q.C0.ESC+"[O")}_reportWindowsOptions(M){if(this._renderService)switch(M){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let C=this._renderService.dimensions.css.canvas.width.toFixed(0),H=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${q.C0.ESC}[4;${H};${C}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let N=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${q.C0.ESC}[6;${V};${N}t`)}}cancel(M,C){if(this.options.cancelEvents||C)return M.preventDefault(),M.stopPropagation(),!1}}s.Terminal=Y},9924:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;let a=Date.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=a-this._lastRefreshMs,d=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(L,s,o){var c=this&&this.__decorate||function(t,e,r,l){var v,p=arguments.length,g=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(v=t[u])&&(g=(p<3?v(g):p>3?v(e,r,g):v(e,r))||g);return p>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let a=o(3656),n=o(4725),d=o(8460),_=o(844),h=o(2585),i=s.Viewport=class extends _.Disposable{constructor(t,e,r,l,v,p,g,u){super(),this._viewportElement=t,this._scrollArea=e,this._bufferService=r,this._optionsService=l,this._charSizeService=v,this._renderService=p,this._coreBrowserService=g,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 d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((m=>this._renderDimensions=m))),this._handleThemeChange(u.colors),this.register(u.onChangeColors((m=>this._handleThemeChange(m)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(t){this._viewportElement.style.backgroundColor=t.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(t){if(t)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 e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null}syncScrollArea(t=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(t);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(t)}_handleScroll(t){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 e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let t=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(t*(this._smoothScrollState.target-this._smoothScrollState.origin)),t<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(t,e){let r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&r<this._lastRecordedBufferHeight)||(t.cancelable&&t.preventDefault(),!1)}handleWheel(t){let e=this._getPixelsScrolled(t);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}scrollLines(t){if(t!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=t*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!1})}_getPixelsScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(t,e){let r,l="",v=[],p=e??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let u=t;u<p;u++){let m=g.get(u);if(!m)continue;let y=g.get(u+1)?.isWrapped;if(l+=m.translateToString(!y),!y||u===g.length-1){let x=document.createElement("div");x.textContent=l,v.push(x),l.length>0&&(r=x),l=""}}return{bufferElements:v,cursorElement:r}}getLinesScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(t,e){let r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&e.altKey||r==="ctrl"&&e.ctrlKey||r==="shift"&&e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(t){this._lastTouchY=t.touches[0].pageY}handleTouchMove(t){let e=this._lastTouchY-t.touches[0].pageY;return this._lastTouchY=t.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}};s.Viewport=i=c([f(2,h.IBufferService),f(3,h.IOptionsService),f(4,n.ICharSizeService),f(5,n.IRenderService),f(6,n.ICoreBrowserService),f(7,n.IThemeService)],i)},3107:function(L,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,v=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(h,i,t,e);else for(var p=h.length-1;p>=0;p--)(r=h[p])&&(v=(l<3?r(v):l>3?r(i,t,v):r(i,t))||v);return l>3&&v&&Object.defineProperty(i,t,v),v},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let a=o(4725),n=o(844),d=o(2585),_=s.BufferDecorationRenderer=class extends n.Disposable{constructor(h,i,t,e,r){super(),this._screenElement=h,this._bufferService=i,this._coreBrowserService=t,this._decorationService=e,this._renderService=r,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((l=>this._removeDecoration(l)))),this.register((0,n.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 h of this._decorationService.decorations)this._renderDecoration(h);this._dimensionsChanged=!1}_renderDecoration(h){this._refreshStyle(h),this._dimensionsChanged&&this._refreshXPosition(h)}_createElement(h){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",h?.options?.layer==="top"),i.style.width=`${Math.round((h.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(h.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(h.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let t=h.options.x??0;return t&&t>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(h,i),i}_refreshStyle(h){let i=h.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)h.element&&(h.element.style.display="none",h.onRenderEmitter.fire(h.element));else{let t=this._decorationElements.get(h);t||(t=this._createElement(h),h.element=t,this._decorationElements.set(h,t),this._container.appendChild(t),h.onDispose((()=>{this._decorationElements.delete(h),t.remove()}))),t.style.top=i*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",h.onRenderEmitter.fire(t)}}_refreshXPosition(h,i=h.element){if(!i)return;let t=h.options.x??0;(h.options.anchor||"left")==="right"?i.style.right=t?t*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=t?t*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(h){this._decorationElements.get(h)?.remove(),this._decorationElements.delete(h),h.dispose()}};s.BufferDecorationRenderer=_=c([f(1,d.IBufferService),f(2,a.ICoreBrowserService),f(3,d.IDecorationService),f(4,a.IRenderService)],_)},5871:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(let c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,f){return c>=o.startBufferLine-this._linePadding[f||"full"]&&c<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(L,s,o){var c=this&&this.__decorate||function(r,l,v,p){var g,u=arguments.length,m=u<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,v):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,l,v,p);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(l,v,m):g(l,v))||m);return u>3&&m&&Object.defineProperty(l,v,m),m},f=this&&this.__param||function(r,l){return function(v,p){l(v,p,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let a=o(5871),n=o(4725),d=o(844),_=o(2585),h={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},e=s.OverviewRulerRenderer=class extends d.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,l,v,p,g,u,m){super(),this._viewportElement=r,this._screenElement=l,this._bufferService=v,this._decorationService=p,this._renderService=g,this._optionsService=u,this._coreBrowserService=m,this._colorZoneStore=new a.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 y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,d.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 r=Math.floor(this._canvas.width/3),l=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=r,i.center=l,i.right=r,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=i.left,t.right=i.left+i.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);let r=this._canvas.height/this._bufferService.buffer.lines.length,l=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);h.left=l,h.center=l,h.right=l}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.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 l of this._decorationService.decorations)this._colorZoneStore.addDecoration(l);this._ctx.lineWidth=1;let r=this._colorZoneStore.zones;for(let l of r)l.position!=="full"&&this._renderColorZone(l);for(let l of r)l.position==="full"&&this._renderColorZone(l);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(t[r.position||"full"],Math.round((this._canvas.height-1)*(r.startBufferLine/this._bufferService.buffers.active.lines.length)-h[r.position||"full"]/2),i[r.position||"full"],Math.round((this._canvas.height-1)*((r.endBufferLine-r.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[r.position||"full"]))}_queueRefresh(r,l){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=l||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=e=c([f(2,_.IBufferService),f(3,_.IDecorationService),f(4,n.IRenderService),f(5,_.IOptionsService),f(6,n.ICoreBrowserService)],e)},2950:function(L,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,v=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(h,i,t,e);else for(var p=h.length-1;p>=0;p--)(r=h[p])&&(v=(l<3?r(v):l>3?r(i,t,v):r(i,t))||v);return l>3&&v&&Object.defineProperty(i,t,v),v},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let a=o(4725),n=o(2585),d=o(2584),_=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(h,i,t,e,r,l){this._textarea=h,this._compositionView=i,this._bufferService=t,this._optionsService=e,this._coreService=r,this._renderService=l,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(h){this._compositionView.textContent=h.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(h){if(this._isComposing||this._isSendingComposition){if(h.keyCode===229||h.keyCode===16||h.keyCode===17||h.keyCode===18)return!1;this._finalizeComposition(!1)}return h.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(h){if(this._compositionView.classList.remove("active"),this._isComposing=!1,h){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let h=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,t=i.replace(h,"");this._dataAlreadySent=t,i.length>h.length?this._coreService.triggerDataEvent(t,!0):i.length<h.length?this._coreService.triggerDataEvent(`${d.C0.DEL}`,!0):i.length===h.length&&i!==h&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(h){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}h||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=_=c([f(2,n.IBufferService),f(3,n.IOptionsService),f(4,n.ICoreService),f(5,a.IRenderService)],_)},9806:(L,s)=>{function o(c,f,a){let n=a.getBoundingClientRect(),d=c.getComputedStyle(a),_=parseInt(d.getPropertyValue("padding-left")),h=parseInt(d.getPropertyValue("padding-top"));return[f.clientX-n.left-_,f.clientY-n.top-h]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(c,f,a,n,d,_,h,i,t){if(!_)return;let e=o(c,f,a);return e?(e[0]=Math.ceil((e[0]+(t?h/2:0))/h),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),n+(t?1:0)),e[1]=Math.min(Math.max(e[1],1),d),e):void 0}},9504:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let c=o(2584);function f(i,t,e,r){let l=i-a(i,e),v=t-a(t,e),p=Math.abs(l-v)-(function(g,u,m){let y=0,x=g-a(g,m),S=u-a(u,m);for(let w=0;w<Math.abs(x-S);w++){let A=n(g,u)==="A"?-1:1;m.buffer.lines.get(x+A*w)?.isWrapped&&y++}return y})(i,t,e);return h(p,_(n(i,t),r))}function a(i,t){let e=0,r=t.buffer.lines.get(i),l=r?.isWrapped;for(;l&&i>=0&&i<t.rows;)e++,r=t.buffer.lines.get(--i),l=r?.isWrapped;return e}function n(i,t){return i>t?"A":"B"}function d(i,t,e,r,l,v){let p=i,g=t,u="";for(;p!==e||g!==r;)p+=l?1:-1,l&&p>v.cols-1?(u+=v.buffer.translateBufferLineToString(g,!1,i,p),p=0,i=0,g++):!l&&p<0&&(u+=v.buffer.translateBufferLineToString(g,!1,0,i+1),p=v.cols-1,i=p,g--);return u+v.buffer.translateBufferLineToString(g,!1,i,p)}function _(i,t){let e=t?"O":"[";return c.C0.ESC+e+i}function h(i,t){i=Math.floor(i);let e="";for(let r=0;r<i;r++)e+=t;return e}s.moveToCellSequence=function(i,t,e,r){let l=e.buffer.x,v=e.buffer.y;if(!e.buffer.hasScrollback)return(function(u,m,y,x,S,w){return f(m,x,S,w).length===0?"":h(d(u,m,u,m-a(m,S),!1,S).length,_("D",w))})(l,v,0,t,e,r)+f(v,t,e,r)+(function(u,m,y,x,S,w){let A;A=f(m,x,S,w).length>0?x-a(x,S):m;let z=x,U=(function(q,$,b,E,k,D){let P;return P=f(b,E,k,D).length>0?E-a(E,k):$,q<b&&P<=E||q>=b&&P<E?"C":"D"})(u,m,y,x,S,w);return h(d(u,A,y,z,U==="C",S).length,_(U,w))})(l,v,i,t,e,r);let p;if(v===t)return p=l>i?"D":"C",h(Math.abs(l-i),_(p,r));p=v>t?"D":"C";let g=Math.abs(v-t);return h((function(u,m){return m.cols-u})(v>t?i:l,e)+(g-1)*e.cols+1+((v>t?l:i)-1),_(p,r))}},1296:function(L,s,o){var c=this&&this.__decorate||function(w,A,z,U){var q,$=arguments.length,b=$<3?A:U===null?U=Object.getOwnPropertyDescriptor(A,z):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(w,A,z,U);else for(var E=w.length-1;E>=0;E--)(q=w[E])&&(b=($<3?q(b):$>3?q(A,z,b):q(A,z))||b);return $>3&&b&&Object.defineProperty(A,z,b),b},f=this&&this.__param||function(w,A){return function(z,U){A(z,U,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let a=o(3787),n=o(2550),d=o(2223),_=o(6171),h=o(6052),i=o(4725),t=o(8055),e=o(8460),r=o(844),l=o(2585),v="xterm-dom-renderer-owner-",p="xterm-rows",g="xterm-fg-",u="xterm-bg-",m="xterm-focus",y="xterm-selection",x=1,S=s.DomRenderer=class extends r.Disposable{constructor(w,A,z,U,q,$,b,E,k,D,P,K,Y){super(),this._terminal=w,this._document=A,this._element=z,this._screenElement=U,this._viewportElement=q,this._helperContainer=$,this._linkifier2=b,this._charSizeService=k,this._optionsService=D,this._bufferService=P,this._coreBrowserService=K,this._themeService=Y,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,h.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(p),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,_.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Z=>this._injectCss(Z)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Z=>this._handleLinkHover(Z)))),this.register(this._linkifier2.onHideLinkUnderline((Z=>this._handleLinkLeave(Z)))),this.register((0,r.toDisposable)((()=>{this._element.classList.remove(v+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new n.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 w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),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/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),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 z of this._rowElements)z.style.width=`${this.dimensions.css.canvas.width}px`,z.style.height=`${this.dimensions.css.cell.height}px`,z.style.lineHeight=`${this.dimensions.css.cell.height}px`,z.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let A=`${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=A,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(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let A=`${this._terminalSelector} .${p} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;A+=`${this._terminalSelector} .${p} .xterm-dim { color: ${t.color.multiplyOpacity(w.foreground,.5).css};}`,A+=`${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 z=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,q=`blink_block_${this._terminalClass}`;A+=`@keyframes ${z} { 50% { border-bottom-style: hidden; }}`,A+=`@keyframes ${U} { 50% { box-shadow: none; }}`,A+=`@keyframes ${q} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,A+=`${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,A+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(let[$,b]of w.ansi.entries())A+=`${this._terminalSelector} .${g}${$} { color: ${b.css}; }${this._terminalSelector} .${g}${$}.xterm-dim { color: ${t.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${u}${$} { background-color: ${b.css}; }`;A+=`${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR} { color: ${t.color.opaque(w.background).css}; }${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${t.color.multiplyOpacity(t.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${u}${d.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=A}_setDefaultSpacing(){let w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,A){for(let z=this._rowElements.length;z<=A;z++){let U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>A;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,A){this._refreshRowElements(w,A),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(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,A,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,A,z),this.renderRows(0,this._bufferService.rows-1),!w||!A)return;this._selectionRenderModel.update(this._terminal,w,A,z);let U=this._selectionRenderModel.viewportStartRow,q=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(z){let k=w[0]>A[0];E.appendChild(this._createSelectionElement($,k?A[0]:w[0],k?w[0]:A[0],b-$+1))}else{let k=U===$?w[0]:0,D=$===q?A[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement($,k,D));let P=b-$-1;if(E.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,P)),$!==b){let K=q===b?A[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(w,A,z,U=1){let q=this._document.createElement("div"),$=A*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(z-A);return $+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-$),q.style.height=U*this.dimensions.css.cell.height+"px",q.style.top=w*this.dimensions.css.cell.height+"px",q.style.left=`${$}px`,q.style.width=`${b}px`,q}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 w of this._rowElements)w.replaceChildren()}renderRows(w,A){let z=this._bufferService.buffer,U=z.ybase+z.y,q=Math.min(z.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=w;k<=A;k++){let D=k+z.ydisp,P=this._rowElements[k],K=z.lines.get(D);if(!P||!K)break;P.replaceChildren(...this._rowFactory.createRow(K,D,D===U,b,E,q,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,A,z,U,q,$){z<0&&(w=0),U<0&&(A=0);let b=this._bufferService.rows-1;z=Math.max(Math.min(z,b),0),U=Math.max(Math.min(U,b),0),q=Math.min(q,this._bufferService.cols);let E=this._bufferService.buffer,k=E.ybase+E.y,D=Math.min(E.x,q-1),P=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=z;Z<=U;++Z){let M=Z+E.ydisp,C=this._rowElements[Z],H=E.lines.get(M);if(!C||!H)break;C.replaceChildren(...this._rowFactory.createRow(H,M,M===k,K,Y,D,P,this.dimensions.css.cell.width,this._widthCache,$?Z===z?w:0:-1,$?(Z===U?A:q)-1:-1))}}};s.DomRenderer=S=c([f(7,l.IInstantiationService),f(8,i.ICharSizeService),f(9,l.IOptionsService),f(10,l.IBufferService),f(11,i.ICoreBrowserService),f(12,i.IThemeService)],S)},3787:function(L,s,o){var c=this&&this.__decorate||function(p,g,u,m){var y,x=arguments.length,S=x<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,g,u,m);else for(var w=p.length-1;w>=0;w--)(y=p[w])&&(S=(x<3?y(S):x>3?y(g,u,S):y(g,u))||S);return x>3&&S&&Object.defineProperty(g,u,S),S},f=this&&this.__param||function(p,g){return function(u,m){g(u,m,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let a=o(2223),n=o(643),d=o(511),_=o(2585),h=o(8055),i=o(4725),t=o(4269),e=o(6171),r=o(3734),l=s.DomRendererRowFactory=class{constructor(p,g,u,m,y,x,S){this._document=p,this._characterJoinerService=g,this._optionsService=u,this._coreBrowserService=m,this._coreService=y,this._decorationService=x,this._themeService=S,this._workCell=new d.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,g,u){this._selectionStart=p,this._selectionEnd=g,this._columnSelectMode=u}createRow(p,g,u,m,y,x,S,w,A,z,U){let q=[],$=this._characterJoinerService.getJoinedCharacters(g),b=this._themeService.colors,E,k=p.getNoBgTrimmedLength();u&&k<x+1&&(k=x+1);let D=0,P="",K=0,Y=0,Z=0,M=!1,C=0,H=!1,N=0,V=[],j=z!==-1&&U!==-1;for(let te=0;te<k;te++){p.loadCell(te,this._workCell);let ne=this._workCell.getWidth();if(ne===0)continue;let oe=!1,fe=te,X=this._workCell;if($.length>0&&te===$[0][0]){oe=!0;let J=$.shift();X=new t.JoinedCellData(this._workCell,p.translateToString(!0,J[0],J[1]),J[1]-J[0]),fe=J[1]-1,ne=X.getWidth()}let Ce=this._isCellInSelection(te,g),We=u&&te===x,Be=j&&te>=z&&te<=U,Ue=!1;this._decorationService.forEachDecorationAtCell(te,g,void 0,(J=>{Ue=!0}));let Ie=X.getChars()||n.WHITESPACE_CELL_CHAR;if(Ie===" "&&(X.isUnderline()||X.isOverline())&&(Ie="\xA0"),N=ne*w-A.get(Ie,X.isBold(),X.isItalic()),E){if(D&&(Ce&&H||!Ce&&!H&&X.bg===K)&&(Ce&&H&&b.selectionForeground||X.fg===Y)&&X.extended.ext===Z&&Be===M&&N===C&&!We&&!oe&&!Ue){X.isInvisible()?P+=n.WHITESPACE_CELL_CHAR:P+=Ie,D++;continue}D&&(E.textContent=P),E=this._document.createElement("span"),D=0,P=""}else E=this._document.createElement("span");if(K=X.bg,Y=X.fg,Z=X.extended.ext,M=Be,C=N,H=Ce,oe&&x>=te&&x<=fe&&(x=te),!this._coreService.isCursorHidden&&We&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)S&&V.push("xterm-cursor-blink"),V.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(y)switch(y){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(X.isBold()&&V.push("xterm-bold"),X.isItalic()&&V.push("xterm-italic"),X.isDim()&&V.push("xterm-dim"),P=X.isInvisible()?n.WHITESPACE_CELL_CHAR:X.getChars()||n.WHITESPACE_CELL_CHAR,X.isUnderline()&&(V.push(`xterm-underline-${X.extended.underlineStyle}`),P===" "&&(P="\xA0"),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let J=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&J<8&&(J+=8),E.style.textDecorationColor=b.ansi[J].css}X.isOverline()&&(V.push("xterm-overline"),P===" "&&(P="\xA0")),X.isStrikethrough()&&V.push("xterm-strikethrough"),Be&&(E.style.textDecoration="underline");let me=X.getFgColor(),ke=X.getFgColorMode(),we=X.getBgColor(),Te=X.getBgColorMode(),Je=!!X.isInverse();if(Je){let J=me;me=we,we=J;let xe=ke;ke=Te,Te=xe}let se,ye,ae,Le=!1;switch(this._decorationService.forEachDecorationAtCell(te,g,void 0,(J=>{J.options.layer!=="top"&&Le||(J.backgroundColorRGB&&(Te=50331648,we=J.backgroundColorRGB.rgba>>8&16777215,se=J.backgroundColorRGB),J.foregroundColorRGB&&(ke=50331648,me=J.foregroundColorRGB.rgba>>8&16777215,ye=J.foregroundColorRGB),Le=J.options.layer==="top")})),!Le&&Ce&&(se=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,we=se.rgba>>8&16777215,Te=50331648,Le=!0,b.selectionForeground&&(ke=50331648,me=b.selectionForeground.rgba>>8&16777215,ye=b.selectionForeground)),Le&&V.push("xterm-decoration-top"),Te){case 16777216:case 33554432:ae=b.ansi[we],V.push(`xterm-bg-${we}`);break;case 50331648:ae=h.channels.toColor(we>>16,we>>8&255,255&we),this._addStyle(E,`background-color:#${v((we>>>0).toString(16),"0",6)}`);break;default:Je?(ae=b.foreground,V.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):ae=b.background}switch(se||X.isDim()&&(se=h.color.multiplyOpacity(ae,.5)),ke){case 16777216:case 33554432:X.isBold()&&me<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(me+=8),this._applyMinimumContrast(E,ae,b.ansi[me],X,se,void 0)||V.push(`xterm-fg-${me}`);break;case 50331648:let J=h.channels.toColor(me>>16&255,me>>8&255,255&me);this._applyMinimumContrast(E,ae,J,X,se,ye)||this._addStyle(E,`color:#${v(me.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ae,b.foreground,X,se,ye)||Je&&V.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}V.length&&(E.className=V.join(" "),V.length=0),We||oe||Ue?E.textContent=P:D++,N!==this.defaultSpacing&&(E.style.letterSpacing=`${N}px`),q.push(E),te=fe}return E&&D&&(E.textContent=P),q}_applyMinimumContrast(p,g,u,m,y,x){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let S=this._getContrastCache(m),w;if(y||x||(w=S.getColor(g.rgba,u.rgba)),w===void 0){let A=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);w=h.color.ensureContrastRatio(y||g,x||u,A),S.setColor((y||g).rgba,(x||u).rgba,w??null)}return!!w&&(this._addStyle(p,`color:${w.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,g){p.setAttribute("style",`${p.getAttribute("style")||""}${g};`)}_isCellInSelection(p,g){let u=this._selectionStart,m=this._selectionEnd;return!(!u||!m)&&(this._columnSelectMode?u[0]<=m[0]?p>=u[0]&&g>=u[1]&&p<m[0]&&g<=m[1]:p<u[0]&&g>=u[1]&&p>=m[0]&&g<=m[1]:g>u[1]&&g<m[1]||u[1]===m[1]&&g===u[1]&&p>=u[0]&&p<m[0]||u[1]<m[1]&&g===m[1]&&p<m[0]||u[1]<m[1]&&g===u[1]&&p>=u[0])}};function v(p,g,u){for(;p.length<u;)p=g+p;return p}s.DomRendererRowFactory=l=c([f(1,i.ICharacterJoinerService),f(2,_.IOptionsService),f(3,i.ICoreBrowserService),f(4,_.ICoreService),f(5,_.IDecorationService),f(6,i.IThemeService)],l)},2550:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let f=o.createElement("span");f.classList.add("xterm-char-measure-element");let a=o.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let n=o.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let d=o.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[f,a,n,d],this._container.appendChild(f),this._container.appendChild(a),this._container.appendChild(n),this._container.appendChild(d),c.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(o,c,f,a){o===this._font&&c===this._fontSize&&f===this._weight&&a===this._weightBold||(this._font=o,this._fontSize=c,this._weight=f,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(o,c,f){let a=0;if(!c&&!f&&o.length===1&&(a=o.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let _=this._measure(o,0);return _>0&&(this._flat[a]=_),_}let n=o;c&&(n+="B"),f&&(n+="I");let d=this._holey.get(n);if(d===void 0){let _=0;c&&(_|=1),f&&(_|=2),d=this._measure(o,_),d>0&&this._holey.set(n,d)}return d}_measure(o,c){let f=this._measureElements[c];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let c=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(L,s)=>{function o(f){return 57508<=f&&f<=57558}function c(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=o,s.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},s.isEmoji=c,s.allowRescaling=function(f,a,n,d){return a===1&&n>Math.ceil(1.5*d)&&f!==void 0&&f>255&&!c(f)&&!o(f)&&!(function(_){return 57344<=_&&_<=63743})(f)},s.treatGlyphAsBackgroundColor=function(f){return o(f)||(function(a){return 9472<=a&&a<=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,a,n=0){return(f-(2*Math.round(a)-n))%(2*Math.round(a))}},6052:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,a,n,d=!1){if(this.selectionStart=a,this.selectionEnd=n,!a||!n||a[0]===n[0]&&a[1]===n[1])return void this.clear();let _=f.buffers.active.ydisp,h=a[1]-_,i=n[1]-_,t=Math.max(h,0),e=Math.min(i,f.rows-1);t>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=h,this.viewportEndRow=i,this.viewportCappedStartRow=t,this.viewportCappedEndRow=e,this.startCol=a[0],this.endCol=n[0])}isCellSelected(f,a,n){return!!this.hasSelection&&(n-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?a>=this.startCol&&n>=this.viewportCappedStartRow&&a<this.endCol&&n<=this.viewportCappedEndRow:a<this.startCol&&n>=this.viewportCappedStartRow&&a>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&a>=this.startCol&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&a>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let a=o(2585),n=o(8460),d=o(844),_=s.CharSizeService=class extends d.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,r,l){super(),this._optionsService=l,this.width=0,this.height=0,this._onCharSizeChange=this.register(new n.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new t(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};s.CharSizeService=_=c([f(2,a.IOptionsService)],_);class h extends d.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,l){r!==void 0&&r>0&&l!==void 0&&l>0&&(this._result.width=r,this._result.height=l)}}class i extends h{constructor(r,l,v){super(),this._document=r,this._parentElement=l,this._optionsService=v,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 t extends h{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let l=this._ctx.measureText("W");if(!("width"in l&&"fontBoundingBoxAscent"in l&&"fontBoundingBoxDescent"in l))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let r=this._ctx.measureText("W");return this._validateAndSet(r.width,r.fontBoundingBoxAscent+r.fontBoundingBoxDescent),this._result}}},4269:function(L,s,o){var c=this&&this.__decorate||function(t,e,r,l){var v,p=arguments.length,g=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(v=t[u])&&(g=(p<3?v(g):p>3?v(e,r,g):v(e,r))||g);return p>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let a=o(3734),n=o(643),d=o(511),_=o(2585);class h extends a.AttributeData{constructor(e,r,l){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=r,this._width=l}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()]}}s.JoinedCellData=h;let i=s.CharacterJoinerService=class Mt{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(e){let r={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(r),r.id}deregister(e){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===e)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let r=this._bufferService.buffer.lines.get(e);if(!r||r.length===0)return[];let l=[],v=r.translateToString(!0),p=0,g=0,u=0,m=r.getFg(0),y=r.getBg(0);for(let x=0;x<r.getTrimmedLength();x++)if(r.loadCell(x,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==y){if(x-p>1){let S=this._getJoinedRanges(v,u,g,r,p);for(let w=0;w<S.length;w++)l.push(S[w])}p=x,u=g,m=this._workCell.fg,y=this._workCell.bg}g+=this._workCell.getChars().length||n.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){let x=this._getJoinedRanges(v,u,g,r,p);for(let S=0;S<x.length;S++)l.push(x[S])}return l}_getJoinedRanges(e,r,l,v,p){let g=e.substring(r,l),u=[];try{u=this._characterJoiners[0].handler(g)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{let y=this._characterJoiners[m].handler(g);for(let x=0;x<y.length;x++)Mt._mergeRanges(u,y[x])}catch(y){console.error(y)}return this._stringRangesToCellRanges(u,v,p),u}_stringRangesToCellRanges(e,r,l){let v=0,p=!1,g=0,u=e[v];if(u){for(let m=l;m<this._bufferService.cols;m++){let y=r.getWidth(m),x=r.getString(m).length||n.WHITESPACE_CELL_CHAR.length;if(y!==0){if(!p&&u[0]<=g&&(u[0]=m,p=!0),u[1]<=g){if(u[1]=m,u=e[++v],!u)break;u[0]<=g?(u[0]=m,p=!0):p=!1}g+=x}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,r){let l=!1;for(let v=0;v<e.length;v++){let p=e[v];if(l){if(r[1]<=p[0])return e[v-1][1]=r[1],e;if(r[1]<=p[1])return e[v-1][1]=Math.max(r[1],p[1]),e.splice(v,1),e;e.splice(v,1),v--}else{if(r[1]<=p[0])return e.splice(v,0,r),e;if(r[1]<=p[1])return p[0]=Math.min(r[0],p[0]),e;r[0]<p[1]&&(p[0]=Math.min(r[0],p[0]),l=!0)}}return l?e[e.length-1][1]=r[1]:e.push(r),e}};s.CharacterJoinerService=i=c([f(0,_.IBufferService)],i)},5114:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let c=o(844),f=o(8460),a=o(3656);class n extends c.Disposable{constructor(h,i,t){super(),this._textarea=h,this._window=i,this.mainDocument=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new d(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((e=>this._screenDprMonitor.setWindow(e)))),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(h){this._window!==h&&(this._window=h,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=n;class d extends c.Disposable{constructor(h){super(),this._parentWindow=h,this._windowResizeListener=this.register(new c.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,c.toDisposable)((()=>this.clearListener())))}setWindow(h){this._parentWindow=h,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.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,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let c=o(844);class f extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(n){return this.linkProviders.push(n),{dispose:()=>{let d=this.linkProviders.indexOf(n);d!==-1&&this.linkProviders.splice(d,1)}}}}s.LinkProviderService=f},8934:function(L,s,o){var c=this&&this.__decorate||function(_,h,i,t){var e,r=arguments.length,l=r<3?h:t===null?t=Object.getOwnPropertyDescriptor(h,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(_,h,i,t);else for(var v=_.length-1;v>=0;v--)(e=_[v])&&(l=(r<3?e(l):r>3?e(h,i,l):e(h,i))||l);return r>3&&l&&Object.defineProperty(h,i,l),l},f=this&&this.__param||function(_,h){return function(i,t){h(i,t,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let a=o(4725),n=o(9806),d=s.MouseService=class{constructor(_,h){this._renderService=_,this._charSizeService=h}getCoords(_,h,i,t,e){return(0,n.getCoords)(window,_,h,i,t,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(_,h){let i=(0,n.getCoordsRelativeToElement)(window,_,h);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};s.MouseService=d=c([f(0,a.IRenderService),f(1,a.ICharSizeService)],d)},3230:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let a=o(6193),n=o(4725),d=o(8460),_=o(844),h=o(7226),i=o(2585),t=s.RenderService=class extends _.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,r,l,v,p,g,u,m){super(),this._rowCount=e,this._charSizeService=v,this._renderer=this.register(new _.MutableDisposable),this._pausedResizeTask=new h.DebouncedIdleTask,this._observerDisposable=this.register(new _.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 d.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new d.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new d.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new d.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((y,x)=>this._renderRows(y,x)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(g.onResize((()=>this._fullRefresh()))),this.register(g.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(l.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(p.onDecorationRegistered((()=>this._fullRefresh()))),this.register(p.onDecorationRemoved((()=>this._fullRefresh()))),this.register(l.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(l.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(g.buffer.y,g.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,r),this.register(u.onWindowChange((y=>this._registerIntersectionObserver(y,r))))}_registerIntersectionObserver(e,r){if("IntersectionObserver"in e){let l=new e.IntersectionObserver((v=>this._handleIntersectionChange(v[v.length-1])),{threshold:0});l.observe(r),this._observerDisposable.value=(0,_.toDisposable)((()=>l.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,r,l=!1){this._isPaused?this._needsFullRefresh=!0:(l||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,r,this._rowCount))}_renderRows(e,r){this._renderer.value&&(e=Math.min(e,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(e,r),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:r}),this._onRender.fire({start:e,end:r}),this._isNextRenderRedrawOnly=!0)}resize(e,r){this._rowCount=r,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((r=>this.refreshRows(r.start,r.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_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(e,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,r))):this._renderer.value.handleResize(e,r),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,r,l){this._selectionState.start=e,this._selectionState.end=r,this._selectionState.columnSelectMode=l,this._renderer.value?.handleSelectionChanged(e,r,l)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=t=c([f(2,i.IOptionsService),f(3,n.ICharSizeService),f(4,i.IDecorationService),f(5,i.IBufferService),f(6,n.ICoreBrowserService),f(7,n.IThemeService)],t)},9312:function(L,s,o){var c=this&&this.__decorate||function(u,m,y,x){var S,w=arguments.length,A=w<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,m,y,x);else for(var z=u.length-1;z>=0;z--)(S=u[z])&&(A=(w<3?S(A):w>3?S(m,y,A):S(m,y))||A);return w>3&&A&&Object.defineProperty(m,y,A),A},f=this&&this.__param||function(u,m){return function(y,x){m(y,x,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let a=o(9806),n=o(9504),d=o(456),_=o(4725),h=o(8460),i=o(844),t=o(6114),e=o(4841),r=o(511),l=o(2585),v="\xA0",p=new RegExp(v,"g"),g=s.SelectionService=class extends i.Disposable{constructor(u,m,y,x,S,w,A,z,U){super(),this._element=u,this._screenElement=m,this._linkifier=y,this._bufferService=x,this._coreService=S,this._mouseService=w,this._optionsService=A,this._renderService=z,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new r.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new h.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new h.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new h.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=q=>this._handleMouseMove(q),this._mouseUpListener=q=>this._handleMouseUp(q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((q=>this._handleTrim(q))),this.register(this._bufferService.buffers.onBufferActivate((q=>this._handleBufferActivate(q)))),this.enable(),this._model=new d.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.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 u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!u||!m||u[0]===m[0]&&u[1]===m[1])}get selectionText(){let u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!u||!m)return"";let y=this._bufferService.buffer,x=[];if(this._activeSelectionMode===3){if(u[0]===m[0])return"";let S=u[0]<m[0]?u[0]:m[0],w=u[0]<m[0]?m[0]:u[0];for(let A=u[1];A<=m[1];A++){let z=y.translateBufferLineToString(A,!0,S,w);x.push(z)}}else{let S=u[1]===m[1]?m[0]:void 0;x.push(y.translateBufferLineToString(u[1],!0,u[0],S));for(let w=u[1]+1;w<=m[1]-1;w++){let A=y.lines.get(w),z=y.translateBufferLineToString(w,!0);A?.isWrapped?x[x.length-1]+=z:x.push(z)}if(u[1]!==m[1]){let w=y.lines.get(m[1]),A=y.translateBufferLineToString(m[1],!0,0,m[0]);w&&w.isWrapped?x[x.length-1]+=A:x.push(A)}}return x.map((S=>S.replace(p," "))).join(t.isWindows?`\r
|
|
7
7
|
`:`
|
|
8
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),t.isLinux&&u&&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(u){let m=this._getMouseBufferCoords(u),y=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!!(y&&x&&m)&&this._areCoordsInSelection(m,y,x)}isCellInSelection(u,m){let y=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!y||!x)&&this._areCoordsInSelection([u,m],y,x)}_areCoordsInSelection(u,m,y){return u[1]>m[1]&&u[1]<y[1]||m[1]===y[1]&&u[1]===m[1]&&u[0]>=m[0]&&u[0]<y[0]||m[1]<y[1]&&u[1]===y[1]&&u[0]<y[0]||m[1]<y[1]&&u[1]===m[1]&&u[0]>=m[0]}_selectWordAtCursor(u,m){let y=this._linkifier.currentLink?.link?.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let x=this._getMouseBufferCoords(u);return!!x&&(this._selectWordAt(x,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,m){this._model.clearSelection(),u=Math.max(u,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){let m=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(u){let m=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1],y=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=y?0:(m>y&&(m-=y),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(u){return t.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),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(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){let m=this._getMouseBufferCoords(u);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(u){return u.altKey&&!(t.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;let m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!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(u),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let y=this._bufferService.buffer;if(this._model.selectionEnd[1]<y.lines.length){let x=y.lines.get(this._model.selectionEnd[1]);x&&x.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[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 u=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(u.ydisp+this._bufferService.rows,u.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=u.ydisp),this.refresh()}}_handleMouseUp(u){let m=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let y=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(y&&y[0]!==void 0&&y[1]!==void 0){let x=(0,n.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,y=!(!u||!m||u[0]===m[0]&&u[1]===m[1]);y?u&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,m,y)):this._oldHasSelection&&this._fireOnSelectionChange(u,m,y)}_fireOnSelectionChange(u,m,y){this._oldSelectionStart=u,this._oldSelectionEnd=m,this._oldHasSelection=y,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim((m=>this._handleTrim(m)))}_convertViewportColToCharacterIndex(u,m){let y=m;for(let x=0;m>=x;x++){let C=u.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:C>1&&m!==x&&(y+=C-1)}return y}setSelection(u,m,y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,m],this._model.selectionStartLength=y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,m,y=!0,x=!0){if(u[0]>=this._bufferService.cols)return;let C=this._bufferService.buffer,w=C.lines.get(u[1]);if(!w)return;let A=C.translateBufferLineToString(u[1],!1),P=this._convertViewportColToCharacterIndex(w,u[0]),U=P,q=u[0]-P,$=0,b=0,E=0,k=0;if(A.charAt(P)===" "){for(;P>0&&A.charAt(P-1)===" ";)P--;for(;U<A.length&&A.charAt(U+1)===" ";)U++}else{let K=u[0],X=u[0];w.getWidth(K)===0&&($++,K--),w.getWidth(X)===2&&(b++,X++);let Z=w.getString(X).length;for(Z>1&&(k+=Z-1,U+=Z-1);K>0&&P>0&&!this._isCharWordSeparator(w.loadCell(K-1,this._workCell));){w.loadCell(K-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,K--):T>1&&(E+=T-1,P-=T-1),P--,K--}for(;X<w.length&&U+1<A.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,X++):T>1&&(k+=T-1,U+=T-1),U++,X++}}U++;let L=P+q-$+E,H=Math.min(this._bufferService.cols,U-P+$+b-E-k);if(m||A.slice(P,U).trim()!==""){if(y&&L===0&&w.getCodePoint(0)!==32){let K=C.lines.get(u[1]-1);if(K&&w.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let X=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(X){let Z=this._bufferService.cols-X.start;L-=Z,H+=Z}}}if(x&&L+H===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){let K=C.lines.get(u[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let X=this._getWordAt([0,u[1]+1],!1,!1,!0);X&&(H+=X.length)}}return{start:L,length:H}}}_selectWordAt(u,m){let y=this._getWordAt(u,m);if(y){for(;y.start<0;)y.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[y.start,u[1]],this._model.selectionStartLength=y.length}}_selectToWordAt(u){let m=this._getWordAt(u,!0);if(m){let y=u[1];for(;m.start<0;)m.start+=this._bufferService.cols,y--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,y]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){let m=this._bufferService.buffer.getWrappedRangeForLine(u),y={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols)}};s.SelectionService=g=c([f(3,l.IBufferService),f(4,l.ICoreService),f(5,_.IMouseService),f(6,l.IOptionsService),f(7,_.IRenderService),f(8,_.ICoreBrowserService)],g)},4725:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;let c=o(8343);s.ICharSizeService=(0,c.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),s.IMouseService=(0,c.createDecorator)("MouseService"),s.IRenderService=(0,c.createDecorator)("RenderService"),s.ISelectionService=(0,c.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,c.createDecorator)("ThemeService"),s.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(D,s,o){var c=this&&this.__decorate||function(g,u,m,y){var x,C=arguments.length,w=C<3?u:y===null?y=Object.getOwnPropertyDescriptor(u,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(g,u,m,y);else for(var A=g.length-1;A>=0;A--)(x=g[A])&&(w=(C<3?x(w):C>3?x(u,m,w):x(u,m))||w);return C>3&&w&&Object.defineProperty(u,m,w),w},f=this&&this.__param||function(g,u){return function(m,y){u(m,y,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let a=o(7239),n=o(8055),d=o(8460),_=o(844),h=o(2585),i=n.css.toColor("#ffffff"),t=n.css.toColor("#000000"),e=n.css.toColor("#ffffff"),r=n.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let g=[n.css.toColor("#2e3436"),n.css.toColor("#cc0000"),n.css.toColor("#4e9a06"),n.css.toColor("#c4a000"),n.css.toColor("#3465a4"),n.css.toColor("#75507b"),n.css.toColor("#06989a"),n.css.toColor("#d3d7cf"),n.css.toColor("#555753"),n.css.toColor("#ef2929"),n.css.toColor("#8ae234"),n.css.toColor("#fce94f"),n.css.toColor("#729fcf"),n.css.toColor("#ad7fa8"),n.css.toColor("#34e2e2"),n.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let m=0;m<216;m++){let y=u[m/36%6|0],x=u[m/6%6|0],C=u[m%6];g.push({css:n.channels.toCss(y,x,C),rgba:n.channels.toRgba(y,x,C)})}for(let m=0;m<24;m++){let y=8+10*m;g.push({css:n.channels.toCss(y,y,y),rgba:n.channels.toRgba(y,y,y)})}return g})());let p=s.ThemeService=class extends _.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new d.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:t,cursor:e,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:l,selectionBackgroundOpaque:n.color.blend(t,l),selectionInactiveBackgroundTransparent:l,selectionInactiveBackgroundOpaque:n.color.blend(t,l),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(g={}){let u=this._colors;if(u.foreground=v(g.foreground,i),u.background=v(g.background,t),u.cursor=v(g.cursor,e),u.cursorAccent=v(g.cursorAccent,r),u.selectionBackgroundTransparent=v(g.selectionBackground,l),u.selectionBackgroundOpaque=n.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=v(g.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=n.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=g.selectionForeground?v(g.selectionForeground,n.NULL_COLOR):void 0,u.selectionForeground===n.NULL_COLOR&&(u.selectionForeground=void 0),n.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=n.color.opacity(u.selectionBackgroundTransparent,.3)),n.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=n.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=s.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=v(g.black,s.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=v(g.red,s.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=v(g.green,s.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=v(g.yellow,s.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=v(g.blue,s.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=v(g.magenta,s.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=v(g.cyan,s.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=v(g.white,s.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=v(g.brightBlack,s.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=v(g.brightRed,s.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=v(g.brightGreen,s.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=v(g.brightYellow,s.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=v(g.brightBlue,s.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=v(g.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=v(g.brightCyan,s.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=v(g.brightWhite,s.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){let m=Math.min(u.ansi.length-16,g.extendedAnsi.length);for(let y=0;y<m;y++)u.ansi[y+16]=v(g.extendedAnsi[y],s.DEFAULT_ANSI_COLORS[y+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(g){this._restoreColor(g),this._onChangeColors.fire(this.colors)}_restoreColor(g){if(g!==void 0)switch(g){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[g]=this._restoreColors.ansi[g]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(g){g(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 v(g,u){if(g!==void 0)try{return n.css.toColor(g)}catch{}return u}s.ThemeService=p=c([f(0,h.IOptionsService)],p)},6349:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let c=o(8460),f=o(844);class a extends f.Disposable{constructor(d){super(),this._maxLength=d,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.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(d){if(this._maxLength===d)return;let _=new Array(d);for(let h=0;h<Math.min(d,this.length);h++)_[h]=this._array[this._getCyclicIndex(h)];this._array=_,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let _=this._length;_<d;_++)this._array[_]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,_){this._array[this._getCyclicIndex(d)]=_}push(d){this._array[this._getCyclicIndex(this._length)]=d,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(d,_,...h){if(_){for(let i=d;i<this._length-_;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+_)];this._length-=_,this.onDeleteEmitter.fire({index:d,amount:_})}for(let i=this._length-1;i>=d;i--)this._array[this._getCyclicIndex(i+h.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<h.length;i++)this._array[this._getCyclicIndex(d+i)]=h[i];if(h.length&&this.onInsertEmitter.fire({index:d,amount:h.length}),this._length+h.length>this._maxLength){let i=this._length+h.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=h.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,_,h){if(!(_<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+h<0)throw new Error("Cannot shift elements in list beyond index 0");if(h>0){for(let t=_-1;t>=0;t--)this.set(d+t+h,this.get(d+t));let i=d+_+h-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<_;i++)this.set(d+i+h,this.get(d+i))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}s.CircularList=a},1439:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(c,f=5){if(typeof c!="object")return c;let a=Array.isArray(c)?[]:{};for(let n in c)a[n]=f<=1?c[n]:c[n]&&o(c[n],f-1);return a}},8055:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,c=0,f=0,a=0;var n,d,_,h,i;function t(r){let l=r.toString(16);return l.length<2?"0"+l:l}function e(r,l){return r<l?(l+.05)/(r+.05):(r+.05)/(l+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(l,p,v,g){return g!==void 0?`#${t(l)}${t(p)}${t(v)}${t(g)}`:`#${t(l)}${t(p)}${t(v)}`},r.toRgba=function(l,p,v,g=255){return(l<<24|p<<16|v<<8|g)>>>0},r.toColor=function(l,p,v,g){return{css:r.toCss(l,p,v,g),rgba:r.toRgba(l,p,v,g)}}})(n||(s.channels=n={})),(function(r){function l(p,v){return a=Math.round(255*v),[o,c,f]=i.toChannels(p.rgba),{css:n.toCss(o,c,f,a),rgba:n.toRgba(o,c,f,a)}}r.blend=function(p,v){if(a=(255&v.rgba)/255,a===1)return{css:v.css,rgba:v.rgba};let g=v.rgba>>24&255,u=v.rgba>>16&255,m=v.rgba>>8&255,y=p.rgba>>24&255,x=p.rgba>>16&255,C=p.rgba>>8&255;return o=y+Math.round((g-y)*a),c=x+Math.round((u-x)*a),f=C+Math.round((m-C)*a),{css:n.toCss(o,c,f),rgba:n.toRgba(o,c,f)}},r.isOpaque=function(p){return(255&p.rgba)==255},r.ensureContrastRatio=function(p,v,g){let u=i.ensureContrastRatio(p.rgba,v.rgba,g);if(u)return n.toColor(u>>24&255,u>>16&255,u>>8&255)},r.opaque=function(p){let v=(255|p.rgba)>>>0;return[o,c,f]=i.toChannels(v),{css:n.toCss(o,c,f),rgba:v}},r.opacity=l,r.multiplyOpacity=function(p,v){return a=255&p.rgba,l(p,a*v/255)},r.toColorRGB=function(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}})(d||(s.color=d={})),(function(r){let l,p;try{let v=document.createElement("canvas");v.width=1,v.height=1;let g=v.getContext("2d",{willReadFrequently:!0});g&&(l=g,l.globalCompositeOperation="copy",p=l.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(v){if(v.match(/#[\da-f]{3,8}/i))switch(v.length){case 4:return o=parseInt(v.slice(1,2).repeat(2),16),c=parseInt(v.slice(2,3).repeat(2),16),f=parseInt(v.slice(3,4).repeat(2),16),n.toColor(o,c,f);case 5:return o=parseInt(v.slice(1,2).repeat(2),16),c=parseInt(v.slice(2,3).repeat(2),16),f=parseInt(v.slice(3,4).repeat(2),16),a=parseInt(v.slice(4,5).repeat(2),16),n.toColor(o,c,f,a);case 7:return{css:v,rgba:(parseInt(v.slice(1),16)<<8|255)>>>0};case 9:return{css:v,rgba:parseInt(v.slice(1),16)>>>0}}let g=v.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return o=parseInt(g[1]),c=parseInt(g[2]),f=parseInt(g[3]),a=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),n.toColor(o,c,f,a);if(!l||!p)throw new Error("css.toColor: Unsupported css format");if(l.fillStyle=p,l.fillStyle=v,typeof l.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(l.fillRect(0,0,1,1),[o,c,f,a]=l.getImageData(0,0,1,1).data,a!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:n.toRgba(o,c,f,a),css:v}}})(_||(s.css=_={})),(function(r){function l(p,v,g){let u=p/255,m=v/255,y=g/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}r.relativeLuminance=function(p){return l(p>>16&255,p>>8&255,255&p)},r.relativeLuminance2=l})(h||(s.rgb=h={})),(function(r){function l(v,g,u){let m=v>>24&255,y=v>>16&255,x=v>>8&255,C=g>>24&255,w=g>>16&255,A=g>>8&255,P=e(h.relativeLuminance2(C,w,A),h.relativeLuminance2(m,y,x));for(;P<u&&(C>0||w>0||A>0);)C-=Math.max(0,Math.ceil(.1*C)),w-=Math.max(0,Math.ceil(.1*w)),A-=Math.max(0,Math.ceil(.1*A)),P=e(h.relativeLuminance2(C,w,A),h.relativeLuminance2(m,y,x));return(C<<24|w<<16|A<<8|255)>>>0}function p(v,g,u){let m=v>>24&255,y=v>>16&255,x=v>>8&255,C=g>>24&255,w=g>>16&255,A=g>>8&255,P=e(h.relativeLuminance2(C,w,A),h.relativeLuminance2(m,y,x));for(;P<u&&(C<255||w<255||A<255);)C=Math.min(255,C+Math.ceil(.1*(255-C))),w=Math.min(255,w+Math.ceil(.1*(255-w))),A=Math.min(255,A+Math.ceil(.1*(255-A))),P=e(h.relativeLuminance2(C,w,A),h.relativeLuminance2(m,y,x));return(C<<24|w<<16|A<<8|255)>>>0}r.blend=function(v,g){if(a=(255&g)/255,a===1)return g;let u=g>>24&255,m=g>>16&255,y=g>>8&255,x=v>>24&255,C=v>>16&255,w=v>>8&255;return o=x+Math.round((u-x)*a),c=C+Math.round((m-C)*a),f=w+Math.round((y-w)*a),n.toRgba(o,c,f)},r.ensureContrastRatio=function(v,g,u){let m=h.relativeLuminance(v>>8),y=h.relativeLuminance(g>>8);if(e(m,y)<u){if(y<m){let w=l(v,g,u),A=e(m,h.relativeLuminance(w>>8));if(A<u){let P=p(v,g,u);return A>e(m,h.relativeLuminance(P>>8))?w:P}return w}let x=p(v,g,u),C=e(m,h.relativeLuminance(x>>8));if(C<u){let w=l(v,g,u);return C>e(m,h.relativeLuminance(w>>8))?x:w}return x}},r.reduceLuminance=l,r.increaseLuminance=p,r.toChannels=function(v){return[v>>24&255,v>>16&255,v>>8&255,255&v]}})(i||(s.rgba=i={})),s.toPaddedHex=t,s.contrastRatio=e},8969:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let c=o(844),f=o(2585),a=o(4348),n=o(7866),d=o(744),_=o(7302),h=o(6975),i=o(8460),t=o(1753),e=o(1480),r=o(7994),l=o(9282),p=o(5435),v=o(5981),g=o(2660),u=!1;class m extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((x=>{this._onScrollApi?.fire(x.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(x){for(let C in x)this.optionsService.options[C]=x[C]}constructor(x){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new _.OptionsService(x)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(n.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(h.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(t.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new p.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.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((C=>{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((C=>{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 v.WriteBuffer(((C,w)=>this._inputHandler.parse(C,w)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,C){this._writeBuffer.write(x,C)}writeSync(x,C){this._logService.logLevel<=f.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(x,C)}input(x,C=!0){this.coreService.triggerDataEvent(x,C)}resize(x,C){isNaN(x)||isNaN(C)||(x=Math.max(x,d.MINIMUM_COLS),C=Math.max(C,d.MINIMUM_ROWS),this._bufferService.resize(x,C))}scroll(x,C=!1){this._bufferService.scroll(x,C)}scrollLines(x,C,w){this._bufferService.scrollLines(x,C,w)}scrollPages(x){this.scrollLines(x*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(x){let C=x-this._bufferService.buffer.ydisp;C!==0&&this.scrollLines(C)}registerEscHandler(x,C){return this._inputHandler.registerEscHandler(x,C)}registerDcsHandler(x,C){return this._inputHandler.registerDcsHandler(x,C)}registerCsiHandler(x,C){return this._inputHandler.registerCsiHandler(x,C)}registerOscHandler(x,C){return this._inputHandler.registerOscHandler(x,C)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1,C=this.optionsService.rawOptions.windowsPty;C&&C.buildNumber!==void 0&&C.buildNumber!==void 0?x=C.backend==="conpty"&&C.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let x=[];x.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},(()=>((0,l.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(let C of x)C.dispose()}))}}}s.CoreTerminal=m},8460:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o((f=>c.fire(f)))},s.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},5435:function(D,s,o){var c=this&&this.__decorate||function($,b,E,k){var L,H=arguments.length,K=H<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,E):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate($,b,E,k);else for(var X=$.length-1;X>=0;X--)(L=$[X])&&(K=(H<3?L(K):H>3?L(b,E,K):L(b,E))||K);return H>3&&K&&Object.defineProperty(b,E,K),K},f=this&&this.__param||function($,b){return function(E,k){b(E,k,$)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let a=o(2584),n=o(7116),d=o(2015),_=o(844),h=o(482),i=o(8437),t=o(8460),e=o(643),r=o(511),l=o(3734),p=o(2585),v=o(1480),g=o(6242),u=o(6351),m=o(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function C($,b){if($>24)return b.setWinLines||!1;switch($){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 w;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(s.WindowsOptionsReportType=w={}));let A=0;class P extends _.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,k,L,H,K,X,Z,T=new d.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=k,this._logService=L,this._optionsService=H,this._oscLinkService=K,this._coreMouseService=X,this._unicodeService=Z,this._parser=T,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new h.StringToUtf32,this._utf8Decoder=new h.Utf8ToUtf32,this._workCell=new r.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new t.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new t.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new t.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new t.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new t.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new t.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new t.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new t.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new t.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new t.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new t.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new t.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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((S=>this._activeBuffer=S.activeBuffer))),this._parser.setCsiHandlerFallback(((S,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(S),params:z.toArray()})})),this._parser.setEscHandlerFallback((S=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(S)})})),this._parser.setExecuteHandlerFallback((S=>{this._logService.debug("Unknown EXECUTE code: ",{code:S})})),this._parser.setOscHandlerFallback(((S,z,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:S,action:z,data:N})})),this._parser.setDcsHandlerFallback(((S,z,N)=>{z==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(S),action:z,payload:N})})),this._parser.setPrintHandler(((S,z,N)=>this.print(S,z,N))),this._parser.registerCsiHandler({final:"@"},(S=>this.insertChars(S))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(S=>this.scrollLeft(S))),this._parser.registerCsiHandler({final:"A"},(S=>this.cursorUp(S))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(S=>this.scrollRight(S))),this._parser.registerCsiHandler({final:"B"},(S=>this.cursorDown(S))),this._parser.registerCsiHandler({final:"C"},(S=>this.cursorForward(S))),this._parser.registerCsiHandler({final:"D"},(S=>this.cursorBackward(S))),this._parser.registerCsiHandler({final:"E"},(S=>this.cursorNextLine(S))),this._parser.registerCsiHandler({final:"F"},(S=>this.cursorPrecedingLine(S))),this._parser.registerCsiHandler({final:"G"},(S=>this.cursorCharAbsolute(S))),this._parser.registerCsiHandler({final:"H"},(S=>this.cursorPosition(S))),this._parser.registerCsiHandler({final:"I"},(S=>this.cursorForwardTab(S))),this._parser.registerCsiHandler({final:"J"},(S=>this.eraseInDisplay(S,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(S=>this.eraseInDisplay(S,!0))),this._parser.registerCsiHandler({final:"K"},(S=>this.eraseInLine(S,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(S=>this.eraseInLine(S,!0))),this._parser.registerCsiHandler({final:"L"},(S=>this.insertLines(S))),this._parser.registerCsiHandler({final:"M"},(S=>this.deleteLines(S))),this._parser.registerCsiHandler({final:"P"},(S=>this.deleteChars(S))),this._parser.registerCsiHandler({final:"S"},(S=>this.scrollUp(S))),this._parser.registerCsiHandler({final:"T"},(S=>this.scrollDown(S))),this._parser.registerCsiHandler({final:"X"},(S=>this.eraseChars(S))),this._parser.registerCsiHandler({final:"Z"},(S=>this.cursorBackwardTab(S))),this._parser.registerCsiHandler({final:"`"},(S=>this.charPosAbsolute(S))),this._parser.registerCsiHandler({final:"a"},(S=>this.hPositionRelative(S))),this._parser.registerCsiHandler({final:"b"},(S=>this.repeatPrecedingCharacter(S))),this._parser.registerCsiHandler({final:"c"},(S=>this.sendDeviceAttributesPrimary(S))),this._parser.registerCsiHandler({prefix:">",final:"c"},(S=>this.sendDeviceAttributesSecondary(S))),this._parser.registerCsiHandler({final:"d"},(S=>this.linePosAbsolute(S))),this._parser.registerCsiHandler({final:"e"},(S=>this.vPositionRelative(S))),this._parser.registerCsiHandler({final:"f"},(S=>this.hVPosition(S))),this._parser.registerCsiHandler({final:"g"},(S=>this.tabClear(S))),this._parser.registerCsiHandler({final:"h"},(S=>this.setMode(S))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(S=>this.setModePrivate(S))),this._parser.registerCsiHandler({final:"l"},(S=>this.resetMode(S))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(S=>this.resetModePrivate(S))),this._parser.registerCsiHandler({final:"m"},(S=>this.charAttributes(S))),this._parser.registerCsiHandler({final:"n"},(S=>this.deviceStatus(S))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(S=>this.deviceStatusPrivate(S))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(S=>this.softReset(S))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(S=>this.setCursorStyle(S))),this._parser.registerCsiHandler({final:"r"},(S=>this.setScrollRegion(S))),this._parser.registerCsiHandler({final:"s"},(S=>this.saveCursor(S))),this._parser.registerCsiHandler({final:"t"},(S=>this.windowOptions(S))),this._parser.registerCsiHandler({final:"u"},(S=>this.restoreCursor(S))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(S=>this.insertColumns(S))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(S=>this.deleteColumns(S))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(S=>this.selectProtected(S))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(S=>this.requestMode(S,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(S=>this.requestMode(S,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((S=>(this.setTitle(S),this.setIconName(S),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((S=>this.setIconName(S)))),this._parser.registerOscHandler(2,new g.OscHandler((S=>this.setTitle(S)))),this._parser.registerOscHandler(4,new g.OscHandler((S=>this.setOrReportIndexedColor(S)))),this._parser.registerOscHandler(8,new g.OscHandler((S=>this.setHyperlink(S)))),this._parser.registerOscHandler(10,new g.OscHandler((S=>this.setOrReportFgColor(S)))),this._parser.registerOscHandler(11,new g.OscHandler((S=>this.setOrReportBgColor(S)))),this._parser.registerOscHandler(12,new g.OscHandler((S=>this.setOrReportCursorColor(S)))),this._parser.registerOscHandler(104,new g.OscHandler((S=>this.restoreIndexedColor(S)))),this._parser.registerOscHandler(110,new g.OscHandler((S=>this.restoreFgColor(S)))),this._parser.registerOscHandler(111,new g.OscHandler((S=>this.restoreBgColor(S)))),this._parser.registerOscHandler(112,new g.OscHandler((S=>this.restoreCursorColor(S)))),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 S in n.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:S},(()=>this.selectCharset("("+S))),this._parser.registerEscHandler({intermediates:")",final:S},(()=>this.selectCharset(")"+S))),this._parser.registerEscHandler({intermediates:"*",final:S},(()=>this.selectCharset("*"+S))),this._parser.registerEscHandler({intermediates:"+",final:S},(()=>this.selectCharset("+"+S))),this._parser.registerEscHandler({intermediates:"-",final:S},(()=>this.selectCharset("-"+S))),this._parser.registerEscHandler({intermediates:".",final:S},(()=>this.selectCharset("."+S))),this._parser.registerEscHandler({intermediates:"/",final:S},(()=>this.selectCharset("/"+S)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((S=>(this._logService.error("Parsing error: ",S),S))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler(((S,z)=>this.requestStatusString(S,z))))}_preserveStack(b,E,k,L){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=k,this._parseStack.position=L}_logSlowResolvingAsync(b){this._logService.logLevel<=p.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,E){let k,L=this._activeBuffer.x,H=this._activeBuffer.y,K=0,X=this._parseStack.paused;if(X){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(k),k;L=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>x&&(K=this._parseStack.position+x)}if(this._logService.logLevel<=p.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(S=>String.fromCharCode(S))).join("")}"`),typeof b=="string"?b.split("").map((S=>S.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(b.length,x))),X||this._dirtyRowTracker.clearRange(),b.length>x)for(let S=K;S<b.length;S+=x){let z=S+x<b.length?S+x:b.length,N=typeof b=="string"?this._stringDecoder.decode(b.substring(S,z),this._parseBuffer):this._utf8Decoder.decode(b.subarray(S,z),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,N))return this._preserveStack(L,H,N,S),this._logSlowResolvingAsync(k),k}else if(!X){let S=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,S))return this._preserveStack(L,H,S,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===L&&this._activeBuffer.y===H||this._onCursorMove.fire();let Z=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(Z,this._bufferService.rows-1))}print(b,E,k){let L,H,K=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,T=this._coreService.decPrivateModes.wraparound,S=this._coreService.modes.insertMode,z=this._curAttrData,N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-E>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let V=this._parser.precedingJoinState;for(let j=E;j<k;++j){if(L=b[j],L<127&&K){let fe=K[String.fromCharCode(L)];fe&&(L=fe.charCodeAt(0))}let te=this._unicodeService.charProperties(L,V);H=v.UnicodeService.extractWidth(te);let ne=v.UnicodeService.extractShouldJoin(te),oe=ne?v.UnicodeService.extractWidth(V):0;if(V=te,X&&this._onA11yChar.fire((0,h.stringFromCodePoint)(L)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+H-oe>Z){if(T){let fe=N,J=this._activeBuffer.x-oe;for(this._activeBuffer.x=oe,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),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),oe>0&&N instanceof i.BufferLine&&N.copyCellsFrom(fe,J,0,oe,!1);J<Z;)fe.setCellFromCodepoint(J++,0,1,z)}else if(this._activeBuffer.x=Z-1,H===2)continue}if(ne&&this._activeBuffer.x){let fe=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-fe,L,H);for(let J=H-oe;--J>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(S&&(N.insertCells(this._activeBuffer.x,H-oe,this._activeBuffer.getNullCell(z)),N.getWidth(Z-1)===2&&N.setCellFromCodepoint(Z-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,z)),N.setCellFromCodepoint(this._activeBuffer.x++,L,H,z),H>0)for(;--H;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=V,this._activeBuffer.x<Z&&k-E>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,E){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,E):this._parser.registerCsiHandler(b,(k=>!C(k.params[0],this._optionsService.rawOptions.windowOptions)||E(k)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new u.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,new g.OscHandler(E))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=b,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+E)}cursorUp(b){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let E=b.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let E=b.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,E,k,L=!1,H=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,k,this._activeBuffer.getNullCell(this._eraseAttrData()),H),L&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),k.isWrapped=!1)}eraseInDisplay(b,E=!1){let k;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);k<this._bufferService.rows;k++)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(0);break;case 3:let L=this._activeBuffer.lines.length-this._bufferService.rows;L>0&&(this._activeBuffer.lines.trimStart(L),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-L,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-L,0),this._onScroll.fire(0))}return!0}eraseInLine(b,E=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-L+1;for(;E--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,L;for(L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,L=this._bufferService.rows-1+this._activeBuffer.ybase-L;E--;)this._activeBuffer.lines.splice(k,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}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(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let E=this._parser.precedingJoinState;if(!E)return!0;let k=b.params[0]||1,L=v.UnicodeService.extractWidth(E),H=this._activeBuffer.x-L,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(H),X=new Uint32Array(K.length*k),Z=0;for(let S=0;S<K.length;){let z=K.codePointAt(S)||0;X[Z++]=z,S+=z>65535?2:1}let T=Z;for(let S=1;S<k;++S)X.copyWithin(T,0,Z),T+=Z;return this.print(X,0,T),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(a.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(a.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(a.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(a.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(a.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,n.DEFAULT_CHARSET),this._charsetService.setgCharset(1,n.DEFAULT_CHARSET),this._charsetService.setgCharset(2,n.DEFAULT_CHARSET),this._charsetService.setgCharset(3,n.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),b.params[E]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(b,E){let k=this._coreService.decPrivateModes,{activeProtocol:L,activeEncoding:H}=this._coreMouseService,K=this._coreService,{buffers:X,cols:Z}=this._bufferService,{active:T,alt:S}=X,z=this._optionsService.rawOptions,N=ne=>ne?1:2,V=b.params[0];return j=V,te=E?V===2?4:V===4?N(K.modes.insertMode):V===12?3:V===20?N(z.convertEol):0:V===1?N(k.applicationCursorKeys):V===3?z.windowOptions.setWinLines?Z===80?2:Z===132?1:0:0:V===6?N(k.origin):V===7?N(k.wraparound):V===8?3:V===9?N(L==="X10"):V===12?N(z.cursorBlink):V===25?N(!K.isCursorHidden):V===45?N(k.reverseWraparound):V===66?N(k.applicationKeypad):V===67?4:V===1e3?N(L==="VT200"):V===1002?N(L==="DRAG"):V===1003?N(L==="ANY"):V===1004?N(k.sendFocus):V===1005?4:V===1006?N(H==="SGR"):V===1015?4:V===1016?N(H==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?N(T===S):V===2004?N(k.bracketedPasteMode):0,K.triggerDataEvent(`${a.C0.ESC}[${E?"":"?"}${j};${te}$y`),!0;var j,te}_updateAttrColor(b,E,k,L,H){return E===2?(b|=50331648,b&=-16777216,b|=l.AttributeData.fromColorRGB([k,L,H])):E===5&&(b&=-50331904,b|=33554432|255&k),b}_extractColor(b,E,k){let L=[0,0,-1,0,0,0],H=0,K=0;do{if(L[K+H]=b.params[E+K],b.hasSubParams(E+K)){let X=b.getSubParams(E+K),Z=0;do L[1]===5&&(H=1),L[K+Z+1+H]=X[Z];while(++Z<X.length&&Z+K+1+H<L.length);break}if(L[1]===5&&K+H>=2||L[1]===2&&K+H>=5)break;L[1]&&(H=1)}while(++K+E<b.length&&K+H<L.length);for(let X=2;X<L.length;++X)L[X]===-1&&(L[X]=0);switch(L[0]){case 38:k.fg=this._updateAttrColor(k.fg,L[1],L[3],L[4],L[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,L[1],L[3],L[4],L[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,L[1],L[3],L[4],L[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=i.DEFAULT_ATTR_DATA.fg,b.bg=i.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let E=b.length,k,L=this._curAttrData;for(let H=0;H<E;H++)k=b.params[H],k>=30&&k<=37?(L.fg&=-50331904,L.fg|=16777216|k-30):k>=40&&k<=47?(L.bg&=-50331904,L.bg|=16777216|k-40):k>=90&&k<=97?(L.fg&=-50331904,L.fg|=16777224|k-90):k>=100&&k<=107?(L.bg&=-50331904,L.bg|=16777224|k-100):k===0?this._processSGR0(L):k===1?L.fg|=134217728:k===3?L.bg|=67108864:k===4?(L.fg|=268435456,this._processUnderline(b.hasSubParams(H)?b.getSubParams(H)[0]:1,L)):k===5?L.fg|=536870912:k===7?L.fg|=67108864:k===8?L.fg|=1073741824:k===9?L.fg|=2147483648:k===2?L.bg|=134217728:k===21?this._processUnderline(2,L):k===22?(L.fg&=-134217729,L.bg&=-134217729):k===23?L.bg&=-67108865:k===24?(L.fg&=-268435457,this._processUnderline(0,L)):k===25?L.fg&=-536870913:k===27?L.fg&=-67108865:k===28?L.fg&=-1073741825:k===29?L.fg&=2147483647:k===39?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):k===49?(L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?H+=this._extractColor(b,H,L):k===53?L.bg|=1073741824:k===55?L.bg&=-1073741825:k===59?(L.extended=L.extended.clone(),L.extended.underlineColor=-1,L.updateExtended()):k===100?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${E};${k}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${E};${k}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(b){let E=b.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let k=E%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(b){let E=b.params[0]||1,k;return(b.length<2||(k=b.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(b){if(!C(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(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let E=[],k=b.split(";");for(;k.length>1;){let L=k.shift(),H=k.shift();if(/^\d+$/.exec(L)){let K=parseInt(L);if(q(K))if(H==="?")E.push({type:0,index:K});else{let X=(0,m.parseColor)(H);X&&E.push({type:1,index:K,color:X})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(b){let E=b.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(b,E){this._getCurrentLinkId()&&this._finishHyperlink();let k=b.split(":"),L,H=k.findIndex((K=>K.startsWith("id=")));return H!==-1&&(L=k[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:L,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,E){let k=b.split(";");for(let L=0;L<k.length&&!(E>=this._specialColors.length);++L,++E)if(k[L]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let H=(0,m.parseColor)(k[L]);H&&this._onColor.fire([{type:1,index:this._specialColors[E],color:H}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let E=[],k=b.split(";");for(let L=0;L<k.length;++L)if(/^\d+$/.exec(k[L])){let H=parseInt(k[L]);q(H)&&E.push({type:2,index:H})}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,n.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(y[b[0]],n.CHARSETS[b[1]]||n.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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.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 r.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){let k=this._activeBuffer.ybase+this._activeBuffer.y+E,L=this._activeBuffer.lines.get(k);L&&(L.fill(b),L.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let k=this._bufferService.buffer,L=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${H}${a.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[L.cursorStyle]-(L.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}s.InputHandler=P;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,b){$>b&&(A=$,$=b,b=A),$<this.start&&(this.start=$),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function q($){return 0<=$&&$<256}U=c([f(0,p.IBufferService)],U)},844:(D,s)=>{function o(c){for(let f of c)f.dispose();c.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 c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let f=this._disposables.indexOf(c);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(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,a,n){this._data[f]||(this._data[f]={}),this._data[f][a]=n}get(f,a){return this._data[f]?this._data[f][a]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(c,f,a,n,d){this._data.get(c,f)||this._data.set(c,f,new o),this._data.get(c,f).set(a,n,d)}get(c,f,a,n){return this._data.get(c,f)?.get(a,n)}clear(){this._data.clear()}}},6114:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;let o=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;let f=o.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),s.isIpad=c==="iPad",s.isIphone=c==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),s.isLinux=c.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},6106:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;let f=this._getKey(c);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,f){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do f(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let f=0,a=this._array.length-1;for(;a>=f;){let n=f+a>>1,d=this._getKey(this._array[n]);if(d>c)a=n-1;else{if(!(d<c)){for(;n>0&&this._getKey(this._array[n-1])===c;)n--;return n}f=n+1}}return f}}},7226:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let c=o(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),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(d){this._idleCallback=void 0;let _=0,h=0,i=d.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(_=Date.now(),this._tasks[this._i]()||this._i++,_=Math.max(1,Date.now()-_),h=Math.max(_,h),t=d.timeRemaining(),1.5*h>t)return i-_<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-_))}ms`),void this._start();i=t}this.clear()}}class a extends f{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){let _=Date.now()+d;return{timeRemaining:()=>Math.max(0,_-Date.now())}}}s.PriorityTaskQueue=a,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(n){return requestIdleCallback(n)}_cancelCallback(n){cancelIdleCallback(n)}}:a,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(n){this._queue.clear(),this._queue.enqueue(n)}flush(){this._queue.flush()}}},9282:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let c=o(643);s.updateWindowsModeWrappedState=function(f){let a=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),n=a?.get(f.cols-1),d=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);d&&n&&(d.isWrapped=n[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&n[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){let a=new o;return a.fg=this.fg,a.bg=this.bg,a.extended=this.extended.clone(),a}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}s.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(a){this._ext&=-469762049,this._ext|=a<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(a){this._ext&=-67108864,this._ext|=67108863&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}get underlineVariantOffset(){let a=(3758096384&this._ext)>>29;return a<0?4294967288^a:a}set underlineVariantOffset(a){this._ext&=536870911,this._ext|=a<<29&3758096384}constructor(a=0,n=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=n}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},9092:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let c=o(6349),f=o(7226),a=o(3734),n=o(8437),d=o(4634),_=o(511),h=o(643),i=o(4863),t=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(e,r,l){this._hasScrollback=e,this._optionsService=r,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=_.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.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 c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,r){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let r=e+this._optionsService.rawOptions.scrollback;return r>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:r}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=n.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,r){let l=this.getNullCell(n.DEFAULT_ATTR_DATA),p=0,v=this._getCorrectBufferLength(r);if(v>this.lines.maxLength&&(this.lines.maxLength=v),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)p+=+this.lines.get(u).resize(e,l);let g=0;if(this._rows<r)for(let u=this._rows;u<r;u++)this.lines.length<r+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new n.BufferLine(e,l)):this.ybase>0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,l)));else for(let u=this._rows;u>r;u--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(v<this.lines.maxLength){let u=this.lines.length-v;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=v}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,r-1),g&&(this.y+=g),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(e,r),this._cols>e))for(let g=0;g<this.lines.length;g++)p+=+this.lines.get(g).resize(e,l);this._cols=e,this._rows=r,this._memoryCleanupQueue.clear(),p>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,r){this._cols!==e&&(e>this._cols?this._reflowLarger(e,r):this._reflowSmaller(e,r))}_reflowLarger(e,r){let l=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(l.length>0){let p=(0,d.reflowLargerCreateNewLayout)(this.lines,l);(0,d.reflowLargerApplyNewLayout)(this.lines,p.layout),this._reflowLargerAdjustViewport(e,r,p.countRemoved)}}_reflowLargerAdjustViewport(e,r,l){let p=this.getNullCell(n.DEFAULT_ATTR_DATA),v=l;for(;v-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new n.BufferLine(e,p))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-l,0)}_reflowSmaller(e,r){let l=this.getNullCell(n.DEFAULT_ATTR_DATA),p=[],v=0;for(let g=this.lines.length-1;g>=0;g--){let u=this.lines.get(g);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let m=[u];for(;u.isWrapped&&g>0;)u=this.lines.get(--g),m.unshift(u);let y=this.ybase+this.y;if(y>=g&&y<g+m.length)continue;let x=m[m.length-1].getTrimmedLength(),C=(0,d.reflowSmallerGetNewLineLengths)(m,this._cols,e),w=C.length-m.length,A;A=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+w):Math.max(0,this.lines.length-this.lines.maxLength+w);let P=[];for(let k=0;k<w;k++){let L=this.getBlankLine(n.DEFAULT_ATTR_DATA,!0);P.push(L)}P.length>0&&(p.push({start:g+m.length+v,newLines:P}),v+=P.length),m.push(...P);let U=C.length-1,q=C[U];q===0&&(U--,q=C[U]);let $=m.length-w-1,b=x;for(;$>=0;){let k=Math.min(b,q);if(m[U]===void 0)break;if(m[U].copyCellsFrom(m[$],b-k,q-k,k,!0),q-=k,q===0&&(U--,q=C[U]),b-=k,b===0){$--;let L=Math.max($,0);b=(0,d.getWrappedLineTrimmedLength)(m,L,this._cols)}}for(let k=0;k<m.length;k++)C[k]<e&&m[k].setCell(C[k],l);let E=w-A;for(;E-- >0;)this.ybase===0?this.y<r-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+v)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(p.length>0){let g=[],u=[];for(let U=0;U<this.lines.length;U++)u.push(this.lines.get(U));let m=this.lines.length,y=m-1,x=0,C=p[x];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+v);let w=0;for(let U=Math.min(this.lines.maxLength-1,m+v-1);U>=0;U--)if(C&&C.start>y+w){for(let q=C.newLines.length-1;q>=0;q--)this.lines.set(U--,C.newLines[q]);U++,g.push({index:y+1,amount:C.newLines.length}),w+=C.newLines.length,C=p[++x]}else this.lines.set(U,u[y--]);let A=0;for(let U=g.length-1;U>=0;U--)g[U].index+=A,this.lines.onInsertEmitter.fire(g[U]),A+=g[U].amount;let P=Math.max(0,m+v-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(e,r,l=0,p){let v=this.lines.get(e);return v?v.translateToString(r,l,p):""}getWrappedRangeForLine(e){let r=e,l=e;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;l+1<this.lines.length&&this.lines.get(l+1).isWrapped;)l++;return{first:r,last:l}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===e&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let r=new i.Marker(e);return this.markers.push(r),r.register(this.lines.onTrim((l=>{r.line-=l,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((l=>{r.line>=l.index&&(r.line+=l.amount)}))),r.register(this.lines.onDelete((l=>{r.line>=l.index&&r.line<l.index+l.amount&&r.dispose(),r.line>l.index&&(r.line-=l.amount)}))),r.register(r.onDispose((()=>this._removeMarker(r)))),r}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let c=o(3734),f=o(511),a=o(643),n=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let d=0;class _{constructor(i,t,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let r=t||f.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let l=0;l<i;++l)this.setCell(l,r);this.length=i}get(i){let t=this._data[3*i+0],e=2097151&t;return[this._data[3*i+1],2097152&t?this._combined[i]:e?(0,n.stringFromCodePoint)(e):"",t>>22,2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,t){this._data[3*i+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=t[1],this._data[3*i+0]=2097152|i|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&t}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i]:2097151&t?(0,n.stringFromCodePoint)(2097151&t):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,t){return d=3*i,t.content=this._data[d+0],t.fg=this._data[d+1],t.bg=this._data[d+2],2097152&t.content&&(t.combinedData=this._combined[i]),268435456&t.bg&&(t.extended=this._extendedAttrs[i]),t}setCell(i,t){2097152&t.content&&(this._combined[i]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=t.content,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}setCellFromCodepoint(i,t,e,r){268435456&r.bg&&(this._extendedAttrs[i]=r.extended),this._data[3*i+0]=t|e<<22,this._data[3*i+1]=r.fg,this._data[3*i+2]=r.bg}addCodepointToCell(i,t,e){let r=this._data[3*i+0];2097152&r?this._combined[i]+=(0,n.stringFromCodePoint)(t):2097151&r?(this._combined[i]=(0,n.stringFromCodePoint)(2097151&r)+(0,n.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|4194304,e&&(r&=-12582913,r|=e<<22),this._data[3*i+0]=r}insertCells(i,t,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length-i){let r=new f.CellData;for(let l=this.length-i-t-1;l>=0;--l)this.setCell(i+t+l,this.loadCell(i+l,r));for(let l=0;l<t;++l)this.setCell(i+l,e)}else for(let r=i;r<this.length;++r)this.setCell(r,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,t,e){if(i%=this.length,t<this.length-i){let r=new f.CellData;for(let l=0;l<this.length-i-t;++l)this.setCell(i+l,this.loadCell(i+t+l,r));for(let l=this.length-t;l<this.length;++l)this.setCell(l,e)}else for(let r=i;r<this.length;++r)this.setCell(r,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,t,e,r=!1){if(r)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.setCell(i++,e)}resize(i,t){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let r=new Uint32Array(e);r.set(this._data),this._data=r}for(let r=this.length;r<i;++r)this.setCell(r,t)}else{this._data=this._data.subarray(0,e);let r=Object.keys(this._combined);for(let p=0;p<r.length;p++){let v=parseInt(r[p],10);v>=i&&delete this._combined[v]}let l=Object.keys(this._extendedAttrs);for(let p=0;p<l.length;p++){let v=parseInt(l[p],10);v>=i&&delete this._extendedAttrs[v]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,t=!1){if(t)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let t in i._combined)this._combined[t]=i._combined[t];this._extendedAttrs={};for(let t in i._extendedAttrs)this._extendedAttrs[t]=i._extendedAttrs[t];this.isWrapped=i.isWrapped}clone(){let i=new _(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let t in this._combined)i._combined[t]=this._combined[t];for(let t in this._extendedAttrs)i._extendedAttrs[t]=this._extendedAttrs[t];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,t,e,r,l){let p=i._data;if(l)for(let g=r-1;g>=0;g--){for(let u=0;u<3;u++)this._data[3*(e+g)+u]=p[3*(t+g)+u];268435456&p[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}else for(let g=0;g<r;g++){for(let u=0;u<3;u++)this._data[3*(e+g)+u]=p[3*(t+g)+u];268435456&p[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}let v=Object.keys(i._combined);for(let g=0;g<v.length;g++){let u=parseInt(v[g],10);u>=t&&(this._combined[u-t+e]=i._combined[u])}}translateToString(i,t,e,r){t=t??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),r&&(r.length=0);let l="";for(;t<e;){let p=this._data[3*t+0],v=2097151&p,g=2097152&p?this._combined[t]:v?(0,n.stringFromCodePoint)(v):a.WHITESPACE_CELL_CHAR;if(l+=g,r)for(let u=0;u<g.length;++u)r.push(t);t+=p>>22||1}return r&&r.push(t),l}}s.BufferLine=_},4841:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(D,s)=>{function o(c,f,a){if(f===c.length-1)return c[f].getTrimmedLength();let n=!c[f].hasContent(a-1)&&c[f].getWidth(a-1)===1,d=c[f+1].getWidth(0)===2;return n&&d?a-1:a}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(c,f,a,n,d){let _=[];for(let h=0;h<c.length-1;h++){let i=h,t=c.get(++i);if(!t.isWrapped)continue;let e=[c.get(h)];for(;i<c.length&&t.isWrapped;)e.push(t),t=c.get(++i);if(n>=h&&n<i){h+=e.length-1;continue}let r=0,l=o(e,r,f),p=1,v=0;for(;p<e.length;){let u=o(e,p,f),m=u-v,y=a-l,x=Math.min(m,y);e[r].copyCellsFrom(e[p],v,l,x,!1),l+=x,l===a&&(r++,l=0),v+=x,v===u&&(p++,v=0),l===0&&r!==0&&e[r-1].getWidth(a-1)===2&&(e[r].copyCellsFrom(e[r-1],a-1,l++,1,!1),e[r-1].setCell(a-1,d))}e[r].replaceCells(l,a,d);let g=0;for(let u=e.length-1;u>0&&(u>r||e[u].getTrimmedLength()===0);u--)g++;g>0&&(_.push(h+e.length-g),_.push(g)),h+=e.length-1}return _},s.reflowLargerCreateNewLayout=function(c,f){let a=[],n=0,d=f[n],_=0;for(let h=0;h<c.length;h++)if(d===h){let i=f[++n];c.onDeleteEmitter.fire({index:h-_,amount:i}),h+=i-1,_+=i,d=f[++n]}else a.push(h);return{layout:a,countRemoved:_}},s.reflowLargerApplyNewLayout=function(c,f){let a=[];for(let n=0;n<f.length;n++)a.push(c.get(f[n]));for(let n=0;n<a.length;n++)c.set(n,a[n]);c.length=f.length},s.reflowSmallerGetNewLineLengths=function(c,f,a){let n=[],d=c.map(((t,e)=>o(c,e,f))).reduce(((t,e)=>t+e)),_=0,h=0,i=0;for(;i<d;){if(d-i<a){n.push(d-i);break}_+=a;let t=o(c,h,f);_>t&&(_-=t,h++);let e=c[h].getWidth(_-1)===2;e&&_--;let r=e?a-1:a;n.push(r),i+=r}return n},s.getWrappedLineTrimmedLength=o},5295:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let c=o(8460),f=o(844),a=o(9092);class n extends f.Disposable{constructor(_,h){super(),this._optionsService=_,this._bufferService=h,this._onBufferActivate=this.register(new c.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 a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.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(_){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(_),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(_,h){this._normal.resize(_,h),this._alt.resize(_,h),this.setupTabStops(_)}setupTabStops(_){this._normal.setupTabStops(_),this._alt.setupTabStops(_)}}s.BufferSet=n},511:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let c=o(482),f=o(643),a=o(3734);class n extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=""}static fromCharData(_){let h=new n;return h.setFromCharData(_),h}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(_){this.fg=_[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let h=!1;if(_[f.CHAR_DATA_CHAR_INDEX].length>2)h=!0;else if(_[f.CHAR_DATA_CHAR_INDEX].length===2){let i=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let t=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(i-55296)+t-56320+65536|_[f.CHAR_DATA_WIDTH_INDEX]<<22:h=!0}else h=!0}else this.content=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[f.CHAR_DATA_WIDTH_INDEX]<<22;h&&(this.combinedData=_[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|_[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=n},643:(D,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:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let c=o(8460),f=o(844);class a{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new c.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(d){return this._disposables.push(d),d}}s.Marker=a,a._nextId=1},7116:(D,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:(D,s)=>{var o,c,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(a){a.NUL="\0",a.SOH="",a.STX="",a.ETX="",a.EOT="",a.ENQ="",a.ACK="",a.BEL="\x07",a.BS="\b",a.HT=" ",a.LF=`
|
|
9
|
-
`,a.VT="\v",a.FF="\f",a.CR="\r",a.SO="",a.SI="",a.DLE="",a.DC1="",a.DC2="",a.DC3="",a.DC4="",a.NAK="",a.SYN="",a.ETB="",a.CAN="",a.EM="",a.SUB="",a.ESC="\x1B",a.FS="",a.GS="",a.RS="",a.US="",a.SP=" ",a.DEL="\x7F"})(o||(s.C0=o={})),(function(a){a.PAD="\x80",a.HOP="\x81",a.BPH="\x82",a.NBH="\x83",a.IND="\x84",a.NEL="\x85",a.SSA="\x86",a.ESA="\x87",a.HTS="\x88",a.HTJ="\x89",a.VTS="\x8A",a.PLD="\x8B",a.PLU="\x8C",a.RI="\x8D",a.SS2="\x8E",a.SS3="\x8F",a.DCS="\x90",a.PU1="\x91",a.PU2="\x92",a.STS="\x93",a.CCH="\x94",a.MW="\x95",a.SPA="\x96",a.EPA="\x97",a.SOS="\x98",a.SGCI="\x99",a.SCI="\x9A",a.CSI="\x9B",a.ST="\x9C",a.OSC="\x9D",a.PM="\x9E",a.APC="\x9F"})(c||(s.C1=c={})),(function(a){a.ST=`${o.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let c=o(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(a,n,d,_){let h={type:0,cancel:!1,key:void 0},i=(a.shiftKey?1:0)|(a.altKey?2:0)|(a.ctrlKey?4:0)|(a.metaKey?8:0);switch(a.keyCode){case 0:a.key==="UIKeyInputUpArrow"?h.key=n?c.C0.ESC+"OA":c.C0.ESC+"[A":a.key==="UIKeyInputLeftArrow"?h.key=n?c.C0.ESC+"OD":c.C0.ESC+"[D":a.key==="UIKeyInputRightArrow"?h.key=n?c.C0.ESC+"OC":c.C0.ESC+"[C":a.key==="UIKeyInputDownArrow"&&(h.key=n?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:h.key=a.ctrlKey?"\b":c.C0.DEL,a.altKey&&(h.key=c.C0.ESC+h.key);break;case 9:if(a.shiftKey){h.key=c.C0.ESC+"[Z";break}h.key=c.C0.HT,h.cancel=!0;break;case 13:h.key=a.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,h.cancel=!0;break;case 27:h.key=c.C0.ESC,a.altKey&&(h.key=c.C0.ESC+c.C0.ESC),h.cancel=!0;break;case 37:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"D",h.key===c.C0.ESC+"[1;3D"&&(h.key=c.C0.ESC+(d?"b":"[1;5D"))):h.key=n?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"C",h.key===c.C0.ESC+"[1;3C"&&(h.key=c.C0.ESC+(d?"f":"[1;5C"))):h.key=n?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"A",d||h.key!==c.C0.ESC+"[1;3A"||(h.key=c.C0.ESC+"[1;5A")):h.key=n?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"B",d||h.key!==c.C0.ESC+"[1;3B"||(h.key=c.C0.ESC+"[1;5B")):h.key=n?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:a.shiftKey||a.ctrlKey||(h.key=c.C0.ESC+"[2~");break;case 46:h.key=i?c.C0.ESC+"[3;"+(i+1)+"~":c.C0.ESC+"[3~";break;case 36:h.key=i?c.C0.ESC+"[1;"+(i+1)+"H":n?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:h.key=i?c.C0.ESC+"[1;"+(i+1)+"F":n?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:a.shiftKey?h.type=2:a.ctrlKey?h.key=c.C0.ESC+"[5;"+(i+1)+"~":h.key=c.C0.ESC+"[5~";break;case 34:a.shiftKey?h.type=3:a.ctrlKey?h.key=c.C0.ESC+"[6;"+(i+1)+"~":h.key=c.C0.ESC+"[6~";break;case 112:h.key=i?c.C0.ESC+"[1;"+(i+1)+"P":c.C0.ESC+"OP";break;case 113:h.key=i?c.C0.ESC+"[1;"+(i+1)+"Q":c.C0.ESC+"OQ";break;case 114:h.key=i?c.C0.ESC+"[1;"+(i+1)+"R":c.C0.ESC+"OR";break;case 115:h.key=i?c.C0.ESC+"[1;"+(i+1)+"S":c.C0.ESC+"OS";break;case 116:h.key=i?c.C0.ESC+"[15;"+(i+1)+"~":c.C0.ESC+"[15~";break;case 117:h.key=i?c.C0.ESC+"[17;"+(i+1)+"~":c.C0.ESC+"[17~";break;case 118:h.key=i?c.C0.ESC+"[18;"+(i+1)+"~":c.C0.ESC+"[18~";break;case 119:h.key=i?c.C0.ESC+"[19;"+(i+1)+"~":c.C0.ESC+"[19~";break;case 120:h.key=i?c.C0.ESC+"[20;"+(i+1)+"~":c.C0.ESC+"[20~";break;case 121:h.key=i?c.C0.ESC+"[21;"+(i+1)+"~":c.C0.ESC+"[21~";break;case 122:h.key=i?c.C0.ESC+"[23;"+(i+1)+"~":c.C0.ESC+"[23~";break;case 123:h.key=i?c.C0.ESC+"[24;"+(i+1)+"~":c.C0.ESC+"[24~";break;default:if(!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)if(d&&!_||!a.altKey||a.metaKey)!d||a.altKey||a.ctrlKey||a.shiftKey||!a.metaKey?a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&a.keyCode>=48&&a.key.length===1?h.key=a.key:a.key&&a.ctrlKey&&(a.key==="_"&&(h.key=c.C0.US),a.key==="@"&&(h.key=c.C0.NUL)):a.keyCode===65&&(h.type=1);else{let t=f[a.keyCode],e=t?.[a.shiftKey?1:0];if(e)h.key=c.C0.ESC+e;else if(a.keyCode>=65&&a.keyCode<=90){let r=a.ctrlKey?a.keyCode-64:a.keyCode+32,l=String.fromCharCode(r);a.shiftKey&&(l=l.toUpperCase()),h.key=c.C0.ESC+l}else if(a.keyCode===32)h.key=c.C0.ESC+(a.ctrlKey?c.C0.NUL:" ");else if(a.key==="Dead"&&a.code.startsWith("Key")){let r=a.code.slice(3,4);a.shiftKey||(r=r.toLowerCase()),h.key=c.C0.ESC+r,h.cancel=!0}}else a.keyCode>=65&&a.keyCode<=90?h.key=String.fromCharCode(a.keyCode-64):a.keyCode===32?h.key=c.C0.NUL:a.keyCode>=51&&a.keyCode<=55?h.key=String.fromCharCode(a.keyCode-51+27):a.keyCode===56?h.key=c.C0.DEL:a.keyCode===219?h.key=c.C0.ESC:a.keyCode===220?h.key=c.C0.FS:a.keyCode===221&&(h.key=c.C0.GS)}return h}},482:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,c=0,f=o.length){let a="";for(let n=c;n<f;++n){let d=o[n];d>65535?(d-=65536,a+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):a+=String.fromCharCode(d)}return a},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){let f=o.length;if(!f)return 0;let a=0,n=0;if(this._interim){let d=o.charCodeAt(n++);56320<=d&&d<=57343?c[a++]=1024*(this._interim-55296)+d-56320+65536:(c[a++]=this._interim,c[a++]=d),this._interim=0}for(let d=n;d<f;++d){let _=o.charCodeAt(d);if(55296<=_&&_<=56319){if(++d>=f)return this._interim=_,a;let h=o.charCodeAt(d);56320<=h&&h<=57343?c[a++]=1024*(_-55296)+h-56320+65536:(c[a++]=_,c[a++]=h)}else _!==65279&&(c[a++]=_)}return a}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){let f=o.length;if(!f)return 0;let a,n,d,_,h=0,i=0,t=0;if(this.interim[0]){let l=!1,p=this.interim[0];p&=(224&p)==192?31:(240&p)==224?15:7;let v,g=0;for(;(v=63&this.interim[++g])&&g<4;)p<<=6,p|=v;let u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=u-g;for(;t<m;){if(t>=f)return 0;if(v=o[t++],(192&v)!=128){t--,l=!0;break}this.interim[g++]=v,p<<=6,p|=63&v}l||(u===2?p<128?t--:c[h++]=p:u===3?p<2048||p>=55296&&p<=57343||p===65279||(c[h++]=p):p<65536||p>1114111||(c[h++]=p)),this.interim.fill(0)}let e=f-4,r=t;for(;r<f;){for(;!(!(r<e)||128&(a=o[r])||128&(n=o[r+1])||128&(d=o[r+2])||128&(_=o[r+3]));)c[h++]=a,c[h++]=n,c[h++]=d,c[h++]=_,r+=4;if(a=o[r++],a<128)c[h++]=a;else if((224&a)==192){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(i=(31&a)<<6|63&n,i<128){r--;continue}c[h++]=i}else if((240&a)==224){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,h;if(d=o[r++],(192&d)!=128){r--;continue}if(i=(15&a)<<12|(63&n)<<6|63&d,i<2048||i>=55296&&i<=57343||i===65279)continue;c[h++]=i}else if((248&a)==240){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,h;if(d=o[r++],(192&d)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,this.interim[2]=d,h;if(_=o[r++],(192&_)!=128){r--;continue}if(i=(7&a)<<18|(63&n)<<12|(63&d)<<6|63&_,i<65536||i>1114111)continue;c[h++]=i}}return h}}},225:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let c=o(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]],a=[[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]],n;s.UnicodeV6=class{constructor(){if(this.version="6",!n){n=new Uint8Array(65536),n.fill(1),n[0]=0,n.fill(0,1,32),n.fill(0,127,160),n.fill(2,4352,4448),n[9001]=2,n[9002]=2,n.fill(2,11904,42192),n[12351]=1,n.fill(2,44032,55204),n.fill(2,63744,64256),n.fill(2,65040,65050),n.fill(2,65072,65136),n.fill(2,65280,65377),n.fill(2,65504,65511);for(let d=0;d<f.length;++d)n.fill(0,f[d][0],f[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?n[d]:(function(_,h){let i,t=0,e=h.length-1;if(_<h[0][0]||_>h[e][1])return!1;for(;e>=t;)if(i=t+e>>1,_>h[i][1])t=i+1;else{if(!(_<h[i][0]))return!0;e=i-1}return!1})(d,a)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,_){let h=this.wcwidth(d),i=h===0&&_!==0;if(i){let t=c.UnicodeService.extractWidth(_);t===0?i=!1:t>h&&(h=t)}return c.UnicodeService.createPropertyValue(0,h,i)}}},5981:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let c=o(8460),f=o(844);class a extends f.Disposable{constructor(d){super(),this._action=d,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(d,_){if(_!==void 0&&this._syncCalls>_)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let h;for(this._isSyncWriting=!0;h=this._writeBuffer.shift();){this._action(h);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(d,_){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+=d.length,this._writeBuffer.push(d),this._callbacks.push(_),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(_)}_innerWrite(d=0,_=!0){let h=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],t=this._action(i,_);if(t){let r=l=>Date.now()-h>=12?setTimeout((()=>this._innerWrite(0,l))):this._innerWrite(h,l);return void t.catch((l=>(queueMicrotask((()=>{throw l})),Promise.resolve(!1)))).then(r)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-h>=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=a},5941:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function f(a,n){let d=a.toString(16),_=d.length<2?"0"+d:d;switch(n){case 4:return d[0];case 8:return _;case 12:return(_+_).slice(0,3);default:return _+_}}s.parseColor=function(a){if(!a)return;let n=a.toLowerCase();if(n.indexOf("rgb:")===0){n=n.slice(4);let d=o.exec(n);if(d){let _=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/_*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/_*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/_*255)]}}else if(n.indexOf("#")===0&&(n=n.slice(1),c.exec(n)&&[3,6,9,12].includes(n.length))){let d=n.length/3,_=[0,0,0];for(let h=0;h<3;++h){let i=parseInt(n.slice(d*h,d*h+d),16);_[h]=d===1?i<<4:d===2?i:d===3?i>>4:i>>8}return _}},s.toRgbString=function(a,n=16){let[d,_,h]=a;return`rgb:${f(d,n)}/${f(_,n)}/${f(h,n)}`}},5770:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let c=o(482),f=o(8742),a=o(5770),n=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=n,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}registerHandler(_,h){this._handlers[_]===void 0&&(this._handlers[_]=[]);let i=this._handlers[_];return i.push(h),{dispose:()=>{let t=i.indexOf(h);t!==-1&&i.splice(t,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}reset(){if(this._active.length)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].unhook(!1);this._stack.paused=!1,this._active=n,this._ident=0}hook(_,h){if(this.reset(),this._ident=_,this._active=this._handlers[_]||n,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(h);else this._handlerFb(this._ident,"HOOK",h)}put(_,h,i){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(_,h,i);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(_,h,i))}unhook(_,h=!0){if(this._active.length){let i=!1,t=this._active.length-1,e=!1;if(this._stack.paused&&(t=this._stack.loopPosition-1,i=h,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;t>=0&&(i=this._active[t].unhook(_),i!==!0);t--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!1,i;t--}for(;t>=0;t--)if(i=this._active[t].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",_);this._active=n,this._ident=0}};let d=new f.Params;d.addParam(0),s.DcsHandler=class{constructor(_){this._handler=_,this._data="",this._params=d,this._hitLimit=!1}hook(_){this._params=_.length>1||_.params[0]?_.clone():d,this._data="",this._hitLimit=!1}put(_,h,i){this._hitLimit||(this._data+=(0,c.utf32ToString)(_,h,i),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(_){let h=!1;if(this._hitLimit)h=!1;else if(_&&(h=this._handler(this._data,this._params),h instanceof Promise))return h.then((i=>(this._params=d,this._data="",this._hitLimit=!1,i)));return this._params=d,this._data="",this._hitLimit=!1,h}}},2015:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let c=o(844),f=o(8742),a=o(6242),n=o(6351);class d{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,r,l){this.table[e<<8|t]=r<<4|l}addMany(t,e,r,l){for(let p=0;p<t.length;p++)this.table[e<<8|t[p]]=r<<4|l}}s.TransitionTable=d;let _=160;s.VT500_TRANSITION_TABLE=(function(){let i=new d(4095),t=Array.apply(null,Array(256)).map(((g,u)=>u)),e=(g,u)=>t.slice(g,u),r=e(32,127),l=e(0,24);l.push(25),l.push.apply(l,e(28,32));let p=e(0,14),v;for(v in i.setDefault(1,0),i.addMany(r,0,2,0),p)i.addMany([24,26,153,154],v,3,0),i.addMany(e(128,144),v,3,0),i.addMany(e(144,152),v,3,0),i.add(156,v,0,0),i.add(27,v,11,1),i.add(157,v,4,8),i.addMany([152,158,159],v,0,7),i.add(155,v,11,3),i.add(144,v,11,9);return i.addMany(l,0,3,0),i.addMany(l,1,3,1),i.add(127,1,0,1),i.addMany(l,8,0,8),i.addMany(l,3,3,3),i.add(127,3,0,3),i.addMany(l,4,3,4),i.add(127,4,0,4),i.addMany(l,6,3,6),i.addMany(l,5,3,5),i.add(127,5,0,5),i.addMany(l,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(r,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(r,7,0,7),i.addMany(l,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(l,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(l,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(l,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(l,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(l,13,13,13),i.addMany(r,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(_,0,2,0),i.add(_,8,5,8),i.add(_,6,0,6),i.add(_,11,0,11),i.add(_,13,13,13),i})();class h extends c.Disposable{constructor(t=s.VT500_TRANSITION_TABLE){super(),this._transitions=t,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=(e,r,l)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,r)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new n.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(t,e=[64,126]){let r=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=t.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let p=0;p<t.intermediates.length;++p){let v=t.intermediates.charCodeAt(p);if(32>v||v>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=v}}if(t.final.length!==1)throw new Error("final must be a single byte");let l=t.final.charCodeAt(0);if(e[0]>l||l>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return r<<=8,r|=l,r}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(255&t)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let r=this._identifier(t,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let l=this._escHandlers[r];return l.push(e),{dispose:()=>{let p=l.indexOf(e);p!==-1&&l.splice(p,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let r=this._identifier(t);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let l=this._csiHandlers[r];return l.push(e),{dispose:()=>{let p=l.indexOf(e);p!==-1&&l.splice(p,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,e,r,l,p){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=r,this._parseStack.transition=l,this._parseStack.chunkPos=p}parse(t,e,r){let l,p=0,v=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(l=u[m](this._params),l!==!0);m--)if(l instanceof Promise)return this._parseStack.handlerPos=m,l}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(l=u[m](),l!==!0);m--)if(l instanceof Promise)return this._parseStack.handlerPos=m,l}this._parseStack.handlers=[];break;case 6:if(p=t[this._parseStack.chunkPos],l=this._dcsParser.unhook(p!==24&&p!==26,r),l)return l;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(p=t[this._parseStack.chunkPos],l=this._oscParser.end(p!==24&&p!==26,r),l)return l;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=g;u<e;++u){switch(p=t[u],v=this._transitions.table[this.currentState<<8|(p<160?p:_)],v>>4){case 2:for(let w=u+1;;++w){if(w>=e||(p=t[w])<32||p>126&&p<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(p=t[w])<32||p>126&&p<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(p=t[w])<32||p>126&&p<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(p=t[w])<32||p>126&&p<_){this._printHandler(t,u,w),u=w-1;break}}break;case 3:this._executeHandlers[p]?this._executeHandlers[p]():this._executeHandlerFb(p),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:p,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|p],y=m?m.length-1:-1;for(;y>=0&&(l=m[y](this._params),l!==!0);y--)if(l instanceof Promise)return this._preserveStack(3,m,y,v,u),l;y<0&&this._csiHandlerFb(this._collect<<8|p,this._params),this.precedingJoinState=0;break;case 8:do switch(p){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(p-48)}while(++u<e&&(p=t[u])>47&&p<60);u--;break;case 9:this._collect<<=8,this._collect|=p;break;case 10:let x=this._escHandlers[this._collect<<8|p],C=x?x.length-1:-1;for(;C>=0&&(l=x[C](),l!==!0);C--)if(l instanceof Promise)return this._preserveStack(4,x,C,v,u),l;C<0&&this._escHandlerFb(this._collect<<8|p),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|p,this._params);break;case 13:for(let w=u+1;;++w)if(w>=e||(p=t[w])===24||p===26||p===27||p>127&&p<_){this._dcsParser.put(t,u,w),u=w-1;break}break;case 14:if(l=this._dcsParser.unhook(p!==24&&p!==26),l)return this._preserveStack(6,[],0,v,u),l;p===27&&(v|=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 w=u+1;;w++)if(w>=e||(p=t[w])<32||p>127&&p<_){this._oscParser.put(t,u,w),u=w-1;break}break;case 6:if(l=this._oscParser.end(p!==24&&p!==26),l)return this._preserveStack(5,[],0,v,u),l;p===27&&(v|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&v}}}s.EscapeSequenceParser=h},6242:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let c=o(5770),f=o(482),a=[];s.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(n,d){this._handlers[n]===void 0&&(this._handlers[n]=[]);let _=this._handlers[n];return _.push(d),{dispose:()=>{let h=_.indexOf(d);h!==-1&&_.splice(h,1)}}}clearHandler(n){this._handlers[n]&&delete this._handlers[n]}setHandlerFallback(n){this._handlerFb=n}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let n=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;n>=0;--n)this._active[n].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].start();else this._handlerFb(this._id,"START")}_put(n,d,_){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(n,d,_);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(n,d,_))}start(){this.reset(),this._state=1}put(n,d,_){if(this._state!==3){if(this._state===1)for(;d<_;){let h=n[d++];if(h===59){this._state=2,this._start();break}if(h<48||57<h)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+h-48}this._state===2&&_-d>0&&this._put(n,d,_)}}end(n,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let _=!1,h=this._active.length-1,i=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,_=d,i=this._stack.fallThrough,this._stack.paused=!1),!i&&_===!1){for(;h>=0&&(_=this._active[h].end(n),_!==!0);h--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,_;h--}for(;h>=0;h--)if(_=this._active[h].end(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,_}else this._handlerFb(this._id,"END",n);this._active=a,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(n){this._handler=n,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(n,d,_){this._hitLimit||(this._data+=(0,f.utf32ToString)(n,d,_),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(n){let d=!1;if(this._hitLimit)d=!1;else if(n&&(d=this._handler(this._data),d instanceof Promise))return d.then((_=>(this._data="",this._hitLimit=!1,_)));return this._data="",this._hitLimit=!1,d}}},8742:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let o=2147483647;class c{static fromArray(a){let n=new c;if(!a.length)return n;for(let d=Array.isArray(a[0])?1:0;d<a.length;++d){let _=a[d];if(Array.isArray(_))for(let h=0;h<_.length;++h)n.addSubParam(_[h]);else n.addParam(_)}return n}constructor(a=32,n=32){if(this.maxLength=a,this.maxSubParamsLength=n,n>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(a),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(a),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let a=new c(this.maxLength,this.maxSubParamsLength);return a.params.set(this.params),a.length=this.length,a._subParams.set(this._subParams),a._subParamsLength=this._subParamsLength,a._subParamsIdx.set(this._subParamsIdx),a._rejectDigits=this._rejectDigits,a._rejectSubDigits=this._rejectSubDigits,a._digitIsSub=this._digitIsSub,a}toArray(){let a=[];for(let n=0;n<this.length;++n){a.push(this.params[n]);let d=this._subParamsIdx[n]>>8,_=255&this._subParamsIdx[n];_-d>0&&a.push(Array.prototype.slice.call(this._subParams,d,_))}return a}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(a){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=a>o?o:a}}addSubParam(a){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=a>o?o:a,this._subParamsIdx[this.length-1]++}}hasSubParams(a){return(255&this._subParamsIdx[a])-(this._subParamsIdx[a]>>8)>0}getSubParams(a){let n=this._subParamsIdx[a]>>8,d=255&this._subParamsIdx[a];return d-n>0?this._subParams.subarray(n,d):null}getSubParamsAll(){let a={};for(let n=0;n<this.length;++n){let d=this._subParamsIdx[n]>>8,_=255&this._subParamsIdx[n];_-d>0&&(a[n]=this._subParams.slice(d,_))}return a}addDigit(a){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let d=this._digitIsSub?this._subParams:this.params,_=d[n-1];d[n-1]=~_?Math.min(10*_+a,o):a}}s.Params=c},5741:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){let f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===o){c=f;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let c=o(3785),f=o(511);s.BufferApiView=class{constructor(a,n){this._buffer=a,this.type=n}init(a){return this._buffer=a,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(a){let n=this._buffer.lines.get(a);if(n)return new c.BufferLineApiView(n)}getNullCell(){return new f.CellData}}},3785:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let c=o(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,a){if(!(f<0||f>=this._line.length))return a?(this._line.loadCell(f,a),a):this._line.loadCell(f,new c.CellData)}translateToString(f,a,n){return this._line.translateToString(f,a,n)}}},8285:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let c=o(8771),f=o(8460),a=o(844);class n extends a.Disposable{constructor(_){super(),this._core=_,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.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=n},7975:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,(f=>c(f.toArray())))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,((f,a)=>c(f,a.toArray())))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(D,s,o){var c=this&&this.__decorate||function(i,t,e,r){var l,p=arguments.length,v=p<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(l=i[g])&&(v=(p<3?l(v):p>3?l(t,e,v):l(t,e))||v);return p>3&&v&&Object.defineProperty(t,e,v),v},f=this&&this.__param||function(i,t){return function(e,r){t(e,r,i)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let a=o(8460),n=o(844),d=o(5295),_=o(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let h=s.BufferService=class extends n.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new d.BufferSet(i,this))}resize(i,t){this.cols=i,this.rows=t,this.buffers.resize(i,t),this._onResize.fire({cols:i,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,t=!1){let e=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===i.fg&&r.getBg(0)===i.bg||(r=e.getBlankLine(i,t),this._cachedBlankLine=r),r.isWrapped=t;let l=e.ybase+e.scrollTop,p=e.ybase+e.scrollBottom;if(e.scrollTop===0){let v=e.lines.isFull;p===e.lines.length-1?v?e.lines.recycle().copyFrom(r):e.lines.push(r.clone()):e.lines.splice(p+1,0,r.clone()),v?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let v=p-l+1;e.lines.shiftElements(l+1,v-1,-1),e.lines.set(p,r.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,t,e){let r=this.buffer;if(i<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else i+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let l=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+i,r.ybase),0),l!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};s.BufferService=h=c([f(0,_.IOptionsService)],h)},7994:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(D,s,o){var c=this&&this.__decorate||function(r,l,p,v){var g,u=arguments.length,m=u<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,l,p,v);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(l,p,m):g(l,p))||m);return u>3&&m&&Object.defineProperty(l,p,m),m},f=this&&this.__param||function(r,l){return function(p,v){l(p,v,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let a=o(2585),n=o(8460),d=o(844),_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:r=>r.button!==4&&r.action===1&&(r.ctrl=!1,r.alt=!1,r.shift=!1,!0)},VT200:{events:19,restrict:r=>r.action!==32},DRAG:{events:23,restrict:r=>r.action!==32||r.button!==3},ANY:{events:31,restrict:r=>!0}};function h(r,l){let p=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(p|=64,p|=r.action):(p|=3&r.button,4&r.button&&(p|=64),8&r.button&&(p|=128),r.action===32?p|=32:r.action!==0||l||(p|=3)),p}let i=String.fromCharCode,t={DEFAULT:r=>{let l=[h(r,!1)+32,r.col+32,r.row+32];return l[0]>255||l[1]>255||l[2]>255?"":`\x1B[M${i(l[0])}${i(l[1])}${i(l[2])}`},SGR:r=>{let l=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${h(r,!0)};${r.col};${r.row}${l}`},SGR_PIXELS:r=>{let l=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${h(r,!0)};${r.x};${r.y}${l}`}},e=s.CoreMouseService=class extends d.Disposable{constructor(r,l){super(),this._bufferService=r,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new n.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let p of Object.keys(_))this.addProtocol(p,_[p]);for(let p of Object.keys(t))this.addEncoding(p,t[p]);this.reset()}addProtocol(r,l){this._protocols[r]=l}addEncoding(r,l){this._encodings[r]=l}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(r){if(!this._protocols[r])throw new Error(`unknown protocol "${r}"`);this._activeProtocol=r,this._onProtocolChange.fire(this._protocols[r].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(r){if(!this._encodings[r])throw new Error(`unknown encoding "${r}"`);this._activeEncoding=r}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(r){if(r.col<0||r.col>=this._bufferService.cols||r.row<0||r.row>=this._bufferService.rows||r.button===4&&r.action===32||r.button===3&&r.action!==32||r.button!==4&&(r.action===2||r.action===3)||(r.col++,r.row++,r.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,r,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(r))return!1;let l=this._encodings[this._activeEncoding](r);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=r,!0}explainEvents(r){return{down:!!(1&r),up:!!(2&r),drag:!!(4&r),move:!!(8&r),wheel:!!(16&r)}}_equalEvents(r,l,p){if(p){if(r.x!==l.x||r.y!==l.y)return!1}else if(r.col!==l.col||r.row!==l.row)return!1;return r.button===l.button&&r.action===l.action&&r.ctrl===l.ctrl&&r.alt===l.alt&&r.shift===l.shift}};s.CoreMouseService=e=c([f(0,a.IBufferService),f(1,a.ICoreService)],e)},6975:function(D,s,o){var c=this&&this.__decorate||function(e,r,l,p){var v,g=arguments.length,u=g<3?r:p===null?p=Object.getOwnPropertyDescriptor(r,l):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,p);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(u=(g<3?v(u):g>3?v(r,l,u):v(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,p){r(l,p,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let a=o(1439),n=o(8460),d=o(844),_=o(2585),h=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),t=s.CoreService=class extends d.Disposable{constructor(e,r,l){super(),this._bufferService=e,this._logService=r,this._optionsService=l,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new n.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new n.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new n.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new n.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(h),this.decPrivateModes=(0,a.clone)(i)}reset(){this.modes=(0,a.clone)(h),this.decPrivateModes=(0,a.clone)(i)}triggerDataEvent(e,r=!1){if(this._optionsService.rawOptions.disableStdin)return;let l=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((p=>p.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((r=>r.charCodeAt(0))))),this._onBinary.fire(e))}};s.CoreService=t=c([f(0,_.IBufferService),f(1,_.ILogService),f(2,_.IOptionsService)],t)},9074:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let c=o(8055),f=o(8460),a=o(844),n=o(6106),d=0,_=0;class h extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new n.SortedList((e=>e?.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,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let r=new i(e);if(r){let l=r.marker.onDispose((()=>r.dispose()));r.onDispose((()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),l.dispose())})),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,r,l){let p=0,v=0;for(let g of this._decorations.getKeyIterator(r))p=g.options.x??0,v=p+(g.options.width??1),e>=p&&e<v&&(!l||(g.options.layer??"bottom")===l)&&(yield g)}forEachDecorationAtCell(e,r,l,p){this._decorations.forEachByKey(r,(v=>{d=v.options.x??0,_=d+(v.options.width??1),e>=d&&e<_&&(!l||(v.options.layer??"bottom")===l)&&p(v)}))}}s.DecorationService=h;class i extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,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=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let c=o(2585),f=o(8343);class a{constructor(...d){this._entries=new Map;for(let[_,h]of d)this.set(_,h)}set(d,_){let h=this._entries.get(d);return this._entries.set(d,_),h}forEach(d){for(let[_,h]of this._entries.entries())d(_,h)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}s.ServiceCollection=a,s.InstantiationService=class{constructor(){this._services=new a,this._services.set(c.IInstantiationService,this)}setService(n,d){this._services.set(n,d)}getService(n){return this._services.get(n)}createInstance(n,...d){let _=(0,f.getServiceDependencies)(n).sort(((t,e)=>t.index-e.index)),h=[];for(let t of _){let e=this._services.get(t.id);if(!e)throw new Error(`[createInstance] ${n.name} depends on UNKNOWN service ${t.id}.`);h.push(e)}let i=_.length>0?_[0].index:d.length;if(d.length!==i)throw new Error(`[createInstance] First service dependency of ${n.name} at position ${i+1} conflicts with ${d.length} static arguments`);return new n(...d,...h)}}},7866:function(D,s,o){var c=this&&this.__decorate||function(i,t,e,r){var l,p=arguments.length,v=p<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(l=i[g])&&(v=(p<3?l(v):p>3?l(t,e,v):l(t,e))||v);return p>3&&v&&Object.defineProperty(t,e,v),v},f=this&&this.__param||function(i,t){return function(e,r){t(e,r,i)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let a=o(844),n=o(2585),d={trace:n.LogLevelEnum.TRACE,debug:n.LogLevelEnum.DEBUG,info:n.LogLevelEnum.INFO,warn:n.LogLevelEnum.WARN,error:n.LogLevelEnum.ERROR,off:n.LogLevelEnum.OFF},_,h=s.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=n.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),_=this}_updateLogLevel(){this._logLevel=d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let t=0;t<i.length;t++)typeof i[t]=="function"&&(i[t]=i[t]())}_log(i,t,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...e)}trace(i,...t){this._logLevel<=n.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,t)}debug(i,...t){this._logLevel<=n.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,t)}info(i,...t){this._logLevel<=n.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,t)}warn(i,...t){this._logLevel<=n.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,t)}error(i,...t){this._logLevel<=n.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,t)}};s.LogService=h=c([f(0,n.IOptionsService)],h),s.setTraceLogger=function(i){_=i},s.traceCall=function(i,t,e){if(typeof e.value!="function")throw new Error("not supported");let r=e.value;e.value=function(...l){if(_.logLevel!==n.LogLevelEnum.TRACE)return r.apply(this,l);_.trace(`GlyphRenderer#${r.name}(${l.map((v=>JSON.stringify(v))).join(", ")})`);let p=r.apply(this,l);return _.trace(`GlyphRenderer#${r.name} return`,p),p}}},7302:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let c=o(8460),f=o(844),a=o(6114);s.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:a.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let n=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends f.Disposable{constructor(h){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...s.DEFAULT_OPTIONS};for(let t in h)if(t in i)try{let e=h[t];i[t]=this._sanitizeAndValidateOption(t,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(h,i){return this.onOptionChange((t=>{t===h&&i(this.rawOptions[h])}))}onMultipleOptionChange(h,i){return this.onOptionChange((t=>{h.indexOf(t)!==-1&&i()}))}_setupOptions(){let h=t=>{if(!(t in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);return this.rawOptions[t]},i=(t,e)=>{if(!(t in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);e=this._sanitizeAndValidateOption(t,e),this.rawOptions[t]!==e&&(this.rawOptions[t]=e,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let e={get:h.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,e)}}_sanitizeAndValidateOption(h,i){switch(h){case"cursorStyle":if(i||(i=s.DEFAULT_OPTIONS[h]),!(function(t){return t==="block"||t==="underline"||t==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${h}`);break;case"wordSeparator":i||(i=s.DEFAULT_OPTIONS[h]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=n.includes(i)?i:s.DEFAULT_OPTIONS[h];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${h} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${h} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${h} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${h} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}s.OptionsService=d},2660:function(D,s,o){var c=this&&this.__decorate||function(d,_,h,i){var t,e=arguments.length,r=e<3?_:i===null?i=Object.getOwnPropertyDescriptor(_,h):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(d,_,h,i);else for(var l=d.length-1;l>=0;l--)(t=d[l])&&(r=(e<3?t(r):e>3?t(_,h,r):t(_,h))||r);return e>3&&r&&Object.defineProperty(_,h,r),r},f=this&&this.__param||function(d,_){return function(h,i){_(h,i,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let a=o(2585),n=s.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){let _=this._bufferService.buffer;if(d.id===void 0){let l=_.addMarker(_.ybase+_.y),p={data:d,id:this._nextId++,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(p,l))),this._dataByLinkId.set(p.id,p),p.id}let h=d,i=this._getEntryIdKey(h),t=this._entriesWithId.get(i);if(t)return this.addLineToLink(t.id,_.ybase+_.y),t.id;let e=_.addMarker(_.ybase+_.y),r={id:this._nextId++,key:this._getEntryIdKey(h),data:h,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(r,e))),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(d,_){let h=this._dataByLinkId.get(d);if(h&&h.lines.every((i=>i.line!==_))){let i=this._bufferService.buffer.addMarker(_);h.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(h,i)))}}getLinkData(d){return this._dataByLinkId.get(d)?.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,_){let h=d.lines.indexOf(_);h!==-1&&(d.lines.splice(h,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};s.OscLinkService=n=c([f(0,a.IBufferService)],n)},8343:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let o="di$target",c="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(f){return f[c]||[]},s.createDecorator=function(f){if(s.serviceRegistry.has(f))return s.serviceRegistry.get(f);let a=function(n,d,_){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(h,i,t){i[o]===i?i[c].push({id:h,index:t}):(i[c]=[{id:h,index:t}],i[o]=i)})(a,n,_)};return a.toString=()=>f,s.serviceRegistry.set(f,a),a}},2585:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;let c=o(8343);var f;s.IBufferService=(0,c.createDecorator)("BufferService"),s.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),s.ICoreService=(0,c.createDecorator)("CoreService"),s.ICharsetService=(0,c.createDecorator)("CharsetService"),s.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(a){a[a.TRACE=0]="TRACE",a[a.DEBUG=1]="DEBUG",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.OFF=5]="OFF"})(f||(s.LogLevelEnum=f={})),s.ILogService=(0,c.createDecorator)("LogService"),s.IOptionsService=(0,c.createDecorator)("OptionsService"),s.IOscLinkService=(0,c.createDecorator)("OscLinkService"),s.IUnicodeService=(0,c.createDecorator)("UnicodeService"),s.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(D,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let c=o(8460),f=o(225);class a{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,_,h=!1){return(16777215&d)<<3|(3&_)<<1|(h?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;let d=new f.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let _=0,h=0,i=d.length;for(let t=0;t<i;++t){let e=d.charCodeAt(t);if(55296<=e&&e<=56319){if(++t>=i)return _+this.wcwidth(e);let p=d.charCodeAt(t);56320<=p&&p<=57343?e=1024*(e-55296)+p-56320+65536:_+=this.wcwidth(p)}let r=this.charProperties(e,h),l=a.extractWidth(r);a.extractShouldJoin(r)&&(l-=a.extractWidth(h)),_+=l,h=r}return _}charProperties(d,_){return this._activeProvider.charProperties(d,_)}}s.UnicodeService=a}},R={};function O(D){var s=R[D];if(s!==void 0)return s.exports;var o=R[D]={exports:{}};return B[D].call(o.exports,o,o.exports,O),o.exports}var F={};return(()=>{var D=F;Object.defineProperty(D,"__esModule",{value:!0}),D.Terminal=void 0;let s=O(9042),o=O(3236),c=O(844),f=O(5741),a=O(8285),n=O(7975),d=O(7090),_=["cols","rows"];class h extends c.Disposable{constructor(t){super(),this._core=this.register(new o.Terminal(t)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let e=l=>this._core.options[l],r=(l,p)=>{this._checkReadonlyOptions(l),this._core.options[l]=p};for(let l in this._core.options){let p={get:e.bind(this,l),set:r.bind(this,l)};Object.defineProperty(this._publicOptions,l,p)}}_checkReadonlyOptions(t){if(_.includes(t))throw new Error(`Option "${t}" 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 n.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.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 a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,r){this._verifyIntegers(t,e,r),this._core.select(t,e,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
10
|
-
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return s}_verifyIntegers(...t){for(let e of t)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(let e of t)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}D.Terminal=h})(),F})()))});var Tt=pt((nt,mt)=>{(function(B,R){typeof nt=="object"&&typeof mt=="object"?mt.exports=R():typeof define=="function"&&define.amd?define([],R):typeof nt=="object"?nt.FitAddon=R():B.FitAddon=R()})(self,(()=>(()=>{"use strict";var B={};return(()=>{var R=B;Object.defineProperty(R,"__esModule",{value:!0}),R.FitAddon=void 0,R.FitAddon=class{activate(O){this._terminal=O}dispose(){}fit(){let O=this.proposeDimensions();if(!O||!this._terminal||isNaN(O.cols)||isNaN(O.rows))return;let F=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(F._renderService.clear(),this._terminal.resize(O.cols,O.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let O=this._terminal._core,F=O._renderService.dimensions;if(F.css.cell.width===0||F.css.cell.height===0)return;let D=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(s.getPropertyValue("height")),c=Math.max(0,parseInt(s.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),a=o-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),n=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-D;return{cols:Math.max(2,Math.floor(n/F.css.cell.width)),rows:Math.max(1,Math.floor(a/F.css.cell.height))}}}})(),B})()))});var Mt=pt((ot,bt)=>{(function(B,R){typeof ot=="object"&&typeof bt=="object"?bt.exports=R():typeof define=="function"&&define.amd?define([],R):typeof ot=="object"?ot.SearchAddon=R():B.SearchAddon=R()})(self,(()=>(()=>{"use strict";var B={345:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o((f=>c.fire(f)))},s.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},859:(D,s)=>{function o(c){for(let f of c)f.dispose();c.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 c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let f=this._disposables.indexOf(c);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(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}}},R={};function O(D){var s=R[D];if(s!==void 0)return s.exports;var o=R[D]={exports:{}};return B[D](o,o.exports,O),o.exports}var F={};return(()=>{var D=F;Object.defineProperty(D,"__esModule",{value:!0}),D.SearchAddon=void 0;let s=O(345),o=O(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class f extends o.Disposable{constructor(n){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new o.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new o.MutableDisposable,this._onDidChangeResults=this.register(new s.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=n?.highlightLimit??1e3}activate(n){this._terminal=n,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,o.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let n=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(n,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(n){this._selectedDecoration.clear(),(0,o.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),n||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||_)&&this._highlightAllMatches(n,d);let h=this._findNextAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,h}_highlightAllMatches(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!n||n.length===0)return void this.clearDecorations();d=d||{},this.clearDecorations(!0);let _=[],h,i=this._find(n,0,0,d);for(;i&&(h?.row!==i.row||h?.col!==i.col)&&!(_.length>=this._highlightLimit);)h=i,_.push(h),i=this._find(n,h.col+h.term.length>=this._terminal.cols?h.row+1:h.row,h.col+h.term.length>=this._terminal.cols?0:h.col+1,d);for(let t of _){let e=this._createResultDecoration(t,d.decorations);e&&(this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}}))}}_find(n,d,_,h){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(_>this._terminal.cols)throw new Error(`Invalid col: ${_} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let t={startRow:d,startCol:_};if(i=this._findInLine(n,t,h),!i)for(let e=d+1;e<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=e,t.startCol=0,i=this._findInLine(n,t,h),!i);e++);return i}_findNextAndSelect(n,d){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let _=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,i=0;_&&(this._cachedSearchTerm===n?(h=_.end.x,i=_.end.y):(h=_.start.x,i=_.start.y)),this._initLinesCache();let t={startRow:i,startCol:h},e=this._findInLine(n,t,d);if(!e)for(let r=i+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=r,t.startCol=0,e=this._findInLine(n,t,d),!e);r++);if(!e&&i!==0)for(let r=0;r<i&&(t.startRow=r,t.startCol=0,e=this._findInLine(n,t,d),!e);r++);return!e&&_&&(t.startRow=_.start.y,t.startCol=0,e=this._findInLine(n,t,d)),this._selectResult(e,d?.decorations,d?.noScroll)}findPrevious(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||_)&&this._highlightAllMatches(n,d);let h=this._findPreviousAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,h}_didOptionsChange(n,d){return!!d&&(n.caseSensitive!==d.caseSensitive||n.regex!==d.regex||n.wholeWord!==d.wholeWord)}_fireResults(n){if(n?.decorations){let d=-1;if(this._selectedDecoration.value){let _=this._selectedDecoration.value.match;for(let h=0;h<this._highlightDecorations.length;h++){let i=this._highlightDecorations[h].match;if(i.row===_.row&&i.col===_.col&&i.size===_.size){d=h;break}}}this._onDidChangeResults.fire({resultIndex:d,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let _=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols,t=!0;this._initLinesCache();let e={startRow:h,startCol:i},r;if(_&&(e.startRow=h=_.start.y,e.startCol=i=_.start.x,this._cachedSearchTerm!==n&&(r=this._findInLine(n,e,d,!1),r||(e.startRow=h=_.end.y,e.startCol=i=_.end.x))),r||(r=this._findInLine(n,e,d,t)),!r){e.startCol=Math.max(e.startCol,this._terminal.cols);for(let l=h-1;l>=0&&(e.startRow=l,r=this._findInLine(n,e,d,t),!r);l--);}if(!r&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=h&&(e.startRow=l,r=this._findInLine(n,e,d,t),!r);l--);return this._selectResult(r,d?.decorations,d?.noScroll)}_initLinesCache(){let n=this._terminal;this._linesCache||(this._linesCache=new Array(n.buffer.active.length),this._linesCacheDisposables.value=(0,o.getDisposeArrayDisposable)([n.onLineFeed((()=>this._destroyLinesCache())),n.onCursorMove((()=>this._destroyLinesCache())),n.onResize((()=>this._destroyLinesCache()))])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout((()=>this._destroyLinesCache()),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(n,d,_){return(n===0||c.includes(d[n-1]))&&(n+_.length===d.length||c.includes(d[n+_.length]))}_findInLine(n,d,_={},h=!1){let i=this._terminal,t=d.startRow,e=d.startCol;if(i.buffer.active.getLine(t)?.isWrapped)return h?void(d.startCol+=i.cols):(d.startRow--,d.startCol+=i.cols,this._findInLine(n,d,_));let l=this._linesCache?.[t];l||(l=this._translateBufferLineToStringWithWrap(t,!0),this._linesCache&&(this._linesCache[t]=l));let[p,v]=l,g=this._bufferColsToStringOffset(t,e),u=_.caseSensitive?n:n.toLowerCase(),m=_.caseSensitive?p:p.toLowerCase(),y=-1;if(_.regex){let x=RegExp(u,"g"),C;if(h)for(;C=x.exec(m.slice(0,g));)y=x.lastIndex-C[0].length,n=C[0],x.lastIndex-=n.length-1;else C=x.exec(m.slice(g)),C&&C[0].length>0&&(y=g+(x.lastIndex-C[0].length),n=C[0])}else h?g-u.length>=0&&(y=m.lastIndexOf(u,g-u.length)):y=m.indexOf(u,g);if(y>=0){if(_.wholeWord&&!this._isWholeWord(y,m,n))return;let x=0;for(;x<v.length-1&&y>=v[x+1];)x++;let C=x;for(;C<v.length-1&&y+n.length>=v[C+1];)C++;let w=y-v[x],A=y+n.length-v[C],P=this._stringLengthToBufferSize(t+x,w);return{term:n,col:P,row:t+x,size:this._stringLengthToBufferSize(t+C,A)-P+i.cols*(C-x)}}}_stringLengthToBufferSize(n,d){let _=this._terminal.buffer.active.getLine(n);if(!_)return 0;for(let h=0;h<d;h++){let i=_.getCell(h);if(!i)break;let t=i.getChars();t.length>1&&(d-=t.length-1);let e=_.getCell(h+1);e&&e.getWidth()===0&&d++}return d}_bufferColsToStringOffset(n,d){let _=this._terminal,h=n,i=0,t=_.buffer.active.getLine(h);for(;d>0&&t;){for(let e=0;e<d&&e<_.cols;e++){let r=t.getCell(e);if(!r)break;r.getWidth()&&(i+=r.getCode()===0?1:r.getChars().length)}if(h++,t=_.buffer.active.getLine(h),t&&!t.isWrapped)break;d-=_.cols}return i}_translateBufferLineToStringWithWrap(n,d){let _=this._terminal,h=[],i=[0],t=_.buffer.active.getLine(n);for(;t;){let e=_.buffer.active.getLine(n+1),r=!!e&&e.isWrapped,l=t.translateToString(!r&&d);if(r&&e){let p=t.getCell(t.length-1);p&&p.getCode()===0&&p.getWidth()===1&&e.getCell(0)?.getWidth()===2&&(l=l.slice(0,-1))}if(h.push(l),!r)break;i.push(i[i.length-1]+l.length),n++,t=e}return[h.join(""),i]}_selectResult(n,d,_){let h=this._terminal;if(this._selectedDecoration.clear(),!n)return h.clearSelection(),!1;if(h.select(n.col,n.row,n.size),d){let i=h.registerMarker(-h.buffer.active.baseY-h.buffer.active.cursorY+n.row);if(i){let t=h.registerDecoration({marker:i,x:n.col,width:n.size,backgroundColor:d.activeMatchBackground,layer:"top",overviewRulerOptions:{color:d.activeMatchColorOverviewRuler}});if(t){let e=[];e.push(i),e.push(t.onRender((r=>this._applyStyles(r,d.activeMatchBorder,!0)))),e.push(t.onDispose((()=>(0,o.disposeArray)(e)))),this._selectedDecoration.value={decoration:t,match:n,dispose(){t.dispose()}}}}}if(!_&&(n.row>=h.buffer.active.viewportY+h.rows||n.row<h.buffer.active.viewportY)){let i=n.row-h.buffer.active.viewportY;i-=Math.floor(h.rows/2),h.scrollLines(i)}return!0}_applyStyles(n,d,_){n.classList.contains("xterm-find-result-decoration")||(n.classList.add("xterm-find-result-decoration"),d&&(n.style.outline=`1px solid ${d}`)),_&&n.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(n,d){let _=this._terminal,h=_.registerMarker(-_.buffer.active.baseY-_.buffer.active.cursorY+n.row);if(!h)return;let i=_.registerDecoration({marker:h,x:n.col,width:n.size,backgroundColor:d.matchBackground,overviewRulerOptions:this._highlightedLines.has(h.line)?void 0:{color:d.matchOverviewRuler,position:"center"}});if(i){let t=[];t.push(h),t.push(i.onRender((e=>this._applyStyles(e,d.matchBorder,!1)))),t.push(i.onDispose((()=>(0,o.disposeArray)(t))))}return i}}D.SearchAddon=f})(),F})()))});var mi={};li(mi,{apply:()=>vi,inject:()=>_i});module.exports=hi(mi);var pe=require("react");var ee=require("react");var ae="zTerm";async function ie(B,R,O={},F){let D=B.connection;if(!D?.rpc?.call)throw new Error("\u5F53\u524D DSH \u7F3A\u5C11 Connection RPC\uFF0C\u8BF7\u4F7F\u7528\u5DF2\u652F\u6301\u7684\u5BBF\u4E3B\u7248\u672C");let s=await D.rpc.call("/api",`zterm/${R}`,O,F);if(!s.ok)throw new Error(s.error?.message||`${ae} \u8BF7\u6C42\u5931\u8D25`);return s.value}function it(B,R,O="text/plain;charset=utf-8"){let F=URL.createObjectURL(new Blob([R],{type:O})),D=document.createElement("a");D.href=F,D.download=B,D.click(),URL.revokeObjectURL(F)}function rt(){return new Date().toISOString().replace(/[-:]/g,"").replace(/T/,"-").slice(0,15)}function Lt(B,R){let O=new Map(B);if(R.reset){O.clear();for(let F of R.snapshots??[])O.set(F.terminalId,{generation:F.generation,text:F.text,seq:R.cursor})}for(let F of R.output??[]){let D=O.get(F.terminalId);D&&D.generation===F.generation&&F.seq<=D.seq||O.set(F.terminalId,{generation:F.generation,text:`${D&&D.generation===F.generation?D.text:""}${F.text}`.slice(-5e5),seq:F.seq})}for(let F of O.keys())R.workspace.terminals.some(D=>D.id===F)||O.delete(F);return O}var ue=require("react"),Ht=vt(At(),1),Ft=vt(Tt(),1),Nt=vt(Mt(),1);var qe=require("react");function ze(B,R,O,F){try{let D=localStorage.getItem(B),s=D===null?R:Number(D);return Number.isFinite(s)?Math.max(O,Math.min(F,s)):R}catch{return R}}function Pe(B,R){try{localStorage.setItem(B,String(R))}catch{}}var Ke=12,at=8,lt=32,St="dsh-zterm.terminal-font-size",Xe=new Set,ht;function It(B){return Number.isInteger(B)&&B>=at&&B<=lt}function Ct(){try{let B=localStorage.getItem(St),R=B===null?Ke:Number(B);return It(R)?R:Ke}catch{return ht??Ke}}function Ot(){return ht??=Ct()}function zt(B){B!==Ot()&&(ht=B,Xe.forEach(R=>R()))}function Pt(B){It(B)&&(zt(B),Pe(St,B))}function Bt(B){(B.key===St||B.key===null)&&zt(Ct())}function ci(B){return!Xe.size&&typeof window<"u"&&(ht=Ct(),window.addEventListener("storage",Bt)),Xe.add(B),()=>{Xe.delete(B),!Xe.size&&typeof window<"u"&&window.removeEventListener("storage",Bt)}}function ct(){return(0,qe.useSyncExternalStore)(ci,Ot,()=>Ke)}function Ve(){let B=(0,qe.useRef)(()=>{});return(0,qe.useEffect)(()=>()=>B.current(),[]),(R,O)=>{R.preventDefault(),B.current();let F=()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",F),B.current=()=>{}};B.current=F,window.addEventListener("mousemove",O),window.addEventListener("mouseup",F,{once:!0})}}var Re=require("react/jsx-runtime");function Wt({ctx:B,sessionId:R,terminal:O,buffer:F,visible:D,onError:s}){let o=(0,ue.useRef)(null),c=(0,ue.useRef)(),f=(0,ue.useRef)(),a=(0,ue.useRef)(),n=(0,ue.useRef)(""),d=(0,ue.useRef)(O),_=(0,ue.useRef)(s),h=(0,ue.useRef)(Promise.resolve()),i=(0,ue.useRef)(()=>{}),[t,e]=(0,ue.useState)(""),r=ct(),l=(0,ue.useRef)(r);return l.current=r,d.current=O,_.current=s,(0,ue.useLayoutEffect)(()=>{if(!o.current)return;let p=new Ht.Terminal({cursorBlink:!0,fontSize:l.current,fontFamily:"Menlo, Consolas, monospace",scrollback:5e3,allowProposedApi:!1,convertEol:!1,theme:{background:"#12161d",foreground:"#dce3ed",cursor:"#e4edf8",selectionBackground:"#334b66"}}),v=new Ft.FitAddon,g=new Nt.SearchAddon;p.loadAddon(v),p.loadAddon(g),p.open(o.current),c.current=p,a.current=v,f.current=g,n.current="";let u=!1,m=p.onData(A=>{let P=d.current;P.state==="ready"&&(h.current=h.current.catch(()=>{}).then(async()=>{u||await ie(B,"input",{sessionId:R,terminalId:P.id,generation:P.generation,data:A})}).catch(U=>{u||_.current(U.message)}))}),y;i.current=()=>{if(u||!o.current?.clientWidth)return;v.fit();let A=d.current;A.state==="ready"&&ie(B,"resize",{sessionId:R,terminalId:A.id,generation:A.generation,cols:p.cols,rows:p.rows}).catch(P=>{u||_.current(P.message)})};let x=()=>{clearTimeout(y),y=setTimeout(()=>i.current(),80)},C=new ResizeObserver(x);C.observe(o.current),x();let w=A=>{(A.metaKey||A.ctrlKey)&&A.key.toLowerCase()==="f"&&(A.preventDefault(),document.getElementById(`zterm-find-${O.id}`)?.focus())};return o.current.addEventListener("keydown",w),()=>{u=!0,i.current=()=>{},clearTimeout(y),C.disconnect(),m.dispose(),o.current?.removeEventListener("keydown",w),p.dispose(),c.current=void 0}},[B,R,O.id,O.generation]),(0,ue.useEffect)(()=>{let p=c.current;!p||!F||F.generation!==O.generation||(F.text.startsWith(n.current)?p.write(F.text.slice(n.current.length)):(p.reset(),p.write(F.text)),n.current=F.text)},[F,O.generation]),(0,ue.useLayoutEffect)(()=>{let p=c.current;!p||p.options.fontSize===r||(p.options.fontSize=r,D&&i.current())},[r,D]),(0,ue.useEffect)(()=>{D&&(i.current(),c.current?.focus())},[D,O.state,O.generation]),(0,Re.jsxs)("div",{className:"zt-terminal-screen",style:{display:D?"flex":"none"},children:[(0,Re.jsxs)("div",{className:"zt-terminal-search",children:[(0,Re.jsx)("input",{id:`zterm-find-${O.id}`,"aria-label":"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",placeholder:"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",value:t,onChange:p=>{e(p.target.value),f.current?.findNext(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&f.current?.findNext(t),p.key==="Escape"&&(e(""),c.current?.focus())}}),(0,Re.jsx)("button",{title:"\u4E0A\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findPrevious(t),children:"\u2191"}),(0,Re.jsx)("button",{title:"\u4E0B\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findNext(t),children:"\u2193"}),(0,Re.jsx)("span",{children:"\u7EC8\u7AEF\u8F93\u5165\u76F4\u63A5\u64CD\u4F5C\u5F53\u524D\u673A\u5668"})]}),(0,Re.jsx)("div",{className:"zt-terminal-canvas",ref:o})]})}var ce=require("react");var He={password:"\u5BC6\u7801",key:"\u79C1\u94A5\u5185\u5BB9","key-file":"\u79C1\u94A5\u6587\u4EF6"};var Ee=require("react"),be=require("react/jsx-runtime");function Ye(B){let R=new Map;for(let s of B){let o=s.parentId??"";R.set(o,[...R.get(o)??[],s])}let O=(R.get("")??[]).slice().reverse().map(s=>({...s,depth:0})),F=[],D=new Set;for(;O.length;){let s=O.pop();if(!D.has(s.id)){D.add(s.id),F.push(s);for(let o of(R.get(s.id)??[]).slice().reverse())O.push({...o,depth:s.depth+1})}}return F}function di({folder:B,onEdit:R,onDelete:O}){let F=(0,Ee.useRef)(null),D=(0,Ee.useRef)(null),s=(0,Ee.useId)(),[o,c]=(0,Ee.useState)(!1);(0,Ee.useEffect)(()=>{let n=F.current;n.setAttribute("popover","auto"),D.current.setAttribute("popovertarget",s);let d=()=>{let _=n.matches(":popover-open");if(c(_),!_)return;let h=D.current.getBoundingClientRect();n.style.left=`${Math.max(8,Math.min(h.right-n.offsetWidth,window.innerWidth-n.offsetWidth-8))}px`,n.style.top=`${Math.max(8,h.bottom+n.offsetHeight+4<=window.innerHeight-8?h.bottom+4:h.top-n.offsetHeight-4)}px`,n.querySelector("button")?.focus({preventScroll:!0})};return n.addEventListener("toggle",d),()=>n.removeEventListener("toggle",d)},[s]),(0,Ee.useEffect)(()=>{if(!o)return;let n=()=>F.current?.hidePopover();return window.addEventListener("resize",n),document.addEventListener("scroll",n,!0),()=>{window.removeEventListener("resize",n),document.removeEventListener("scroll",n,!0)}},[o]);let f=n=>{F.current?.hidePopover(),n(B)},a=n=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();let d=[...n.currentTarget.querySelectorAll("button")],_=d.indexOf(document.activeElement),h=n.key==="Home"?0:n.key==="End"?d.length-1:(_+(n.key==="ArrowUp"?-1:1)+d.length)%d.length;d[h]?.focus()};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("button",{ref:D,className:"zt-folder-action","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${B.label}`,title:"\u6587\u4EF6\u5939\u64CD\u4F5C","aria-haspopup":"menu","aria-controls":s,"aria-expanded":o,children:"\u22EF"}),(0,be.jsxs)("div",{ref:F,id:s,className:"zt-folder-menu",role:"menu","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${B.label}`,onKeyDown:a,children:[(0,be.jsx)("button",{role:"menuitem",onClick:()=>f(R),children:"\u66F4\u540D"}),(0,be.jsx)("button",{role:"menuitem",onClick:()=>f(O),children:"\u5220\u9664"})]})]})}function Ut({folders:B,selected:R,onSelect:O,onEdit:F,onDelete:D}){let[s,o]=(0,Ee.useState)(new Set),c=Ye(B),f=new Set,a=new Set(B.map(n=>n.parentId));return(0,be.jsxs)("nav",{className:"zt-folder-tree","aria-label":"\u4E3B\u673A\u6587\u4EF6\u5939",children:[(0,be.jsx)("button",{className:R===""?"active":"",onClick:()=>O(""),children:"\u25B1 \u6839\u76EE\u5F55(\u5168\u90E8\u4E3B\u673A)"}),c.map(n=>n.parentId&&(s.has(n.parentId)||f.has(n.parentId))?(f.add(n.id),null):(0,be.jsxs)("div",{style:{paddingLeft:`min(${Math.min(8,n.depth)*12}px, 25%)`},children:[(0,be.jsx)("button",{className:"zt-folder-toggle","aria-label":`${s.has(n.id)?"\u5C55\u5F00":"\u6536\u8D77"}\u6587\u4EF6\u5939 ${n.label}`,disabled:!a.has(n.id),onClick:()=>o(d=>{let _=new Set(d);return _.has(n.id)?_.delete(n.id):_.add(n.id),_}),children:a.has(n.id)?s.has(n.id)?"\u25B8":"\u25BE":"\xB7"}),(0,be.jsxs)("button",{className:`zt-folder-name${R===n.id?" active":""}`,onClick:()=>O(n.id),title:n.label,children:["\u25B1 ",n.label]}),(0,be.jsx)(di,{folder:n,onEdit:F,onDelete:D})]},n.id))]})}var W=require("react/jsx-runtime");function Fe({title:B,children:R,onClose:O}){let F=(0,ce.useRef)(null),D=(0,ce.useRef)(O);return D.current=O,(0,ce.useEffect)(()=>{let s=document.activeElement,o=F.current;(o?.querySelector("input,select,textarea")??o?.querySelector("button")??o)?.focus();let c=f=>{if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),D.current();return}if(f.key!=="Tab")return;let a=[...o?.querySelectorAll('button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')??[]].filter(_=>_.offsetParent!==null),n=a[0],d=a.at(-1);n?f.shiftKey&&(document.activeElement===n||document.activeElement===o)?(f.preventDefault(),d?.focus()):!f.shiftKey&&document.activeElement===d&&(f.preventDefault(),n.focus()):(f.preventDefault(),o?.focus())};return o?.addEventListener("keydown",c),()=>{o?.removeEventListener("keydown",c),s?.isConnected&&s.focus()}},[]),(0,W.jsx)("div",{className:"zt-modal-shade",onMouseDown:s=>{s.target===s.currentTarget&&O()},children:(0,W.jsxs)("section",{ref:F,tabIndex:-1,className:"zt-modal",role:"dialog","aria-modal":"true","aria-label":B,children:[(0,W.jsxs)("header",{children:[(0,W.jsx)("strong",{children:B}),(0,W.jsx)("button",{"aria-label":"\u5173\u95ED\u5BF9\u8BDD\u6846",onClick:O,children:"\xD7"})]}),R]})})}function _e({title:B,children:R}){return(0,W.jsxs)("label",{className:"zt-field",children:[(0,W.jsx)("span",{children:B}),R]})}function $t({ctx:B,host:R,folders:O,credentials:F=[],defaultCredentialId:D,revision:s,onClose:o,onSaved:c}){let[f,a]=(0,ce.useState)({label:R?.label??"",host:R?.host??"",port:String(R?.port??22),username:R?.username??"",authType:R?.authType??"key-file",privateKeyPath:R?.privateKeyPath??"",folderId:R?.folderId??""}),[n,d]=(0,ce.useState)(""),[_,h]=(0,ce.useState)(""),[i,t]=(0,ce.useState)(!1),[e,r]=(0,ce.useState)(""),[l,p]=(0,ce.useState)(!1),[v,g]=(0,ce.useState)(R?.credentialId||!R&&F.length?"saved":R?.authType??"key-file"),[u,m]=(0,ce.useState)(R?.credentialId||D||F[0]?.id||""),y=R&&!R.credentialId&&R.authType===v,x=(C,w)=>a(A=>({...A,[C]:w}));return(0,W.jsx)(Fe,{title:R?"\u7F16\u8F91\u8FDC\u7A0B\u4E3B\u673A":"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A",onClose:o,children:(0,W.jsxs)("form",{onSubmit:C=>{C.preventDefault(),p(!0),r(""),ie(B,"host/save",{host:{...R,...f,credentialId:v==="saved"?u:void 0,folderId:f.folderId||void 0,port:Number(f.port),kind:"ssh"},secret:v==="saved"?"":n,passphrase:v==="saved"?"":_,clearPassphrase:i,revision:s}).then(()=>{d(""),h(""),c(),o()}).catch(w=>r(w.message)).finally(()=>p(!1))},children:[(0,W.jsx)(_e,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:f.label,onChange:C=>x("label",C.target.value)})}),(0,W.jsxs)("div",{className:"zt-form-row",children:[(0,W.jsx)(_e,{title:"\u4E3B\u673A\u5730\u5740",children:(0,W.jsx)("input",{required:!0,value:f.host,placeholder:"\u4E3B\u673A\u540D\u6216 IP",onChange:C=>x("host",C.target.value)})}),(0,W.jsx)(_e,{title:"\u7AEF\u53E3",children:(0,W.jsx)("input",{type:"number",required:!0,min:"1",max:"65535",value:f.port,onChange:C=>x("port",C.target.value)})})]}),(0,W.jsx)(_e,{title:"\u767B\u5F55\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:f.username,onChange:C=>x("username",C.target.value)})}),(0,W.jsx)(_e,{title:"\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:f.folderId,onChange:C=>x("folderId",C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).map(C=>(0,W.jsxs)("option",{value:C.id,children:["\u3000".repeat(Math.min(8,C.depth)),C.label]},C.id))]})}),(0,W.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:v,onChange:C=>{g(C.target.value),C.target.value!=="saved"&&x("authType",C.target.value),d(""),h(""),t(!1)},children:[(0,W.jsx)("option",{value:"saved",children:"\u9009\u62E9\u5DF2\u4FDD\u5B58\u51ED\u8BC1"}),(0,W.jsx)("option",{value:"password",children:"\u5BC6\u7801"}),(0,W.jsx)("option",{value:"key",children:"\u79C1\u94A5\u5185\u5BB9"}),(0,W.jsx)("option",{value:"key-file",children:"\u79C1\u94A5\u6587\u4EF6"})]})}),v==="saved"&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_e,{title:"\u767B\u5F55\u51ED\u8BC1",children:(0,W.jsxs)("select",{required:!0,value:u,onChange:C=>m(C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u8BF7\u9009\u62E9\u51ED\u8BC1"}),F.map(C=>(0,W.jsxs)("option",{value:C.id,children:[C.label," \xB7 ",He[C.authType]]},C.id))]})}),(0,W.jsx)("p",{className:"zt-hint",children:"\u51ED\u8BC1\u5728\u300C\u8BBE\u7F6E \u2192 zTerm \u2192 \u7BA1\u7406\u51ED\u8BC1\u300D\u4E2D\u4FDD\u5B58\uFF0C\u6B64\u5904\u65E0\u9700\u518D\u586B\u5185\u5BB9\u6216\u8DEF\u5F84\u3002"})]}),["password","key"].includes(v)&&(0,W.jsx)(_e,{title:f.authType==="key"?"\u79C1\u94A5\u5185\u5BB9":"\u5BC6\u7801",children:f.authType==="key"?(0,W.jsx)("textarea",{rows:5,value:n,placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9",onChange:C=>d(C.target.value),spellCheck:!1,required:!y}):(0,W.jsx)("input",{type:"password",value:n,autoComplete:"new-password",placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:C=>d(C.target.value),required:!y})}),v==="key-file"&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_e,{title:"\u79C1\u94A5\u6587\u4EF6\u8DEF\u5F84",children:(0,W.jsx)("input",{value:f.privateKeyPath,placeholder:"\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6",onChange:C=>x("privateKeyPath",C.target.value)})}),(0,W.jsx)("p",{className:"zt-hint",children:"\u586B\u5199 DSH \u5BBF\u4E3B\u4E0A\u7684\u7EDD\u5BF9\u8DEF\u5F84\u6216 ~/ \u8DEF\u5F84\u3002DSH \u90E8\u7F72\u5728\u8FDC\u7AEF\u65F6\uFF0C\u586B\u5199\u8FDC\u7AEF\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})]}),["key","key-file"].includes(v)&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_e,{title:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09",children:(0,W.jsx)("input",{type:"password",disabled:i,value:_,placeholder:"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4",onChange:C=>h(C.target.value)})}),R?.passphraseRef&&(0,W.jsxs)("label",{className:"zt-check",children:[(0,W.jsx)("input",{type:"checkbox",checked:i,onChange:C=>t(C.target.checked)}),"\u79FB\u9664\u6B64\u4E3B\u673A\u7684\u79C1\u94A5\u53E3\u4EE4\u5F15\u7528"]})]}),(0,W.jsx)("p",{className:"zt-hint",children:"\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u4FDD\u5B58\u5728 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u7531\u5BBF\u4E3B\u8BFB\u53D6\u3002\u6240\u6709\u65B0\u8FDE\u63A5\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\u3002"}),e&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:e}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:o,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:l,children:l?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u4E3B\u673A"})]})]})})}function jt({ctx:B,profile:R,revision:O,onClose:F,onSaved:D}){let[s,o]=(0,ce.useState)({label:R?.label??"",baseUrl:R?.baseUrl??"",authMode:R?.authMode??"access_key",username:R?.username??"",verifyTls:R?.verifyTls??!0}),[c,f]=(0,ce.useState)(""),[a,n]=(0,ce.useState)(""),[d,_]=(0,ce.useState)(""),[h,i]=(0,ce.useState)(!1);return(0,W.jsx)(Fe,{title:R?"\u7F16\u8F91 JumpServer":"\u6DFB\u52A0 JumpServer",onClose:F,children:(0,W.jsxs)("form",{onSubmit:t=>{t.preventDefault(),i(!0),_(""),ie(B,"jump/save",{profile:{...R,...s},secret:c,accessKeyId:a,revision:O}).then(()=>{f(""),n(""),D(),F()}).catch(e=>_(e.message)).finally(()=>i(!1))},children:[(0,W.jsx)(_e,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:s.label,onChange:t=>o({...s,label:t.target.value})})}),(0,W.jsx)(_e,{title:"\u670D\u52A1\u5730\u5740",children:(0,W.jsx)("input",{required:!0,type:"url",value:s.baseUrl,placeholder:"https://jump.example.com",onChange:t=>o({...s,baseUrl:t.target.value})})}),(0,W.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:s.authMode,onChange:t=>o({...s,authMode:t.target.value}),children:[(0,W.jsx)("option",{value:"access_key",children:"Access Key"}),(0,W.jsx)("option",{value:"token",children:"Token"}),(0,W.jsx)("option",{value:"password",children:"\u8D26\u53F7\u5BC6\u7801"})]})}),s.authMode==="access_key"&&(0,W.jsx)(_e,{title:"Access Key ID",children:(0,W.jsx)("input",{type:"password",value:a,placeholder:R?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>n(t.target.value)})}),s.authMode==="password"&&(0,W.jsx)(_e,{title:"\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:s.username,onChange:t=>o({...s,username:t.target.value})})}),(0,W.jsx)(_e,{title:s.authMode==="access_key"?"Access Key Secret":s.authMode==="token"?"Token":"\u5BC6\u7801",children:(0,W.jsx)("input",{type:"password",value:c,placeholder:R?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>f(t.target.value)})}),(0,W.jsxs)("label",{className:"zt-check",children:[(0,W.jsx)("input",{type:"checkbox",checked:s.verifyTls,onChange:t=>o({...s,verifyTls:t.target.checked})}),"\u9A8C\u8BC1 TLS \u8BC1\u4E66"]}),(0,W.jsx)("p",{className:"zt-hint",children:"\u8FDE\u63A5\u4F7F\u7528\u8D44\u4EA7\u4E0E\u8D26\u53F7\u7684\u7A33\u5B9A ID\uFF0C\u4EE4\u724C\u4EC5\u5728\u5BBF\u4E3B\u5185\u90E8\u5904\u7406\u3002"}),d&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:d}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:F,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:h,children:h?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u5B9E\u4F8B"})]})]})})}function Kt({ctx:B,folder:R,folders:O,revision:F,onClose:D,onSaved:s}){let[o,c]=(0,ce.useState)(R?.label??""),[f,a]=(0,ce.useState)(R?.parentId??""),[n,d]=(0,ce.useState)(""),[_,h]=(0,ce.useState)(!1),i=new Set;if(R){i.add(R.id);for(let t of Ye(O))t.parentId&&i.has(t.parentId)&&i.add(t.id)}return(0,W.jsx)(Fe,{title:R?"\u7F16\u8F91\u4E3B\u673A\u6587\u4EF6\u5939":"\u65B0\u5EFA\u4E3B\u673A\u6587\u4EF6\u5939",onClose:D,children:(0,W.jsxs)("form",{onSubmit:t=>{t.preventDefault(),h(!0),ie(B,"folder/save",{folder:{id:R?.id,label:o,parentId:f||void 0},revision:F}).then(()=>{s(),D()}).catch(e=>d(e.message)).finally(()=>h(!1))},children:[(0,W.jsx)(_e,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:o,onChange:t=>c(t.target.value)})}),(0,W.jsx)(_e,{title:"\u7236\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:f,onChange:t=>a(t.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).filter(t=>!i.has(t.id)).map(t=>(0,W.jsxs)("option",{value:t.id,children:["\u3000".repeat(Math.min(8,t.depth)),t.label]},t.id))]})}),n&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:n}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:D,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{disabled:_,className:"zt-primary",children:_?"\u4FDD\u5B58\u4E2D\u2026":R?"\u4FDD\u5B58":"\u521B\u5EFA"})]})]})})}var Ae=require("react");var Me=require("react/jsx-runtime");function qt({ctx:B,instanceId:R,nodes:O,selected:F,onSelect:D,onError:s}){let[o,c]=(0,Ae.useState)(new Map),[f,a]=(0,Ae.useState)(new Set),[n,d]=(0,Ae.useState)(new Set),_=(0,Ae.useRef)(!0),h=(0,Ae.useRef)(new AbortController);(0,Ae.useEffect)(()=>()=>{_.current=!1,h.current.abort()},[]);let i=async l=>{if(f.has(l.nodeId)){a(p=>{let v=new Set(p);return v.delete(l.nodeId),v});return}if(!o.has(l.nodeId)){d(p=>new Set(p).add(l.nodeId));try{let p=await ie(B,"jump/query",{instanceId:R,operation:"nodes",parentKey:l.key||l.nodeId},h.current.signal);if(!_.current)return;c(v=>new Map(v).set(l.nodeId,p.nodes??[]))}catch(p){_.current&&s(p.message);return}finally{_.current&&d(p=>{let v=new Set(p);return v.delete(l.nodeId),v})}}a(p=>new Set(p).add(l.nodeId))},t=O.slice().reverse().map(l=>({node:l,depth:0})),e=[],r=new Set;for(;t.length&&e.length<500;){let l=t.pop();if(!r.has(l.node.nodeId)&&(r.add(l.node.nodeId),e.push(l),f.has(l.node.nodeId)))for(let p of(o.get(l.node.nodeId)??[]).slice().reverse())t.push({node:p,depth:l.depth+1})}return(0,Me.jsxs)("nav",{className:"zt-folder-tree","aria-label":"JumpServer \u8D44\u4EA7\u8282\u70B9",children:[(0,Me.jsx)("button",{className:F?"":"active",onClick:()=>D(""),children:"\u25A4 \u5168\u90E8\u8D44\u4EA7"}),e.map(({node:l,depth:p})=>(0,Me.jsxs)("div",{style:{paddingLeft:Math.min(8,p)*12},children:[(0,Me.jsx)("button",{className:"zt-folder-toggle",disabled:!l.hasChildren||n.has(l.nodeId),"aria-label":`\u5C55\u5F00\u8D44\u4EA7\u8282\u70B9 ${l.name}`,onClick:()=>void i(l),children:n.has(l.nodeId)?"\u2026":l.hasChildren?f.has(l.nodeId)?"\u25BE":"\u25B8":"\xB7"}),(0,Me.jsxs)("button",{className:F===l.nodeId?"active":"",onClick:()=>D(l.nodeId),title:l.name,children:[l.name," (",l.assetCount,")"]})]},l.nodeId)),t.length>0&&(0,Me.jsx)("p",{className:"zt-hint",children:"\u8282\u70B9\u663E\u793A\u5DF2\u8FBE 500 \u9879\uFF0C\u8BF7\u6536\u8D77\u90E8\u5206\u8282\u70B9\u3002"})]})}var Ne=require("react");var dt=require("react/jsx-runtime");function wt({children:B,label:R,storageKey:O}){let F=(0,Ne.useRef)(null),D=Ve(),[s,o]=(0,Ne.useState)(()=>ze(O,165,56,Number.MAX_SAFE_INTEGER)),[c,f]=(0,Ne.useState)(165);(0,Ne.useLayoutEffect)(()=>{let i=F.current?.parentElement;if(!i)return;let t=()=>f(Math.max(8,i.clientHeight-120));t();let e=new ResizeObserver(t);return e.observe(i),()=>e.disconnect()},[]);let a=Math.min(56,c),n=Math.max(a,Math.min(c,s)),d=i=>{let t=Math.max(a,Math.min(c,Math.round(i)));o(t),Pe(O,t)};return(0,dt.jsxs)("div",{ref:F,className:"zt-tree-pane",style:{height:n},children:[B,(0,dt.jsx)("div",{className:"zt-tree-handle",role:"separator","aria-label":R,"aria-orientation":"horizontal",tabIndex:0,"aria-valuemin":a,"aria-valuemax":c,"aria-valuenow":n,onMouseDown:i=>{if(i.button!==0)return;let t=i.clientY,e=F.current?.getBoundingClientRect().height??n;D(i,r=>d(e+r.clientY-t))},onKeyDown:i=>{let t;if(i.key==="ArrowUp")t=n-10;else if(i.key==="ArrowDown")t=n+10;else if(i.key==="Home")t=a;else if(i.key==="End")t=c;else return;i.preventDefault(),d(t)}})]})}var M=require("react/jsx-runtime"),Vt={terminals:[],operations:[],revision:0,capabilities:{local:!1,external:!1},hostPlatform:""},Gt={connecting:"\u8FDE\u63A5\u4E2D",ready:"\u5DF2\u8FDE\u63A5",disconnected:"\u5DF2\u65AD\u5F00",error:"\u8FDE\u63A5\u5931\u8D25",executing:"\u6267\u884C\u4E2D",completed:"\u5B8C\u6210",failed:"\u5931\u8D25",unknown:"\u7ED3\u679C\u4E0D\u660E",blocked:"\u5DF2\u62D2\u7EDD",not_sent:"\u672A\u4E0B\u53D1"},ut=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`page-${Date.now()}-${Math.random()}`;function yt({ctx:B,sessionId:R,visible:O=!0,onClose:F}){let[D,s]=(0,ee.useState)(Vt),[o,c]=(0,ee.useState)(new Map),[f,a]=(0,ee.useState)(""),[n,d]=(0,ee.useState)(""),[_,h]=(0,ee.useState)(),[i,t]=(0,ee.useState)(""),[e,r]=(0,ee.useState)(0),[l,p]=(0,ee.useState)(""),[v,g]=(0,ee.useState)("ssh"),[u,m]=(0,ee.useState)(!1),[y,x]=(0,ee.useState)(!1),[C,w]=(0,ee.useState)(!1),[A,P]=(0,ee.useState)(""),[U,q]=(0,ee.useState)(""),[$,b]=(0,ee.useState)([]),[E,k]=(0,ee.useState)(),[L,H]=(0,ee.useState)(),[K,X]=(0,ee.useState)(),[Z,T]=(0,ee.useState)(!1),[S,z]=(0,ee.useState)(!1),[N,V]=(0,ee.useState)(()=>ze("dsh-zterm.list-width",240,180,440)),[j,te]=(0,ee.useState)(!1),[ne,oe]=(0,ee.useState)(!1),[fe,J]=(0,ee.useState)(),Ce=(0,ee.useRef)(!0),We=(0,ee.useRef)(O),Be=(0,ee.useRef)(-1),Ue=(0,ee.useRef)(async()=>{}),Ie=(0,ee.useRef)(f),me=(0,ee.useRef)(0),ke=(0,ee.useRef)(0),we=(0,ee.useRef)(null),Te=(0,ee.useRef)(null),Ge=Ve();We.current=O,Ie.current=f;let se=(0,ee.useCallback)(I=>d(I),[]);(0,ee.useEffect)(()=>{Ce.current=!0,s(Vt),c(new Map),Be.current=-1;let I=!1,re=!1,he,Oe,je=new AbortController,ii=async()=>{try{re||(await ie(B,"client/attach",{sessionId:R,pageId:ut},je.signal),re=!0);let De=await ie(B,"poll",{sessionId:R,cursor:Be.current},je.signal);if(I)return;Be.current=De.cursor,s(De.workspace),c(_t=>Lt(_t,De)),De.workspace.terminals.some(_t=>_t.id===Ie.current)||a(De.workspace.terminals[0]?.id??"")}catch(De){I||d(De instanceof Error?De.message:"\u65E0\u6CD5\u8BFB\u53D6\u7EC8\u7AEF\u72B6\u6001")}},Et=()=>Oe||(Oe=ii().finally(()=>{Oe=void 0}),Oe),kt=async()=>{await Et(),I||(he=setTimeout(kt,We.current?200:1e3))};return Ue.current=Et,kt(),ie(B,"saved-workspace",{sessionId:R}).then(De=>{I||oe(De.length>0)}).catch(()=>{}),()=>{I=!0,Ce.current=!1,clearTimeout(he),je.abort()}},[B,R]);let ye=(0,ee.useCallback)(async I=>{let re=++me.current,he=await ie(B,"catalog",{query:i,offset:e,folderId:l||void 0},I);I?.aborted||re!==me.current||!Ce.current||(h(he),!A&&he.jumpservers.length&&P(he.jumpservers[0].id))},[B,i,e,l,A]);(0,ee.useEffect)(()=>{let I=new AbortController,re=setTimeout(()=>{ye(I.signal).catch(he=>{I.signal.aborted||se(he.message)})},150);return()=>{clearTimeout(re),I.abort()}},[ye,se,D.catalogRevision]);let le=(0,ee.useCallback)(async(I,re={})=>{te(!0),d("");try{let he=await ie(B,I,{sessionId:R,pageId:ut,...re});if(Ce.current)return await Ue.current(),he}catch(he){Ce.current&&se(he instanceof Error?he.message:"\u64CD\u4F5C\u5931\u8D25")}finally{Ce.current&&te(!1)}},[B,R,se]),Le=async I=>{let re=await le("connect",{target:I});re?.id&&a(re.id)};(0,ee.useEffect)(()=>{if(!O||!we.current)return;let I=()=>Te.current?.scrollIntoView({block:"nearest",inline:"nearest"});I();let re=new ResizeObserver(I);return re.observe(we.current),()=>re.disconnect()},[f,O,D.terminals.length]);let Y=D.terminals.find(I=>I.id===f),xe=D.binding,Ze=Y&&xe?.terminalId===Y.id&&xe.generation===Y.generation,ve=D.terminals.find(I=>I.trust),$e=ve?{terminalId:ve.id,generation:ve.generation}:{},Qe=I=>I.target.source==="local"?I.target.label:`${I.target.username??""}@${I.target.host??I.target.label}${I.target.port?`:${I.target.port}`:""}`,Je=Y?{terminalId:Y.id,generation:Y.generation}:{},et=_?.jumpservers?.find(I=>I.id===A);(0,ee.useEffect)(()=>{if(v!=="jumpserver"||!A)return;let I=!0;return b([]),ie(B,"jump/query",{instanceId:A,operation:"nodes"}).then(re=>{I&&b(re.nodes??[])}).catch(re=>{I&&se(re.message)}),()=>{I=!1}},[B,A,v,se]),(0,ee.useEffect)(()=>{if(v!=="jumpserver"||!A)return;let I=!0;k(void 0);let re=setTimeout(()=>{ie(B,"jump/query",{instanceId:A,operation:"assets",nodeId:U||void 0,query:i,offset:e,limit:100}).then(he=>{I&&k(he)}).catch(he=>{I&&se(he.message)})},200);return()=>{I=!1,clearTimeout(re)}},[B,A,U,i,e,v,se]),(0,ee.useEffect)(()=>{ke.current++,H(void 0)},[A,v]);let ei=async I=>{let re=++ke.current;X(I),H(void 0);try{let he=await ie(B,"jump/query",{instanceId:A,operation:"accounts",assetId:I.assetId});re===ke.current&&Ce.current&&H(he.accounts)}catch(he){re===ke.current&&Ce.current&&se(he.message)}},ti=I=>{let re=I.clientX,he=N;Ge(I,Oe=>{let je=Math.max(180,Math.min(440,he+re-Oe.clientX));V(je),Pe("dsh-zterm.list-width",je)})};return(0,M.jsxs)("div",{className:"zt-workbench",children:[_?.temporarilyDisabled&&(0,M.jsx)("div",{className:"zt-workbench-notice",role:"status",children:"zTerm \u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230\u672C\u63D2\u4EF6\u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\uFF1B\u624B\u5DE5\u8FDE\u63A5\u3001\u7EC8\u7AEF\u548C\u914D\u7F6E\u7BA1\u7406\u4ECD\u53EF\u4F7F\u7528\u3002\u53EF\u5728\u300C\u8BBE\u7F6E \u2192 zTerm\u300D\u6062\u590D\u3002"}),n&&(0,M.jsxs)("div",{className:"zt-error-banner",role:"alert",children:[(0,M.jsx)("span",{children:n}),(0,M.jsx)("button",{"aria-label":"\u5173\u95ED\u9519\u8BEF\u63D0\u793A",onClick:()=>d(""),children:"\xD7"})]}),(0,M.jsxs)("div",{className:"zt-workbench-body",children:[(0,M.jsxs)("main",{className:"zt-terminal-area",children:[(0,M.jsxs)("div",{className:"zt-terminal-topbar",children:[(0,M.jsx)("nav",{ref:we,className:"zt-terminal-tabs","aria-label":"\u7EC8\u7AEF\u6807\u7B7E",children:D.terminals.map(I=>(0,M.jsxs)("div",{ref:I.id===f?Te:void 0,className:`zt-tab ${I.id===f?"active":""}`,children:[(0,M.jsxs)("button",{onClick:()=>a(I.id),title:Qe(I),children:[(0,M.jsx)("i",{className:`zt-state-dot ${I.state}`}),I.target.label]}),(0,M.jsx)("button",{"aria-label":`\u5173\u95ED\u7EC8\u7AEF ${I.target.label}`,onClick:()=>J({text:`\u5173\u95ED\u300C${I.target.label}\u300D\u7684\u7EC8\u7AEF\u8FDE\u63A5\uFF1F`,act:()=>{le("close",{terminalId:I.id}),J(void 0)}}),children:"\xD7"})]},I.id))}),(0,M.jsxs)("div",{className:"zt-terminal-controls",children:[(0,M.jsx)("button",{disabled:!D.capabilities.local||j,title:D.capabilities.local?"\u6BCF\u6B21\u70B9\u51FB\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\uFF0C\u8FD0\u884C\u5728 DSH \u6240\u5728\u7684\u673A\u5668\u4E0A":`\u8BF7\u5728 ${ae} \u8BBE\u7F6E\u4E2D\u542F\u7528\u672C\u5730\u7EC8\u7AEF\u5E76\u4FDD\u5B58`,onClick:()=>void Le({kind:"local"}),children:"\u6253\u5F00\u672C\u673A\u7EC8\u7AEF"}),(0,M.jsx)("button",{title:"\u64CD\u4F5C\u8BB0\u5F55",onClick:()=>T(!Z),children:"\u8BB0\u5F55"}),S&&(0,M.jsx)("button",{title:"\u663E\u793A\u673A\u5668\u5217\u8868","aria-expanded":!1,onClick:()=>z(!1),children:"\u673A\u5668\u5217\u8868"}),F&&(0,M.jsx)("button",{"aria-label":`\u6536\u8D77 ${ae}`,onClick:F,children:"\xD7"})]})]}),Y?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)("div",{className:"zt-terminal-toolbar",children:[(0,M.jsxs)("div",{className:"zt-target",title:Qe(Y),children:[Qe(Y),(0,M.jsxs)("span",{children:[Gt[Y.state],Y.busy?" \xB7 AI \u6267\u884C\u4E2D":""]})]}),(0,M.jsxs)("div",{className:"zt-actions",children:[(0,M.jsx)("button",{disabled:j||Y.state!=="ready"||!Y.agentReady||Y.uncertain,onClick:()=>void le("bind",Je),children:Ze?"\u5DF2\u7ED1\u5B9A AI":"\u7ED1\u5B9A AI"}),(0,M.jsxs)("label",{className:`zt-mode ${Ze&&xe.mode==="readwrite"?"write":""}`,title:"\u672A\u52FE\u9009\uFF1A\u8BFB\u6A21\u5F0F\uFF0CAI \u4EC5\u53EF\u4F7F\u7528\u5185\u7F6E\u67E5\u8BE2\u5DE5\u5177\uFF1B\u52FE\u9009\uFF1A\u8BFB\u5199\u6A21\u5F0F\uFF0CAI \u53EF\u6267\u884C\u5DF2\u6388\u6743\u7684\u547D\u4EE4\u3002",children:[(0,M.jsx)("input",{type:"checkbox","aria-label":"\u5141\u8BB8AI\u5199\u64CD\u4F5C",checked:!!(Ze&&xe.mode==="readwrite"),disabled:!Ze||j||!Y.agentReady||Y.uncertain,onChange:I=>void le("mode",{...Je,mode:I.target.checked?"readwrite":"read"})}),"\u5141\u8BB8AI\u5199\u64CD\u4F5C"]}),(0,M.jsx)("button",{disabled:!Y.busy,onClick:()=>void le("stop",Je),children:"\u505C\u6B62"}),(0,M.jsx)("button",{disabled:j||Y.busy,onClick:()=>void le(Y.state==="ready"?"disconnect":"reconnect",Je),children:Y.state==="ready"?"\u65AD\u5F00":"\u91CD\u8FDE"})]})]}),!Y.agentReady&&Y.state==="ready"&&!Y.uncertain&&(0,M.jsxs)("div",{className:"zt-notice",children:["\u624B\u5DE5\u8F93\u5165\u540E\uFF0CAI \u5DF2\u6682\u505C\u64CD\u4F5C\u3002\u786E\u8BA4\u7EC8\u7AEF\u56DE\u5230\u7A7A\u95F2 Shell \u540E\uFF1A",(0,M.jsx)("button",{onClick:()=>void le("shell-ready",Je),children:"\u786E\u8BA4\u7A7A\u95F2 Shell"})]}),Y.uncertain&&(0,M.jsx)("div",{className:"zt-notice danger",children:"\u524D\u6B21\u64CD\u4F5C\u7ED3\u679C\u4E0D\u660E\uFF0C\u5DF2\u505C\u6B62\u81EA\u52A8\u4E0B\u53D1\u3002\u6838\u5B9E\u673A\u5668\u72B6\u6001\u540E\u91CD\u65B0\u5EFA\u7ACB\u8FDE\u63A5\u3002"}),Y.error&&(0,M.jsx)("div",{className:"zt-notice danger",children:Y.error})]}):(0,M.jsxs)("div",{className:"zt-empty",children:[(0,M.jsx)("div",{className:"zt-terminal-mark",children:">_"}),(0,M.jsx)("h3",{children:"\u8FDE\u63A5\u4E00\u53F0\u673A\u5668"}),(0,M.jsxs)("p",{children:["\u4ECE\u53F3\u4FA7\u9009\u62E9\u4E3B\u673A\u6216 JumpServer \u8D44\u4EA7\u3002",(0,M.jsx)("br",{}),"\u8FDE\u63A5\u540E\u53EF\u624B\u5DE5\u64CD\u4F5C\uFF0C\u6216\u7ED1\u5B9A\u7ED9\u5F53\u524D DSH \u5BF9\u8BDD\u4E2D\u7684 AI\u3002"]}),D.capabilities.automatic&&(0,M.jsx)("p",{children:"\u4E5F\u53EF\u5728\u5BF9\u8BDD\u4E2D\u6307\u5B9A\u4E3B\u673A\u540D\u6216 IP\uFF0CAI \u4F1A\u5148\u67E5\u8FDC\u7A0B\u4E3B\u673A\uFF0C\u518D\u67E5 JumpServer\uFF0C\u6700\u540E\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u3002"}),(0,M.jsx)("button",{className:"zt-primary",onClick:()=>m(null),children:"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A"}),ne&&(0,M.jsx)("button",{onClick:()=>void le("restore"),children:"\u6062\u590D\u4E0A\u6B21\u7EC8\u7AEF\u5217\u8868\uFF08\u9ED8\u8BA4\u53EA\u8BFB\uFF09"})]}),(0,M.jsx)("div",{className:"zt-screens",children:D.terminals.map(I=>(0,M.jsx)(Wt,{ctx:B,sessionId:R,terminal:I,buffer:o.get(I.id),visible:O&&I.id===f,onError:se},`${I.id}:${I.generation}`))}),(0,M.jsxs)("footer",{className:"zt-statusbar",children:[(0,M.jsxs)("div",{className:"zt-status-info",children:[(0,M.jsx)("span",{children:xe?`AI \u7ED1\u5B9A\uFF1A${D.terminals.find(I=>I.id===xe.terminalId)?.target.label??xe.terminalId} \xB7 ${xe.mode==="readwrite"?`\u8BFB\u5199 ${xe.writeCalls}/${xe.maxWriteCalls}`:"\u53EA\u8BFB"}`:"AI \u5C1A\u672A\u7ED1\u5B9A\u7EC8\u7AEF"}),(0,M.jsxs)("span",{className:"zt-host-platform",title:"\u7EC8\u7AEF\u8FDE\u63A5\u4E0E\u547D\u4EE4\u4ECE DSH \u5BBF\u4E3B\u53D1\u8D77",children:["DSH \u5BBF\u4E3B \xB7 ",D.hostPlatform||"\u6B63\u5728\u8FDE\u63A5"]})]}),Y&&(0,M.jsx)("button",{onClick:()=>{ie(B,"terminal/export",{sessionId:R,terminalId:Y.id}).then(I=>it(`zterm-${rt()}-\u7EC8\u7AEF.txt`,`\u7EC8\u7AEF\uFF1A${Qe(Y)}
|
|
8
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),t.isLinux&&u&&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(u){let m=this._getMouseBufferCoords(u),y=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!!(y&&x&&m)&&this._areCoordsInSelection(m,y,x)}isCellInSelection(u,m){let y=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!y||!x)&&this._areCoordsInSelection([u,m],y,x)}_areCoordsInSelection(u,m,y){return u[1]>m[1]&&u[1]<y[1]||m[1]===y[1]&&u[1]===m[1]&&u[0]>=m[0]&&u[0]<y[0]||m[1]<y[1]&&u[1]===y[1]&&u[0]<y[0]||m[1]<y[1]&&u[1]===m[1]&&u[0]>=m[0]}_selectWordAtCursor(u,m){let y=this._linkifier.currentLink?.link?.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let x=this._getMouseBufferCoords(u);return!!x&&(this._selectWordAt(x,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,m){this._model.clearSelection(),u=Math.max(u,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){let m=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(u){let m=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1],y=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=y?0:(m>y&&(m-=y),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(u){return t.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),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(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){let m=this._getMouseBufferCoords(u);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(u){return u.altKey&&!(t.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;let m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!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(u),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let y=this._bufferService.buffer;if(this._model.selectionEnd[1]<y.lines.length){let x=y.lines.get(this._model.selectionEnd[1]);x&&x.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[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 u=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(u.ydisp+this._bufferService.rows,u.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=u.ydisp),this.refresh()}}_handleMouseUp(u){let m=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let y=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(y&&y[0]!==void 0&&y[1]!==void 0){let x=(0,n.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,y=!(!u||!m||u[0]===m[0]&&u[1]===m[1]);y?u&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,m,y)):this._oldHasSelection&&this._fireOnSelectionChange(u,m,y)}_fireOnSelectionChange(u,m,y){this._oldSelectionStart=u,this._oldSelectionEnd=m,this._oldHasSelection=y,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim((m=>this._handleTrim(m)))}_convertViewportColToCharacterIndex(u,m){let y=m;for(let x=0;m>=x;x++){let S=u.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:S>1&&m!==x&&(y+=S-1)}return y}setSelection(u,m,y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,m],this._model.selectionStartLength=y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,m,y=!0,x=!0){if(u[0]>=this._bufferService.cols)return;let S=this._bufferService.buffer,w=S.lines.get(u[1]);if(!w)return;let A=S.translateBufferLineToString(u[1],!1),z=this._convertViewportColToCharacterIndex(w,u[0]),U=z,q=u[0]-z,$=0,b=0,E=0,k=0;if(A.charAt(z)===" "){for(;z>0&&A.charAt(z-1)===" ";)z--;for(;U<A.length&&A.charAt(U+1)===" ";)U++}else{let K=u[0],Y=u[0];w.getWidth(K)===0&&($++,K--),w.getWidth(Y)===2&&(b++,Y++);let Z=w.getString(Y).length;for(Z>1&&(k+=Z-1,U+=Z-1);K>0&&z>0&&!this._isCharWordSeparator(w.loadCell(K-1,this._workCell));){w.loadCell(K-1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,K--):M>1&&(E+=M-1,z-=M-1),z--,K--}for(;Y<w.length&&U+1<A.length&&!this._isCharWordSeparator(w.loadCell(Y+1,this._workCell));){w.loadCell(Y+1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):M>1&&(k+=M-1,U+=M-1),U++,Y++}}U++;let D=z+q-$+E,P=Math.min(this._bufferService.cols,U-z+$+b-E-k);if(m||A.slice(z,U).trim()!==""){if(y&&D===0&&w.getCodePoint(0)!==32){let K=S.lines.get(u[1]-1);if(K&&w.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let Y=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(Y){let Z=this._bufferService.cols-Y.start;D-=Z,P+=Z}}}if(x&&D+P===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){let K=S.lines.get(u[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(P+=Y.length)}}return{start:D,length:P}}}_selectWordAt(u,m){let y=this._getWordAt(u,m);if(y){for(;y.start<0;)y.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[y.start,u[1]],this._model.selectionStartLength=y.length}}_selectToWordAt(u){let m=this._getWordAt(u,!0);if(m){let y=u[1];for(;m.start<0;)m.start+=this._bufferService.cols,y--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,y]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){let m=this._bufferService.buffer.getWrappedRangeForLine(u),y={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols)}};s.SelectionService=g=c([f(3,l.IBufferService),f(4,l.ICoreService),f(5,_.IMouseService),f(6,l.IOptionsService),f(7,_.IRenderService),f(8,_.ICoreBrowserService)],g)},4725:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;let c=o(8343);s.ICharSizeService=(0,c.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),s.IMouseService=(0,c.createDecorator)("MouseService"),s.IRenderService=(0,c.createDecorator)("RenderService"),s.ISelectionService=(0,c.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,c.createDecorator)("ThemeService"),s.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(L,s,o){var c=this&&this.__decorate||function(g,u,m,y){var x,S=arguments.length,w=S<3?u:y===null?y=Object.getOwnPropertyDescriptor(u,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(g,u,m,y);else for(var A=g.length-1;A>=0;A--)(x=g[A])&&(w=(S<3?x(w):S>3?x(u,m,w):x(u,m))||w);return S>3&&w&&Object.defineProperty(u,m,w),w},f=this&&this.__param||function(g,u){return function(m,y){u(m,y,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let a=o(7239),n=o(8055),d=o(8460),_=o(844),h=o(2585),i=n.css.toColor("#ffffff"),t=n.css.toColor("#000000"),e=n.css.toColor("#ffffff"),r=n.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let g=[n.css.toColor("#2e3436"),n.css.toColor("#cc0000"),n.css.toColor("#4e9a06"),n.css.toColor("#c4a000"),n.css.toColor("#3465a4"),n.css.toColor("#75507b"),n.css.toColor("#06989a"),n.css.toColor("#d3d7cf"),n.css.toColor("#555753"),n.css.toColor("#ef2929"),n.css.toColor("#8ae234"),n.css.toColor("#fce94f"),n.css.toColor("#729fcf"),n.css.toColor("#ad7fa8"),n.css.toColor("#34e2e2"),n.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let m=0;m<216;m++){let y=u[m/36%6|0],x=u[m/6%6|0],S=u[m%6];g.push({css:n.channels.toCss(y,x,S),rgba:n.channels.toRgba(y,x,S)})}for(let m=0;m<24;m++){let y=8+10*m;g.push({css:n.channels.toCss(y,y,y),rgba:n.channels.toRgba(y,y,y)})}return g})());let v=s.ThemeService=class extends _.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new d.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:t,cursor:e,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:l,selectionBackgroundOpaque:n.color.blend(t,l),selectionInactiveBackgroundTransparent:l,selectionInactiveBackgroundOpaque:n.color.blend(t,l),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(g={}){let u=this._colors;if(u.foreground=p(g.foreground,i),u.background=p(g.background,t),u.cursor=p(g.cursor,e),u.cursorAccent=p(g.cursorAccent,r),u.selectionBackgroundTransparent=p(g.selectionBackground,l),u.selectionBackgroundOpaque=n.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=p(g.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=n.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=g.selectionForeground?p(g.selectionForeground,n.NULL_COLOR):void 0,u.selectionForeground===n.NULL_COLOR&&(u.selectionForeground=void 0),n.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=n.color.opacity(u.selectionBackgroundTransparent,.3)),n.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=n.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=s.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=p(g.black,s.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=p(g.red,s.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=p(g.green,s.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=p(g.yellow,s.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=p(g.blue,s.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=p(g.magenta,s.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=p(g.cyan,s.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=p(g.white,s.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=p(g.brightBlack,s.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=p(g.brightRed,s.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=p(g.brightGreen,s.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=p(g.brightYellow,s.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=p(g.brightBlue,s.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=p(g.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=p(g.brightCyan,s.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=p(g.brightWhite,s.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){let m=Math.min(u.ansi.length-16,g.extendedAnsi.length);for(let y=0;y<m;y++)u.ansi[y+16]=p(g.extendedAnsi[y],s.DEFAULT_ANSI_COLORS[y+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(g){this._restoreColor(g),this._onChangeColors.fire(this.colors)}_restoreColor(g){if(g!==void 0)switch(g){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[g]=this._restoreColors.ansi[g]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(g){g(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 p(g,u){if(g!==void 0)try{return n.css.toColor(g)}catch{}return u}s.ThemeService=v=c([f(0,h.IOptionsService)],v)},6349:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let c=o(8460),f=o(844);class a extends f.Disposable{constructor(d){super(),this._maxLength=d,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.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(d){if(this._maxLength===d)return;let _=new Array(d);for(let h=0;h<Math.min(d,this.length);h++)_[h]=this._array[this._getCyclicIndex(h)];this._array=_,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let _=this._length;_<d;_++)this._array[_]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,_){this._array[this._getCyclicIndex(d)]=_}push(d){this._array[this._getCyclicIndex(this._length)]=d,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(d,_,...h){if(_){for(let i=d;i<this._length-_;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+_)];this._length-=_,this.onDeleteEmitter.fire({index:d,amount:_})}for(let i=this._length-1;i>=d;i--)this._array[this._getCyclicIndex(i+h.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<h.length;i++)this._array[this._getCyclicIndex(d+i)]=h[i];if(h.length&&this.onInsertEmitter.fire({index:d,amount:h.length}),this._length+h.length>this._maxLength){let i=this._length+h.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=h.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,_,h){if(!(_<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+h<0)throw new Error("Cannot shift elements in list beyond index 0");if(h>0){for(let t=_-1;t>=0;t--)this.set(d+t+h,this.get(d+t));let i=d+_+h-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<_;i++)this.set(d+i+h,this.get(d+i))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}s.CircularList=a},1439:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(c,f=5){if(typeof c!="object")return c;let a=Array.isArray(c)?[]:{};for(let n in c)a[n]=f<=1?c[n]:c[n]&&o(c[n],f-1);return a}},8055:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,c=0,f=0,a=0;var n,d,_,h,i;function t(r){let l=r.toString(16);return l.length<2?"0"+l:l}function e(r,l){return r<l?(l+.05)/(r+.05):(r+.05)/(l+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(l,v,p,g){return g!==void 0?`#${t(l)}${t(v)}${t(p)}${t(g)}`:`#${t(l)}${t(v)}${t(p)}`},r.toRgba=function(l,v,p,g=255){return(l<<24|v<<16|p<<8|g)>>>0},r.toColor=function(l,v,p,g){return{css:r.toCss(l,v,p,g),rgba:r.toRgba(l,v,p,g)}}})(n||(s.channels=n={})),(function(r){function l(v,p){return a=Math.round(255*p),[o,c,f]=i.toChannels(v.rgba),{css:n.toCss(o,c,f,a),rgba:n.toRgba(o,c,f,a)}}r.blend=function(v,p){if(a=(255&p.rgba)/255,a===1)return{css:p.css,rgba:p.rgba};let g=p.rgba>>24&255,u=p.rgba>>16&255,m=p.rgba>>8&255,y=v.rgba>>24&255,x=v.rgba>>16&255,S=v.rgba>>8&255;return o=y+Math.round((g-y)*a),c=x+Math.round((u-x)*a),f=S+Math.round((m-S)*a),{css:n.toCss(o,c,f),rgba:n.toRgba(o,c,f)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,p,g){let u=i.ensureContrastRatio(v.rgba,p.rgba,g);if(u)return n.toColor(u>>24&255,u>>16&255,u>>8&255)},r.opaque=function(v){let p=(255|v.rgba)>>>0;return[o,c,f]=i.toChannels(p),{css:n.toCss(o,c,f),rgba:p}},r.opacity=l,r.multiplyOpacity=function(v,p){return a=255&v.rgba,l(v,a*p/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}})(d||(s.color=d={})),(function(r){let l,v;try{let p=document.createElement("canvas");p.width=1,p.height=1;let g=p.getContext("2d",{willReadFrequently:!0});g&&(l=g,l.globalCompositeOperation="copy",v=l.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(p){if(p.match(/#[\da-f]{3,8}/i))switch(p.length){case 4:return o=parseInt(p.slice(1,2).repeat(2),16),c=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),n.toColor(o,c,f);case 5:return o=parseInt(p.slice(1,2).repeat(2),16),c=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),a=parseInt(p.slice(4,5).repeat(2),16),n.toColor(o,c,f,a);case 7:return{css:p,rgba:(parseInt(p.slice(1),16)<<8|255)>>>0};case 9:return{css:p,rgba:parseInt(p.slice(1),16)>>>0}}let g=p.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return o=parseInt(g[1]),c=parseInt(g[2]),f=parseInt(g[3]),a=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),n.toColor(o,c,f,a);if(!l||!v)throw new Error("css.toColor: Unsupported css format");if(l.fillStyle=v,l.fillStyle=p,typeof l.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(l.fillRect(0,0,1,1),[o,c,f,a]=l.getImageData(0,0,1,1).data,a!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:n.toRgba(o,c,f,a),css:p}}})(_||(s.css=_={})),(function(r){function l(v,p,g){let u=v/255,m=p/255,y=g/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}r.relativeLuminance=function(v){return l(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=l})(h||(s.rgb=h={})),(function(r){function l(p,g,u){let m=p>>24&255,y=p>>16&255,x=p>>8&255,S=g>>24&255,w=g>>16&255,A=g>>8&255,z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));for(;z<u&&(S>0||w>0||A>0);)S-=Math.max(0,Math.ceil(.1*S)),w-=Math.max(0,Math.ceil(.1*w)),A-=Math.max(0,Math.ceil(.1*A)),z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));return(S<<24|w<<16|A<<8|255)>>>0}function v(p,g,u){let m=p>>24&255,y=p>>16&255,x=p>>8&255,S=g>>24&255,w=g>>16&255,A=g>>8&255,z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));for(;z<u&&(S<255||w<255||A<255);)S=Math.min(255,S+Math.ceil(.1*(255-S))),w=Math.min(255,w+Math.ceil(.1*(255-w))),A=Math.min(255,A+Math.ceil(.1*(255-A))),z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));return(S<<24|w<<16|A<<8|255)>>>0}r.blend=function(p,g){if(a=(255&g)/255,a===1)return g;let u=g>>24&255,m=g>>16&255,y=g>>8&255,x=p>>24&255,S=p>>16&255,w=p>>8&255;return o=x+Math.round((u-x)*a),c=S+Math.round((m-S)*a),f=w+Math.round((y-w)*a),n.toRgba(o,c,f)},r.ensureContrastRatio=function(p,g,u){let m=h.relativeLuminance(p>>8),y=h.relativeLuminance(g>>8);if(e(m,y)<u){if(y<m){let w=l(p,g,u),A=e(m,h.relativeLuminance(w>>8));if(A<u){let z=v(p,g,u);return A>e(m,h.relativeLuminance(z>>8))?w:z}return w}let x=v(p,g,u),S=e(m,h.relativeLuminance(x>>8));if(S<u){let w=l(p,g,u);return S>e(m,h.relativeLuminance(w>>8))?x:w}return x}},r.reduceLuminance=l,r.increaseLuminance=v,r.toChannels=function(p){return[p>>24&255,p>>16&255,p>>8&255,255&p]}})(i||(s.rgba=i={})),s.toPaddedHex=t,s.contrastRatio=e},8969:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let c=o(844),f=o(2585),a=o(4348),n=o(7866),d=o(744),_=o(7302),h=o(6975),i=o(8460),t=o(1753),e=o(1480),r=o(7994),l=o(9282),v=o(5435),p=o(5981),g=o(2660),u=!1;class m extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((x=>{this._onScrollApi?.fire(x.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(x){for(let S in x)this.optionsService.options[S]=x[S]}constructor(x){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new _.OptionsService(x)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(n.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(h.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(t.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.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((S=>{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((S=>{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 p.WriteBuffer(((S,w)=>this._inputHandler.parse(S,w)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,S){this._writeBuffer.write(x,S)}writeSync(x,S){this._logService.logLevel<=f.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(x,S)}input(x,S=!0){this.coreService.triggerDataEvent(x,S)}resize(x,S){isNaN(x)||isNaN(S)||(x=Math.max(x,d.MINIMUM_COLS),S=Math.max(S,d.MINIMUM_ROWS),this._bufferService.resize(x,S))}scroll(x,S=!1){this._bufferService.scroll(x,S)}scrollLines(x,S,w){this._bufferService.scrollLines(x,S,w)}scrollPages(x){this.scrollLines(x*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(x){let S=x-this._bufferService.buffer.ydisp;S!==0&&this.scrollLines(S)}registerEscHandler(x,S){return this._inputHandler.registerEscHandler(x,S)}registerDcsHandler(x,S){return this._inputHandler.registerDcsHandler(x,S)}registerCsiHandler(x,S){return this._inputHandler.registerCsiHandler(x,S)}registerOscHandler(x,S){return this._inputHandler.registerOscHandler(x,S)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1,S=this.optionsService.rawOptions.windowsPty;S&&S.buildNumber!==void 0&&S.buildNumber!==void 0?x=S.backend==="conpty"&&S.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let x=[];x.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},(()=>((0,l.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(let S of x)S.dispose()}))}}}s.CoreTerminal=m},8460:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o((f=>c.fire(f)))},s.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},5435:function(L,s,o){var c=this&&this.__decorate||function($,b,E,k){var D,P=arguments.length,K=P<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,E):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate($,b,E,k);else for(var Y=$.length-1;Y>=0;Y--)(D=$[Y])&&(K=(P<3?D(K):P>3?D(b,E,K):D(b,E))||K);return P>3&&K&&Object.defineProperty(b,E,K),K},f=this&&this.__param||function($,b){return function(E,k){b(E,k,$)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let a=o(2584),n=o(7116),d=o(2015),_=o(844),h=o(482),i=o(8437),t=o(8460),e=o(643),r=o(511),l=o(3734),v=o(2585),p=o(1480),g=o(6242),u=o(6351),m=o(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S($,b){if($>24)return b.setWinLines||!1;switch($){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 w;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(s.WindowsOptionsReportType=w={}));let A=0;class z extends _.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,k,D,P,K,Y,Z,M=new d.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=k,this._logService=D,this._optionsService=P,this._oscLinkService=K,this._coreMouseService=Y,this._unicodeService=Z,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new h.StringToUtf32,this._utf8Decoder=new h.Utf8ToUtf32,this._workCell=new r.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new t.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new t.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new t.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new t.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new t.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new t.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new t.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new t.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new t.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new t.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new t.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new t.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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((C=>this._activeBuffer=C.activeBuffer))),this._parser.setCsiHandlerFallback(((C,H)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(C),params:H.toArray()})})),this._parser.setEscHandlerFallback((C=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(C)})})),this._parser.setExecuteHandlerFallback((C=>{this._logService.debug("Unknown EXECUTE code: ",{code:C})})),this._parser.setOscHandlerFallback(((C,H,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:C,action:H,data:N})})),this._parser.setDcsHandlerFallback(((C,H,N)=>{H==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(C),action:H,payload:N})})),this._parser.setPrintHandler(((C,H,N)=>this.print(C,H,N))),this._parser.registerCsiHandler({final:"@"},(C=>this.insertChars(C))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(C=>this.scrollLeft(C))),this._parser.registerCsiHandler({final:"A"},(C=>this.cursorUp(C))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(C=>this.scrollRight(C))),this._parser.registerCsiHandler({final:"B"},(C=>this.cursorDown(C))),this._parser.registerCsiHandler({final:"C"},(C=>this.cursorForward(C))),this._parser.registerCsiHandler({final:"D"},(C=>this.cursorBackward(C))),this._parser.registerCsiHandler({final:"E"},(C=>this.cursorNextLine(C))),this._parser.registerCsiHandler({final:"F"},(C=>this.cursorPrecedingLine(C))),this._parser.registerCsiHandler({final:"G"},(C=>this.cursorCharAbsolute(C))),this._parser.registerCsiHandler({final:"H"},(C=>this.cursorPosition(C))),this._parser.registerCsiHandler({final:"I"},(C=>this.cursorForwardTab(C))),this._parser.registerCsiHandler({final:"J"},(C=>this.eraseInDisplay(C,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(C=>this.eraseInDisplay(C,!0))),this._parser.registerCsiHandler({final:"K"},(C=>this.eraseInLine(C,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(C=>this.eraseInLine(C,!0))),this._parser.registerCsiHandler({final:"L"},(C=>this.insertLines(C))),this._parser.registerCsiHandler({final:"M"},(C=>this.deleteLines(C))),this._parser.registerCsiHandler({final:"P"},(C=>this.deleteChars(C))),this._parser.registerCsiHandler({final:"S"},(C=>this.scrollUp(C))),this._parser.registerCsiHandler({final:"T"},(C=>this.scrollDown(C))),this._parser.registerCsiHandler({final:"X"},(C=>this.eraseChars(C))),this._parser.registerCsiHandler({final:"Z"},(C=>this.cursorBackwardTab(C))),this._parser.registerCsiHandler({final:"`"},(C=>this.charPosAbsolute(C))),this._parser.registerCsiHandler({final:"a"},(C=>this.hPositionRelative(C))),this._parser.registerCsiHandler({final:"b"},(C=>this.repeatPrecedingCharacter(C))),this._parser.registerCsiHandler({final:"c"},(C=>this.sendDeviceAttributesPrimary(C))),this._parser.registerCsiHandler({prefix:">",final:"c"},(C=>this.sendDeviceAttributesSecondary(C))),this._parser.registerCsiHandler({final:"d"},(C=>this.linePosAbsolute(C))),this._parser.registerCsiHandler({final:"e"},(C=>this.vPositionRelative(C))),this._parser.registerCsiHandler({final:"f"},(C=>this.hVPosition(C))),this._parser.registerCsiHandler({final:"g"},(C=>this.tabClear(C))),this._parser.registerCsiHandler({final:"h"},(C=>this.setMode(C))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(C=>this.setModePrivate(C))),this._parser.registerCsiHandler({final:"l"},(C=>this.resetMode(C))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(C=>this.resetModePrivate(C))),this._parser.registerCsiHandler({final:"m"},(C=>this.charAttributes(C))),this._parser.registerCsiHandler({final:"n"},(C=>this.deviceStatus(C))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(C=>this.deviceStatusPrivate(C))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(C=>this.softReset(C))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(C=>this.setCursorStyle(C))),this._parser.registerCsiHandler({final:"r"},(C=>this.setScrollRegion(C))),this._parser.registerCsiHandler({final:"s"},(C=>this.saveCursor(C))),this._parser.registerCsiHandler({final:"t"},(C=>this.windowOptions(C))),this._parser.registerCsiHandler({final:"u"},(C=>this.restoreCursor(C))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(C=>this.insertColumns(C))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(C=>this.deleteColumns(C))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(C=>this.selectProtected(C))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(C=>this.requestMode(C,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(C=>this.requestMode(C,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((C=>(this.setTitle(C),this.setIconName(C),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((C=>this.setIconName(C)))),this._parser.registerOscHandler(2,new g.OscHandler((C=>this.setTitle(C)))),this._parser.registerOscHandler(4,new g.OscHandler((C=>this.setOrReportIndexedColor(C)))),this._parser.registerOscHandler(8,new g.OscHandler((C=>this.setHyperlink(C)))),this._parser.registerOscHandler(10,new g.OscHandler((C=>this.setOrReportFgColor(C)))),this._parser.registerOscHandler(11,new g.OscHandler((C=>this.setOrReportBgColor(C)))),this._parser.registerOscHandler(12,new g.OscHandler((C=>this.setOrReportCursorColor(C)))),this._parser.registerOscHandler(104,new g.OscHandler((C=>this.restoreIndexedColor(C)))),this._parser.registerOscHandler(110,new g.OscHandler((C=>this.restoreFgColor(C)))),this._parser.registerOscHandler(111,new g.OscHandler((C=>this.restoreBgColor(C)))),this._parser.registerOscHandler(112,new g.OscHandler((C=>this.restoreCursorColor(C)))),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 C in n.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:C},(()=>this.selectCharset("("+C))),this._parser.registerEscHandler({intermediates:")",final:C},(()=>this.selectCharset(")"+C))),this._parser.registerEscHandler({intermediates:"*",final:C},(()=>this.selectCharset("*"+C))),this._parser.registerEscHandler({intermediates:"+",final:C},(()=>this.selectCharset("+"+C))),this._parser.registerEscHandler({intermediates:"-",final:C},(()=>this.selectCharset("-"+C))),this._parser.registerEscHandler({intermediates:".",final:C},(()=>this.selectCharset("."+C))),this._parser.registerEscHandler({intermediates:"/",final:C},(()=>this.selectCharset("/"+C)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((C=>(this._logService.error("Parsing error: ",C),C))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler(((C,H)=>this.requestStatusString(C,H))))}_preserveStack(b,E,k,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=k,this._parseStack.position=D}_logSlowResolvingAsync(b){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,E){let k,D=this._activeBuffer.x,P=this._activeBuffer.y,K=0,Y=this._parseStack.paused;if(Y){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(k),k;D=this._parseStack.cursorStartX,P=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>x&&(K=this._parseStack.position+x)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(C=>String.fromCharCode(C))).join("")}"`),typeof b=="string"?b.split("").map((C=>C.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(b.length,x))),Y||this._dirtyRowTracker.clearRange(),b.length>x)for(let C=K;C<b.length;C+=x){let H=C+x<b.length?C+x:b.length,N=typeof b=="string"?this._stringDecoder.decode(b.substring(C,H),this._parseBuffer):this._utf8Decoder.decode(b.subarray(C,H),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,N))return this._preserveStack(D,P,N,C),this._logSlowResolvingAsync(k),k}else if(!Y){let C=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,C))return this._preserveStack(D,P,C,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===D&&this._activeBuffer.y===P||this._onCursorMove.fire();let Z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M,this._bufferService.rows-1),Math.min(Z,this._bufferService.rows-1))}print(b,E,k){let D,P,K=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,C=this._coreService.modes.insertMode,H=this._curAttrData,N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-E>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,H);let V=this._parser.precedingJoinState;for(let j=E;j<k;++j){if(D=b[j],D<127&&K){let fe=K[String.fromCharCode(D)];fe&&(D=fe.charCodeAt(0))}let te=this._unicodeService.charProperties(D,V);P=p.UnicodeService.extractWidth(te);let ne=p.UnicodeService.extractShouldJoin(te),oe=ne?p.UnicodeService.extractWidth(V):0;if(V=te,Y&&this._onA11yChar.fire((0,h.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+P-oe>Z){if(M){let fe=N,X=this._activeBuffer.x-oe;for(this._activeBuffer.x=oe,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),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),oe>0&&N instanceof i.BufferLine&&N.copyCellsFrom(fe,X,0,oe,!1);X<Z;)fe.setCellFromCodepoint(X++,0,1,H)}else if(this._activeBuffer.x=Z-1,P===2)continue}if(ne&&this._activeBuffer.x){let fe=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-fe,D,P);for(let X=P-oe;--X>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}else if(C&&(N.insertCells(this._activeBuffer.x,P-oe,this._activeBuffer.getNullCell(H)),N.getWidth(Z-1)===2&&N.setCellFromCodepoint(Z-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,H)),N.setCellFromCodepoint(this._activeBuffer.x++,D,P,H),P>0)for(;--P;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}this._parser.precedingJoinState=V,this._activeBuffer.x<Z&&k-E>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,H),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,E){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,E):this._parser.registerCsiHandler(b,(k=>!S(k.params[0],this._optionsService.rawOptions.windowOptions)||E(k)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new u.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,new g.OscHandler(E))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=b,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+E)}cursorUp(b){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let E=b.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let E=b.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,E,k,D=!1,P=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,k,this._activeBuffer.getNullCell(this._eraseAttrData()),P),D&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),k.isWrapped=!1)}eraseInDisplay(b,E=!1){let k;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);k<this._bufferService.rows;k++)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(0);break;case 3:let D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(b,E=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;E--;)this._activeBuffer.lines.splice(P-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;E--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(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(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let E=this._parser.precedingJoinState;if(!E)return!0;let k=b.params[0]||1,D=p.UnicodeService.extractWidth(E),P=this._activeBuffer.x-D,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(P),Y=new Uint32Array(K.length*k),Z=0;for(let C=0;C<K.length;){let H=K.codePointAt(C)||0;Y[Z++]=H,C+=H>65535?2:1}let M=Z;for(let C=1;C<k;++C)Y.copyWithin(M,0,Z),M+=Z;return this.print(Y,0,M),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(a.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(a.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(a.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(a.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(a.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,n.DEFAULT_CHARSET),this._charsetService.setgCharset(1,n.DEFAULT_CHARSET),this._charsetService.setgCharset(2,n.DEFAULT_CHARSET),this._charsetService.setgCharset(3,n.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),b.params[E]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(b,E){let k=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:P}=this._coreMouseService,K=this._coreService,{buffers:Y,cols:Z}=this._bufferService,{active:M,alt:C}=Y,H=this._optionsService.rawOptions,N=ne=>ne?1:2,V=b.params[0];return j=V,te=E?V===2?4:V===4?N(K.modes.insertMode):V===12?3:V===20?N(H.convertEol):0:V===1?N(k.applicationCursorKeys):V===3?H.windowOptions.setWinLines?Z===80?2:Z===132?1:0:0:V===6?N(k.origin):V===7?N(k.wraparound):V===8?3:V===9?N(D==="X10"):V===12?N(H.cursorBlink):V===25?N(!K.isCursorHidden):V===45?N(k.reverseWraparound):V===66?N(k.applicationKeypad):V===67?4:V===1e3?N(D==="VT200"):V===1002?N(D==="DRAG"):V===1003?N(D==="ANY"):V===1004?N(k.sendFocus):V===1005?4:V===1006?N(P==="SGR"):V===1015?4:V===1016?N(P==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?N(M===C):V===2004?N(k.bracketedPasteMode):0,K.triggerDataEvent(`${a.C0.ESC}[${E?"":"?"}${j};${te}$y`),!0;var j,te}_updateAttrColor(b,E,k,D,P){return E===2?(b|=50331648,b&=-16777216,b|=l.AttributeData.fromColorRGB([k,D,P])):E===5&&(b&=-50331904,b|=33554432|255&k),b}_extractColor(b,E,k){let D=[0,0,-1,0,0,0],P=0,K=0;do{if(D[K+P]=b.params[E+K],b.hasSubParams(E+K)){let Y=b.getSubParams(E+K),Z=0;do D[1]===5&&(P=1),D[K+Z+1+P]=Y[Z];while(++Z<Y.length&&Z+K+1+P<D.length);break}if(D[1]===5&&K+P>=2||D[1]===2&&K+P>=5)break;D[1]&&(P=1)}while(++K+E<b.length&&K+P<D.length);for(let Y=2;Y<D.length;++Y)D[Y]===-1&&(D[Y]=0);switch(D[0]){case 38:k.fg=this._updateAttrColor(k.fg,D[1],D[3],D[4],D[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,D[1],D[3],D[4],D[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,D[1],D[3],D[4],D[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=i.DEFAULT_ATTR_DATA.fg,b.bg=i.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let E=b.length,k,D=this._curAttrData;for(let P=0;P<E;P++)k=b.params[P],k>=30&&k<=37?(D.fg&=-50331904,D.fg|=16777216|k-30):k>=40&&k<=47?(D.bg&=-50331904,D.bg|=16777216|k-40):k>=90&&k<=97?(D.fg&=-50331904,D.fg|=16777224|k-90):k>=100&&k<=107?(D.bg&=-50331904,D.bg|=16777224|k-100):k===0?this._processSGR0(D):k===1?D.fg|=134217728:k===3?D.bg|=67108864:k===4?(D.fg|=268435456,this._processUnderline(b.hasSubParams(P)?b.getSubParams(P)[0]:1,D)):k===5?D.fg|=536870912:k===7?D.fg|=67108864:k===8?D.fg|=1073741824:k===9?D.fg|=2147483648:k===2?D.bg|=134217728:k===21?this._processUnderline(2,D):k===22?(D.fg&=-134217729,D.bg&=-134217729):k===23?D.bg&=-67108865:k===24?(D.fg&=-268435457,this._processUnderline(0,D)):k===25?D.fg&=-536870913:k===27?D.fg&=-67108865:k===28?D.fg&=-1073741825:k===29?D.fg&=2147483647:k===39?(D.fg&=-67108864,D.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):k===49?(D.bg&=-67108864,D.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?P+=this._extractColor(b,P,D):k===53?D.bg|=1073741824:k===55?D.bg&=-1073741825:k===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):k===100?(D.fg&=-67108864,D.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${E};${k}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${E};${k}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(b){let E=b.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let k=E%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(b){let E=b.params[0]||1,k;return(b.length<2||(k=b.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(b){if(!S(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(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let E=[],k=b.split(";");for(;k.length>1;){let D=k.shift(),P=k.shift();if(/^\d+$/.exec(D)){let K=parseInt(D);if(q(K))if(P==="?")E.push({type:0,index:K});else{let Y=(0,m.parseColor)(P);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 k=b.split(":"),D,P=k.findIndex((K=>K.startsWith("id=")));return P!==-1&&(D=k[P].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,E){let k=b.split(";");for(let D=0;D<k.length&&!(E>=this._specialColors.length);++D,++E)if(k[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let P=(0,m.parseColor)(k[D]);P&&this._onColor.fire([{type:1,index:this._specialColors[E],color:P}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let E=[],k=b.split(";");for(let D=0;D<k.length;++D)if(/^\d+$/.exec(k[D])){let P=parseInt(k[D]);q(P)&&E.push({type:2,index:P})}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,n.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(y[b[0]],n.CHARSETS[b[1]]||n.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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.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 r.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){let k=this._activeBuffer.ybase+this._activeBuffer.y+E,D=this._activeBuffer.lines.get(k);D&&(D.fill(b),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let k=this._bufferService.buffer,D=this._optionsService.rawOptions;return(P=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${P}${a.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}s.InputHandler=z;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,b){$>b&&(A=$,$=b,b=A),$<this.start&&(this.start=$),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function q($){return 0<=$&&$<256}U=c([f(0,v.IBufferService)],U)},844:(L,s)=>{function o(c){for(let f of c)f.dispose();c.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 c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let f=this._disposables.indexOf(c);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(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,a,n){this._data[f]||(this._data[f]={}),this._data[f][a]=n}get(f,a){return this._data[f]?this._data[f][a]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(c,f,a,n,d){this._data.get(c,f)||this._data.set(c,f,new o),this._data.get(c,f).set(a,n,d)}get(c,f,a,n){return this._data.get(c,f)?.get(a,n)}clear(){this._data.clear()}}},6114:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;let o=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;let f=o.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),s.isIpad=c==="iPad",s.isIphone=c==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),s.isLinux=c.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},6106:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;let f=this._getKey(c);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,f){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do f(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let f=0,a=this._array.length-1;for(;a>=f;){let n=f+a>>1,d=this._getKey(this._array[n]);if(d>c)a=n-1;else{if(!(d<c)){for(;n>0&&this._getKey(this._array[n-1])===c;)n--;return n}f=n+1}}return f}}},7226:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let c=o(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),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(d){this._idleCallback=void 0;let _=0,h=0,i=d.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(_=Date.now(),this._tasks[this._i]()||this._i++,_=Math.max(1,Date.now()-_),h=Math.max(_,h),t=d.timeRemaining(),1.5*h>t)return i-_<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-_))}ms`),void this._start();i=t}this.clear()}}class a extends f{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){let _=Date.now()+d;return{timeRemaining:()=>Math.max(0,_-Date.now())}}}s.PriorityTaskQueue=a,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(n){return requestIdleCallback(n)}_cancelCallback(n){cancelIdleCallback(n)}}:a,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(n){this._queue.clear(),this._queue.enqueue(n)}flush(){this._queue.flush()}}},9282:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let c=o(643);s.updateWindowsModeWrappedState=function(f){let a=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),n=a?.get(f.cols-1),d=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);d&&n&&(d.isWrapped=n[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&n[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){let a=new o;return a.fg=this.fg,a.bg=this.bg,a.extended=this.extended.clone(),a}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}s.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(a){this._ext&=-469762049,this._ext|=a<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(a){this._ext&=-67108864,this._ext|=67108863&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}get underlineVariantOffset(){let a=(3758096384&this._ext)>>29;return a<0?4294967288^a:a}set underlineVariantOffset(a){this._ext&=536870911,this._ext|=a<<29&3758096384}constructor(a=0,n=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=n}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},9092:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let c=o(6349),f=o(7226),a=o(3734),n=o(8437),d=o(4634),_=o(511),h=o(643),i=o(4863),t=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(e,r,l){this._hasScrollback=e,this._optionsService=r,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=_.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.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 c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,r){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let r=e+this._optionsService.rawOptions.scrollback;return r>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:r}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=n.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,r){let l=this.getNullCell(n.DEFAULT_ATTR_DATA),v=0,p=this._getCorrectBufferLength(r);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)v+=+this.lines.get(u).resize(e,l);let g=0;if(this._rows<r)for(let u=this._rows;u<r;u++)this.lines.length<r+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new n.BufferLine(e,l)):this.ybase>0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,l)));else for(let u=this._rows;u>r;u--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(p<this.lines.maxLength){let u=this.lines.length-p;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=p}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,r-1),g&&(this.y+=g),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(e,r),this._cols>e))for(let g=0;g<this.lines.length;g++)v+=+this.lines.get(g).resize(e,l);this._cols=e,this._rows=r,this._memoryCleanupQueue.clear(),v>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,r){this._cols!==e&&(e>this._cols?this._reflowLarger(e,r):this._reflowSmaller(e,r))}_reflowLarger(e,r){let l=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(l.length>0){let v=(0,d.reflowLargerCreateNewLayout)(this.lines,l);(0,d.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(e,r,v.countRemoved)}}_reflowLargerAdjustViewport(e,r,l){let v=this.getNullCell(n.DEFAULT_ATTR_DATA),p=l;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new n.BufferLine(e,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-l,0)}_reflowSmaller(e,r){let l=this.getNullCell(n.DEFAULT_ATTR_DATA),v=[],p=0;for(let g=this.lines.length-1;g>=0;g--){let u=this.lines.get(g);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let m=[u];for(;u.isWrapped&&g>0;)u=this.lines.get(--g),m.unshift(u);let y=this.ybase+this.y;if(y>=g&&y<g+m.length)continue;let x=m[m.length-1].getTrimmedLength(),S=(0,d.reflowSmallerGetNewLineLengths)(m,this._cols,e),w=S.length-m.length,A;A=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+w):Math.max(0,this.lines.length-this.lines.maxLength+w);let z=[];for(let k=0;k<w;k++){let D=this.getBlankLine(n.DEFAULT_ATTR_DATA,!0);z.push(D)}z.length>0&&(v.push({start:g+m.length+p,newLines:z}),p+=z.length),m.push(...z);let U=S.length-1,q=S[U];q===0&&(U--,q=S[U]);let $=m.length-w-1,b=x;for(;$>=0;){let k=Math.min(b,q);if(m[U]===void 0)break;if(m[U].copyCellsFrom(m[$],b-k,q-k,k,!0),q-=k,q===0&&(U--,q=S[U]),b-=k,b===0){$--;let D=Math.max($,0);b=(0,d.getWrappedLineTrimmedLength)(m,D,this._cols)}}for(let k=0;k<m.length;k++)S[k]<e&&m[k].setCell(S[k],l);let E=w-A;for(;E-- >0;)this.ybase===0?this.y<r-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(v.length>0){let g=[],u=[];for(let U=0;U<this.lines.length;U++)u.push(this.lines.get(U));let m=this.lines.length,y=m-1,x=0,S=v[x];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let w=0;for(let U=Math.min(this.lines.maxLength-1,m+p-1);U>=0;U--)if(S&&S.start>y+w){for(let q=S.newLines.length-1;q>=0;q--)this.lines.set(U--,S.newLines[q]);U++,g.push({index:y+1,amount:S.newLines.length}),w+=S.newLines.length,S=v[++x]}else this.lines.set(U,u[y--]);let A=0;for(let U=g.length-1;U>=0;U--)g[U].index+=A,this.lines.onInsertEmitter.fire(g[U]),A+=g[U].amount;let z=Math.max(0,m+p-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}translateBufferLineToString(e,r,l=0,v){let p=this.lines.get(e);return p?p.translateToString(r,l,v):""}getWrappedRangeForLine(e){let r=e,l=e;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;l+1<this.lines.length&&this.lines.get(l+1).isWrapped;)l++;return{first:r,last:l}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===e&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let r=new i.Marker(e);return this.markers.push(r),r.register(this.lines.onTrim((l=>{r.line-=l,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((l=>{r.line>=l.index&&(r.line+=l.amount)}))),r.register(this.lines.onDelete((l=>{r.line>=l.index&&r.line<l.index+l.amount&&r.dispose(),r.line>l.index&&(r.line-=l.amount)}))),r.register(r.onDispose((()=>this._removeMarker(r)))),r}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let c=o(3734),f=o(511),a=o(643),n=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let d=0;class _{constructor(i,t,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let r=t||f.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let l=0;l<i;++l)this.setCell(l,r);this.length=i}get(i){let t=this._data[3*i+0],e=2097151&t;return[this._data[3*i+1],2097152&t?this._combined[i]:e?(0,n.stringFromCodePoint)(e):"",t>>22,2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,t){this._data[3*i+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=t[1],this._data[3*i+0]=2097152|i|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&t}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i]:2097151&t?(0,n.stringFromCodePoint)(2097151&t):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,t){return d=3*i,t.content=this._data[d+0],t.fg=this._data[d+1],t.bg=this._data[d+2],2097152&t.content&&(t.combinedData=this._combined[i]),268435456&t.bg&&(t.extended=this._extendedAttrs[i]),t}setCell(i,t){2097152&t.content&&(this._combined[i]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=t.content,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}setCellFromCodepoint(i,t,e,r){268435456&r.bg&&(this._extendedAttrs[i]=r.extended),this._data[3*i+0]=t|e<<22,this._data[3*i+1]=r.fg,this._data[3*i+2]=r.bg}addCodepointToCell(i,t,e){let r=this._data[3*i+0];2097152&r?this._combined[i]+=(0,n.stringFromCodePoint)(t):2097151&r?(this._combined[i]=(0,n.stringFromCodePoint)(2097151&r)+(0,n.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|4194304,e&&(r&=-12582913,r|=e<<22),this._data[3*i+0]=r}insertCells(i,t,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length-i){let r=new f.CellData;for(let l=this.length-i-t-1;l>=0;--l)this.setCell(i+t+l,this.loadCell(i+l,r));for(let l=0;l<t;++l)this.setCell(i+l,e)}else for(let r=i;r<this.length;++r)this.setCell(r,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,t,e){if(i%=this.length,t<this.length-i){let r=new f.CellData;for(let l=0;l<this.length-i-t;++l)this.setCell(i+l,this.loadCell(i+t+l,r));for(let l=this.length-t;l<this.length;++l)this.setCell(l,e)}else for(let r=i;r<this.length;++r)this.setCell(r,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,t,e,r=!1){if(r)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.setCell(i++,e)}resize(i,t){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let r=new Uint32Array(e);r.set(this._data),this._data=r}for(let r=this.length;r<i;++r)this.setCell(r,t)}else{this._data=this._data.subarray(0,e);let r=Object.keys(this._combined);for(let v=0;v<r.length;v++){let p=parseInt(r[v],10);p>=i&&delete this._combined[p]}let l=Object.keys(this._extendedAttrs);for(let v=0;v<l.length;v++){let p=parseInt(l[v],10);p>=i&&delete this._extendedAttrs[p]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,t=!1){if(t)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let t in i._combined)this._combined[t]=i._combined[t];this._extendedAttrs={};for(let t in i._extendedAttrs)this._extendedAttrs[t]=i._extendedAttrs[t];this.isWrapped=i.isWrapped}clone(){let i=new _(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let t in this._combined)i._combined[t]=this._combined[t];for(let t in this._extendedAttrs)i._extendedAttrs[t]=this._extendedAttrs[t];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,t,e,r,l){let v=i._data;if(l)for(let g=r-1;g>=0;g--){for(let u=0;u<3;u++)this._data[3*(e+g)+u]=v[3*(t+g)+u];268435456&v[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}else for(let g=0;g<r;g++){for(let u=0;u<3;u++)this._data[3*(e+g)+u]=v[3*(t+g)+u];268435456&v[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}let p=Object.keys(i._combined);for(let g=0;g<p.length;g++){let u=parseInt(p[g],10);u>=t&&(this._combined[u-t+e]=i._combined[u])}}translateToString(i,t,e,r){t=t??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),r&&(r.length=0);let l="";for(;t<e;){let v=this._data[3*t+0],p=2097151&v,g=2097152&v?this._combined[t]:p?(0,n.stringFromCodePoint)(p):a.WHITESPACE_CELL_CHAR;if(l+=g,r)for(let u=0;u<g.length;++u)r.push(t);t+=v>>22||1}return r&&r.push(t),l}}s.BufferLine=_},4841:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(L,s)=>{function o(c,f,a){if(f===c.length-1)return c[f].getTrimmedLength();let n=!c[f].hasContent(a-1)&&c[f].getWidth(a-1)===1,d=c[f+1].getWidth(0)===2;return n&&d?a-1:a}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(c,f,a,n,d){let _=[];for(let h=0;h<c.length-1;h++){let i=h,t=c.get(++i);if(!t.isWrapped)continue;let e=[c.get(h)];for(;i<c.length&&t.isWrapped;)e.push(t),t=c.get(++i);if(n>=h&&n<i){h+=e.length-1;continue}let r=0,l=o(e,r,f),v=1,p=0;for(;v<e.length;){let u=o(e,v,f),m=u-p,y=a-l,x=Math.min(m,y);e[r].copyCellsFrom(e[v],p,l,x,!1),l+=x,l===a&&(r++,l=0),p+=x,p===u&&(v++,p=0),l===0&&r!==0&&e[r-1].getWidth(a-1)===2&&(e[r].copyCellsFrom(e[r-1],a-1,l++,1,!1),e[r-1].setCell(a-1,d))}e[r].replaceCells(l,a,d);let g=0;for(let u=e.length-1;u>0&&(u>r||e[u].getTrimmedLength()===0);u--)g++;g>0&&(_.push(h+e.length-g),_.push(g)),h+=e.length-1}return _},s.reflowLargerCreateNewLayout=function(c,f){let a=[],n=0,d=f[n],_=0;for(let h=0;h<c.length;h++)if(d===h){let i=f[++n];c.onDeleteEmitter.fire({index:h-_,amount:i}),h+=i-1,_+=i,d=f[++n]}else a.push(h);return{layout:a,countRemoved:_}},s.reflowLargerApplyNewLayout=function(c,f){let a=[];for(let n=0;n<f.length;n++)a.push(c.get(f[n]));for(let n=0;n<a.length;n++)c.set(n,a[n]);c.length=f.length},s.reflowSmallerGetNewLineLengths=function(c,f,a){let n=[],d=c.map(((t,e)=>o(c,e,f))).reduce(((t,e)=>t+e)),_=0,h=0,i=0;for(;i<d;){if(d-i<a){n.push(d-i);break}_+=a;let t=o(c,h,f);_>t&&(_-=t,h++);let e=c[h].getWidth(_-1)===2;e&&_--;let r=e?a-1:a;n.push(r),i+=r}return n},s.getWrappedLineTrimmedLength=o},5295:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let c=o(8460),f=o(844),a=o(9092);class n extends f.Disposable{constructor(_,h){super(),this._optionsService=_,this._bufferService=h,this._onBufferActivate=this.register(new c.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 a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.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(_){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(_),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(_,h){this._normal.resize(_,h),this._alt.resize(_,h),this.setupTabStops(_)}setupTabStops(_){this._normal.setupTabStops(_),this._alt.setupTabStops(_)}}s.BufferSet=n},511:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let c=o(482),f=o(643),a=o(3734);class n extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=""}static fromCharData(_){let h=new n;return h.setFromCharData(_),h}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(_){this.fg=_[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let h=!1;if(_[f.CHAR_DATA_CHAR_INDEX].length>2)h=!0;else if(_[f.CHAR_DATA_CHAR_INDEX].length===2){let i=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let t=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(i-55296)+t-56320+65536|_[f.CHAR_DATA_WIDTH_INDEX]<<22:h=!0}else h=!0}else this.content=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[f.CHAR_DATA_WIDTH_INDEX]<<22;h&&(this.combinedData=_[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|_[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=n},643:(L,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:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let c=o(8460),f=o(844);class a{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new c.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(d){return this._disposables.push(d),d}}s.Marker=a,a._nextId=1},7116:(L,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:(L,s)=>{var o,c,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(a){a.NUL="\0",a.SOH="",a.STX="",a.ETX="",a.EOT="",a.ENQ="",a.ACK="",a.BEL="\x07",a.BS="\b",a.HT=" ",a.LF=`
|
|
9
|
+
`,a.VT="\v",a.FF="\f",a.CR="\r",a.SO="",a.SI="",a.DLE="",a.DC1="",a.DC2="",a.DC3="",a.DC4="",a.NAK="",a.SYN="",a.ETB="",a.CAN="",a.EM="",a.SUB="",a.ESC="\x1B",a.FS="",a.GS="",a.RS="",a.US="",a.SP=" ",a.DEL="\x7F"})(o||(s.C0=o={})),(function(a){a.PAD="\x80",a.HOP="\x81",a.BPH="\x82",a.NBH="\x83",a.IND="\x84",a.NEL="\x85",a.SSA="\x86",a.ESA="\x87",a.HTS="\x88",a.HTJ="\x89",a.VTS="\x8A",a.PLD="\x8B",a.PLU="\x8C",a.RI="\x8D",a.SS2="\x8E",a.SS3="\x8F",a.DCS="\x90",a.PU1="\x91",a.PU2="\x92",a.STS="\x93",a.CCH="\x94",a.MW="\x95",a.SPA="\x96",a.EPA="\x97",a.SOS="\x98",a.SGCI="\x99",a.SCI="\x9A",a.CSI="\x9B",a.ST="\x9C",a.OSC="\x9D",a.PM="\x9E",a.APC="\x9F"})(c||(s.C1=c={})),(function(a){a.ST=`${o.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let c=o(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(a,n,d,_){let h={type:0,cancel:!1,key:void 0},i=(a.shiftKey?1:0)|(a.altKey?2:0)|(a.ctrlKey?4:0)|(a.metaKey?8:0);switch(a.keyCode){case 0:a.key==="UIKeyInputUpArrow"?h.key=n?c.C0.ESC+"OA":c.C0.ESC+"[A":a.key==="UIKeyInputLeftArrow"?h.key=n?c.C0.ESC+"OD":c.C0.ESC+"[D":a.key==="UIKeyInputRightArrow"?h.key=n?c.C0.ESC+"OC":c.C0.ESC+"[C":a.key==="UIKeyInputDownArrow"&&(h.key=n?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:h.key=a.ctrlKey?"\b":c.C0.DEL,a.altKey&&(h.key=c.C0.ESC+h.key);break;case 9:if(a.shiftKey){h.key=c.C0.ESC+"[Z";break}h.key=c.C0.HT,h.cancel=!0;break;case 13:h.key=a.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,h.cancel=!0;break;case 27:h.key=c.C0.ESC,a.altKey&&(h.key=c.C0.ESC+c.C0.ESC),h.cancel=!0;break;case 37:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"D",h.key===c.C0.ESC+"[1;3D"&&(h.key=c.C0.ESC+(d?"b":"[1;5D"))):h.key=n?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"C",h.key===c.C0.ESC+"[1;3C"&&(h.key=c.C0.ESC+(d?"f":"[1;5C"))):h.key=n?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"A",d||h.key!==c.C0.ESC+"[1;3A"||(h.key=c.C0.ESC+"[1;5A")):h.key=n?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(a.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"B",d||h.key!==c.C0.ESC+"[1;3B"||(h.key=c.C0.ESC+"[1;5B")):h.key=n?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:a.shiftKey||a.ctrlKey||(h.key=c.C0.ESC+"[2~");break;case 46:h.key=i?c.C0.ESC+"[3;"+(i+1)+"~":c.C0.ESC+"[3~";break;case 36:h.key=i?c.C0.ESC+"[1;"+(i+1)+"H":n?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:h.key=i?c.C0.ESC+"[1;"+(i+1)+"F":n?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:a.shiftKey?h.type=2:a.ctrlKey?h.key=c.C0.ESC+"[5;"+(i+1)+"~":h.key=c.C0.ESC+"[5~";break;case 34:a.shiftKey?h.type=3:a.ctrlKey?h.key=c.C0.ESC+"[6;"+(i+1)+"~":h.key=c.C0.ESC+"[6~";break;case 112:h.key=i?c.C0.ESC+"[1;"+(i+1)+"P":c.C0.ESC+"OP";break;case 113:h.key=i?c.C0.ESC+"[1;"+(i+1)+"Q":c.C0.ESC+"OQ";break;case 114:h.key=i?c.C0.ESC+"[1;"+(i+1)+"R":c.C0.ESC+"OR";break;case 115:h.key=i?c.C0.ESC+"[1;"+(i+1)+"S":c.C0.ESC+"OS";break;case 116:h.key=i?c.C0.ESC+"[15;"+(i+1)+"~":c.C0.ESC+"[15~";break;case 117:h.key=i?c.C0.ESC+"[17;"+(i+1)+"~":c.C0.ESC+"[17~";break;case 118:h.key=i?c.C0.ESC+"[18;"+(i+1)+"~":c.C0.ESC+"[18~";break;case 119:h.key=i?c.C0.ESC+"[19;"+(i+1)+"~":c.C0.ESC+"[19~";break;case 120:h.key=i?c.C0.ESC+"[20;"+(i+1)+"~":c.C0.ESC+"[20~";break;case 121:h.key=i?c.C0.ESC+"[21;"+(i+1)+"~":c.C0.ESC+"[21~";break;case 122:h.key=i?c.C0.ESC+"[23;"+(i+1)+"~":c.C0.ESC+"[23~";break;case 123:h.key=i?c.C0.ESC+"[24;"+(i+1)+"~":c.C0.ESC+"[24~";break;default:if(!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)if(d&&!_||!a.altKey||a.metaKey)!d||a.altKey||a.ctrlKey||a.shiftKey||!a.metaKey?a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&a.keyCode>=48&&a.key.length===1?h.key=a.key:a.key&&a.ctrlKey&&(a.key==="_"&&(h.key=c.C0.US),a.key==="@"&&(h.key=c.C0.NUL)):a.keyCode===65&&(h.type=1);else{let t=f[a.keyCode],e=t?.[a.shiftKey?1:0];if(e)h.key=c.C0.ESC+e;else if(a.keyCode>=65&&a.keyCode<=90){let r=a.ctrlKey?a.keyCode-64:a.keyCode+32,l=String.fromCharCode(r);a.shiftKey&&(l=l.toUpperCase()),h.key=c.C0.ESC+l}else if(a.keyCode===32)h.key=c.C0.ESC+(a.ctrlKey?c.C0.NUL:" ");else if(a.key==="Dead"&&a.code.startsWith("Key")){let r=a.code.slice(3,4);a.shiftKey||(r=r.toLowerCase()),h.key=c.C0.ESC+r,h.cancel=!0}}else a.keyCode>=65&&a.keyCode<=90?h.key=String.fromCharCode(a.keyCode-64):a.keyCode===32?h.key=c.C0.NUL:a.keyCode>=51&&a.keyCode<=55?h.key=String.fromCharCode(a.keyCode-51+27):a.keyCode===56?h.key=c.C0.DEL:a.keyCode===219?h.key=c.C0.ESC:a.keyCode===220?h.key=c.C0.FS:a.keyCode===221&&(h.key=c.C0.GS)}return h}},482:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,c=0,f=o.length){let a="";for(let n=c;n<f;++n){let d=o[n];d>65535?(d-=65536,a+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):a+=String.fromCharCode(d)}return a},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){let f=o.length;if(!f)return 0;let a=0,n=0;if(this._interim){let d=o.charCodeAt(n++);56320<=d&&d<=57343?c[a++]=1024*(this._interim-55296)+d-56320+65536:(c[a++]=this._interim,c[a++]=d),this._interim=0}for(let d=n;d<f;++d){let _=o.charCodeAt(d);if(55296<=_&&_<=56319){if(++d>=f)return this._interim=_,a;let h=o.charCodeAt(d);56320<=h&&h<=57343?c[a++]=1024*(_-55296)+h-56320+65536:(c[a++]=_,c[a++]=h)}else _!==65279&&(c[a++]=_)}return a}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){let f=o.length;if(!f)return 0;let a,n,d,_,h=0,i=0,t=0;if(this.interim[0]){let l=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let p,g=0;for(;(p=63&this.interim[++g])&&g<4;)v<<=6,v|=p;let u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=u-g;for(;t<m;){if(t>=f)return 0;if(p=o[t++],(192&p)!=128){t--,l=!0;break}this.interim[g++]=p,v<<=6,v|=63&p}l||(u===2?v<128?t--:c[h++]=v:u===3?v<2048||v>=55296&&v<=57343||v===65279||(c[h++]=v):v<65536||v>1114111||(c[h++]=v)),this.interim.fill(0)}let e=f-4,r=t;for(;r<f;){for(;!(!(r<e)||128&(a=o[r])||128&(n=o[r+1])||128&(d=o[r+2])||128&(_=o[r+3]));)c[h++]=a,c[h++]=n,c[h++]=d,c[h++]=_,r+=4;if(a=o[r++],a<128)c[h++]=a;else if((224&a)==192){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(i=(31&a)<<6|63&n,i<128){r--;continue}c[h++]=i}else if((240&a)==224){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,h;if(d=o[r++],(192&d)!=128){r--;continue}if(i=(15&a)<<12|(63&n)<<6|63&d,i<2048||i>=55296&&i<=57343||i===65279)continue;c[h++]=i}else if((248&a)==240){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,h;if(d=o[r++],(192&d)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,this.interim[2]=d,h;if(_=o[r++],(192&_)!=128){r--;continue}if(i=(7&a)<<18|(63&n)<<12|(63&d)<<6|63&_,i<65536||i>1114111)continue;c[h++]=i}}return h}}},225:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let c=o(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]],a=[[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]],n;s.UnicodeV6=class{constructor(){if(this.version="6",!n){n=new Uint8Array(65536),n.fill(1),n[0]=0,n.fill(0,1,32),n.fill(0,127,160),n.fill(2,4352,4448),n[9001]=2,n[9002]=2,n.fill(2,11904,42192),n[12351]=1,n.fill(2,44032,55204),n.fill(2,63744,64256),n.fill(2,65040,65050),n.fill(2,65072,65136),n.fill(2,65280,65377),n.fill(2,65504,65511);for(let d=0;d<f.length;++d)n.fill(0,f[d][0],f[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?n[d]:(function(_,h){let i,t=0,e=h.length-1;if(_<h[0][0]||_>h[e][1])return!1;for(;e>=t;)if(i=t+e>>1,_>h[i][1])t=i+1;else{if(!(_<h[i][0]))return!0;e=i-1}return!1})(d,a)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,_){let h=this.wcwidth(d),i=h===0&&_!==0;if(i){let t=c.UnicodeService.extractWidth(_);t===0?i=!1:t>h&&(h=t)}return c.UnicodeService.createPropertyValue(0,h,i)}}},5981:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let c=o(8460),f=o(844);class a extends f.Disposable{constructor(d){super(),this._action=d,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(d,_){if(_!==void 0&&this._syncCalls>_)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let h;for(this._isSyncWriting=!0;h=this._writeBuffer.shift();){this._action(h);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(d,_){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+=d.length,this._writeBuffer.push(d),this._callbacks.push(_),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(_)}_innerWrite(d=0,_=!0){let h=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],t=this._action(i,_);if(t){let r=l=>Date.now()-h>=12?setTimeout((()=>this._innerWrite(0,l))):this._innerWrite(h,l);return void t.catch((l=>(queueMicrotask((()=>{throw l})),Promise.resolve(!1)))).then(r)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-h>=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=a},5941:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function f(a,n){let d=a.toString(16),_=d.length<2?"0"+d:d;switch(n){case 4:return d[0];case 8:return _;case 12:return(_+_).slice(0,3);default:return _+_}}s.parseColor=function(a){if(!a)return;let n=a.toLowerCase();if(n.indexOf("rgb:")===0){n=n.slice(4);let d=o.exec(n);if(d){let _=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/_*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/_*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/_*255)]}}else if(n.indexOf("#")===0&&(n=n.slice(1),c.exec(n)&&[3,6,9,12].includes(n.length))){let d=n.length/3,_=[0,0,0];for(let h=0;h<3;++h){let i=parseInt(n.slice(d*h,d*h+d),16);_[h]=d===1?i<<4:d===2?i:d===3?i>>4:i>>8}return _}},s.toRgbString=function(a,n=16){let[d,_,h]=a;return`rgb:${f(d,n)}/${f(_,n)}/${f(h,n)}`}},5770:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let c=o(482),f=o(8742),a=o(5770),n=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=n,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}registerHandler(_,h){this._handlers[_]===void 0&&(this._handlers[_]=[]);let i=this._handlers[_];return i.push(h),{dispose:()=>{let t=i.indexOf(h);t!==-1&&i.splice(t,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}reset(){if(this._active.length)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].unhook(!1);this._stack.paused=!1,this._active=n,this._ident=0}hook(_,h){if(this.reset(),this._ident=_,this._active=this._handlers[_]||n,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(h);else this._handlerFb(this._ident,"HOOK",h)}put(_,h,i){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(_,h,i);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(_,h,i))}unhook(_,h=!0){if(this._active.length){let i=!1,t=this._active.length-1,e=!1;if(this._stack.paused&&(t=this._stack.loopPosition-1,i=h,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;t>=0&&(i=this._active[t].unhook(_),i!==!0);t--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!1,i;t--}for(;t>=0;t--)if(i=this._active[t].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",_);this._active=n,this._ident=0}};let d=new f.Params;d.addParam(0),s.DcsHandler=class{constructor(_){this._handler=_,this._data="",this._params=d,this._hitLimit=!1}hook(_){this._params=_.length>1||_.params[0]?_.clone():d,this._data="",this._hitLimit=!1}put(_,h,i){this._hitLimit||(this._data+=(0,c.utf32ToString)(_,h,i),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(_){let h=!1;if(this._hitLimit)h=!1;else if(_&&(h=this._handler(this._data,this._params),h instanceof Promise))return h.then((i=>(this._params=d,this._data="",this._hitLimit=!1,i)));return this._params=d,this._data="",this._hitLimit=!1,h}}},2015:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let c=o(844),f=o(8742),a=o(6242),n=o(6351);class d{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,r,l){this.table[e<<8|t]=r<<4|l}addMany(t,e,r,l){for(let v=0;v<t.length;v++)this.table[e<<8|t[v]]=r<<4|l}}s.TransitionTable=d;let _=160;s.VT500_TRANSITION_TABLE=(function(){let i=new d(4095),t=Array.apply(null,Array(256)).map(((g,u)=>u)),e=(g,u)=>t.slice(g,u),r=e(32,127),l=e(0,24);l.push(25),l.push.apply(l,e(28,32));let v=e(0,14),p;for(p in i.setDefault(1,0),i.addMany(r,0,2,0),v)i.addMany([24,26,153,154],p,3,0),i.addMany(e(128,144),p,3,0),i.addMany(e(144,152),p,3,0),i.add(156,p,0,0),i.add(27,p,11,1),i.add(157,p,4,8),i.addMany([152,158,159],p,0,7),i.add(155,p,11,3),i.add(144,p,11,9);return i.addMany(l,0,3,0),i.addMany(l,1,3,1),i.add(127,1,0,1),i.addMany(l,8,0,8),i.addMany(l,3,3,3),i.add(127,3,0,3),i.addMany(l,4,3,4),i.add(127,4,0,4),i.addMany(l,6,3,6),i.addMany(l,5,3,5),i.add(127,5,0,5),i.addMany(l,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(r,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(r,7,0,7),i.addMany(l,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(l,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(l,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(l,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(l,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(l,13,13,13),i.addMany(r,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(_,0,2,0),i.add(_,8,5,8),i.add(_,6,0,6),i.add(_,11,0,11),i.add(_,13,13,13),i})();class h extends c.Disposable{constructor(t=s.VT500_TRANSITION_TABLE){super(),this._transitions=t,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=(e,r,l)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,r)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new n.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(t,e=[64,126]){let r=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=t.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let v=0;v<t.intermediates.length;++v){let p=t.intermediates.charCodeAt(v);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=p}}if(t.final.length!==1)throw new Error("final must be a single byte");let l=t.final.charCodeAt(0);if(e[0]>l||l>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return r<<=8,r|=l,r}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(255&t)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let r=this._identifier(t,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let l=this._escHandlers[r];return l.push(e),{dispose:()=>{let v=l.indexOf(e);v!==-1&&l.splice(v,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let r=this._identifier(t);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let l=this._csiHandlers[r];return l.push(e),{dispose:()=>{let v=l.indexOf(e);v!==-1&&l.splice(v,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,e,r,l,v){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=r,this._parseStack.transition=l,this._parseStack.chunkPos=v}parse(t,e,r){let l,v=0,p=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(l=u[m](this._params),l!==!0);m--)if(l instanceof Promise)return this._parseStack.handlerPos=m,l}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(l=u[m](),l!==!0);m--)if(l instanceof Promise)return this._parseStack.handlerPos=m,l}this._parseStack.handlers=[];break;case 6:if(v=t[this._parseStack.chunkPos],l=this._dcsParser.unhook(v!==24&&v!==26,r),l)return l;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(v=t[this._parseStack.chunkPos],l=this._oscParser.end(v!==24&&v!==26,r),l)return l;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=g;u<e;++u){switch(v=t[u],p=this._transitions.table[this.currentState<<8|(v<160?v:_)],p>>4){case 2:for(let w=u+1;;++w){if(w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}}break;case 3:this._executeHandlers[v]?this._executeHandlers[v]():this._executeHandlerFb(v),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:v,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|v],y=m?m.length-1:-1;for(;y>=0&&(l=m[y](this._params),l!==!0);y--)if(l instanceof Promise)return this._preserveStack(3,m,y,p,u),l;y<0&&this._csiHandlerFb(this._collect<<8|v,this._params),this.precedingJoinState=0;break;case 8:do switch(v){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(v-48)}while(++u<e&&(v=t[u])>47&&v<60);u--;break;case 9:this._collect<<=8,this._collect|=v;break;case 10:let x=this._escHandlers[this._collect<<8|v],S=x?x.length-1:-1;for(;S>=0&&(l=x[S](),l!==!0);S--)if(l instanceof Promise)return this._preserveStack(4,x,S,p,u),l;S<0&&this._escHandlerFb(this._collect<<8|v),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|v,this._params);break;case 13:for(let w=u+1;;++w)if(w>=e||(v=t[w])===24||v===26||v===27||v>127&&v<_){this._dcsParser.put(t,u,w),u=w-1;break}break;case 14:if(l=this._dcsParser.unhook(v!==24&&v!==26),l)return this._preserveStack(6,[],0,p,u),l;v===27&&(p|=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 w=u+1;;w++)if(w>=e||(v=t[w])<32||v>127&&v<_){this._oscParser.put(t,u,w),u=w-1;break}break;case 6:if(l=this._oscParser.end(v!==24&&v!==26),l)return this._preserveStack(5,[],0,p,u),l;v===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&p}}}s.EscapeSequenceParser=h},6242:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let c=o(5770),f=o(482),a=[];s.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(n,d){this._handlers[n]===void 0&&(this._handlers[n]=[]);let _=this._handlers[n];return _.push(d),{dispose:()=>{let h=_.indexOf(d);h!==-1&&_.splice(h,1)}}}clearHandler(n){this._handlers[n]&&delete this._handlers[n]}setHandlerFallback(n){this._handlerFb=n}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let n=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;n>=0;--n)this._active[n].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].start();else this._handlerFb(this._id,"START")}_put(n,d,_){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(n,d,_);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(n,d,_))}start(){this.reset(),this._state=1}put(n,d,_){if(this._state!==3){if(this._state===1)for(;d<_;){let h=n[d++];if(h===59){this._state=2,this._start();break}if(h<48||57<h)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+h-48}this._state===2&&_-d>0&&this._put(n,d,_)}}end(n,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let _=!1,h=this._active.length-1,i=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,_=d,i=this._stack.fallThrough,this._stack.paused=!1),!i&&_===!1){for(;h>=0&&(_=this._active[h].end(n),_!==!0);h--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,_;h--}for(;h>=0;h--)if(_=this._active[h].end(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,_}else this._handlerFb(this._id,"END",n);this._active=a,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(n){this._handler=n,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(n,d,_){this._hitLimit||(this._data+=(0,f.utf32ToString)(n,d,_),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(n){let d=!1;if(this._hitLimit)d=!1;else if(n&&(d=this._handler(this._data),d instanceof Promise))return d.then((_=>(this._data="",this._hitLimit=!1,_)));return this._data="",this._hitLimit=!1,d}}},8742:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let o=2147483647;class c{static fromArray(a){let n=new c;if(!a.length)return n;for(let d=Array.isArray(a[0])?1:0;d<a.length;++d){let _=a[d];if(Array.isArray(_))for(let h=0;h<_.length;++h)n.addSubParam(_[h]);else n.addParam(_)}return n}constructor(a=32,n=32){if(this.maxLength=a,this.maxSubParamsLength=n,n>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(a),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(a),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let a=new c(this.maxLength,this.maxSubParamsLength);return a.params.set(this.params),a.length=this.length,a._subParams.set(this._subParams),a._subParamsLength=this._subParamsLength,a._subParamsIdx.set(this._subParamsIdx),a._rejectDigits=this._rejectDigits,a._rejectSubDigits=this._rejectSubDigits,a._digitIsSub=this._digitIsSub,a}toArray(){let a=[];for(let n=0;n<this.length;++n){a.push(this.params[n]);let d=this._subParamsIdx[n]>>8,_=255&this._subParamsIdx[n];_-d>0&&a.push(Array.prototype.slice.call(this._subParams,d,_))}return a}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(a){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=a>o?o:a}}addSubParam(a){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=a>o?o:a,this._subParamsIdx[this.length-1]++}}hasSubParams(a){return(255&this._subParamsIdx[a])-(this._subParamsIdx[a]>>8)>0}getSubParams(a){let n=this._subParamsIdx[a]>>8,d=255&this._subParamsIdx[a];return d-n>0?this._subParams.subarray(n,d):null}getSubParamsAll(){let a={};for(let n=0;n<this.length;++n){let d=this._subParamsIdx[n]>>8,_=255&this._subParamsIdx[n];_-d>0&&(a[n]=this._subParams.slice(d,_))}return a}addDigit(a){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let d=this._digitIsSub?this._subParams:this.params,_=d[n-1];d[n-1]=~_?Math.min(10*_+a,o):a}}s.Params=c},5741:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){let f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===o){c=f;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let c=o(3785),f=o(511);s.BufferApiView=class{constructor(a,n){this._buffer=a,this.type=n}init(a){return this._buffer=a,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(a){let n=this._buffer.lines.get(a);if(n)return new c.BufferLineApiView(n)}getNullCell(){return new f.CellData}}},3785:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let c=o(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,a){if(!(f<0||f>=this._line.length))return a?(this._line.loadCell(f,a),a):this._line.loadCell(f,new c.CellData)}translateToString(f,a,n){return this._line.translateToString(f,a,n)}}},8285:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let c=o(8771),f=o(8460),a=o(844);class n extends a.Disposable{constructor(_){super(),this._core=_,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.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=n},7975:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,(f=>c(f.toArray())))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,((f,a)=>c(f,a.toArray())))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(L,s,o){var c=this&&this.__decorate||function(i,t,e,r){var l,v=arguments.length,p=v<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(l=i[g])&&(p=(v<3?l(p):v>3?l(t,e,p):l(t,e))||p);return v>3&&p&&Object.defineProperty(t,e,p),p},f=this&&this.__param||function(i,t){return function(e,r){t(e,r,i)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let a=o(8460),n=o(844),d=o(5295),_=o(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let h=s.BufferService=class extends n.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new d.BufferSet(i,this))}resize(i,t){this.cols=i,this.rows=t,this.buffers.resize(i,t),this._onResize.fire({cols:i,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,t=!1){let e=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===i.fg&&r.getBg(0)===i.bg||(r=e.getBlankLine(i,t),this._cachedBlankLine=r),r.isWrapped=t;let l=e.ybase+e.scrollTop,v=e.ybase+e.scrollBottom;if(e.scrollTop===0){let p=e.lines.isFull;v===e.lines.length-1?p?e.lines.recycle().copyFrom(r):e.lines.push(r.clone()):e.lines.splice(v+1,0,r.clone()),p?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let p=v-l+1;e.lines.shiftElements(l+1,p-1,-1),e.lines.set(v,r.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,t,e){let r=this.buffer;if(i<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else i+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let l=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+i,r.ybase),0),l!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};s.BufferService=h=c([f(0,_.IOptionsService)],h)},7994:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(L,s,o){var c=this&&this.__decorate||function(r,l,v,p){var g,u=arguments.length,m=u<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,v):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,l,v,p);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(l,v,m):g(l,v))||m);return u>3&&m&&Object.defineProperty(l,v,m),m},f=this&&this.__param||function(r,l){return function(v,p){l(v,p,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let a=o(2585),n=o(8460),d=o(844),_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:r=>r.button!==4&&r.action===1&&(r.ctrl=!1,r.alt=!1,r.shift=!1,!0)},VT200:{events:19,restrict:r=>r.action!==32},DRAG:{events:23,restrict:r=>r.action!==32||r.button!==3},ANY:{events:31,restrict:r=>!0}};function h(r,l){let v=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(v|=64,v|=r.action):(v|=3&r.button,4&r.button&&(v|=64),8&r.button&&(v|=128),r.action===32?v|=32:r.action!==0||l||(v|=3)),v}let i=String.fromCharCode,t={DEFAULT:r=>{let l=[h(r,!1)+32,r.col+32,r.row+32];return l[0]>255||l[1]>255||l[2]>255?"":`\x1B[M${i(l[0])}${i(l[1])}${i(l[2])}`},SGR:r=>{let l=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${h(r,!0)};${r.col};${r.row}${l}`},SGR_PIXELS:r=>{let l=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${h(r,!0)};${r.x};${r.y}${l}`}},e=s.CoreMouseService=class extends d.Disposable{constructor(r,l){super(),this._bufferService=r,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new n.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let v of Object.keys(_))this.addProtocol(v,_[v]);for(let v of Object.keys(t))this.addEncoding(v,t[v]);this.reset()}addProtocol(r,l){this._protocols[r]=l}addEncoding(r,l){this._encodings[r]=l}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(r){if(!this._protocols[r])throw new Error(`unknown protocol "${r}"`);this._activeProtocol=r,this._onProtocolChange.fire(this._protocols[r].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(r){if(!this._encodings[r])throw new Error(`unknown encoding "${r}"`);this._activeEncoding=r}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(r){if(r.col<0||r.col>=this._bufferService.cols||r.row<0||r.row>=this._bufferService.rows||r.button===4&&r.action===32||r.button===3&&r.action!==32||r.button!==4&&(r.action===2||r.action===3)||(r.col++,r.row++,r.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,r,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(r))return!1;let l=this._encodings[this._activeEncoding](r);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=r,!0}explainEvents(r){return{down:!!(1&r),up:!!(2&r),drag:!!(4&r),move:!!(8&r),wheel:!!(16&r)}}_equalEvents(r,l,v){if(v){if(r.x!==l.x||r.y!==l.y)return!1}else if(r.col!==l.col||r.row!==l.row)return!1;return r.button===l.button&&r.action===l.action&&r.ctrl===l.ctrl&&r.alt===l.alt&&r.shift===l.shift}};s.CoreMouseService=e=c([f(0,a.IBufferService),f(1,a.ICoreService)],e)},6975:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let a=o(1439),n=o(8460),d=o(844),_=o(2585),h=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),t=s.CoreService=class extends d.Disposable{constructor(e,r,l){super(),this._bufferService=e,this._logService=r,this._optionsService=l,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new n.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new n.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new n.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new n.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(h),this.decPrivateModes=(0,a.clone)(i)}reset(){this.modes=(0,a.clone)(h),this.decPrivateModes=(0,a.clone)(i)}triggerDataEvent(e,r=!1){if(this._optionsService.rawOptions.disableStdin)return;let l=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((v=>v.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((r=>r.charCodeAt(0))))),this._onBinary.fire(e))}};s.CoreService=t=c([f(0,_.IBufferService),f(1,_.ILogService),f(2,_.IOptionsService)],t)},9074:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let c=o(8055),f=o(8460),a=o(844),n=o(6106),d=0,_=0;class h extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new n.SortedList((e=>e?.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,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let r=new i(e);if(r){let l=r.marker.onDispose((()=>r.dispose()));r.onDispose((()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),l.dispose())})),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,r,l){let v=0,p=0;for(let g of this._decorations.getKeyIterator(r))v=g.options.x??0,p=v+(g.options.width??1),e>=v&&e<p&&(!l||(g.options.layer??"bottom")===l)&&(yield g)}forEachDecorationAtCell(e,r,l,v){this._decorations.forEachByKey(r,(p=>{d=p.options.x??0,_=d+(p.options.width??1),e>=d&&e<_&&(!l||(p.options.layer??"bottom")===l)&&v(p)}))}}s.DecorationService=h;class i extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,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=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let c=o(2585),f=o(8343);class a{constructor(...d){this._entries=new Map;for(let[_,h]of d)this.set(_,h)}set(d,_){let h=this._entries.get(d);return this._entries.set(d,_),h}forEach(d){for(let[_,h]of this._entries.entries())d(_,h)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}s.ServiceCollection=a,s.InstantiationService=class{constructor(){this._services=new a,this._services.set(c.IInstantiationService,this)}setService(n,d){this._services.set(n,d)}getService(n){return this._services.get(n)}createInstance(n,...d){let _=(0,f.getServiceDependencies)(n).sort(((t,e)=>t.index-e.index)),h=[];for(let t of _){let e=this._services.get(t.id);if(!e)throw new Error(`[createInstance] ${n.name} depends on UNKNOWN service ${t.id}.`);h.push(e)}let i=_.length>0?_[0].index:d.length;if(d.length!==i)throw new Error(`[createInstance] First service dependency of ${n.name} at position ${i+1} conflicts with ${d.length} static arguments`);return new n(...d,...h)}}},7866:function(L,s,o){var c=this&&this.__decorate||function(i,t,e,r){var l,v=arguments.length,p=v<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(l=i[g])&&(p=(v<3?l(p):v>3?l(t,e,p):l(t,e))||p);return v>3&&p&&Object.defineProperty(t,e,p),p},f=this&&this.__param||function(i,t){return function(e,r){t(e,r,i)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let a=o(844),n=o(2585),d={trace:n.LogLevelEnum.TRACE,debug:n.LogLevelEnum.DEBUG,info:n.LogLevelEnum.INFO,warn:n.LogLevelEnum.WARN,error:n.LogLevelEnum.ERROR,off:n.LogLevelEnum.OFF},_,h=s.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=n.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),_=this}_updateLogLevel(){this._logLevel=d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let t=0;t<i.length;t++)typeof i[t]=="function"&&(i[t]=i[t]())}_log(i,t,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...e)}trace(i,...t){this._logLevel<=n.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,t)}debug(i,...t){this._logLevel<=n.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,t)}info(i,...t){this._logLevel<=n.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,t)}warn(i,...t){this._logLevel<=n.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,t)}error(i,...t){this._logLevel<=n.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,t)}};s.LogService=h=c([f(0,n.IOptionsService)],h),s.setTraceLogger=function(i){_=i},s.traceCall=function(i,t,e){if(typeof e.value!="function")throw new Error("not supported");let r=e.value;e.value=function(...l){if(_.logLevel!==n.LogLevelEnum.TRACE)return r.apply(this,l);_.trace(`GlyphRenderer#${r.name}(${l.map((p=>JSON.stringify(p))).join(", ")})`);let v=r.apply(this,l);return _.trace(`GlyphRenderer#${r.name} return`,v),v}}},7302:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let c=o(8460),f=o(844),a=o(6114);s.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:a.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let n=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends f.Disposable{constructor(h){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...s.DEFAULT_OPTIONS};for(let t in h)if(t in i)try{let e=h[t];i[t]=this._sanitizeAndValidateOption(t,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(h,i){return this.onOptionChange((t=>{t===h&&i(this.rawOptions[h])}))}onMultipleOptionChange(h,i){return this.onOptionChange((t=>{h.indexOf(t)!==-1&&i()}))}_setupOptions(){let h=t=>{if(!(t in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);return this.rawOptions[t]},i=(t,e)=>{if(!(t in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);e=this._sanitizeAndValidateOption(t,e),this.rawOptions[t]!==e&&(this.rawOptions[t]=e,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let e={get:h.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,e)}}_sanitizeAndValidateOption(h,i){switch(h){case"cursorStyle":if(i||(i=s.DEFAULT_OPTIONS[h]),!(function(t){return t==="block"||t==="underline"||t==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${h}`);break;case"wordSeparator":i||(i=s.DEFAULT_OPTIONS[h]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=n.includes(i)?i:s.DEFAULT_OPTIONS[h];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${h} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${h} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${h} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${h} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}s.OptionsService=d},2660:function(L,s,o){var c=this&&this.__decorate||function(d,_,h,i){var t,e=arguments.length,r=e<3?_:i===null?i=Object.getOwnPropertyDescriptor(_,h):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(d,_,h,i);else for(var l=d.length-1;l>=0;l--)(t=d[l])&&(r=(e<3?t(r):e>3?t(_,h,r):t(_,h))||r);return e>3&&r&&Object.defineProperty(_,h,r),r},f=this&&this.__param||function(d,_){return function(h,i){_(h,i,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let a=o(2585),n=s.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){let _=this._bufferService.buffer;if(d.id===void 0){let l=_.addMarker(_.ybase+_.y),v={data:d,id:this._nextId++,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(v,l))),this._dataByLinkId.set(v.id,v),v.id}let h=d,i=this._getEntryIdKey(h),t=this._entriesWithId.get(i);if(t)return this.addLineToLink(t.id,_.ybase+_.y),t.id;let e=_.addMarker(_.ybase+_.y),r={id:this._nextId++,key:this._getEntryIdKey(h),data:h,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(r,e))),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(d,_){let h=this._dataByLinkId.get(d);if(h&&h.lines.every((i=>i.line!==_))){let i=this._bufferService.buffer.addMarker(_);h.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(h,i)))}}getLinkData(d){return this._dataByLinkId.get(d)?.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,_){let h=d.lines.indexOf(_);h!==-1&&(d.lines.splice(h,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};s.OscLinkService=n=c([f(0,a.IBufferService)],n)},8343:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let o="di$target",c="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(f){return f[c]||[]},s.createDecorator=function(f){if(s.serviceRegistry.has(f))return s.serviceRegistry.get(f);let a=function(n,d,_){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(h,i,t){i[o]===i?i[c].push({id:h,index:t}):(i[c]=[{id:h,index:t}],i[o]=i)})(a,n,_)};return a.toString=()=>f,s.serviceRegistry.set(f,a),a}},2585:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;let c=o(8343);var f;s.IBufferService=(0,c.createDecorator)("BufferService"),s.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),s.ICoreService=(0,c.createDecorator)("CoreService"),s.ICharsetService=(0,c.createDecorator)("CharsetService"),s.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(a){a[a.TRACE=0]="TRACE",a[a.DEBUG=1]="DEBUG",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.OFF=5]="OFF"})(f||(s.LogLevelEnum=f={})),s.ILogService=(0,c.createDecorator)("LogService"),s.IOptionsService=(0,c.createDecorator)("OptionsService"),s.IOscLinkService=(0,c.createDecorator)("OscLinkService"),s.IUnicodeService=(0,c.createDecorator)("UnicodeService"),s.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let c=o(8460),f=o(225);class a{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,_,h=!1){return(16777215&d)<<3|(3&_)<<1|(h?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;let d=new f.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let _=0,h=0,i=d.length;for(let t=0;t<i;++t){let e=d.charCodeAt(t);if(55296<=e&&e<=56319){if(++t>=i)return _+this.wcwidth(e);let v=d.charCodeAt(t);56320<=v&&v<=57343?e=1024*(e-55296)+v-56320+65536:_+=this.wcwidth(v)}let r=this.charProperties(e,h),l=a.extractWidth(r);a.extractShouldJoin(r)&&(l-=a.extractWidth(h)),_+=l,h=r}return _}charProperties(d,_){return this._activeProvider.charProperties(d,_)}}s.UnicodeService=a}},R={};function O(L){var s=R[L];if(s!==void 0)return s.exports;var o=R[L]={exports:{}};return T[L].call(o.exports,o,o.exports,O),o.exports}var W={};return(()=>{var L=W;Object.defineProperty(L,"__esModule",{value:!0}),L.Terminal=void 0;let s=O(9042),o=O(3236),c=O(844),f=O(5741),a=O(8285),n=O(7975),d=O(7090),_=["cols","rows"];class h extends c.Disposable{constructor(t){super(),this._core=this.register(new o.Terminal(t)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let e=l=>this._core.options[l],r=(l,v)=>{this._checkReadonlyOptions(l),this._core.options[l]=v};for(let l in this._core.options){let v={get:e.bind(this,l),set:r.bind(this,l)};Object.defineProperty(this._publicOptions,l,v)}}_checkReadonlyOptions(t){if(_.includes(t))throw new Error(`Option "${t}" 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 n.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.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 a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,r){this._verifyIntegers(t,e,r),this._core.select(t,e,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
10
|
+
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return s}_verifyIntegers(...t){for(let e of t)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(let e of t)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}L.Terminal=h})(),W})()))});var It=pt((nt,mt)=>{(function(T,R){typeof nt=="object"&&typeof mt=="object"?mt.exports=R():typeof define=="function"&&define.amd?define([],R):typeof nt=="object"?nt.FitAddon=R():T.FitAddon=R()})(self,(()=>(()=>{"use strict";var T={};return(()=>{var R=T;Object.defineProperty(R,"__esModule",{value:!0}),R.FitAddon=void 0,R.FitAddon=class{activate(O){this._terminal=O}dispose(){}fit(){let O=this.proposeDimensions();if(!O||!this._terminal||isNaN(O.cols)||isNaN(O.rows))return;let W=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(W._renderService.clear(),this._terminal.resize(O.cols,O.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let O=this._terminal._core,W=O._renderService.dimensions;if(W.css.cell.width===0||W.css.cell.height===0)return;let L=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(s.getPropertyValue("height")),c=Math.max(0,parseInt(s.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),a=o-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),n=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-L;return{cols:Math.max(2,Math.floor(n/W.css.cell.width)),rows:Math.max(1,Math.floor(a/W.css.cell.height))}}}})(),T})()))});var Ot=pt((ot,bt)=>{(function(T,R){typeof ot=="object"&&typeof bt=="object"?bt.exports=R():typeof define=="function"&&define.amd?define([],R):typeof ot=="object"?ot.SearchAddon=R():T.SearchAddon=R()})(self,(()=>(()=>{"use strict";var T={345:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o((f=>c.fire(f)))},s.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},859:(L,s)=>{function o(c){for(let f of c)f.dispose();c.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 c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let f=this._disposables.indexOf(c);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(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}}},R={};function O(L){var s=R[L];if(s!==void 0)return s.exports;var o=R[L]={exports:{}};return T[L](o,o.exports,O),o.exports}var W={};return(()=>{var L=W;Object.defineProperty(L,"__esModule",{value:!0}),L.SearchAddon=void 0;let s=O(345),o=O(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class f extends o.Disposable{constructor(n){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new o.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new o.MutableDisposable,this._onDidChangeResults=this.register(new s.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=n?.highlightLimit??1e3}activate(n){this._terminal=n,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,o.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let n=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(n,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(n){this._selectedDecoration.clear(),(0,o.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),n||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||_)&&this._highlightAllMatches(n,d);let h=this._findNextAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,h}_highlightAllMatches(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!n||n.length===0)return void this.clearDecorations();d=d||{},this.clearDecorations(!0);let _=[],h,i=this._find(n,0,0,d);for(;i&&(h?.row!==i.row||h?.col!==i.col)&&!(_.length>=this._highlightLimit);)h=i,_.push(h),i=this._find(n,h.col+h.term.length>=this._terminal.cols?h.row+1:h.row,h.col+h.term.length>=this._terminal.cols?0:h.col+1,d);for(let t of _){let e=this._createResultDecoration(t,d.decorations);e&&(this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}}))}}_find(n,d,_,h){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(_>this._terminal.cols)throw new Error(`Invalid col: ${_} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let t={startRow:d,startCol:_};if(i=this._findInLine(n,t,h),!i)for(let e=d+1;e<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=e,t.startCol=0,i=this._findInLine(n,t,h),!i);e++);return i}_findNextAndSelect(n,d){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let _=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,i=0;_&&(this._cachedSearchTerm===n?(h=_.end.x,i=_.end.y):(h=_.start.x,i=_.start.y)),this._initLinesCache();let t={startRow:i,startCol:h},e=this._findInLine(n,t,d);if(!e)for(let r=i+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=r,t.startCol=0,e=this._findInLine(n,t,d),!e);r++);if(!e&&i!==0)for(let r=0;r<i&&(t.startRow=r,t.startCol=0,e=this._findInLine(n,t,d),!e);r++);return!e&&_&&(t.startRow=_.start.y,t.startCol=0,e=this._findInLine(n,t,d)),this._selectResult(e,d?.decorations,d?.noScroll)}findPrevious(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||_)&&this._highlightAllMatches(n,d);let h=this._findPreviousAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,h}_didOptionsChange(n,d){return!!d&&(n.caseSensitive!==d.caseSensitive||n.regex!==d.regex||n.wholeWord!==d.wholeWord)}_fireResults(n){if(n?.decorations){let d=-1;if(this._selectedDecoration.value){let _=this._selectedDecoration.value.match;for(let h=0;h<this._highlightDecorations.length;h++){let i=this._highlightDecorations[h].match;if(i.row===_.row&&i.col===_.col&&i.size===_.size){d=h;break}}}this._onDidChangeResults.fire({resultIndex:d,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let _=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols,t=!0;this._initLinesCache();let e={startRow:h,startCol:i},r;if(_&&(e.startRow=h=_.start.y,e.startCol=i=_.start.x,this._cachedSearchTerm!==n&&(r=this._findInLine(n,e,d,!1),r||(e.startRow=h=_.end.y,e.startCol=i=_.end.x))),r||(r=this._findInLine(n,e,d,t)),!r){e.startCol=Math.max(e.startCol,this._terminal.cols);for(let l=h-1;l>=0&&(e.startRow=l,r=this._findInLine(n,e,d,t),!r);l--);}if(!r&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=h&&(e.startRow=l,r=this._findInLine(n,e,d,t),!r);l--);return this._selectResult(r,d?.decorations,d?.noScroll)}_initLinesCache(){let n=this._terminal;this._linesCache||(this._linesCache=new Array(n.buffer.active.length),this._linesCacheDisposables.value=(0,o.getDisposeArrayDisposable)([n.onLineFeed((()=>this._destroyLinesCache())),n.onCursorMove((()=>this._destroyLinesCache())),n.onResize((()=>this._destroyLinesCache()))])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout((()=>this._destroyLinesCache()),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(n,d,_){return(n===0||c.includes(d[n-1]))&&(n+_.length===d.length||c.includes(d[n+_.length]))}_findInLine(n,d,_={},h=!1){let i=this._terminal,t=d.startRow,e=d.startCol;if(i.buffer.active.getLine(t)?.isWrapped)return h?void(d.startCol+=i.cols):(d.startRow--,d.startCol+=i.cols,this._findInLine(n,d,_));let l=this._linesCache?.[t];l||(l=this._translateBufferLineToStringWithWrap(t,!0),this._linesCache&&(this._linesCache[t]=l));let[v,p]=l,g=this._bufferColsToStringOffset(t,e),u=_.caseSensitive?n:n.toLowerCase(),m=_.caseSensitive?v:v.toLowerCase(),y=-1;if(_.regex){let x=RegExp(u,"g"),S;if(h)for(;S=x.exec(m.slice(0,g));)y=x.lastIndex-S[0].length,n=S[0],x.lastIndex-=n.length-1;else S=x.exec(m.slice(g)),S&&S[0].length>0&&(y=g+(x.lastIndex-S[0].length),n=S[0])}else h?g-u.length>=0&&(y=m.lastIndexOf(u,g-u.length)):y=m.indexOf(u,g);if(y>=0){if(_.wholeWord&&!this._isWholeWord(y,m,n))return;let x=0;for(;x<p.length-1&&y>=p[x+1];)x++;let S=x;for(;S<p.length-1&&y+n.length>=p[S+1];)S++;let w=y-p[x],A=y+n.length-p[S],z=this._stringLengthToBufferSize(t+x,w);return{term:n,col:z,row:t+x,size:this._stringLengthToBufferSize(t+S,A)-z+i.cols*(S-x)}}}_stringLengthToBufferSize(n,d){let _=this._terminal.buffer.active.getLine(n);if(!_)return 0;for(let h=0;h<d;h++){let i=_.getCell(h);if(!i)break;let t=i.getChars();t.length>1&&(d-=t.length-1);let e=_.getCell(h+1);e&&e.getWidth()===0&&d++}return d}_bufferColsToStringOffset(n,d){let _=this._terminal,h=n,i=0,t=_.buffer.active.getLine(h);for(;d>0&&t;){for(let e=0;e<d&&e<_.cols;e++){let r=t.getCell(e);if(!r)break;r.getWidth()&&(i+=r.getCode()===0?1:r.getChars().length)}if(h++,t=_.buffer.active.getLine(h),t&&!t.isWrapped)break;d-=_.cols}return i}_translateBufferLineToStringWithWrap(n,d){let _=this._terminal,h=[],i=[0],t=_.buffer.active.getLine(n);for(;t;){let e=_.buffer.active.getLine(n+1),r=!!e&&e.isWrapped,l=t.translateToString(!r&&d);if(r&&e){let v=t.getCell(t.length-1);v&&v.getCode()===0&&v.getWidth()===1&&e.getCell(0)?.getWidth()===2&&(l=l.slice(0,-1))}if(h.push(l),!r)break;i.push(i[i.length-1]+l.length),n++,t=e}return[h.join(""),i]}_selectResult(n,d,_){let h=this._terminal;if(this._selectedDecoration.clear(),!n)return h.clearSelection(),!1;if(h.select(n.col,n.row,n.size),d){let i=h.registerMarker(-h.buffer.active.baseY-h.buffer.active.cursorY+n.row);if(i){let t=h.registerDecoration({marker:i,x:n.col,width:n.size,backgroundColor:d.activeMatchBackground,layer:"top",overviewRulerOptions:{color:d.activeMatchColorOverviewRuler}});if(t){let e=[];e.push(i),e.push(t.onRender((r=>this._applyStyles(r,d.activeMatchBorder,!0)))),e.push(t.onDispose((()=>(0,o.disposeArray)(e)))),this._selectedDecoration.value={decoration:t,match:n,dispose(){t.dispose()}}}}}if(!_&&(n.row>=h.buffer.active.viewportY+h.rows||n.row<h.buffer.active.viewportY)){let i=n.row-h.buffer.active.viewportY;i-=Math.floor(h.rows/2),h.scrollLines(i)}return!0}_applyStyles(n,d,_){n.classList.contains("xterm-find-result-decoration")||(n.classList.add("xterm-find-result-decoration"),d&&(n.style.outline=`1px solid ${d}`)),_&&n.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(n,d){let _=this._terminal,h=_.registerMarker(-_.buffer.active.baseY-_.buffer.active.cursorY+n.row);if(!h)return;let i=_.registerDecoration({marker:h,x:n.col,width:n.size,backgroundColor:d.matchBackground,overviewRulerOptions:this._highlightedLines.has(h.line)?void 0:{color:d.matchOverviewRuler,position:"center"}});if(i){let t=[];t.push(h),t.push(i.onRender((e=>this._applyStyles(e,d.matchBorder,!1)))),t.push(i.onDispose((()=>(0,o.disposeArray)(t))))}return i}}L.SearchAddon=f})(),W})()))});var ki={};fi(ki,{apply:()=>xi,inject:()=>wi});module.exports=_i(ki);var pe=require("react");var ee=require("react");var le="zTerm";async function ie(T,R,O={},W){let L=T.connection;if(!L?.rpc?.call)throw new Error("\u5F53\u524D DSH \u7F3A\u5C11 Connection RPC\uFF0C\u8BF7\u4F7F\u7528\u5DF2\u652F\u6301\u7684\u5BBF\u4E3B\u7248\u672C");let s=await L.rpc.call("/api",`zterm/${R}`,O,W);if(!s.ok)throw new Error(s.error?.message||`${le} \u8BF7\u6C42\u5931\u8D25`);return s.value}function it(T,R,O="text/plain;charset=utf-8"){let W=URL.createObjectURL(new Blob([R],{type:O})),L=document.createElement("a");L.href=W,L.download=T,L.click(),URL.revokeObjectURL(W)}function rt(){return new Date().toISOString().replace(/[-:]/g,"").replace(/T/,"-").slice(0,15)}function At(T,R=Date.now()){if(!T)return;let O=Date.parse(T);if(!Number.isFinite(O))return;let W=Math.floor((R-O)/1e3);if(!(W<2))return W<60?`\u5DF2 ${W} \u79D2`:`\u5DF2 ${Math.floor(W/60)} \u5206 ${W%60} \u79D2`}var Rt=0;function Tt(T,R){let O=new Map(T);if(R.reset){O.clear();for(let s of R.snapshots??[])O.set(s.terminalId,{generation:s.generation,text:s.text,seq:R.cursor,epoch:++Rt,end:s.text.length})}let W=new Map,L=s=>({generation:s,seq:Number.NEGATIVE_INFINITY,base:"",parts:[],epoch:++Rt,end:0});for(let s of R.output??[]){let o=O.get(s.terminalId),c=W.get(s.terminalId);c?c.generation!==s.generation&&(c=L(s.generation),W.set(s.terminalId,c)):(c=o&&o.generation===s.generation?{generation:s.generation,seq:o.seq,base:o.text,parts:[],epoch:o.epoch,end:o.end}:L(s.generation),W.set(s.terminalId,c)),!(s.seq<=c.seq)&&(c.seq=s.seq,c.parts.push(s.text),c.end+=s.text.length)}for(let[s,o]of W)o.parts.length&&O.set(s,{generation:o.generation,text:`${o.base}${o.parts.join("")}`.slice(-5e5),seq:o.seq,epoch:o.epoch,end:o.end});for(let s of O.keys())R.workspace.terminals.some(o=>o.id===s)||O.delete(s);return O}var he=require("react"),Ut=vt(Bt(),1),$t=vt(It(),1),jt=vt(Ot(),1);var Ve=require("react");function ze(T,R,O,W){try{let L=localStorage.getItem(T),s=L===null?R:Number(L);return Number.isFinite(s)?Math.max(O,Math.min(W,s)):R}catch{return R}}function Pe(T,R){try{localStorage.setItem(T,String(R))}catch{}}var qe=12,at=8,lt=32,St="dsh-zterm.terminal-font-size",Xe=new Set,ht;function Pt(T){return Number.isInteger(T)&&T>=at&&T<=lt}function Ct(){try{let T=localStorage.getItem(St),R=T===null?qe:Number(T);return Pt(R)?R:qe}catch{return ht??qe}}function Ht(){return ht??=Ct()}function Nt(T){T!==Ht()&&(ht=T,Xe.forEach(R=>R()))}function Ft(T){Pt(T)&&(Nt(T),Pe(St,T))}function zt(T){(T.key===St||T.key===null)&&Nt(Ct())}function pi(T){return!Xe.size&&typeof window<"u"&&(ht=Ct(),window.addEventListener("storage",zt)),Xe.add(T),()=>{Xe.delete(T),!Xe.size&&typeof window<"u"&&window.removeEventListener("storage",zt)}}function ct(){return(0,Ve.useSyncExternalStore)(pi,Ht,()=>qe)}function Ge(){let T=(0,Ve.useRef)(()=>{});return(0,Ve.useEffect)(()=>()=>T.current(),[]),(R,O)=>{R.preventDefault(),T.current();let W=()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",W),T.current=()=>{}};T.current=W,window.addEventListener("mousemove",O),window.addEventListener("mouseup",W,{once:!0})}}var Re=require("react/jsx-runtime"),vi=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.userAgentData?.platform||navigator.platform||"");function gi(T){return(/^[a-z]$/i.test(T.key)?T.key.toLowerCase()==="f":T.code==="KeyF")&&!T.altKey&&(vi?T.metaKey&&!T.ctrlKey&&!T.shiftKey:T.ctrlKey&&T.shiftKey&&!T.metaKey)}var mi=/^(?:\x1b\[[?>]?[\d;]*[cnRt]|\x1b\[\??\d+;\d+\$y|\x1bP[01]\$r[^\x1b]*\x1b\\|\x1b\][\d;]+;rgb:[\da-fA-F/]+(?:\x1b\\|\x07))+$/,Wt={epoch:-1,end:0,text:""};function Kt({ctx:T,sessionId:R,terminal:O,buffer:W,visible:L,onError:s}){let o=(0,he.useRef)(null),c=(0,he.useRef)(),f=(0,he.useRef)(),a=(0,he.useRef)(),n=(0,he.useRef)(Wt),d=(0,he.useRef)(O),_=(0,he.useRef)(s),h=(0,he.useRef)(Promise.resolve()),i=(0,he.useRef)(()=>{}),t=(0,he.useRef)(()=>{}),e=(0,he.useRef)(()=>{}),r=(0,he.useRef)(!1),[l,v]=(0,he.useState)(""),p=ct(),g=(0,he.useRef)(p),u=(0,he.useRef)(W);g.current=p,u.current=W,d.current=O,_.current=s;let m=()=>{let x=c.current,S=u.current,w=r.current;if(r.current=!1,!x||!S||S.generation!==d.current.generation)return;let A=n.current;if(A.epoch===S.epoch&&A.end===S.end)return;let z=A.epoch===S.epoch?A.end-(S.end-S.text.length):-1;z>=0&&z<=S.text.length?e.current(S.text.slice(z),w):S.text.startsWith(A.text)?e.current(S.text.slice(A.text.length),w||!!A.text):(x.reset(),e.current(S.text,!0)),n.current={epoch:S.epoch,end:S.end,text:S.text}},y=()=>{if(c.current||!o.current)return;let x=o.current,S=new Ut.Terminal({cursorBlink:!0,fontSize:g.current,fontFamily:"Menlo, Consolas, monospace",scrollback:5e3,allowProposedApi:!1,convertEol:!1,theme:{background:"#12161d",foreground:"#dce3ed",cursor:"#e4edf8",selectionBackground:"#334b66"}}),w=new $t.FitAddon,A=new jt.SearchAddon;S.loadAddon(w),S.loadAddon(A),S.open(x),c.current=S,a.current=w,f.current=A,n.current=Wt;let z=!1,U=0;e.current=(D,P)=>{if(D){if(!P){S.write(D);return}U++,S.write(D,()=>{U--})}};let q=S.onData(D=>{let P=d.current;P.state==="ready"&&(U>0&&mi.test(D)||(h.current=h.current.catch(()=>{}).then(async()=>{z||await ie(T,"input",{sessionId:R,terminalId:P.id,generation:P.generation,data:D})}).catch(K=>{z||_.current(K.message)})))}),$;i.current=()=>{if(z||!o.current?.clientWidth)return;w.fit();let D=d.current;D.state==="ready"&&ie(T,"resize",{sessionId:R,terminalId:D.id,generation:D.generation,cols:S.cols,rows:S.rows}).catch(P=>{z||_.current(P.message)})};let b=()=>{clearTimeout($),$=setTimeout(()=>i.current(),80)},E=new ResizeObserver(b);E.observe(x),b();let k=D=>{gi(D)&&(D.preventDefault(),D.stopPropagation(),document.getElementById(`zterm-find-${O.id}`)?.focus())};x.addEventListener("keydown",k,!0),t.current=()=>{z=!0,i.current=()=>{},e.current=()=>{},clearTimeout($),E.disconnect(),q.dispose(),x.removeEventListener("keydown",k,!0),S.dispose(),c.current=void 0}};return(0,he.useLayoutEffect)(()=>()=>{t.current(),t.current=()=>{}},[T,R,O.id,O.generation]),(0,he.useLayoutEffect)(()=>{L&&(y(),r.current=!0,m())},[L,T,R,O.id,O.generation]),(0,he.useEffect)(()=>{L&&m()},[W,O.generation]),(0,he.useLayoutEffect)(()=>{let x=c.current;!L||!x||x.options.fontSize===p||(x.options.fontSize=p,i.current())},[p,L]),(0,he.useEffect)(()=>{L&&(i.current(),c.current?.focus())},[L,O.state,O.generation]),(0,Re.jsxs)("div",{className:"zt-terminal-screen",style:{display:L?"flex":"none"},children:[(0,Re.jsxs)("div",{className:"zt-terminal-search",children:[(0,Re.jsx)("input",{id:`zterm-find-${O.id}`,"aria-label":"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",placeholder:"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",value:l,onChange:x=>{v(x.target.value),f.current?.findNext(x.target.value)},onKeyDown:x=>{x.key==="Enter"&&f.current?.findNext(l),x.key==="Escape"&&(v(""),c.current?.focus())}}),(0,Re.jsx)("button",{title:"\u4E0A\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findPrevious(l),children:"\u2191"}),(0,Re.jsx)("button",{title:"\u4E0B\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findNext(l),children:"\u2193"}),(0,Re.jsx)("span",{children:"\u7EC8\u7AEF\u8F93\u5165\u76F4\u63A5\u64CD\u4F5C\u5F53\u524D\u673A\u5668"})]}),(0,Re.jsx)("div",{className:"zt-terminal-canvas",ref:o})]})}var de=require("react");var He={password:"\u5BC6\u7801",key:"\u79C1\u94A5\u5185\u5BB9","key-file":"\u79C1\u94A5\u6587\u4EF6"};var Ee=require("react"),be=require("react/jsx-runtime");function Ye(T){let R=new Map;for(let s of T){let o=s.parentId??"";R.set(o,[...R.get(o)??[],s])}let O=(R.get("")??[]).slice().reverse().map(s=>({...s,depth:0})),W=[],L=new Set;for(;O.length;){let s=O.pop();if(!L.has(s.id)){L.add(s.id),W.push(s);for(let o of(R.get(s.id)??[]).slice().reverse())O.push({...o,depth:s.depth+1})}}return W}function bi({folder:T,onEdit:R,onDelete:O}){let W=(0,Ee.useRef)(null),L=(0,Ee.useRef)(null),s=(0,Ee.useId)(),[o,c]=(0,Ee.useState)(!1);(0,Ee.useEffect)(()=>{let n=W.current;n.setAttribute("popover","auto"),L.current.setAttribute("popovertarget",s);let d=()=>{let _=n.matches(":popover-open");if(c(_),!_)return;let h=L.current.getBoundingClientRect();n.style.left=`${Math.max(8,Math.min(h.right-n.offsetWidth,window.innerWidth-n.offsetWidth-8))}px`,n.style.top=`${Math.max(8,h.bottom+n.offsetHeight+4<=window.innerHeight-8?h.bottom+4:h.top-n.offsetHeight-4)}px`,n.querySelector("button")?.focus({preventScroll:!0})};return n.addEventListener("toggle",d),()=>n.removeEventListener("toggle",d)},[s]),(0,Ee.useEffect)(()=>{if(!o)return;let n=()=>W.current?.hidePopover();return window.addEventListener("resize",n),document.addEventListener("scroll",n,!0),()=>{window.removeEventListener("resize",n),document.removeEventListener("scroll",n,!0)}},[o]);let f=n=>{W.current?.hidePopover(),n(T)},a=n=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();let d=[...n.currentTarget.querySelectorAll("button")],_=d.indexOf(document.activeElement),h=n.key==="Home"?0:n.key==="End"?d.length-1:(_+(n.key==="ArrowUp"?-1:1)+d.length)%d.length;d[h]?.focus()};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("button",{ref:L,className:"zt-folder-action","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${T.label}`,title:"\u6587\u4EF6\u5939\u64CD\u4F5C","aria-haspopup":"menu","aria-controls":s,"aria-expanded":o,children:"\u22EF"}),(0,be.jsxs)("div",{ref:W,id:s,className:"zt-folder-menu",role:"menu","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${T.label}`,onKeyDown:a,children:[(0,be.jsx)("button",{role:"menuitem",onClick:()=>f(R),children:"\u66F4\u540D"}),(0,be.jsx)("button",{role:"menuitem",onClick:()=>f(O),children:"\u5220\u9664"})]})]})}function qt({folders:T,selected:R,onSelect:O,onEdit:W,onDelete:L}){let[s,o]=(0,Ee.useState)(new Set),c=Ye(T),f=new Set,a=new Set(T.map(n=>n.parentId));return(0,be.jsxs)("nav",{className:"zt-folder-tree","aria-label":"\u4E3B\u673A\u6587\u4EF6\u5939",children:[(0,be.jsx)("button",{className:R===""?"active":"",onClick:()=>O(""),children:"\u25B1 \u6839\u76EE\u5F55(\u5168\u90E8\u4E3B\u673A)"}),c.map(n=>n.parentId&&(s.has(n.parentId)||f.has(n.parentId))?(f.add(n.id),null):(0,be.jsxs)("div",{style:{paddingLeft:`min(${Math.min(8,n.depth)*12}px, 25%)`},children:[(0,be.jsx)("button",{className:"zt-folder-toggle","aria-label":`${s.has(n.id)?"\u5C55\u5F00":"\u6536\u8D77"}\u6587\u4EF6\u5939 ${n.label}`,disabled:!a.has(n.id),onClick:()=>o(d=>{let _=new Set(d);return _.has(n.id)?_.delete(n.id):_.add(n.id),_}),children:a.has(n.id)?s.has(n.id)?"\u25B8":"\u25BE":"\xB7"}),(0,be.jsxs)("button",{className:`zt-folder-name${R===n.id?" active":""}`,onClick:()=>O(n.id),title:n.label,children:["\u25B1 ",n.label]}),(0,be.jsx)(bi,{folder:n,onEdit:W,onDelete:L})]},n.id))]})}var F=require("react/jsx-runtime");function Ne({title:T,children:R,onClose:O}){let W=(0,de.useRef)(null),L=(0,de.useRef)(O);return L.current=O,(0,de.useEffect)(()=>{let s=document.activeElement,o=W.current;(o?.querySelector("input,select,textarea")??o?.querySelector("button")??o)?.focus();let c=f=>{if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),L.current();return}if(f.key!=="Tab")return;let a=[...o?.querySelectorAll('button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')??[]].filter(_=>_.offsetParent!==null),n=a[0],d=a.at(-1);n?f.shiftKey&&(document.activeElement===n||document.activeElement===o)?(f.preventDefault(),d?.focus()):!f.shiftKey&&document.activeElement===d&&(f.preventDefault(),n.focus()):(f.preventDefault(),o?.focus())};return o?.addEventListener("keydown",c),()=>{o?.removeEventListener("keydown",c),s?.isConnected&&s.focus()}},[]),(0,F.jsx)("div",{className:"zt-modal-shade",onMouseDown:s=>{s.target===s.currentTarget&&O()},children:(0,F.jsxs)("section",{ref:W,tabIndex:-1,className:"zt-modal",role:"dialog","aria-modal":"true","aria-label":T,children:[(0,F.jsxs)("header",{children:[(0,F.jsx)("strong",{children:T}),(0,F.jsx)("button",{"aria-label":"\u5173\u95ED\u5BF9\u8BDD\u6846",onClick:O,children:"\xD7"})]}),R]})})}function _e({title:T,children:R}){return(0,F.jsxs)("label",{className:"zt-field",children:[(0,F.jsx)("span",{children:T}),R]})}function Vt({ctx:T,host:R,folders:O,credentials:W=[],defaultCredentialId:L,revision:s,onClose:o,onSaved:c}){let[f,a]=(0,de.useState)({label:R?.label??"",host:R?.host??"",port:String(R?.port??22),username:R?.username??"",authType:R?.authType??"key-file",privateKeyPath:R?.privateKeyPath??"",folderId:R?.folderId??""}),[n,d]=(0,de.useState)(""),[_,h]=(0,de.useState)(""),[i,t]=(0,de.useState)(!1),[e,r]=(0,de.useState)(""),[l,v]=(0,de.useState)(!1),[p,g]=(0,de.useState)(R?.credentialId||!R&&W.length?"saved":R?.authType??"key-file"),[u,m]=(0,de.useState)(R?.credentialId||L||W[0]?.id||""),y=R&&!R.credentialId&&R.authType===p,x=(S,w)=>a(A=>({...A,[S]:w}));return(0,F.jsx)(Ne,{title:R?"\u7F16\u8F91\u8FDC\u7A0B\u4E3B\u673A":"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A",onClose:o,children:(0,F.jsxs)("form",{onSubmit:S=>{S.preventDefault(),v(!0),r(""),ie(T,"host/save",{host:{...R,...f,credentialId:p==="saved"?u:void 0,folderId:f.folderId||void 0,port:Number(f.port),kind:"ssh"},secret:p==="saved"?"":n,passphrase:p==="saved"?"":_,clearPassphrase:i,revision:s}).then(()=>{d(""),h(""),c(),o()}).catch(w=>r(w.message)).finally(()=>v(!1))},children:[(0,F.jsx)(_e,{title:"\u540D\u79F0",children:(0,F.jsx)("input",{required:!0,value:f.label,onChange:S=>x("label",S.target.value)})}),(0,F.jsxs)("div",{className:"zt-form-row",children:[(0,F.jsx)(_e,{title:"\u4E3B\u673A\u5730\u5740",children:(0,F.jsx)("input",{required:!0,value:f.host,placeholder:"\u4E3B\u673A\u540D\u6216 IP",onChange:S=>x("host",S.target.value)})}),(0,F.jsx)(_e,{title:"\u7AEF\u53E3",children:(0,F.jsx)("input",{type:"number",required:!0,min:"1",max:"65535",value:f.port,onChange:S=>x("port",S.target.value)})})]}),(0,F.jsx)(_e,{title:"\u767B\u5F55\u8D26\u53F7",children:(0,F.jsx)("input",{required:!0,value:f.username,onChange:S=>x("username",S.target.value)})}),(0,F.jsx)(_e,{title:"\u6587\u4EF6\u5939",children:(0,F.jsxs)("select",{value:f.folderId,onChange:S=>x("folderId",S.target.value),children:[(0,F.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).map(S=>(0,F.jsxs)("option",{value:S.id,children:["\u3000".repeat(Math.min(8,S.depth)),S.label]},S.id))]})}),(0,F.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,F.jsxs)("select",{value:p,onChange:S=>{g(S.target.value),S.target.value!=="saved"&&x("authType",S.target.value),d(""),h(""),t(!1)},children:[(0,F.jsx)("option",{value:"saved",children:"\u9009\u62E9\u5DF2\u4FDD\u5B58\u51ED\u8BC1"}),(0,F.jsx)("option",{value:"password",children:"\u5BC6\u7801"}),(0,F.jsx)("option",{value:"key",children:"\u79C1\u94A5\u5185\u5BB9"}),(0,F.jsx)("option",{value:"key-file",children:"\u79C1\u94A5\u6587\u4EF6"})]})}),p==="saved"&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(_e,{title:"\u767B\u5F55\u51ED\u8BC1",children:(0,F.jsxs)("select",{required:!0,value:u,onChange:S=>m(S.target.value),children:[(0,F.jsx)("option",{value:"",children:"\u8BF7\u9009\u62E9\u51ED\u8BC1"}),W.map(S=>(0,F.jsxs)("option",{value:S.id,children:[S.label," \xB7 ",He[S.authType]]},S.id))]})}),(0,F.jsx)("p",{className:"zt-hint",children:"\u51ED\u8BC1\u5728\u300C\u8BBE\u7F6E \u2192 zTerm \u2192 \u7BA1\u7406\u51ED\u8BC1\u300D\u4E2D\u4FDD\u5B58\uFF0C\u6B64\u5904\u65E0\u9700\u518D\u586B\u5185\u5BB9\u6216\u8DEF\u5F84\u3002"})]}),["password","key"].includes(p)&&(0,F.jsx)(_e,{title:f.authType==="key"?"\u79C1\u94A5\u5185\u5BB9":"\u5BC6\u7801",children:f.authType==="key"?(0,F.jsx)("textarea",{rows:5,value:n,placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9",onChange:S=>d(S.target.value),spellCheck:!1,required:!y}):(0,F.jsx)("input",{type:"password",value:n,autoComplete:"new-password",placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:S=>d(S.target.value),required:!y})}),p==="key-file"&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(_e,{title:"\u79C1\u94A5\u6587\u4EF6\u8DEF\u5F84",children:(0,F.jsx)("input",{value:f.privateKeyPath,placeholder:"\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6",onChange:S=>x("privateKeyPath",S.target.value)})}),(0,F.jsx)("p",{className:"zt-hint",children:"\u586B\u5199 DSH \u5BBF\u4E3B\u4E0A\u7684\u7EDD\u5BF9\u8DEF\u5F84\u6216 ~/ \u8DEF\u5F84\u3002DSH \u90E8\u7F72\u5728\u8FDC\u7AEF\u65F6\uFF0C\u586B\u5199\u8FDC\u7AEF\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})]}),["key","key-file"].includes(p)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(_e,{title:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09",children:(0,F.jsx)("input",{type:"password",disabled:i,value:_,placeholder:"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4",onChange:S=>h(S.target.value)})}),R?.passphraseRef&&(0,F.jsxs)("label",{className:"zt-check",children:[(0,F.jsx)("input",{type:"checkbox",checked:i,onChange:S=>t(S.target.checked)}),"\u79FB\u9664\u6B64\u4E3B\u673A\u7684\u79C1\u94A5\u53E3\u4EE4\u5F15\u7528"]})]}),(0,F.jsx)("p",{className:"zt-hint",children:"\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u4FDD\u5B58\u5728 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u7531\u5BBF\u4E3B\u8BFB\u53D6\u3002\u6240\u6709\u65B0\u8FDE\u63A5\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\u3002"}),e&&(0,F.jsx)("p",{className:"zt-error",role:"alert",children:e}),(0,F.jsxs)("footer",{children:[(0,F.jsx)("button",{type:"button",onClick:o,children:"\u53D6\u6D88"}),(0,F.jsx)("button",{className:"zt-primary",disabled:l,children:l?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u4E3B\u673A"})]})]})})}function Gt({ctx:T,profile:R,revision:O,onClose:W,onSaved:L}){let[s,o]=(0,de.useState)({label:R?.label??"",baseUrl:R?.baseUrl??"",authMode:R?.authMode??"access_key",username:R?.username??"",verifyTls:R?.verifyTls??!0}),[c,f]=(0,de.useState)(""),[a,n]=(0,de.useState)(""),[d,_]=(0,de.useState)(""),[h,i]=(0,de.useState)(!1);return(0,F.jsx)(Ne,{title:R?"\u7F16\u8F91 JumpServer":"\u6DFB\u52A0 JumpServer",onClose:W,children:(0,F.jsxs)("form",{onSubmit:t=>{t.preventDefault(),i(!0),_(""),ie(T,"jump/save",{profile:{...R,...s},secret:c,accessKeyId:a,revision:O}).then(()=>{f(""),n(""),L(),W()}).catch(e=>_(e.message)).finally(()=>i(!1))},children:[(0,F.jsx)(_e,{title:"\u540D\u79F0",children:(0,F.jsx)("input",{required:!0,value:s.label,onChange:t=>o({...s,label:t.target.value})})}),(0,F.jsx)(_e,{title:"\u670D\u52A1\u5730\u5740",children:(0,F.jsx)("input",{required:!0,type:"url",value:s.baseUrl,placeholder:"https://jump.example.com",onChange:t=>o({...s,baseUrl:t.target.value})})}),(0,F.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,F.jsxs)("select",{value:s.authMode,onChange:t=>o({...s,authMode:t.target.value}),children:[(0,F.jsx)("option",{value:"access_key",children:"Access Key"}),(0,F.jsx)("option",{value:"token",children:"Token"}),(0,F.jsx)("option",{value:"password",children:"\u8D26\u53F7\u5BC6\u7801"})]})}),s.authMode==="access_key"&&(0,F.jsx)(_e,{title:"Access Key ID",children:(0,F.jsx)("input",{type:"password",value:a,placeholder:R?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>n(t.target.value)})}),s.authMode==="password"&&(0,F.jsx)(_e,{title:"\u8D26\u53F7",children:(0,F.jsx)("input",{required:!0,value:s.username,onChange:t=>o({...s,username:t.target.value})})}),(0,F.jsx)(_e,{title:s.authMode==="access_key"?"Access Key Secret":s.authMode==="token"?"Token":"\u5BC6\u7801",children:(0,F.jsx)("input",{type:"password",value:c,placeholder:R?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>f(t.target.value)})}),(0,F.jsxs)("label",{className:"zt-check",children:[(0,F.jsx)("input",{type:"checkbox",checked:s.verifyTls,onChange:t=>o({...s,verifyTls:t.target.checked})}),"\u9A8C\u8BC1 TLS \u8BC1\u4E66"]}),(0,F.jsx)("p",{className:"zt-hint",children:"\u8FDE\u63A5\u4F7F\u7528\u8D44\u4EA7\u4E0E\u8D26\u53F7\u7684\u7A33\u5B9A ID\uFF0C\u4EE4\u724C\u4EC5\u5728\u5BBF\u4E3B\u5185\u90E8\u5904\u7406\u3002"}),d&&(0,F.jsx)("p",{className:"zt-error",role:"alert",children:d}),(0,F.jsxs)("footer",{children:[(0,F.jsx)("button",{type:"button",onClick:W,children:"\u53D6\u6D88"}),(0,F.jsx)("button",{className:"zt-primary",disabled:h,children:h?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u5B9E\u4F8B"})]})]})})}function Jt({ctx:T,folder:R,folders:O,revision:W,onClose:L,onSaved:s}){let[o,c]=(0,de.useState)(R?.label??""),[f,a]=(0,de.useState)(R?.parentId??""),[n,d]=(0,de.useState)(""),[_,h]=(0,de.useState)(!1),i=new Set;if(R){i.add(R.id);for(let t of Ye(O))t.parentId&&i.has(t.parentId)&&i.add(t.id)}return(0,F.jsx)(Ne,{title:R?"\u7F16\u8F91\u4E3B\u673A\u6587\u4EF6\u5939":"\u65B0\u5EFA\u4E3B\u673A\u6587\u4EF6\u5939",onClose:L,children:(0,F.jsxs)("form",{onSubmit:t=>{t.preventDefault(),h(!0),ie(T,"folder/save",{folder:{id:R?.id,label:o,parentId:f||void 0},revision:W}).then(()=>{s(),L()}).catch(e=>d(e.message)).finally(()=>h(!1))},children:[(0,F.jsx)(_e,{title:"\u540D\u79F0",children:(0,F.jsx)("input",{required:!0,value:o,onChange:t=>c(t.target.value)})}),(0,F.jsx)(_e,{title:"\u7236\u6587\u4EF6\u5939",children:(0,F.jsxs)("select",{value:f,onChange:t=>a(t.target.value),children:[(0,F.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).filter(t=>!i.has(t.id)).map(t=>(0,F.jsxs)("option",{value:t.id,children:["\u3000".repeat(Math.min(8,t.depth)),t.label]},t.id))]})}),n&&(0,F.jsx)("p",{className:"zt-error",role:"alert",children:n}),(0,F.jsxs)("footer",{children:[(0,F.jsx)("button",{type:"button",onClick:L,children:"\u53D6\u6D88"}),(0,F.jsx)("button",{disabled:_,className:"zt-primary",children:_?"\u4FDD\u5B58\u4E2D\u2026":R?"\u4FDD\u5B58":"\u521B\u5EFA"})]})]})})}var Ae=require("react");var Me=require("react/jsx-runtime");function Xt({ctx:T,instanceId:R,nodes:O,selected:W,onSelect:L,onError:s}){let[o,c]=(0,Ae.useState)(new Map),[f,a]=(0,Ae.useState)(new Set),[n,d]=(0,Ae.useState)(new Set),_=(0,Ae.useRef)(!0),h=(0,Ae.useRef)(new AbortController);(0,Ae.useEffect)(()=>()=>{_.current=!1,h.current.abort()},[]);let i=async l=>{if(f.has(l.nodeId)){a(v=>{let p=new Set(v);return p.delete(l.nodeId),p});return}if(!o.has(l.nodeId)){d(v=>new Set(v).add(l.nodeId));try{let v=await ie(T,"jump/query",{instanceId:R,operation:"nodes",parentKey:l.key||l.nodeId},h.current.signal);if(!_.current)return;c(p=>new Map(p).set(l.nodeId,v.nodes??[]))}catch(v){_.current&&s(v.message);return}finally{_.current&&d(v=>{let p=new Set(v);return p.delete(l.nodeId),p})}}a(v=>new Set(v).add(l.nodeId))},t=O.slice().reverse().map(l=>({node:l,depth:0})),e=[],r=new Set;for(;t.length&&e.length<500;){let l=t.pop();if(!r.has(l.node.nodeId)&&(r.add(l.node.nodeId),e.push(l),f.has(l.node.nodeId)))for(let v of(o.get(l.node.nodeId)??[]).slice().reverse())t.push({node:v,depth:l.depth+1})}return(0,Me.jsxs)("nav",{className:"zt-folder-tree","aria-label":"JumpServer \u8D44\u4EA7\u8282\u70B9",children:[(0,Me.jsx)("button",{className:W?"":"active",onClick:()=>L(""),children:"\u25A4 \u5168\u90E8\u8D44\u4EA7"}),e.map(({node:l,depth:v})=>(0,Me.jsxs)("div",{style:{paddingLeft:Math.min(8,v)*12},children:[(0,Me.jsx)("button",{className:"zt-folder-toggle",disabled:!l.hasChildren||n.has(l.nodeId),"aria-label":`\u5C55\u5F00\u8D44\u4EA7\u8282\u70B9 ${l.name}`,onClick:()=>void i(l),children:n.has(l.nodeId)?"\u2026":l.hasChildren?f.has(l.nodeId)?"\u25BE":"\u25B8":"\xB7"}),(0,Me.jsxs)("button",{className:W===l.nodeId?"active":"",onClick:()=>L(l.nodeId),title:l.name,children:[l.name," (",l.assetCount,")"]})]},l.nodeId)),t.length>0&&(0,Me.jsx)("p",{className:"zt-hint",children:"\u8282\u70B9\u663E\u793A\u5DF2\u8FBE 500 \u9879\uFF0C\u8BF7\u6536\u8D77\u90E8\u5206\u8282\u70B9\u3002"})]})}var Fe=require("react");var dt=require("react/jsx-runtime");function wt({children:T,label:R,storageKey:O}){let W=(0,Fe.useRef)(null),L=Ge(),[s,o]=(0,Fe.useState)(()=>ze(O,165,56,Number.MAX_SAFE_INTEGER)),[c,f]=(0,Fe.useState)(165);(0,Fe.useLayoutEffect)(()=>{let i=W.current?.parentElement;if(!i)return;let t=()=>f(Math.max(8,i.clientHeight-120));t();let e=new ResizeObserver(t);return e.observe(i),()=>e.disconnect()},[]);let a=Math.min(56,c),n=Math.max(a,Math.min(c,s)),d=i=>{let t=Math.max(a,Math.min(c,Math.round(i)));o(t),Pe(O,t)};return(0,dt.jsxs)("div",{ref:W,className:"zt-tree-pane",style:{height:n},children:[T,(0,dt.jsx)("div",{className:"zt-tree-handle",role:"separator","aria-label":R,"aria-orientation":"horizontal",tabIndex:0,"aria-valuemin":a,"aria-valuemax":c,"aria-valuenow":n,onMouseDown:i=>{if(i.button!==0)return;let t=i.clientY,e=W.current?.getBoundingClientRect().height??n;L(i,r=>d(e+r.clientY-t))},onKeyDown:i=>{let t;if(i.key==="ArrowUp")t=n-10;else if(i.key==="ArrowDown")t=n+10;else if(i.key==="Home")t=a;else if(i.key==="End")t=c;else return;i.preventDefault(),d(t)}})]})}var B=require("react/jsx-runtime"),Yt={terminals:[],operations:[],revision:0,capabilities:{local:!1,external:!1},hostPlatform:""},Zt={connecting:"\u8FDE\u63A5\u4E2D",ready:"\u5DF2\u8FDE\u63A5",disconnected:"\u5DF2\u65AD\u5F00",error:"\u8FDE\u63A5\u5931\u8D25",executing:"\u6267\u884C\u4E2D",completed:"\u5B8C\u6210",failed:"\u5931\u8D25",unknown:"\u7ED3\u679C\u4E0D\u660E",blocked:"\u5DF2\u62D2\u7EDD",not_sent:"\u672A\u4E0B\u53D1"},ut=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`page-${Date.now()}-${Math.random()}`;function yt({ctx:T,sessionId:R,visible:O=!0,onClose:W}){let[L,s]=(0,ee.useState)(Yt),[o,c]=(0,ee.useState)(new Map),[f,a]=(0,ee.useState)(""),[n,d]=(0,ee.useState)(""),[_,h]=(0,ee.useState)(),[i,t]=(0,ee.useState)(""),[e,r]=(0,ee.useState)(0),[l,v]=(0,ee.useState)(""),[p,g]=(0,ee.useState)("ssh"),[u,m]=(0,ee.useState)(!1),[y,x]=(0,ee.useState)(!1),[S,w]=(0,ee.useState)(!1),[A,z]=(0,ee.useState)(""),[U,q]=(0,ee.useState)(""),[$,b]=(0,ee.useState)([]),[E,k]=(0,ee.useState)(),[D,P]=(0,ee.useState)(),[K,Y]=(0,ee.useState)(),[Z,M]=(0,ee.useState)(!1),[C,H]=(0,ee.useState)(!1),[N,V]=(0,ee.useState)(()=>ze("dsh-zterm.list-width",240,180,440)),[j,te]=(0,ee.useState)(!1),[ne,oe]=(0,ee.useState)(!1),[fe,X]=(0,ee.useState)(),Ce=(0,ee.useRef)(!0),We=(0,ee.useRef)(O),Be=(0,ee.useRef)(-1),Ue=(0,ee.useRef)(async()=>{}),Ie=(0,ee.useRef)(f),me=(0,ee.useRef)(0),ke=(0,ee.useRef)(0),we=(0,ee.useRef)(null),Te=(0,ee.useRef)(null),Je=Ge();We.current=O,Ie.current=f;let se=(0,ee.useCallback)(I=>d(I),[]);(0,ee.useEffect)(()=>{Ce.current=!0,s(Yt),c(new Map),Be.current=-1;let I=!1,re=!1,ce,Oe,Ke=new AbortController,ai=async()=>{try{re||(await ie(T,"client/attach",{sessionId:R,pageId:ut},Ke.signal),re=!0);let De=await ie(T,"poll",{sessionId:R,cursor:Be.current},Ke.signal);if(I)return;Be.current=De.cursor,s(De.workspace),c(_t=>Tt(_t,De)),De.workspace.terminals.some(_t=>_t.id===Ie.current)||a(De.workspace.terminals[0]?.id??"")}catch(De){I||d(De instanceof Error?De.message:"\u65E0\u6CD5\u8BFB\u53D6\u7EC8\u7AEF\u72B6\u6001")}},kt=()=>Oe||(Oe=ai().finally(()=>{Oe=void 0}),Oe),Dt=async()=>{await kt(),I||(ce=setTimeout(Dt,We.current?200:1e3))};return Ue.current=kt,Dt(),ie(T,"saved-workspace",{sessionId:R}).then(De=>{I||oe(De.length>0)}).catch(()=>{}),()=>{I=!0,Ce.current=!1,clearTimeout(ce),Ke.abort()}},[T,R]);let ye=(0,ee.useCallback)(async I=>{let re=++me.current,ce=await ie(T,"catalog",{query:i,offset:e,folderId:l||void 0},I);I?.aborted||re!==me.current||!Ce.current||(h(ce),!A&&ce.jumpservers.length&&z(ce.jumpservers[0].id))},[T,i,e,l,A]);(0,ee.useEffect)(()=>{let I=new AbortController,re=setTimeout(()=>{ye(I.signal).catch(ce=>{I.signal.aborted||se(ce.message)})},150);return()=>{clearTimeout(re),I.abort()}},[ye,se,L.catalogRevision]);let ae=(0,ee.useCallback)(async(I,re={})=>{te(!0),d("");try{let ce=await ie(T,I,{sessionId:R,pageId:ut,...re});if(Ce.current)return await Ue.current(),ce}catch(ce){Ce.current&&se(ce instanceof Error?ce.message:"\u64CD\u4F5C\u5931\u8D25")}finally{Ce.current&&te(!1)}},[T,R,se]),Le=async I=>{let re=await ae("connect",{target:I});re?.id&&a(re.id)};(0,ee.useEffect)(()=>{if(!O||!we.current)return;let I=()=>Te.current?.scrollIntoView({block:"nearest",inline:"nearest"});I();let re=new ResizeObserver(I);return re.observe(we.current),()=>re.disconnect()},[f,O,L.terminals.length]);let J=L.terminals.find(I=>I.id===f),xe=L.binding,Ze=J&&xe?.terminalId===J.id&&xe.generation===J.generation,ve=L.terminals.find(I=>I.trust),$e=ve?{terminalId:ve.id,generation:ve.generation}:{},Qe=I=>I.target.source==="local"?I.target.label:`${I.target.username??""}@${I.target.host??I.target.label}${I.target.port?`:${I.target.port}`:""}`,je=J?{terminalId:J.id,generation:J.generation}:{},si=J?L.operations.filter(I=>I.status==="executing"&&I.terminalId===J.id).at(-1)?.startedAt??(J.state==="connecting"?J.createdAt:void 0):void 0,Et=At(si),et=_?.jumpservers?.find(I=>I.id===A);(0,ee.useEffect)(()=>{if(p!=="jumpserver"||!A)return;let I=!0;return b([]),ie(T,"jump/query",{instanceId:A,operation:"nodes"}).then(re=>{I&&b(re.nodes??[])}).catch(re=>{I&&se(re.message)}),()=>{I=!1}},[T,A,p,se]),(0,ee.useEffect)(()=>{if(p!=="jumpserver"||!A)return;let I=!0;k(void 0);let re=setTimeout(()=>{ie(T,"jump/query",{instanceId:A,operation:"assets",nodeId:U||void 0,query:i,offset:e,limit:100}).then(ce=>{I&&k(ce)}).catch(ce=>{I&&se(ce.message)})},200);return()=>{I=!1,clearTimeout(re)}},[T,A,U,i,e,p,se]),(0,ee.useEffect)(()=>{ke.current++,P(void 0)},[A,p]);let ni=async I=>{let re=++ke.current;Y(I),P(void 0);try{let ce=await ie(T,"jump/query",{instanceId:A,operation:"accounts",assetId:I.assetId});re===ke.current&&Ce.current&&P(ce.accounts)}catch(ce){re===ke.current&&Ce.current&&se(ce.message)}},oi=I=>{let re=I.clientX,ce=N;Je(I,Oe=>{let Ke=Math.max(180,Math.min(440,ce+re-Oe.clientX));V(Ke),Pe("dsh-zterm.list-width",Ke)})};return(0,B.jsxs)("div",{className:"zt-workbench",children:[_?.temporarilyDisabled&&(0,B.jsx)("div",{className:"zt-workbench-notice",role:"status",children:"zTerm \u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230\u672C\u63D2\u4EF6\u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\uFF1B\u624B\u5DE5\u8FDE\u63A5\u3001\u7EC8\u7AEF\u548C\u914D\u7F6E\u7BA1\u7406\u4ECD\u53EF\u4F7F\u7528\u3002\u53EF\u5728\u300C\u8BBE\u7F6E \u2192 zTerm\u300D\u6062\u590D\u3002"}),n&&(0,B.jsxs)("div",{className:"zt-error-banner",role:"alert",children:[(0,B.jsx)("span",{children:n}),(0,B.jsx)("button",{"aria-label":"\u5173\u95ED\u9519\u8BEF\u63D0\u793A",onClick:()=>d(""),children:"\xD7"})]}),(0,B.jsxs)("div",{className:"zt-workbench-body",children:[(0,B.jsxs)("main",{className:"zt-terminal-area",children:[(0,B.jsxs)("div",{className:"zt-terminal-topbar",children:[(0,B.jsx)("nav",{ref:we,className:"zt-terminal-tabs","aria-label":"\u7EC8\u7AEF\u6807\u7B7E",children:L.terminals.map(I=>(0,B.jsxs)("div",{ref:I.id===f?Te:void 0,className:`zt-tab ${I.id===f?"active":""}`,children:[(0,B.jsxs)("button",{onClick:()=>a(I.id),title:Qe(I),children:[(0,B.jsx)("i",{className:`zt-state-dot ${I.state}`}),I.target.label]}),(0,B.jsx)("button",{"aria-label":`\u5173\u95ED\u7EC8\u7AEF ${I.target.label}`,onClick:()=>X({text:`\u5173\u95ED\u300C${I.target.label}\u300D\u7684\u7EC8\u7AEF\u8FDE\u63A5\uFF1F`,act:()=>{ae("close",{terminalId:I.id}),X(void 0)}}),children:"\xD7"})]},I.id))}),(0,B.jsxs)("div",{className:"zt-terminal-controls",children:[(0,B.jsx)("button",{disabled:!L.capabilities.local||j,title:L.capabilities.local?"\u6BCF\u6B21\u70B9\u51FB\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\uFF0C\u8FD0\u884C\u5728 DSH \u6240\u5728\u7684\u673A\u5668\u4E0A":`\u8BF7\u5728 ${le} \u8BBE\u7F6E\u4E2D\u542F\u7528\u672C\u5730\u7EC8\u7AEF\u5E76\u4FDD\u5B58`,onClick:()=>void Le({kind:"local"}),children:"\u6253\u5F00\u672C\u673A\u7EC8\u7AEF"}),(0,B.jsx)("button",{title:"\u64CD\u4F5C\u8BB0\u5F55",onClick:()=>M(!Z),children:"\u8BB0\u5F55"}),C&&(0,B.jsx)("button",{title:"\u663E\u793A\u673A\u5668\u5217\u8868","aria-expanded":!1,onClick:()=>H(!1),children:"\u673A\u5668\u5217\u8868"}),W&&(0,B.jsx)("button",{"aria-label":`\u6536\u8D77 ${le}`,onClick:W,children:"\xD7"})]})]}),J?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"zt-terminal-toolbar",children:[(0,B.jsxs)("div",{className:"zt-target",title:Qe(J),children:[Qe(J),(0,B.jsxs)("span",{children:[Zt[J.state],J.busy?" \xB7 AI \u6267\u884C\u4E2D":"",Et?` \xB7 ${Et}`:""]})]}),(0,B.jsxs)("div",{className:"zt-actions",children:[(0,B.jsx)("button",{disabled:j||J.state!=="ready"||!J.agentReady||J.uncertain,onClick:()=>void ae("bind",je),children:Ze?"\u5DF2\u7ED1\u5B9A AI":"\u7ED1\u5B9A AI"}),(0,B.jsxs)("label",{className:`zt-mode ${Ze&&xe.mode==="readwrite"?"write":""}`,title:"\u672A\u52FE\u9009\uFF1A\u8BFB\u6A21\u5F0F\uFF0CAI \u4EC5\u53EF\u4F7F\u7528\u5185\u7F6E\u67E5\u8BE2\u5DE5\u5177\uFF1B\u52FE\u9009\uFF1A\u8BFB\u5199\u6A21\u5F0F\uFF0CAI \u53EF\u6267\u884C\u5DF2\u6388\u6743\u7684\u547D\u4EE4\u3002",children:[(0,B.jsx)("input",{type:"checkbox","aria-label":"\u5141\u8BB8AI\u5199\u64CD\u4F5C",checked:!!(Ze&&xe.mode==="readwrite"),disabled:!Ze||j||!J.agentReady||J.uncertain,onChange:I=>void ae("mode",{...je,mode:I.target.checked?"readwrite":"read"})}),"\u5141\u8BB8AI\u5199\u64CD\u4F5C"]}),(0,B.jsx)("button",{disabled:!J.busy,onClick:()=>void ae("stop",je),children:"\u505C\u6B62"}),(0,B.jsx)("button",{disabled:j||J.busy,onClick:()=>void ae(J.state==="ready"?"disconnect":"reconnect",je),children:J.state==="ready"?"\u65AD\u5F00":"\u91CD\u8FDE"})]})]}),!J.agentReady&&J.state==="ready"&&!J.uncertain&&(0,B.jsxs)("div",{className:"zt-notice",children:["\u624B\u5DE5\u8F93\u5165\u540E\uFF0CAI \u5DF2\u6682\u505C\u64CD\u4F5C\u3002\u786E\u8BA4\u7EC8\u7AEF\u56DE\u5230\u7A7A\u95F2 Shell \u540E\uFF1A",(0,B.jsx)("button",{onClick:()=>void ae("shell-ready",je),children:"\u786E\u8BA4\u7A7A\u95F2 Shell"})]}),J.uncertain&&(0,B.jsxs)("div",{className:"zt-notice danger",children:["\u524D\u6B21\u64CD\u4F5C\u7ED3\u679C\u4E0D\u660E\uFF0C\u5DF2\u505C\u6B62\u81EA\u52A8\u4E0B\u53D1\u3002\u6838\u5B9E\u673A\u5668\u72B6\u6001\u540E\u91CD\u65B0\u5EFA\u7ACB\u8FDE\u63A5\u3002",(0,B.jsx)("button",{disabled:j||J.busy,onClick:()=>X({text:`\u91CD\u5EFA\u300C${J.target.label}\u300D\u7684\u8FDE\u63A5\uFF1F\u5F53\u524D Shell \u4F1A\u65AD\u5F00\uFF0C\u4ECD\u5728\u524D\u53F0\u8FD0\u884C\u7684\u547D\u4EE4\u53EF\u80FD\u968F\u4E4B\u7EC8\u6B62\uFF0C\u8BF7\u5148\u5728\u7EC8\u7AEF\u6838\u5B9E\u8FDC\u7AEF\u72B6\u6001\u3002`,act:()=>{ae("reconnect",je),X(void 0)}}),children:"\u91CD\u5EFA\u8FDE\u63A5"})]}),J.error&&(0,B.jsx)("div",{className:"zt-notice danger",children:J.error})]}):(0,B.jsxs)("div",{className:"zt-empty",children:[(0,B.jsx)("div",{className:"zt-terminal-mark",children:">_"}),(0,B.jsx)("h3",{children:"\u8FDE\u63A5\u4E00\u53F0\u673A\u5668"}),(0,B.jsxs)("p",{children:["\u4ECE\u53F3\u4FA7\u9009\u62E9\u4E3B\u673A\u6216 JumpServer \u8D44\u4EA7\u3002",(0,B.jsx)("br",{}),"\u8FDE\u63A5\u540E\u53EF\u624B\u5DE5\u64CD\u4F5C\uFF0C\u6216\u7ED1\u5B9A\u7ED9\u5F53\u524D DSH \u5BF9\u8BDD\u4E2D\u7684 AI\u3002"]}),L.capabilities.automatic&&(0,B.jsx)("p",{children:"\u4E5F\u53EF\u5728\u5BF9\u8BDD\u4E2D\u6307\u5B9A\u4E3B\u673A\u540D\u6216 IP\uFF0CAI \u4F1A\u5148\u67E5\u8FDC\u7A0B\u4E3B\u673A\uFF0C\u518D\u67E5 JumpServer\uFF0C\u6700\u540E\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u3002"}),(0,B.jsx)("button",{className:"zt-primary",onClick:()=>m(null),children:"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A"}),ne&&(0,B.jsx)("button",{onClick:()=>void ae("restore"),children:"\u6062\u590D\u4E0A\u6B21\u7EC8\u7AEF\u5217\u8868\uFF08\u9ED8\u8BA4\u53EA\u8BFB\uFF09"})]}),(0,B.jsx)("div",{className:"zt-screens",children:L.terminals.map(I=>(0,B.jsx)(Kt,{ctx:T,sessionId:R,terminal:I,buffer:o.get(I.id),visible:O&&I.id===f,onError:se},`${I.id}:${I.generation}`))}),(0,B.jsxs)("footer",{className:"zt-statusbar",children:[(0,B.jsxs)("div",{className:"zt-status-info",children:[(0,B.jsx)("span",{children:xe?`AI \u7ED1\u5B9A\uFF1A${L.terminals.find(I=>I.id===xe.terminalId)?.target.label??xe.terminalId} \xB7 ${xe.mode==="readwrite"?`\u8BFB\u5199 ${xe.writeCalls}/${xe.maxWriteCalls}`:"\u53EA\u8BFB"}`:"AI \u5C1A\u672A\u7ED1\u5B9A\u7EC8\u7AEF"}),(0,B.jsxs)("span",{className:"zt-host-platform",title:"\u7EC8\u7AEF\u8FDE\u63A5\u4E0E\u547D\u4EE4\u4ECE DSH \u5BBF\u4E3B\u53D1\u8D77",children:["DSH \u5BBF\u4E3B \xB7 ",L.hostPlatform||"\u6B63\u5728\u8FDE\u63A5"]})]}),J&&(0,B.jsx)("button",{onClick:()=>{ie(T,"terminal/export",{sessionId:R,terminalId:J.id}).then(I=>it(`zterm-${rt()}-\u7EC8\u7AEF.txt`,`\u7EC8\u7AEF\uFF1A${Qe(J)}
|
|
11
11
|
\u8BF4\u660E\uFF1A\u4EC5\u5305\u542B\u6709\u754C\u5386\u53F2\u7F13\u51B2\uFF0C\u53EF\u80FD\u5DF2\u622A\u65AD\u3002
|
|
12
12
|
|
|
13
|
-
${I}`)).catch(I=>se(I.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
|
|
14
|
-
`,ve.trust.fingerprint]}),ve.trust.trustedFingerprint&&(0,M.jsxs)("p",{children:["\u539F\u6307\u7EB9\uFF1A",ve.trust.trustedFingerprint]}),(0,M.jsx)("p",{className:"zt-hint",children:"\u901A\u8FC7\u72EC\u7ACB\u53EF\u4FE1\u6E20\u9053\u6838\u5B9E\u6307\u7EB9\u540E\u518D\u7EE7\u7EED\u3002"}),(0,M.jsx)("footer",{children:ve.trust.kind==="changed"?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{onClick:()=>void le("disconnect",$e),children:"\u53D6\u6D88\u8FDE\u63A5"}),(0,M.jsx)("button",{onClick:()=>{le("trust/reset",$e)},children:"\u5DF2\u6838\u5B9E\u53D8\u66F4\uFF0C\u6E05\u9664\u65E7\u8BB0\u5F55"})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{onClick:()=>void le("trust",{...$e,requestId:ve.trust.requestId,decision:"reject"}),children:"\u62D2\u7EDD"}),(0,M.jsx)("button",{onClick:()=>void le("trust",{...$e,requestId:ve.trust.requestId,decision:"trust-once"}),children:"\u4EC5\u4FE1\u4EFB\u6B64\u6B21\u8FDE\u63A5"}),(0,M.jsx)("button",{className:"zt-primary",onClick:()=>void le("trust",{...$e,requestId:ve.trust.requestId,decision:"trust-always"}),children:"\u4FE1\u4EFB\u5E76\u4FDD\u5B58"})]})})]})}),fe&&(0,M.jsxs)(Fe,{title:"\u786E\u8BA4\u64CD\u4F5C",onClose:()=>J(void 0),children:[(0,M.jsx)("p",{children:fe.text}),(0,M.jsxs)("footer",{children:[(0,M.jsx)("button",{onClick:()=>J(void 0),children:"\u53D6\u6D88"}),(0,M.jsx)("button",{className:"zt-primary",onClick:fe.act,children:"\u786E\u8BA4"})]})]})]})}var ge=require("react");var Se=require("react");var Q=require("react/jsx-runtime");function Jt({ctx:B,credentials:R,revision:O,onSaved:F}){let[D,s]=(0,Se.useState)(),[o,c]=(0,Se.useState)(""),[f,a]=(0,Se.useState)("key"),[n,d]=(0,Se.useState)(""),[_,h]=(0,Se.useState)(""),[i,t]=(0,Se.useState)(!1),[e,r]=(0,Se.useState)(!1),[l,p]=(0,Se.useState)(!1),[v,g]=(0,Se.useState)(""),[u,m]=(0,Se.useState)(""),y=(0,Se.useRef)(0);(0,Se.useEffect)(()=>()=>{y.current++},[]);let x=C=>{y.current++,p(!1),s(C),c(C?.label??""),a(C?.authType??"key"),d(C?.privateKeyPath??""),h(""),t(!1),g(""),m("")};return(0,Q.jsxs)("section",{className:"zt-settings-card zt-credential-manager","aria-label":"\u7BA1\u7406\u51ED\u8BC1",children:[(0,Q.jsxs)("div",{className:"zt-credential-header",children:[(0,Q.jsx)("strong",{children:"\u7BA1\u7406\u51ED\u8BC1"}),(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>{F().then(()=>g("")).catch(C=>g(C.message))},children:"\u5237\u65B0\u51ED\u8BC1\u5217\u8868"})]}),(0,Q.jsx)("p",{className:"zt-hint",children:"\u4FDD\u5B58\u4E00\u6B21\uFF0C\u4E3B\u673A\u6309\u540D\u79F0\u9009\u7528\u3002"}),(0,Q.jsx)("div",{className:"zt-credential-list",role:"list","aria-label":"\u51ED\u8BC1\u5217\u8868",children:R.length?R.map(C=>(0,Q.jsxs)("div",{className:"zt-credential-row",role:"listitem",children:[(0,Q.jsxs)("span",{children:[(0,Q.jsx)("b",{children:C.label}),(0,Q.jsx)("small",{children:He[C.authType]})]}),(0,Q.jsx)("button",{type:"button",disabled:e,"aria-label":`\u7F16\u8F91\u51ED\u8BC1 ${C.label}`,onClick:()=>x(C),children:"\u7F16\u8F91"})]},C.id)):(0,Q.jsx)("p",{className:"zt-hint",children:"\u6682\u65E0\u51ED\u8BC1\uFF0C\u5728\u4E0B\u65B9\u65B0\u589E\u3002"})}),(0,Q.jsx)("form",{onSubmit:C=>{C.preventDefault(),!(e||l)&&(r(!0),g(""),m(""),y.current++,ie(B,"credential/save",{credential:{id:D?.id,label:o,authType:f},content:n,passphrase:_,clearPassphrase:i,revision:O}).then(async()=>{x(),await F(),m("\u51ED\u8BC1\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u5728\u4E3B\u673A\u4E2D\u6309\u540D\u79F0\u9009\u62E9\u3002")}).catch(w=>g(w.message)).finally(()=>r(!1)))},children:(0,Q.jsxs)("fieldset",{disabled:e,className:"zt-credential-fields",children:[(0,Q.jsx)("h3",{children:D?"\u7F16\u8F91\u51ED\u8BC1":"\u65B0\u589E\u51ED\u8BC1"}),(0,Q.jsxs)("div",{className:"zt-credential-meta",children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u540D\u79F0"}),(0,Q.jsx)("input",{required:!0,maxLength:200,value:o,placeholder:"\u4F8B\u5982\uFF1A\u8FD0\u7EF4\u79C1\u94A5",onChange:C=>c(C.target.value)})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u7C7B\u578B"}),(0,Q.jsx)("select",{value:f,onChange:C=>{y.current++,p(!1),a(C.target.value),d(""),h(""),t(!1),g("")},children:Object.entries(He).map(([C,w])=>(0,Q.jsx)("option",{value:C,children:w},C))})]})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u5185\u5BB9"}),f==="key"?(0,Q.jsx)("textarea",{rows:3,value:n,spellCheck:!1,autoComplete:"off",required:!D||D.authType!==f,placeholder:D?.authType===f?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5\uFF1B\u4E5F\u53EF\u9009\u62E9\u6587\u4EF6\u5BFC\u5165":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9\uFF0C\u6216\u5728\u4E0B\u65B9\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",onChange:C=>{y.current++,p(!1),d(C.target.value)}}):(0,Q.jsx)("input",{type:f==="password"?"password":"text",value:n,autoComplete:"new-password",required:f==="key-file"||!D||D.authType!==f,placeholder:f==="key-file"?"\u5BBF\u4E3B\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4F8B\u5982 ~/.ssh/id_ed25519":D?.authType===f?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:C=>d(C.target.value)})]}),f==="key"&&(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6"}),(0,Q.jsx)("input",{type:"file","aria-label":"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",disabled:e,onChange:C=>{let w=C.target.files?.[0],A=++y.current;if(C.target.value="",p(!1),!!w){if(w.size>1e5){g("\u79C1\u94A5\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 100 KB");return}p(!0),w.text().then(P=>{y.current===A&&(d(P),c(U=>U||w.name.slice(0,200)),g(""))}).catch(()=>{y.current===A&&g("\u8BFB\u53D6\u79C1\u94A5\u6587\u4EF6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")}).finally(()=>{y.current===A&&p(!1)})}}}),(0,Q.jsx)("small",{className:"zt-hint",children:"\u76F4\u63A5\u5BFC\u5165\u6587\u4EF6\uFF0C\u65E0\u9700\u586B\u5199\u8DEF\u5F84\u3002"})]}),f==="key-file"&&(0,Q.jsx)("p",{className:"zt-hint",children:"\u586B\u5199\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u79C1\u94A5\u8DEF\u5F84\uFF0C\u4EC5\u5728\u8FD9\u91CC\u586B\u5199\u4E00\u6B21\u3002\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"}),f!=="password"&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09"}),(0,Q.jsx)("input",{type:"password",autoComplete:"new-password",disabled:i,value:_,onChange:C=>h(C.target.value),placeholder:D?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4":"\u79C1\u94A5\u6709\u53E3\u4EE4\u65F6\u586B\u5199"})]}),D?.passphraseRef&&(0,Q.jsxs)("label",{className:"zt-check",children:[(0,Q.jsx)("input",{type:"checkbox",checked:i,onChange:C=>t(C.target.checked)}),"\u6E05\u9664\u79C1\u94A5\u53E3\u4EE4"]})]}),v&&(0,Q.jsx)("p",{role:"alert",className:"zt-error",children:v}),u&&(0,Q.jsx)("p",{role:"status",className:"zt-success",children:u}),(0,Q.jsxs)("div",{className:"zt-actions",children:[D&&(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>x(),children:"\u53D6\u6D88\u7F16\u8F91"}),(0,Q.jsx)("button",{className:"zt-primary",disabled:e||l,children:e?"\u4FDD\u5B58\u4E2D\u2026":l?"\u8BFB\u53D6\u6587\u4EF6\u2026":"\u4FDD\u5B58\u51ED\u8BC1"})]})]})})]})}var G=require("react/jsx-runtime"),Xt=["allowLocalTerminal","defaultSshUsername","defaultPrivateKeyPath","defaultCredentialId","defaultPanelWidth","maxSessions","maxWriteCalls","commandTimeoutMs"];function Yt({ctx:B}){let[R,O]=(0,ge.useState)(),[F,D]=(0,ge.useState)(""),[s,o]=(0,ge.useState)(!1),[c,f]=(0,ge.useState)(""),[a,n]=(0,ge.useState)(!1),[d,_]=(0,ge.useState)(""),h=ct(),[i,t]=(0,ge.useState)(String(h)),e=(0,ge.useRef)(),r=(0,ge.useRef)(!0),l=(0,ge.useCallback)(async()=>{let g=await ie(B,"catalog");if(!r.current)return;let u=e.current;e.current=g,O(m=>({...g,...Object.fromEntries(Xt.filter(y=>u&&m?.[y]!==u[y]).map(y=>[y,m[y]]))}))},[B]);(0,ge.useEffect)(()=>t(String(h)),[h]),(0,ge.useEffect)(()=>(r.current=!0,l().catch(g=>{r.current&&D(g.message)}),()=>{r.current=!1}),[l]);let p=(g,u)=>{O({...R,[g]:u}),f("")},v=async g=>{if(!R||a)return;let u=!!R.temporarilyDisabled;n(!0),_(""),f(""),O({...R,temporarilyDisabled:g});try{await ie(B,"config",{patch:{temporarilyDisabled:g},revision:R.revision})}catch(m){O(y=>({...y,temporarilyDisabled:u})),_(m instanceof Error?m.message:"\u5207\u6362\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),n(!1);return}window.dispatchEvent(new CustomEvent("dsh-zterm:state")),n(!1);try{await l()}catch(m){_(m instanceof Error?m.message:"\u5DF2\u5207\u6362\uFF0C\u4F46\u5237\u65B0\u914D\u7F6E\u5931\u8D25")}};return(0,G.jsxs)("section",{className:"zt-settings",children:[(0,G.jsx)("h2",{children:ae}),(0,G.jsxs)("div",{className:`zt-settings-card zt-switch-card${R?.temporarilyDisabled?" active":""}`,children:[(0,G.jsx)("strong",{children:"\u4E34\u65F6\u7981\u7528 zTerm"}),(0,G.jsxs)("label",{className:"zt-check",children:[(0,G.jsx)("input",{type:"checkbox",role:"switch","aria-label":"\u4E34\u65F6\u7981\u7528 zTerm",checked:!!R?.temporarilyDisabled,disabled:!R||a,onChange:g=>void v(g.target.checked)}),"AI \u6682\u65F6\u4E0D\u4F7F\u7528 zTerm"]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u63D2\u4EF6\u4FDD\u6301\u542F\u7528\uFF0C\u53EA\u8BA9 AI \u6682\u65F6\u770B\u4E0D\u5230\u3001\u4E5F\u7528\u4E0D\u4E86 zTerm \u5DE5\u5177\uFF0C\u5E76\u505C\u6B62\u6CE8\u5165 zTerm \u63D0\u793A\uFF1B\u5DE5\u4F5C\u53F0\u3001\u624B\u5DE5\u7EC8\u7AEF\u548C\u4E3B\u673A\uFF0F\u51ED\u636E\u7BA1\u7406\u4E0D\u53D7\u5F71\u54CD\u3002\u70B9\u51FB\u7ACB\u5373\u751F\u6548\uFF0C\u65E0\u9700\u4FDD\u5B58\u8BBE\u7F6E\u3002"}),R?.temporarilyDisabled&&(0,G.jsx)("p",{className:"zt-switch-status",role:"status",children:"\u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230 zTerm \u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\u3002"}),d&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:d})]}),(0,G.jsx)("p",{children:"\u5728 DSH \u5BF9\u8BDD\u53F3\u4FA7\u8FDE\u63A5\u771F\u5B9E\u673A\u5668\u3002\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\uFF0C\u7531\u4EBA\u7C7B\u5728\u5DF2\u7ED1\u5B9A\u7EC8\u7AEF\u7684\u5DE5\u5177\u680F\u5F00\u542F\u8BFB\u5199\u3002"}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u7EC8\u7AEF\u5916\u89C2"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u7EC8\u7AEF\u5B57\u4F53\u5927\u5C0F\uFF08px\uFF09"}),(0,G.jsx)("input",{type:"number",min:at,max:lt,step:1,value:i,onChange:g=>{t(g.target.value),Pt(Number(g.target.value))},onBlur:()=>t(String(h))})]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u9ED8\u8BA4 ",Ke,"px\uFF0C\u53EF\u8C03 ",at,"\u2013",lt,"px\u3002\u4FEE\u6539\u7ACB\u5373\u5E94\u7528\u5230\u5DF2\u6253\u5F00\u7684\u7EC8\u7AEF\uFF0C\u4FDD\u5B58\u5728\u5F53\u524D\u6D4F\u89C8\u5668\u3002"]})]}),F&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:F}),c&&(0,G.jsx)("p",{className:"zt-success",role:"status",children:c}),R?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("form",{onSubmit:g=>{g.preventDefault(),o(!0),D(""),f(""),ie(B,"config",{patch:Object.fromEntries(Xt.map(u=>[u,R[u]])),revision:R.revision}).then(()=>ie(B,"catalog")).then(u=>{e.current=u,O(u),f(u.allowLocalTerminal?`\u914D\u7F6E\u5DF2\u4FDD\u5B58\u3002\u672C\u5730\u7EC8\u7AEF\u5DF2\u542F\u7528\uFF1A\u6253\u5F00 ${ae}\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002`:"\u914D\u7F6E\u5DF2\u4FDD\u5B58\uFF0C\u672C\u5730\u7EC8\u7AEF\u672A\u542F\u7528\u3002")}).catch(u=>D(u.message)).finally(()=>o(!1))},children:[(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u672C\u5730\u7EC8\u7AEF"}),(0,G.jsxs)("label",{className:"zt-check",children:[(0,G.jsx)("input",{type:"checkbox",checked:R.allowLocalTerminal,onChange:g=>p("allowLocalTerminal",g.target.checked)}),"\u5141\u8BB8\u6253\u5F00\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u7EC8\u7AEF"]}),(0,G.jsx)("p",{className:"zt-hint",children:"DSH \u5728\u4F60\u7684\u7535\u8111\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u8FD9\u53F0\u7535\u8111\u7684\u7EC8\u7AEF\uFF1BDSH \u5728\u670D\u52A1\u5668\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u670D\u52A1\u5668\u7684\u7EC8\u7AEF\u3002"}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u52FE\u9009\u540E\u70B9\u51FB\u4E0B\u65B9\u7684\u300C\u4FDD\u5B58\u8BBE\u7F6E\u300D\u624D\u4F1A\u751F\u6548\u3002\u7136\u540E\u4ECE\u804A\u5929\u9876\u90E8\u6253\u5F00\u300C",ae,"\u300D\uFF0C\u70B9\u51FB\u9762\u677F\u53F3\u4E0A\u65B9\u7684\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002\u6BCF\u6B21\u70B9\u51FB\u90FD\u4F1A\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\u6807\u7B7E\u3002"]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u901A\u8FC7\u5BF9\u8BDD\u8FDE\u63A5\u8FDC\u7A0B\u673A\u5668"}),(0,G.jsx)("p",{children:"\u544A\u8BC9 AI \u8981\u8FDE\u63A5\u7684\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4F8B\u5982\u300C\u8FDE\u63A5 192.0.2.21\u300D\u3002AI \u4F1A\u6309\u4EE5\u4E0B\u987A\u5E8F\u67E5\u627E\uFF1A"}),(0,G.jsxs)("ol",{className:"zt-hint",children:[(0,G.jsx)("li",{children:"\u5148\u627E\u4E3B\u673A\u5217\u8868\u91CC\u5DF2\u4FDD\u5B58\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u6CA1\u627E\u5230\uFF0C\u518D\u67E5 JumpServer\uFF08\u5821\u5792\u673A\uFF09\u91CC\u4F60\u6709\u6743\u9650\u8BBF\u95EE\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u90FD\u6CA1\u627E\u5230\uFF0C\u5C31\u4FDD\u5B58\u4E3A\u65B0\u4E3B\u673A\uFF0C\u5E76\u5C1D\u8BD5\u7528\u4E0B\u65B9\u7684\u8D26\u53F7\u548C SSH \u79C1\u94A5\u8FDE\u63A5\u3002"})]}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u65B0\u4E3B\u673A\u9ED8\u8BA4\u767B\u5F55\u8D26\u53F7"}),(0,G.jsx)("input",{value:R.defaultSshUsername??"",placeholder:"\u7559\u7A7A\u4F7F\u7528\u8FD0\u884C DSH \u7684\u8D26\u53F7",onChange:g=>p("defaultSshUsername",g.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5BF9\u8BDD\u91CC\u6307\u5B9A\u4E86\u767B\u5F55\u8D26\u53F7\u65F6\uFF0C\u4F18\u5148\u4F7F\u7528\u4F60\u6307\u5B9A\u7684\u8D26\u53F7\u3002"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u51ED\u8BC1"}),(0,G.jsxs)("select",{value:R.defaultCredentialId??"",onChange:g=>p("defaultCredentialId",g.target.value),children:[(0,G.jsx)("option",{value:"",children:"\u81EA\u52A8\u67E5\u627E\u5BBF\u4E3B\u9ED8\u8BA4\u79C1\u94A5\u6587\u4EF6"}),(R.credentials??[]).filter(g=>g.authType!=="password").map(g=>(0,G.jsxs)("option",{value:g.id,children:[g.label," \xB7 ",He[g.authType]]},g.id))]})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5728\u4E0B\u65B9\u300C\u7BA1\u7406\u51ED\u8BC1\u300D\u4FDD\u5B58\u79C1\u94A5\u540E\uFF0C\u6309\u540D\u79F0\u9009\u62E9\u9ED8\u8BA4\u51ED\u8BC1\u3002\u79C1\u94A5\u5185\u5BB9\u4E0D\u4F1A\u53D1\u9001\u7ED9 AI\u3002"}),!R.defaultCredentialId&&(0,G.jsxs)("details",{children:[(0,G.jsx)("summary",{children:"\u6307\u5B9A\u5DF2\u6709\u7684\u5BBF\u4E3B\u79C1\u94A5\u6587\u4EF6\uFF08\u53EF\u9009\uFF09"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6"}),(0,G.jsx)("input",{value:R.defaultPrivateKeyPath??"",placeholder:"\u7559\u7A7A\u81EA\u52A8\u67E5\u627E ~/.ssh \u4E0B\u7684\u9ED8\u8BA4\u79C1\u94A5",onChange:g=>p("defaultPrivateKeyPath",g.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u4F7F\u7528\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u8DEF\u5F84\uFF1B\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"})]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u6267\u884C\u4E0E\u5E03\u5C40"}),[["defaultPanelWidth","\u72EC\u7ACB\u9762\u677F\u9ED8\u8BA4\u5BBD\u5EA6\uFF08\u767E\u5206\u6BD4\uFF09",30,80],["maxSessions","\u6BCF\u4F1A\u8BDD\u7EC8\u7AEF\u4E0A\u9650",1,32],["maxWriteCalls","\u6BCF\u6B21\u8BFB\u5199\u6388\u6743\u7684\u547D\u4EE4\u4E0A\u9650",1,1e3],["commandTimeoutMs","\u5355\u6B21\u547D\u4EE4\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",1e3,12e4]].map(([g,u,m,y])=>(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:u}),(0,G.jsx)("input",{type:"number",min:m,max:y,required:!0,value:R[g],onChange:x=>p(String(g),Number(x.target.value))})]},g))]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u51ED\u636E"}),(0,G.jsxs)("p",{children:["\u4E3B\u673A\u3001\u6587\u4EF6\u5939\u3001JumpServer \u5B9E\u4F8B\u548C\u8D26\u53F7\u4ECE\u4F1A\u8BDD\u4E2D\u7684\u300C",ae,"\u300D\u5165\u53E3\u7BA1\u7406\u3002\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u5199\u5165 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u76F4\u63A5\u4ECE\u5BBF\u4E3B\u8BFB\u53D6\uFF0C\u5DE5\u5177\u7ED3\u679C\u4E0D\u5305\u542B\u51ED\u636E\u503C\u3002"]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u5DF2\u914D\u7F6E ",R.total," \u53F0\u4E3B\u673A\u3001",R.jumpservers.length," \u4E2A JumpServer \u5B9E\u4F8B\u3002"]})]}),(0,G.jsx)("button",{className:"zt-primary",disabled:s,children:s?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u8BBE\u7F6E"})]}),(0,G.jsx)(Jt,{ctx:B,credentials:R.credentials??[],revision:R.revision,onSaved:l})]}):(0,G.jsx)("p",{className:"zt-hint",children:"\u6B63\u5728\u8BFB\u53D6\u914D\u7F6E\u2026"})]})}var Zt=`.zt-workbench,.zt-settings,.zt-modal{--zt-bg:var(--dsw-alias-bg-base,#fff);--zt-layer:var(--dsw-alias-bg-layer-2,#f4f6f8);--zt-text:var(--dsw-alias-label-primary,#252b36);--zt-muted:var(--dsw-alias-label-secondary,#687284);--zt-border:var(--dsw-alias-border-l2,#dfe3e9);--zt-accent:var(--dsw-alias-state-business-primary,#3764d6);color:var(--zt-text);font:13px/1.5 system-ui,sans-serif;box-sizing:border-box}
|
|
13
|
+
${I}`)).catch(I=>se(I.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,B.jsxs)("div",{className:"zt-records",children:[(0,B.jsxs)("header",{children:[(0,B.jsx)("strong",{children:"\u5B9E\u9645\u64CD\u4F5C\u8BB0\u5F55"}),(0,B.jsx)("button",{onClick:()=>{ie(T,"results",{sessionId:R,limit:200}).then(I=>it(`zterm-${rt()}-\u64CD\u4F5C\u8BB0\u5F55.json`,JSON.stringify({version:1,sessionId:R,historyLimited:!0,records:I},null,2),"application/json")).catch(I=>se(I.message))},children:"\u5BFC\u51FA JSON"})]}),!L.operations.length&&(0,B.jsx)("p",{className:"zt-hint",children:"\u7ED1\u5B9A\u7EC8\u7AEF\u5E76\u8C03\u7528\u5DE5\u5177\u540E\uFF0C\u5B9E\u9645\u64CD\u4F5C\u8BB0\u5F55\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002"}),L.operations.slice().reverse().map(I=>(0,B.jsxs)("details",{children:[(0,B.jsxs)("summary",{children:[(0,B.jsx)("span",{className:`zt-record-status ${I.status}`,children:Zt[I.status]}),(0,B.jsx)("span",{children:I.label}),(0,B.jsx)("time",{children:new Date(I.startedAt).toLocaleTimeString("zh-CN")})]}),(0,B.jsxs)("p",{className:"zt-hint",children:[I.target.label," \xB7 \u9000\u51FA\u7801 ",I.exitCode??"\u672A\u77E5"," \xB7 ",I.completion??"\u672A\u6838\u9A8C",I.truncated?" \xB7 \u8BB0\u5F55\u5DF2\u622A\u65AD":""]}),(0,B.jsx)("pre",{children:I.error||I.output||"\uFF08\u65E0\u8F93\u51FA\uFF09"})]},I.id))]})]}),!C&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"zt-list-handle",role:"separator","aria-label":"\u8C03\u6574\u673A\u5668\u5217\u8868\u5BBD\u5EA6","aria-orientation":"vertical",onMouseDown:oi}),(0,B.jsxs)("aside",{className:"zt-hosts",style:{width:N},children:[(0,B.jsxs)("div",{className:"zt-list-header",children:[(0,B.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u8D44\u4EA7"}),(0,B.jsxs)("div",{className:"zt-list-header-actions",children:[(0,B.jsx)("button",{"aria-label":"\u5237\u65B0\u673A\u5668\u5217\u8868",title:"\u5237\u65B0\u673A\u5668\u5217\u8868",onClick:()=>void ye().catch(I=>se(I.message)),children:"\u21BB"}),(0,B.jsx)("button",{title:"\u6536\u8D77\u673A\u5668\u5217\u8868","aria-expanded":!0,onClick:()=>H(!0),children:"\u6536\u8D77\u5217\u8868"})]})]}),(0,B.jsxs)("div",{className:"zt-source-tabs",children:[(0,B.jsx)("button",{className:p==="ssh"?"active":"",onClick:()=>{g("ssh"),r(0),t("")},children:"\u8FDC\u7A0B\u4E3B\u673A"}),(0,B.jsx)("button",{className:p==="jumpserver"?"active":"",onClick:()=>{g("jumpserver"),r(0),t("")},children:"JumpServer"})]}),(0,B.jsx)("input",{className:"zt-list-search","aria-label":"\u641C\u7D22\u4E3B\u673A\u6216\u8D44\u4EA7",placeholder:"\u641C\u7D22\u540D\u79F0\u6216\u5730\u5740",value:i,onChange:I=>{t(I.target.value),r(0)}}),p==="ssh"?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"zt-list-actions",children:[(0,B.jsx)("button",{onClick:()=>m(null),children:"\uFF0B \u4E3B\u673A"}),(0,B.jsx)("button",{onClick:()=>w(null),children:"\uFF0B \u6587\u4EF6\u5939"}),(0,B.jsx)("button",{onClick:()=>void ie(T,"hosts/export").then(I=>it(`zterm-${rt()}-ssh-config`,I)).catch(I=>se(I.message)),children:"\u5BFC\u51FA"})]}),(0,B.jsxs)("div",{className:"zt-host-browser",children:[(0,B.jsx)(wt,{label:"\u8C03\u6574\u4E3B\u673A\u6587\u4EF6\u5939\u9AD8\u5EA6",storageKey:"dsh-zterm.folder-tree-height",children:(0,B.jsx)(qt,{folders:_?.folders??[],selected:l,onSelect:I=>{v(I),r(0)},onEdit:w,onDelete:I=>X({text:`\u5220\u9664\u6587\u4EF6\u5939\u300C${I.label}\u300D\uFF1F\u6587\u4EF6\u5939\u5FC5\u987B\u4E3A\u7A7A\u3002`,act:()=>{ie(T,"folder/delete",{id:I.id,revision:_?.revision}).then(()=>(l===I.id&&v(""),ye())).catch(re=>se(re.message)),X(void 0)}})})},"folders"),(0,B.jsxs)("div",{className:"zt-host-list",children:[_?.hosts.map(I=>(0,B.jsxs)("div",{className:"zt-host-row",children:[(0,B.jsxs)("button",{className:"zt-host-connect",disabled:j,onClick:()=>void Le({targetId:I.id}),title:`\u8FDE\u63A5 ${I.username}@${I.host}:${I.port}`,children:[(0,B.jsx)("span",{className:"zt-host-glyph",children:"\u25A4"}),(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:I.label}),(0,B.jsxs)("small",{children:[I.username,"@",I.host]})]})]}),(0,B.jsx)("button",{title:"\u7F16\u8F91\u4E3B\u673A",onClick:()=>m(I),children:"\u22EF"}),(0,B.jsx)("button",{title:"\u79FB\u9664\u4E3B\u673A\u914D\u7F6E",onClick:()=>X({text:`\u79FB\u9664\u300C${I.label}\u300D\u7684\u914D\u7F6E\uFF1F\u5DF2\u6709\u7EC8\u7AEF\u8FDE\u63A5\u4FDD\u6301\u539F\u76EE\u6807\u3002`,act:()=>{ie(T,"host/delete",{id:I.id,revision:_.revision}).then(()=>ye()).catch(re=>se(re.message)),X(void 0)}}),children:"\xD7"})]},I.id)),!_?.hosts.length&&(0,B.jsx)("p",{className:"zt-list-empty",children:i?"\u6CA1\u6709\u5339\u914D\u7684\u4E3B\u673A":"\u6DFB\u52A0\u4E3B\u673A\u540E\u4ECE\u8FD9\u91CC\u8FDE\u63A5"})]})]}),(0,B.jsxs)("div",{className:"zt-pagination",children:[(0,B.jsxs)("span",{children:[_?.total??0," \u53F0",_?.total?` \xB7 \u5F53\u524D ${e+1}\u2013${Math.min(e+200,_.total)}`:""]}),(0,B.jsx)("button",{disabled:!e,onClick:()=>r(Math.max(0,e-200)),children:"\u2039"}),(0,B.jsx)("button",{disabled:e+200>=(_?.total??0),onClick:()=>r(e+200),children:"\u203A"})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"zt-list-actions",children:[(0,B.jsx)("button",{onClick:()=>x(null),children:"\uFF0B \u5B9E\u4F8B"}),et&&(0,B.jsx)("button",{onClick:()=>x(et),children:"\u7F16\u8F91"}),et&&(0,B.jsx)("button",{onClick:()=>X({text:`\u79FB\u9664\u300C${et.label}\u300D\u7684\u914D\u7F6E\uFF1F`,act:()=>{ie(T,"jump/delete",{id:A,revision:_.revision}).then(()=>{z(""),ye()}).catch(I=>se(I.message)),X(void 0)}}),children:"\u79FB\u9664"})]}),(0,B.jsxs)("select",{"aria-label":"JumpServer \u5B9E\u4F8B",value:A,onChange:I=>{z(I.target.value),q(""),r(0)},children:[(0,B.jsx)("option",{value:"",children:"\u9009\u62E9\u5B9E\u4F8B"}),_?.jumpservers.map(I=>(0,B.jsx)("option",{value:I.id,children:I.label},I.id))]}),(0,B.jsxs)("div",{className:"zt-host-browser",children:[A&&(0,B.jsx)(wt,{label:"\u8C03\u6574 JumpServer \u8D44\u4EA7\u8282\u70B9\u9AD8\u5EA6",storageKey:"dsh-zterm.jump-tree-height",children:(0,B.jsx)(Xt,{ctx:T,instanceId:A,nodes:$,selected:U,onSelect:I=>{q(I),r(0)},onError:se},A)},"jumpserver"),(0,B.jsxs)("div",{className:"zt-host-list",children:[E?.assets?.map(I=>(0,B.jsxs)("button",{className:"zt-asset-row",onClick:()=>void ni(I),children:[(0,B.jsx)("strong",{children:I.name}),(0,B.jsxs)("small",{children:[I.address," \xB7 ",I.platform]})]},I.assetId)),!A&&(0,B.jsx)("p",{className:"zt-list-empty",children:"\u5148\u6DFB\u52A0 JumpServer \u5B9E\u4F8B"})]})]}),(0,B.jsxs)("div",{className:"zt-pagination",children:[(0,B.jsxs)("span",{children:[E?.total??0," \u53F0"]}),(0,B.jsx)("button",{disabled:!e,onClick:()=>r(Math.max(0,e-100)),children:"\u2039"}),(0,B.jsx)("button",{disabled:!E?.hasMore,onClick:()=>r(e+100),children:"\u203A"})]})]})]})]})]}),u!==!1&&(0,B.jsx)(Vt,{ctx:T,host:u??void 0,folders:_?.folders??[],credentials:_?.credentials??[],defaultCredentialId:_?.defaultCredentialId,revision:_?.revision,onClose:()=>m(!1),onSaved:()=>void ye()}),y!==!1&&(0,B.jsx)(Gt,{ctx:T,profile:y??void 0,revision:_?.revision,onClose:()=>x(!1),onSaved:()=>void ye()}),S!==!1&&(0,B.jsx)(Jt,{ctx:T,folder:S??void 0,folders:_?.folders??[],revision:_?.revision,onClose:()=>w(!1),onSaved:()=>void ye()}),D&&(0,B.jsx)(Ne,{title:`\u9009\u62E9\u8D26\u53F7 \xB7 ${K?.name??""}`,onClose:()=>P(void 0),children:(0,B.jsxs)("div",{className:"zt-account-list",children:[D.map(I=>(0,B.jsxs)("button",{disabled:!I.canConnect||j,onClick:()=>{Le({kind:"jumpserver",instanceId:A,assetId:K.assetId,accountId:I.accountId,label:K.name,accountName:I.name||I.username}),P(void 0)},children:[(0,B.jsx)("strong",{children:I.name}),(0,B.jsxs)("span",{children:[I.username,I.canConnect?"":" \xB7 \u65E0\u8FDE\u63A5\u6743\u9650"]})]},I.accountId)),!D.length&&(0,B.jsx)("p",{children:"\u6CA1\u6709\u53EF\u7528\u8D26\u53F7"})]})}),O&&ve?.trust&&(0,B.jsx)(Ne,{title:ve.trust.kind==="changed"?"SSH \u4E3B\u673A\u6307\u7EB9\u5DF2\u53D8\u66F4":"\u6838\u5B9E SSH \u4E3B\u673A\u8EAB\u4EFD",onClose:()=>{ae("disconnect",$e)},children:(0,B.jsxs)("div",{className:"zt-trust",children:[(0,B.jsxs)("p",{children:[ve.target.label," \xB7 ",ve.trust.username,"@",ve.trust.host,":",ve.trust.port]}),(0,B.jsxs)("pre",{children:[ve.trust.algorithm,`
|
|
14
|
+
`,ve.trust.fingerprint]}),ve.trust.trustedFingerprint&&(0,B.jsxs)("p",{children:["\u539F\u6307\u7EB9\uFF1A",ve.trust.trustedFingerprint]}),(0,B.jsx)("p",{className:"zt-hint",children:"\u901A\u8FC7\u72EC\u7ACB\u53EF\u4FE1\u6E20\u9053\u6838\u5B9E\u6307\u7EB9\u540E\u518D\u7EE7\u7EED\u3002"}),(0,B.jsx)("footer",{children:ve.trust.kind==="changed"?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("button",{onClick:()=>void ae("disconnect",$e),children:"\u53D6\u6D88\u8FDE\u63A5"}),(0,B.jsx)("button",{onClick:()=>{ae("trust/reset",$e)},children:"\u5DF2\u6838\u5B9E\u53D8\u66F4\uFF0C\u6E05\u9664\u65E7\u8BB0\u5F55"})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("button",{onClick:()=>void ae("trust",{...$e,requestId:ve.trust.requestId,decision:"reject"}),children:"\u62D2\u7EDD"}),(0,B.jsx)("button",{onClick:()=>void ae("trust",{...$e,requestId:ve.trust.requestId,decision:"trust-once"}),children:"\u4EC5\u4FE1\u4EFB\u6B64\u6B21\u8FDE\u63A5"}),(0,B.jsx)("button",{className:"zt-primary",onClick:()=>void ae("trust",{...$e,requestId:ve.trust.requestId,decision:"trust-always"}),children:"\u4FE1\u4EFB\u5E76\u4FDD\u5B58"})]})})]})}),fe&&(0,B.jsxs)(Ne,{title:"\u786E\u8BA4\u64CD\u4F5C",onClose:()=>X(void 0),children:[(0,B.jsx)("p",{children:fe.text}),(0,B.jsxs)("footer",{children:[(0,B.jsx)("button",{onClick:()=>X(void 0),children:"\u53D6\u6D88"}),(0,B.jsx)("button",{className:"zt-primary",onClick:fe.act,children:"\u786E\u8BA4"})]})]})]})}var ge=require("react");var Se=require("react");var Q=require("react/jsx-runtime");function Qt({ctx:T,credentials:R,revision:O,onSaved:W}){let[L,s]=(0,Se.useState)(),[o,c]=(0,Se.useState)(""),[f,a]=(0,Se.useState)("key"),[n,d]=(0,Se.useState)(""),[_,h]=(0,Se.useState)(""),[i,t]=(0,Se.useState)(!1),[e,r]=(0,Se.useState)(!1),[l,v]=(0,Se.useState)(!1),[p,g]=(0,Se.useState)(""),[u,m]=(0,Se.useState)(""),y=(0,Se.useRef)(0);(0,Se.useEffect)(()=>()=>{y.current++},[]);let x=S=>{y.current++,v(!1),s(S),c(S?.label??""),a(S?.authType??"key"),d(S?.privateKeyPath??""),h(""),t(!1),g(""),m("")};return(0,Q.jsxs)("section",{className:"zt-settings-card zt-credential-manager","aria-label":"\u7BA1\u7406\u51ED\u8BC1",children:[(0,Q.jsxs)("div",{className:"zt-credential-header",children:[(0,Q.jsx)("strong",{children:"\u7BA1\u7406\u51ED\u8BC1"}),(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>{W().then(()=>g("")).catch(S=>g(S.message))},children:"\u5237\u65B0\u51ED\u8BC1\u5217\u8868"})]}),(0,Q.jsx)("p",{className:"zt-hint",children:"\u4FDD\u5B58\u4E00\u6B21\uFF0C\u4E3B\u673A\u6309\u540D\u79F0\u9009\u7528\u3002"}),(0,Q.jsx)("div",{className:"zt-credential-list",role:"list","aria-label":"\u51ED\u8BC1\u5217\u8868",children:R.length?R.map(S=>(0,Q.jsxs)("div",{className:"zt-credential-row",role:"listitem",children:[(0,Q.jsxs)("span",{children:[(0,Q.jsx)("b",{children:S.label}),(0,Q.jsx)("small",{children:He[S.authType]})]}),(0,Q.jsx)("button",{type:"button",disabled:e,"aria-label":`\u7F16\u8F91\u51ED\u8BC1 ${S.label}`,onClick:()=>x(S),children:"\u7F16\u8F91"})]},S.id)):(0,Q.jsx)("p",{className:"zt-hint",children:"\u6682\u65E0\u51ED\u8BC1\uFF0C\u5728\u4E0B\u65B9\u65B0\u589E\u3002"})}),(0,Q.jsx)("form",{onSubmit:S=>{S.preventDefault(),!(e||l)&&(r(!0),g(""),m(""),y.current++,ie(T,"credential/save",{credential:{id:L?.id,label:o,authType:f},content:n,passphrase:_,clearPassphrase:i,revision:O}).then(async()=>{x(),await W(),m("\u51ED\u8BC1\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u5728\u4E3B\u673A\u4E2D\u6309\u540D\u79F0\u9009\u62E9\u3002")}).catch(w=>g(w.message)).finally(()=>r(!1)))},children:(0,Q.jsxs)("fieldset",{disabled:e,className:"zt-credential-fields",children:[(0,Q.jsx)("h3",{children:L?"\u7F16\u8F91\u51ED\u8BC1":"\u65B0\u589E\u51ED\u8BC1"}),(0,Q.jsxs)("div",{className:"zt-credential-meta",children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u540D\u79F0"}),(0,Q.jsx)("input",{required:!0,maxLength:200,value:o,placeholder:"\u4F8B\u5982\uFF1A\u8FD0\u7EF4\u79C1\u94A5",onChange:S=>c(S.target.value)})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u7C7B\u578B"}),(0,Q.jsx)("select",{value:f,onChange:S=>{y.current++,v(!1),a(S.target.value),d(""),h(""),t(!1),g("")},children:Object.entries(He).map(([S,w])=>(0,Q.jsx)("option",{value:S,children:w},S))})]})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u5185\u5BB9"}),f==="key"?(0,Q.jsx)("textarea",{rows:3,value:n,spellCheck:!1,autoComplete:"off",required:!L||L.authType!==f,placeholder:L?.authType===f?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5\uFF1B\u4E5F\u53EF\u9009\u62E9\u6587\u4EF6\u5BFC\u5165":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9\uFF0C\u6216\u5728\u4E0B\u65B9\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",onChange:S=>{y.current++,v(!1),d(S.target.value)}}):(0,Q.jsx)("input",{type:f==="password"?"password":"text",value:n,autoComplete:"new-password",required:f==="key-file"||!L||L.authType!==f,placeholder:f==="key-file"?"\u5BBF\u4E3B\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4F8B\u5982 ~/.ssh/id_ed25519":L?.authType===f?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:S=>d(S.target.value)})]}),f==="key"&&(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6"}),(0,Q.jsx)("input",{type:"file","aria-label":"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",disabled:e,onChange:S=>{let w=S.target.files?.[0],A=++y.current;if(S.target.value="",v(!1),!!w){if(w.size>1e5){g("\u79C1\u94A5\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 100 KB");return}v(!0),w.text().then(z=>{y.current===A&&(d(z),c(U=>U||w.name.slice(0,200)),g(""))}).catch(()=>{y.current===A&&g("\u8BFB\u53D6\u79C1\u94A5\u6587\u4EF6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")}).finally(()=>{y.current===A&&v(!1)})}}}),(0,Q.jsx)("small",{className:"zt-hint",children:"\u76F4\u63A5\u5BFC\u5165\u6587\u4EF6\uFF0C\u65E0\u9700\u586B\u5199\u8DEF\u5F84\u3002"})]}),f==="key-file"&&(0,Q.jsx)("p",{className:"zt-hint",children:"\u586B\u5199\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u79C1\u94A5\u8DEF\u5F84\uFF0C\u4EC5\u5728\u8FD9\u91CC\u586B\u5199\u4E00\u6B21\u3002\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"}),f!=="password"&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09"}),(0,Q.jsx)("input",{type:"password",autoComplete:"new-password",disabled:i,value:_,onChange:S=>h(S.target.value),placeholder:L?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4":"\u79C1\u94A5\u6709\u53E3\u4EE4\u65F6\u586B\u5199"})]}),L?.passphraseRef&&(0,Q.jsxs)("label",{className:"zt-check",children:[(0,Q.jsx)("input",{type:"checkbox",checked:i,onChange:S=>t(S.target.checked)}),"\u6E05\u9664\u79C1\u94A5\u53E3\u4EE4"]})]}),p&&(0,Q.jsx)("p",{role:"alert",className:"zt-error",children:p}),u&&(0,Q.jsx)("p",{role:"status",className:"zt-success",children:u}),(0,Q.jsxs)("div",{className:"zt-actions",children:[L&&(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>x(),children:"\u53D6\u6D88\u7F16\u8F91"}),(0,Q.jsx)("button",{className:"zt-primary",disabled:e||l,children:e?"\u4FDD\u5B58\u4E2D\u2026":l?"\u8BFB\u53D6\u6587\u4EF6\u2026":"\u4FDD\u5B58\u51ED\u8BC1"})]})]})})]})}var G=require("react/jsx-runtime"),ei=["allowLocalTerminal","defaultSshUsername","defaultPrivateKeyPath","defaultCredentialId","defaultPanelWidth","maxSessions","maxWriteCalls","commandTimeoutMs"];function ti({ctx:T}){let[R,O]=(0,ge.useState)(),[W,L]=(0,ge.useState)(""),[s,o]=(0,ge.useState)(!1),[c,f]=(0,ge.useState)(""),[a,n]=(0,ge.useState)(!1),[d,_]=(0,ge.useState)(""),h=ct(),[i,t]=(0,ge.useState)(String(h)),e=(0,ge.useRef)(),r=(0,ge.useRef)(!0),l=(0,ge.useCallback)(async()=>{let g=await ie(T,"catalog");if(!r.current)return;let u=e.current;e.current=g,O(m=>({...g,...Object.fromEntries(ei.filter(y=>u&&m?.[y]!==u[y]).map(y=>[y,m[y]]))}))},[T]);(0,ge.useEffect)(()=>t(String(h)),[h]),(0,ge.useEffect)(()=>(r.current=!0,l().catch(g=>{r.current&&L(g.message)}),()=>{r.current=!1}),[l]);let v=(g,u)=>{O({...R,[g]:u}),f("")},p=async g=>{if(!R||a)return;let u=!!R.temporarilyDisabled;n(!0),_(""),f(""),O({...R,temporarilyDisabled:g});try{await ie(T,"config",{patch:{temporarilyDisabled:g},revision:R.revision})}catch(m){O(y=>({...y,temporarilyDisabled:u})),_(m instanceof Error?m.message:"\u5207\u6362\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),n(!1);return}window.dispatchEvent(new CustomEvent("dsh-zterm:state")),n(!1);try{await l()}catch(m){_(m instanceof Error?m.message:"\u5DF2\u5207\u6362\uFF0C\u4F46\u5237\u65B0\u914D\u7F6E\u5931\u8D25")}};return(0,G.jsxs)("section",{className:"zt-settings",children:[(0,G.jsx)("h2",{children:le}),(0,G.jsxs)("div",{className:`zt-settings-card zt-switch-card${R?.temporarilyDisabled?" active":""}`,children:[(0,G.jsx)("strong",{children:"\u4E34\u65F6\u7981\u7528 zTerm"}),(0,G.jsxs)("label",{className:"zt-check",children:[(0,G.jsx)("input",{type:"checkbox",role:"switch","aria-label":"\u4E34\u65F6\u7981\u7528 zTerm",checked:!!R?.temporarilyDisabled,disabled:!R||a,onChange:g=>void p(g.target.checked)}),"AI \u6682\u65F6\u4E0D\u4F7F\u7528 zTerm"]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u63D2\u4EF6\u4FDD\u6301\u542F\u7528\uFF0C\u53EA\u8BA9 AI \u6682\u65F6\u770B\u4E0D\u5230\u3001\u4E5F\u7528\u4E0D\u4E86 zTerm \u5DE5\u5177\uFF0C\u5E76\u505C\u6B62\u6CE8\u5165 zTerm \u63D0\u793A\uFF1B\u5DE5\u4F5C\u53F0\u3001\u624B\u5DE5\u7EC8\u7AEF\u548C\u4E3B\u673A\uFF0F\u51ED\u636E\u7BA1\u7406\u4E0D\u53D7\u5F71\u54CD\u3002\u70B9\u51FB\u7ACB\u5373\u751F\u6548\uFF0C\u65E0\u9700\u4FDD\u5B58\u8BBE\u7F6E\u3002"}),R?.temporarilyDisabled&&(0,G.jsx)("p",{className:"zt-switch-status",role:"status",children:"\u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230 zTerm \u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\u3002"}),d&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:d})]}),(0,G.jsx)("p",{children:"\u5728 DSH \u5BF9\u8BDD\u53F3\u4FA7\u8FDE\u63A5\u771F\u5B9E\u673A\u5668\u3002\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\uFF0C\u7531\u4EBA\u7C7B\u5728\u5DF2\u7ED1\u5B9A\u7EC8\u7AEF\u7684\u5DE5\u5177\u680F\u5F00\u542F\u8BFB\u5199\u3002"}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u7EC8\u7AEF\u5916\u89C2"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u7EC8\u7AEF\u5B57\u4F53\u5927\u5C0F\uFF08px\uFF09"}),(0,G.jsx)("input",{type:"number",min:at,max:lt,step:1,value:i,onChange:g=>{t(g.target.value),Ft(Number(g.target.value))},onBlur:()=>t(String(h))})]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u9ED8\u8BA4 ",qe,"px\uFF0C\u53EF\u8C03 ",at,"\u2013",lt,"px\u3002\u4FEE\u6539\u7ACB\u5373\u5E94\u7528\u5230\u5DF2\u6253\u5F00\u7684\u7EC8\u7AEF\uFF0C\u4FDD\u5B58\u5728\u5F53\u524D\u6D4F\u89C8\u5668\u3002"]})]}),W&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:W}),c&&(0,G.jsx)("p",{className:"zt-success",role:"status",children:c}),R?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("form",{onSubmit:g=>{g.preventDefault(),o(!0),L(""),f(""),ie(T,"config",{patch:Object.fromEntries(ei.map(u=>[u,R[u]])),revision:R.revision}).then(()=>ie(T,"catalog")).then(u=>{e.current=u,O(u),f(u.allowLocalTerminal?`\u914D\u7F6E\u5DF2\u4FDD\u5B58\u3002\u672C\u5730\u7EC8\u7AEF\u5DF2\u542F\u7528\uFF1A\u6253\u5F00 ${le}\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002`:"\u914D\u7F6E\u5DF2\u4FDD\u5B58\uFF0C\u672C\u5730\u7EC8\u7AEF\u672A\u542F\u7528\u3002")}).catch(u=>L(u.message)).finally(()=>o(!1))},children:[(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u672C\u5730\u7EC8\u7AEF"}),(0,G.jsxs)("label",{className:"zt-check",children:[(0,G.jsx)("input",{type:"checkbox",checked:R.allowLocalTerminal,onChange:g=>v("allowLocalTerminal",g.target.checked)}),"\u5141\u8BB8\u6253\u5F00\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u7EC8\u7AEF"]}),(0,G.jsx)("p",{className:"zt-hint",children:"DSH \u5728\u4F60\u7684\u7535\u8111\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u8FD9\u53F0\u7535\u8111\u7684\u7EC8\u7AEF\uFF1BDSH \u5728\u670D\u52A1\u5668\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u670D\u52A1\u5668\u7684\u7EC8\u7AEF\u3002"}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u52FE\u9009\u540E\u70B9\u51FB\u4E0B\u65B9\u7684\u300C\u4FDD\u5B58\u8BBE\u7F6E\u300D\u624D\u4F1A\u751F\u6548\u3002\u7136\u540E\u4ECE\u804A\u5929\u9876\u90E8\u6253\u5F00\u300C",le,"\u300D\uFF0C\u70B9\u51FB\u9762\u677F\u53F3\u4E0A\u65B9\u7684\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002\u6BCF\u6B21\u70B9\u51FB\u90FD\u4F1A\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\u6807\u7B7E\u3002"]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u901A\u8FC7\u5BF9\u8BDD\u8FDE\u63A5\u8FDC\u7A0B\u673A\u5668"}),(0,G.jsx)("p",{children:"\u544A\u8BC9 AI \u8981\u8FDE\u63A5\u7684\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4F8B\u5982\u300C\u8FDE\u63A5 192.0.2.21\u300D\u3002AI \u4F1A\u6309\u4EE5\u4E0B\u987A\u5E8F\u67E5\u627E\uFF1A"}),(0,G.jsxs)("ol",{className:"zt-hint",children:[(0,G.jsx)("li",{children:"\u5148\u627E\u4E3B\u673A\u5217\u8868\u91CC\u5DF2\u4FDD\u5B58\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u6CA1\u627E\u5230\uFF0C\u518D\u67E5 JumpServer\uFF08\u5821\u5792\u673A\uFF09\u91CC\u4F60\u6709\u6743\u9650\u8BBF\u95EE\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u90FD\u6CA1\u627E\u5230\uFF0C\u5C31\u4FDD\u5B58\u4E3A\u65B0\u4E3B\u673A\uFF0C\u5E76\u5C1D\u8BD5\u7528\u4E0B\u65B9\u7684\u8D26\u53F7\u548C SSH \u79C1\u94A5\u8FDE\u63A5\u3002"})]}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u65B0\u4E3B\u673A\u9ED8\u8BA4\u767B\u5F55\u8D26\u53F7"}),(0,G.jsx)("input",{value:R.defaultSshUsername??"",placeholder:"\u7559\u7A7A\u4F7F\u7528\u8FD0\u884C DSH \u7684\u8D26\u53F7",onChange:g=>v("defaultSshUsername",g.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5BF9\u8BDD\u91CC\u6307\u5B9A\u4E86\u767B\u5F55\u8D26\u53F7\u65F6\uFF0C\u4F18\u5148\u4F7F\u7528\u4F60\u6307\u5B9A\u7684\u8D26\u53F7\u3002"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u51ED\u8BC1"}),(0,G.jsxs)("select",{value:R.defaultCredentialId??"",onChange:g=>v("defaultCredentialId",g.target.value),children:[(0,G.jsx)("option",{value:"",children:"\u81EA\u52A8\u67E5\u627E\u5BBF\u4E3B\u9ED8\u8BA4\u79C1\u94A5\u6587\u4EF6"}),(R.credentials??[]).filter(g=>g.authType!=="password").map(g=>(0,G.jsxs)("option",{value:g.id,children:[g.label," \xB7 ",He[g.authType]]},g.id))]})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5728\u4E0B\u65B9\u300C\u7BA1\u7406\u51ED\u8BC1\u300D\u4FDD\u5B58\u79C1\u94A5\u540E\uFF0C\u6309\u540D\u79F0\u9009\u62E9\u9ED8\u8BA4\u51ED\u8BC1\u3002\u79C1\u94A5\u5185\u5BB9\u4E0D\u4F1A\u53D1\u9001\u7ED9 AI\u3002"}),!R.defaultCredentialId&&(0,G.jsxs)("details",{children:[(0,G.jsx)("summary",{children:"\u6307\u5B9A\u5DF2\u6709\u7684\u5BBF\u4E3B\u79C1\u94A5\u6587\u4EF6\uFF08\u53EF\u9009\uFF09"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6"}),(0,G.jsx)("input",{value:R.defaultPrivateKeyPath??"",placeholder:"\u7559\u7A7A\u81EA\u52A8\u67E5\u627E ~/.ssh \u4E0B\u7684\u9ED8\u8BA4\u79C1\u94A5",onChange:g=>v("defaultPrivateKeyPath",g.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u4F7F\u7528\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u8DEF\u5F84\uFF1B\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"})]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u6267\u884C\u4E0E\u5E03\u5C40"}),[["defaultPanelWidth","\u72EC\u7ACB\u9762\u677F\u9ED8\u8BA4\u5BBD\u5EA6\uFF08\u767E\u5206\u6BD4\uFF09",30,80],["maxSessions","\u6BCF\u4F1A\u8BDD\u7EC8\u7AEF\u4E0A\u9650",1,32],["maxWriteCalls","\u6BCF\u6B21\u8BFB\u5199\u6388\u6743\u7684\u547D\u4EE4\u4E0A\u9650",1,1e3],["commandTimeoutMs","\u5355\u6B21\u547D\u4EE4\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",1e3,12e4]].map(([g,u,m,y])=>(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:u}),(0,G.jsx)("input",{type:"number",min:m,max:y,required:!0,value:R[g],onChange:x=>v(String(g),Number(x.target.value))})]},g))]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u51ED\u636E"}),(0,G.jsxs)("p",{children:["\u4E3B\u673A\u3001\u6587\u4EF6\u5939\u3001JumpServer \u5B9E\u4F8B\u548C\u8D26\u53F7\u4ECE\u4F1A\u8BDD\u4E2D\u7684\u300C",le,"\u300D\u5165\u53E3\u7BA1\u7406\u3002\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u5199\u5165 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u76F4\u63A5\u4ECE\u5BBF\u4E3B\u8BFB\u53D6\uFF0C\u5DE5\u5177\u7ED3\u679C\u4E0D\u5305\u542B\u51ED\u636E\u503C\u3002"]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u5DF2\u914D\u7F6E ",R.total," \u53F0\u4E3B\u673A\u3001",R.jumpservers.length," \u4E2A JumpServer \u5B9E\u4F8B\u3002"]})]}),(0,G.jsx)("button",{className:"zt-primary",disabled:s,children:s?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u8BBE\u7F6E"})]}),(0,G.jsx)(Qt,{ctx:T,credentials:R.credentials??[],revision:R.revision,onSaved:l})]}):(0,G.jsx)("p",{className:"zt-hint",children:"\u6B63\u5728\u8BFB\u53D6\u914D\u7F6E\u2026"})]})}var ii=`.zt-workbench,.zt-settings,.zt-modal{--zt-bg:var(--dsw-alias-bg-base,#fff);--zt-layer:var(--dsw-alias-bg-layer-2,#f4f6f8);--zt-text:var(--dsw-alias-label-primary,#252b36);--zt-muted:var(--dsw-alias-label-secondary,#687284);--zt-border:var(--dsw-alias-border-l2,#dfe3e9);--zt-accent:var(--dsw-alias-state-business-primary,#3764d6);color:var(--zt-text);font:13px/1.5 system-ui,sans-serif;box-sizing:border-box}
|
|
15
15
|
.zt-workbench *,.zt-settings *,.zt-modal *{box-sizing:border-box}
|
|
16
16
|
.zt-credential-header{display:flex;align-items:center;justify-content:space-between;gap:12px}.zt-credential-meta{display:flex;gap:12px;flex-wrap:wrap}.zt-credential-meta>.zt-field{flex:1 1 160px}.zt-credential-list{max-height:220px;overflow:auto}
|
|
17
17
|
.zt-settings-card.zt-credential-manager .zt-field{margin-top:8px;margin-bottom:8px}.zt-credential-manager .zt-hint{margin:8px 0}.zt-credential-header strong{font-weight:500}
|
|
@@ -44,7 +44,7 @@ ${I}`)).catch(I=>se(I.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
|
|
|
44
44
|
.zt-host-browser{display:flex;flex-direction:column;flex:1;min-height:0}.zt-tree-pane{display:flex;flex-direction:column;flex:none;min-height:0;max-height:100%}.zt-tree-handle{height:8px;flex:none;position:relative;cursor:row-resize;user-select:none}.zt-tree-handle::after{content:"";position:absolute;left:8px;right:8px;top:3px;height:1px;background:var(--zt-border)}.zt-tree-handle::before{content:"";position:absolute;left:calc(50% - 14px);top:2px;width:28px;height:3px;border-radius:2px;background:var(--zt-muted);z-index:1}.zt-tree-handle:hover::before,.zt-tree-handle:focus-visible::before{background:var(--zt-accent)}.zt-tree-handle:focus-visible{outline:1px solid var(--zt-accent);outline-offset:-1px}
|
|
45
45
|
.zt-folder-tree{flex:1;min-height:0;overflow:auto;padding:2px 8px 7px}.zt-folder-tree>button{display:block;width:100%;text-align:left}.zt-folder-tree>div{display:flex;min-width:0}.zt-folder-tree button{font-size:12px;border:0;background:transparent;padding:3px 5px;text-align:left;overflow:hidden;text-overflow:ellipsis}.zt-folder-tree .zt-folder-name{flex:1;min-width:0}.zt-folder-tree .zt-folder-action{flex:none;padding:3px 5px}.zt-folder-menu{position:fixed;inset:auto;margin:0;width:110px;padding:4px;border:1px solid var(--zt-border);border-radius:6px;background:var(--zt-bg);color:var(--zt-text);box-shadow:0 4px 14px #0002}.zt-folder-menu>button{display:block;width:100%;padding:5px 8px;text-align:left;border-radius:4px}.zt-folder-tree .active{color:var(--zt-accent);background:var(--zt-layer)}.zt-folder-toggle{width:20px;flex:none}.zt-standalone{right:var(--dsh-sidebar-width,0px)}
|
|
46
46
|
@media(max-width:700px){.zt-status-info{gap:6px}.zt-terminal-controls{gap:3px;padding:3px 5px}.zt-terminal-controls button{font-size:11px;padding:3px 5px}.zt-terminal-toolbar{padding:5px}.zt-terminal-search span{display:none}.zt-hosts{max-width:42%;min-width:150px}.zt-host-row>button:last-child{display:none}.zt-modal-shade{padding:8px}.zt-mode{padding:3px;font-size:11px}.zt-terminal-toolbar .zt-actions{gap:3px}.zt-terminal-toolbar button{padding:3px 5px;font-size:11px}}
|
|
47
|
-
`;var
|
|
47
|
+
`;var ri=`/**
|
|
48
48
|
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
49
49
|
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
50
50
|
* https://github.com/chjj/term.js
|
|
@@ -262,6 +262,6 @@ ${I}`)).catch(I=>se(I.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
|
|
|
262
262
|
z-index: 2;
|
|
263
263
|
position: relative;
|
|
264
264
|
}
|
|
265
|
-
`;var
|
|
266
|
-
${
|
|
265
|
+
`;var ue=require("react/jsx-runtime"),wi=["slots","connection"],xt="dsh-zterm:workbench";function ft(T=16){return(0,ue.jsxs)("svg",{width:T,height:T,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,ue.jsx)("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"2"}),(0,ue.jsx)("path",{d:"m4 6 2 2-2 2m4 0h4"})]})}function yi({ctx:T,service:R,tab:O,scope:W,visible:L}){return(0,pe.useEffect)(()=>{O?.id&&O.title!==le&&R.updateTab?.(O.id,{title:le})},[R,O?.id,O?.title]),(0,ue.jsx)(yt,{ctx:T,sessionId:W.sessionId,visible:L})}function xi(T){let R=new Set,O,W=()=>R.forEach(c=>c()),L=()=>(0,pe.useSyncExternalStore)(c=>(R.add(c),()=>R.delete(c)),()=>O),s=document.createElement("style");s.dataset.plugin="dsh-zterm",s.textContent=`${ri}
|
|
266
|
+
${ii}`,document.head.appendChild(s),T.effect(()=>()=>{s.remove(),R.clear()}),T.inject(["betterSidebar"],c=>{O=c.betterSidebar,W();let f=O.registerTab({id:xt,title:()=>le,description:"\u8FDE\u63A5\u771F\u5B9E\u673A\u5668\uFF0C\u63D0\u4F9B\u8BFB\u5DE5\u5177\u548C\u4EBA\u7C7B\u5F00\u542F\u7684\u8BFB\u5199\u64CD\u4F5C\u3002",icon:ft,single:!0,order:109,component:n=>(0,ue.jsx)(yi,{...n,ctx:T,service:c.betterSidebar})}),a=c.slots.inject("sidebar.right.pane.tab.title",()=>c.slots.register({name:"sidebar.right.pane.tab.title",key:`dsh-better-sidebar:${xt}`,priority:-1},()=>(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)("span",{"aria-hidden":"true",children:ft()}),le]})));return()=>{a?.(),f?.(),O=void 0,W()}});function o(c){let f=L(),[a,n]=(0,pe.useState)(!1),[d,_]=(0,pe.useState)(""),[h,i]=(0,pe.useState)(!1),t=c.sessionId??c.scope?.sessionId,e=c.scope??{sessionId:t},r=c.useChat??c.useSession,l=typeof r=="function"?r(g=>g.legacy?.nodes??g.nodes):void 0,v=(0,pe.useRef)(""),p=()=>{f?.openTab?f.openTab({type:xt,title:le,url:"zterm://workbench"},e):parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0?_("\u53F3\u4FA7\u8111\u56FE\u9762\u677F\u5DF2\u5C55\u5F00\u3002\u8BF7\u5148\u6536\u8D77\u8111\u56FE\uFF0C\u6216\u4F7F\u7528 Better Sidebar \u7684 Tab \u5207\u6362\u3002"):n(!0)};return(0,pe.useEffect)(()=>{t&&ie(T,"client/attach",{sessionId:t,pageId:ut}).catch(()=>{})},[t]),(0,pe.useEffect)(()=>{let g=!0,u=()=>{ie(T,"status").then(m=>{g&&i(!!m?.temporarilyDisabled)}).catch(()=>{})};return u(),window.addEventListener("dsh-zterm:state",u),()=>{g=!1,window.removeEventListener("dsh-zterm:state",u)}},[T]),(0,pe.useEffect)(()=>{if(!l)return;let g=Array.isArray(l)?[...l]:[l],u="";for(let m=0;g.length&&m<5e3;m++){let y=g.pop();if(!y||typeof y!="object")continue;let x=y.name??y.call?.name??y.toolName;if(["zterm_connect","zterm_bind"].includes(x)){u=String(y.id??y.callId??y.call?.id??x);break}for(let S of["children","nodes","body","calls","subCalls"]){let w=y[S];if(Array.isArray(w))for(let A of w){if(g.length>=5e3)break;g.push(A)}}}u&&u!==v.current&&(v.current=u,p())},[l,f,t]),(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("button",{className:"zt-header-button",title:h?`${le} \u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u4F7F\u7528\u672C\u63D2\u4EF6\u5DE5\u5177`:`\u6253\u5F00 ${le}`,onClick:p,children:[ft(15),le,h&&(0,ue.jsx)("span",{className:"zt-header-badge",children:"AI\u7981\u7528"})]}),a&&!f&&t&&(0,ue.jsx)(Ei,{ctx:T,sessionId:t,onClose:()=>n(!1),onConflict:()=>{n(!1),_(`\u8111\u56FE\u9762\u677F\u5DF2\u5C55\u5F00\uFF0C${le} \u72EC\u7ACB\u9762\u677F\u5DF2\u6536\u8D77\u3002\u53EF\u4EE5\u4ECE ${le} \u5165\u53E3\u91CD\u65B0\u6253\u5F00\u3002`)}}),d&&(0,ue.jsxs)("div",{className:"zt-standalone-error",role:"alert",children:[d,(0,ue.jsx)("button",{onClick:()=>_(""),children:"\u5173\u95ED"})]})]})}T.slots.inject("conversation.session.header.actions",()=>T.slots.register({name:"conversation.session.header.actions",id:"dsh-zterm",order:109},o)),T.slots.inject("settings.section",()=>T.slots.register({name:"settings.section",id:"dsh-zterm",order:109,label:le,icon:ft},()=>(0,ue.jsx)(ti,{ctx:T})))}function Ei({ctx:T,sessionId:R,onClose:O,onConflict:W}){let L=a=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),a)),[s,o]=(0,pe.useState)(()=>L(ze("dsh-zterm.panel-width",window.innerWidth*.6,0,window.innerWidth))),c=Ge();(0,pe.useEffect)(()=>{let a=!0;return ie(T,"catalog").then(n=>{a&&o(L(ze("dsh-zterm.panel-width",window.innerWidth*n.defaultPanelWidth/100,0,window.innerWidth)))}).catch(()=>{}),()=>{a=!1}},[T]),(0,pe.useEffect)(()=>{let a=()=>{parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0&&W()},n=new MutationObserver(a);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),a(),()=>n.disconnect()},[W]),(0,pe.useEffect)(()=>{let a=()=>o(n=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),n)));return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),(0,pe.useEffect)(()=>{document.documentElement.style.setProperty("--dsh-zterm-width",`${s}px`);let a=document.createElement("style");return a.dataset.plugin="dsh-zterm",a.textContent="#root{margin-right:calc(var(--dsh-zterm-width,0px) + var(--dsh-sidebar-width,0px))!important;width:calc(100% - var(--dsh-zterm-width,0px) - var(--dsh-sidebar-width,0px))!important}",document.head.appendChild(a),()=>{a.remove(),document.documentElement.style.removeProperty("--dsh-zterm-width")}},[s]);let f=a=>{let n=a.clientX,d=s;c(a,_=>{let h=L(d+n-_.clientX);o(h),Pe("dsh-zterm.panel-width",h)})};return(0,ue.jsxs)("section",{className:"zt-standalone",style:{width:s},"aria-label":le,children:[(0,ue.jsx)("div",{className:"zt-panel-handle",role:"separator","aria-label":`\u8C03\u6574 ${le} \u9762\u677F\u5BBD\u5EA6`,onMouseDown:f}),(0,ue.jsx)(yt,{ctx:T,sessionId:R,onClose:O})]})}
|
|
267
267
|
return module.exports; } });
|