tring-chat 0.1.13 → 0.1.15
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/LICENSE +0 -0
- package/README.md +11 -0
- package/dist/fix-spawn-helper.mjs +0 -0
- package/dist/tring.js +24 -0
- package/dist/web/assets/{index-mVWsm9Sf.css → index-BMT8h4qK.css} +1 -1
- package/dist/web/assets/{index-DZRbRgNO.js → index-BRvnX-Pe.js} +12 -12
- package/dist/web/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
- package/dist/web/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
- package/dist/web/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
- package/dist/web/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
- package/dist/web/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
- package/dist/web/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
- package/dist/web/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
- package/dist/web/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
- package/dist/web/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
- package/dist/web/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
- package/dist/web/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
- package/dist/web/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
- package/dist/web/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
- package/dist/web/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- package/dist/web/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
- package/dist/web/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
- package/dist/web/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
- package/dist/web/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
- package/dist/web/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
- package/dist/web/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
- package/dist/web/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
- package/dist/web/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
- package/dist/web/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
- package/dist/web/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
- package/dist/web/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-700-normal-BWTpRfYl.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-700-normal-CEoEElIJ.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-700-normal-C6CZE3T8.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-700-normal-DEigVDxa.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-700-normal-D3wTyLJW.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-700-normal-CZipNAKV.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-700-normal-CxPITLHs.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-700-normal-BDLVIk2r.woff +0 -0
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/maskable-512.png +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/manifest.webmanifest +0 -0
- package/dist/web/sw.js +0 -0
- package/package.json +1 -1
- package/scripts/postinstall.mjs +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
`))),this.register(this._terminal.onA11yTab(_=>this._handleTab(_))),this.register(this._terminal.onKey(_=>this._handleKey(_.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,f.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let
|
|
3
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=r.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,s){this._liveRegionDebouncer.refresh(i,s,this._terminal.rows)}_renderRows(i,s){const d=this._terminal.buffer,g=d.lines.length.toString();for(let _=i;_<=s;_++){const S=d.lines.get(d.ydisp+_),u=[],v=(S==null?void 0:S.translateToString(!0,void 0,void 0,u))||"",C=(d.ydisp+_+1).toString(),x=this._rowElements[_];x&&(v.length===0?(x.innerText=" ",this._rowColumns.set(x,[0,1])):(x.textContent=v,this._rowColumns.set(x,u)),x.setAttribute("aria-posinset",C),x.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,s){const d=i.target,g=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==g)return;let _,S;if(s===0?(_=d,S=this._rowElements.pop(),this._rowContainer.removeChild(S)):(_=this._rowElements.shift(),S=d,this._rowContainer.removeChild(_)),_.removeEventListener("focus",this._topBoundaryFocusListener),S.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{const 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(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var v;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:i.anchorNode,offset:i.anchorOffset},d={node:i.focusNode,offset:i.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const g=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:g,offset:((v=g.textContent)==null?void 0:v.length)??0}),!this._rowContainer.contains(d.node))return;const _=({node:C,offset:x})=>{const w=C instanceof Text?C.parentNode:C;let E=parseInt(w==null?void 0:w.getAttribute("aria-posinset"),10)-1;if(isNaN(E))return console.warn("row is invalid. Race condition?"),null;const A=this._rowColumns.get(w);if(!A)return console.warn("columns is null. Race condition?"),null;let I=x<A.length?A[x]:A.slice(-1)[0]+1;return I>=this._terminal.cols&&(++E,I=0),{row:E,column:I}},S=_(s),u=_(d);if(S&&u){if(S.row>u.row||S.row===u.row&&S.column>=u.column)throw new Error("invalid range");this._terminal.select(S.column,S.row,(u.row-S.row)*this._terminal.cols-S.column+u.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_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 i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=n=h([l(1,o.IInstantiationService),l(2,p.ICoreBrowserService),l(3,p.IRenderService)],n)},3614:(M,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,f){return f?"\x1B[200~"+c+"\x1B[201~":c}function l(c,f,p,o){c=h(c=a(c),p.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(c,!0),f.value=""}function r(c,f,p){const o=p.getBoundingClientRect(),e=c.clientX-o.left-10,n=c.clientY-o.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${e}px`,f.style.top=`${n}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=h,t.copyHandler=function(c,f){c.clipboardData&&c.clipboardData.setData("text/plain",f.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,f,p,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),f,p,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=r,t.rightClickHandler=function(c,f,p,o,e){r(c,f,p),e&&o.rightClickSelect(c),f.value=o.selectionText,f.select()}},7239:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=a(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(l,r,c){this._css.set(l,r,c)}getCss(l,r){return this._css.get(l,r)}setColor(l,r,c){this._color.set(l,r,c)}getColor(l,r){return this._color.get(l,r)}clear(){this._color.clear(),this._css.clear()}}},3656:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,r){a.addEventListener(h,l,r);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,r))}}}},3551:function(M,t,a){var h=this&&this.__decorate||function(n,i,s,d){var g,_=arguments.length,S=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,i,s,d);else for(var u=n.length-1;u>=0;u--)(g=n[u])&&(S=(_<3?g(S):_>3?g(i,s,S):g(i,s))||S);return _>3&&S&&Object.defineProperty(i,s,S),S},l=this&&this.__param||function(n,i){return function(s,d){i(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const r=a(3656),c=a(8460),f=a(844),p=a(2585),o=a(4725);let e=t.Linkifier=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(n,i,s,d,g){super(),this._element=n,this._mouseService=i,this._renderService=s,this._bufferService=d,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)(()=>{var _;this._lastMouseEvent=void 0,(_=this._activeProviderReplies)==null||_.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,r.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,r.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,r.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,r.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){this._lastMouseEvent=n;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const s=n.composedPath();for(let d=0;d<s.length;d++){const g=s[d];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,i){var d,g;this._activeProviderReplies&&i||((d=this._activeProviderReplies)==null||d.forEach(_=>{_==null||_.forEach(S=>{S.link.dispose&&S.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);let s=!1;for(const[_,S]of this._linkProviderService.linkProviders.entries())i?(g=this._activeProviderReplies)!=null&&g.get(_)&&(s=this._checkLinkProviderResult(_,n,s)):S.provideLinks(n.y,u=>{var C,x;if(this._isMouseOut)return;const v=u==null?void 0:u.map(w=>({link:w}));(C=this._activeProviderReplies)==null||C.set(_,v),s=this._checkLinkProviderResult(_,n,s),((x=this._activeProviderReplies)==null?void 0:x.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)})}_removeIntersectingLinks(n,i){const s=new Set;for(let d=0;d<i.size;d++){const g=i.get(d);if(g)for(let _=0;_<g.length;_++){const S=g[_],u=S.link.range.start.y<n?0:S.link.range.start.x,v=S.link.range.end.y>n?this._bufferService.cols:S.link.range.end.x;for(let C=u;C<=v;C++){if(s.has(C)){g.splice(_--,1);break}s.add(C)}}}}_checkLinkProviderResult(n,i,s){var _;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(n);let g=!1;for(let S=0;S<n;S++)this._activeProviderReplies.has(S)&&!this._activeProviderReplies.get(S)||(g=!0);if(!g&&d){const S=d.find(u=>this._linkAtPosition(u.link,i));S&&(s=!0,this._handleNewLink(S))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let S=0;S<this._activeProviderReplies.size;S++){const u=(_=this._activeProviderReplies.get(S))==null?void 0:_.find(v=>this._linkAtPosition(v.link,i));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,i){this._currentLink&&this._lastMouseEvent&&(!n||!i||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(n.link,i)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,g,_;(d=this._currentLink)!=null&&d.state&&((_=(g=this._currentLink)==null?void 0:g.state)==null?void 0:_.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(d,g),this._lastMouseEvent)){const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._askForLink(_,!1)}})))}_linkHover(n,i,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(s,i.text)}_fireUnderlineEvent(n,i){const s=n.range,d=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(n,i,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(s,i.text)}_linkAtPosition(n,i){const s=n.range.start.y*this._bufferService.cols+n.range.start.x,d=n.range.end.y*this._bufferService.cols+n.range.end.x,g=i.y*this._bufferService.cols+i.x;return s<=g&&g<=d}_positionFromMouseEvent(n,i,s){const d=s.getCoords(n,i,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,i,s,d,g){return{x1:n,y1:i,x2:s,y2:d,cols:this._bufferService.cols,fg:g}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,p.IBufferService),l(4,o.ILinkProviderService)],e)},9042:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(M,t,a){var h=this&&this.__decorate||function(o,e,n,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,n,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,n,g):s(e,n))||g);return d>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(o,e){return function(n,i){e(n,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const r=a(511),c=a(2585);let f=t.OscLinkProvider=class{constructor(o,e,n){this._bufferService=o,this._optionsService=e,this._oscLinkService=n}provideLinks(o,e){var v;const n=this._bufferService.buffer.lines.get(o-1);if(!n)return void e(void 0);const i=[],s=this._optionsService.rawOptions.linkHandler,d=new r.CellData,g=n.getTrimmedLength();let _=-1,S=-1,u=!1;for(let C=0;C<g;C++)if(S!==-1||n.hasContent(C)){if(n.loadCell(C,d),d.hasExtendedAttrs()&&d.extended.urlId){if(S===-1){S=C,_=d.extended.urlId;continue}u=d.extended.urlId!==_}else S!==-1&&(u=!0);if(u||S!==-1&&C===g-1){const x=(v=this._oscLinkService.getLinkData(_))==null?void 0:v.uri;if(x){const w={start:{x:S+1,y:o},end:{x:C+(u||C!==g-1?0:1),y:o}};let E=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const A=new URL(x);["http:","https:"].includes(A.protocol)||(E=!0)}catch{E=!0}E||i.push({text:x,range:w,activate:(A,I)=>s?s.activate(A,I,w):p(0,I),hover:(A,I)=>{var N;return(N=s==null?void 0:s.hover)==null?void 0:N.call(s,A,I,w)},leave:(A,I)=>{var N;return(N=s==null?void 0:s.leave)==null?void 0:N.call(s,A,I,w)}})}u=!1,d.hasExtendedAttrs()&&d.extended.urlId?(S=C,_=d.extended.urlId):(S=-1,_=-1)}}e(i)}};function p(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
1
|
+
var Ui=Object.defineProperty;var zi=(m,w,E)=>w in m?Ui(m,w,{enumerable:!0,configurable:!0,writable:!0,value:E}):m[w]=E;var de=(m,w,E)=>zi(m,typeof w!="symbol"?w+"":w,E);(function(){const w=document.createElement("link").relList;if(w&&w.supports&&w.supports("modulepreload"))return;for(const B of document.querySelectorAll('link[rel="modulepreload"]'))D(B);new MutationObserver(B=>{for(const H of B)if(H.type==="childList")for(const M of H.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&D(M)}).observe(document,{childList:!0,subtree:!0});function E(B){const H={};return B.integrity&&(H.integrity=B.integrity),B.referrerPolicy&&(H.referrerPolicy=B.referrerPolicy),B.crossOrigin==="use-credentials"?H.credentials="include":B.crossOrigin==="anonymous"?H.credentials="omit":H.credentials="same-origin",H}function D(B){if(B.ep)return;B.ep=!0;const H=E(B);fetch(B.href,H)}})();const ji=16,qi={code:"Space",ctrl:!0};function Ki(){const m=[];for(let w=1;w<=10;w++){const E=w===10?0:w;m.push({slot:w,code:`Digit${E}`,legend:String(E)})}for(let w=11;w<=ji;w++){const E=w-10;m.push({slot:w,code:`Digit${E}`,ctrl:!0,legend:`Ctrl+${E}`}),m.push({slot:w,code:`Digit${E}`,shift:!0,legend:`Shift+${E}`})}return m}const ei=Ki(),Gi={KeyN:"next-done",KeyP:"projects",KeyC:"new-session",KeyR:"rename",KeyX:"kill",KeyM:"mark-seen",Escape:"close"};function ti(m,w){return w.code===m.code&&w.ctrlKey===!!m.ctrl&&w.shiftKey===!!m.shift&&!w.altKey&&!w.metaKey}function Rt(m){return ti(qi,m)}function Vi(m){for(const w of ei)if(ti(w,m))return w.slot;return null}function Xi(m){return m.ctrlKey||m.altKey||m.metaKey?null:Gi[m.code]??null}const Yi="\x1B\r";function Ji(m){return m.code!=="Enter"&&m.code!=="NumpadEnter"?!1:(m.ctrlKey||m.shiftKey)&&!m.altKey&&!m.metaKey}function Zi(m,w){return!w&&m.code==="KeyV"&&m.ctrlKey&&!m.shiftKey&&!m.altKey&&!m.metaKey}function kt(m){return ei.filter(w=>w.slot===m).map(w=>w.legend).join(" / ")}function Qi(m){const w=m.indexOf(0);return w<0?null:{id:new TextDecoder().decode(m.subarray(0,w)),data:m.subarray(w+1)}}const zt="tring.token";function es(m,w,E){const D=new URLSearchParams(m).get("token");if(D){try{w.setItem(zt,D)}catch{}try{E==null||E()}catch{}return D}try{return w.getItem(zt)??void 0}catch{return}}const Dt=location.origin,Ge=es(location.search,localStorage,()=>{const m=new URL(location.href);m.searchParams.delete("token"),history.replaceState(null,"",`${m.pathname}${m.search}${m.hash}`)});async function At(m){const w=await fetch(`${Dt}${m}`,{headers:Ge?{authorization:`Bearer ${Ge}`}:{}}),E=await w.json().catch(()=>({}));if(!w.ok)throw new Error(E.error??`request failed (${w.status})`);return E}async function ts(m){const w=m instanceof File?`?name=${encodeURIComponent(m.name)}`:"",E=await fetch(`${Dt}/api/upload${w}`,{method:"POST",headers:{...Ge?{authorization:`Bearer ${Ge}`}:{},"content-type":m.type||"application/octet-stream"},body:m}),D=await E.json().catch(()=>({}));if(!E.ok||!D.path)throw new Error(D.error??`upload failed (${E.status})`);return D.path}class is{constructor(w,E=Ge){de(this,"ws",null);de(this,"retry",0);de(this,"closed",!1);this.h=w,this.token=E}connect(){const w=Dt.replace(/^http/,"ws"),E=new WebSocket(w);E.binaryType="arraybuffer",this.ws=E,E.onopen=()=>{this.retry=0,this.send({type:"hello",...this.token?{token:this.token}:{}}),this.h.onOpen()},E.onmessage=D=>{if(D.data instanceof ArrayBuffer){const B=Qi(new Uint8Array(D.data));B&&this.h.onOutput(B.id,B.data);return}this.h.onMessage(JSON.parse(String(D.data)))},E.onclose=()=>{this.ws=null,this.h.onClose(),!this.closed&&(this.retry=Math.min(this.retry+1,8),setTimeout(()=>this.connect(),Math.min(200*this.retry,2e3)))}}send(w){var E;((E=this.ws)==null?void 0:E.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(w))}dispose(){var w;this.closed=!0,(w=this.ws)==null||w.close()}}var ii={exports:{}};(function(m,w){(function(E,D){m.exports=D()})(globalThis,()=>(()=>{var E={4567:function(M,t,o){var h=this&&this.__decorate||function(i,r,d,g){var _,S=arguments.length,u=S<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,r,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(S<3?_(u):S>3?_(r,d,u):_(r,d))||u);return S>3&&u&&Object.defineProperty(r,d,u),u},l=this&&this.__param||function(i,r){return function(d,g){r(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const s=o(9042),c=o(9924),f=o(844),p=o(4725),a=o(2585),e=o(3656);let n=t.AccessibilityManager=class extends f.Disposable{constructor(i,r,d,g){super(),this._terminal=i,this._coreBrowserService=d,this._renderService=g,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 _=0;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);if(this._topBoundaryFocusListener=_=>this._handleBoundaryFocus(_,0),this._bottomBoundaryFocusListener=_=>this._handleBoundaryFocus(_,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 c.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(_=>this._handleResize(_.rows))),this.register(this._terminal.onRender(_=>this._refreshRows(_.start,_.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(_=>this._handleChar(_))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
|
+
`))),this.register(this._terminal.onA11yTab(_=>this._handleTab(_))),this.register(this._terminal.onKey(_=>this._handleKey(_.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,f.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let r=0;r<i;r++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
|
|
3
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=s.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,r){this._liveRegionDebouncer.refresh(i,r,this._terminal.rows)}_renderRows(i,r){const d=this._terminal.buffer,g=d.lines.length.toString();for(let _=i;_<=r;_++){const S=d.lines.get(d.ydisp+_),u=[],v=(S==null?void 0:S.translateToString(!0,void 0,void 0,u))||"",C=(d.ydisp+_+1).toString(),x=this._rowElements[_];x&&(v.length===0?(x.innerText=" ",this._rowColumns.set(x,[0,1])):(x.textContent=v,this._rowColumns.set(x,u)),x.setAttribute("aria-posinset",C),x.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,r){const d=i.target,g=this._rowElements[r===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==g)return;let _,S;if(r===0?(_=d,S=this._rowElements.pop(),this._rowContainer.removeChild(S)):(_=this._rowElements.shift(),S=d,this._rowContainer.removeChild(_)),_.removeEventListener("focus",this._topBoundaryFocusListener),S.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){const u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{const 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(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var v;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:i.anchorNode,offset:i.anchorOffset},d={node:i.focusNode,offset:i.focusOffset};if((r.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===d.node&&r.offset>d.offset)&&([r,d]=[d,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;const g=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:g,offset:((v=g.textContent)==null?void 0:v.length)??0}),!this._rowContainer.contains(d.node))return;const _=({node:C,offset:x})=>{const y=C instanceof Text?C.parentNode:C;let L=parseInt(y==null?void 0:y.getAttribute("aria-posinset"),10)-1;if(isNaN(L))return console.warn("row is invalid. Race condition?"),null;const A=this._rowColumns.get(y);if(!A)return console.warn("columns is null. Race condition?"),null;let I=x<A.length?A[x]:A.slice(-1)[0]+1;return I>=this._terminal.cols&&(++L,I=0),{row:L,column:I}},S=_(r),u=_(d);if(S&&u){if(S.row>u.row||S.row===u.row&&S.column>=u.column)throw new Error("invalid range");this._terminal.select(S.column,S.row,(u.row-S.row)*this._terminal.cols-S.column+u.column)}}_handleResize(i){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>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_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 i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=n=h([l(1,a.IInstantiationService),l(2,p.ICoreBrowserService),l(3,p.IRenderService)],n)},3614:(M,t)=>{function o(c){return c.replace(/\r?\n/g,"\r")}function h(c,f){return f?"\x1B[200~"+c+"\x1B[201~":c}function l(c,f,p,a){c=h(c=o(c),p.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(c,!0),f.value=""}function s(c,f,p){const a=p.getBoundingClientRect(),e=c.clientX-a.left-10,n=c.clientY-a.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${e}px`,f.style.top=`${n}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=o,t.bracketTextForPaste=h,t.copyHandler=function(c,f){c.clipboardData&&c.clipboardData.setData("text/plain",f.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,f,p,a){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),f,p,a)},t.paste=l,t.moveTextAreaUnderMouseCursor=s,t.rightClickHandler=function(c,f,p,a,e){s(c,f,p),e&&a.rightClickSelect(c),f.value=a.selectionText,f.select()}},7239:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=o(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(l,s,c){this._css.set(l,s,c)}getCss(l,s){return this._css.get(l,s)}setColor(l,s,c){this._color.set(l,s,c)}getColor(l,s){return this._color.get(l,s)}clear(){this._color.clear(),this._css.clear()}}},3656:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(o,h,l,s){o.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,o.removeEventListener(h,l,s))}}}},3551:function(M,t,o){var h=this&&this.__decorate||function(n,i,r,d){var g,_=arguments.length,S=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,r):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,i,r,d);else for(var u=n.length-1;u>=0;u--)(g=n[u])&&(S=(_<3?g(S):_>3?g(i,r,S):g(i,r))||S);return _>3&&S&&Object.defineProperty(i,r,S),S},l=this&&this.__param||function(n,i){return function(r,d){i(r,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const s=o(3656),c=o(8460),f=o(844),p=o(2585),a=o(4725);let e=t.Linkifier=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(n,i,r,d,g){super(),this._element=n,this._mouseService=i,this._renderService=r,this._bufferService=d,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)(()=>{var _;this._lastMouseEvent=void 0,(_=this._activeProviderReplies)==null||_.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,s.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,s.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){this._lastMouseEvent=n;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const r=n.composedPath();for(let d=0;d<r.length;d++){const g=r[d];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,i){var d,g;this._activeProviderReplies&&i||((d=this._activeProviderReplies)==null||d.forEach(_=>{_==null||_.forEach(S=>{S.link.dispose&&S.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);let r=!1;for(const[_,S]of this._linkProviderService.linkProviders.entries())i?(g=this._activeProviderReplies)!=null&&g.get(_)&&(r=this._checkLinkProviderResult(_,n,r)):S.provideLinks(n.y,u=>{var C,x;if(this._isMouseOut)return;const v=u==null?void 0:u.map(y=>({link:y}));(C=this._activeProviderReplies)==null||C.set(_,v),r=this._checkLinkProviderResult(_,n,r),((x=this._activeProviderReplies)==null?void 0:x.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)})}_removeIntersectingLinks(n,i){const r=new Set;for(let d=0;d<i.size;d++){const g=i.get(d);if(g)for(let _=0;_<g.length;_++){const S=g[_],u=S.link.range.start.y<n?0:S.link.range.start.x,v=S.link.range.end.y>n?this._bufferService.cols:S.link.range.end.x;for(let C=u;C<=v;C++){if(r.has(C)){g.splice(_--,1);break}r.add(C)}}}}_checkLinkProviderResult(n,i,r){var _;if(!this._activeProviderReplies)return r;const d=this._activeProviderReplies.get(n);let g=!1;for(let S=0;S<n;S++)this._activeProviderReplies.has(S)&&!this._activeProviderReplies.get(S)||(g=!0);if(!g&&d){const S=d.find(u=>this._linkAtPosition(u.link,i));S&&(r=!0,this._handleNewLink(S))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let S=0;S<this._activeProviderReplies.size;S++){const u=(_=this._activeProviderReplies.get(S))==null?void 0:_.find(v=>this._linkAtPosition(v.link,i));if(u){r=!0,this._handleNewLink(u);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,i){this._currentLink&&this._lastMouseEvent&&(!n||!i||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(n.link,i)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var r,d;return(d=(r=this._currentLink)==null?void 0:r.state)==null?void 0:d.decorations.pointerCursor},set:r=>{var d;(d=this._currentLink)!=null&&d.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:()=>{var r,d;return(d=(r=this._currentLink)==null?void 0:r.state)==null?void 0:d.decorations.underline},set:r=>{var d,g,_;(d=this._currentLink)!=null&&d.state&&((_=(g=this._currentLink)==null?void 0:g.state)==null?void 0:_.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;const d=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(d,g),this._lastMouseEvent)){const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._askForLink(_,!1)}})))}_linkHover(n,i,r){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(n,i){const r=n.range,d=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-d-1,r.end.x,r.end.y-d-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(n,i,r){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(n,i){const r=n.range.start.y*this._bufferService.cols+n.range.start.x,d=n.range.end.y*this._bufferService.cols+n.range.end.x,g=i.y*this._bufferService.cols+i.x;return r<=g&&g<=d}_positionFromMouseEvent(n,i,r){const d=r.getCoords(n,i,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,i,r,d,g){return{x1:n,y1:i,x2:r,y2:d,cols:this._bufferService.cols,fg:g}}};t.Linkifier=e=h([l(1,a.IMouseService),l(2,a.IRenderService),l(3,p.IBufferService),l(4,a.ILinkProviderService)],e)},9042:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(M,t,o){var h=this&&this.__decorate||function(a,e,n,i){var r,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(a,e,n,i);else for(var _=a.length-1;_>=0;_--)(r=a[_])&&(g=(d<3?r(g):d>3?r(e,n,g):r(e,n))||g);return d>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(a,e){return function(n,i){e(n,i,a)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const s=o(511),c=o(2585);let f=t.OscLinkProvider=class{constructor(a,e,n){this._bufferService=a,this._optionsService=e,this._oscLinkService=n}provideLinks(a,e){var v;const n=this._bufferService.buffer.lines.get(a-1);if(!n)return void e(void 0);const i=[],r=this._optionsService.rawOptions.linkHandler,d=new s.CellData,g=n.getTrimmedLength();let _=-1,S=-1,u=!1;for(let C=0;C<g;C++)if(S!==-1||n.hasContent(C)){if(n.loadCell(C,d),d.hasExtendedAttrs()&&d.extended.urlId){if(S===-1){S=C,_=d.extended.urlId;continue}u=d.extended.urlId!==_}else S!==-1&&(u=!0);if(u||S!==-1&&C===g-1){const x=(v=this._oscLinkService.getLinkData(_))==null?void 0:v.uri;if(x){const y={start:{x:S+1,y:a},end:{x:C+(u||C!==g-1?0:1),y:a}};let L=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{const A=new URL(x);["http:","https:"].includes(A.protocol)||(L=!0)}catch{L=!0}L||i.push({text:x,range:y,activate:(A,I)=>r?r.activate(A,I,y):p(0,I),hover:(A,I)=>{var N;return(N=r==null?void 0:r.hover)==null?void 0:N.call(r,A,I,y)},leave:(A,I)=>{var N;return(N=r==null?void 0:r.leave)==null?void 0:N.call(r,A,I,y)}})}u=!1,d.hasExtendedAttrs()&&d.extended.urlId?(S=C,_=d.extended.urlId):(S=-1,_=-1)}}e(i)}};function p(a,e){if(confirm(`Do you want to navigate to ${e}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=f=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],f)},6193:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,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();const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),r=a(3551),c=a(9042),f=a(3730),p=a(1680),o=a(3107),e=a(5744),n=a(2950),i=a(1296),s=a(428),d=a(4269),g=a(5114),_=a(8934),S=a(3230),u=a(9312),v=a(4725),C=a(6731),x=a(8055),w=a(8969),E=a(8460),A=a(844),I=a(6114),N=a(8437),$=a(2584),F=a(7399),b=a(5941),k=a(9074),T=a(2585),O=a(5435),U=a(4567),q=a(779);class Y extends w.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(P={}){super(P),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new A.MutableDisposable),this._onCursorMove=this.register(new E.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new E.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new E.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new E.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new E.EventEmitter),this._onBlur=this.register(new E.EventEmitter),this._onA11yCharEmitter=this.register(new E.EventEmitter),this._onA11yTabEmitter=this.register(new E.EventEmitter),this._onWillOpen=this.register(new E.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(k.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((R,z)=>this.refresh(R,z))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(R=>this._reportWindowsOptions(R))),this.register(this._inputHandler.onColor(R=>this._handleColorEvent(R))),this.register((0,E.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,E.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(R=>this._afterResize(R.cols,R.rows))),this.register((0,A.toDisposable)(()=>{var R,z;this._customKeyEventHandler=void 0,(z=(R=this.element)==null?void 0:R.parentNode)==null||z.removeChild(this.element)}))}_handleColorEvent(P){if(this._themeService)for(const R of P){let z,W="";switch(R.index){case 256:z="foreground",W="10";break;case 257:z="background",W="11";break;case 258:z="cursor",W="12";break;default:z="ansi",W="4;"+R.index}switch(R.type){case 0:const G=x.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${W};${(0,b.toRgbString)(G)}${$.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors(K=>K.ansi[R.index]=x.channels.toColor(...R.color));else{const K=z;this._themeService.modifyColors(Q=>Q[K]=x.channels.toColor(...R.color))}break;case 2:this._themeService.restoreColor(R.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var P;return(P=this.textarea)==null?void 0:P.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const P=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(P);if(!R)return;const z=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,G=R.getWidth(z),K=this._renderService.dimensions.css.cell.width*G,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,J=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=J+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=K+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",R=>{this.hasSelection()&&(0,h.copyHandler)(R,this._selectionService)}));const P=R=>(0,h.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,l.addDisposableDomListener)(this.element,"paste",P)),I.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",R=>{R.button===2&&(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",R=>{(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",R=>{R.button===1&&(0,h.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",P=>this._keyUp(P),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",P=>this._keyDown(P),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",P=>this._keyPress(P),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",P=>this._compositionHelper.compositionupdate(P))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,l.addDisposableDomListener)(this.textarea,"input",P=>this._inputEvent(P),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(P){var z;if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((z=this.element)==null?void 0:z.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.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"),P.appendChild(this.element);const R=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.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,l.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),R.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),I.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(g.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(C.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(S.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(_.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(r.Linkifier,this.screenElement)),this.element.appendChild(R);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const P=this,R=this.element;function z(K){const Q=P._mouseService.getMouseReportCoords(K,P.screenElement);if(!Q)return!1;let J,oe;switch(K.overrideType||K.type){case"mousemove":oe=32,K.buttons===void 0?(J=3,K.button!==void 0&&(J=K.button<3?K.button:3)):J=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":oe=0,J=K.button<3?K.button:3;break;case"mousedown":oe=1,J=K.button<3?K.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(K)===!1||P.viewport.getLinesScrolled(K)===0)return!1;oe=K.deltaY<0?0:1,J=4;break;default:return!1}return!(oe===void 0||J===void 0||J>4)&&P.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:J,action:oe,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:K=>(z(K),K.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(K)),wheel:K=>(z(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&z(K)},mousemove:K=>{K.buttons||z(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),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&K?W.mousemove||(R.addEventListener("mousemove",G.mousemove),W.mousemove=G.mousemove):(R.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&K?W.wheel||(R.addEventListener("wheel",G.wheel,{passive:!1}),W.wheel=G.wheel):(R.removeEventListener("wheel",W.wheel),W.wheel=null),2&K?W.mouseup||(W.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&K?W.mousedrag||(W.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(R,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return z(K),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(K)})),this.register((0,l.addDisposableDomListener)(R,"wheel",K=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const Q=this.viewport.getLinesScrolled(K);if(Q===0)return;const J=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let oe="";for(let _e=0;_e<Math.abs(Q);_e++)oe+=J;return this.coreService.triggerDataEvent(oe,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(R,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,l.addDisposableDomListener)(R,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(P,R){var z;(z=this._renderService)==null||z.refreshRows(P,R)}updateCursorStyle(P){var R;(R=this._selectionService)!=null&&R.shouldColumnSelect(P)?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(P,R,z=0){var W;z===1?(super.scrollLines(P,R,z),this.refresh(0,this.rows-1)):(W=this.viewport)==null||W.scrollLines(P)}paste(P){(0,h.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,R,z){this._selectionService.setSelection(P,R,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(){var P;(P=this._selectionService)==null||P.clearSelection()}selectAll(){var P;(P=this._selectionService)==null||P.selectAll()}selectLines(P,R){var z;(z=this._selectionService)==null||z.selectLines(P,R)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!R&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,F.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),z.type===3||z.type===2){const W=this.rows-1;return this.scrollLines(z.type===2?-W:W),this.cancel(P,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(z.cancel&&this.cancel(P,!0),!z.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==$.C0.ETX&&z.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,R){const z=P.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||P.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||P.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?z:z&&(!R.keyCode||R.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||(function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18}(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)R=P.charCode;else if(P.which===null||P.which===void 0)R=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;R=P.which}return!(!R||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=P.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(P),!0}return!1}resize(P,R){P!==this.cols||R!==this.rows?super.resize(P,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,R){var z,W;(z=this._charSizeService)==null||z.measure(),(W=this.viewport)==null||W.syncScrollArea(!0)}clear(){var P;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 R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(N.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(P=this.viewport)==null||P.reset(),this.refresh(0,this.rows-1)}}reset(){var R,z;this.options.rows=this.rows,this.options.cols=this.cols;const P=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)==null||R.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){var P;(P=this._renderService)==null||P.clearTextureAtlas()}_reportFocus(){var P;(P=this.element)!=null&&P.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case O.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${z};${R}t`);break;case O.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${G};${W}t`)}}cancel(P,R){if(this.options.cancelEvents||R)return P.preventDefault(),P.stopPropagation(),!1}}t.Terminal=Y},9924:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=r-this._lastRefreshMs,f=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},f)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(M,t,a){var h=this&&this.__decorate||function(n,i,s,d){var g,_=arguments.length,S=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,i,s,d);else for(var u=n.length-1;u>=0;u--)(g=n[u])&&(S=(_<3?g(S):_>3?g(i,s,S):g(i,s))||S);return _>3&&S&&Object.defineProperty(i,s,S),S},l=this&&this.__param||function(n,i){return function(s,d){i(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const r=a(3656),c=a(4725),f=a(8460),p=a(844),o=a(2585);let e=t.Viewport=class extends p.Disposable{constructor(n,i,s,d,g,_,S,u){super(),this._viewportElement=n,this._scrollArea=i,this._bufferService=s,this._optionsService=d,this._charSizeService=g,this._renderService=_,this._coreBrowserService=S,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 f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,r.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(v=>this._activeBuffer=v.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(v=>this._renderDimensions=v)),this._handleThemeChange(u.colors),this.register(u.onChangeColors(v=>this._handleThemeChange(v))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(n){this._viewportElement.style.backgroundColor=n.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(n){if(n)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;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){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});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<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(n,i){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&s<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const i=this._getPixelsScrolled(n);return i!==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+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=n*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(n,i){var u;let s,d="";const g=[],_=i??this._bufferService.buffer.lines.length,S=this._bufferService.buffer.lines;for(let v=n;v<_;v++){const C=S.get(v);if(!C)continue;const x=(u=S.get(v+1))==null?void 0:u.isWrapped;if(d+=C.translateToString(!x),!x||v===S.length-1){const w=document.createElement("div");w.textContent=d,g.push(w),d.length>0&&(s=w),d=""}}return{bufferElements:g,cursorElement:s}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(n,i){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&i.altKey||s==="ctrl"&&i.ctrlKey||s==="shift"&&i.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const i=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(M,t,a){var h=this&&this.__decorate||function(o,e,n,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,n,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,n,g):s(e,n))||g);return d>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(o,e){return function(n,i){e(n,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const r=a(4725),c=a(844),f=a(2585);let p=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,n,i,s){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=n,this._decorationService=i,this._renderService=s,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(d=>this._removeDecoration(d))),this.register((0,c.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(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=o==null?void 0:o.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const n=o.options.x??0;return n&&n>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let n=this._decorationElements.get(o);n||(n=this._createElement(o),o.element=n,this._decorationElements.set(o,n),this._container.appendChild(n),o.onDispose(()=>{this._decorationElements.delete(o),n.remove()})),n.style.top=e*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(n)}}_refreshXPosition(o,e=o.element){if(!e)return;const n=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=p=h([l(1,f.IBufferService),l(2,r.ICoreBrowserService),l(3,f.IDecorationService),l(4,r.IRenderService)],p)},5871:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.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(a){if(a.options.overviewRulerOptions){for(const h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(M,t,a){var h=this&&this.__decorate||function(s,d,g,_){var S,u=arguments.length,v=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,d,g,_);else for(var C=s.length-1;C>=0;C--)(S=s[C])&&(v=(u<3?S(v):u>3?S(d,g,v):S(d,g))||v);return u>3&&v&&Object.defineProperty(d,g,v),v},l=this&&this.__param||function(s,d){return function(g,_){d(g,_,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const r=a(5871),c=a(4725),f=a(844),p=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,g,_,S,u,v){var x;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=g,this._decorationService=_,this._renderService=S,this._optionsService=u,this._coreBrowserService=v,this._colorZoneStore=new r.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(),(x=this._viewportElement.parentElement)==null||x.insertBefore(this._canvas,this._viewportElement);const C=this._canvas.getContext("2d");if(!C)throw new Error("Ctx cannot be null");this._ctx=C,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,f.toDisposable)(()=>{var w;(w=this._canvas)==null||w.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(){const s=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=s,e.center=d,e.right=s,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=e.left,n.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);o.left=d,o.center=d,o.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.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(const d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(n[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-o[s.position||"full"]/2),e[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=i=h([l(2,p.IBufferService),l(3,p.IDecorationService),l(4,c.IRenderService),l(5,p.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(M,t,a){var h=this&&this.__decorate||function(o,e,n,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,n,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,n,g):s(e,n))||g);return d>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(o,e){return function(n,i){e(n,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const r=a(4725),c=a(2585),f=a(2584);let p=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,n,i,s,d){this._textarea=o,this._compositionView=e,this._bufferService=n,this._optionsService=i,this._coreService=s,this._renderService=d,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(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,n=e.replace(o,"");this._dataAlreadySent=n,e.length>o.length?this._coreService.triggerDataEvent(n,!0):e.length<o.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=p=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,r.IRenderService)],p)},9806:(M,t)=>{function a(h,l,r){const c=r.getBoundingClientRect(),f=h.getComputedStyle(r),p=parseInt(f.getPropertyValue("padding-left")),o=parseInt(f.getPropertyValue("padding-top"));return[l.clientX-c.left-p,l.clientY-c.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,r,c,f,p,o,e,n){if(!p)return;const i=a(h,l,r);return i?(i[0]=Math.ceil((i[0]+(n?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(n?1:0)),i[1]=Math.min(Math.max(i[1],1),f),i):void 0}},9504:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,n,i,s){const d=e-r(e,i),g=n-r(n,i),_=Math.abs(d-g)-function(S,u,v){let C=0;const x=S-r(S,v),w=u-r(u,v);for(let E=0;E<Math.abs(x-w);E++){const A=c(S,u)==="A"?-1:1,I=v.buffer.lines.get(x+A*E);I!=null&&I.isWrapped&&C++}return C}(e,n,i);return o(_,p(c(e,n),s))}function r(e,n){let i=0,s=n.buffer.lines.get(e),d=s==null?void 0:s.isWrapped;for(;d&&e>=0&&e<n.rows;)i++,s=n.buffer.lines.get(--e),d=s==null?void 0:s.isWrapped;return i}function c(e,n){return e>n?"A":"B"}function f(e,n,i,s,d,g){let _=e,S=n,u="";for(;_!==i||S!==s;)_+=d?1:-1,d&&_>g.cols-1?(u+=g.buffer.translateBufferLineToString(S,!1,e,_),_=0,e=0,S++):!d&&_<0&&(u+=g.buffer.translateBufferLineToString(S,!1,0,e+1),_=g.cols-1,e=_,S--);return u+g.buffer.translateBufferLineToString(S,!1,e,_)}function p(e,n){const i=n?"O":"[";return h.C0.ESC+i+e}function o(e,n){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=n;return i}t.moveToCellSequence=function(e,n,i,s){const d=i.buffer.x,g=i.buffer.y;if(!i.buffer.hasScrollback)return function(u,v,C,x,w,E){return l(v,x,w,E).length===0?"":o(f(u,v,u,v-r(v,w),!1,w).length,p("D",E))}(d,g,0,n,i,s)+l(g,n,i,s)+function(u,v,C,x,w,E){let A;A=l(v,x,w,E).length>0?x-r(x,w):v;const I=x,N=function($,F,b,k,T,O){let U;return U=l(b,k,T,O).length>0?k-r(k,T):F,$<b&&U<=k||$>=b&&U<k?"C":"D"}(u,v,C,x,w,E);return o(f(u,A,C,I,N==="C",w).length,p(N,E))}(d,g,e,n,i,s);let _;if(g===n)return _=d>e?"D":"C",o(Math.abs(d-e),p(_,s));_=g>n?"D":"C";const S=Math.abs(g-n);return o(function(u,v){return v.cols-u}(g>n?e:d,i)+(S-1)*i.cols+1+((g>n?d:e)-1),p(_,s))}},1296:function(M,t,a){var h=this&&this.__decorate||function(E,A,I,N){var $,F=arguments.length,b=F<3?A:N===null?N=Object.getOwnPropertyDescriptor(A,I):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(E,A,I,N);else for(var k=E.length-1;k>=0;k--)($=E[k])&&(b=(F<3?$(b):F>3?$(A,I,b):$(A,I))||b);return F>3&&b&&Object.defineProperty(A,I,b),b},l=this&&this.__param||function(E,A){return function(I,N){A(I,N,E)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const r=a(3787),c=a(2550),f=a(2223),p=a(6171),o=a(6052),e=a(4725),n=a(8055),i=a(8460),s=a(844),d=a(2585),g="xterm-dom-renderer-owner-",_="xterm-rows",S="xterm-fg-",u="xterm-bg-",v="xterm-focus",C="xterm-selection";let x=1,w=t.DomRenderer=class extends s.Disposable{constructor(E,A,I,N,$,F,b,k,T,O,U,q,Y){super(),this._terminal=E,this._document=A,this._element=I,this._screenElement=N,this._viewportElement=$,this._helperContainer=F,this._linkifier2=b,this._charSizeService=T,this._optionsService=O,this._bufferService=U,this._coreBrowserService=q,this._themeService=Y,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_),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(C),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(V=>this._injectCss(V))),this._injectCss(this._themeService.colors),this._rowFactory=k.createInstance(r.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(V=>this._handleLinkHover(V))),this.register(this._linkifier2.onHideLinkUnderline(V=>this._handleLinkLeave(V))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new c.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(){const E=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*E,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*E),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/E),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/E),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(const I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const A=`${this._terminalSelector} .${_} 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(E){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let A=`${this._terminalSelector} .${_} { color: ${E.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;A+=`${this._terminalSelector} .${_} .xterm-dim { color: ${n.color.multiplyOpacity(E.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;}`;const I=`blink_underline_${this._terminalClass}`,N=`blink_bar_${this._terminalClass}`,$=`blink_block_${this._terminalClass}`;A+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,A+=`@keyframes ${N} { 50% { box-shadow: none; }}`,A+=`@keyframes ${$} { 0% { background-color: ${E.cursor.css}; color: ${E.cursorAccent.css}; } 50% { background-color: inherit; color: ${E.cursor.css}; }}`,A+=`${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${E.cursor.css}; color: ${E.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${E.cursor.css} !important; color: ${E.cursorAccent.css} !important;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${E.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${E.cursor.css} inset;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${E.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,A+=`${this._terminalSelector} .${C} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${C} div { position: absolute; background-color: ${E.selectionBackgroundOpaque.css};}${this._terminalSelector} .${C} div { position: absolute; background-color: ${E.selectionInactiveBackgroundOpaque.css};}`;for(const[F,b]of E.ansi.entries())A+=`${this._terminalSelector} .${S}${F} { color: ${b.css}; }${this._terminalSelector} .${S}${F}.xterm-dim { color: ${n.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${u}${F} { background-color: ${b.css}; }`;A+=`${this._terminalSelector} .${S}${f.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(E.background).css}; }${this._terminalSelector} .${S}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(E.background),.5).css}; }${this._terminalSelector} .${u}${f.INVERTED_DEFAULT_COLOR} { background-color: ${E.foreground.css}; }`,this._themeStyleElement.textContent=A}_setDefaultSpacing(){const E=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${E}px`,this._rowFactory.defaultSpacing=E}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(E,A){for(let I=this._rowElements.length;I<=A;I++){const N=this._document.createElement("div");this._rowContainer.appendChild(N),this._rowElements.push(N)}for(;this._rowElements.length>A;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(E,A){this._refreshRowElements(E,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(v),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(v),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(E,A,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(E,A,I),this.renderRows(0,this._bufferService.rows-1),!E||!A)return;this._selectionRenderModel.update(this._terminal,E,A,I);const N=this._selectionRenderModel.viewportStartRow,$=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(F>=this._bufferService.rows||b<0)return;const k=this._document.createDocumentFragment();if(I){const T=E[0]>A[0];k.appendChild(this._createSelectionElement(F,T?A[0]:E[0],T?E[0]:A[0],b-F+1))}else{const T=N===F?E[0]:0,O=F===$?A[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(F,T,O));const U=b-F-1;if(k.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,U)),F!==b){const q=$===b?A[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(b,0,q))}}this._selectionContainer.appendChild(k)}_createSelectionElement(E,A,I,N=1){const $=this._document.createElement("div"),F=A*this.dimensions.css.cell.width;let b=this.dimensions.css.cell.width*(I-A);return F+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-F),$.style.height=N*this.dimensions.css.cell.height+"px",$.style.top=E*this.dimensions.css.cell.height+"px",$.style.left=`${F}px`,$.style.width=`${b}px`,$}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(const E of this._rowElements)E.replaceChildren()}renderRows(E,A){const I=this._bufferService.buffer,N=I.ybase+I.y,$=Math.min(I.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,k=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=E;T<=A;T++){const O=T+I.ydisp,U=this._rowElements[T],q=I.lines.get(O);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,O,O===N,b,k,$,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(E){this._setCellUnderline(E.x1,E.x2,E.y1,E.y2,E.cols,!0)}_handleLinkLeave(E){this._setCellUnderline(E.x1,E.x2,E.y1,E.y2,E.cols,!1)}_setCellUnderline(E,A,I,N,$,F){I<0&&(E=0),N<0&&(A=0);const b=this._bufferService.rows-1;I=Math.max(Math.min(I,b),0),N=Math.max(Math.min(N,b),0),$=Math.min($,this._bufferService.cols);const k=this._bufferService.buffer,T=k.ybase+k.y,O=Math.min(k.x,$-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let V=I;V<=N;++V){const P=V+k.ydisp,R=this._rowElements[V],z=k.lines.get(P);if(!R||!z)break;R.replaceChildren(...this._rowFactory.createRow(z,P,P===T,q,Y,O,U,this.dimensions.css.cell.width,this._widthCache,F?V===I?E:0:-1,F?(V===N?A:$)-1:-1))}}};t.DomRenderer=w=h([l(7,d.IInstantiationService),l(8,e.ICharSizeService),l(9,d.IOptionsService),l(10,d.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],w)},3787:function(M,t,a){var h=this&&this.__decorate||function(_,S,u,v){var C,x=arguments.length,w=x<3?S:v===null?v=Object.getOwnPropertyDescriptor(S,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(_,S,u,v);else for(var E=_.length-1;E>=0;E--)(C=_[E])&&(w=(x<3?C(w):x>3?C(S,u,w):C(S,u))||w);return x>3&&w&&Object.defineProperty(S,u,w),w},l=this&&this.__param||function(_,S){return function(u,v){S(u,v,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const r=a(2223),c=a(643),f=a(511),p=a(2585),o=a(8055),e=a(4725),n=a(4269),i=a(6171),s=a(3734);let d=t.DomRendererRowFactory=class{constructor(_,S,u,v,C,x,w){this._document=_,this._characterJoinerService=S,this._optionsService=u,this._coreBrowserService=v,this._coreService=C,this._decorationService=x,this._themeService=w,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(_,S,u){this._selectionStart=_,this._selectionEnd=S,this._columnSelectMode=u}createRow(_,S,u,v,C,x,w,E,A,I,N){const $=[],F=this._characterJoinerService.getJoinedCharacters(S),b=this._themeService.colors;let k,T=_.getNoBgTrimmedLength();u&&T<x+1&&(T=x+1);let O=0,U="",q=0,Y=0,V=0,P=!1,R=0,z=!1,W=0;const G=[],K=I!==-1&&N!==-1;for(let Q=0;Q<T;Q++){_.loadCell(Q,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let oe=!1,_e=Q,Z=this._workCell;if(F.length>0&&Q===F[0][0]){oe=!0;const ee=F.shift();Z=new n.JoinedCellData(this._workCell,_.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),_e=ee[1]-1,J=Z.getWidth()}const we=this._isCellInSelection(Q,S),Oe=u&&Q===x,ne=K&&Q>=I&&Q<=N;let te=!1;this._decorationService.forEachDecorationAtCell(Q,S,void 0,ee=>{te=!0});let ie=Z.getChars()||c.WHITESPACE_CELL_CHAR;if(ie===" "&&(Z.isUnderline()||Z.isOverline())&&(ie=" "),W=J*E-A.get(ie,Z.isBold(),Z.isItalic()),k){if(O&&(we&&z||!we&&!z&&Z.bg===q)&&(we&&z&&b.selectionForeground||Z.fg===Y)&&Z.extended.ext===V&&ne===P&&W===R&&!Oe&&!oe&&!te){Z.isInvisible()?U+=c.WHITESPACE_CELL_CHAR:U+=ie,O++;continue}O&&(k.textContent=U),k=this._document.createElement("span"),O=0,U=""}else k=this._document.createElement("span");if(q=Z.bg,Y=Z.fg,V=Z.extended.ext,P=ne,R=W,z=we,oe&&x>=Q&&x<=_e&&(x=Q),!this._coreService.isCursorHidden&&Oe&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)w&&G.push("xterm-cursor-blink"),G.push(v==="bar"?"xterm-cursor-bar":v==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(C)switch(C){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline")}}if(Z.isBold()&&G.push("xterm-bold"),Z.isItalic()&&G.push("xterm-italic"),Z.isDim()&&G.push("xterm-dim"),U=Z.isInvisible()?c.WHITESPACE_CELL_CHAR:Z.getChars()||c.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(G.push(`xterm-underline-${Z.extended.underlineStyle}`),U===" "&&(U=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ee=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ee<8&&(ee+=8),k.style.textDecorationColor=b.ansi[ee].css}Z.isOverline()&&(G.push("xterm-overline"),U===" "&&(U=" ")),Z.isStrikethrough()&&G.push("xterm-strikethrough"),ne&&(k.style.textDecoration="underline");let X=Z.getFgColor(),se=Z.getFgColorMode(),de=Z.getBgColor(),ce=Z.getBgColorMode();const Ee=!!Z.isInverse();if(Ee){const ee=X;X=de,de=ee;const $e=se;se=ce,ce=$e}let me,be,fe,he=!1;switch(this._decorationService.forEachDecorationAtCell(Q,S,void 0,ee=>{ee.options.layer!=="top"&&he||(ee.backgroundColorRGB&&(ce=50331648,de=ee.backgroundColorRGB.rgba>>8&16777215,me=ee.backgroundColorRGB),ee.foregroundColorRGB&&(se=50331648,X=ee.foregroundColorRGB.rgba>>8&16777215,be=ee.foregroundColorRGB),he=ee.options.layer==="top")}),!he&&we&&(me=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,de=me.rgba>>8&16777215,ce=50331648,he=!0,b.selectionForeground&&(se=50331648,X=b.selectionForeground.rgba>>8&16777215,be=b.selectionForeground)),he&&G.push("xterm-decoration-top"),ce){case 16777216:case 33554432:fe=b.ansi[de],G.push(`xterm-bg-${de}`);break;case 50331648:fe=o.channels.toColor(de>>16,de>>8&255,255&de),this._addStyle(k,`background-color:#${g((de>>>0).toString(16),"0",6)}`);break;default:Ee?(fe=b.foreground,G.push(`xterm-bg-${r.INVERTED_DEFAULT_COLOR}`)):fe=b.background}switch(me||Z.isDim()&&(me=o.color.multiplyOpacity(fe,.5)),se){case 16777216:case 33554432:Z.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(k,fe,b.ansi[X],Z,me,void 0)||G.push(`xterm-fg-${X}`);break;case 50331648:const ee=o.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(k,fe,ee,Z,me,be)||this._addStyle(k,`color:#${g(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,fe,b.foreground,Z,me,be)||Ee&&G.push(`xterm-fg-${r.INVERTED_DEFAULT_COLOR}`)}G.length&&(k.className=G.join(" "),G.length=0),Oe||oe||te?k.textContent=U:O++,W!==this.defaultSpacing&&(k.style.letterSpacing=`${W}px`),$.push(k),Q=_e}return k&&O&&(k.textContent=U),$}_applyMinimumContrast(_,S,u,v,C,x){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(v.getCode()))return!1;const w=this._getContrastCache(v);let E;if(C||x||(E=w.getColor(S.rgba,u.rgba)),E===void 0){const A=this._optionsService.rawOptions.minimumContrastRatio/(v.isDim()?2:1);E=o.color.ensureContrastRatio(C||S,x||u,A),w.setColor((C||S).rgba,(x||u).rgba,E??null)}return!!E&&(this._addStyle(_,`color:${E.css}`),!0)}_getContrastCache(_){return _.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(_,S){_.setAttribute("style",`${_.getAttribute("style")||""}${S};`)}_isCellInSelection(_,S){const u=this._selectionStart,v=this._selectionEnd;return!(!u||!v)&&(this._columnSelectMode?u[0]<=v[0]?_>=u[0]&&S>=u[1]&&_<v[0]&&S<=v[1]:_<u[0]&&S>=u[1]&&_>=v[0]&&S<=v[1]:S>u[1]&&S<v[1]||u[1]===v[1]&&S===u[1]&&_>=u[0]&&_<v[0]||u[1]<v[1]&&S===v[1]&&_<v[0]||u[1]<v[1]&&S===u[1]&&_>=u[0])}};function g(_,S,u){for(;_.length<u;)_=S+_;return _}t.DomRendererRowFactory=d=h([l(1,e.ICharacterJoinerService),l(2,p.IOptionsService),l(3,e.ICoreBrowserService),l(4,p.ICoreService),l(5,p.IDecorationService),l(6,e.IThemeService)],d)},2550:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.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";const l=a.createElement("span");l.classList.add("xterm-char-measure-element");const r=a.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const f=a.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[l,r,c,f],this._container.appendChild(l),this._container.appendChild(r),this._container.appendChild(c),this._container.appendChild(f),h.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(a,h,l,r){a===this._font&&h===this._fontSize&&l===this._weight&&r===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(a,h,l){let r=0;if(!h&&!l&&a.length===1&&(r=a.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];const p=this._measure(a,0);return p>0&&(this._flat[r]=p),p}let c=a;h&&(c+="B"),l&&(c+="I");let f=this._holey.get(c);if(f===void 0){let p=0;h&&(p|=1),l&&(p|=2),f=this._measure(a,p),f>0&&this._holey.set(c,f)}return f}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,r,c,f){return r===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(p){return 57344<=p&&p<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(r){return 9472<=r&&r<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,r,c=0){return(l-(2*Math.round(r)-c))%(2*Math.round(r))}},6052:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{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(l,r,c,f=!1){if(this.selectionStart=r,this.selectionEnd=c,!r||!c||r[0]===c[0]&&r[1]===c[1])return void this.clear();const p=l.buffers.active.ydisp,o=r[1]-p,e=c[1]-p,n=Math.max(o,0),i=Math.min(e,l.rows-1);n>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=r[0],this.endCol=c[0])}isCellSelected(l,r,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&c>=this.viewportCappedStartRow&&r<this.endCol&&c<=this.viewportCappedEndRow:r<this.startCol&&c>=this.viewportCappedStartRow&&r>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&r>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(a){this._bufferService=a,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()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,h=this.selectionEnd;return!(!a||!h)&&(a[1]>h[1]||a[1]===h[1]&&a[0]>h[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(M,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,S=arguments.length,u=S<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(S<3?_(u):S>3?_(s,d,u):_(s,d))||u);return S>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const r=a(2585),c=a(8460),f=a(844);let p=t.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,s,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=p=h([l(2,r.IOptionsService)],p);class o extends f.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class e extends o{constructor(s,d,g){super(),this._document=s,this._parentElement=d,this._optionsService=g,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 n extends o{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(M,t,a){var h=this&&this.__decorate||function(n,i,s,d){var g,_=arguments.length,S=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,i,s,d);else for(var u=n.length-1;u>=0;u--)(g=n[u])&&(S=(_<3?g(S):_>3?g(i,s,S):g(i,s))||S);return _>3&&S&&Object.defineProperty(i,s,S),S},l=this&&this.__param||function(n,i){return function(s,d){i(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const r=a(3734),c=a(643),f=a(511),p=a(2585);class o extends r.AttributeData{constructor(i,s,d){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=s,this._width=d}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class si{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(i){const s={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(s),s.id}deregister(i){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===i)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(i);if(!s||s.length===0)return[];const d=[],g=s.translateToString(!0);let _=0,S=0,u=0,v=s.getFg(0),C=s.getBg(0);for(let x=0;x<s.getTrimmedLength();x++)if(s.loadCell(x,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==v||this._workCell.bg!==C){if(x-_>1){const w=this._getJoinedRanges(g,u,S,s,_);for(let E=0;E<w.length;E++)d.push(w[E])}_=x,u=S,v=this._workCell.fg,C=this._workCell.bg}S+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-_>1){const x=this._getJoinedRanges(g,u,S,s,_);for(let w=0;w<x.length;w++)d.push(x[w])}return d}_getJoinedRanges(i,s,d,g,_){const S=i.substring(s,d);let u=[];try{u=this._characterJoiners[0].handler(S)}catch(v){console.error(v)}for(let v=1;v<this._characterJoiners.length;v++)try{const C=this._characterJoiners[v].handler(S);for(let x=0;x<C.length;x++)si._mergeRanges(u,C[x])}catch(C){console.error(C)}return this._stringRangesToCellRanges(u,g,_),u}_stringRangesToCellRanges(i,s,d){let g=0,_=!1,S=0,u=i[g];if(u){for(let v=d;v<this._bufferService.cols;v++){const C=s.getWidth(v),x=s.getString(v).length||c.WHITESPACE_CELL_CHAR.length;if(C!==0){if(!_&&u[0]<=S&&(u[0]=v,_=!0),u[1]<=S){if(u[1]=v,u=i[++g],!u)break;u[0]<=S?(u[0]=v,_=!0):_=!1}S+=x}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(i,s){let d=!1;for(let g=0;g<i.length;g++){const _=i[g];if(d){if(s[1]<=_[0])return i[g-1][1]=s[1],i;if(s[1]<=_[1])return i[g-1][1]=Math.max(s[1],_[1]),i.splice(g,1),i;i.splice(g,1),g--}else{if(s[1]<=_[0])return i.splice(g,0,s),i;if(s[1]<=_[1])return _[0]=Math.min(s[0],_[0]),i;s[0]<_[1]&&(_[0]=Math.min(s[0],_[0]),d=!0)}}return d?i[i.length-1][1]=s[1]:i.push(s),i}};t.CharacterJoinerService=e=h([l(0,p.IBufferService)],e)},5114:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),r=a(3656);class c extends h.Disposable{constructor(o,e,n){super(),this._textarea=o,this._window=e,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,l.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(o){this._window!==o&&(this._window=o,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}}t.CoreBrowserService=c;class f extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,r.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.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:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const f=this.linkProviders.indexOf(c);f!==-1&&this.linkProviders.splice(f,1)}}}}t.LinkProviderService=l},8934:function(M,t,a){var h=this&&this.__decorate||function(p,o,e,n){var i,s=arguments.length,d=s<3?o:n===null?n=Object.getOwnPropertyDescriptor(o,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(p,o,e,n);else for(var g=p.length-1;g>=0;g--)(i=p[g])&&(d=(s<3?i(d):s>3?i(o,e,d):i(o,e))||d);return s>3&&d&&Object.defineProperty(o,e,d),d},l=this&&this.__param||function(p,o){return function(e,n){o(e,n,p)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const r=a(4725),c=a(9806);let f=t.MouseService=class{constructor(p,o){this._renderService=p,this._charSizeService=o}getCoords(p,o,e,n,i){return(0,c.getCoords)(window,p,o,e,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(p,o){const e=(0,c.getCoordsRelativeToElement)(window,p,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=f=h([l(0,r.IRenderService),l(1,r.ICharSizeService)],f)},3230:function(M,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,S=arguments.length,u=S<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(S<3?_(u):S>3?_(s,d,u):_(s,d))||u);return S>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const r=a(6193),c=a(4725),f=a(8460),p=a(844),o=a(7226),e=a(2585);let n=t.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,s,d,g,_,S,u,v){super(),this._rowCount=i,this._charSizeService=g,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new p.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 f.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new f.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new f.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new f.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new r.RenderDebouncer((C,x)=>this._renderRows(C,x),u),this.register(this._renderDebouncer),this.register(u.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(S.onResize(()=>this._fullRefresh())),this.register(S.buffers.onBufferActivate(()=>{var C;return(C=this._renderer.value)==null?void 0:C.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(_.onDecorationRegistered(()=>this._fullRefresh())),this.register(_.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(S.cols,S.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(S.buffer.y,S.buffer.y,!0))),this.register(v.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(u.window,s),this.register(u.onWindowChange(C=>this._registerIntersectionObserver(C,s)))}_registerIntersectionObserver(i,s){if("IntersectionObserver"in i){const d=new i.IntersectionObserver(g=>this._handleIntersectionChange(g[g.length-1]),{threshold:0});d.observe(s),this._observerDisposable.value=(0,p.toDisposable)(()=>d.disconnect())}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.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(i,s,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,s,this._rowCount))}_renderRows(i,s){this._renderer.value&&(i=Math.min(i,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(i,s),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:s}),this._onRender.fire({start:i,end:s}),this._isNextRenderRedrawOnly=!0)}resize(i,s){this._rowCount=s,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(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw(s=>this.refreshRows(s.start,s.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,s;this._renderer.value&&((s=(i=this._renderer.value).clearTextureAtlas)==null||s.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(i,s)}):this._renderer.value.handleResize(i,s),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,s,d){var g;this._selectionState.start=i,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(g=this._renderer.value)==null||g.handleSelectionChanged(i,s,d)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=n=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],n)},9312:function(M,t,a){var h=this&&this.__decorate||function(u,v,C,x){var w,E=arguments.length,A=E<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,C):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,v,C,x);else for(var I=u.length-1;I>=0;I--)(w=u[I])&&(A=(E<3?w(A):E>3?w(v,C,A):w(v,C))||A);return E>3&&A&&Object.defineProperty(v,C,A),A},l=this&&this.__param||function(u,v){return function(C,x){v(C,x,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const r=a(9806),c=a(9504),f=a(456),p=a(4725),o=a(8460),e=a(844),n=a(6114),i=a(4841),s=a(511),d=a(2585),g=" ",_=new RegExp(g,"g");let S=t.SelectionService=class extends e.Disposable{constructor(u,v,C,x,w,E,A,I,N){super(),this._element=u,this._screenElement=v,this._linkifier=C,this._bufferService=x,this._coreService=w,this._mouseService=E,this._optionsService=A,this._renderService=I,this._coreBrowserService=N,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.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(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;return!(!u||!v||u[0]===v[0]&&u[1]===v[1])}get selectionText(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;if(!u||!v)return"";const C=this._bufferService.buffer,x=[];if(this._activeSelectionMode===3){if(u[0]===v[0])return"";const w=u[0]<v[0]?u[0]:v[0],E=u[0]<v[0]?v[0]:u[0];for(let A=u[1];A<=v[1];A++){const I=C.translateBufferLineToString(A,!0,w,E);x.push(I)}}else{const w=u[1]===v[1]?v[0]:void 0;x.push(C.translateBufferLineToString(u[1],!0,u[0],w));for(let E=u[1]+1;E<=v[1]-1;E++){const A=C.lines.get(E),I=C.translateBufferLineToString(E,!0);A!=null&&A.isWrapped?x[x.length-1]+=I:x.push(I)}if(u[1]!==v[1]){const E=C.lines.get(v[1]),A=C.translateBufferLineToString(v[1],!0,0,v[0]);E&&E.isWrapped?x[x.length-1]+=A:x.push(A)}}return x.map(w=>w.replace(_," ")).join(n.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=f=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],f)},6193:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(o,h){this._renderCallback=o,this._coreBrowserService=h,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,h,l){this._rowCount=l,o=o!==void 0?o:0,h=h!==void 0?h: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,h):h,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();const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=o(3614),l=o(3656),s=o(3551),c=o(9042),f=o(3730),p=o(1680),a=o(3107),e=o(5744),n=o(2950),i=o(1296),r=o(428),d=o(4269),g=o(5114),_=o(8934),S=o(3230),u=o(9312),v=o(4725),C=o(6731),x=o(8055),y=o(8969),L=o(8460),A=o(844),I=o(6114),N=o(8437),$=o(2584),F=o(7399),b=o(5941),k=o(9074),T=o(2585),O=o(5435),U=o(4567),q=o(779);class Y extends y.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(P={}){super(P),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new A.MutableDisposable),this._onCursorMove=this.register(new L.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new L.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new L.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new L.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new L.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new L.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new L.EventEmitter),this._onBlur=this.register(new L.EventEmitter),this._onA11yCharEmitter=this.register(new L.EventEmitter),this._onA11yTabEmitter=this.register(new L.EventEmitter),this._onWillOpen=this.register(new L.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(k.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((R,z)=>this.refresh(R,z))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(R=>this._reportWindowsOptions(R))),this.register(this._inputHandler.onColor(R=>this._handleColorEvent(R))),this.register((0,L.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,L.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,L.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,L.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(R=>this._afterResize(R.cols,R.rows))),this.register((0,A.toDisposable)(()=>{var R,z;this._customKeyEventHandler=void 0,(z=(R=this.element)==null?void 0:R.parentNode)==null||z.removeChild(this.element)}))}_handleColorEvent(P){if(this._themeService)for(const R of P){let z,W="";switch(R.index){case 256:z="foreground",W="10";break;case 257:z="background",W="11";break;case 258:z="cursor",W="12";break;default:z="ansi",W="4;"+R.index}switch(R.type){case 0:const G=x.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${W};${(0,b.toRgbString)(G)}${$.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors(K=>K.ansi[R.index]=x.channels.toColor(...R.color));else{const K=z;this._themeService.modifyColors(Q=>Q[K]=x.channels.toColor(...R.color))}break;case 2:this._themeService.restoreColor(R.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var P;return(P=this.textarea)==null?void 0:P.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const P=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(P);if(!R)return;const z=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,G=R.getWidth(z),K=this._renderService.dimensions.css.cell.width*G,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,J=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=J+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=K+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",R=>{this.hasSelection()&&(0,h.copyHandler)(R,this._selectionService)}));const P=R=>(0,h.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,l.addDisposableDomListener)(this.element,"paste",P)),I.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",R=>{R.button===2&&(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",R=>{(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",R=>{R.button===1&&(0,h.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",P=>this._keyUp(P),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",P=>this._keyDown(P),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",P=>this._keyPress(P),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",P=>this._compositionHelper.compositionupdate(P))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,l.addDisposableDomListener)(this.textarea,"input",P=>this._inputEvent(P),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(P){var z;if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((z=this.element)==null?void 0:z.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.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"),P.appendChild(this.element);const R=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.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,l.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),R.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),I.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(g.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,l.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(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(C.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(S.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(_.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(R);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(a.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const P=this,R=this.element;function z(K){const Q=P._mouseService.getMouseReportCoords(K,P.screenElement);if(!Q)return!1;let J,oe;switch(K.overrideType||K.type){case"mousemove":oe=32,K.buttons===void 0?(J=3,K.button!==void 0&&(J=K.button<3?K.button:3)):J=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":oe=0,J=K.button<3?K.button:3;break;case"mousedown":oe=1,J=K.button<3?K.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(K)===!1||P.viewport.getLinesScrolled(K)===0)return!1;oe=K.deltaY<0?0:1,J=4;break;default:return!1}return!(oe===void 0||J===void 0||J>4)&&P.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:J,action:oe,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:K=>(z(K),K.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(K)),wheel:K=>(z(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&z(K)},mousemove:K=>{K.buttons||z(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),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&K?W.mousemove||(R.addEventListener("mousemove",G.mousemove),W.mousemove=G.mousemove):(R.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&K?W.wheel||(R.addEventListener("wheel",G.wheel,{passive:!1}),W.wheel=G.wheel):(R.removeEventListener("wheel",W.wheel),W.wheel=null),2&K?W.mouseup||(W.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&K?W.mousedrag||(W.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(R,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return z(K),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(K)})),this.register((0,l.addDisposableDomListener)(R,"wheel",K=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const Q=this.viewport.getLinesScrolled(K);if(Q===0)return;const J=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let oe="";for(let _e=0;_e<Math.abs(Q);_e++)oe+=J;return this.coreService.triggerDataEvent(oe,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(R,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,l.addDisposableDomListener)(R,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(P,R){var z;(z=this._renderService)==null||z.refreshRows(P,R)}updateCursorStyle(P){var R;(R=this._selectionService)!=null&&R.shouldColumnSelect(P)?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(P,R,z=0){var W;z===1?(super.scrollLines(P,R,z),this.refresh(0,this.rows-1)):(W=this.viewport)==null||W.scrollLines(P)}paste(P){(0,h.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,R,z){this._selectionService.setSelection(P,R,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(){var P;(P=this._selectionService)==null||P.clearSelection()}selectAll(){var P;(P=this._selectionService)==null||P.selectAll()}selectLines(P,R){var z;(z=this._selectionService)==null||z.selectLines(P,R)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!R&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,F.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),z.type===3||z.type===2){const W=this.rows-1;return this.scrollLines(z.type===2?-W:W),this.cancel(P,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(z.cancel&&this.cancel(P,!0),!z.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==$.C0.ETX&&z.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,R){const z=P.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||P.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||P.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?z:z&&(!R.keyCode||R.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||(function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18}(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)R=P.charCode;else if(P.which===null||P.which===void 0)R=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;R=P.which}return!(!R||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=P.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(P),!0}return!1}resize(P,R){P!==this.cols||R!==this.rows?super.resize(P,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,R){var z,W;(z=this._charSizeService)==null||z.measure(),(W=this.viewport)==null||W.syncScrollArea(!0)}clear(){var P;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 R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(N.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(P=this.viewport)==null||P.reset(),this.refresh(0,this.rows-1)}}reset(){var R,z;this.options.rows=this.rows,this.options.cols=this.cols;const P=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)==null||R.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){var P;(P=this._renderService)==null||P.clearTextureAtlas()}_reportFocus(){var P;(P=this.element)!=null&&P.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case O.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${z};${R}t`);break;case O.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${G};${W}t`)}}cancel(P,R){if(this.options.cancelEvents||R)return P.preventDefault(),P.stopPropagation(),!1}}t.Terminal=Y},9924:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(o,h=1e3){this._renderCallback=o,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,h,l){this._rowCount=l,o=o!==void 0?o:0,h=h!==void 0?h: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,h):h;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=s-this._lastRefreshMs,f=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},f)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h)}}},1680:function(M,t,o){var h=this&&this.__decorate||function(n,i,r,d){var g,_=arguments.length,S=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,r):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,i,r,d);else for(var u=n.length-1;u>=0;u--)(g=n[u])&&(S=(_<3?g(S):_>3?g(i,r,S):g(i,r))||S);return _>3&&S&&Object.defineProperty(i,r,S),S},l=this&&this.__param||function(n,i){return function(r,d){i(r,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=o(3656),c=o(4725),f=o(8460),p=o(844),a=o(2585);let e=t.Viewport=class extends p.Disposable{constructor(n,i,r,d,g,_,S,u){super(),this._viewportElement=n,this._scrollArea=i,this._bufferService=r,this._optionsService=d,this._charSizeService=g,this._renderService=_,this._coreBrowserService=S,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 f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(v=>this._activeBuffer=v.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(v=>this._renderDimensions=v)),this._handleThemeChange(u.colors),this.register(u.onChangeColors(v=>this._handleThemeChange(v))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(n){this._viewportElement.style.backgroundColor=n.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(n){if(n)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;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){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});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<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(n,i){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&r<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const i=this._getPixelsScrolled(n);return i!==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+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=n*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(n,i){var u;let r,d="";const g=[],_=i??this._bufferService.buffer.lines.length,S=this._bufferService.buffer.lines;for(let v=n;v<_;v++){const C=S.get(v);if(!C)continue;const x=(u=S.get(v+1))==null?void 0:u.isWrapped;if(d+=C.translateToString(!x),!x||v===S.length-1){const y=document.createElement("div");y.textContent=d,g.push(y),d.length>0&&(r=y),d=""}}return{bufferElements:g,cursorElement:r}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(n,i){const r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&i.altKey||r==="ctrl"&&i.ctrlKey||r==="shift"&&i.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const i=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}};t.Viewport=e=h([l(2,a.IBufferService),l(3,a.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(M,t,o){var h=this&&this.__decorate||function(a,e,n,i){var r,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(a,e,n,i);else for(var _=a.length-1;_>=0;_--)(r=a[_])&&(g=(d<3?r(g):d>3?r(e,n,g):r(e,n))||g);return d>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(a,e){return function(n,i){e(n,i,a)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const s=o(4725),c=o(844),f=o(2585);let p=t.BufferDecorationRenderer=class extends c.Disposable{constructor(a,e,n,i,r){super(),this._screenElement=a,this._bufferService=e,this._coreBrowserService=n,this._decorationService=i,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(d=>this._removeDecoration(d))),this.register((0,c.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(const a of this._decorationService.decorations)this._renderDecoration(a);this._dimensionsChanged=!1}_renderDecoration(a){this._refreshStyle(a),this._dimensionsChanged&&this._refreshXPosition(a)}_createElement(a){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=a==null?void 0:a.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((a.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(a.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(a.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const n=a.options.x??0;return n&&n>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(a,e),e}_refreshStyle(a){const e=a.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)a.element&&(a.element.style.display="none",a.onRenderEmitter.fire(a.element));else{let n=this._decorationElements.get(a);n||(n=this._createElement(a),a.element=n,this._decorationElements.set(a,n),this._container.appendChild(n),a.onDispose(()=>{this._decorationElements.delete(a),n.remove()})),n.style.top=e*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",a.onRenderEmitter.fire(n)}}_refreshXPosition(a,e=a.element){if(!e)return;const n=a.options.x??0;(a.options.anchor||"left")==="right"?e.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(a){var e;(e=this._decorationElements.get(a))==null||e.remove(),this._decorationElements.delete(a),a.dispose()}};t.BufferDecorationRenderer=p=h([l(1,f.IBufferService),l(2,s.ICoreBrowserService),l(3,f.IDecorationService),l(4,s.IRenderService)],p)},5871:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.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(const h of this._zones)if(h.color===o.options.overviewRulerOptions.color&&h.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,o.marker.line))return;if(this._lineAdjacentToZone(h,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(h,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,h){return h>=o.startBufferLine&&h<=o.endBufferLine}_lineAdjacentToZone(o,h,l){return h>=o.startBufferLine-this._linePadding[l||"full"]&&h<=o.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(o,h){o.startBufferLine=Math.min(o.startBufferLine,h),o.endBufferLine=Math.max(o.endBufferLine,h)}}},5744:function(M,t,o){var h=this&&this.__decorate||function(r,d,g,_){var S,u=arguments.length,v=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(r,d,g,_);else for(var C=r.length-1;C>=0;C--)(S=r[C])&&(v=(u<3?S(v):u>3?S(d,g,v):S(d,g))||v);return u>3&&v&&Object.defineProperty(d,g,v),v},l=this&&this.__param||function(r,d){return function(g,_){d(g,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const s=o(5871),c=o(4725),f=o(844),p=o(2585),a={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,d,g,_,S,u,v){var x;super(),this._viewportElement=r,this._screenElement=d,this._bufferService=g,this._decorationService=_,this._renderService=S,this._optionsService=u,this._coreBrowserService=v,this._colorZoneStore=new s.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(),(x=this._viewportElement.parentElement)==null||x.insertBefore(this._canvas,this._viewportElement);const C=this._canvas.getContext("2d");if(!C)throw new Error("Ctx cannot be null");this._ctx=C,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,f.toDisposable)(()=>{var y;(y=this._canvas)==null||y.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(){const r=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=r,e.center=d,e.right=r,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=e.left,n.right=e.left+e.center}_refreshDrawHeightConstants(){a.full=Math.round(2*this._coreBrowserService.dpr);const r=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);a.left=d,a.center=d,a.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.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(const d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const r=this._colorZoneStore.zones;for(const d of r)d.position!=="full"&&this._renderColorZone(d);for(const d of r)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(n[r.position||"full"],Math.round((this._canvas.height-1)*(r.startBufferLine/this._bufferService.buffers.active.lines.length)-a[r.position||"full"]/2),e[r.position||"full"],Math.round((this._canvas.height-1)*((r.endBufferLine-r.startBufferLine)/this._bufferService.buffers.active.lines.length)+a[r.position||"full"]))}_queueRefresh(r,d){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=i=h([l(2,p.IBufferService),l(3,p.IDecorationService),l(4,c.IRenderService),l(5,p.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(M,t,o){var h=this&&this.__decorate||function(a,e,n,i){var r,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(a,e,n,i);else for(var _=a.length-1;_>=0;_--)(r=a[_])&&(g=(d<3?r(g):d>3?r(e,n,g):r(e,n))||g);return d>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(a,e){return function(n,i){e(n,i,a)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const s=o(4725),c=o(2585),f=o(2584);let p=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(a,e,n,i,r,d){this._textarea=a,this._compositionView=e,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=d,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(a){this._compositionView.textContent=a.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(a){if(this._isComposing||this._isSendingComposition){if(a.keyCode===229||a.keyCode===16||a.keyCode===17||a.keyCode===18)return!1;this._finalizeComposition(!1)}return a.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(a){if(this._compositionView.classList.remove("active"),this._isComposing=!1,a){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const a=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,n=e.replace(a,"");this._dataAlreadySent=n,e.length>a.length?this._coreService.triggerDataEvent(n,!0):e.length<a.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):e.length===a.length&&e!==a&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(a){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}a||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=p=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,s.IRenderService)],p)},9806:(M,t)=>{function o(h,l,s){const c=s.getBoundingClientRect(),f=h.getComputedStyle(s),p=parseInt(f.getPropertyValue("padding-left")),a=parseInt(f.getPropertyValue("padding-top"));return[l.clientX-c.left-p,l.clientY-c.top-a]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=o,t.getCoords=function(h,l,s,c,f,p,a,e,n){if(!p)return;const i=o(h,l,s);return i?(i[0]=Math.ceil((i[0]+(n?a/2:0))/a),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(n?1:0)),i[1]=Math.min(Math.max(i[1],1),f),i):void 0}},9504:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=o(2584);function l(e,n,i,r){const d=e-s(e,i),g=n-s(n,i),_=Math.abs(d-g)-function(S,u,v){let C=0;const x=S-s(S,v),y=u-s(u,v);for(let L=0;L<Math.abs(x-y);L++){const A=c(S,u)==="A"?-1:1,I=v.buffer.lines.get(x+A*L);I!=null&&I.isWrapped&&C++}return C}(e,n,i);return a(_,p(c(e,n),r))}function s(e,n){let i=0,r=n.buffer.lines.get(e),d=r==null?void 0:r.isWrapped;for(;d&&e>=0&&e<n.rows;)i++,r=n.buffer.lines.get(--e),d=r==null?void 0:r.isWrapped;return i}function c(e,n){return e>n?"A":"B"}function f(e,n,i,r,d,g){let _=e,S=n,u="";for(;_!==i||S!==r;)_+=d?1:-1,d&&_>g.cols-1?(u+=g.buffer.translateBufferLineToString(S,!1,e,_),_=0,e=0,S++):!d&&_<0&&(u+=g.buffer.translateBufferLineToString(S,!1,0,e+1),_=g.cols-1,e=_,S--);return u+g.buffer.translateBufferLineToString(S,!1,e,_)}function p(e,n){const i=n?"O":"[";return h.C0.ESC+i+e}function a(e,n){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=n;return i}t.moveToCellSequence=function(e,n,i,r){const d=i.buffer.x,g=i.buffer.y;if(!i.buffer.hasScrollback)return function(u,v,C,x,y,L){return l(v,x,y,L).length===0?"":a(f(u,v,u,v-s(v,y),!1,y).length,p("D",L))}(d,g,0,n,i,r)+l(g,n,i,r)+function(u,v,C,x,y,L){let A;A=l(v,x,y,L).length>0?x-s(x,y):v;const I=x,N=function($,F,b,k,T,O){let U;return U=l(b,k,T,O).length>0?k-s(k,T):F,$<b&&U<=k||$>=b&&U<k?"C":"D"}(u,v,C,x,y,L);return a(f(u,A,C,I,N==="C",y).length,p(N,L))}(d,g,e,n,i,r);let _;if(g===n)return _=d>e?"D":"C",a(Math.abs(d-e),p(_,r));_=g>n?"D":"C";const S=Math.abs(g-n);return a(function(u,v){return v.cols-u}(g>n?e:d,i)+(S-1)*i.cols+1+((g>n?d:e)-1),p(_,r))}},1296:function(M,t,o){var h=this&&this.__decorate||function(L,A,I,N){var $,F=arguments.length,b=F<3?A:N===null?N=Object.getOwnPropertyDescriptor(A,I):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(L,A,I,N);else for(var k=L.length-1;k>=0;k--)($=L[k])&&(b=(F<3?$(b):F>3?$(A,I,b):$(A,I))||b);return F>3&&b&&Object.defineProperty(A,I,b),b},l=this&&this.__param||function(L,A){return function(I,N){A(I,N,L)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=o(3787),c=o(2550),f=o(2223),p=o(6171),a=o(6052),e=o(4725),n=o(8055),i=o(8460),r=o(844),d=o(2585),g="xterm-dom-renderer-owner-",_="xterm-rows",S="xterm-fg-",u="xterm-bg-",v="xterm-focus",C="xterm-selection";let x=1,y=t.DomRenderer=class extends r.Disposable{constructor(L,A,I,N,$,F,b,k,T,O,U,q,Y){super(),this._terminal=L,this._document=A,this._element=I,this._screenElement=N,this._viewportElement=$,this._helperContainer=F,this._linkifier2=b,this._charSizeService=T,this._optionsService=O,this._bufferService=U,this._coreBrowserService=q,this._themeService=Y,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,a.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_),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(C),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(V=>this._injectCss(V))),this._injectCss(this._themeService.colors),this._rowFactory=k.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(V=>this._handleLinkHover(V))),this.register(this._linkifier2.onHideLinkUnderline(V=>this._handleLinkLeave(V))),this.register((0,r.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new c.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(){const L=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*L,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*L),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/L),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/L),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(const I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const A=`${this._terminalSelector} .${_} 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(L){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let A=`${this._terminalSelector} .${_} { color: ${L.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;A+=`${this._terminalSelector} .${_} .xterm-dim { color: ${n.color.multiplyOpacity(L.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;}`;const I=`blink_underline_${this._terminalClass}`,N=`blink_bar_${this._terminalClass}`,$=`blink_block_${this._terminalClass}`;A+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,A+=`@keyframes ${N} { 50% { box-shadow: none; }}`,A+=`@keyframes ${$} { 0% { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css}; } 50% { background-color: inherit; color: ${L.cursor.css}; }}`,A+=`${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${L.cursor.css} !important; color: ${L.cursorAccent.css} !important;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${L.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${L.cursor.css} inset;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${L.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,A+=`${this._terminalSelector} .${C} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${C} div { position: absolute; background-color: ${L.selectionBackgroundOpaque.css};}${this._terminalSelector} .${C} div { position: absolute; background-color: ${L.selectionInactiveBackgroundOpaque.css};}`;for(const[F,b]of L.ansi.entries())A+=`${this._terminalSelector} .${S}${F} { color: ${b.css}; }${this._terminalSelector} .${S}${F}.xterm-dim { color: ${n.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${u}${F} { background-color: ${b.css}; }`;A+=`${this._terminalSelector} .${S}${f.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(L.background).css}; }${this._terminalSelector} .${S}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(L.background),.5).css}; }${this._terminalSelector} .${u}${f.INVERTED_DEFAULT_COLOR} { background-color: ${L.foreground.css}; }`,this._themeStyleElement.textContent=A}_setDefaultSpacing(){const L=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${L}px`,this._rowFactory.defaultSpacing=L}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(L,A){for(let I=this._rowElements.length;I<=A;I++){const N=this._document.createElement("div");this._rowContainer.appendChild(N),this._rowElements.push(N)}for(;this._rowElements.length>A;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(L,A){this._refreshRowElements(L,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(v),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(v),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(L,A,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(L,A,I),this.renderRows(0,this._bufferService.rows-1),!L||!A)return;this._selectionRenderModel.update(this._terminal,L,A,I);const N=this._selectionRenderModel.viewportStartRow,$=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(F>=this._bufferService.rows||b<0)return;const k=this._document.createDocumentFragment();if(I){const T=L[0]>A[0];k.appendChild(this._createSelectionElement(F,T?A[0]:L[0],T?L[0]:A[0],b-F+1))}else{const T=N===F?L[0]:0,O=F===$?A[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(F,T,O));const U=b-F-1;if(k.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,U)),F!==b){const q=$===b?A[0]:this._bufferService.cols;k.appendChild(this._createSelectionElement(b,0,q))}}this._selectionContainer.appendChild(k)}_createSelectionElement(L,A,I,N=1){const $=this._document.createElement("div"),F=A*this.dimensions.css.cell.width;let b=this.dimensions.css.cell.width*(I-A);return F+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-F),$.style.height=N*this.dimensions.css.cell.height+"px",$.style.top=L*this.dimensions.css.cell.height+"px",$.style.left=`${F}px`,$.style.width=`${b}px`,$}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(const L of this._rowElements)L.replaceChildren()}renderRows(L,A){const I=this._bufferService.buffer,N=I.ybase+I.y,$=Math.min(I.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,k=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=L;T<=A;T++){const O=T+I.ydisp,U=this._rowElements[T],q=I.lines.get(O);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,O,O===N,b,k,$,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)}_handleLinkLeave(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)}_setCellUnderline(L,A,I,N,$,F){I<0&&(L=0),N<0&&(A=0);const b=this._bufferService.rows-1;I=Math.max(Math.min(I,b),0),N=Math.max(Math.min(N,b),0),$=Math.min($,this._bufferService.cols);const k=this._bufferService.buffer,T=k.ybase+k.y,O=Math.min(k.x,$-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let V=I;V<=N;++V){const P=V+k.ydisp,R=this._rowElements[V],z=k.lines.get(P);if(!R||!z)break;R.replaceChildren(...this._rowFactory.createRow(z,P,P===T,q,Y,O,U,this.dimensions.css.cell.width,this._widthCache,F?V===I?L:0:-1,F?(V===N?A:$)-1:-1))}}};t.DomRenderer=y=h([l(7,d.IInstantiationService),l(8,e.ICharSizeService),l(9,d.IOptionsService),l(10,d.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],y)},3787:function(M,t,o){var h=this&&this.__decorate||function(_,S,u,v){var C,x=arguments.length,y=x<3?S:v===null?v=Object.getOwnPropertyDescriptor(S,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(_,S,u,v);else for(var L=_.length-1;L>=0;L--)(C=_[L])&&(y=(x<3?C(y):x>3?C(S,u,y):C(S,u))||y);return x>3&&y&&Object.defineProperty(S,u,y),y},l=this&&this.__param||function(_,S){return function(u,v){S(u,v,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=o(2223),c=o(643),f=o(511),p=o(2585),a=o(8055),e=o(4725),n=o(4269),i=o(6171),r=o(3734);let d=t.DomRendererRowFactory=class{constructor(_,S,u,v,C,x,y){this._document=_,this._characterJoinerService=S,this._optionsService=u,this._coreBrowserService=v,this._coreService=C,this._decorationService=x,this._themeService=y,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(_,S,u){this._selectionStart=_,this._selectionEnd=S,this._columnSelectMode=u}createRow(_,S,u,v,C,x,y,L,A,I,N){const $=[],F=this._characterJoinerService.getJoinedCharacters(S),b=this._themeService.colors;let k,T=_.getNoBgTrimmedLength();u&&T<x+1&&(T=x+1);let O=0,U="",q=0,Y=0,V=0,P=!1,R=0,z=!1,W=0;const G=[],K=I!==-1&&N!==-1;for(let Q=0;Q<T;Q++){_.loadCell(Q,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let oe=!1,_e=Q,Z=this._workCell;if(F.length>0&&Q===F[0][0]){oe=!0;const ee=F.shift();Z=new n.JoinedCellData(this._workCell,_.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),_e=ee[1]-1,J=Z.getWidth()}const we=this._isCellInSelection(Q,S),Pe=u&&Q===x,ne=K&&Q>=I&&Q<=N;let te=!1;this._decorationService.forEachDecorationAtCell(Q,S,void 0,ee=>{te=!0});let ie=Z.getChars()||c.WHITESPACE_CELL_CHAR;if(ie===" "&&(Z.isUnderline()||Z.isOverline())&&(ie=" "),W=J*L-A.get(ie,Z.isBold(),Z.isItalic()),k){if(O&&(we&&z||!we&&!z&&Z.bg===q)&&(we&&z&&b.selectionForeground||Z.fg===Y)&&Z.extended.ext===V&&ne===P&&W===R&&!Pe&&!oe&&!te){Z.isInvisible()?U+=c.WHITESPACE_CELL_CHAR:U+=ie,O++;continue}O&&(k.textContent=U),k=this._document.createElement("span"),O=0,U=""}else k=this._document.createElement("span");if(q=Z.bg,Y=Z.fg,V=Z.extended.ext,P=ne,R=W,z=we,oe&&x>=Q&&x<=_e&&(x=Q),!this._coreService.isCursorHidden&&Pe&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)y&&G.push("xterm-cursor-blink"),G.push(v==="bar"?"xterm-cursor-bar":v==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(C)switch(C){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline")}}if(Z.isBold()&&G.push("xterm-bold"),Z.isItalic()&&G.push("xterm-italic"),Z.isDim()&&G.push("xterm-dim"),U=Z.isInvisible()?c.WHITESPACE_CELL_CHAR:Z.getChars()||c.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(G.push(`xterm-underline-${Z.extended.underlineStyle}`),U===" "&&(U=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ee=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ee<8&&(ee+=8),k.style.textDecorationColor=b.ansi[ee].css}Z.isOverline()&&(G.push("xterm-overline"),U===" "&&(U=" ")),Z.isStrikethrough()&&G.push("xterm-strikethrough"),ne&&(k.style.textDecoration="underline");let X=Z.getFgColor(),se=Z.getFgColorMode(),ue=Z.getBgColor(),ce=Z.getBgColorMode();const Ee=!!Z.isInverse();if(Ee){const ee=X;X=ue,ue=ee;const Ne=se;se=ce,ce=Ne}let me,be,fe,he=!1;switch(this._decorationService.forEachDecorationAtCell(Q,S,void 0,ee=>{ee.options.layer!=="top"&&he||(ee.backgroundColorRGB&&(ce=50331648,ue=ee.backgroundColorRGB.rgba>>8&16777215,me=ee.backgroundColorRGB),ee.foregroundColorRGB&&(se=50331648,X=ee.foregroundColorRGB.rgba>>8&16777215,be=ee.foregroundColorRGB),he=ee.options.layer==="top")}),!he&&we&&(me=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ue=me.rgba>>8&16777215,ce=50331648,he=!0,b.selectionForeground&&(se=50331648,X=b.selectionForeground.rgba>>8&16777215,be=b.selectionForeground)),he&&G.push("xterm-decoration-top"),ce){case 16777216:case 33554432:fe=b.ansi[ue],G.push(`xterm-bg-${ue}`);break;case 50331648:fe=a.channels.toColor(ue>>16,ue>>8&255,255&ue),this._addStyle(k,`background-color:#${g((ue>>>0).toString(16),"0",6)}`);break;default:Ee?(fe=b.foreground,G.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):fe=b.background}switch(me||Z.isDim()&&(me=a.color.multiplyOpacity(fe,.5)),se){case 16777216:case 33554432:Z.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(k,fe,b.ansi[X],Z,me,void 0)||G.push(`xterm-fg-${X}`);break;case 50331648:const ee=a.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(k,fe,ee,Z,me,be)||this._addStyle(k,`color:#${g(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,fe,b.foreground,Z,me,be)||Ee&&G.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}G.length&&(k.className=G.join(" "),G.length=0),Pe||oe||te?k.textContent=U:O++,W!==this.defaultSpacing&&(k.style.letterSpacing=`${W}px`),$.push(k),Q=_e}return k&&O&&(k.textContent=U),$}_applyMinimumContrast(_,S,u,v,C,x){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(v.getCode()))return!1;const y=this._getContrastCache(v);let L;if(C||x||(L=y.getColor(S.rgba,u.rgba)),L===void 0){const A=this._optionsService.rawOptions.minimumContrastRatio/(v.isDim()?2:1);L=a.color.ensureContrastRatio(C||S,x||u,A),y.setColor((C||S).rgba,(x||u).rgba,L??null)}return!!L&&(this._addStyle(_,`color:${L.css}`),!0)}_getContrastCache(_){return _.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(_,S){_.setAttribute("style",`${_.getAttribute("style")||""}${S};`)}_isCellInSelection(_,S){const u=this._selectionStart,v=this._selectionEnd;return!(!u||!v)&&(this._columnSelectMode?u[0]<=v[0]?_>=u[0]&&S>=u[1]&&_<v[0]&&S<=v[1]:_<u[0]&&S>=u[1]&&_>=v[0]&&S<=v[1]:S>u[1]&&S<v[1]||u[1]===v[1]&&S===u[1]&&_>=u[0]&&_<v[0]||u[1]<v[1]&&S===v[1]&&_<v[0]||u[1]<v[1]&&S===u[1]&&_>=u[0])}};function g(_,S,u){for(;_.length<u;)_=S+_;return _}t.DomRendererRowFactory=d=h([l(1,e.ICharacterJoinerService),l(2,p.IOptionsService),l(3,e.ICoreBrowserService),l(4,p.ICoreService),l(5,p.IDecorationService),l(6,e.IThemeService)],d)},2550:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(o,h){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";const l=o.createElement("span");l.classList.add("xterm-char-measure-element");const s=o.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const c=o.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const f=o.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[l,s,c,f],this._container.appendChild(l),this._container.appendChild(s),this._container.appendChild(c),this._container.appendChild(f),h.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,h,l,s){o===this._font&&h===this._fontSize&&l===this._weight&&s===this._weightBold||(this._font=o,this._fontSize=h,this._weight=l,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(o,h,l){let s=0;if(!h&&!l&&o.length===1&&(s=o.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const p=this._measure(o,0);return p>0&&(this._flat[s]=p),p}let c=o;h&&(c+="B"),l&&(c+="I");let f=this._holey.get(c);if(f===void 0){let p=0;h&&(p|=1),l&&(p|=2),f=this._measure(o,p),f>0&&this._holey.set(c,f)}return f}_measure(o,h){const l=this._measureElements[h];return l.textContent=o.repeat(32),l.offsetWidth/32}}},2223:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=o(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(M,t)=>{function o(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=o,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,f){return s===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!o(l)&&!function(p){return 57344<=p&&p<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return o(l)||function(s){return 9472<=s&&s<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},6052:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.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(l,s,c,f=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const p=l.buffers.active.ydisp,a=s[1]-p,e=c[1]-p,n=Math.max(a,0),i=Math.min(e,l.rows-1);n>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=a,this.viewportEndRow=e,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new o}},456:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.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()){const 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]){const 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(){const o=this.selectionStart,h=this.selectionEnd;return!(!o||!h)&&(o[1]>h[1]||o[1]===h[1]&&o[0]>h[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(M,t,o){var h=this&&this.__decorate||function(i,r,d,g){var _,S=arguments.length,u=S<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,r,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(S<3?_(u):S>3?_(r,d,u):_(r,d))||u);return S>3&&u&&Object.defineProperty(r,d,u),u},l=this&&this.__param||function(i,r){return function(d,g){r(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const s=o(2585),c=o(8460),f=o(844);let p=t.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,r,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=p=h([l(2,s.IOptionsService)],p);class a extends f.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,d){r!==void 0&&r>0&&d!==void 0&&d>0&&(this._result.width=r,this._result.height=d)}}class e extends a{constructor(r,d,g){super(),this._document=r,this._parentElement=d,this._optionsService=g,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 n extends a{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const r=this._ctx.measureText("W");return this._validateAndSet(r.width,r.fontBoundingBoxAscent+r.fontBoundingBoxDescent),this._result}}},4269:function(M,t,o){var h=this&&this.__decorate||function(n,i,r,d){var g,_=arguments.length,S=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,r):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,i,r,d);else for(var u=n.length-1;u>=0;u--)(g=n[u])&&(S=(_<3?g(S):_>3?g(i,r,S):g(i,r))||S);return _>3&&S&&Object.defineProperty(i,r,S),S},l=this&&this.__param||function(n,i){return function(r,d){i(r,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=o(3734),c=o(643),f=o(511),p=o(2585);class a extends s.AttributeData{constructor(i,r,d){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=r,this._width=d}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=a;let e=t.CharacterJoinerService=class si{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(i){const r={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(r),r.id}deregister(i){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===i)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const r=this._bufferService.buffer.lines.get(i);if(!r||r.length===0)return[];const d=[],g=r.translateToString(!0);let _=0,S=0,u=0,v=r.getFg(0),C=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!==v||this._workCell.bg!==C){if(x-_>1){const y=this._getJoinedRanges(g,u,S,r,_);for(let L=0;L<y.length;L++)d.push(y[L])}_=x,u=S,v=this._workCell.fg,C=this._workCell.bg}S+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-_>1){const x=this._getJoinedRanges(g,u,S,r,_);for(let y=0;y<x.length;y++)d.push(x[y])}return d}_getJoinedRanges(i,r,d,g,_){const S=i.substring(r,d);let u=[];try{u=this._characterJoiners[0].handler(S)}catch(v){console.error(v)}for(let v=1;v<this._characterJoiners.length;v++)try{const C=this._characterJoiners[v].handler(S);for(let x=0;x<C.length;x++)si._mergeRanges(u,C[x])}catch(C){console.error(C)}return this._stringRangesToCellRanges(u,g,_),u}_stringRangesToCellRanges(i,r,d){let g=0,_=!1,S=0,u=i[g];if(u){for(let v=d;v<this._bufferService.cols;v++){const C=r.getWidth(v),x=r.getString(v).length||c.WHITESPACE_CELL_CHAR.length;if(C!==0){if(!_&&u[0]<=S&&(u[0]=v,_=!0),u[1]<=S){if(u[1]=v,u=i[++g],!u)break;u[0]<=S?(u[0]=v,_=!0):_=!1}S+=x}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(i,r){let d=!1;for(let g=0;g<i.length;g++){const _=i[g];if(d){if(r[1]<=_[0])return i[g-1][1]=r[1],i;if(r[1]<=_[1])return i[g-1][1]=Math.max(r[1],_[1]),i.splice(g,1),i;i.splice(g,1),g--}else{if(r[1]<=_[0])return i.splice(g,0,r),i;if(r[1]<=_[1])return _[0]=Math.min(r[0],_[0]),i;r[0]<_[1]&&(_[0]=Math.min(r[0],_[0]),d=!0)}}return d?i[i.length-1][1]=r[1]:i.push(r),i}};t.CharacterJoinerService=e=h([l(0,p.IBufferService)],e)},5114:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=o(844),l=o(8460),s=o(3656);class c extends h.Disposable{constructor(a,e,n){super(),this._textarea=a,this._window=e,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,l.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(a){this._window!==a&&(this._window=a,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}}t.CoreBrowserService=c;class f extends h.Disposable{constructor(a){super(),this._parentWindow=a,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(a){this._parentWindow=a,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,s.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var a;this._outerListener&&((a=this._resolutionMediaMatchList)==null||a.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:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=o(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const f=this.linkProviders.indexOf(c);f!==-1&&this.linkProviders.splice(f,1)}}}}t.LinkProviderService=l},8934:function(M,t,o){var h=this&&this.__decorate||function(p,a,e,n){var i,r=arguments.length,d=r<3?a:n===null?n=Object.getOwnPropertyDescriptor(a,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(p,a,e,n);else for(var g=p.length-1;g>=0;g--)(i=p[g])&&(d=(r<3?i(d):r>3?i(a,e,d):i(a,e))||d);return r>3&&d&&Object.defineProperty(a,e,d),d},l=this&&this.__param||function(p,a){return function(e,n){a(e,n,p)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=o(4725),c=o(9806);let f=t.MouseService=class{constructor(p,a){this._renderService=p,this._charSizeService=a}getCoords(p,a,e,n,i){return(0,c.getCoords)(window,p,a,e,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(p,a){const e=(0,c.getCoordsRelativeToElement)(window,p,a);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=f=h([l(0,s.IRenderService),l(1,s.ICharSizeService)],f)},3230:function(M,t,o){var h=this&&this.__decorate||function(i,r,d,g){var _,S=arguments.length,u=S<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,r,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(S<3?_(u):S>3?_(r,d,u):_(r,d))||u);return S>3&&u&&Object.defineProperty(r,d,u),u},l=this&&this.__param||function(i,r){return function(d,g){r(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const s=o(6193),c=o(4725),f=o(8460),p=o(844),a=o(7226),e=o(2585);let n=t.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,r,d,g,_,S,u,v){super(),this._rowCount=i,this._charSizeService=g,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new a.DebouncedIdleTask,this._observerDisposable=this.register(new p.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 f.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new f.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new f.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new f.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new s.RenderDebouncer((C,x)=>this._renderRows(C,x),u),this.register(this._renderDebouncer),this.register(u.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(S.onResize(()=>this._fullRefresh())),this.register(S.buffers.onBufferActivate(()=>{var C;return(C=this._renderer.value)==null?void 0:C.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(_.onDecorationRegistered(()=>this._fullRefresh())),this.register(_.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(S.cols,S.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(S.buffer.y,S.buffer.y,!0))),this.register(v.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(u.window,r),this.register(u.onWindowChange(C=>this._registerIntersectionObserver(C,r)))}_registerIntersectionObserver(i,r){if("IntersectionObserver"in i){const d=new i.IntersectionObserver(g=>this._handleIntersectionChange(g[g.length-1]),{threshold:0});d.observe(r),this._observerDisposable.value=(0,p.toDisposable)(()=>d.disconnect())}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.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(i,r,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,r,this._rowCount))}_renderRows(i,r){this._renderer.value&&(i=Math.min(i,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(i,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:i,end:r}),this._onRender.fire({start:i,end:r}),this._isNextRenderRedrawOnly=!0)}resize(i,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(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw(r=>this.refreshRows(r.start,r.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,r;this._renderer.value&&((r=(i=this._renderer.value).clearTextureAtlas)==null||r.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(i,r)}):this._renderer.value.handleResize(i,r),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,r,d){var g;this._selectionState.start=i,this._selectionState.end=r,this._selectionState.columnSelectMode=d,(g=this._renderer.value)==null||g.handleSelectionChanged(i,r,d)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=n=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],n)},9312:function(M,t,o){var h=this&&this.__decorate||function(u,v,C,x){var y,L=arguments.length,A=L<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,C):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,v,C,x);else for(var I=u.length-1;I>=0;I--)(y=u[I])&&(A=(L<3?y(A):L>3?y(v,C,A):y(v,C))||A);return L>3&&A&&Object.defineProperty(v,C,A),A},l=this&&this.__param||function(u,v){return function(C,x){v(C,x,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=o(9806),c=o(9504),f=o(456),p=o(4725),a=o(8460),e=o(844),n=o(6114),i=o(4841),r=o(511),d=o(2585),g=" ",_=new RegExp(g,"g");let S=t.SelectionService=class extends e.Disposable{constructor(u,v,C,x,y,L,A,I,N){super(),this._element=u,this._screenElement=v,this._linkifier=C,this._bufferService=x,this._coreService=y,this._mouseService=L,this._optionsService=A,this._renderService=I,this._coreBrowserService=N,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 a.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new a.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new a.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new a.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.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(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;return!(!u||!v||u[0]===v[0]&&u[1]===v[1])}get selectionText(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;if(!u||!v)return"";const C=this._bufferService.buffer,x=[];if(this._activeSelectionMode===3){if(u[0]===v[0])return"";const y=u[0]<v[0]?u[0]:v[0],L=u[0]<v[0]?v[0]:u[0];for(let A=u[1];A<=v[1];A++){const I=C.translateBufferLineToString(A,!0,y,L);x.push(I)}}else{const y=u[1]===v[1]?v[0]:void 0;x.push(C.translateBufferLineToString(u[1],!0,u[0],y));for(let L=u[1]+1;L<=v[1]-1;L++){const A=C.lines.get(L),I=C.translateBufferLineToString(L,!0);A!=null&&A.isWrapped?x[x.length-1]+=I:x.push(I)}if(u[1]!==v[1]){const L=C.lines.get(v[1]),A=C.translateBufferLineToString(v[1],!0,0,v[0]);L&&L.isWrapped?x[x.length-1]+=A:x.push(A)}}return x.map(y=>y.replace(_," ")).join(n.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.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){const v=this._getMouseBufferCoords(u),C=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!!(C&&x&&v)&&this._areCoordsInSelection(v,C,x)}isCellInSelection(u,v){const C=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!C||!x)&&this._areCoordsInSelection([u,v],C,x)}_areCoordsInSelection(u,v,C){return u[1]>v[1]&&u[1]<C[1]||v[1]===C[1]&&u[1]===v[1]&&u[0]>=v[0]&&u[0]<C[0]||v[1]<C[1]&&u[1]===C[1]&&u[0]<C[0]||v[1]<C[1]&&u[1]===v[1]&&u[0]>=v[0]}_selectWordAtCursor(u,v){var w,E;const C=(E=(w=this._linkifier.currentLink)==null?void 0:w.link)==null?void 0:E.range;if(C)return this._model.selectionStart=[C.start.x-1,C.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(C,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const x=this._getMouseBufferCoords(u);return!!x&&(this._selectWordAt(x,v),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,v){this._model.clearSelection(),u=Math.max(u,0),v=Math.min(v,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,v],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){const v=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(v)return v[0]--,v[1]--,v[1]+=this._bufferService.buffer.ydisp,v}_getMouseEventScrollAmount(u){let v=(0,r.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const C=this._renderService.dimensions.css.canvas.height;return v>=0&&v<=C?0:(v>C&&(v-=C),v=Math.min(Math.max(v,-50),50),v/=50,v/Math.abs(v)+Math.round(14*v))}shouldForceSelection(u){return n.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;const v=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);v&&v.length!==this._model.selectionStart[0]&&v.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){const v=this._getMouseBufferCoords(u);v&&(this._activeSelectionMode=2,this._selectLineAt(v[1]))}shouldColumnSelect(u){return u.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;const v=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));const C=this._bufferService.buffer;if(this._model.selectionEnd[1]<C.lines.length){const x=C.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]++}v&&v[0]===this._model.selectionEnd[0]&&v[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});const 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){const v=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&v<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const C=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(C&&C[0]!==void 0&&C[1]!==void 0){const x=(0,c.moveToCellSequence)(C[0]-1,C[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd,C=!(!u||!v||u[0]===v[0]&&u[1]===v[1]);C?u&&v&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&v[0]===this._oldSelectionEnd[0]&&v[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,v,C)):this._oldHasSelection&&this._fireOnSelectionChange(u,v,C)}_fireOnSelectionChange(u,v,C){this._oldSelectionStart=u,this._oldSelectionEnd=v,this._oldHasSelection=C,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim(v=>this._handleTrim(v))}_convertViewportColToCharacterIndex(u,v){let C=v;for(let x=0;v>=x;x++){const w=u.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?C--:w>1&&v!==x&&(C+=w-1)}return C}setSelection(u,v,C){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,v],this._model.selectionStartLength=C,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,v,C=!0,x=!0){if(u[0]>=this._bufferService.cols)return;const w=this._bufferService.buffer,E=w.lines.get(u[1]);if(!E)return;const A=w.translateBufferLineToString(u[1],!1);let I=this._convertViewportColToCharacterIndex(E,u[0]),N=I;const $=u[0]-I;let F=0,b=0,k=0,T=0;if(A.charAt(I)===" "){for(;I>0&&A.charAt(I-1)===" ";)I--;for(;N<A.length&&A.charAt(N+1)===" ";)N++}else{let q=u[0],Y=u[0];E.getWidth(q)===0&&(F++,q--),E.getWidth(Y)===2&&(b++,Y++);const V=E.getString(Y).length;for(V>1&&(T+=V-1,N+=V-1);q>0&&I>0&&!this._isCharWordSeparator(E.loadCell(q-1,this._workCell));){E.loadCell(q-1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,q--):P>1&&(k+=P-1,I-=P-1),I--,q--}for(;Y<E.length&&N+1<A.length&&!this._isCharWordSeparator(E.loadCell(Y+1,this._workCell));){E.loadCell(Y+1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):P>1&&(T+=P-1,N+=P-1),N++,Y++}}N++;let O=I+$-F+k,U=Math.min(this._bufferService.cols,N-I+F+b-k-T);if(v||A.slice(I,N).trim()!==""){if(C&&O===0&&E.getCodePoint(0)!==32){const q=w.lines.get(u[1]-1);if(q&&E.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(Y){const V=this._bufferService.cols-Y.start;O-=V,U+=V}}}if(x&&O+U===this._bufferService.cols&&E.getCodePoint(this._bufferService.cols-1)!==32){const q=w.lines.get(u[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:O,length:U}}}_selectWordAt(u,v){const C=this._getWordAt(u,v);if(C){for(;C.start<0;)C.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[C.start,u[1]],this._model.selectionStartLength=C.length}}_selectToWordAt(u){const v=this._getWordAt(u,!0);if(v){let C=u[1];for(;v.start<0;)v.start+=this._bufferService.cols,C--;if(!this._model.areSelectionValuesReversed())for(;v.start+v.length>this._bufferService.cols;)v.length-=this._bufferService.cols,C++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?v.start:v.start+v.length,C]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){const v=this._bufferService.buffer.getWrappedRangeForLine(u),C={start:{x:0,y:v.first},end:{x:this._bufferService.cols-1,y:v.last}};this._model.selectionStart=[0,v.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(C,this._bufferService.cols)}};t.SelectionService=S=h([l(3,d.IBufferService),l(4,d.ICoreService),l(5,p.IMouseService),l(6,d.IOptionsService),l(7,p.IRenderService),l(8,p.ICoreBrowserService)],S)},4725:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const h=a(8343);t.ICharSizeService=(0,h.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),t.IMouseService=(0,h.createDecorator)("MouseService"),t.IRenderService=(0,h.createDecorator)("RenderService"),t.ISelectionService=(0,h.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,h.createDecorator)("ThemeService"),t.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(M,t,a){var h=this&&this.__decorate||function(S,u,v,C){var x,w=arguments.length,E=w<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,u,v,C);else for(var A=S.length-1;A>=0;A--)(x=S[A])&&(E=(w<3?x(E):w>3?x(u,v,E):x(u,v))||E);return w>3&&E&&Object.defineProperty(u,v,E),E},l=this&&this.__param||function(S,u){return function(v,C){u(v,C,S)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const r=a(7239),c=a(8055),f=a(8460),p=a(844),o=a(2585),e=c.css.toColor("#ffffff"),n=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),s=c.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const S=[c.css.toColor("#2e3436"),c.css.toColor("#cc0000"),c.css.toColor("#4e9a06"),c.css.toColor("#c4a000"),c.css.toColor("#3465a4"),c.css.toColor("#75507b"),c.css.toColor("#06989a"),c.css.toColor("#d3d7cf"),c.css.toColor("#555753"),c.css.toColor("#ef2929"),c.css.toColor("#8ae234"),c.css.toColor("#fce94f"),c.css.toColor("#729fcf"),c.css.toColor("#ad7fa8"),c.css.toColor("#34e2e2"),c.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let v=0;v<216;v++){const C=u[v/36%6|0],x=u[v/6%6|0],w=u[v%6];S.push({css:c.channels.toCss(C,x,w),rgba:c.channels.toRgba(C,x,w)})}for(let v=0;v<24;v++){const C=8+10*v;S.push({css:c.channels.toCss(C,C,C),rgba:c.channels.toRgba(C,C,C)})}return S})());let g=t.ThemeService=class extends p.Disposable{get colors(){return this._colors}constructor(S){super(),this._optionsService=S,this._contrastCache=new r.ColorContrastCache,this._halfContrastCache=new r.ColorContrastCache,this._onChangeColors=this.register(new f.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:n,cursor:i,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:c.color.blend(n,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:c.color.blend(n,d),ansi:t.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(S={}){const u=this._colors;if(u.foreground=_(S.foreground,e),u.background=_(S.background,n),u.cursor=_(S.cursor,i),u.cursorAccent=_(S.cursorAccent,s),u.selectionBackgroundTransparent=_(S.selectionBackground,d),u.selectionBackgroundOpaque=c.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=_(S.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=c.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=S.selectionForeground?_(S.selectionForeground,c.NULL_COLOR):void 0,u.selectionForeground===c.NULL_COLOR&&(u.selectionForeground=void 0),c.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=c.color.opacity(u.selectionBackgroundTransparent,.3)),c.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=c.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=t.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=_(S.black,t.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=_(S.red,t.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=_(S.green,t.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=_(S.yellow,t.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=_(S.blue,t.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=_(S.magenta,t.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=_(S.cyan,t.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=_(S.white,t.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=_(S.brightBlack,t.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=_(S.brightRed,t.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=_(S.brightGreen,t.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=_(S.brightYellow,t.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=_(S.brightBlue,t.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=_(S.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=_(S.brightCyan,t.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=_(S.brightWhite,t.DEFAULT_ANSI_COLORS[15]),S.extendedAnsi){const v=Math.min(u.ansi.length-16,S.extendedAnsi.length);for(let C=0;C<v;C++)u.ansi[C+16]=_(S.extendedAnsi[C],t.DEFAULT_ANSI_COLORS[C+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(S){this._restoreColor(S),this._onChangeColors.fire(this.colors)}_restoreColor(S){if(S!==void 0)switch(S){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[S]=this._restoreColors.ansi[S]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(S){S(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 _(S,u){if(S!==void 0)try{return c.css.toColor(S)}catch{}return u}t.ThemeService=g=h([l(0,o.IOptionsService)],g)},6349:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class r extends l.Disposable{constructor(f){super(),this._maxLength=f,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.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(f){if(this._maxLength===f)return;const p=new Array(f);for(let o=0;o<Math.min(f,this.length);o++)p[o]=this._array[this._getCyclicIndex(o)];this._array=p,this._maxLength=f,this._startIndex=0}get length(){return this._length}set length(f){if(f>this._length)for(let p=this._length;p<f;p++)this._array[p]=void 0;this._length=f}get(f){return this._array[this._getCyclicIndex(f)]}set(f,p){this._array[this._getCyclicIndex(f)]=p}push(f){this._array[this._getCyclicIndex(this._length)]=f,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(f,p,...o){if(p){for(let e=f;e<this._length-p;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+p)];this._length-=p,this.onDeleteEmitter.fire({index:f,amount:p})}for(let e=this._length-1;e>=f;e--)this._array[this._getCyclicIndex(e+o.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<o.length;e++)this._array[this._getCyclicIndex(f+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:f,amount:o.length}),this._length+o.length>this._maxLength){const e=this._length+o.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=o.length}trimStart(f){f>this._length&&(f=this._length),this._startIndex+=f,this._length-=f,this.onTrimEmitter.fire(f)}shiftElements(f,p,o){if(!(p<=0)){if(f<0||f>=this._length)throw new Error("start argument out of range");if(f+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let n=p-1;n>=0;n--)this.set(f+n+o,this.get(f+n));const e=f+p+o-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<p;e++)this.set(f+e+o,this.get(f+e))}}_getCyclicIndex(f){return(this._startIndex+f)%this._maxLength}}t.CircularList=r},1439:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,l=5){if(typeof h!="object")return h;const r=Array.isArray(h)?[]:{};for(const c in h)r[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return r}},8055:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,r=0;var c,f,p,o,e;function n(s){const d=s.toString(16);return d.length<2?"0"+d:d}function i(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,g,_,S){return S!==void 0?`#${n(d)}${n(g)}${n(_)}${n(S)}`:`#${n(d)}${n(g)}${n(_)}`},s.toRgba=function(d,g,_,S=255){return(d<<24|g<<16|_<<8|S)>>>0},s.toColor=function(d,g,_,S){return{css:s.toCss(d,g,_,S),rgba:s.toRgba(d,g,_,S)}}}(c||(t.channels=c={})),function(s){function d(g,_){return r=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,r),rgba:c.toRgba(a,h,l,r)}}s.blend=function(g,_){if(r=(255&_.rgba)/255,r===1)return{css:_.css,rgba:_.rgba};const S=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,C=g.rgba>>24&255,x=g.rgba>>16&255,w=g.rgba>>8&255;return a=C+Math.round((S-C)*r),h=x+Math.round((u-x)*r),l=w+Math.round((v-w)*r),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},s.isOpaque=function(g){return(255&g.rgba)==255},s.ensureContrastRatio=function(g,_,S){const u=e.ensureContrastRatio(g.rgba,_.rgba,S);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},s.opaque=function(g){const _=(255|g.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},s.opacity=d,s.multiplyOpacity=function(g,_){return r=255&g.rgba,d(g,r*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(f||(t.color=f={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const S=_.getContext("2d",{willReadFrequently:!0});S&&(d=S,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),r=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,r);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const S=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return a=parseInt(S[1]),h=parseInt(S[2]),l=parseInt(S[3]),r=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),c.toColor(a,h,l,r);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,r]=d.getImageData(0,0,1,1).data,r!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,r),css:_}}}(p||(t.css=p={})),function(s){function d(g,_,S){const u=g/255,v=_/255,C=S/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.0722*(C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4))}s.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},s.relativeLuminance2=d}(o||(t.rgb=o={})),function(s){function d(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let w=S>>24&255,E=S>>16&255,A=S>>8&255,I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));for(;I<u&&(w>0||E>0||A>0);)w-=Math.max(0,Math.ceil(.1*w)),E-=Math.max(0,Math.ceil(.1*E)),A-=Math.max(0,Math.ceil(.1*A)),I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));return(w<<24|E<<16|A<<8|255)>>>0}function g(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let w=S>>24&255,E=S>>16&255,A=S>>8&255,I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));for(;I<u&&(w<255||E<255||A<255);)w=Math.min(255,w+Math.ceil(.1*(255-w))),E=Math.min(255,E+Math.ceil(.1*(255-E))),A=Math.min(255,A+Math.ceil(.1*(255-A))),I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));return(w<<24|E<<16|A<<8|255)>>>0}s.blend=function(_,S){if(r=(255&S)/255,r===1)return S;const u=S>>24&255,v=S>>16&255,C=S>>8&255,x=_>>24&255,w=_>>16&255,E=_>>8&255;return a=x+Math.round((u-x)*r),h=w+Math.round((v-w)*r),l=E+Math.round((C-E)*r),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,S,u){const v=o.relativeLuminance(_>>8),C=o.relativeLuminance(S>>8);if(i(v,C)<u){if(C<v){const E=d(_,S,u),A=i(v,o.relativeLuminance(E>>8));if(A<u){const I=g(_,S,u);return A>i(v,o.relativeLuminance(I>>8))?E:I}return E}const x=g(_,S,u),w=i(v,o.relativeLuminance(x>>8));if(w<u){const E=d(_,S,u);return w>i(v,o.relativeLuminance(E>>8))?x:E}return x}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=n,t.contrastRatio=i},8969:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),r=a(4348),c=a(7866),f=a(744),p=a(7302),o=a(6975),e=a(8460),n=a(1753),i=a(1480),s=a(7994),d=a(9282),g=a(5435),_=a(5981),S=a(2660);let u=!1;class v extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event(x=>{var w;(w=this._onScrollApi)==null||w.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(const w in x)this.optionsService.options[w]=x[w]}constructor(x){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new r.InstantiationService,this.optionsService=this.register(new p.OptionsService(x)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(f.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(w=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(w=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new _.WriteBuffer((w,E)=>this._inputHandler.parse(w,E))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,w){this._writeBuffer.write(x,w)}writeSync(x,w){this._logService.logLevel<=l.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(x,w)}input(x,w=!0){this.coreService.triggerDataEvent(x,w)}resize(x,w){isNaN(x)||isNaN(w)||(x=Math.max(x,f.MINIMUM_COLS),w=Math.max(w,f.MINIMUM_ROWS),this._bufferService.resize(x,w))}scroll(x,w=!1){this._bufferService.scroll(x,w)}scrollLines(x,w,E){this._bufferService.scrollLines(x,w,E)}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){const w=x-this._bufferService.buffer.ydisp;w!==0&&this.scrollLines(w)}registerEscHandler(x,w){return this._inputHandler.registerEscHandler(x,w)}registerDcsHandler(x,w){return this._inputHandler.registerDcsHandler(x,w)}registerCsiHandler(x,w){return this._inputHandler.registerCsiHandler(x,w)}registerOscHandler(x,w){return this._inputHandler.registerOscHandler(x,w)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1;const w=this.optionsService.rawOptions.windowsPty;w&&w.buildNumber!==void 0&&w.buildNumber!==void 0?x=w.backend==="conpty"&&w.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const x=[];x.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const w of x)w.dispose()})}}}t.CoreTerminal=v},8460:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let r=0;r<this._listeners.length;r++)l.push(this._listeners[r]);for(let r=0;r<l.length;r++)l[r].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},5435:function(M,t,a){var h=this&&this.__decorate||function(F,b,k,T){var O,U=arguments.length,q=U<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,k):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(F,b,k,T);else for(var Y=F.length-1;Y>=0;Y--)(O=F[Y])&&(q=(U<3?O(q):U>3?O(b,k,q):O(b,k))||q);return U>3&&q&&Object.defineProperty(b,k,q),q},l=this&&this.__param||function(F,b){return function(k,T){b(k,T,F)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const r=a(2584),c=a(7116),f=a(2015),p=a(844),o=a(482),e=a(8437),n=a(8460),i=a(643),s=a(511),d=a(3734),g=a(2585),_=a(1480),S=a(6242),u=a(6351),v=a(5941),C={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function w(F,b){if(F>24)return b.setWinLines||!1;switch(F){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 E;(function(F){F[F.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",F[F.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(E||(t.WindowsOptionsReportType=E={}));let A=0;class I extends p.Disposable{getAttrData(){return this._curAttrData}constructor(b,k,T,O,U,q,Y,V,P=new f.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=k,this._coreService=T,this._logService=O,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=Y,this._unicodeService=V,this._parser=P,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.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 N(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(R=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:z.toArray()})}),this._parser.setEscHandlerFallback(R=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(R)})}),this._parser.setExecuteHandlerFallback(R=>{this._logService.debug("Unknown EXECUTE code: ",{code:R})}),this._parser.setOscHandlerFallback((R,z,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:z,data:W})}),this._parser.setDcsHandlerFallback((R,z,W)=>{z==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:z,payload:W})}),this._parser.setPrintHandler((R,z,W)=>this.print(R,z,W)),this._parser.registerCsiHandler({final:"@"},R=>this.insertChars(R)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},R=>this.scrollLeft(R)),this._parser.registerCsiHandler({final:"A"},R=>this.cursorUp(R)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},R=>this.scrollRight(R)),this._parser.registerCsiHandler({final:"B"},R=>this.cursorDown(R)),this._parser.registerCsiHandler({final:"C"},R=>this.cursorForward(R)),this._parser.registerCsiHandler({final:"D"},R=>this.cursorBackward(R)),this._parser.registerCsiHandler({final:"E"},R=>this.cursorNextLine(R)),this._parser.registerCsiHandler({final:"F"},R=>this.cursorPrecedingLine(R)),this._parser.registerCsiHandler({final:"G"},R=>this.cursorCharAbsolute(R)),this._parser.registerCsiHandler({final:"H"},R=>this.cursorPosition(R)),this._parser.registerCsiHandler({final:"I"},R=>this.cursorForwardTab(R)),this._parser.registerCsiHandler({final:"J"},R=>this.eraseInDisplay(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},R=>this.eraseInDisplay(R,!0)),this._parser.registerCsiHandler({final:"K"},R=>this.eraseInLine(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},R=>this.eraseInLine(R,!0)),this._parser.registerCsiHandler({final:"L"},R=>this.insertLines(R)),this._parser.registerCsiHandler({final:"M"},R=>this.deleteLines(R)),this._parser.registerCsiHandler({final:"P"},R=>this.deleteChars(R)),this._parser.registerCsiHandler({final:"S"},R=>this.scrollUp(R)),this._parser.registerCsiHandler({final:"T"},R=>this.scrollDown(R)),this._parser.registerCsiHandler({final:"X"},R=>this.eraseChars(R)),this._parser.registerCsiHandler({final:"Z"},R=>this.cursorBackwardTab(R)),this._parser.registerCsiHandler({final:"`"},R=>this.charPosAbsolute(R)),this._parser.registerCsiHandler({final:"a"},R=>this.hPositionRelative(R)),this._parser.registerCsiHandler({final:"b"},R=>this.repeatPrecedingCharacter(R)),this._parser.registerCsiHandler({final:"c"},R=>this.sendDeviceAttributesPrimary(R)),this._parser.registerCsiHandler({prefix:">",final:"c"},R=>this.sendDeviceAttributesSecondary(R)),this._parser.registerCsiHandler({final:"d"},R=>this.linePosAbsolute(R)),this._parser.registerCsiHandler({final:"e"},R=>this.vPositionRelative(R)),this._parser.registerCsiHandler({final:"f"},R=>this.hVPosition(R)),this._parser.registerCsiHandler({final:"g"},R=>this.tabClear(R)),this._parser.registerCsiHandler({final:"h"},R=>this.setMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"h"},R=>this.setModePrivate(R)),this._parser.registerCsiHandler({final:"l"},R=>this.resetMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"l"},R=>this.resetModePrivate(R)),this._parser.registerCsiHandler({final:"m"},R=>this.charAttributes(R)),this._parser.registerCsiHandler({final:"n"},R=>this.deviceStatus(R)),this._parser.registerCsiHandler({prefix:"?",final:"n"},R=>this.deviceStatusPrivate(R)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},R=>this.softReset(R)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},R=>this.setCursorStyle(R)),this._parser.registerCsiHandler({final:"r"},R=>this.setScrollRegion(R)),this._parser.registerCsiHandler({final:"s"},R=>this.saveCursor(R)),this._parser.registerCsiHandler({final:"t"},R=>this.windowOptions(R)),this._parser.registerCsiHandler({final:"u"},R=>this.restoreCursor(R)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},R=>this.insertColumns(R)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},R=>this.deleteColumns(R)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},R=>this.selectProtected(R)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},R=>this.requestMode(R,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},R=>this.requestMode(R,!1)),this._parser.setExecuteHandler(r.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(r.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(r.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(r.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(r.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(r.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(r.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(r.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(r.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(r.C1.IND,()=>this.index()),this._parser.setExecuteHandler(r.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(r.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new S.OscHandler(R=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new S.OscHandler(R=>this.setIconName(R))),this._parser.registerOscHandler(2,new S.OscHandler(R=>this.setTitle(R))),this._parser.registerOscHandler(4,new S.OscHandler(R=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new S.OscHandler(R=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new S.OscHandler(R=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new S.OscHandler(R=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new S.OscHandler(R=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new S.OscHandler(R=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new S.OscHandler(R=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new S.OscHandler(R=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new S.OscHandler(R=>this.restoreCursorColor(R))),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(const R in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:R},()=>this.selectCharset("("+R)),this._parser.registerEscHandler({intermediates:")",final:R},()=>this.selectCharset(")"+R)),this._parser.registerEscHandler({intermediates:"*",final:R},()=>this.selectCharset("*"+R)),this._parser.registerEscHandler({intermediates:"+",final:R},()=>this.selectCharset("+"+R)),this._parser.registerEscHandler({intermediates:"-",final:R},()=>this.selectCharset("-"+R)),this._parser.registerEscHandler({intermediates:".",final:R},()=>this.selectCharset("."+R)),this._parser.registerEscHandler({intermediates:"/",final:R},()=>this.selectCharset("/"+R));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(R=>(this._logService.error("Parsing error: ",R),R)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler((R,z)=>this.requestStatusString(R,z)))}_preserveStack(b,k,T,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=k,this._parseStack.decodedLength=T,this._parseStack.position=O}_logSlowResolvingAsync(b){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([b,new Promise((k,T)=>setTimeout(()=>T("#SLOW_TIMEOUT"),5e3))]).catch(k=>{if(k!=="#SLOW_TIMEOUT")throw k;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,k){let T,O=this._activeBuffer.x,U=this._activeBuffer.y,q=0;const Y=this._parseStack.paused;if(Y){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,k))return this._logSlowResolvingAsync(T),T;O=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>x&&(q=this._parseStack.position+x)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,R=>String.fromCharCode(R)).join("")}"`),typeof b=="string"?b.split("").map(R=>R.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 R=q;R<b.length;R+=x){const z=R+x<b.length?R+x:b.length,W=typeof b=="string"?this._stringDecoder.decode(b.substring(R,z),this._parseBuffer):this._utf8Decoder.decode(b.subarray(R,z),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,W))return this._preserveStack(O,U,W,R),this._logSlowResolvingAsync(T),T}else if(!Y){const R=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,R))return this._preserveStack(O,U,R,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===O&&this._activeBuffer.y===U||this._onCursorMove.fire();const V=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),P=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);P<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(P,this._bufferService.rows-1),Math.min(V,this._bufferService.rows-1))}print(b,k,T){let O,U;const q=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,V=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,z=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-k>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let G=this._parser.precedingJoinState;for(let K=k;K<T;++K){if(O=b[K],O<127&&q){const _e=q[String.fromCharCode(O)];_e&&(O=_e.charCodeAt(0))}const Q=this._unicodeService.charProperties(O,G);U=_.UnicodeService.extractWidth(Q);const J=_.UnicodeService.extractShouldJoin(Q),oe=J?_.UnicodeService.extractWidth(G):0;if(G=Q,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-oe>V){if(P){const _e=W;let Z=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),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),oe>0&&W instanceof e.BufferLine&&W.copyCellsFrom(_e,Z,0,oe,!1);Z<V;)_e.setCellFromCodepoint(Z++,0,1,z)}else if(this._activeBuffer.x=V-1,U===2)continue}if(J&&this._activeBuffer.x){const _e=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-_e,O,U);for(let Z=U-oe;--Z>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(R&&(W.insertCells(this._activeBuffer.x,U-oe,this._activeBuffer.getNullCell(z)),W.getWidth(V-1)===2&&W.setCellFromCodepoint(V-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,z)),W.setCellFromCodepoint(this._activeBuffer.x++,O,U,z),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=G,this._activeBuffer.x<V&&T-k>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,k){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,k):this._parser.registerCsiHandler(b,T=>!w(T.params[0],this._optionsService.rawOptions.windowOptions)||k(T))}registerDcsHandler(b,k){return this._parser.registerDcsHandler(b,new u.DcsHandler(k))}registerEscHandler(b,k){return this._parser.registerEscHandler(b,k)}registerOscHandler(b,k){return this._parser.registerOscHandler(b,new S.OscHandler(k))}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(){var b;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&&((b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&b.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);k.hasWidth(this._activeBuffer.x)&&!k.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const 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,k){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+k):(this._activeBuffer.x=b,this._activeBuffer.y=k),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,k){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+k)}cursorUp(b){const k=this._activeBuffer.y-this._activeBuffer.scrollTop;return k>=0?this._moveCursor(0,-Math.min(k,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){const k=this._activeBuffer.scrollBottom-this._activeBuffer.y;return k>=0?this._moveCursor(0,Math.min(k,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){const k=b.params[0];return k===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:k===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=b.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=b.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){const k=b.params[0];return k===1&&(this._curAttrData.bg|=536870912),k!==2&&k!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,k,T,O=!1,U=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);q.replaceCells(k,T,this._activeBuffer.getNullCell(this._eraseAttrData()),U),O&&(q.isWrapped=!1)}_resetBufferLine(b,k=!1){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),k),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),T.isWrapped=!1)}eraseInDisplay(b,k=!1){let T;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,k);T<this._bufferService.rows;T++)this._resetBufferLine(T,k);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,k),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,k);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,k);this._dirtyRowTracker.markDirty(0);break;case 3:const O=this._activeBuffer.lines.length-this._bufferService.rows;O>0&&(this._activeBuffer.lines.trimStart(O),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-O,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-O,0),this._onScroll.fire(0))}return!0}eraseInLine(b,k=!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,k);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,k);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,k)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let k=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y,O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;k--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let k=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y;let O;for(O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,O=this._bufferService.rows-1+this._activeBuffer.ybase-O;k--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(O,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();const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let k=b.params[0]||1;for(;k--;)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 k=b.params[0]||1;for(;k--;)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(e.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.deleteCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.insertCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.insertCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.deleteCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.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){const k=this._parser.precedingJoinState;if(!k)return!0;const T=b.params[0]||1,O=_.UnicodeService.extractWidth(k),U=this._activeBuffer.x-O,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(q.length*T);let V=0;for(let R=0;R<q.length;){const z=q.codePointAt(R)||0;Y[V++]=z,R+=z>65535?2:1}let P=V;for(let R=1;R<T;++R)Y.copyWithin(P,0,V),P+=V;return this.print(Y,0,P),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(r.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(r.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(r.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(r.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(r.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let k=0;k<b.length;k++)switch(b.params[k]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let k=0;k<b.length;k++)switch(b.params[k]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),this._charsetService.setgCharset(1,c.DEFAULT_CHARSET),this._charsetService.setgCharset(2,c.DEFAULT_CHARSET),this._charsetService.setgCharset(3,c.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 k=0;k<b.length;k++)switch(b.params[k]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let k=0;k<b.length;k++)switch(b.params[k]){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[k]===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,k){const T=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:Y,cols:V}=this._bufferService,{active:P,alt:R}=Y,z=this._optionsService.rawOptions,W=J=>J?1:2,G=b.params[0];return K=G,Q=k?G===2?4:G===4?W(q.modes.insertMode):G===12?3:G===20?W(z.convertEol):0:G===1?W(T.applicationCursorKeys):G===3?z.windowOptions.setWinLines?V===80?2:V===132?1:0:0:G===6?W(T.origin):G===7?W(T.wraparound):G===8?3:G===9?W(O==="X10"):G===12?W(z.cursorBlink):G===25?W(!q.isCursorHidden):G===45?W(T.reverseWraparound):G===66?W(T.applicationKeypad):G===67?4:G===1e3?W(O==="VT200"):G===1002?W(O==="DRAG"):G===1003?W(O==="ANY"):G===1004?W(T.sendFocus):G===1005?4:G===1006?W(U==="SGR"):G===1015?4:G===1016?W(U==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?W(P===R):G===2004?W(T.bracketedPasteMode):0,q.triggerDataEvent(`${r.C0.ESC}[${k?"":"?"}${K};${Q}$y`),!0;var K,Q}_updateAttrColor(b,k,T,O,U){return k===2?(b|=50331648,b&=-16777216,b|=d.AttributeData.fromColorRGB([T,O,U])):k===5&&(b&=-50331904,b|=33554432|255&T),b}_extractColor(b,k,T){const O=[0,0,-1,0,0,0];let U=0,q=0;do{if(O[q+U]=b.params[k+q],b.hasSubParams(k+q)){const Y=b.getSubParams(k+q);let V=0;do O[1]===5&&(U=1),O[q+V+1+U]=Y[V];while(++V<Y.length&&V+q+1+U<O.length);break}if(O[1]===5&&q+U>=2||O[1]===2&&q+U>=5)break;O[1]&&(U=1)}while(++q+k<b.length&&q+U<O.length);for(let Y=2;Y<O.length;++Y)O[Y]===-1&&(O[Y]=0);switch(O[0]){case 38:T.fg=this._updateAttrColor(T.fg,O[1],O[3],O[4],O[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,O[1],O[3],O[4],O[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,O[1],O[3],O[4],O[5])}return q}_processUnderline(b,k){k.extended=k.extended.clone(),(!~b||b>5)&&(b=1),k.extended.underlineStyle=b,k.fg|=268435456,b===0&&(k.fg&=-268435457),k.updateExtended()}_processSGR0(b){b.fg=e.DEFAULT_ATTR_DATA.fg,b.bg=e.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;const k=b.length;let T;const O=this._curAttrData;for(let U=0;U<k;U++)T=b.params[U],T>=30&&T<=37?(O.fg&=-50331904,O.fg|=16777216|T-30):T>=40&&T<=47?(O.bg&=-50331904,O.bg|=16777216|T-40):T>=90&&T<=97?(O.fg&=-50331904,O.fg|=16777224|T-90):T>=100&&T<=107?(O.bg&=-50331904,O.bg|=16777224|T-100):T===0?this._processSGR0(O):T===1?O.fg|=134217728:T===3?O.bg|=67108864:T===4?(O.fg|=268435456,this._processUnderline(b.hasSubParams(U)?b.getSubParams(U)[0]:1,O)):T===5?O.fg|=536870912:T===7?O.fg|=67108864:T===8?O.fg|=1073741824:T===9?O.fg|=2147483648:T===2?O.bg|=134217728:T===21?this._processUnderline(2,O):T===22?(O.fg&=-134217729,O.bg&=-134217729):T===23?O.bg&=-67108865:T===24?(O.fg&=-268435457,this._processUnderline(0,O)):T===25?O.fg&=-536870913:T===27?O.fg&=-67108865:T===28?O.fg&=-1073741825:T===29?O.fg&=2147483647:T===39?(O.fg&=-67108864,O.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):T===49?(O.bg&=-67108864,O.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?U+=this._extractColor(b,U,O):T===53?O.bg|=1073741824:T===55?O.bg&=-1073741825:T===59?(O.extended=O.extended.clone(),O.extended.underlineColor=-1,O.updateExtended()):T===100?(O.fg&=-67108864,O.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,O.bg&=-67108864,O.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${r.C0.ESC}[0n`);break;case 6:const k=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${r.C0.ESC}[${k};${T}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){const k=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${r.C0.ESC}[?${k};${T}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=e.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){const k=b.params[0]||1;switch(k){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"}const T=k%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(b){const k=b.params[0]||1;let T;return(b.length<2||(T=b.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>k&&(this._activeBuffer.scrollTop=k-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(b){if(!w(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;const k=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:k!==2&&this._onRequestWindowsOptionsReport.fire(E.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(E.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${r.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:k!==0&&k!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),k!==0&&k!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:k!==0&&k!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),k!==0&&k!==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){const k=[],T=b.split(";");for(;T.length>1;){const O=T.shift(),U=T.shift();if(/^\d+$/.exec(O)){const q=parseInt(O);if($(q))if(U==="?")k.push({type:0,index:q});else{const Y=(0,v.parseColor)(U);Y&&k.push({type:1,index:q,color:Y})}}}return k.length&&this._onColor.fire(k),!0}setHyperlink(b){const k=b.split(";");return!(k.length<2)&&(k[1]?this._createHyperlink(k[0],k[1]):!k[0]&&this._finishHyperlink())}_createHyperlink(b,k){this._getCurrentLinkId()&&this._finishHyperlink();const T=b.split(":");let O;const U=T.findIndex(q=>q.startsWith("id="));return U!==-1&&(O=T[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:k}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,k){const T=b.split(";");for(let O=0;O<T.length&&!(k>=this._specialColors.length);++O,++k)if(T[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[k]}]);else{const U=(0,v.parseColor)(T[O]);U&&this._onColor.fire([{type:1,index:this._specialColors[k],color:U}])}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;const k=[],T=b.split(";");for(let O=0;O<T.length;++O)if(/^\d+$/.exec(T[O])){const U=parseInt(T[O]);$(U)&&k.push({type:2,index:U})}return k.length&&this._onColor.fire(k),!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,c.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(C[b[0]],c.CHARSETS[b[1]]||c.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){const 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=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.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(){const b=new s.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let k=0;k<this._bufferService.rows;++k){const T=this._activeBuffer.ybase+this._activeBuffer.y+k,O=this._activeBuffer.lines.get(T);O&&(O.fill(b),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,k){const T=this._bufferService.buffer,O=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${r.C0.ESC}${U}${r.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,k){this._dirtyRowTracker.markRangeDirty(b,k)}}t.InputHandler=I;let N=class{constructor(F){this._bufferService=F,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(F){F<this.start?this.start=F:F>this.end&&(this.end=F)}markRangeDirty(F,b){F>b&&(A=F,F=b,b=A),F<this.start&&(this.start=F),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function $(F){return 0<=F&&F<256}N=h([l(0,g.IBufferService)],N)},844:(M,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,r,c){this._data[l]||(this._data[l]={}),this._data[l][r]=c}get(l,r){return this._data[l]?this._data[l][r]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,r,c,f){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(r,c,f)}get(h,l,r,c){var f;return(f=this._data.get(h,l))==null?void 0:f.get(r,c)}clear(){this._data.clear()}}},6114:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(a=this._search(this._getKey(h)),this._array.splice(a,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const l=this._getKey(h);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,l){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let l=0,r=this._array.length-1;for(;r>=l;){let c=l+r>>1;const f=this._getKey(this._array[c]);if(f>h)r=c-1;else{if(!(f<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),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(f){this._idleCallback=void 0;let p=0,o=0,e=f.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),o=Math.max(p,o),n=f.timeRemaining(),1.5*o>n)return e-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-p))}ms`),void this._start();e=n}this.clear()}}class r extends l{_requestCallback(f){return setTimeout(()=>f(this._createDeadline(16)))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const p=Date.now()+f;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}t.PriorityTaskQueue=r,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:r,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(l){const r=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=r==null?void 0:r.get(l.cols-1),f=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);f&&c&&(f.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(r){return[r>>>16&255,r>>>8&255,255&r]}static fromColorRGB(r){return(255&r[0])<<16|(255&r[1])<<8|255&r[2]}clone(){const r=new a;return r.fg=this.fg,r.bg=this.bg,r.extended=this.extended.clone(),r}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}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(r){this._ext=r}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(r){this._ext&=-469762049,this._ext|=r<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(r){this._ext&=-67108864,this._ext|=67108863&r}get urlId(){return this._urlId}set urlId(r){this._urlId=r}get underlineVariantOffset(){const r=(3758096384&this._ext)>>29;return r<0?4294967288^r:r}set underlineVariantOffset(r){this._ext&=536870911,this._ext|=r<<29&3758096384}constructor(r=0,c=0){this._ext=0,this._urlId=0,this._ext=r,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),r=a(3734),c=a(8437),f=a(4634),p=a(511),o=a(643),e=a(4863),n=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,s,d){this._hasScrollback=i,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=c.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=p.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=p.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new r.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new r.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,s){return new c.BufferLine(this._bufferService.cols,this.getNullCell(i),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const s=i+this._optionsService.rawOptions.scrollback;return s>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:s}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,s){const d=this.getNullCell(c.DEFAULT_ATTR_DATA);let g=0;const _=this._getCorrectBufferLength(s);if(_>this.lines.maxLength&&(this.lines.maxLength=_),this.lines.length>0){if(this._cols<i)for(let u=0;u<this.lines.length;u++)g+=+this.lines.get(u).resize(i,d);let S=0;if(this._rows<s)for(let u=this._rows;u<s;u++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new c.BufferLine(i,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,d)));else for(let u=this._rows;u>s;u--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(_<this.lines.maxLength){const u=this.lines.length-_;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=_}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,s-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(i,s),this._cols>i))for(let S=0;S<this.lines.length;S++)g+=+this.lines.get(S).resize(i,d);this._cols=i,this._rows=s,this._memoryCleanupQueue.clear(),g>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,s){this._cols!==i&&(i>this._cols?this._reflowLarger(i,s):this._reflowSmaller(i,s))}_reflowLarger(i,s){const d=(0,f.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(d.length>0){const g=(0,f.reflowLargerCreateNewLayout)(this.lines,d);(0,f.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(i,s,g.countRemoved)}}_reflowLargerAdjustViewport(i,s,d){const g=this.getNullCell(c.DEFAULT_ATTR_DATA);let _=d;for(;_-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new c.BufferLine(i,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(i,s){const d=this.getNullCell(c.DEFAULT_ATTR_DATA),g=[];let _=0;for(let S=this.lines.length-1;S>=0;S--){let u=this.lines.get(S);if(!u||!u.isWrapped&&u.getTrimmedLength()<=i)continue;const v=[u];for(;u.isWrapped&&S>0;)u=this.lines.get(--S),v.unshift(u);const C=this.ybase+this.y;if(C>=S&&C<S+v.length)continue;const x=v[v.length-1].getTrimmedLength(),w=(0,f.reflowSmallerGetNewLineLengths)(v,this._cols,i),E=w.length-v.length;let A;A=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+E):Math.max(0,this.lines.length-this.lines.maxLength+E);const I=[];for(let T=0;T<E;T++){const O=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);I.push(O)}I.length>0&&(g.push({start:S+v.length+_,newLines:I}),_+=I.length),v.push(...I);let N=w.length-1,$=w[N];$===0&&(N--,$=w[N]);let F=v.length-E-1,b=x;for(;F>=0;){const T=Math.min(b,$);if(v[N]===void 0)break;if(v[N].copyCellsFrom(v[F],b-T,$-T,T,!0),$-=T,$===0&&(N--,$=w[N]),b-=T,b===0){F--;const O=Math.max(F,0);b=(0,f.getWrappedLineTrimmedLength)(v,O,this._cols)}}for(let T=0;T<v.length;T++)w[T]<i&&v[T].setCell(w[T],d);let k=E-A;for(;k-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+_)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+E,this.ybase+s-1)}if(g.length>0){const S=[],u=[];for(let N=0;N<this.lines.length;N++)u.push(this.lines.get(N));const v=this.lines.length;let C=v-1,x=0,w=g[x];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+_);let E=0;for(let N=Math.min(this.lines.maxLength-1,v+_-1);N>=0;N--)if(w&&w.start>C+E){for(let $=w.newLines.length-1;$>=0;$--)this.lines.set(N--,w.newLines[$]);N++,S.push({index:C+1,amount:w.newLines.length}),E+=w.newLines.length,w=g[++x]}else this.lines.set(N,u[C--]);let A=0;for(let N=S.length-1;N>=0;N--)S[N].index+=A,this.lines.onInsertEmitter.fire(S[N]),A+=S[N].amount;const I=Math.max(0,v+_-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(i,s,d=0,g){const _=this.lines.get(i);return _?_.translateToString(s,d,g):""}getWrappedRangeForLine(i){let s=i,d=i;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===i&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const s=new e.Marker(i);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),l=a(511),r=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let f=0;class p{constructor(e,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=n||l.CellData.fromCharData([0,r.NULL_CELL_CHAR,r.NULL_CELL_WIDTH,r.NULL_CELL_CODE]);for(let d=0;d<e;++d)this.setCell(d,s);this.length=e}get(e){const n=this._data[3*e+0],i=2097151&n;return[this._data[3*e+1],2097152&n?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",n>>22,2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,n){this._data[3*e+1]=n[r.CHAR_DATA_ATTR_INDEX],n[r.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=n[1],this._data[3*e+0]=2097152|e|n[r.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=n[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[r.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&n}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e]:2097151&n?(0,c.stringFromCodePoint)(2097151&n):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,n){return f=3*e,n.content=this._data[f+0],n.fg=this._data[f+1],n.bg=this._data[f+2],2097152&n.content&&(n.combinedData=this._combined[e]),268435456&n.bg&&(n.extended=this._extendedAttrs[e]),n}setCell(e,n){2097152&n.content&&(this._combined[e]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=n.content,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}setCellFromCodepoint(e,n,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=n|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,n,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,c.stringFromCodePoint)(n):2097151&s?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&s)+(0,c.stringFromCodePoint)(n),s&=-2097152,s|=2097152):s=n|4194304,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,n,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length-e){const s=new l.CellData;for(let d=this.length-e-n-1;d>=0;--d)this.setCell(e+n+d,this.loadCell(e+d,s));for(let d=0;d<n;++d)this.setCell(e+d,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,n,i){if(e%=this.length,n<this.length-e){const s=new l.CellData;for(let d=0;d<this.length-e-n;++d)this.setCell(e+d,this.loadCell(e+n+d,s));for(let d=this.length-n;d<this.length;++d)this.setCell(d,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,n,i,s=!1){if(s)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);e<n&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);e<n&&e<this.length;)this.setCell(e++,i)}resize(e,n){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,i);const s=Object.keys(this._combined);for(let g=0;g<s.length;g++){const _=parseInt(s[g],10);_>=e&&delete this._combined[_]}const d=Object.keys(this._extendedAttrs);for(let g=0;g<d.length;g++){const _=parseInt(d[g],10);_>=e&&delete this._extendedAttrs[_]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,n=!1){if(n)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const n in e._combined)this._combined[n]=e._combined[n];this._extendedAttrs={};for(const n in e._extendedAttrs)this._extendedAttrs[n]=e._extendedAttrs[n];this.isWrapped=e.isWrapped}clone(){const e=new p(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const n in this._combined)e._combined[n]=this._combined[n];for(const n in this._extendedAttrs)e._extendedAttrs[n]=this._extendedAttrs[n];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,n,i,s,d){const g=e._data;if(d)for(let S=s-1;S>=0;S--){for(let u=0;u<3;u++)this._data[3*(i+S)+u]=g[3*(n+S)+u];268435456&g[3*(n+S)+2]&&(this._extendedAttrs[i+S]=e._extendedAttrs[n+S])}else for(let S=0;S<s;S++){for(let u=0;u<3;u++)this._data[3*(i+S)+u]=g[3*(n+S)+u];268435456&g[3*(n+S)+2]&&(this._extendedAttrs[i+S]=e._extendedAttrs[n+S])}const _=Object.keys(e._combined);for(let S=0;S<_.length;S++){const u=parseInt(_[S],10);u>=n&&(this._combined[u-n+i]=e._combined[u])}}translateToString(e,n,i,s){n=n??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;n<i;){const g=this._data[3*n+0],_=2097151&g,S=2097152&g?this._combined[n]:_?(0,c.stringFromCodePoint)(_):r.WHITESPACE_CELL_CHAR;if(d+=S,s)for(let u=0;u<S.length;++u)s.push(n);n+=g>>22||1}return s&&s.push(n),d}}t.BufferLine=p},4841:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,h){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return h*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(M,t)=>{function a(h,l,r){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(r-1)&&h[l].getWidth(r-1)===1,f=h[l+1].getWidth(0)===2;return c&&f?r-1:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,r,c,f){const p=[];for(let o=0;o<h.length-1;o++){let e=o,n=h.get(++e);if(!n.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&n.isWrapped;)i.push(n),n=h.get(++e);if(c>=o&&c<e){o+=i.length-1;continue}let s=0,d=a(i,s,l),g=1,_=0;for(;g<i.length;){const u=a(i,g,l),v=u-_,C=r-d,x=Math.min(v,C);i[s].copyCellsFrom(i[g],_,d,x,!1),d+=x,d===r&&(s++,d=0),_+=x,_===u&&(g++,_=0),d===0&&s!==0&&i[s-1].getWidth(r-1)===2&&(i[s].copyCellsFrom(i[s-1],r-1,d++,1,!1),i[s-1].setCell(r-1,f))}i[s].replaceCells(d,r,f);let S=0;for(let u=i.length-1;u>0&&(u>s||i[u].getTrimmedLength()===0);u--)S++;S>0&&(p.push(o+i.length-S),p.push(S)),o+=i.length-1}return p},t.reflowLargerCreateNewLayout=function(h,l){const r=[];let c=0,f=l[c],p=0;for(let o=0;o<h.length;o++)if(f===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-p,amount:e}),o+=e-1,p+=e,f=l[++c]}else r.push(o);return{layout:r,countRemoved:p}},t.reflowLargerApplyNewLayout=function(h,l){const r=[];for(let c=0;c<l.length;c++)r.push(h.get(l[c]));for(let c=0;c<r.length;c++)h.set(c,r[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,r){const c=[],f=h.map((n,i)=>a(h,i,l)).reduce((n,i)=>n+i);let p=0,o=0,e=0;for(;e<f;){if(f-e<r){c.push(f-e);break}p+=r;const n=a(h,o,l);p>n&&(p-=n,o++);const i=h[o].getWidth(p-1)===2;i&&p--;const s=i?r-1:r;c.push(s),e+=s}return c},t.getWrappedLineTrimmedLength=a},5295:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),l=a(844),r=a(9092);class c extends l.Disposable{constructor(p,o){super(),this._optionsService=p,this._bufferService=o,this._onBufferActivate=this.register(new h.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 r.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new r.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(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),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(p,o){this._normal.resize(p,o),this._alt.resize(p,o),this.setupTabStops(p)}setupTabStops(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)}}t.BufferSet=c},511:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),r=a(3734);class c extends r.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new r.ExtendedAttrs,this.combinedData=""}static fromCharData(p){const o=new c;return o.setFromCharData(p),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(p[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(p[l.CHAR_DATA_CHAR_INDEX].length===2){const e=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|p[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=p[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},643:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),l=a(844);class r{get id(){return this._id}constructor(f){this.line=f,this.isDisposed=!1,this._disposables=[],this._id=r._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(f){return this._disposables.push(f),f}}t.Marker=r,r._nextId=1},7116:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(M,t)=>{var a,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(r){r.NUL="\0",r.SOH="",r.STX="",r.ETX="",r.EOT="",r.ENQ="",r.ACK="",r.BEL="\x07",r.BS="\b",r.HT=" ",r.LF=`
|
|
8
|
-
`,r.VT="\v",r.FF="\f",r.CR="\r",r.SO="",r.SI="",r.DLE="",r.DC1="",r.DC2="",r.DC3="",r.DC4="",r.NAK="",r.SYN="",r.ETB="",r.CAN="",r.EM="",r.SUB="",r.ESC="\x1B",r.FS="",r.GS="",r.RS="",r.US="",r.SP=" ",r.DEL=""}(a||(t.C0=a={})),function(r){r.PAD="",r.HOP="",r.BPH="",r.NBH="",r.IND="",r.NEL="
",r.SSA="",r.ESA="",r.HTS="",r.HTJ="",r.VTS="",r.PLD="",r.PLU="",r.RI="",r.SS2="",r.SS3="",r.DCS="",r.PU1="",r.PU2="",r.STS="",r.CCH="",r.MW="",r.SPA="",r.EPA="",r.SOS="",r.SGCI="",r.SCI="",r.CSI="",r.ST="",r.OSC="",r.PM="",r.APC=""}(h||(t.C1=h={})),function(r){r.ST=`${a.ESC}\\`}(l||(t.C1_ESCAPED=l={}))},7399:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),l={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:["'",'"']};t.evaluateKeyboardEvent=function(r,c,f,p){const o={type:0,cancel:!1,key:void 0},e=(r.shiftKey?1:0)|(r.altKey?2:0)|(r.ctrlKey?4:0)|(r.metaKey?8:0);switch(r.keyCode){case 0:r.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":r.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":r.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":r.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=r.ctrlKey?"\b":h.C0.DEL,r.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(r.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=r.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,r.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(r.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(f?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(r.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(f?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(r.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",f||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(r.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",f||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:r.shiftKey||r.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":c?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":c?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:r.shiftKey?o.type=2:r.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:r.shiftKey?o.type=3:r.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!r.ctrlKey||r.shiftKey||r.altKey||r.metaKey)if(f&&!p||!r.altKey||r.metaKey)!f||r.altKey||r.ctrlKey||r.shiftKey||!r.metaKey?r.key&&!r.ctrlKey&&!r.altKey&&!r.metaKey&&r.keyCode>=48&&r.key.length===1?o.key=r.key:r.key&&r.ctrlKey&&(r.key==="_"&&(o.key=h.C0.US),r.key==="@"&&(o.key=h.C0.NUL)):r.keyCode===65&&(o.type=1);else{const n=l[r.keyCode],i=n==null?void 0:n[r.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(r.keyCode>=65&&r.keyCode<=90){const s=r.ctrlKey?r.keyCode-64:r.keyCode+32;let d=String.fromCharCode(s);r.shiftKey&&(d=d.toUpperCase()),o.key=h.C0.ESC+d}else if(r.keyCode===32)o.key=h.C0.ESC+(r.ctrlKey?h.C0.NUL:" ");else if(r.key==="Dead"&&r.code.startsWith("Key")){let s=r.code.slice(3,4);r.shiftKey||(s=s.toLowerCase()),o.key=h.C0.ESC+s,o.cancel=!0}}else r.keyCode>=65&&r.keyCode<=90?o.key=String.fromCharCode(r.keyCode-64):r.keyCode===32?o.key=h.C0.NUL:r.keyCode>=51&&r.keyCode<=55?o.key=String.fromCharCode(r.keyCode-51+27):r.keyCode===56?o.key=h.C0.DEL:r.keyCode===219?o.key=h.C0.ESC:r.keyCode===220?o.key=h.C0.FS:r.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let r="";for(let c=h;c<l;++c){let f=a[c];f>65535?(f-=65536,r+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):r+=String.fromCharCode(f)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let r=0,c=0;if(this._interim){const f=a.charCodeAt(c++);56320<=f&&f<=57343?h[r++]=1024*(this._interim-55296)+f-56320+65536:(h[r++]=this._interim,h[r++]=f),this._interim=0}for(let f=c;f<l;++f){const p=a.charCodeAt(f);if(55296<=p&&p<=56319){if(++f>=l)return this._interim=p,r;const o=a.charCodeAt(f);56320<=o&&o<=57343?h[r++]=1024*(p-55296)+o-56320+65536:(h[r++]=p,h[r++]=o)}else p!==65279&&(h[r++]=p)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let r,c,f,p,o=0,e=0,n=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,S=0;for(;(_=63&this.interim[++S])&&S<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-S;for(;n<v;){if(n>=l)return 0;if(_=a[n++],(192&_)!=128){n--,d=!0;break}this.interim[S++]=_,g<<=6,g|=63&_}d||(u===2?g<128?n--:h[o++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[o++]=g):g<65536||g>1114111||(h[o++]=g)),this.interim.fill(0)}const i=l-4;let s=n;for(;s<l;){for(;!(!(s<i)||128&(r=a[s])||128&(c=a[s+1])||128&(f=a[s+2])||128&(p=a[s+3]));)h[o++]=r,h[o++]=c,h[o++]=f,h[o++]=p,s+=4;if(r=a[s++],r<128)h[o++]=r;else if((224&r)==192){if(s>=l)return this.interim[0]=r,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&r)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&r)==224){if(s>=l)return this.interim[0]=r,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=r,this.interim[1]=c,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(15&r)<<12|(63&c)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&r)==240){if(s>=l)return this.interim[0]=r,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=r,this.interim[1]=c,o;if(f=a[s++],(192&f)!=128){s--;continue}if(s>=l)return this.interim[0]=r,this.interim[1]=c,this.interim[2]=f,o;if(p=a[s++],(192&p)!=128){s--;continue}if(e=(7&r)<<18|(63&c)<<12|(63&f)<<6|63&p,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),l=[[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]],r=[[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]];let c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let f=0;f<l.length;++f)c.fill(0,l[f][0],l[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?c[f]:function(p,o){let e,n=0,i=o.length-1;if(p<o[0][0]||p>o[i][1])return!1;for(;i>=n;)if(e=n+i>>1,p>o[e][1])n=e+1;else{if(!(p<o[e][0]))return!0;i=e-1}return!1}(f,r)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1}charProperties(f,p){let o=this.wcwidth(f),e=o===0&&p!==0;if(e){const n=h.UnicodeService.extractWidth(p);n===0?e=!1:n>o&&(o=n)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),l=a(844);class r extends l.Disposable{constructor(f){super(),this._action=f,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(f,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(f,p){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+=f.length,this._writeBuffer.push(f),this._callbacks.push(p),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(p)}_innerWrite(f=0,p=!0){const o=f||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],n=this._action(e,p);if(n){const s=d=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(o,d);return void n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=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()}}t.WriteBuffer=r},5941:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const a=/^([\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})$/,h=/^[\da-f]+$/;function l(r,c){const f=r.toString(16),p=f.length<2?"0"+f:f;switch(c){case 4:return f[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}t.parseColor=function(r){if(!r)return;let c=r.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const f=a.exec(c);if(f){const p=f[1]?15:f[4]?255:f[7]?4095:65535;return[Math.round(parseInt(f[1]||f[4]||f[7]||f[10],16)/p*255),Math.round(parseInt(f[2]||f[5]||f[8]||f[11],16)/p*255),Math.round(parseInt(f[3]||f[6]||f[9]||f[12],16)/p*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const f=c.length/3,p=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(f*o,f*o+f),16);p[o]=f===1?e<<4:f===2?e:f===3?e>>4:e>>8}return p}},t.toRgbString=function(r,c=16){const[f,p,o]=r;return`rgb:${l(f,c)}/${l(p,c)}/${l(o,c)}`}},5770:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),l=a(8742),r=a(5770),c=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=c,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}registerHandler(p,o){this._handlers[p]===void 0&&(this._handlers[p]=[]);const e=this._handlers[p];return e.push(o),{dispose:()=>{const n=e.indexOf(o);n!==-1&&e.splice(n,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=c,this._ident=0}hook(p,o){if(this.reset(),this._ident=p,this._active=this._handlers[p]||c,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(p,o,e){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(p,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(p,o,e))}unhook(p,o=!0){if(this._active.length){let e=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;n>=0&&(e=this._active[n].unhook(p),e!==!0);n--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,e;n--}for(;n>=0;n--)if(e=this._active[n].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",p);this._active=c,this._ident=0}};const f=new l.Params;f.addParam(0),t.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=f,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():f,this._data="",this._hitLimit=!1}put(p,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(p,o,e),this._data.length>r.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let o=!1;if(this._hitLimit)o=!1;else if(p&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=f,this._data="",this._hitLimit=!1,e));return this._params=f,this._data="",this._hitLimit=!1,o}}},2015:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=a(844),l=a(8742),r=a(6242),c=a(6351);class f{constructor(n){this.table=new Uint8Array(n)}setDefault(n,i){this.table.fill(n<<4|i)}add(n,i,s,d){this.table[i<<8|n]=s<<4|d}addMany(n,i,s,d){for(let g=0;g<n.length;g++)this.table[i<<8|n[g]]=s<<4|d}}t.TransitionTable=f;const p=160;t.VT500_TRANSITION_TABLE=function(){const e=new f(4095),n=Array.apply(null,Array(256)).map((S,u)=>u),i=(S,u)=>n.slice(S,u),s=i(32,127),d=i(0,24);d.push(25),d.push.apply(d,i(28,32));const g=i(0,14);let _;for(_ in e.setDefault(1,0),e.addMany(s,0,2,0),g)e.addMany([24,26,153,154],_,3,0),e.addMany(i(128,144),_,3,0),e.addMany(i(144,152),_,3,0),e.add(156,_,0,0),e.add(27,_,11,1),e.add(157,_,4,8),e.addMany([152,158,159],_,0,7),e.add(155,_,11,3),e.add(144,_,11,9);return e.addMany(d,0,3,0),e.addMany(d,1,3,1),e.add(127,1,0,1),e.addMany(d,8,0,8),e.addMany(d,3,3,3),e.add(127,3,0,3),e.addMany(d,4,3,4),e.add(127,4,0,4),e.addMany(d,6,3,6),e.addMany(d,5,3,5),e.add(127,5,0,5),e.addMany(d,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(d,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(d,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(d,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(d,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(d,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(d,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(p,0,2,0),e.add(p,8,5,8),e.add(p,6,0,6),e.add(p,11,0,11),e.add(p,13,13,13),e}();class o extends h.Disposable{constructor(n=t.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,d)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,s)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new r.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,i=[64,126]){let s=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=n.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<n.intermediates.length;++g){const _=n.intermediates.charCodeAt(g);if(32>_||_>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=_}}if(n.final.length!==1)throw new Error("final must be a single byte");const d=n.final.charCodeAt(0);if(i[0]>d||d>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=d,s}identToString(n){const i=[];for(;n;)i.push(String.fromCharCode(255&n)),n>>=8;return i.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,i){const s=this._identifier(n,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,i){this._executeHandlers[n.charCodeAt(0)]=i}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,i){const s=this._identifier(n);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,i){return this._dcsParser.registerHandler(this._identifier(n),i)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,i){return this._oscParser.registerHandler(n,i)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,i,s,d,g){this._parseStack.state=n,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=g}parse(n,i,s){let d,g=0,_=0,S=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,S=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const u=this._parseStack.handlers;let v=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&v>-1){for(;v>=0&&(d=u[v](this._params),d!==!0);v--)if(d instanceof Promise)return this._parseStack.handlerPos=v,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&v>-1){for(;v>=0&&(d=u[v](),d!==!0);v--)if(d instanceof Promise)return this._parseStack.handlerPos=v,d}this._parseStack.handlers=[];break;case 6:if(g=n[this._parseStack.chunkPos],d=this._dcsParser.unhook(g!==24&&g!==26,s),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=n[this._parseStack.chunkPos],d=this._oscParser.end(g!==24&&g!==26,s),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,S=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=S;u<i;++u){switch(g=n[u],_=this._transitions.table[this.currentState<<8|(g<160?g:p)],_>>4){case 2:for(let E=u+1;;++E){if(E>=i||(g=n[E])<32||g>126&&g<p){this._printHandler(n,u,E),u=E-1;break}if(++E>=i||(g=n[E])<32||g>126&&g<p){this._printHandler(n,u,E),u=E-1;break}if(++E>=i||(g=n[E])<32||g>126&&g<p){this._printHandler(n,u,E),u=E-1;break}if(++E>=i||(g=n[E])<32||g>126&&g<p){this._printHandler(n,u,E),u=E-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const v=this._csiHandlers[this._collect<<8|g];let C=v?v.length-1:-1;for(;C>=0&&(d=v[C](this._params),d!==!0);C--)if(d instanceof Promise)return this._preserveStack(3,v,C,_,u),d;C<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++u<i&&(g=n[u])>47&&g<60);u--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const x=this._escHandlers[this._collect<<8|g];let w=x?x.length-1:-1;for(;w>=0&&(d=x[w](),d!==!0);w--)if(d instanceof Promise)return this._preserveStack(4,x,w,_,u),d;w<0&&this._escHandlerFb(this._collect<<8|g),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|g,this._params);break;case 13:for(let E=u+1;;++E)if(E>=i||(g=n[E])===24||g===26||g===27||g>127&&g<p){this._dcsParser.put(n,u,E),u=E-1;break}break;case 14:if(d=this._dcsParser.unhook(g!==24&&g!==26),d)return this._preserveStack(6,[],0,_,u),d;g===27&&(_|=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 E=u+1;;E++)if(E>=i||(g=n[E])<32||g>127&&g<p){this._oscParser.put(n,u,E),u=E-1;break}break;case 6:if(d=this._oscParser.end(g!==24&&g!==26),d)return this._preserveStack(5,[],0,_,u),d;g===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&_}}}t.EscapeSequenceParser=o},6242:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),r=[];t.OscParser=class{constructor(){this._state=0,this._active=r,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,f){this._handlers[c]===void 0&&(this._handlers[c]=[]);const p=this._handlers[c];return p.push(f),{dispose:()=>{const o=p.indexOf(f);o!==-1&&p.splice(o,1)}}}clearHandler(c){this._handlers[c]&&delete this._handlers[c]}setHandlerFallback(c){this._handlerFb=c}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=r}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=r,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||r,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,f,p){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,f,p);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,f,p))}start(){this.reset(),this._state=1}put(c,f,p){if(this._state!==3){if(this._state===1)for(;f<p;){const o=c[f++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&p-f>0&&this._put(c,f,p)}}end(c,f=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,p=f,e=this._stack.fallThrough,this._stack.paused=!1),!e&&p===!1){for(;o>=0&&(p=this._active[o].end(c),p!==!0);o--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,p;o--}for(;o>=0;o--)if(p=this._active[o].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",c);this._active=r,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,f,p){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,f,p),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let f=!1;if(this._hitLimit)f=!1;else if(c&&(f=this._handler(this._data),f instanceof Promise))return f.then(p=>(this._data="",this._hitLimit=!1,p));return this._data="",this._hitLimit=!1,f}}},8742:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(r){const c=new h;if(!r.length)return c;for(let f=Array.isArray(r[0])?1:0;f<r.length;++f){const p=r[f];if(Array.isArray(p))for(let o=0;o<p.length;++o)c.addSubParam(p[o]);else c.addParam(p)}return c}constructor(r=32,c=32){if(this.maxLength=r,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(r),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(r),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const r=new h(this.maxLength,this.maxSubParamsLength);return r.params.set(this.params),r.length=this.length,r._subParams.set(this._subParams),r._subParamsLength=this._subParamsLength,r._subParamsIdx.set(this._subParamsIdx),r._rejectDigits=this._rejectDigits,r._rejectSubDigits=this._rejectSubDigits,r._digitIsSub=this._digitIsSub,r}toArray(){const r=[];for(let c=0;c<this.length;++c){r.push(this.params[c]);const f=this._subParamsIdx[c]>>8,p=255&this._subParamsIdx[c];p-f>0&&r.push(Array.prototype.slice.call(this._subParams,f,p))}return r}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(r){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(r<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=r>a?a:r}}addSubParam(r){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(r<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=r>a?a:r,this._subParamsIdx[this.length-1]++}}hasSubParams(r){return(255&this._subParamsIdx[r])-(this._subParamsIdx[r]>>8)>0}getSubParams(r){const c=this._subParamsIdx[r]>>8,f=255&this._subParamsIdx[r];return f-c>0?this._subParams.subarray(c,f):null}getSubParamsAll(){const r={};for(let c=0;c<this.length;++c){const f=this._subParamsIdx[c]>>8,p=255&this._subParamsIdx[c];p-f>0&&(r[c]=this._subParams.slice(f,p))}return r}addDigit(r){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const f=this._digitIsSub?this._subParams:this.params,p=f[c-1];f[c-1]=~p?Math.min(10*p+r,a):r}}t.Params=h},5741:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,h){const l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){h=l;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=a(511);t.BufferApiView=class{constructor(r,c){this._buffer=r,this.type=c}init(r){return this._buffer=r,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(r){const c=this._buffer.lines.get(r);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,r){if(!(l<0||l>=this._line.length))return r?(this._line.loadCell(l,r),r):this._line.loadCell(l,new h.CellData)}translateToString(l,r,c){return this._line.translateToString(l,r,c)}}},8285:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),r=a(844);class c extends r.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.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)}}t.BufferNamespaceApi=c},7975:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,l=>h(l.toArray()))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,(l,r)=>h(l,r.toArray()))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(M,t,a){var h=this&&this.__decorate||function(e,n,i,s){var d,g=arguments.length,_=g<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,n,i,s);else for(var S=e.length-1;S>=0;S--)(d=e[S])&&(_=(g<3?d(_):g>3?d(n,i,_):d(n,i))||_);return g>3&&_&&Object.defineProperty(n,i,_),_},l=this&&this.__param||function(e,n){return function(i,s){n(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const r=a(8460),c=a(844),f=a(5295),p=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends c.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new r.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new f.BufferSet(e,this))}resize(e,n){this.cols=e,this.rows=n,this.buffers.resize(e,n),this._onResize.fire({cols:e,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,n=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,n),this._cachedBlankLine=s),s.isWrapped=n;const d=i.ybase+i.scrollTop,g=i.ybase+i.scrollBottom;if(i.scrollTop===0){const _=i.lines.isFull;g===i.lines.length-1?_?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(g+1,0,s.clone()),_?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const _=g-d+1;i.lines.shiftElements(d+1,_-1,-1),i.lines.set(g,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,n,i){const s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),d!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}};t.BufferService=o=h([l(0,p.IOptionsService)],o)},7994:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,h){this._charsets[a]=h,this.glevel===a&&(this.charset=h)}}},1753:function(M,t,a){var h=this&&this.__decorate||function(s,d,g,_){var S,u=arguments.length,v=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,d,g,_);else for(var C=s.length-1;C>=0;C--)(S=s[C])&&(v=(u<3?S(v):u>3?S(d,g,v):S(d,g))||v);return u>3&&v&&Object.defineProperty(d,g,v),v},l=this&&this.__param||function(s,d){return function(g,_){d(g,_,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const r=a(2585),c=a(8460),f=a(844),p={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function o(s,d){let g=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(g|=64,g|=s.action):(g|=3&s.button,4&s.button&&(g|=64),8&s.button&&(g|=128),s.action===32?g|=32:s.action!==0||d||(g|=3)),g}const e=String.fromCharCode,n={DEFAULT:s=>{const d=[o(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${e(d[0])}${e(d[1])}${e(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${o(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${o(s,!0)};${s.x};${s.y}${d}`}};let i=t.CoreMouseService=class extends f.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new c.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const g of Object.keys(p))this.addProtocol(g,p[g]);for(const g of Object.keys(n))this.addEncoding(g,n[g]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,g){if(g){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};t.CoreMouseService=i=h([l(0,r.IBufferService),l(1,r.ICoreService)],i)},6975:function(M,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,S=arguments.length,u=S<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(S<3?_(u):S>3?_(s,d,u):_(s,d))||u);return S>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const r=a(1439),c=a(8460),f=a(844),p=a(2585),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=t.CoreService=class extends f.Disposable{constructor(i,s,d){super(),this._bufferService=i,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new c.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new c.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,r.clone)(o),this.decPrivateModes=(0,r.clone)(e)}reset(){this.modes=(0,r.clone)(o),this.decPrivateModes=(0,r.clone)(e)}triggerDataEvent(i,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(g=>g.charCodeAt(0))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,()=>i.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(i))}};t.CoreService=n=h([l(0,p.IBufferService),l(1,p.ILogService),l(2,p.IOptionsService)],n)},9074:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),r=a(844),c=a(6106);let f=0,p=0;class o extends r.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,r.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const s=new e(i);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())}),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,s,d){let g=0,_=0;for(const S of this._decorations.getKeyIterator(s))g=S.options.x??0,_=g+(S.options.width??1),i>=g&&i<_&&(!d||(S.options.layer??"bottom")===d)&&(yield S)}forEachDecorationAtCell(i,s,d,g){this._decorations.forEachByKey(s,_=>{f=_.options.x??0,p=f+(_.options.width??1),i>=f&&i<p&&(!d||(_.options.layer??"bottom")===d)&&g(_)})}}t.DecorationService=o;class e extends r.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class r{constructor(...f){this._entries=new Map;for(const[p,o]of f)this.set(p,o)}set(f,p){const o=this._entries.get(f);return this._entries.set(f,p),o}forEach(f){for(const[p,o]of this._entries.entries())f(p,o)}has(f){return this._entries.has(f)}get(f){return this._entries.get(f)}}t.ServiceCollection=r,t.InstantiationService=class{constructor(){this._services=new r,this._services.set(h.IInstantiationService,this)}setService(c,f){this._services.set(c,f)}getService(c){return this._services.get(c)}createInstance(c,...f){const p=(0,l.getServiceDependencies)(c).sort((n,i)=>n.index-i.index),o=[];for(const n of p){const i=this._services.get(n.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${n.id}.`);o.push(i)}const e=p.length>0?p[0].index:f.length;if(f.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${f.length} static arguments`);return new c(...f,...o)}}},7866:function(M,t,a){var h=this&&this.__decorate||function(e,n,i,s){var d,g=arguments.length,_=g<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,n,i,s);else for(var S=e.length-1;S>=0;S--)(d=e[S])&&(_=(g<3?d(_):g>3?d(n,i,_):d(n,i))||_);return g>3&&_&&Object.defineProperty(n,i,_),_},l=this&&this.__param||function(e,n){return function(i,s){n(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const r=a(844),c=a(2585),f={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let p,o=t.LogService=class extends r.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),p=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(e,...n){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,n)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){p=e},t.traceCall=function(e,n,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(p.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);p.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return p.trace(`GlyphRenderer#${s.name} return`,g),g}}},7302:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),r=a(6114);t.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:r.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class f extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const n in o)if(n in e)try{const i=o[n];e[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(n=>{n===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(n=>{o.indexOf(n)!==-1&&e()})}_setupOptions(){const o=n=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},e=(n,i)=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const i={get:o.bind(this,n),set:e.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(n){return n==="block"||n==="underline"||n==="bar"}(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[o];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${o} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${o} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=f},2660:function(M,t,a){var h=this&&this.__decorate||function(f,p,o,e){var n,i=arguments.length,s=i<3?p:e===null?e=Object.getOwnPropertyDescriptor(p,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(f,p,o,e);else for(var d=f.length-1;d>=0;d--)(n=f[d])&&(s=(i<3?n(s):i>3?n(p,o,s):n(p,o))||s);return i>3&&s&&Object.defineProperty(p,o,s),s},l=this&&this.__param||function(f,p){return function(o,e){p(o,e,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const r=a(2585);let c=t.OscLinkService=class{constructor(f){this._bufferService=f,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(f){const p=this._bufferService.buffer;if(f.id===void 0){const d=p.addMarker(p.ybase+p.y),g={data:f,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(g,d)),this._dataByLinkId.set(g.id,g),g.id}const o=f,e=this._getEntryIdKey(o),n=this._entriesWithId.get(e);if(n)return this.addLineToLink(n.id,p.ybase+p.y),n.id;const i=p.addMarker(p.ybase+p.y),s={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(f,p){const o=this._dataByLinkId.get(f);if(o&&o.lines.every(e=>e.line!==p)){const e=this._bufferService.buffer.addMarker(p);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(f){var p;return(p=this._dataByLinkId.get(f))==null?void 0:p.data}_getEntryIdKey(f){return`${f.id};;${f.uri}`}_removeMarkerFromLink(f,p){const o=f.lines.indexOf(p);o!==-1&&(f.lines.splice(o,1),f.lines.length===0&&(f.data.id!==void 0&&this._entriesWithId.delete(f.key),this._dataByLinkId.delete(f.id)))}};t.OscLinkService=c=h([l(0,r.IBufferService)],c)},8343:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const r=function(c,f,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,n){e[a]===e?e[h].push({id:o,index:n}):(e[h]=[{id:o,index:n}],e[a]=e)})(r,c,p)};return r.toString=()=>l,t.serviceRegistry.set(l,r),r}},2585:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(8343);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(r){r[r.TRACE=0]="TRACE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=a(225);class r{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,p,o=!1){return(16777215&f)<<3|(3&p)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const f=new l.UnicodeV6;this.register(f),this._active=f.version,this._activeProvider=f}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(f){if(!this._providers[f])throw new Error(`unknown Unicode version "${f}"`);this._active=f,this._activeProvider=this._providers[f],this._onChange.fire(f)}register(f){this._providers[f.version]=f}wcwidth(f){return this._activeProvider.wcwidth(f)}getStringCellWidth(f){let p=0,o=0;const e=f.length;for(let n=0;n<e;++n){let i=f.charCodeAt(n);if(55296<=i&&i<=56319){if(++n>=e)return p+this.wcwidth(i);const g=f.charCodeAt(n);56320<=g&&g<=57343?i=1024*(i-55296)+g-56320+65536:p+=this.wcwidth(g)}const s=this.charProperties(i,o);let d=r.extractWidth(s);r.extractShouldJoin(s)&&(d-=r.extractWidth(o)),p+=d,o=s}return p}charProperties(f,p){return this._activeProvider.charProperties(f,p)}}t.UnicodeService=r}},D={};function B(M){var t=D[M];if(t!==void 0)return t.exports;var a=D[M]={exports:{}};return L[M].call(a.exports,a,a.exports,B),a.exports}var H={};return(()=>{var M=H;Object.defineProperty(M,"__esModule",{value:!0}),M.Terminal=void 0;const t=B(9042),a=B(3236),h=B(844),l=B(5741),r=B(8285),c=B(7975),f=B(7090),p=["cols","rows"];class o extends h.Disposable{constructor(n){super(),this._core=this.register(new a.Terminal(n)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=d=>this._core.options[d],s=(d,g)=>{this._checkReadonlyOptions(d),this._core.options[d]=g};for(const d in this._core.options){const g={get:i.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,g)}}_checkReadonlyOptions(n){if(p.includes(n))throw new Error(`Option "${n}" 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 c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.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 r.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const i in n)this._publicOptions[i]=n[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,i=!0){this._core.input(n,i)}resize(n,i){this._verifyIntegers(n,i),this._core.resize(n,i)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,i,s){this._verifyIntegers(n,i,s),this._core.select(n,i,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,i){this._verifyIntegers(n,i),this._core.selectLines(n,i)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,i){this._core.write(n,i)}writeln(n,i){this._core.write(n),this._core.write(`\r
|
|
9
|
-
`,i)}paste(n){this._core.paste(n)}refresh(n,i){this._verifyIntegers(n,i),this._core.refresh(n,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const i of n)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const i of n)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}M.Terminal=
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.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){const v=this._getMouseBufferCoords(u),C=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!!(C&&x&&v)&&this._areCoordsInSelection(v,C,x)}isCellInSelection(u,v){const C=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!C||!x)&&this._areCoordsInSelection([u,v],C,x)}_areCoordsInSelection(u,v,C){return u[1]>v[1]&&u[1]<C[1]||v[1]===C[1]&&u[1]===v[1]&&u[0]>=v[0]&&u[0]<C[0]||v[1]<C[1]&&u[1]===C[1]&&u[0]<C[0]||v[1]<C[1]&&u[1]===v[1]&&u[0]>=v[0]}_selectWordAtCursor(u,v){var y,L;const C=(L=(y=this._linkifier.currentLink)==null?void 0:y.link)==null?void 0:L.range;if(C)return this._model.selectionStart=[C.start.x-1,C.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(C,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const x=this._getMouseBufferCoords(u);return!!x&&(this._selectWordAt(x,v),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,v){this._model.clearSelection(),u=Math.max(u,0),v=Math.min(v,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,v],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){const v=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(v)return v[0]--,v[1]--,v[1]+=this._bufferService.buffer.ydisp,v}_getMouseEventScrollAmount(u){let v=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const C=this._renderService.dimensions.css.canvas.height;return v>=0&&v<=C?0:(v>C&&(v-=C),v=Math.min(Math.max(v,-50),50),v/=50,v/Math.abs(v)+Math.round(14*v))}shouldForceSelection(u){return n.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;const v=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);v&&v.length!==this._model.selectionStart[0]&&v.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){const v=this._getMouseBufferCoords(u);v&&(this._activeSelectionMode=2,this._selectLineAt(v[1]))}shouldColumnSelect(u){return u.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;const v=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));const C=this._bufferService.buffer;if(this._model.selectionEnd[1]<C.lines.length){const x=C.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]++}v&&v[0]===this._model.selectionEnd[0]&&v[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});const 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){const v=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&v<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const C=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(C&&C[0]!==void 0&&C[1]!==void 0){const x=(0,c.moveToCellSequence)(C[0]-1,C[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd,C=!(!u||!v||u[0]===v[0]&&u[1]===v[1]);C?u&&v&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&v[0]===this._oldSelectionEnd[0]&&v[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,v,C)):this._oldHasSelection&&this._fireOnSelectionChange(u,v,C)}_fireOnSelectionChange(u,v,C){this._oldSelectionStart=u,this._oldSelectionEnd=v,this._oldHasSelection=C,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim(v=>this._handleTrim(v))}_convertViewportColToCharacterIndex(u,v){let C=v;for(let x=0;v>=x;x++){const y=u.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?C--:y>1&&v!==x&&(C+=y-1)}return C}setSelection(u,v,C){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,v],this._model.selectionStartLength=C,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,v,C=!0,x=!0){if(u[0]>=this._bufferService.cols)return;const y=this._bufferService.buffer,L=y.lines.get(u[1]);if(!L)return;const A=y.translateBufferLineToString(u[1],!1);let I=this._convertViewportColToCharacterIndex(L,u[0]),N=I;const $=u[0]-I;let F=0,b=0,k=0,T=0;if(A.charAt(I)===" "){for(;I>0&&A.charAt(I-1)===" ";)I--;for(;N<A.length&&A.charAt(N+1)===" ";)N++}else{let q=u[0],Y=u[0];L.getWidth(q)===0&&(F++,q--),L.getWidth(Y)===2&&(b++,Y++);const V=L.getString(Y).length;for(V>1&&(T+=V-1,N+=V-1);q>0&&I>0&&!this._isCharWordSeparator(L.loadCell(q-1,this._workCell));){L.loadCell(q-1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,q--):P>1&&(k+=P-1,I-=P-1),I--,q--}for(;Y<L.length&&N+1<A.length&&!this._isCharWordSeparator(L.loadCell(Y+1,this._workCell));){L.loadCell(Y+1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):P>1&&(T+=P-1,N+=P-1),N++,Y++}}N++;let O=I+$-F+k,U=Math.min(this._bufferService.cols,N-I+F+b-k-T);if(v||A.slice(I,N).trim()!==""){if(C&&O===0&&L.getCodePoint(0)!==32){const q=y.lines.get(u[1]-1);if(q&&L.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(Y){const V=this._bufferService.cols-Y.start;O-=V,U+=V}}}if(x&&O+U===this._bufferService.cols&&L.getCodePoint(this._bufferService.cols-1)!==32){const q=y.lines.get(u[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:O,length:U}}}_selectWordAt(u,v){const C=this._getWordAt(u,v);if(C){for(;C.start<0;)C.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[C.start,u[1]],this._model.selectionStartLength=C.length}}_selectToWordAt(u){const v=this._getWordAt(u,!0);if(v){let C=u[1];for(;v.start<0;)v.start+=this._bufferService.cols,C--;if(!this._model.areSelectionValuesReversed())for(;v.start+v.length>this._bufferService.cols;)v.length-=this._bufferService.cols,C++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?v.start:v.start+v.length,C]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){const v=this._bufferService.buffer.getWrappedRangeForLine(u),C={start:{x:0,y:v.first},end:{x:this._bufferService.cols-1,y:v.last}};this._model.selectionStart=[0,v.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(C,this._bufferService.cols)}};t.SelectionService=S=h([l(3,d.IBufferService),l(4,d.ICoreService),l(5,p.IMouseService),l(6,d.IOptionsService),l(7,p.IRenderService),l(8,p.ICoreBrowserService)],S)},4725:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const h=o(8343);t.ICharSizeService=(0,h.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),t.IMouseService=(0,h.createDecorator)("MouseService"),t.IRenderService=(0,h.createDecorator)("RenderService"),t.ISelectionService=(0,h.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,h.createDecorator)("ThemeService"),t.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(M,t,o){var h=this&&this.__decorate||function(S,u,v,C){var x,y=arguments.length,L=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,u,v,C);else for(var A=S.length-1;A>=0;A--)(x=S[A])&&(L=(y<3?x(L):y>3?x(u,v,L):x(u,v))||L);return y>3&&L&&Object.defineProperty(u,v,L),L},l=this&&this.__param||function(S,u){return function(v,C){u(v,C,S)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const s=o(7239),c=o(8055),f=o(8460),p=o(844),a=o(2585),e=c.css.toColor("#ffffff"),n=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),r=c.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const S=[c.css.toColor("#2e3436"),c.css.toColor("#cc0000"),c.css.toColor("#4e9a06"),c.css.toColor("#c4a000"),c.css.toColor("#3465a4"),c.css.toColor("#75507b"),c.css.toColor("#06989a"),c.css.toColor("#d3d7cf"),c.css.toColor("#555753"),c.css.toColor("#ef2929"),c.css.toColor("#8ae234"),c.css.toColor("#fce94f"),c.css.toColor("#729fcf"),c.css.toColor("#ad7fa8"),c.css.toColor("#34e2e2"),c.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let v=0;v<216;v++){const C=u[v/36%6|0],x=u[v/6%6|0],y=u[v%6];S.push({css:c.channels.toCss(C,x,y),rgba:c.channels.toRgba(C,x,y)})}for(let v=0;v<24;v++){const C=8+10*v;S.push({css:c.channels.toCss(C,C,C),rgba:c.channels.toRgba(C,C,C)})}return S})());let g=t.ThemeService=class extends p.Disposable{get colors(){return this._colors}constructor(S){super(),this._optionsService=S,this._contrastCache=new s.ColorContrastCache,this._halfContrastCache=new s.ColorContrastCache,this._onChangeColors=this.register(new f.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:n,cursor:i,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:c.color.blend(n,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:c.color.blend(n,d),ansi:t.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(S={}){const u=this._colors;if(u.foreground=_(S.foreground,e),u.background=_(S.background,n),u.cursor=_(S.cursor,i),u.cursorAccent=_(S.cursorAccent,r),u.selectionBackgroundTransparent=_(S.selectionBackground,d),u.selectionBackgroundOpaque=c.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=_(S.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=c.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=S.selectionForeground?_(S.selectionForeground,c.NULL_COLOR):void 0,u.selectionForeground===c.NULL_COLOR&&(u.selectionForeground=void 0),c.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=c.color.opacity(u.selectionBackgroundTransparent,.3)),c.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=c.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=t.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=_(S.black,t.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=_(S.red,t.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=_(S.green,t.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=_(S.yellow,t.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=_(S.blue,t.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=_(S.magenta,t.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=_(S.cyan,t.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=_(S.white,t.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=_(S.brightBlack,t.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=_(S.brightRed,t.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=_(S.brightGreen,t.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=_(S.brightYellow,t.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=_(S.brightBlue,t.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=_(S.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=_(S.brightCyan,t.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=_(S.brightWhite,t.DEFAULT_ANSI_COLORS[15]),S.extendedAnsi){const v=Math.min(u.ansi.length-16,S.extendedAnsi.length);for(let C=0;C<v;C++)u.ansi[C+16]=_(S.extendedAnsi[C],t.DEFAULT_ANSI_COLORS[C+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(S){this._restoreColor(S),this._onChangeColors.fire(this.colors)}_restoreColor(S){if(S!==void 0)switch(S){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[S]=this._restoreColors.ansi[S]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(S){S(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 _(S,u){if(S!==void 0)try{return c.css.toColor(S)}catch{}return u}t.ThemeService=g=h([l(0,a.IOptionsService)],g)},6349:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=o(8460),l=o(844);class s extends l.Disposable{constructor(f){super(),this._maxLength=f,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.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(f){if(this._maxLength===f)return;const p=new Array(f);for(let a=0;a<Math.min(f,this.length);a++)p[a]=this._array[this._getCyclicIndex(a)];this._array=p,this._maxLength=f,this._startIndex=0}get length(){return this._length}set length(f){if(f>this._length)for(let p=this._length;p<f;p++)this._array[p]=void 0;this._length=f}get(f){return this._array[this._getCyclicIndex(f)]}set(f,p){this._array[this._getCyclicIndex(f)]=p}push(f){this._array[this._getCyclicIndex(this._length)]=f,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(f,p,...a){if(p){for(let e=f;e<this._length-p;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+p)];this._length-=p,this.onDeleteEmitter.fire({index:f,amount:p})}for(let e=this._length-1;e>=f;e--)this._array[this._getCyclicIndex(e+a.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<a.length;e++)this._array[this._getCyclicIndex(f+e)]=a[e];if(a.length&&this.onInsertEmitter.fire({index:f,amount:a.length}),this._length+a.length>this._maxLength){const e=this._length+a.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=a.length}trimStart(f){f>this._length&&(f=this._length),this._startIndex+=f,this._length-=f,this.onTrimEmitter.fire(f)}shiftElements(f,p,a){if(!(p<=0)){if(f<0||f>=this._length)throw new Error("start argument out of range");if(f+a<0)throw new Error("Cannot shift elements in list beyond index 0");if(a>0){for(let n=p-1;n>=0;n--)this.set(f+n+a,this.get(f+n));const e=f+p+a-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<p;e++)this.set(f+e+a,this.get(f+e))}}_getCyclicIndex(f){return(this._startIndex+f)%this._maxLength}}t.CircularList=s},1439:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function o(h,l=5){if(typeof h!="object")return h;const s=Array.isArray(h)?[]:{};for(const c in h)s[c]=l<=1?h[c]:h[c]&&o(h[c],l-1);return s}},8055:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let o=0,h=0,l=0,s=0;var c,f,p,a,e;function n(r){const d=r.toString(16);return d.length<2?"0"+d:d}function i(r,d){return r<d?(d+.05)/(r+.05):(r+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(d,g,_,S){return S!==void 0?`#${n(d)}${n(g)}${n(_)}${n(S)}`:`#${n(d)}${n(g)}${n(_)}`},r.toRgba=function(d,g,_,S=255){return(d<<24|g<<16|_<<8|S)>>>0},r.toColor=function(d,g,_,S){return{css:r.toCss(d,g,_,S),rgba:r.toRgba(d,g,_,S)}}}(c||(t.channels=c={})),function(r){function d(g,_){return s=Math.round(255*_),[o,h,l]=e.toChannels(g.rgba),{css:c.toCss(o,h,l,s),rgba:c.toRgba(o,h,l,s)}}r.blend=function(g,_){if(s=(255&_.rgba)/255,s===1)return{css:_.css,rgba:_.rgba};const S=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,C=g.rgba>>24&255,x=g.rgba>>16&255,y=g.rgba>>8&255;return o=C+Math.round((S-C)*s),h=x+Math.round((u-x)*s),l=y+Math.round((v-y)*s),{css:c.toCss(o,h,l),rgba:c.toRgba(o,h,l)}},r.isOpaque=function(g){return(255&g.rgba)==255},r.ensureContrastRatio=function(g,_,S){const u=e.ensureContrastRatio(g.rgba,_.rgba,S);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},r.opaque=function(g){const _=(255|g.rgba)>>>0;return[o,h,l]=e.toChannels(_),{css:c.toCss(o,h,l),rgba:_}},r.opacity=d,r.multiplyOpacity=function(g,_){return s=255&g.rgba,d(g,s*_/255)},r.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(f||(t.color=f={})),function(r){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const S=_.getContext("2d",{willReadFrequently:!0});S&&(d=S,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return o=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(o,h,l);case 5:return o=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),s=parseInt(_.slice(4,5).repeat(2),16),c.toColor(o,h,l,s);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const S=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return o=parseInt(S[1]),h=parseInt(S[2]),l=parseInt(S[3]),s=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),c.toColor(o,h,l,s);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,h,l,s]=d.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(o,h,l,s),css:_}}}(p||(t.css=p={})),function(r){function d(g,_,S){const u=g/255,v=_/255,C=S/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.0722*(C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4))}r.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},r.relativeLuminance2=d}(a||(t.rgb=a={})),function(r){function d(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let y=S>>24&255,L=S>>16&255,A=S>>8&255,I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));for(;I<u&&(y>0||L>0||A>0);)y-=Math.max(0,Math.ceil(.1*y)),L-=Math.max(0,Math.ceil(.1*L)),A-=Math.max(0,Math.ceil(.1*A)),I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));return(y<<24|L<<16|A<<8|255)>>>0}function g(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let y=S>>24&255,L=S>>16&255,A=S>>8&255,I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));for(;I<u&&(y<255||L<255||A<255);)y=Math.min(255,y+Math.ceil(.1*(255-y))),L=Math.min(255,L+Math.ceil(.1*(255-L))),A=Math.min(255,A+Math.ceil(.1*(255-A))),I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));return(y<<24|L<<16|A<<8|255)>>>0}r.blend=function(_,S){if(s=(255&S)/255,s===1)return S;const u=S>>24&255,v=S>>16&255,C=S>>8&255,x=_>>24&255,y=_>>16&255,L=_>>8&255;return o=x+Math.round((u-x)*s),h=y+Math.round((v-y)*s),l=L+Math.round((C-L)*s),c.toRgba(o,h,l)},r.ensureContrastRatio=function(_,S,u){const v=a.relativeLuminance(_>>8),C=a.relativeLuminance(S>>8);if(i(v,C)<u){if(C<v){const L=d(_,S,u),A=i(v,a.relativeLuminance(L>>8));if(A<u){const I=g(_,S,u);return A>i(v,a.relativeLuminance(I>>8))?L:I}return L}const x=g(_,S,u),y=i(v,a.relativeLuminance(x>>8));if(y<u){const L=d(_,S,u);return y>i(v,a.relativeLuminance(L>>8))?x:L}return x}},r.reduceLuminance=d,r.increaseLuminance=g,r.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=n,t.contrastRatio=i},8969:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=o(844),l=o(2585),s=o(4348),c=o(7866),f=o(744),p=o(7302),a=o(6975),e=o(8460),n=o(1753),i=o(1480),r=o(7994),d=o(9282),g=o(5435),_=o(5981),S=o(2660);let u=!1;class v extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event(x=>{var y;(y=this._onScrollApi)==null||y.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(const y in x)this.optionsService.options[y]=x[y]}constructor(x){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new s.InstantiationService,this.optionsService=this.register(new p.OptionsService(x)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(f.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(a.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.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(y=>{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(y=>{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 _.WriteBuffer((y,L)=>this._inputHandler.parse(y,L))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,y){this._writeBuffer.write(x,y)}writeSync(x,y){this._logService.logLevel<=l.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(x,y)}input(x,y=!0){this.coreService.triggerDataEvent(x,y)}resize(x,y){isNaN(x)||isNaN(y)||(x=Math.max(x,f.MINIMUM_COLS),y=Math.max(y,f.MINIMUM_ROWS),this._bufferService.resize(x,y))}scroll(x,y=!1){this._bufferService.scroll(x,y)}scrollLines(x,y,L){this._bufferService.scrollLines(x,y,L)}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){const y=x-this._bufferService.buffer.ydisp;y!==0&&this.scrollLines(y)}registerEscHandler(x,y){return this._inputHandler.registerEscHandler(x,y)}registerDcsHandler(x,y){return this._inputHandler.registerDcsHandler(x,y)}registerCsiHandler(x,y){return this._inputHandler.registerCsiHandler(x,y)}registerOscHandler(x,y){return this._inputHandler.registerOscHandler(x,y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1;const y=this.optionsService.rawOptions.windowsPty;y&&y.buildNumber!==void 0&&y.buildNumber!==void 0?x=y.backend==="conpty"&&y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const x=[];x.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const y of x)y.dispose()})}}}t.CoreTerminal=v},8460:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.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 h=0;h<this._listeners.length;h++)if(this._listeners[h]===o)return void this._listeners.splice(h,1)}}})),this._event}fire(o,h){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,o,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(o,h){return o(l=>h.fire(l))},t.runAndSubscribe=function(o,h){return h(void 0),o(l=>h(l))}},5435:function(M,t,o){var h=this&&this.__decorate||function(F,b,k,T){var O,U=arguments.length,q=U<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,k):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(F,b,k,T);else for(var Y=F.length-1;Y>=0;Y--)(O=F[Y])&&(q=(U<3?O(q):U>3?O(b,k,q):O(b,k))||q);return U>3&&q&&Object.defineProperty(b,k,q),q},l=this&&this.__param||function(F,b){return function(k,T){b(k,T,F)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const s=o(2584),c=o(7116),f=o(2015),p=o(844),a=o(482),e=o(8437),n=o(8460),i=o(643),r=o(511),d=o(3734),g=o(2585),_=o(1480),S=o(6242),u=o(6351),v=o(5941),C={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function y(F,b){if(F>24)return b.setWinLines||!1;switch(F){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 L;(function(F){F[F.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",F[F.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(L||(t.WindowsOptionsReportType=L={}));let A=0;class I extends p.Disposable{getAttrData(){return this._curAttrData}constructor(b,k,T,O,U,q,Y,V,P=new f.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=k,this._coreService=T,this._logService=O,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=Y,this._unicodeService=V,this._parser=P,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new a.StringToUtf32,this._utf8Decoder=new a.Utf8ToUtf32,this._workCell=new r.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.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 N(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(R=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:z.toArray()})}),this._parser.setEscHandlerFallback(R=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(R)})}),this._parser.setExecuteHandlerFallback(R=>{this._logService.debug("Unknown EXECUTE code: ",{code:R})}),this._parser.setOscHandlerFallback((R,z,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:z,data:W})}),this._parser.setDcsHandlerFallback((R,z,W)=>{z==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:z,payload:W})}),this._parser.setPrintHandler((R,z,W)=>this.print(R,z,W)),this._parser.registerCsiHandler({final:"@"},R=>this.insertChars(R)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},R=>this.scrollLeft(R)),this._parser.registerCsiHandler({final:"A"},R=>this.cursorUp(R)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},R=>this.scrollRight(R)),this._parser.registerCsiHandler({final:"B"},R=>this.cursorDown(R)),this._parser.registerCsiHandler({final:"C"},R=>this.cursorForward(R)),this._parser.registerCsiHandler({final:"D"},R=>this.cursorBackward(R)),this._parser.registerCsiHandler({final:"E"},R=>this.cursorNextLine(R)),this._parser.registerCsiHandler({final:"F"},R=>this.cursorPrecedingLine(R)),this._parser.registerCsiHandler({final:"G"},R=>this.cursorCharAbsolute(R)),this._parser.registerCsiHandler({final:"H"},R=>this.cursorPosition(R)),this._parser.registerCsiHandler({final:"I"},R=>this.cursorForwardTab(R)),this._parser.registerCsiHandler({final:"J"},R=>this.eraseInDisplay(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},R=>this.eraseInDisplay(R,!0)),this._parser.registerCsiHandler({final:"K"},R=>this.eraseInLine(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},R=>this.eraseInLine(R,!0)),this._parser.registerCsiHandler({final:"L"},R=>this.insertLines(R)),this._parser.registerCsiHandler({final:"M"},R=>this.deleteLines(R)),this._parser.registerCsiHandler({final:"P"},R=>this.deleteChars(R)),this._parser.registerCsiHandler({final:"S"},R=>this.scrollUp(R)),this._parser.registerCsiHandler({final:"T"},R=>this.scrollDown(R)),this._parser.registerCsiHandler({final:"X"},R=>this.eraseChars(R)),this._parser.registerCsiHandler({final:"Z"},R=>this.cursorBackwardTab(R)),this._parser.registerCsiHandler({final:"`"},R=>this.charPosAbsolute(R)),this._parser.registerCsiHandler({final:"a"},R=>this.hPositionRelative(R)),this._parser.registerCsiHandler({final:"b"},R=>this.repeatPrecedingCharacter(R)),this._parser.registerCsiHandler({final:"c"},R=>this.sendDeviceAttributesPrimary(R)),this._parser.registerCsiHandler({prefix:">",final:"c"},R=>this.sendDeviceAttributesSecondary(R)),this._parser.registerCsiHandler({final:"d"},R=>this.linePosAbsolute(R)),this._parser.registerCsiHandler({final:"e"},R=>this.vPositionRelative(R)),this._parser.registerCsiHandler({final:"f"},R=>this.hVPosition(R)),this._parser.registerCsiHandler({final:"g"},R=>this.tabClear(R)),this._parser.registerCsiHandler({final:"h"},R=>this.setMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"h"},R=>this.setModePrivate(R)),this._parser.registerCsiHandler({final:"l"},R=>this.resetMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"l"},R=>this.resetModePrivate(R)),this._parser.registerCsiHandler({final:"m"},R=>this.charAttributes(R)),this._parser.registerCsiHandler({final:"n"},R=>this.deviceStatus(R)),this._parser.registerCsiHandler({prefix:"?",final:"n"},R=>this.deviceStatusPrivate(R)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},R=>this.softReset(R)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},R=>this.setCursorStyle(R)),this._parser.registerCsiHandler({final:"r"},R=>this.setScrollRegion(R)),this._parser.registerCsiHandler({final:"s"},R=>this.saveCursor(R)),this._parser.registerCsiHandler({final:"t"},R=>this.windowOptions(R)),this._parser.registerCsiHandler({final:"u"},R=>this.restoreCursor(R)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},R=>this.insertColumns(R)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},R=>this.deleteColumns(R)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},R=>this.selectProtected(R)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},R=>this.requestMode(R,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},R=>this.requestMode(R,!1)),this._parser.setExecuteHandler(s.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(s.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(s.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(s.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(s.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(s.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(s.C1.IND,()=>this.index()),this._parser.setExecuteHandler(s.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(s.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new S.OscHandler(R=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new S.OscHandler(R=>this.setIconName(R))),this._parser.registerOscHandler(2,new S.OscHandler(R=>this.setTitle(R))),this._parser.registerOscHandler(4,new S.OscHandler(R=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new S.OscHandler(R=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new S.OscHandler(R=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new S.OscHandler(R=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new S.OscHandler(R=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new S.OscHandler(R=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new S.OscHandler(R=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new S.OscHandler(R=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new S.OscHandler(R=>this.restoreCursorColor(R))),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(const R in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:R},()=>this.selectCharset("("+R)),this._parser.registerEscHandler({intermediates:")",final:R},()=>this.selectCharset(")"+R)),this._parser.registerEscHandler({intermediates:"*",final:R},()=>this.selectCharset("*"+R)),this._parser.registerEscHandler({intermediates:"+",final:R},()=>this.selectCharset("+"+R)),this._parser.registerEscHandler({intermediates:"-",final:R},()=>this.selectCharset("-"+R)),this._parser.registerEscHandler({intermediates:".",final:R},()=>this.selectCharset("."+R)),this._parser.registerEscHandler({intermediates:"/",final:R},()=>this.selectCharset("/"+R));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(R=>(this._logService.error("Parsing error: ",R),R)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler((R,z)=>this.requestStatusString(R,z)))}_preserveStack(b,k,T,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=k,this._parseStack.decodedLength=T,this._parseStack.position=O}_logSlowResolvingAsync(b){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([b,new Promise((k,T)=>setTimeout(()=>T("#SLOW_TIMEOUT"),5e3))]).catch(k=>{if(k!=="#SLOW_TIMEOUT")throw k;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,k){let T,O=this._activeBuffer.x,U=this._activeBuffer.y,q=0;const Y=this._parseStack.paused;if(Y){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,k))return this._logSlowResolvingAsync(T),T;O=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>x&&(q=this._parseStack.position+x)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,R=>String.fromCharCode(R)).join("")}"`),typeof b=="string"?b.split("").map(R=>R.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 R=q;R<b.length;R+=x){const z=R+x<b.length?R+x:b.length,W=typeof b=="string"?this._stringDecoder.decode(b.substring(R,z),this._parseBuffer):this._utf8Decoder.decode(b.subarray(R,z),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,W))return this._preserveStack(O,U,W,R),this._logSlowResolvingAsync(T),T}else if(!Y){const R=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,R))return this._preserveStack(O,U,R,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===O&&this._activeBuffer.y===U||this._onCursorMove.fire();const V=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),P=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);P<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(P,this._bufferService.rows-1),Math.min(V,this._bufferService.rows-1))}print(b,k,T){let O,U;const q=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,V=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,z=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-k>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let G=this._parser.precedingJoinState;for(let K=k;K<T;++K){if(O=b[K],O<127&&q){const _e=q[String.fromCharCode(O)];_e&&(O=_e.charCodeAt(0))}const Q=this._unicodeService.charProperties(O,G);U=_.UnicodeService.extractWidth(Q);const J=_.UnicodeService.extractShouldJoin(Q),oe=J?_.UnicodeService.extractWidth(G):0;if(G=Q,Y&&this._onA11yChar.fire((0,a.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-oe>V){if(P){const _e=W;let Z=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),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),oe>0&&W instanceof e.BufferLine&&W.copyCellsFrom(_e,Z,0,oe,!1);Z<V;)_e.setCellFromCodepoint(Z++,0,1,z)}else if(this._activeBuffer.x=V-1,U===2)continue}if(J&&this._activeBuffer.x){const _e=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-_e,O,U);for(let Z=U-oe;--Z>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(R&&(W.insertCells(this._activeBuffer.x,U-oe,this._activeBuffer.getNullCell(z)),W.getWidth(V-1)===2&&W.setCellFromCodepoint(V-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,z)),W.setCellFromCodepoint(this._activeBuffer.x++,O,U,z),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=G,this._activeBuffer.x<V&&T-k>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,k){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,k):this._parser.registerCsiHandler(b,T=>!y(T.params[0],this._optionsService.rawOptions.windowOptions)||k(T))}registerDcsHandler(b,k){return this._parser.registerDcsHandler(b,new u.DcsHandler(k))}registerEscHandler(b,k){return this._parser.registerEscHandler(b,k)}registerOscHandler(b,k){return this._parser.registerOscHandler(b,new S.OscHandler(k))}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(){var b;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&&((b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&b.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);k.hasWidth(this._activeBuffer.x)&&!k.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const 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,k){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+k):(this._activeBuffer.x=b,this._activeBuffer.y=k),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,k){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+k)}cursorUp(b){const k=this._activeBuffer.y-this._activeBuffer.scrollTop;return k>=0?this._moveCursor(0,-Math.min(k,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){const k=this._activeBuffer.scrollBottom-this._activeBuffer.y;return k>=0?this._moveCursor(0,Math.min(k,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){const k=b.params[0];return k===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:k===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=b.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let k=b.params[0]||1;for(;k--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){const k=b.params[0];return k===1&&(this._curAttrData.bg|=536870912),k!==2&&k!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,k,T,O=!1,U=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);q.replaceCells(k,T,this._activeBuffer.getNullCell(this._eraseAttrData()),U),O&&(q.isWrapped=!1)}_resetBufferLine(b,k=!1){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),k),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),T.isWrapped=!1)}eraseInDisplay(b,k=!1){let T;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,k);T<this._bufferService.rows;T++)this._resetBufferLine(T,k);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,k),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,k);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,k);this._dirtyRowTracker.markDirty(0);break;case 3:const O=this._activeBuffer.lines.length-this._bufferService.rows;O>0&&(this._activeBuffer.lines.trimStart(O),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-O,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-O,0),this._onScroll.fire(0))}return!0}eraseInLine(b,k=!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,k);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,k);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,k)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let k=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y,O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;k--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let k=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y;let O;for(O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,O=this._bufferService.rows-1+this._activeBuffer.ybase-O;k--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(O,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();const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let k=b.params[0]||1;for(;k--;)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 k=b.params[0]||1;for(;k--;)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(e.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.deleteCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.insertCells(0,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.insertCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.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;const k=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);O.deleteCells(this._activeBuffer.x,k,this._activeBuffer.getNullCell(this._eraseAttrData())),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return k&&(k.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){const k=this._parser.precedingJoinState;if(!k)return!0;const T=b.params[0]||1,O=_.UnicodeService.extractWidth(k),U=this._activeBuffer.x-O,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(q.length*T);let V=0;for(let R=0;R<q.length;){const z=q.codePointAt(R)||0;Y[V++]=z,R+=z>65535?2:1}let P=V;for(let R=1;R<T;++R)Y.copyWithin(P,0,V),P+=V;return this.print(Y,0,P),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let k=0;k<b.length;k++)switch(b.params[k]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let k=0;k<b.length;k++)switch(b.params[k]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),this._charsetService.setgCharset(1,c.DEFAULT_CHARSET),this._charsetService.setgCharset(2,c.DEFAULT_CHARSET),this._charsetService.setgCharset(3,c.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 k=0;k<b.length;k++)switch(b.params[k]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let k=0;k<b.length;k++)switch(b.params[k]){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[k]===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,k){const T=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:Y,cols:V}=this._bufferService,{active:P,alt:R}=Y,z=this._optionsService.rawOptions,W=J=>J?1:2,G=b.params[0];return K=G,Q=k?G===2?4:G===4?W(q.modes.insertMode):G===12?3:G===20?W(z.convertEol):0:G===1?W(T.applicationCursorKeys):G===3?z.windowOptions.setWinLines?V===80?2:V===132?1:0:0:G===6?W(T.origin):G===7?W(T.wraparound):G===8?3:G===9?W(O==="X10"):G===12?W(z.cursorBlink):G===25?W(!q.isCursorHidden):G===45?W(T.reverseWraparound):G===66?W(T.applicationKeypad):G===67?4:G===1e3?W(O==="VT200"):G===1002?W(O==="DRAG"):G===1003?W(O==="ANY"):G===1004?W(T.sendFocus):G===1005?4:G===1006?W(U==="SGR"):G===1015?4:G===1016?W(U==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?W(P===R):G===2004?W(T.bracketedPasteMode):0,q.triggerDataEvent(`${s.C0.ESC}[${k?"":"?"}${K};${Q}$y`),!0;var K,Q}_updateAttrColor(b,k,T,O,U){return k===2?(b|=50331648,b&=-16777216,b|=d.AttributeData.fromColorRGB([T,O,U])):k===5&&(b&=-50331904,b|=33554432|255&T),b}_extractColor(b,k,T){const O=[0,0,-1,0,0,0];let U=0,q=0;do{if(O[q+U]=b.params[k+q],b.hasSubParams(k+q)){const Y=b.getSubParams(k+q);let V=0;do O[1]===5&&(U=1),O[q+V+1+U]=Y[V];while(++V<Y.length&&V+q+1+U<O.length);break}if(O[1]===5&&q+U>=2||O[1]===2&&q+U>=5)break;O[1]&&(U=1)}while(++q+k<b.length&&q+U<O.length);for(let Y=2;Y<O.length;++Y)O[Y]===-1&&(O[Y]=0);switch(O[0]){case 38:T.fg=this._updateAttrColor(T.fg,O[1],O[3],O[4],O[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,O[1],O[3],O[4],O[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,O[1],O[3],O[4],O[5])}return q}_processUnderline(b,k){k.extended=k.extended.clone(),(!~b||b>5)&&(b=1),k.extended.underlineStyle=b,k.fg|=268435456,b===0&&(k.fg&=-268435457),k.updateExtended()}_processSGR0(b){b.fg=e.DEFAULT_ATTR_DATA.fg,b.bg=e.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;const k=b.length;let T;const O=this._curAttrData;for(let U=0;U<k;U++)T=b.params[U],T>=30&&T<=37?(O.fg&=-50331904,O.fg|=16777216|T-30):T>=40&&T<=47?(O.bg&=-50331904,O.bg|=16777216|T-40):T>=90&&T<=97?(O.fg&=-50331904,O.fg|=16777224|T-90):T>=100&&T<=107?(O.bg&=-50331904,O.bg|=16777224|T-100):T===0?this._processSGR0(O):T===1?O.fg|=134217728:T===3?O.bg|=67108864:T===4?(O.fg|=268435456,this._processUnderline(b.hasSubParams(U)?b.getSubParams(U)[0]:1,O)):T===5?O.fg|=536870912:T===7?O.fg|=67108864:T===8?O.fg|=1073741824:T===9?O.fg|=2147483648:T===2?O.bg|=134217728:T===21?this._processUnderline(2,O):T===22?(O.fg&=-134217729,O.bg&=-134217729):T===23?O.bg&=-67108865:T===24?(O.fg&=-268435457,this._processUnderline(0,O)):T===25?O.fg&=-536870913:T===27?O.fg&=-67108865:T===28?O.fg&=-1073741825:T===29?O.fg&=2147483647:T===39?(O.fg&=-67108864,O.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):T===49?(O.bg&=-67108864,O.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?U+=this._extractColor(b,U,O):T===53?O.bg|=1073741824:T===55?O.bg&=-1073741825:T===59?(O.extended=O.extended.clone(),O.extended.underlineColor=-1,O.updateExtended()):T===100?(O.fg&=-67108864,O.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,O.bg&=-67108864,O.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${s.C0.ESC}[0n`);break;case 6:const k=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[${k};${T}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){const k=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[?${k};${T}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=e.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){const k=b.params[0]||1;switch(k){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"}const T=k%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(b){const k=b.params[0]||1;let T;return(b.length<2||(T=b.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>k&&(this._activeBuffer.scrollTop=k-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(b){if(!y(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;const k=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:k!==2&&this._onRequestWindowsOptionsReport.fire(L.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(L.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${s.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:k!==0&&k!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),k!==0&&k!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:k!==0&&k!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),k!==0&&k!==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){const k=[],T=b.split(";");for(;T.length>1;){const O=T.shift(),U=T.shift();if(/^\d+$/.exec(O)){const q=parseInt(O);if($(q))if(U==="?")k.push({type:0,index:q});else{const Y=(0,v.parseColor)(U);Y&&k.push({type:1,index:q,color:Y})}}}return k.length&&this._onColor.fire(k),!0}setHyperlink(b){const k=b.split(";");return!(k.length<2)&&(k[1]?this._createHyperlink(k[0],k[1]):!k[0]&&this._finishHyperlink())}_createHyperlink(b,k){this._getCurrentLinkId()&&this._finishHyperlink();const T=b.split(":");let O;const U=T.findIndex(q=>q.startsWith("id="));return U!==-1&&(O=T[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:k}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,k){const T=b.split(";");for(let O=0;O<T.length&&!(k>=this._specialColors.length);++O,++k)if(T[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[k]}]);else{const U=(0,v.parseColor)(T[O]);U&&this._onColor.fire([{type:1,index:this._specialColors[k],color:U}])}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;const k=[],T=b.split(";");for(let O=0;O<T.length;++O)if(/^\d+$/.exec(T[O])){const U=parseInt(T[O]);$(U)&&k.push({type:2,index:U})}return k.length&&this._onColor.fire(k),!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,c.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(C[b[0]],c.CHARSETS[b[1]]||c.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){const 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=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.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(){const b=new r.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let k=0;k<this._bufferService.rows;++k){const T=this._activeBuffer.ybase+this._activeBuffer.y+k,O=this._activeBuffer.lines.get(T);O&&(O.fill(b),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,k){const T=this._bufferService.buffer,O=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${s.C0.ESC}${U}${s.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,k){this._dirtyRowTracker.markRangeDirty(b,k)}}t.InputHandler=I;let N=class{constructor(F){this._bufferService=F,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(F){F<this.start?this.start=F:F>this.end&&(this.end=F)}markRangeDirty(F,b){F>b&&(A=F,F=b,b=A),F<this.start&&(this.start=F),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function $(F){return 0<=F&&F<256}N=h([l(0,g.IBufferService)],N)},844:(M,t)=>{function o(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=o,t.getDisposeArrayDisposable=function(h){return{dispose:()=>o(h)}}},1505:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(l,s,c){this._data[l]||(this._data[l]={}),this._data[l][s]=c}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=o,t.FourKeyMap=class{constructor(){this._data=new o}set(h,l,s,c,f){this._data.get(h,l)||this._data.set(h,l,new o),this._data.get(h,l).set(s,c,f)}get(h,l,s,c){var f;return(f=this._data.get(h,l))==null?void 0:f.get(s,c)}clear(){this._data.clear()}}},6114:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const o=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=o.includes("Firefox"),t.isLegacyEdge=o.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(o),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=o.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(o)},6106:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let o=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(o=this._search(this._getKey(h)),this._array.splice(o,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const l=this._getKey(h);if(l===void 0||(o=this._search(l),o===-1)||this._getKey(this._array[o])!==l)return!1;do if(this._array[o]===h)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===h)}forEachByKey(h,l){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do l(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===h)}values(){return[...this._array].values()}_search(h){let l=0,s=this._array.length-1;for(;s>=l;){let c=l+s>>1;const f=this._getKey(this._array[c]);if(f>h)s=c-1;else{if(!(f<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=o(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),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(f){this._idleCallback=void 0;let p=0,a=0,e=f.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),a=Math.max(p,a),n=f.timeRemaining(),1.5*a>n)return e-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-p))}ms`),void this._start();e=n}this.clear()}}class s extends l{_requestCallback(f){return setTimeout(()=>f(this._createDeadline(16)))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const p=Date.now()+f;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=o(643);t.updateWindowsModeWrappedState=function(l){const s=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=s==null?void 0:s.get(l.cols-1),f=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);f&&c&&(f.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new o;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}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}}t.AttributeData=o;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,c=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=o(6349),l=o(7226),s=o(3734),c=o(8437),f=o(4634),p=o(511),a=o(643),e=o(4863),n=o(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,r,d){this._hasScrollback=i,this._optionsService=r,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=c.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=p.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]),this._whitespaceCell=p.CellData.fromCharData([0,a.WHITESPACE_CELL_CHAR,a.WHITESPACE_CELL_WIDTH,a.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,r){return new c.BufferLine(this._bufferService.cols,this.getNullCell(i),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const r=i+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,r){const d=this.getNullCell(c.DEFAULT_ATTR_DATA);let g=0;const _=this._getCorrectBufferLength(r);if(_>this.lines.maxLength&&(this.lines.maxLength=_),this.lines.length>0){if(this._cols<i)for(let u=0;u<this.lines.length;u++)g+=+this.lines.get(u).resize(i,d);let S=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 c.BufferLine(i,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,d)));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(_<this.lines.maxLength){const u=this.lines.length-_;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=_}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,r-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(i,r),this._cols>i))for(let S=0;S<this.lines.length;S++)g+=+this.lines.get(S).resize(i,d);this._cols=i,this._rows=r,this._memoryCleanupQueue.clear(),g>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,r){this._cols!==i&&(i>this._cols?this._reflowLarger(i,r):this._reflowSmaller(i,r))}_reflowLarger(i,r){const d=(0,f.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(d.length>0){const g=(0,f.reflowLargerCreateNewLayout)(this.lines,d);(0,f.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(i,r,g.countRemoved)}}_reflowLargerAdjustViewport(i,r,d){const g=this.getNullCell(c.DEFAULT_ATTR_DATA);let _=d;for(;_-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new c.BufferLine(i,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(i,r){const d=this.getNullCell(c.DEFAULT_ATTR_DATA),g=[];let _=0;for(let S=this.lines.length-1;S>=0;S--){let u=this.lines.get(S);if(!u||!u.isWrapped&&u.getTrimmedLength()<=i)continue;const v=[u];for(;u.isWrapped&&S>0;)u=this.lines.get(--S),v.unshift(u);const C=this.ybase+this.y;if(C>=S&&C<S+v.length)continue;const x=v[v.length-1].getTrimmedLength(),y=(0,f.reflowSmallerGetNewLineLengths)(v,this._cols,i),L=y.length-v.length;let A;A=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+L):Math.max(0,this.lines.length-this.lines.maxLength+L);const I=[];for(let T=0;T<L;T++){const O=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);I.push(O)}I.length>0&&(g.push({start:S+v.length+_,newLines:I}),_+=I.length),v.push(...I);let N=y.length-1,$=y[N];$===0&&(N--,$=y[N]);let F=v.length-L-1,b=x;for(;F>=0;){const T=Math.min(b,$);if(v[N]===void 0)break;if(v[N].copyCellsFrom(v[F],b-T,$-T,T,!0),$-=T,$===0&&(N--,$=y[N]),b-=T,b===0){F--;const O=Math.max(F,0);b=(0,f.getWrappedLineTrimmedLength)(v,O,this._cols)}}for(let T=0;T<v.length;T++)y[T]<i&&v[T].setCell(y[T],d);let k=L-A;for(;k-- >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+_)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+L,this.ybase+r-1)}if(g.length>0){const S=[],u=[];for(let N=0;N<this.lines.length;N++)u.push(this.lines.get(N));const v=this.lines.length;let C=v-1,x=0,y=g[x];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+_);let L=0;for(let N=Math.min(this.lines.maxLength-1,v+_-1);N>=0;N--)if(y&&y.start>C+L){for(let $=y.newLines.length-1;$>=0;$--)this.lines.set(N--,y.newLines[$]);N++,S.push({index:C+1,amount:y.newLines.length}),L+=y.newLines.length,y=g[++x]}else this.lines.set(N,u[C--]);let A=0;for(let N=S.length-1;N>=0;N--)S[N].index+=A,this.lines.onInsertEmitter.fire(S[N]),A+=S[N].amount;const I=Math.max(0,v+_-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(i,r,d=0,g){const _=this.lines.get(i);return _?_.translateToString(r,d,g):""}getWrappedRangeForLine(i){let r=i,d=i;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:r,last:d}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===i&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const r=new e.Marker(i);return this.markers.push(r),r.register(this.lines.onTrim(d=>{r.line-=d,r.line<0&&r.dispose()})),r.register(this.lines.onInsert(d=>{r.line>=d.index&&(r.line+=d.amount)})),r.register(this.lines.onDelete(d=>{r.line>=d.index&&r.line<d.index+d.amount&&r.dispose(),r.line>d.index&&(r.line-=d.amount)})),r.register(r.onDispose(()=>this._removeMarker(r))),r}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=o(3734),l=o(511),s=o(643),c=o(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let f=0;class p{constructor(e,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const r=n||l.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]);for(let d=0;d<e;++d)this.setCell(d,r);this.length=e}get(e){const n=this._data[3*e+0],i=2097151&n;return[this._data[3*e+1],2097152&n?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",n>>22,2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,n){this._data[3*e+1]=n[s.CHAR_DATA_ATTR_INDEX],n[s.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=n[1],this._data[3*e+0]=2097152|e|n[s.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=n[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[s.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&n}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e]:2097151&n?(0,c.stringFromCodePoint)(2097151&n):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,n){return f=3*e,n.content=this._data[f+0],n.fg=this._data[f+1],n.bg=this._data[f+2],2097152&n.content&&(n.combinedData=this._combined[e]),268435456&n.bg&&(n.extended=this._extendedAttrs[e]),n}setCell(e,n){2097152&n.content&&(this._combined[e]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=n.content,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}setCellFromCodepoint(e,n,i,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=n|i<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,n,i){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,c.stringFromCodePoint)(n):2097151&r?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&r)+(0,c.stringFromCodePoint)(n),r&=-2097152,r|=2097152):r=n|4194304,i&&(r&=-12582913,r|=i<<22),this._data[3*e+0]=r}insertCells(e,n,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length-e){const r=new l.CellData;for(let d=this.length-e-n-1;d>=0;--d)this.setCell(e+n+d,this.loadCell(e+d,r));for(let d=0;d<n;++d)this.setCell(e+d,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,n,i){if(e%=this.length,n<this.length-e){const r=new l.CellData;for(let d=0;d<this.length-e-n;++d)this.setCell(e+d,this.loadCell(e+n+d,r));for(let d=this.length-n;d<this.length;++d)this.setCell(d,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,n,i,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);e<n&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);e<n&&e<this.length;)this.setCell(e++,i)}resize(e,n){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,i);const r=Object.keys(this._combined);for(let g=0;g<r.length;g++){const _=parseInt(r[g],10);_>=e&&delete this._combined[_]}const d=Object.keys(this._extendedAttrs);for(let g=0;g<d.length;g++){const _=parseInt(d[g],10);_>=e&&delete this._extendedAttrs[_]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,n=!1){if(n)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const n in e._combined)this._combined[n]=e._combined[n];this._extendedAttrs={};for(const n in e._extendedAttrs)this._extendedAttrs[n]=e._extendedAttrs[n];this.isWrapped=e.isWrapped}clone(){const e=new p(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const n in this._combined)e._combined[n]=this._combined[n];for(const n in this._extendedAttrs)e._extendedAttrs[n]=this._extendedAttrs[n];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,n,i,r,d){const g=e._data;if(d)for(let S=r-1;S>=0;S--){for(let u=0;u<3;u++)this._data[3*(i+S)+u]=g[3*(n+S)+u];268435456&g[3*(n+S)+2]&&(this._extendedAttrs[i+S]=e._extendedAttrs[n+S])}else for(let S=0;S<r;S++){for(let u=0;u<3;u++)this._data[3*(i+S)+u]=g[3*(n+S)+u];268435456&g[3*(n+S)+2]&&(this._extendedAttrs[i+S]=e._extendedAttrs[n+S])}const _=Object.keys(e._combined);for(let S=0;S<_.length;S++){const u=parseInt(_[S],10);u>=n&&(this._combined[u-n+i]=e._combined[u])}}translateToString(e,n,i,r){n=n??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let d="";for(;n<i;){const g=this._data[3*n+0],_=2097151&g,S=2097152&g?this._combined[n]:_?(0,c.stringFromCodePoint)(_):s.WHITESPACE_CELL_CHAR;if(d+=S,r)for(let u=0;u<S.length;++u)r.push(n);n+=g>>22||1}return r&&r.push(n),d}}t.BufferLine=p},4841:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(o,h){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 h*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(M,t)=>{function o(h,l,s){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(s-1)&&h[l].getWidth(s-1)===1,f=h[l+1].getWidth(0)===2;return c&&f?s-1:s}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,s,c,f){const p=[];for(let a=0;a<h.length-1;a++){let e=a,n=h.get(++e);if(!n.isWrapped)continue;const i=[h.get(a)];for(;e<h.length&&n.isWrapped;)i.push(n),n=h.get(++e);if(c>=a&&c<e){a+=i.length-1;continue}let r=0,d=o(i,r,l),g=1,_=0;for(;g<i.length;){const u=o(i,g,l),v=u-_,C=s-d,x=Math.min(v,C);i[r].copyCellsFrom(i[g],_,d,x,!1),d+=x,d===s&&(r++,d=0),_+=x,_===u&&(g++,_=0),d===0&&r!==0&&i[r-1].getWidth(s-1)===2&&(i[r].copyCellsFrom(i[r-1],s-1,d++,1,!1),i[r-1].setCell(s-1,f))}i[r].replaceCells(d,s,f);let S=0;for(let u=i.length-1;u>0&&(u>r||i[u].getTrimmedLength()===0);u--)S++;S>0&&(p.push(a+i.length-S),p.push(S)),a+=i.length-1}return p},t.reflowLargerCreateNewLayout=function(h,l){const s=[];let c=0,f=l[c],p=0;for(let a=0;a<h.length;a++)if(f===a){const e=l[++c];h.onDeleteEmitter.fire({index:a-p,amount:e}),a+=e-1,p+=e,f=l[++c]}else s.push(a);return{layout:s,countRemoved:p}},t.reflowLargerApplyNewLayout=function(h,l){const s=[];for(let c=0;c<l.length;c++)s.push(h.get(l[c]));for(let c=0;c<s.length;c++)h.set(c,s[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,s){const c=[],f=h.map((n,i)=>o(h,i,l)).reduce((n,i)=>n+i);let p=0,a=0,e=0;for(;e<f;){if(f-e<s){c.push(f-e);break}p+=s;const n=o(h,a,l);p>n&&(p-=n,a++);const i=h[a].getWidth(p-1)===2;i&&p--;const r=i?s-1:s;c.push(r),e+=r}return c},t.getWrappedLineTrimmedLength=o},5295:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=o(8460),l=o(844),s=o(9092);class c extends l.Disposable{constructor(p,a){super(),this._optionsService=p,this._bufferService=a,this._onBufferActivate=this.register(new h.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 s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.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(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),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(p,a){this._normal.resize(p,a),this._alt.resize(p,a),this.setupTabStops(p)}setupTabStops(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)}}t.BufferSet=c},511:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=o(482),l=o(643),s=o(3734);class c extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(p){const a=new c;return a.setFromCharData(p),a}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let a=!1;if(p[l.CHAR_DATA_CHAR_INDEX].length>2)a=!0;else if(p[l.CHAR_DATA_CHAR_INDEX].length===2){const e=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|p[l.CHAR_DATA_WIDTH_INDEX]<<22:a=!0}else a=!0}else this.content=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[l.CHAR_DATA_WIDTH_INDEX]<<22;a&&(this.combinedData=p[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},643:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=o(8460),l=o(844);class s{get id(){return this._id}constructor(f){this.line=f,this.isDisposed=!1,this._disposables=[],this._id=s._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(f){return this._disposables.push(f),f}}t.Marker=s,s._nextId=1},7116:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(M,t)=>{var o,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(s){s.NUL="\0",s.SOH="",s.STX="",s.ETX="",s.EOT="",s.ENQ="",s.ACK="",s.BEL="\x07",s.BS="\b",s.HT=" ",s.LF=`
|
|
8
|
+
`,s.VT="\v",s.FF="\f",s.CR="\r",s.SO="",s.SI="",s.DLE="",s.DC1="",s.DC2="",s.DC3="",s.DC4="",s.NAK="",s.SYN="",s.ETB="",s.CAN="",s.EM="",s.SUB="",s.ESC="\x1B",s.FS="",s.GS="",s.RS="",s.US="",s.SP=" ",s.DEL=""}(o||(t.C0=o={})),function(s){s.PAD="",s.HOP="",s.BPH="",s.NBH="",s.IND="",s.NEL="
",s.SSA="",s.ESA="",s.HTS="",s.HTJ="",s.VTS="",s.PLD="",s.PLU="",s.RI="",s.SS2="",s.SS3="",s.DCS="",s.PU1="",s.PU2="",s.STS="",s.CCH="",s.MW="",s.SPA="",s.EPA="",s.SOS="",s.SGCI="",s.SCI="",s.CSI="",s.ST="",s.OSC="",s.PM="",s.APC=""}(h||(t.C1=h={})),function(s){s.ST=`${o.ESC}\\`}(l||(t.C1_ESCAPED=l={}))},7399:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=o(2584),l={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:["'",'"']};t.evaluateKeyboardEvent=function(s,c,f,p){const a={type:0,cancel:!1,key:void 0},e=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?a.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":s.key==="UIKeyInputLeftArrow"?a.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":s.key==="UIKeyInputRightArrow"?a.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(a.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:a.key=s.ctrlKey?"\b":h.C0.DEL,s.altKey&&(a.key=h.C0.ESC+a.key);break;case 9:if(s.shiftKey){a.key=h.C0.ESC+"[Z";break}a.key=h.C0.HT,a.cancel=!0;break;case 13:a.key=s.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,a.cancel=!0;break;case 27:a.key=h.C0.ESC,s.altKey&&(a.key=h.C0.ESC+h.C0.ESC),a.cancel=!0;break;case 37:if(s.metaKey)break;e?(a.key=h.C0.ESC+"[1;"+(e+1)+"D",a.key===h.C0.ESC+"[1;3D"&&(a.key=h.C0.ESC+(f?"b":"[1;5D"))):a.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(s.metaKey)break;e?(a.key=h.C0.ESC+"[1;"+(e+1)+"C",a.key===h.C0.ESC+"[1;3C"&&(a.key=h.C0.ESC+(f?"f":"[1;5C"))):a.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(s.metaKey)break;e?(a.key=h.C0.ESC+"[1;"+(e+1)+"A",f||a.key!==h.C0.ESC+"[1;3A"||(a.key=h.C0.ESC+"[1;5A")):a.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(s.metaKey)break;e?(a.key=h.C0.ESC+"[1;"+(e+1)+"B",f||a.key!==h.C0.ESC+"[1;3B"||(a.key=h.C0.ESC+"[1;5B")):a.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:s.shiftKey||s.ctrlKey||(a.key=h.C0.ESC+"[2~");break;case 46:a.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:a.key=e?h.C0.ESC+"[1;"+(e+1)+"H":c?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:a.key=e?h.C0.ESC+"[1;"+(e+1)+"F":c?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:s.shiftKey?a.type=2:s.ctrlKey?a.key=h.C0.ESC+"[5;"+(e+1)+"~":a.key=h.C0.ESC+"[5~";break;case 34:s.shiftKey?a.type=3:s.ctrlKey?a.key=h.C0.ESC+"[6;"+(e+1)+"~":a.key=h.C0.ESC+"[6~";break;case 112:a.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:a.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:a.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:a.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:a.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:a.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:a.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:a.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:a.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:a.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:a.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:a.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!s.ctrlKey||s.shiftKey||s.altKey||s.metaKey)if(f&&!p||!s.altKey||s.metaKey)!f||s.altKey||s.ctrlKey||s.shiftKey||!s.metaKey?s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?a.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(a.key=h.C0.US),s.key==="@"&&(a.key=h.C0.NUL)):s.keyCode===65&&(a.type=1);else{const n=l[s.keyCode],i=n==null?void 0:n[s.shiftKey?1:0];if(i)a.key=h.C0.ESC+i;else if(s.keyCode>=65&&s.keyCode<=90){const r=s.ctrlKey?s.keyCode-64:s.keyCode+32;let d=String.fromCharCode(r);s.shiftKey&&(d=d.toUpperCase()),a.key=h.C0.ESC+d}else if(s.keyCode===32)a.key=h.C0.ESC+(s.ctrlKey?h.C0.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let r=s.code.slice(3,4);s.shiftKey||(r=r.toLowerCase()),a.key=h.C0.ESC+r,a.cancel=!0}}else s.keyCode>=65&&s.keyCode<=90?a.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?a.key=h.C0.NUL:s.keyCode>=51&&s.keyCode<=55?a.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?a.key=h.C0.DEL:s.keyCode===219?a.key=h.C0.ESC:s.keyCode===220?a.key=h.C0.FS:s.keyCode===221&&(a.key=h.C0.GS)}return a}},482:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},t.utf32ToString=function(o,h=0,l=o.length){let s="";for(let c=h;c<l;++c){let f=o[c];f>65535?(f-=65536,s+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):s+=String.fromCharCode(f)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,h){const l=o.length;if(!l)return 0;let s=0,c=0;if(this._interim){const f=o.charCodeAt(c++);56320<=f&&f<=57343?h[s++]=1024*(this._interim-55296)+f-56320+65536:(h[s++]=this._interim,h[s++]=f),this._interim=0}for(let f=c;f<l;++f){const p=o.charCodeAt(f);if(55296<=p&&p<=56319){if(++f>=l)return this._interim=p,s;const a=o.charCodeAt(f);56320<=a&&a<=57343?h[s++]=1024*(p-55296)+a-56320+65536:(h[s++]=p,h[s++]=a)}else p!==65279&&(h[s++]=p)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,h){const l=o.length;if(!l)return 0;let s,c,f,p,a=0,e=0,n=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,S=0;for(;(_=63&this.interim[++S])&&S<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-S;for(;n<v;){if(n>=l)return 0;if(_=o[n++],(192&_)!=128){n--,d=!0;break}this.interim[S++]=_,g<<=6,g|=63&_}d||(u===2?g<128?n--:h[a++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[a++]=g):g<65536||g>1114111||(h[a++]=g)),this.interim.fill(0)}const i=l-4;let r=n;for(;r<l;){for(;!(!(r<i)||128&(s=o[r])||128&(c=o[r+1])||128&(f=o[r+2])||128&(p=o[r+3]));)h[a++]=s,h[a++]=c,h[a++]=f,h[a++]=p,r+=4;if(s=o[r++],s<128)h[a++]=s;else if((224&s)==192){if(r>=l)return this.interim[0]=s,a;if(c=o[r++],(192&c)!=128){r--;continue}if(e=(31&s)<<6|63&c,e<128){r--;continue}h[a++]=e}else if((240&s)==224){if(r>=l)return this.interim[0]=s,a;if(c=o[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=c,a;if(f=o[r++],(192&f)!=128){r--;continue}if(e=(15&s)<<12|(63&c)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[a++]=e}else if((248&s)==240){if(r>=l)return this.interim[0]=s,a;if(c=o[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=c,a;if(f=o[r++],(192&f)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=c,this.interim[2]=f,a;if(p=o[r++],(192&p)!=128){r--;continue}if(e=(7&s)<<18|(63&c)<<12|(63&f)<<6|63&p,e<65536||e>1114111)continue;h[a++]=e}}return a}}},225:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=o(1480),l=[[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]],s=[[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]];let c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let f=0;f<l.length;++f)c.fill(0,l[f][0],l[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?c[f]:function(p,a){let e,n=0,i=a.length-1;if(p<a[0][0]||p>a[i][1])return!1;for(;i>=n;)if(e=n+i>>1,p>a[e][1])n=e+1;else{if(!(p<a[e][0]))return!0;i=e-1}return!1}(f,s)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1}charProperties(f,p){let a=this.wcwidth(f),e=a===0&&p!==0;if(e){const n=h.UnicodeService.extractWidth(p);n===0?e=!1:n>a&&(a=n)}return h.UnicodeService.createPropertyValue(0,a,e)}}},5981:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=o(8460),l=o(844);class s extends l.Disposable{constructor(f){super(),this._action=f,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(f,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let a;for(this._isSyncWriting=!0;a=this._writeBuffer.shift();){this._action(a);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(f,p){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+=f.length,this._writeBuffer.push(f),this._callbacks.push(p),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(p)}_innerWrite(f=0,p=!0){const a=f||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],n=this._action(e,p);if(n){const r=d=>Date.now()-a>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(a,d);return void n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(r)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-a>=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()}}t.WriteBuffer=s},5941:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const 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})$/,h=/^[\da-f]+$/;function l(s,c){const f=s.toString(16),p=f.length<2?"0"+f:f;switch(c){case 4:return f[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}t.parseColor=function(s){if(!s)return;let c=s.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const f=o.exec(c);if(f){const p=f[1]?15:f[4]?255:f[7]?4095:65535;return[Math.round(parseInt(f[1]||f[4]||f[7]||f[10],16)/p*255),Math.round(parseInt(f[2]||f[5]||f[8]||f[11],16)/p*255),Math.round(parseInt(f[3]||f[6]||f[9]||f[12],16)/p*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const f=c.length/3,p=[0,0,0];for(let a=0;a<3;++a){const e=parseInt(c.slice(f*a,f*a+f),16);p[a]=f===1?e<<4:f===2?e:f===3?e>>4:e>>8}return p}},t.toRgbString=function(s,c=16){const[f,p,a]=s;return`rgb:${l(f,c)}/${l(p,c)}/${l(a,c)}`}},5770:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=o(482),l=o(8742),s=o(5770),c=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=c,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}registerHandler(p,a){this._handlers[p]===void 0&&(this._handlers[p]=[]);const e=this._handlers[p];return e.push(a),{dispose:()=>{const n=e.indexOf(a);n!==-1&&e.splice(n,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=c,this._ident=0}hook(p,a){if(this.reset(),this._ident=p,this._active=this._handlers[p]||c,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(a);else this._handlerFb(this._ident,"HOOK",a)}put(p,a,e){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(p,a,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(p,a,e))}unhook(p,a=!0){if(this._active.length){let e=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,e=a,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;n>=0&&(e=this._active[n].unhook(p),e!==!0);n--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,e;n--}for(;n>=0;n--)if(e=this._active[n].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",p);this._active=c,this._ident=0}};const f=new l.Params;f.addParam(0),t.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=f,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():f,this._data="",this._hitLimit=!1}put(p,a,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(p,a,e),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let a=!1;if(this._hitLimit)a=!1;else if(p&&(a=this._handler(this._data,this._params),a instanceof Promise))return a.then(e=>(this._params=f,this._data="",this._hitLimit=!1,e));return this._params=f,this._data="",this._hitLimit=!1,a}}},2015:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=o(844),l=o(8742),s=o(6242),c=o(6351);class f{constructor(n){this.table=new Uint8Array(n)}setDefault(n,i){this.table.fill(n<<4|i)}add(n,i,r,d){this.table[i<<8|n]=r<<4|d}addMany(n,i,r,d){for(let g=0;g<n.length;g++)this.table[i<<8|n[g]]=r<<4|d}}t.TransitionTable=f;const p=160;t.VT500_TRANSITION_TABLE=function(){const e=new f(4095),n=Array.apply(null,Array(256)).map((S,u)=>u),i=(S,u)=>n.slice(S,u),r=i(32,127),d=i(0,24);d.push(25),d.push.apply(d,i(28,32));const g=i(0,14);let _;for(_ in e.setDefault(1,0),e.addMany(r,0,2,0),g)e.addMany([24,26,153,154],_,3,0),e.addMany(i(128,144),_,3,0),e.addMany(i(144,152),_,3,0),e.add(156,_,0,0),e.add(27,_,11,1),e.add(157,_,4,8),e.addMany([152,158,159],_,0,7),e.add(155,_,11,3),e.add(144,_,11,9);return e.addMany(d,0,3,0),e.addMany(d,1,3,1),e.add(127,1,0,1),e.addMany(d,8,0,8),e.addMany(d,3,3,3),e.add(127,3,0,3),e.addMany(d,4,3,4),e.add(127,4,0,4),e.addMany(d,6,3,6),e.addMany(d,5,3,5),e.add(127,5,0,5),e.addMany(d,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(d,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(d,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(d,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(d,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(d,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(d,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(p,0,2,0),e.add(p,8,5,8),e.add(p,6,0,6),e.add(p,11,0,11),e.add(p,13,13,13),e}();class a extends h.Disposable{constructor(n=t.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,d)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new s.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,i=[64,126]){let r=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=n.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<n.intermediates.length;++g){const _=n.intermediates.charCodeAt(g);if(32>_||_>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=_}}if(n.final.length!==1)throw new Error("final must be a single byte");const d=n.final.charCodeAt(0);if(i[0]>d||d>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=d,r}identToString(n){const i=[];for(;n;)i.push(String.fromCharCode(255&n)),n>>=8;return i.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,i){const r=this._identifier(n,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);const d=this._escHandlers[r];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,i){this._executeHandlers[n.charCodeAt(0)]=i}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,i){const r=this._identifier(n);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);const d=this._csiHandlers[r];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,i){return this._dcsParser.registerHandler(this._identifier(n),i)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,i){return this._oscParser.registerHandler(n,i)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,i,r,d,g){this._parseStack.state=n,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=d,this._parseStack.chunkPos=g}parse(n,i,r){let d,g=0,_=0,S=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,S=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");const u=this._parseStack.handlers;let v=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&v>-1){for(;v>=0&&(d=u[v](this._params),d!==!0);v--)if(d instanceof Promise)return this._parseStack.handlerPos=v,d}this._parseStack.handlers=[];break;case 4:if(r===!1&&v>-1){for(;v>=0&&(d=u[v](),d!==!0);v--)if(d instanceof Promise)return this._parseStack.handlerPos=v,d}this._parseStack.handlers=[];break;case 6:if(g=n[this._parseStack.chunkPos],d=this._dcsParser.unhook(g!==24&&g!==26,r),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=n[this._parseStack.chunkPos],d=this._oscParser.end(g!==24&&g!==26,r),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,S=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=S;u<i;++u){switch(g=n[u],_=this._transitions.table[this.currentState<<8|(g<160?g:p)],_>>4){case 2:for(let L=u+1;;++L){if(L>=i||(g=n[L])<32||g>126&&g<p){this._printHandler(n,u,L),u=L-1;break}if(++L>=i||(g=n[L])<32||g>126&&g<p){this._printHandler(n,u,L),u=L-1;break}if(++L>=i||(g=n[L])<32||g>126&&g<p){this._printHandler(n,u,L),u=L-1;break}if(++L>=i||(g=n[L])<32||g>126&&g<p){this._printHandler(n,u,L),u=L-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const v=this._csiHandlers[this._collect<<8|g];let C=v?v.length-1:-1;for(;C>=0&&(d=v[C](this._params),d!==!0);C--)if(d instanceof Promise)return this._preserveStack(3,v,C,_,u),d;C<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++u<i&&(g=n[u])>47&&g<60);u--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const x=this._escHandlers[this._collect<<8|g];let y=x?x.length-1:-1;for(;y>=0&&(d=x[y](),d!==!0);y--)if(d instanceof Promise)return this._preserveStack(4,x,y,_,u),d;y<0&&this._escHandlerFb(this._collect<<8|g),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|g,this._params);break;case 13:for(let L=u+1;;++L)if(L>=i||(g=n[L])===24||g===26||g===27||g>127&&g<p){this._dcsParser.put(n,u,L),u=L-1;break}break;case 14:if(d=this._dcsParser.unhook(g!==24&&g!==26),d)return this._preserveStack(6,[],0,_,u),d;g===27&&(_|=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 L=u+1;;L++)if(L>=i||(g=n[L])<32||g>127&&g<p){this._oscParser.put(n,u,L),u=L-1;break}break;case 6:if(d=this._oscParser.end(g!==24&&g!==26),d)return this._preserveStack(5,[],0,_,u),d;g===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&_}}}t.EscapeSequenceParser=a},6242:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=o(5770),l=o(482),s=[];t.OscParser=class{constructor(){this._state=0,this._active=s,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,f){this._handlers[c]===void 0&&(this._handlers[c]=[]);const p=this._handlers[c];return p.push(f),{dispose:()=>{const a=p.indexOf(f);a!==-1&&p.splice(a,1)}}}clearHandler(c){this._handlers[c]&&delete this._handlers[c]}setHandlerFallback(c){this._handlerFb=c}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=s}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=s,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||s,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,f,p){if(this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].put(c,f,p);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,f,p))}start(){this.reset(),this._state=1}put(c,f,p){if(this._state!==3){if(this._state===1)for(;f<p;){const a=c[f++];if(a===59){this._state=2,this._start();break}if(a<48||57<a)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+a-48}this._state===2&&p-f>0&&this._put(c,f,p)}}end(c,f=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,a=this._active.length-1,e=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,p=f,e=this._stack.fallThrough,this._stack.paused=!1),!e&&p===!1){for(;a>=0&&(p=this._active[a].end(c),p!==!0);a--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,p;a--}for(;a>=0;a--)if(p=this._active[a].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",c);this._active=s,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,f,p){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,f,p),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let f=!1;if(this._hitLimit)f=!1;else if(c&&(f=this._handler(this._data),f instanceof Promise))return f.then(p=>(this._data="",this._hitLimit=!1,p));return this._data="",this._hitLimit=!1,f}}},8742:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const o=2147483647;class h{static fromArray(s){const c=new h;if(!s.length)return c;for(let f=Array.isArray(s[0])?1:0;f<s.length;++f){const p=s[f];if(Array.isArray(p))for(let a=0;a<p.length;++a)c.addSubParam(p[a]);else c.addParam(p)}return c}constructor(s=32,c=32){if(this.maxLength=s,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const s=new h(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){const s=[];for(let c=0;c<this.length;++c){s.push(this.params[c]);const f=this._subParamsIdx[c]>>8,p=255&this._subParamsIdx[c];p-f>0&&s.push(Array.prototype.slice.call(this._subParams,f,p))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>o?o:s}}addSubParam(s){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>o?o:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(255&this._subParamsIdx[s])-(this._subParamsIdx[s]>>8)>0}getSubParams(s){const c=this._subParamsIdx[s]>>8,f=255&this._subParamsIdx[s];return f-c>0?this._subParams.subarray(c,f):null}getSubParamsAll(){const s={};for(let c=0;c<this.length;++c){const f=this._subParamsIdx[c]>>8,p=255&this._subParamsIdx[c];p-f>0&&(s[c]=this._subParams.slice(f,p))}return s}addDigit(s){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const f=this._digitIsSub?this._subParams:this.params,p=f[c-1];f[c-1]=~p?Math.min(10*p+s,o):s}}t.Params=h},5741:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,h){const l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===o){h=l;break}if(h===-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(h,1)}}},8771:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=o(3785),l=o(511);t.BufferApiView=class{constructor(s,c){this._buffer=s,this.type=c}init(s){return this._buffer=s,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(s){const c=this._buffer.lines.get(s);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=o(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,s){if(!(l<0||l>=this._line.length))return s?(this._line.loadCell(l,s),s):this._line.loadCell(l,new h.CellData)}translateToString(l,s,c){return this._line.translateToString(l,s,c)}}},8285:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=o(8771),l=o(8460),s=o(844);class c extends s.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.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)}}t.BufferNamespaceApi=c},7975:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,h){return this._core.registerCsiHandler(o,l=>h(l.toArray()))}addCsiHandler(o,h){return this.registerCsiHandler(o,h)}registerDcsHandler(o,h){return this._core.registerDcsHandler(o,(l,s)=>h(l,s.toArray()))}addDcsHandler(o,h){return this.registerDcsHandler(o,h)}registerEscHandler(o,h){return this._core.registerEscHandler(o,h)}addEscHandler(o,h){return this.registerEscHandler(o,h)}registerOscHandler(o,h){return this._core.registerOscHandler(o,h)}addOscHandler(o,h){return this.registerOscHandler(o,h)}}},7090:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.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(M,t,o){var h=this&&this.__decorate||function(e,n,i,r){var d,g=arguments.length,_=g<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,n,i,r);else for(var S=e.length-1;S>=0;S--)(d=e[S])&&(_=(g<3?d(_):g>3?d(n,i,_):d(n,i))||_);return g>3&&_&&Object.defineProperty(n,i,_),_},l=this&&this.__param||function(e,n){return function(i,r){n(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const s=o(8460),c=o(844),f=o(5295),p=o(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let a=t.BufferService=class extends c.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new f.BufferSet(e,this))}resize(e,n){this.cols=e,this.rows=n,this.buffers.resize(e,n),this._onResize.fire({cols:e,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,n=!1){const i=this.buffer;let r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,n),this._cachedBlankLine=r),r.isWrapped=n;const d=i.ybase+i.scrollTop,g=i.ybase+i.scrollBottom;if(i.scrollTop===0){const _=i.lines.isFull;g===i.lines.length-1?_?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(g+1,0,r.clone()),_?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const _=g-d+1;i.lines.shiftElements(d+1,_-1,-1),i.lines.set(g,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,n,i){const r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);const d=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),d!==r.ydisp&&(n||this._onScroll.fire(r.ydisp))}};t.BufferService=a=h([l(0,p.IOptionsService)],a)},7994:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.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,h){this._charsets[o]=h,this.glevel===o&&(this.charset=h)}}},1753:function(M,t,o){var h=this&&this.__decorate||function(r,d,g,_){var S,u=arguments.length,v=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(r,d,g,_);else for(var C=r.length-1;C>=0;C--)(S=r[C])&&(v=(u<3?S(v):u>3?S(d,g,v):S(d,g))||v);return u>3&&v&&Object.defineProperty(d,g,v),v},l=this&&this.__param||function(r,d){return function(g,_){d(g,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const s=o(2585),c=o(8460),f=o(844),p={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 a(r,d){let g=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(g|=64,g|=r.action):(g|=3&r.button,4&r.button&&(g|=64),8&r.button&&(g|=128),r.action===32?g|=32:r.action!==0||d||(g|=3)),g}const e=String.fromCharCode,n={DEFAULT:r=>{const d=[a(r,!1)+32,r.col+32,r.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${e(d[0])}${e(d[1])}${e(d[2])}`},SGR:r=>{const d=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${a(r,!0)};${r.col};${r.row}${d}`},SGR_PIXELS:r=>{const d=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${a(r,!0)};${r.x};${r.y}${d}`}};let i=t.CoreMouseService=class extends f.Disposable{constructor(r,d){super(),this._bufferService=r,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new c.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const g of Object.keys(p))this.addProtocol(g,p[g]);for(const g of Object.keys(n))this.addEncoding(g,n[g]);this.reset()}addProtocol(r,d){this._protocols[r]=d}addEncoding(r,d){this._encodings[r]=d}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;const d=this._encodings[this._activeEncoding](r);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!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,d,g){if(g){if(r.x!==d.x||r.y!==d.y)return!1}else if(r.col!==d.col||r.row!==d.row)return!1;return r.button===d.button&&r.action===d.action&&r.ctrl===d.ctrl&&r.alt===d.alt&&r.shift===d.shift}};t.CoreMouseService=i=h([l(0,s.IBufferService),l(1,s.ICoreService)],i)},6975:function(M,t,o){var h=this&&this.__decorate||function(i,r,d,g){var _,S=arguments.length,u=S<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,r,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(S<3?_(u):S>3?_(r,d,u):_(r,d))||u);return S>3&&u&&Object.defineProperty(r,d,u),u},l=this&&this.__param||function(i,r){return function(d,g){r(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const s=o(1439),c=o(8460),f=o(844),p=o(2585),a=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=t.CoreService=class extends f.Disposable{constructor(i,r,d){super(),this._bufferService=i,this._logService=r,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new c.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new c.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,s.clone)(a),this.decPrivateModes=(0,s.clone)(e)}reset(){this.modes=(0,s.clone)(a),this.decPrivateModes=(0,s.clone)(e)}triggerDataEvent(i,r=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(g=>g.charCodeAt(0))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,()=>i.split("").map(r=>r.charCodeAt(0))),this._onBinary.fire(i))}};t.CoreService=n=h([l(0,p.IBufferService),l(1,p.ILogService),l(2,p.IOptionsService)],n)},9074:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=o(8055),l=o(8460),s=o(844),c=o(6106);let f=0,p=0;class a extends s.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,s.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const r=new e(i);if(r){const d=r.marker.onDispose(()=>r.dispose());r.onDispose(()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),d.dispose())}),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,r,d){let g=0,_=0;for(const S of this._decorations.getKeyIterator(r))g=S.options.x??0,_=g+(S.options.width??1),i>=g&&i<_&&(!d||(S.options.layer??"bottom")===d)&&(yield S)}forEachDecorationAtCell(i,r,d,g){this._decorations.forEachByKey(r,_=>{f=_.options.x??0,p=f+(_.options.width??1),i>=f&&i<p&&(!d||(_.options.layer??"bottom")===d)&&g(_)})}}t.DecorationService=a;class e extends s.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=o(2585),l=o(8343);class s{constructor(...f){this._entries=new Map;for(const[p,a]of f)this.set(p,a)}set(f,p){const a=this._entries.get(f);return this._entries.set(f,p),a}forEach(f){for(const[p,a]of this._entries.entries())f(p,a)}has(f){return this._entries.has(f)}get(f){return this._entries.get(f)}}t.ServiceCollection=s,t.InstantiationService=class{constructor(){this._services=new s,this._services.set(h.IInstantiationService,this)}setService(c,f){this._services.set(c,f)}getService(c){return this._services.get(c)}createInstance(c,...f){const p=(0,l.getServiceDependencies)(c).sort((n,i)=>n.index-i.index),a=[];for(const n of p){const i=this._services.get(n.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${n.id}.`);a.push(i)}const e=p.length>0?p[0].index:f.length;if(f.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${f.length} static arguments`);return new c(...f,...a)}}},7866:function(M,t,o){var h=this&&this.__decorate||function(e,n,i,r){var d,g=arguments.length,_=g<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,n,i,r);else for(var S=e.length-1;S>=0;S--)(d=e[S])&&(_=(g<3?d(_):g>3?d(n,i,_):d(n,i))||_);return g>3&&_&&Object.defineProperty(n,i,_),_},l=this&&this.__param||function(e,n){return function(i,r){n(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=o(844),c=o(2585),f={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let p,a=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),p=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(e,...n){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,n)}};t.LogService=a=h([l(0,c.IOptionsService)],a),t.setTraceLogger=function(e){p=e},t.traceCall=function(e,n,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(...d){if(p.logLevel!==c.LogLevelEnum.TRACE)return r.apply(this,d);p.trace(`GlyphRenderer#${r.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=r.apply(this,d);return p.trace(`GlyphRenderer#${r.name} return`,g),g}}},7302:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=o(8460),l=o(844),s=o(6114);t.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:s.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class f extends l.Disposable{constructor(a){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const n in a)if(n in e)try{const i=a[n];e[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(a,e){return this.onOptionChange(n=>{n===a&&e(this.rawOptions[a])})}onMultipleOptionChange(a,e){return this.onOptionChange(n=>{a.indexOf(n)!==-1&&e()})}_setupOptions(){const a=n=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},e=(n,i)=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const i={get:a.bind(this,n),set:e.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(a,e){switch(a){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[a]),!function(n){return n==="block"||n==="underline"||n==="bar"}(e))throw new Error(`"${e}" is not a valid value for ${a}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[a]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[a];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${a} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${a} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${a} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${a} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=f},2660:function(M,t,o){var h=this&&this.__decorate||function(f,p,a,e){var n,i=arguments.length,r=i<3?p:e===null?e=Object.getOwnPropertyDescriptor(p,a):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(f,p,a,e);else for(var d=f.length-1;d>=0;d--)(n=f[d])&&(r=(i<3?n(r):i>3?n(p,a,r):n(p,a))||r);return i>3&&r&&Object.defineProperty(p,a,r),r},l=this&&this.__param||function(f,p){return function(a,e){p(a,e,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const s=o(2585);let c=t.OscLinkService=class{constructor(f){this._bufferService=f,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(f){const p=this._bufferService.buffer;if(f.id===void 0){const d=p.addMarker(p.ybase+p.y),g={data:f,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(g,d)),this._dataByLinkId.set(g.id,g),g.id}const a=f,e=this._getEntryIdKey(a),n=this._entriesWithId.get(e);if(n)return this.addLineToLink(n.id,p.ybase+p.y),n.id;const i=p.addMarker(p.ybase+p.y),r={id:this._nextId++,key:this._getEntryIdKey(a),data:a,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(r,i)),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(f,p){const a=this._dataByLinkId.get(f);if(a&&a.lines.every(e=>e.line!==p)){const e=this._bufferService.buffer.addMarker(p);a.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(a,e))}}getLinkData(f){var p;return(p=this._dataByLinkId.get(f))==null?void 0:p.data}_getEntryIdKey(f){return`${f.id};;${f.uri}`}_removeMarkerFromLink(f,p){const a=f.lines.indexOf(p);a!==-1&&(f.lines.splice(a,1),f.lines.length===0&&(f.data.id!==void 0&&this._entriesWithId.delete(f.key),this._dataByLinkId.delete(f.id)))}};t.OscLinkService=c=h([l(0,s.IBufferService)],c)},8343:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const o="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const s=function(c,f,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(a,e,n){e[o]===e?e[h].push({id:a,index:n}):(e[h]=[{id:a,index:n}],e[o]=e)})(s,c,p)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},2585:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=o(8343);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=o(8460),l=o(225);class s{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,p,a=!1){return(16777215&f)<<3|(3&p)<<1|(a?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const f=new l.UnicodeV6;this.register(f),this._active=f.version,this._activeProvider=f}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(f){if(!this._providers[f])throw new Error(`unknown Unicode version "${f}"`);this._active=f,this._activeProvider=this._providers[f],this._onChange.fire(f)}register(f){this._providers[f.version]=f}wcwidth(f){return this._activeProvider.wcwidth(f)}getStringCellWidth(f){let p=0,a=0;const e=f.length;for(let n=0;n<e;++n){let i=f.charCodeAt(n);if(55296<=i&&i<=56319){if(++n>=e)return p+this.wcwidth(i);const g=f.charCodeAt(n);56320<=g&&g<=57343?i=1024*(i-55296)+g-56320+65536:p+=this.wcwidth(g)}const r=this.charProperties(i,a);let d=s.extractWidth(r);s.extractShouldJoin(r)&&(d-=s.extractWidth(a)),p+=d,a=r}return p}charProperties(f,p){return this._activeProvider.charProperties(f,p)}}t.UnicodeService=s}},D={};function B(M){var t=D[M];if(t!==void 0)return t.exports;var o=D[M]={exports:{}};return E[M].call(o.exports,o,o.exports,B),o.exports}var H={};return(()=>{var M=H;Object.defineProperty(M,"__esModule",{value:!0}),M.Terminal=void 0;const t=B(9042),o=B(3236),h=B(844),l=B(5741),s=B(8285),c=B(7975),f=B(7090),p=["cols","rows"];class a extends h.Disposable{constructor(n){super(),this._core=this.register(new o.Terminal(n)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=d=>this._core.options[d],r=(d,g)=>{this._checkReadonlyOptions(d),this._core.options[d]=g};for(const d in this._core.options){const g={get:i.bind(this,d),set:r.bind(this,d)};Object.defineProperty(this._publicOptions,d,g)}}_checkReadonlyOptions(n){if(p.includes(n))throw new Error(`Option "${n}" 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 c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.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 s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const i in n)this._publicOptions[i]=n[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,i=!0){this._core.input(n,i)}resize(n,i){this._verifyIntegers(n,i),this._core.resize(n,i)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,i,r){this._verifyIntegers(n,i,r),this._core.select(n,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,i){this._verifyIntegers(n,i),this._core.selectLines(n,i)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,i){this._core.write(n,i)}writeln(n,i){this._core.write(n),this._core.write(`\r
|
|
9
|
+
`,i)}paste(n){this._core.paste(n)}refresh(n,i){this._verifyIntegers(n,i),this._core.refresh(n,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const i of n)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const i of n)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}M.Terminal=a})(),H})())})(ii);var ss=ii.exports,ri={exports:{}};(function(m,w){(function(E,D){m.exports=D()})(self,()=>(()=>{var E={};return(()=>{var D=E;Object.defineProperty(D,"__esModule",{value:!0}),D.FitAddon=void 0,D.FitAddon=class{activate(B){this._terminal=B}dispose(){}fit(){const B=this.proposeDimensions();if(!B||!this._terminal||isNaN(B.cols)||isNaN(B.rows))return;const H=this._terminal._core;this._terminal.rows===B.rows&&this._terminal.cols===B.cols||(H._renderService.clear(),this._terminal.resize(B.cols,B.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const B=this._terminal._core,H=B._renderService.dimensions;if(H.css.cell.width===0||H.css.cell.height===0)return;const M=this._terminal.options.scrollback===0?0:B.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),s=o-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-M;return{cols:Math.max(2,Math.floor(c/H.css.cell.width)),rows:Math.max(1,Math.floor(s/H.css.cell.height))}}}})(),E})())})(ri);var rs=ri.exports,ni={exports:{}};(function(m,w){(function(E,D){m.exports=D()})(self,()=>(()=>{var E={965:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=o(374),l=o(509),s=o(855),c=o(859),f=o(381),p=11,a=p*Float32Array.BYTES_PER_ELEMENT;let e,n=0,i=0,r=0;class d extends c.Disposable{constructor(_,S,u,v){super(),this._terminal=_,this._gl=S,this._dimensions=u,this._optionsService=v,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const C=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(C.getParameter(C.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(C.getParameter(C.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,f.createProgram)(C,`#version 300 es
|
|
10
10
|
layout (location = 0) in vec2 a_unitquad;
|
|
11
11
|
layout (location = 1) in vec2 a_cellpos;
|
|
12
12
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -40,7 +40,7 @@ void main() {
|
|
|
40
40
|
if (v_texpage == 0) {
|
|
41
41
|
outColor = texture(u_texture[0], v_texcoord);
|
|
42
42
|
} ${$}
|
|
43
|
-
}`}(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)(()=>C.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(C.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(C.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(C.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=C.createVertexArray(),C.bindVertexArray(this._vertexArrayObject);const x=new Float32Array([0,0,1,0,0,1,1,1]),
|
|
43
|
+
}`}(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)(()=>C.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(C.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(C.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(C.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=C.createVertexArray(),C.bindVertexArray(this._vertexArrayObject);const x=new Float32Array([0,0,1,0,0,1,1,1]),y=C.createBuffer();this.register((0,c.toDisposable)(()=>C.deleteBuffer(y))),C.bindBuffer(C.ARRAY_BUFFER,y),C.bufferData(C.ARRAY_BUFFER,x,C.STATIC_DRAW),C.enableVertexAttribArray(0),C.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const L=new Uint8Array([0,1,2,3]),A=C.createBuffer();this.register((0,c.toDisposable)(()=>C.deleteBuffer(A))),C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,A),C.bufferData(C.ELEMENT_ARRAY_BUFFER,L,C.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(C.createBuffer()),this.register((0,c.toDisposable)(()=>C.deleteBuffer(this._attributesBuffer))),C.bindBuffer(C.ARRAY_BUFFER,this._attributesBuffer),C.enableVertexAttribArray(2),C.vertexAttribPointer(2,2,C.FLOAT,!1,a,0),C.vertexAttribDivisor(2,1),C.enableVertexAttribArray(3),C.vertexAttribPointer(3,2,C.FLOAT,!1,a,2*Float32Array.BYTES_PER_ELEMENT),C.vertexAttribDivisor(3,1),C.enableVertexAttribArray(4),C.vertexAttribPointer(4,1,C.FLOAT,!1,a,4*Float32Array.BYTES_PER_ELEMENT),C.vertexAttribDivisor(4,1),C.enableVertexAttribArray(5),C.vertexAttribPointer(5,2,C.FLOAT,!1,a,5*Float32Array.BYTES_PER_ELEMENT),C.vertexAttribDivisor(5,1),C.enableVertexAttribArray(6),C.vertexAttribPointer(6,2,C.FLOAT,!1,a,7*Float32Array.BYTES_PER_ELEMENT),C.vertexAttribDivisor(6,1),C.enableVertexAttribArray(1),C.vertexAttribPointer(1,2,C.FLOAT,!1,a,9*Float32Array.BYTES_PER_ELEMENT),C.vertexAttribDivisor(1,1),C.useProgram(this._program);const I=new Int32Array(l.TextureAtlas.maxAtlasPages);for(let N=0;N<l.TextureAtlas.maxAtlasPages;N++)I[N]=N;C.uniform1iv(this._textureLocation,I),C.uniformMatrix4fv(this._projectionLocation,!1,f.PROJECTION_MATRIX),this._atlasTextures=[];for(let N=0;N<l.TextureAtlas.maxAtlasPages;N++){const $=new f.GLTexture((0,h.throwIfFalsy)(C.createTexture()));this.register((0,c.toDisposable)(()=>C.deleteTexture($.texture))),C.activeTexture(C.TEXTURE0+N),C.bindTexture(C.TEXTURE_2D,$.texture),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_S,C.CLAMP_TO_EDGE),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_T,C.CLAMP_TO_EDGE),C.texImage2D(C.TEXTURE_2D,0,C.RGBA,1,1,0,C.RGBA,C.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[N]=$}C.enable(C.BLEND),C.blendFunc(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(_,S,u,v,C,x,y,L,A){this._updateCell(this._vertices.attributes,_,S,u,v,C,x,y,L,A)}_updateCell(_,S,u,v,C,x,y,L,A,I){n=(u*this._terminal.cols+S)*p,v!==s.NULL_CELL_CODE&&v!==void 0?this._atlas&&(e=L&&L.length>1?this._atlas.getRasterizedGlyphCombinedChar(L,C,x,y,!1):this._atlas.getRasterizedGlyph(v,C,x,y,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),C!==I&&e.offset.x>i?(r=e.offset.x-i,_[n]=-(e.offset.x-r)+this._dimensions.device.char.left,_[n+1]=-e.offset.y+this._dimensions.device.char.top,_[n+2]=(e.size.x-r)/this._dimensions.device.canvas.width,_[n+3]=e.size.y/this._dimensions.device.canvas.height,_[n+4]=e.texturePage,_[n+5]=e.texturePositionClipSpace.x+r/this._atlas.pages[e.texturePage].canvas.width,_[n+6]=e.texturePositionClipSpace.y,_[n+7]=e.sizeClipSpace.x-r/this._atlas.pages[e.texturePage].canvas.width,_[n+8]=e.sizeClipSpace.y):(_[n]=-e.offset.x+this._dimensions.device.char.left,_[n+1]=-e.offset.y+this._dimensions.device.char.top,_[n+2]=e.size.x/this._dimensions.device.canvas.width,_[n+3]=e.size.y/this._dimensions.device.canvas.height,_[n+4]=e.texturePage,_[n+5]=e.texturePositionClipSpace.x,_[n+6]=e.texturePositionClipSpace.y,_[n+7]=e.sizeClipSpace.x,_[n+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(v,A,e.size.x,this._dimensions.device.cell.width)&&(_[n+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):_.fill(0,n,n+p-1-2)}clear(){const _=this._terminal,S=_.cols*_.rows*p;this._vertices.count!==S?this._vertices.attributes=new Float32Array(S):this._vertices.attributes.fill(0);let u=0;for(;u<this._vertices.attributesBuffers.length;u++)this._vertices.count!==S?this._vertices.attributesBuffers[u]=new Float32Array(S):this._vertices.attributesBuffers[u].fill(0);this._vertices.count=S,u=0;for(let v=0;v<_.rows;v++)for(let C=0;C<_.cols;C++)this._vertices.attributes[u+9]=C/_.cols,this._vertices.attributes[u+10]=v/_.rows,u+=p}handleResize(){const _=this._gl;_.useProgram(this._program),_.viewport(0,0,_.canvas.width,_.canvas.height),_.uniform2f(this._resolutionLocation,_.canvas.width,_.canvas.height),this.clear()}render(_){if(!this._atlas)return;const S=this._gl;S.useProgram(this._program),S.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const u=this._vertices.attributesBuffers[this._activeBuffer];let v=0;for(let C=0;C<_.lineLengths.length;C++){const x=C*this._terminal.cols*p,y=this._vertices.attributes.subarray(x,x+_.lineLengths[C]*p);u.set(y,v),v+=y.length}S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.bufferData(S.ARRAY_BUFFER,u.subarray(0,v),S.STREAM_DRAW);for(let C=0;C<this._atlas.pages.length;C++)this._atlas.pages[C].version!==this._atlasTextures[C].version&&this._bindAtlasPageTexture(S,this._atlas,C);S.drawElementsInstanced(S.TRIANGLE_STRIP,4,S.UNSIGNED_BYTE,0,v/p)}setAtlas(_){this._atlas=_;for(const S of this._atlasTextures)S.version=-1}_bindAtlasPageTexture(_,S,u){_.activeTexture(_.TEXTURE0+u),_.bindTexture(_.TEXTURE_2D,this._atlasTextures[u].texture),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,S.pages[u].canvas),_.generateMipmap(_.TEXTURE_2D),this._atlasTextures[u].version=S.pages[u].version}setDimensions(_){this._dimensions=_}}t.GlyphRenderer=d},742:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=o(374),l=o(859),s=o(310),c=o(381),f=8*Float32Array.BYTES_PER_ELEMENT;class p{constructor(){this.attributes=new Float32Array(160),this.count=0}}let a=0,e=0,n=0,i=0,r=0,d=0,g=0;class _ extends l.Disposable{constructor(u,v,C,x){super(),this._terminal=u,this._gl=v,this._dimensions=C,this._themeService=x,this._vertices=new p,this._verticesCursor=new p;const y=this._gl;this._program=(0,h.throwIfFalsy)((0,c.createProgram)(y,`#version 300 es
|
|
44
44
|
layout (location = 0) in vec2 a_position;
|
|
45
45
|
layout (location = 1) in vec2 a_size;
|
|
46
46
|
layout (location = 2) in vec4 a_color;
|
|
@@ -63,7 +63,7 @@ out vec4 outColor;
|
|
|
63
63
|
|
|
64
64
|
void main() {
|
|
65
65
|
outColor = v_color;
|
|
66
|
-
}`)),this.register((0,l.toDisposable)(()=>w.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=w.createVertexArray(),w.bindVertexArray(this._vertexArrayObject);const E=new Float32Array([0,0,1,0,0,1,1,1]),A=w.createBuffer();this.register((0,l.toDisposable)(()=>w.deleteBuffer(A))),w.bindBuffer(w.ARRAY_BUFFER,A),w.bufferData(w.ARRAY_BUFFER,E,w.STATIC_DRAW),w.enableVertexAttribArray(3),w.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const I=new Uint8Array([0,1,2,3]),N=w.createBuffer();this.register((0,l.toDisposable)(()=>w.deleteBuffer(N))),w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,N),w.bufferData(w.ELEMENT_ARRAY_BUFFER,I,w.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(w.createBuffer()),this.register((0,l.toDisposable)(()=>w.deleteBuffer(this._attributesBuffer))),w.bindBuffer(w.ARRAY_BUFFER,this._attributesBuffer),w.enableVertexAttribArray(0),w.vertexAttribPointer(0,2,w.FLOAT,!1,f,0),w.vertexAttribDivisor(0,1),w.enableVertexAttribArray(1),w.vertexAttribPointer(1,2,w.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(1,1),w.enableVertexAttribArray(2),w.vertexAttribPointer(2,4,w.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(2,1),this._updateCachedColors(x.colors),this.register(this._themeService.onChangeColors($=>{this._updateCachedColors($),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(u){const v=this._gl;v.useProgram(this._program),v.bindVertexArray(this._vertexArrayObject),v.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),v.bindBuffer(v.ARRAY_BUFFER,this._attributesBuffer),v.bufferData(v.ARRAY_BUFFER,u.attributes,v.DYNAMIC_DRAW),v.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,v.UNSIGNED_BYTE,0,u.count)}handleResize(){this._updateViewportRectangle()}setDimensions(u){this._dimensions=u}_updateCachedColors(u){this._bgFloat=this._colorToFloat32Array(u.background),this._cursorFloat=this._colorToFloat32Array(u.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(u){const v=this._terminal,C=this._vertices;let x,w,E,A,I,N,$,F,b,k,T,O=1;for(x=0;x<v.rows;x++){for(E=-1,A=0,I=0,N=!1,w=0;w<v.cols;w++)$=(x*v.cols+w)*r.RENDER_MODEL_INDICIES_PER_CELL,F=u.cells[$+r.RENDER_MODEL_BG_OFFSET],b=u.cells[$+r.RENDER_MODEL_FG_OFFSET],k=!!(67108864&b),(F!==A||b!==I&&(N||k))&&((A!==0||N&&I!==0)&&(T=8*O++,this._updateRectangle(C,T,I,A,E,w,x)),E=w,A=F,I=b,N=k);(A!==0||N&&I!==0)&&(T=8*O++,this._updateRectangle(C,T,I,A,E,v.cols,x))}C.count=O}updateCursor(u){const v=this._verticesCursor,C=u.cursor;if(!C||C.style==="block")return void(v.count=0);let x,w=0;C.style!=="bar"&&C.style!=="outline"||(x=8*w++,this._addRectangleFloat(v.attributes,x,C.x*this._dimensions.device.cell.width,C.y*this._dimensions.device.cell.height,C.style==="bar"?C.dpr*C.cursorWidth:C.dpr,this._dimensions.device.cell.height,this._cursorFloat)),C.style!=="underline"&&C.style!=="outline"||(x=8*w++,this._addRectangleFloat(v.attributes,x,C.x*this._dimensions.device.cell.width,(C.y+1)*this._dimensions.device.cell.height-C.dpr,C.width*this._dimensions.device.cell.width,C.dpr,this._cursorFloat)),C.style==="outline"&&(x=8*w++,this._addRectangleFloat(v.attributes,x,C.x*this._dimensions.device.cell.width,C.y*this._dimensions.device.cell.height,C.width*this._dimensions.device.cell.width,C.dpr,this._cursorFloat),x=8*w++,this._addRectangleFloat(v.attributes,x,(C.x+C.width)*this._dimensions.device.cell.width-C.dpr,C.y*this._dimensions.device.cell.height,C.dpr,this._dimensions.device.cell.height,this._cursorFloat)),v.count=w}_updateRectangle(u,v,C,x,w,E,A){if(67108864&C)switch(50331648&C){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&C].rgba;break;case 50331648:o=(16777215&C)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&x){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&x].rgba;break;case 50331648:o=(16777215&x)<<8;break;default:o=this._themeService.colors.background.rgba}u.attributes.length<v+4&&(u.attributes=(0,c.expandFloat32Array)(u.attributes,this._terminal.rows*this._terminal.cols*8)),e=w*this._dimensions.device.cell.width,n=A*this._dimensions.device.cell.height,i=(o>>24&255)/255,s=(o>>16&255)/255,d=(o>>8&255)/255,g=1,this._addRectangle(u.attributes,v,e,n,(E-w)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,s,d,g)}_addRectangle(u,v,C,x,w,E,A,I,N,$){u[v]=C/this._dimensions.device.canvas.width,u[v+1]=x/this._dimensions.device.canvas.height,u[v+2]=w/this._dimensions.device.canvas.width,u[v+3]=E/this._dimensions.device.canvas.height,u[v+4]=A,u[v+5]=I,u[v+6]=N,u[v+7]=$}_addRectangleFloat(u,v,C,x,w,E,A){u[v]=C/this._dimensions.device.canvas.width,u[v+1]=x/this._dimensions.device.canvas.height,u[v+2]=w/this._dimensions.device.canvas.width,u[v+3]=E/this._dimensions.device.canvas.height,u[v+4]=A[0],u[v+5]=A[1],u[v+6]=A[2],u[v+7]=A[3]}_colorToFloat32Array(u){return new Float32Array([(u.rgba>>24&255)/255,(u.rgba>>16&255)/255,(u.rgba>>8&255)/255,(255&u.rgba)/255])}}t.RectangleRenderer=_},310:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,r){const c=l*r*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),r=a(627),c=a(457),f=a(56),p=a(374),o=a(345),e=a(859),n=a(147),i=a(782),s=a(855),d=a(965),g=a(742),_=a(310),S=a(733);class u extends e.Disposable{constructor(w,E,A,I,N,$,F,b,k){super(),this._terminal=w,this._characterJoinerService=E,this._charSizeService=A,this._coreBrowserService=I,this._coreService=N,this._decorationService=$,this._optionsService=F,this._themeService=b,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new _.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new S.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,F,this._themeService)],this.dimensions=(0,p.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(F.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const T={antialias:!1,depth:!1,preserveDrawingBuffer:k};if(this._gl=this._canvas.getContext("webgl2",T),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",O=>{console.log("webglcontextlost event received"),O.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(O)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",O=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,r.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(O,U)=>this._setCanvasDevicePixelDimensions(O,U)),this.register(this._coreBrowserService.onWindowChange(O=>{this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,O,(U,q)=>this._setCanvasDevicePixelDimensions(U,q))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var O;for(const U of this._renderLayers)U.dispose();(O=this._canvas.parentElement)==null||O.removeChild(this._canvas),(0,r.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var w;return(w=this._charAtlas)==null?void 0:w.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(w,E){var A,I,N,$;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const F of this._renderLayers)F.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(A=this._rectangleRenderer.value)==null||A.setDimensions(this.dimensions),(I=this._rectangleRenderer.value)==null||I.handleResize(),(N=this._glyphRenderer.value)==null||N.setDimensions(this.dimensions),($=this._glyphRenderer.value)==null||$.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var w;for(const E of this._renderLayers)E.handleBlur(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.pause(),this._requestRedrawViewport()}handleFocus(){var w;for(const E of this._renderLayers)E.handleFocus(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.resume(),this._requestRedrawViewport()}handleSelectionChanged(w,E,A){for(const I of this._renderLayers)I.handleSelectionChanged(this._terminal,w,E,A);this._model.selection.update(this._core,w,E,A),this._requestRedrawViewport()}handleCursorMove(){var w;for(const E of this._renderLayers)E.handleCursorMove(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new g.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new d.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var E;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const w=(0,r.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==w&&(this._onChangeTextureAtlas.fire(w.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(w.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(w.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=w,this._charAtlas.warmUp(),(E=this._glyphRenderer.value)==null||E.setAtlas(this._charAtlas)}_clearModel(w){var E;this._model.clear(),w&&((E=this._glyphRenderer.value)==null||E.clear())}clearTextureAtlas(){var w;(w=this._charAtlas)==null||w.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var w;this._clearModel(!0);for(const E of this._renderLayers)E.reset(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(w){return-1}deregisterCharacterJoiner(w){return!1}renderRows(w,E){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const A of this._renderLayers)A.handleGridChanged(this._terminal,w,E);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(w,E),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new c.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(w,E){const A=this._core;let I,N,$,F,b,k,T,O,U,q,Y,V,P,R,z=this._workCell;w=C(w,A.rows-1,0),E=C(E,A.rows-1,0);const W=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,G=W-A.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,A.cols-1);let Q=-1;const J=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let oe=!1;for(N=w;N<=E;N++)for($=N+A.buffer.ydisp,F=A.buffer.lines.get($),this._model.lineLengths[N]=0,b=this._characterJoinerService.getJoinedCharacters($),P=0;P<A.cols;P++)if(I=this._cellColorResolver.result.bg,F.loadCell(P,z),P===0&&(I=this._cellColorResolver.result.bg),k=!1,T=P,b.length>0&&P===b[0][0]&&(k=!0,O=b.shift(),z=new v(z,F.translateToString(!0,O[0],O[1]),O[1]-O[0]),T=O[1]-1),U=z.getChars(),q=z.getCode(),V=(N*A.cols+P)*_.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(z,P,$,this.dimensions.device.cell.width),J&&$===W&&(P===K&&(this._model.cursor={x:K,y:G,width:z.getWidth(),style:this._coreBrowserService.isFocused?A.options.cursorStyle||"block":A.options.cursorInactiveStyle,cursorWidth:A.options.cursorWidth,dpr:this._devicePixelRatio},Q=K+z.getWidth()-1),P>=K&&P<=Q&&(this._coreBrowserService.isFocused&&(A.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&A.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),q!==s.NULL_CELL_CODE&&(this._model.lineLengths[N]=P+1),(this._model.cells[V]!==q||this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(oe=!0,U.length>1&&(q|=_.COMBINED_CHAR_BIT_MASK),this._model.cells[V]=q,this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=z.getWidth(),this._glyphRenderer.value.updateCell(P,N,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,Y,I),k))for(z=this._workCell,P++;P<T;P++)R=(N*A.cols+P)*_.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(P,N,s.NULL_CELL_CODE,0,0,0,s.NULL_CELL_CHAR,0,0),this._model.cells[R]=s.NULL_CELL_CODE,this._model.cells[R+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[R+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[R+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;oe&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(w,E){this._canvas.width===w&&this._canvas.height===E||(this._canvas.width=w,this._canvas.height=E,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const w=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:w,end:w})}}t.WebglRenderer=u;class v extends n.AttributeData{constructor(w,E,A){super(),this.content=0,this.combinedData="",this.fg=w.fg,this.bg=w.bg,this.combinedData=E,this._width=A}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(w){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function C(x,w,E=0){return Math.max(Math.min(x,w),E)}t.JoinedCellData=v},381:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=a(374);function l(r,c,f){const p=(0,h.throwIfFalsy)(r.createShader(c));if(r.shaderSource(p,f),r.compileShader(p),r.getShaderParameter(p,r.COMPILE_STATUS))return p;console.error(r.getShaderInfoLog(p)),r.deleteShader(p)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(r,c,f){const p=(0,h.throwIfFalsy)(r.createProgram());if(r.attachShader(p,(0,h.throwIfFalsy)(l(r,r.VERTEX_SHADER,c))),r.attachShader(p,(0,h.throwIfFalsy)(l(r,r.FRAGMENT_SHADER,f))),r.linkProgram(p),r.getProgramParameter(p,r.LINK_STATUS))return p;console.error(r.getProgramInfoLog(p)),r.deleteProgram(p)},t.createShader=l,t.expandFloat32Array=function(r,c){const f=Math.min(2*r.length,c),p=new Float32Array(f);for(let o=0;o<r.length;o++)p[o]=r[o];return p},t.GLTexture=class{constructor(r){this.texture=r,this.version=-1}}},592:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),r=a(374),c=a(859);class f extends c.Disposable{constructor(o,e,n,i,s,d,g,_){super(),this._container=e,this._alpha=s,this._coreBrowserService=d,this._optionsService=g,this._themeService=_,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(S=>{this._refreshCharAtlas(o,S),this.reset(o)})),this.register((0,c.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,r.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,n){}handleSelectionChanged(o,e,n,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const n=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,n=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,n,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,n,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(n,i,e.getWidth()),this._ctx.fillText(e.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,n){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,n){return`${n?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=f},733:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),r=a(592);class c extends r.BaseRenderLayer{constructor(p,o,e,n,i,s,d){super(e,p,"link",o,!0,i,s,d),this.register(n.onShowLinkUnderline(g=>this._handleShowLinkUnderline(g))),this.register(n.onHideLinkUnderline(g=>this._handleHideLinkUnderline(g)))}resize(p,o){super.resize(p,o),this._state=void 0}reset(p){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const p=this._state.y2-this._state.y1-1;p>0&&this._clearCells(0,this._state.y1+1,this._state.cols,p),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(p){if(p.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:p.fg!==void 0&&(0,h.is256Color)(p.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[p.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,p.y1===p.y2)this._fillBottomLineAtCells(p.x1,p.y1,p.x2-p.x1);else{this._fillBottomLineAtCells(p.x1,p.y1,p.cols-p.x1);for(let o=p.y1+1;o<p.y2;o++)this._fillBottomLineAtCells(0,o,p.cols);this._fillBottomLineAtCells(0,p.y2,p.x2)}this._state=p}_handleHideLinkUnderline(p){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,r){a.addEventListener(h,l,r);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,r))}}}},274:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),r=a(374);let c,f=0,p=0,o=!1,e=!1,n=!1,i=0;t.CellColorResolver=class{constructor(s,d,g,_,S,u){this._terminal=s,this._optionService=d,this._selectionRenderModel=g,this._decorationService=_,this._coreBrowserService=S,this._themeService=u,this.result={fg:0,bg:0,ext:0}}resolve(s,d,g,_){if(this.result.bg=s.bg,this.result.fg=s.fg,this.result.ext=268435456&s.bg?s.extended.ext:0,p=0,f=0,e=!1,o=!1,n=!1,c=this._themeService.colors,i=0,s.getCode()!==h.NULL_CELL_CODE&&s.extended.underlineStyle===4){const S=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=d*_%(2*Math.round(S))}if(this._decorationService.forEachDecorationAtCell(d,g,"bottom",S=>{S.backgroundColorRGB&&(p=S.backgroundColorRGB.rgba>>8&16777215,e=!0),S.foregroundColorRGB&&(f=S.foregroundColorRGB.rgba>>8&16777215,o=!0)}),n=this._selectionRenderModel.isCellSelected(this._terminal,d,g),n){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:p=(16777215&this.result.fg)<<8|255;break;default:p=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:p=(16777215&this.result.bg)<<8|255}p=l.rgba.blend(p,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else p=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(f=c.selectionForeground.rgba>>8&16777215,o=!0),(0,r.treatGlyphAsBackgroundColor)(s.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(d,g,"top",S=>{S.backgroundColorRGB&&(p=S.backgroundColorRGB.rgba>>8&16777215,e=!0),S.foregroundColorRGB&&(f=S.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(p=n?-16777216&s.bg&-134217729|p|50331648:-16777216&s.bg|p|50331648),o&&(f=-16777216&s.fg&-67108865|f|50331648),67108864&this.result.fg&&(e&&!o&&(f=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648,o=!0),!e&&o&&(p=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648,e=!0)),c=void 0,this.result.bg=e?p:this.result.bg,this.result.fg=o?f:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),r=[];t.acquireTextureAtlas=function(c,f,p,o,e,n,i,s){const d=(0,l.generateConfig)(o,e,n,i,f,p,s);for(let S=0;S<r.length;S++){const u=r[S],v=u.ownedBy.indexOf(c);if(v>=0){if((0,l.configEquals)(u.config,d))return u.atlas;u.ownedBy.length===1?(u.atlas.dispose(),r.splice(S,1)):u.ownedBy.splice(v,1);break}}for(let S=0;S<r.length;S++){const u=r[S];if((0,l.configEquals)(u.config,d))return u.ownedBy.push(c),u.atlas}const g=c._core,_={atlas:new h.TextureAtlas(document,d,g.unicodeService),config:d,ownedBy:[c]};return r.push(_),_.atlas},t.removeTerminalFromCache=function(c){for(let f=0;f<r.length;f++){const p=r[f].ownedBy.indexOf(c);if(p!==-1){r[f].ownedBy.length===1?(r[f].atlas.dispose(),r.splice(f,1)):r[f].ownedBy.splice(p,1);break}}}},197:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,r,c,f,p,o,e){const n={foreground:o.foreground,background:o.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:p.customGlyphs,devicePixelRatio:e,letterSpacing:p.letterSpacing,lineHeight:p.lineHeight,deviceCellWidth:l,deviceCellHeight:r,deviceCharWidth:c,deviceCharHeight:f,fontFamily:p.fontFamily,fontSize:p.fontSize,fontWeight:p.fontWeight,fontWeightBold:p.fontWeightBold,allowTransparency:p.allowTransparency,drawBoldTextInBrightColors:p.drawBoldTextInBrightColors,minimumContrastRatio:p.minimumContrastRatio,colors:n}},t.configEquals=function(l,r){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==r.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===r.devicePixelRatio&&l.customGlyphs===r.customGlyphs&&l.lineHeight===r.lineHeight&&l.letterSpacing===r.letterSpacing&&l.fontFamily===r.fontFamily&&l.fontSize===r.fontSize&&l.fontWeight===r.fontWeight&&l.fontWeightBold===r.fontWeightBold&&l.allowTransparency===r.allowTransparency&&l.deviceCharWidth===r.deviceCharWidth&&l.deviceCharHeight===r.deviceCharHeight&&l.drawBoldTextInBrightColors===r.drawBoldTextInBrightColors&&l.minimumContrastRatio===r.minimumContrastRatio&&l.colors.foreground.rgba===r.colors.foreground.rgba&&l.colors.background.rgba===r.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,h>0)return void this._restartInterval(h)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(h)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,n,i,s,d,g,_){const S=t.blockElementDefinitions[e];if(S)return function(x,w,E,A,I,N){for(let $=0;$<w.length;$++){const F=w[$],b=I/8,k=N/8;x.fillRect(E+F.x*b,A+F.y*k,F.w*b,F.h*k)}}(o,S,n,i,s,d),!0;const u=l[e];if(u)return function(x,w,E,A,I,N){let $=r.get(w);$||($=new Map,r.set(w,$));const F=x.fillStyle;if(typeof F!="string")throw new Error(`Unexpected fillStyle type "${F}"`);let b=$.get(F);if(!b){const k=w[0].length,T=w.length,O=x.canvas.ownerDocument.createElement("canvas");O.width=k,O.height=T;const U=(0,h.throwIfFalsy)(O.getContext("2d")),q=new ImageData(k,T);let Y,V,P,R;if(F.startsWith("#"))Y=parseInt(F.slice(1,3),16),V=parseInt(F.slice(3,5),16),P=parseInt(F.slice(5,7),16),R=F.length>7&&parseInt(F.slice(7,9),16)||1;else{if(!F.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${F}" when drawing pattern glyph`);[Y,V,P,R]=F.substring(5,F.length-1).split(",").map(z=>parseFloat(z))}for(let z=0;z<T;z++)for(let W=0;W<k;W++)q.data[4*(z*k+W)]=Y,q.data[4*(z*k+W)+1]=V,q.data[4*(z*k+W)+2]=P,q.data[4*(z*k+W)+3]=w[z][W]*(255*R);U.putImageData(q,0,0),b=(0,h.throwIfFalsy)(x.createPattern(O,null)),$.set(F,b)}x.fillStyle=b,x.fillRect(E,A,I,N)}(o,u,n,i,s,d),!0;const v=t.boxDrawingDefinitions[e];if(v)return function(x,w,E,A,I,N,$){x.strokeStyle=x.fillStyle;for(const[F,b]of Object.entries(w)){let k;x.beginPath(),x.lineWidth=$*Number.parseInt(F),k=typeof b=="function"?b(.15,.15/N*I):b;for(const T of k.split(" ")){const O=T[0],U=f[O];if(!U){console.error(`Could not find drawing instructions for "${O}"`);continue}const q=T.substring(1).split(",");q[0]&&q[1]&&U(x,p(q,I,N,E,A,!0,$))}x.stroke(),x.closePath()}}(o,v,n,i,s,d,_),!0;const C=t.powerlineDefinitions[e];return!!C&&(function(x,w,E,A,I,N,$,F){const b=new Path2D;b.rect(E,A,I,N),x.clip(b),x.beginPath();const k=$/12;x.lineWidth=F*k;for(const T of w.d.split(" ")){const O=T[0],U=f[O];if(!U){console.error(`Could not find drawing instructions for "${O}"`);continue}const q=T.substring(1).split(",");q[0]&&q[1]&&U(x,p(q,I,N,E,A,!1,F,(w.leftPadding??0)*(k/2),(w.rightPadding??0)*(k/2)))}w.type===1?(x.strokeStyle=x.fillStyle,x.stroke()):x.fill(),x.closePath()}(o,C,n,i,s,d,g,_),!0)};const r=new Map;function c(o,e,n=0){return Math.max(Math.min(o,e),n)}const f={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function p(o,e,n,i,s,d,g,_=0,S=0){const u=o.map(v=>parseFloat(v)||parseInt(v));if(u.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<u.length;v+=2)u[v]*=e-_*g-S*g,d&&u[v]!==0&&(u[v]=c(Math.round(u[v]+.5)-.5,e,0)),u[v]+=i+_*g;for(let v=1;v<u.length;v+=2)u[v]*=n,d&&u[v]!==0&&(u[v]=c(Math.round(u[v]+.5)-.5,n,0)),u[v]+=s;return u}},56:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,r,c){let f=new r.ResizeObserver(p=>{const o=p.find(i=>i.target===l);if(!o)return;if(!("devicePixelContentBoxSize"in o))return f==null||f.disconnect(),void(f=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,n=o.devicePixelContentBoxSize[0].blockSize;e>0&&n>0&&c(e,n)});try{f.observe(l,{box:["device-pixel-content-box"]})}catch{f.disconnect(),f=void 0}return(0,h.toDisposable)(()=>f==null?void 0:f.disconnect())}},374:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,r,c,f){return r===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(p){return 57344<=p&&p<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(r){return 9472<=r&&r<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,r,c=0){return(l-(2*Math.round(r)-c))%(2*Math.round(r))}},296:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{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(l,r,c,f=!1){if(this.selectionStart=r,this.selectionEnd=c,!r||!c||r[0]===c[0]&&r[1]===c[1])return void this.clear();const p=l.buffers.active.ydisp,o=r[1]-p,e=c[1]-p,n=Math.max(o,0),i=Math.min(e,l.rows-1);n>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=r[0],this.endCol=c[0])}isCellSelected(l,r,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&c>=this.viewportCappedStartRow&&r<this.endCol&&c<=this.viewportCappedEndRow:r<this.startCol&&c>=this.viewportCappedStartRow&&r>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&r>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),r=a(374),c=a(160),f=a(345),p=a(485),o=a(385),e=a(147),n=a(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let s;class d{get pages(){return this._pages}constructor(v,C,x){this._document=v,this._config=C,this._unicodeService=x,this._didWarmUp=!1,this._cacheMap=new p.FourKeyMap,this._cacheMapCombined=new p.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new f.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new f.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=S(v,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,r.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const v of this.pages)v.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const v=new o.IdleTaskQueue;for(let C=33;C<126;C++)v.enqueue(()=>{if(!this._cacheMap.get(C,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT)){const x=this._drawToCache(C,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT);this._cacheMap.set(C,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT,x)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const v of this._pages)v.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(d.maxAtlasPages&&this._pages.length>=Math.max(4,d.maxAtlasPages)){const C=this._pages.filter($=>2*$.canvas.width<=(d.maxTextureSize||4096)).sort(($,F)=>F.canvas.width!==$.canvas.width?F.canvas.width-$.canvas.width:F.percentageUsed-$.percentageUsed);let x=-1,w=0;for(let $=0;$<C.length;$++)if(C[$].canvas.width!==w)x=$,w=C[$].canvas.width;else if($-x==3)break;const E=C.slice(x,x+4),A=E.map($=>$.glyphs[0].texturePage).sort(($,F)=>$>F?1:-1),I=this.pages.length-E.length,N=this._mergePages(E,I);N.version++;for(let $=A.length-1;$>=0;$--)this._deletePage(A[$]);this.pages.push(N),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(N.canvas)}const v=new g(this._document,this._textureSize);return this._pages.push(v),this._activePages.push(v),this._onAddTextureAtlasCanvas.fire(v.canvas),v}_mergePages(v,C){const x=2*v[0].canvas.width,w=new g(this._document,x,v);for(const[E,A]of v.entries()){const I=E*A.canvas.width%x,N=Math.floor(E/2)*A.canvas.height;w.ctx.drawImage(A.canvas,I,N);for(const F of A.glyphs)F.texturePage=C,F.sizeClipSpace.x=F.size.x/x,F.sizeClipSpace.y=F.size.y/x,F.texturePosition.x+=I,F.texturePosition.y+=N,F.texturePositionClipSpace.x=F.texturePosition.x/x,F.texturePositionClipSpace.y=F.texturePosition.y/x;this._onRemoveTextureAtlasCanvas.fire(A.canvas);const $=this._activePages.indexOf(A);$!==-1&&this._activePages.splice($,1)}return w}_deletePage(v){this._pages.splice(v,1);for(let C=v;C<this._pages.length;C++){const x=this._pages[C];for(const w of x.glyphs)w.texturePage--;x.version++}}getRasterizedGlyphCombinedChar(v,C,x,w,E){return this._getFromCacheMap(this._cacheMapCombined,v,C,x,w,E)}getRasterizedGlyph(v,C,x,w,E){return this._getFromCacheMap(this._cacheMap,v,C,x,w,E)}_getFromCacheMap(v,C,x,w,E,A=!1){return s=v.get(C,x,w,E),s||(s=this._drawToCache(C,x,w,E,A),v.set(C,x,w,E,s)),s}_getColorFromAnsiIndex(v){if(v>=this._config.colors.ansi.length)throw new Error("No color found for idx "+v);return this._config.colors.ansi[v]}_getBackgroundColor(v,C,x,w){if(this._config.allowTransparency)return c.NULL_COLOR;let E;switch(v){case 16777216:case 33554432:E=this._getColorFromAnsiIndex(C);break;case 50331648:const A=e.AttributeData.toColorRGB(C);E=c.channels.toColor(A[0],A[1],A[2]);break;default:E=x?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return E}_getForegroundColor(v,C,x,w,E,A,I,N,$,F){const b=this._getMinimumContrastColor(v,C,x,w,E,A,I,$,N,F);if(b)return b;let k;switch(E){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&$&&A<8&&(A+=8),k=this._getColorFromAnsiIndex(A);break;case 50331648:const T=e.AttributeData.toColorRGB(A);k=c.channels.toColor(T[0],T[1],T[2]);break;default:k=I?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(k=c.color.opaque(k)),N&&(k=c.color.multiplyOpacity(k,h.DIM_OPACITY)),k}_resolveBackgroundRgba(v,C,x){switch(v){case 16777216:case 33554432:return this._getColorFromAnsiIndex(C).rgba;case 50331648:return C<<8;default:return x?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(v,C,x,w){switch(v){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&w&&C<8&&(C+=8),this._getColorFromAnsiIndex(C).rgba;case 50331648:return C<<8;default:return x?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(v,C,x,w,E,A,I,N,$,F){if(this._config.minimumContrastRatio===1||F)return;const b=this._getContrastCache($),k=b.getColor(v,w);if(k!==void 0)return k||void 0;const T=this._resolveBackgroundRgba(C,x,I),O=this._resolveForegroundRgba(E,A,I,N),U=c.rgba.ensureContrastRatio(T,O,this._config.minimumContrastRatio/($?2:1));if(!U)return void b.setColor(v,w,null);const q=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return b.setColor(v,w,q),q}_getContrastCache(v){return v?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(v,C,x,w,E=!1){const A=typeof v=="number"?String.fromCharCode(v):v,I=Math.min(this._config.deviceCellWidth*Math.max(A.length,2)+4,this._textureSize);this._tmpCanvas.width<I&&(this._tmpCanvas.width=I);const N=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<N&&(this._tmpCanvas.height=N),this._tmpCtx.save(),this._workAttributeData.fg=x,this._workAttributeData.bg=C,this._workAttributeData.extended.ext=w,this._workAttributeData.isInvisible())return i;const $=!!this._workAttributeData.isBold(),F=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),k=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),O=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),V=this._workAttributeData.getBgColor(),P=this._workAttributeData.getBgColorMode();if(F){const X=q;q=V,V=X;const se=Y;Y=P,P=se}const R=this._getBackgroundColor(P,V,F,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=R.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const z=$?this._config.fontWeightBold:this._config.fontWeight,W=k?"italic":"";this._tmpCtx.font=`${W} ${z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const G=A.length===1&&(0,r.isPowerlineGlyph)(A.charCodeAt(0)),K=A.length===1&&(0,r.isRestrictedPowerlineGlyph)(A.charCodeAt(0)),Q=this._getForegroundColor(C,P,V,x,Y,q,F,b,$,(0,r.treatGlyphAsBackgroundColor)(A.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;const J=K?0:4;let oe=!1;this._config.customGlyphs!==!1&&(oe=(0,l.tryDrawCustomChar)(this._tmpCtx,A,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let _e,Z=!G;if(_e=typeof v=="number"?this._unicodeService.wcwidth(v):this._unicodeService.getStringCellWidth(v),T){this._tmpCtx.save();const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=X%2==1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Z=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Z=!1;let fe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&fe<8&&(fe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(fe).css}this._tmpCtx.beginPath();const de=J,ce=Math.ceil(J+this._config.deviceCharHeight)-se-(E?2*X:0),Ee=ce+X,me=ce+2*X;let be=this._workAttributeData.getUnderlineVariantOffset();for(let fe=0;fe<_e;fe++){this._tmpCtx.save();const he=de+fe*this._config.deviceCellWidth,ee=de+(fe+1)*this._config.deviceCellWidth,$e=he+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(ee,ce),this._tmpCtx.moveTo(he,me),this._tmpCtx.lineTo(ee,me);break;case 3:const Ze=X<=1?me:Math.ceil(J+this._config.deviceCharHeight-X/2)-se,Qe=X<=1?ce:Math.ceil(J+this._config.deviceCharHeight+X/2)-se,Nt=new Path2D;Nt.rect(he,ce,this._config.deviceCellWidth,me-ce),this._tmpCtx.clip(Nt),this._tmpCtx.moveTo(he-this._config.deviceCellWidth/2,Ee),this._tmpCtx.bezierCurveTo(he-this._config.deviceCellWidth/2,Qe,he,Qe,he,Ee),this._tmpCtx.bezierCurveTo(he,Ze,$e,Ze,$e,Ee),this._tmpCtx.bezierCurveTo($e,Qe,ee,Qe,ee,Ee),this._tmpCtx.bezierCurveTo(ee,Ze,ee+this._config.deviceCellWidth/2,Ze,ee+this._config.deviceCellWidth/2,Ee);break;case 4:const et=be===0?0:be>=X?2*X-be:X-be;be>=X||et===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he+et,ce),this._tmpCtx.lineTo(ee,ce)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(he+et,ce),this._tmpCtx.moveTo(he+et+X,ce),this._tmpCtx.lineTo(ee,ce)),be=(0,r.computeNextVariantOffset)(ee-he,X,be);break;case 5:const Hi=.6,$i=.3,_t=ee-he,Wt=Math.floor(Hi*_t),Ut=Math.floor($i*_t),Ni=_t-Wt-Ut;this._tmpCtx.setLineDash([Wt,Ut,Ni]),this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(ee,ce);break;default:this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(ee,ce)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!oe&&this._config.fontSize>=12&&!this._config.allowTransparency&&A!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const fe=this._tmpCtx.measureText(A);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in fe&&fe.actualBoundingBoxDescent>0){this._tmpCtx.save();const he=new Path2D;he.rect(de,ce-Math.ceil(X/2),this._config.deviceCellWidth*_e,me-ce+Math.ceil(X/2)),this._tmpCtx.clip(he),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=R.css,this._tmpCtx.strokeText(A,J,J+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=X%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*_e,J+se),this._tmpCtx.stroke()}if(oe||this._tmpCtx.fillText(A,J,J+this._config.deviceCharHeight),A==="_"&&!this._config.allowTransparency){let X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),R,Q,Z);if(X)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=R.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(A,J,J+this._config.deviceCharHeight-se),X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),R,Q,Z),X);se++);}if(O){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),se=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*_e,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();const we=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Oe;if(Oe=this._config.allowTransparency?function(X){for(let se=0;se<X.data.length;se+=4)if(X.data[se+3]>0)return!1;return!0}(we):_(we,R,Q,Z),Oe)return i;const ne=this._findGlyphBoundingBox(we,this._workBoundingBox,I,K,oe,J);let te,ie;for(;;){if(this._activePages.length===0){const X=this._createNewPage();te=X,ie=X.currentRow,ie.height=ne.size.y;break}te=this._activePages[this._activePages.length-1],ie=te.currentRow;for(const X of this._activePages)ne.size.y<=X.currentRow.height&&(te=X,ie=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const se of this._activePages[X].fixedRows)se.height<=ie.height&&ne.size.y<=se.height&&(te=this._activePages[X],ie=se);if(ie.y+ne.size.y>=te.canvas.height||ie.height>ne.size.y+2){let X=!1;if(te.currentRow.y+te.currentRow.height+ne.size.y>=te.canvas.height){let se;for(const de of this._activePages)if(de.currentRow.y+de.currentRow.height+ne.size.y<de.canvas.height){se=de;break}if(se)te=se;else if(d.maxAtlasPages&&this._pages.length>=d.maxAtlasPages&&ie.y+ne.size.y<=te.canvas.height&&ie.height>=ne.size.y&&ie.x+ne.size.x<=te.canvas.width)X=!0;else{const de=this._createNewPage();te=de,ie=de.currentRow,ie.height=ne.size.y,X=!0}}X||(te.currentRow.height>0&&te.fixedRows.push(te.currentRow),ie={x:0,y:te.currentRow.y+te.currentRow.height,height:ne.size.y},te.fixedRows.push(ie),te.currentRow={x:0,y:ie.y+ie.height,height:0})}if(ie.x+ne.size.x<=te.canvas.width)break;ie===te.currentRow?(ie.x=0,ie.y+=ie.height,ie.height=0):te.fixedRows.splice(te.fixedRows.indexOf(ie),1)}return ne.texturePage=this._pages.indexOf(te),ne.texturePosition.x=ie.x,ne.texturePosition.y=ie.y,ne.texturePositionClipSpace.x=ie.x/te.canvas.width,ne.texturePositionClipSpace.y=ie.y/te.canvas.height,ne.sizeClipSpace.x/=te.canvas.width,ne.sizeClipSpace.y/=te.canvas.height,ie.height=Math.max(ie.height,ne.size.y),ie.x+=ne.size.x,te.ctx.putImageData(we,ne.texturePosition.x-this._workBoundingBox.left,ne.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ne.size.x,ne.size.y),te.addGlyph(ne),te.version++,ne}_findGlyphBoundingBox(v,C,x,w,E,A){C.top=0;const I=w?this._config.deviceCellHeight:this._tmpCanvas.height,N=w?this._config.deviceCellWidth:x;let $=!1;for(let F=0;F<I;F++){for(let b=0;b<N;b++){const k=F*this._tmpCanvas.width*4+4*b+3;if(v.data[k]!==0){C.top=F,$=!0;break}}if($)break}C.left=0,$=!1;for(let F=0;F<A+N;F++){for(let b=0;b<I;b++){const k=b*this._tmpCanvas.width*4+4*F+3;if(v.data[k]!==0){C.left=F,$=!0;break}}if($)break}C.right=N,$=!1;for(let F=A+N-1;F>=A;F--){for(let b=0;b<I;b++){const k=b*this._tmpCanvas.width*4+4*F+3;if(v.data[k]!==0){C.right=F,$=!0;break}}if($)break}C.bottom=I,$=!1;for(let F=I-1;F>=0;F--){for(let b=0;b<N;b++){const k=F*this._tmpCanvas.width*4+4*b+3;if(v.data[k]!==0){C.bottom=F,$=!0;break}}if($)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:C.right-C.left+1,y:C.bottom-C.top+1},sizeClipSpace:{x:C.right-C.left+1,y:C.bottom-C.top+1},offset:{x:-C.left+A+(w||E?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-C.top+A+(w||E?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=d;class g{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(v){this._glyphs.push(v),this._usedPixels+=v.size.x*v.size.y}constructor(v,C,x){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],x)for(const w of x)this._glyphs.push(...w.glyphs),this._usedPixels+=w._usedPixels;this.canvas=S(v,C,C),this.ctx=(0,r.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function _(u,v,C,x){const w=v.rgba>>>24,E=v.rgba>>>16&255,A=v.rgba>>>8&255,I=C.rgba>>>24,N=C.rgba>>>16&255,$=C.rgba>>>8&255,F=Math.floor((Math.abs(w-I)+Math.abs(E-N)+Math.abs(A-$))/12);let b=!0;for(let k=0;k<u.data.length;k+=4)u.data[k]===w&&u.data[k+1]===E&&u.data[k+2]===A||x&&Math.abs(u.data[k]-w)+Math.abs(u.data[k+1]-E)+Math.abs(u.data[k+2]-A)<F?u.data[k+3]=0:b=!1;return b}function S(u,v,C){const x=u.createElement("canvas");return x.width=v,x.height=C,x}},160:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,r=0;var c,f,p,o,e;function n(s){const d=s.toString(16);return d.length<2?"0"+d:d}function i(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,g,_,S){return S!==void 0?`#${n(d)}${n(g)}${n(_)}${n(S)}`:`#${n(d)}${n(g)}${n(_)}`},s.toRgba=function(d,g,_,S=255){return(d<<24|g<<16|_<<8|S)>>>0},s.toColor=function(d,g,_,S){return{css:s.toCss(d,g,_,S),rgba:s.toRgba(d,g,_,S)}}}(c||(t.channels=c={})),function(s){function d(g,_){return r=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,r),rgba:c.toRgba(a,h,l,r)}}s.blend=function(g,_){if(r=(255&_.rgba)/255,r===1)return{css:_.css,rgba:_.rgba};const S=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,C=g.rgba>>24&255,x=g.rgba>>16&255,w=g.rgba>>8&255;return a=C+Math.round((S-C)*r),h=x+Math.round((u-x)*r),l=w+Math.round((v-w)*r),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},s.isOpaque=function(g){return(255&g.rgba)==255},s.ensureContrastRatio=function(g,_,S){const u=e.ensureContrastRatio(g.rgba,_.rgba,S);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},s.opaque=function(g){const _=(255|g.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},s.opacity=d,s.multiplyOpacity=function(g,_){return r=255&g.rgba,d(g,r*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(f||(t.color=f={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const S=_.getContext("2d",{willReadFrequently:!0});S&&(d=S,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),r=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,r);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const S=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return a=parseInt(S[1]),h=parseInt(S[2]),l=parseInt(S[3]),r=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),c.toColor(a,h,l,r);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,r]=d.getImageData(0,0,1,1).data,r!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,r),css:_}}}(p||(t.css=p={})),function(s){function d(g,_,S){const u=g/255,v=_/255,C=S/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.0722*(C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4))}s.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},s.relativeLuminance2=d}(o||(t.rgb=o={})),function(s){function d(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let w=S>>24&255,E=S>>16&255,A=S>>8&255,I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));for(;I<u&&(w>0||E>0||A>0);)w-=Math.max(0,Math.ceil(.1*w)),E-=Math.max(0,Math.ceil(.1*E)),A-=Math.max(0,Math.ceil(.1*A)),I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));return(w<<24|E<<16|A<<8|255)>>>0}function g(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let w=S>>24&255,E=S>>16&255,A=S>>8&255,I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));for(;I<u&&(w<255||E<255||A<255);)w=Math.min(255,w+Math.ceil(.1*(255-w))),E=Math.min(255,E+Math.ceil(.1*(255-E))),A=Math.min(255,A+Math.ceil(.1*(255-A))),I=i(o.relativeLuminance2(w,E,A),o.relativeLuminance2(v,C,x));return(w<<24|E<<16|A<<8|255)>>>0}s.blend=function(_,S){if(r=(255&S)/255,r===1)return S;const u=S>>24&255,v=S>>16&255,C=S>>8&255,x=_>>24&255,w=_>>16&255,E=_>>8&255;return a=x+Math.round((u-x)*r),h=w+Math.round((v-w)*r),l=E+Math.round((C-E)*r),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,S,u){const v=o.relativeLuminance(_>>8),C=o.relativeLuminance(S>>8);if(i(v,C)<u){if(C<v){const E=d(_,S,u),A=i(v,o.relativeLuminance(E>>8));if(A<u){const I=g(_,S,u);return A>i(v,o.relativeLuminance(I>>8))?E:I}return E}const x=g(_,S,u),w=i(v,o.relativeLuminance(x>>8));if(w<u){const E=d(_,S,u);return w>i(v,o.relativeLuminance(E>>8))?x:E}return x}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=n,t.contrastRatio=i},345:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let r=0;r<this._listeners.length;r++)l.push(this._listeners[r]);for(let r=0;r<l.length;r++)l[r].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},859:(M,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},485:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,r,c){this._data[l]||(this._data[l]={}),this._data[l][r]=c}get(l,r){return this._data[l]?this._data[l][r]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,r,c,f){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(r,c,f)}get(h,l,r,c){var f;return(f=this._data.get(h,l))==null?void 0:f.get(r,c)}clear(){this._data.clear()}}},399:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),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(f){this._idleCallback=void 0;let p=0,o=0,e=f.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),o=Math.max(p,o),n=f.timeRemaining(),1.5*o>n)return e-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-p))}ms`),void this._start();e=n}this.clear()}}class r extends l{_requestCallback(f){return setTimeout(()=>f(this._createDeadline(16)))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const p=Date.now()+f;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}t.PriorityTaskQueue=r,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:r,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},147:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(r){return[r>>>16&255,r>>>8&255,255&r]}static fromColorRGB(r){return(255&r[0])<<16|(255&r[1])<<8|255&r[2]}clone(){const r=new a;return r.fg=this.fg,r.bg=this.bg,r.extended=this.extended.clone(),r}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}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(r){this._ext=r}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(r){this._ext&=-469762049,this._ext|=r<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(r){this._ext&=-67108864,this._ext|=67108863&r}get urlId(){return this._urlId}set urlId(r){this._urlId=r}get underlineVariantOffset(){const r=(3758096384&this._ext)>>29;return r<0?4294967288^r:r}set underlineVariantOffset(r){this._ext&=536870911,this._ext|=r<<29&3758096384}constructor(r=0,c=0){this._ext=0,this._urlId=0,this._ext=r,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),r=a(147);class c extends r.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new r.ExtendedAttrs,this.combinedData=""}static fromCharData(p){const o=new c;return o.setFromCharData(p),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(p[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(p[l.CHAR_DATA_CHAR_INDEX].length===2){const e=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|p[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=p[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},855:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let r="";for(let c=h;c<l;++c){let f=a[c];f>65535?(f-=65536,r+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):r+=String.fromCharCode(f)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let r=0,c=0;if(this._interim){const f=a.charCodeAt(c++);56320<=f&&f<=57343?h[r++]=1024*(this._interim-55296)+f-56320+65536:(h[r++]=this._interim,h[r++]=f),this._interim=0}for(let f=c;f<l;++f){const p=a.charCodeAt(f);if(55296<=p&&p<=56319){if(++f>=l)return this._interim=p,r;const o=a.charCodeAt(f);56320<=o&&o<=57343?h[r++]=1024*(p-55296)+o-56320+65536:(h[r++]=p,h[r++]=o)}else p!==65279&&(h[r++]=p)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let r,c,f,p,o=0,e=0,n=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,S=0;for(;(_=63&this.interim[++S])&&S<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-S;for(;n<v;){if(n>=l)return 0;if(_=a[n++],(192&_)!=128){n--,d=!0;break}this.interim[S++]=_,g<<=6,g|=63&_}d||(u===2?g<128?n--:h[o++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[o++]=g):g<65536||g>1114111||(h[o++]=g)),this.interim.fill(0)}const i=l-4;let s=n;for(;s<l;){for(;!(!(s<i)||128&(r=a[s])||128&(c=a[s+1])||128&(f=a[s+2])||128&(p=a[s+3]));)h[o++]=r,h[o++]=c,h[o++]=f,h[o++]=p,s+=4;if(r=a[s++],r<128)h[o++]=r;else if((224&r)==192){if(s>=l)return this.interim[0]=r,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&r)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&r)==224){if(s>=l)return this.interim[0]=r,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=r,this.interim[1]=c,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(15&r)<<12|(63&c)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&r)==240){if(s>=l)return this.interim[0]=r,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=r,this.interim[1]=c,o;if(f=a[s++],(192&f)!=128){s--;continue}if(s>=l)return this.interim[0]=r,this.interim[1]=c,this.interim[2]=f,o;if(p=a[s++],(192&p)!=128){s--;continue}if(e=(7&r)<<18|(63&c)<<12|(63&f)<<6|63&p,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(M,t,a){var h=this&&this.__decorate||function(e,n,i,s){var d,g=arguments.length,_=g<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,n,i,s);else for(var S=e.length-1;S>=0;S--)(d=e[S])&&(_=(g<3?d(_):g>3?d(n,i,_):d(n,i))||_);return g>3&&_&&Object.defineProperty(n,i,_),_},l=this&&this.__param||function(e,n){return function(i,s){n(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const r=a(859),c=a(97),f={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let p,o=t.LogService=class extends r.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),p=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(e,...n){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,n)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){p=e},t.traceCall=function(e,n,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(p.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);p.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return p.trace(`GlyphRenderer#${s.name} return`,g),g}}},726:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const r=function(c,f,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,n){e[a]===e?e[h].push({id:o,index:n}):(e[h]=[{id:o,index:n}],e[a]=e)})(r,c,p)};return r.toString=()=>l,t.serviceRegistry.set(l,r),r}},97:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(r){r[r.TRACE=0]="TRACE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},D={};function B(M){var t=D[M];if(t!==void 0)return t.exports;var a=D[M]={exports:{}};return L[M].call(a.exports,a,a.exports,B),a.exports}var H={};return(()=>{var M=H;Object.defineProperty(M,"__esModule",{value:!0}),M.WebglAddon=void 0;const t=B(345),a=B(859),h=B(399),l=B(666),r=B(776);class c extends a.Disposable{constructor(p){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=p,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(p){const o=p._core;if(!p.element)return void this.register(o.onWillOpen(()=>this.activate(p)));this._terminal=p;const e=o.coreService,n=o.optionsService,i=o,s=i._renderService,d=i._characterJoinerService,g=i._charSizeService,_=i._coreBrowserService,S=i._decorationService,u=i._logService,v=i._themeService;(0,r.setTraceLogger)(u),this._renderer=this.register(new l.WebglRenderer(p,d,g,_,e,S,n,v,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const C=this._terminal._core._renderService;C.setRenderer(this._terminal._core._createRenderer()),C.handleResize(p.cols,p.rows)}))}get textureAtlas(){var p;return(p=this._renderer)==null?void 0:p.textureAtlas}clearTextureAtlas(){var p;(p=this._renderer)==null||p.clearTextureAtlas()}}M.WebglAddon=c})(),H})())})(ni);var ss=ni.exports;const rs={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},ns=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],ft=[0,95,135,175,215,255];function jt(m,y){if(m<0)return y;if(m<16)return ns[m]??y;if(m<232){const L=m-16,D=ft[Math.floor(L/36)%6],B=ft[Math.floor(L/6)%6],H=ft[L%6];return`rgb(${D},${B},${H})`}if(m<256){const L=8+(m-232)*10;return`rgb(${L},${L},${L})`}return`#${(m&16777215).toString(16).padStart(6,"0")}`}const qt="\x1Bc";class os{constructor(y){ue(this,"term");ue(this,"fit",new is.FitAddon);ue(this,"onInput",null);ue(this,"shouldSendKey",null);this.term=new ts.Terminal({theme:rs,fontFamily:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3}),this.term.loadAddon(this.fit),this.term.open(y);try{this.term.loadAddon(new ss.WebglAddon)}catch{}this.term.onData(L=>{var D;return(D=this.onInput)==null?void 0:D.call(this,L)}),this.term.attachCustomKeyEventHandler(L=>{var D,B;return((D=this.shouldSendKey)==null?void 0:D.call(this,L))===!1?!1:L.type==="keydown"&&Yi(L)?(L.preventDefault(),(B=this.onInput)==null||B.call(this,Xi),!1):!0}),this.bindTouchScroll(y),this.fitNow()}bindTouchScroll(y){let L=0,D=0;y.addEventListener("touchstart",B=>{B.touches.length===1&&(L=B.touches[0].clientY,D=0)},{capture:!0,passive:!0}),y.addEventListener("touchmove",B=>{if(B.touches.length!==1||!this.wantsWheel())return;B.preventDefault(),B.stopPropagation();const H=B.touches[0];D+=(L-H.clientY)/this.rowHeight(),L=H.clientY;const M=Math.trunc(D);if(M===0)return;D-=M;const t=y.querySelector(".xterm-screen");if(!t)return;const a={deltaY:Math.sign(M),deltaMode:WheelEvent.DOM_DELTA_LINE,clientX:H.clientX,clientY:H.clientY,bubbles:!0,cancelable:!0};for(let h=0;h<Math.abs(M);h++)t.dispatchEvent(new WheelEvent("wheel",a))},{capture:!0,passive:!1})}wantsWheel(){return this.term.modes.mouseTrackingMode!=="none"||this.term.buffer.active.type==="alternate"}rowHeight(){var D;const y=(D=this.term.element)==null?void 0:D.querySelector(".xterm-screen"),L=y&&this.term.rows>0?y.clientHeight/this.term.rows:0;return L>0?L:16}replay(y){this.term.write(qt+y)}write(y){this.term.write(y)}paste(y){this.term.paste(y)}clear(){this.term.write(qt)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}}function as(m){const y=[];let L=0,D=0,B=!1;for(const H of m.split(`
|
|
67
|
-
`)){const M=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(H);if(M){
|
|
68
|
-
`)}const
|
|
69
|
-
`))}async function xs(m){var D;try{if((D=navigator.clipboard)!=null&&D.writeText)return await navigator.clipboard.writeText(m),!0}catch{}const y=document.createElement("textarea");y.value=m,y.setAttribute("readonly",""),y.style.position="fixed",y.style.opacity="0",document.body.append(y),y.select();let L=!1;try{L=document.execCommand("copy")}catch{L=!1}return y.remove(),L}const Gt="#071411",Rs="#dceee7";class ks{constructor(y){ue(this,"ctx");ue(this,"last",null);this.canvas=y,this.ctx=y.getContext("2d",{alpha:!1})}paint(y=this.last){if(!this.ctx||!y)return;this.last=y;const L=window.devicePixelRatio||1,D=this.canvas.clientWidth,B=this.canvas.clientHeight;if(D===0||B===0)return;(this.canvas.width!==Math.round(D*L)||this.canvas.height!==Math.round(B*L))&&(this.canvas.width=Math.round(D*L),this.canvas.height=Math.round(B*L));const H=this.ctx;H.setTransform(L,0,0,L,0,0),H.fillStyle=Gt,H.fillRect(0,0,D,B);const M=D/Math.max(y.cols,1),t=Math.max(M/.6,1),a=B/Math.max(y.rows.length,1);H.textBaseline="top",H.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<y.rows.length;h++){const l=y.rows[h];if(!l)continue;let r=0;for(const c of l){const f=c.text.length*M;c.bg>=0&&(H.fillStyle=jt(c.bg,Gt),H.fillRect(r,h*a,f,a)),c.text.trim()!==""&&(H.fillStyle=jt(c.fg,Rs),H.fillText(c.text,r,h*a)),r+=f}}}refresh(){this.last&&this.paint(this.last)}}const Ue=[4,8,12,16],Vt=16;function di(m){return m<12?Ds(m/2):As(m/4+1)}function Ds(m){const y=new Map;for(let L=1;L<=m;L++)y.set(L,{row:1,col:L});for(let L=0;L<m;L++)y.set(m+1+L,{row:3,col:m-L});return{cols:m,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${m+1}`,cells:y}}function As(m){const y=[];for(let L=1;L<=m;L++)y.push({row:1,col:L});for(let L=2;L<=m-1;L++)y.push({row:L,col:m});for(let L=m;L>=1;L--)y.push({row:m,col:L});for(let L=m-1;L>=2;L--)y.push({row:L,col:1});return{cols:m,rows:m,rowTemplate:`repeat(${m}, 1fr)`,focus:`2 / 2 / ${m} / ${m}`,cells:new Map(y.map((L,D)=>[D+1,L]))}}const ui="tring.ring";let _i=Ms();function Ms(){try{const m=Number(localStorage.getItem(ui));return Ts(m)?m:Vt}catch{return Vt}}function Ts(m){return Ue.includes(m)}function Ke(){return _i}function Bs(m){_i=m;try{localStorage.setItem(ui,String(m))}catch{}}function Os(m,y,L){const D=di(L);m.style.gridTemplateColumns=`repeat(${D.cols}, 1fr)`,m.style.gridTemplateRows=D.rowTemplate,y.style.gridArea=D.focus}function Ps(m,y,L){const D=di(L).cells.get(y);D&&(m.style.gridRow=String(D.row),m.style.gridColumn=String(D.col))}const fi="tring.sound";let tt=null,Mt=Is();function Is(){try{return localStorage.getItem(fi)!=="off"}catch{return!0}}function Ne(){return Mt}function Fs(m){Mt=m;try{localStorage.setItem(fi,m?"on":"off")}catch{}m&&Tt()}async function Tt(){try{return tt??(tt=new AudioContext),tt.state==="suspended"&&await tt.resume(),tt}catch{return null}}document.addEventListener("pointerdown",()=>void Tt(),{once:!0});function Xt(m,y,L,D,B){const H=m.createOscillator(),M=m.createGain();H.type="sine",H.frequency.setValueAtTime(L,y),M.gain.setValueAtTime(0,y),M.gain.linearRampToValueAtTime(D,y+.004),M.gain.exponentialRampToValueAtTime(1e-4,y+B),H.connect(M).connect(m.destination),H.start(y),H.stop(y+B)}function Hs(){Mt&&Tt().then(m=>{if(!m)return;const y=m.currentTime;for(const L of[0,.085])Xt(m,y+L,1568,.13,.55),Xt(m,y+L,2349,.05,.4)})}const pi="tring.usage",vi="tring.usage.view",gi=(m,y)=>{try{const L=localStorage.getItem(m);return L===null?y:JSON.parse(L)}catch{return y}},mi=(m,y)=>{try{localStorage.setItem(m,JSON.stringify(y))}catch{}};let Bt=gi(pi,!1);const mt=()=>Bt;function $s(m){Bt=m,mi(pi,m)}const Ns=()=>Bt&&gi(vi,!1),Si=m=>mi(vi,m),Ws=()=>At("/api/usage");function We(m){return m>=1e9?`${(m/1e9).toFixed(1)}B`:m>=1e6?`${(m/1e6).toFixed(1)}M`:m>=1e3?`${Math.round(m/1e3)}k`:String(m)}const Yt=m=>`$${m.toFixed(2)}`,Jt=m=>new Date(m).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function ae(m,y,L){const D=document.createElement(m);return y&&(D.className=y),L!==void 0&&(D.textContent=L),D}function Ci(m,y,L=!0){const D=Math.min(100,m/y*100),B=ae("div","meter"),H=ae("i");return H.style.width=`${D}%`,L&&(D>=90?H.classList.add("hot"):D>=75&&H.classList.add("warm")),B.append(H),B.setAttribute("role","progressbar"),B.setAttribute("aria-valuenow",String(Math.round(D))),B}function St(m,y,L){m.replaceChildren();const D=ae("div","usage");if(L){D.append(ae("h2",void 0,"Claude usage")),D.append(ae("p","hint",L)),m.append(D);return}if(!y){D.append(ae("p","hint","asking Claude Code…")),m.append(D);return}if(y.limits.length>0){for(const M of y.limits)D.append(Us(M));D.append(ae("p","source","from Claude Code’s own /usage"))}else{const M=y.window;D.append(Zt("5-hour window",`${We(M.tokens)} tokens`,M.resetsAt?`resets ${Jt(M.resetsAt)}`:"nothing running")),D.append(Zt("This week",`${We(y.week.tokens)} tokens`,"rolling 7 days")),D.append(ae("p","source",`${y.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const B=ae("div","utotals"),H=(M,t)=>{const a=ae("div","ucell");return a.append(ae("b",void 0,t),ae("span",void 0,M)),a};if(B.append(H("tokens today",We(y.today.tokens))),B.append(H("today, est.",Yt(y.today.cost))),B.append(H("this week, est.",Yt(y.week.cost))),B.append(H("cache reads, 7d",We(y.week.cacheReadTokens))),D.append(B),y.projects.length>0){D.append(ae("h3",void 0,"By project, last 7 days"));const M=y.projects[0].tokens,t=ae("div","uprojects");for(const a of y.projects.slice(0,8)){const h=ae("div","uproject");h.append(ae("span","nm",a.name)),h.append(Ci(a.tokens,M,!1)),h.append(ae("span","tag",We(a.tokens))),t.append(h)}D.append(t)}D.append(ae("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${Jt(y.scannedAt)}.`)),m.append(D)}function Us(m){const y=ae("div","urow"),L=ae("div","uhead");if(L.append(ae("span","ulabel",m.label)),L.append(ae("span","upct",`${m.percent}%`)),y.append(L),y.append(Ci(m.percent,100)),m.resets){const D=ae("div","ufoot");D.append(ae("span","unote",`resets ${m.resets}`)),y.append(D)}return y}function Zt(m,y,L){const D=ae("div","urow"),B=ae("div","uhead");B.append(ae("span","ulabel",m)),B.append(ae("span","upct",y)),D.append(B);const H=ae("div","ufoot");return H.append(ae("span","unote",L)),D.append(H),D}function zs(m,y,L,D,B,H=!1){m.replaceChildren();const M=document.createElement("div");M.className="logo",M.title="tring";for(let l=0;l<9;l++)M.append(document.createElement("i"));m.append(M);for(const l of y){const r=l.sessions.filter(p=>p.status==="done").length,c=document.createElement("button");c.className="tab"+(!H&&l.id===L?" active":""),c.title=l.root;const f=document.createElement("span");if(f.className="nm",f.textContent=l.name,c.append(f),r>0){const p=document.createElement("span");p.className="badge",p.textContent=String(r),c.append(p)}c.onclick=()=>D.onSelect(l.id),c.oncontextmenu=p=>{p.preventDefault(),D.onContext(l.id,{x:p.clientX,y:p.clientY})},m.append(c)}if(mt()){const l=document.createElement("button");l.className="tab pinned"+(H?" active":""),l.title="Claude usage";const r=document.createElement("span");r.className="nm",r.textContent="Usage",l.append(r),l.onclick=()=>D.onUsage(),m.append(l)}const t=document.createElement("button");t.className="add",t.textContent="+",t.title="New project",t.onclick=()=>D.onAdd(),m.append(t);const a=document.createElement("button");a.className="iconbtn"+(Ne()?" on":""),a.innerHTML=qs(Ne()),a.title=Ne()?"Sound on — click to mute":"Sound off — click to unmute",a.setAttribute("aria-label",a.title),a.setAttribute("aria-pressed",String(Ne())),a.onclick=()=>{Fs(!Ne()),D.onSoundToggle()},a.style.marginLeft=B?"0":"auto",m.append(a);const h=document.createElement("button");if(h.className="iconbtn",h.innerHTML=js(),h.title="Settings",h.setAttribute("aria-label",h.title),h.onclick=()=>D.onSettings(),m.append(h),B){const l=document.createElement("button");l.className="update",l.textContent=`v${B.latest} available`,l.title=`You are on ${B.current}`,l.onclick=()=>D.onUpdate(B),m.insertBefore(l,a)}}function js(){return bi('<path d="M6.09 3.71 L6.43 1.18 L9.57 1.18 L9.91 3.71 L10.76 4.2 L13.12 3.23 L14.69 5.95 L12.67 7.51 L12.67 8.49 L14.69 10.05 L13.12 12.77 L10.76 11.8 L9.91 12.29 L9.57 14.82 L6.43 14.82 L6.09 12.29 L5.24 11.8 L2.88 12.77 L1.31 10.05 L3.33 8.49 L3.33 7.51 L1.31 5.95 L2.88 3.23 L5.24 4.2 Z"/><circle cx="8" cy="8" r="2.4"/>')}function bi(m){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${m}</svg>`}function qs(m){return bi(`<path d="M8 2a3 3 0 0 1 3 3v3l1.4 2.1a.5.5 0 0 1-.4.8H4a.5.5 0 0 1-.4-.8L5 8V5a3 3 0 0 1 3-3z"/><path d="M6.6 12.6a1.5 1.5 0 0 0 2.8 0"/>${m?"":'<path d="M2.5 2.5l11 11"/>'}`)}const wi="(max-width: 720px)";function Ks(m){return m?{key:String(m.slot),name:m.name??m.title??"shell",status:m.status}:{key:"—",name:"pick a session",status:"idle"}}function Gs(m,y,L,D){m.replaceChildren();const B=Ks(y),H=document.createElement("button");H.className=`current st-${B.status}`,H.title="Switch session",H.setAttribute("aria-haspopup","dialog");const M=it("key",B.key),t=it("nm",B.name),a=it("tag",y?B.status:"");H.append(M,t,a,Vs()),H.onclick=()=>D.onOpen(),m.append(H);const h=document.createElement("button");h.className="paste",h.disabled=!y,h.title=y?"Paste from the clipboard":"Focus a session to paste",h.setAttribute("aria-label","Paste"),h.innerHTML=rt('<rect x="4" y="3" width="8" height="11" rx="1.5"/><path d="M6 3V2h4v1M6.5 7h3M6.5 10h3"/>'),h.onclick=()=>D.onPaste(),m.append(h);const l=document.createElement("button");l.className="copy",l.disabled=!y,l.title=y?"Copy text off the screen":"Focus a session to copy",l.setAttribute("aria-label","Copy"),l.innerHTML=rt('<rect x="6" y="6" width="8" height="8" rx="1.5"/><path d="M4 10H3.5A1.5 1.5 0 0 1 2 8.5v-5A1.5 1.5 0 0 1 3.5 2h5A1.5 1.5 0 0 1 10 3.5V4"/>'),l.onclick=()=>D.onCopy(),m.append(l);const r=document.createElement("button");r.className="next",r.disabled=L===0,r.title=L>0?`Next finished session (${L})`:"No finished sessions",r.setAttribute("aria-label",r.title),r.innerHTML=rt('<path d="M5 3l6 5-6 5"/>'),L>0&&r.append(it("badge",String(L))),r.onclick=()=>D.onNext(),m.append(r)}function it(m,y){const L=document.createElement("span");return L.className=m,L.textContent=y,L}function Vs(){const m=document.createElement("span");return m.className="chev",m.innerHTML=rt('<path d="M4 6l4 4 4-4"/>'),m}function rt(m){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${m}</svg>`}const Re=document.getElementById("overlay");let Ct=null;function Ve(){return!Re.hidden}function re(){Re.hidden=!0,Re.replaceChildren();const m=Ct;Ct=null,m==null||m()}function ye(m,y={}){var L;Ct=y.onClosed??null,Re.replaceChildren(m),Re.hidden=!1,y.dismissible!==!1?Re.onclick=D=>{D.target===Re&&re()}:Re.onclick=null,(L=m.querySelector("input, button"))==null||L.focus()}function j(m,y,L){const D=document.createElement(m);return y&&(D.className=y),L!==void 0&&(D.textContent=L),D}function yi(m){const y=j("div","browser"),L=j("div","crumb"),D=j("div","dirlist");y.append(L,D);let B=!1;async function H(M){if(!B){B=!0,D.replaceChildren(j("div","dirnote","loading…"));try{const t=M?`?path=${encodeURIComponent(M)}`:"",a=await At(`/api/fs${t}`);if(m.value=a.path,L.replaceChildren(),a.parent){const h=j("button","up","↑ "+a.parent);h.type="button",h.onclick=()=>void H(a.parent),L.append(h)}else L.append(j("span","dirnote",a.path));D.replaceChildren(),a.entries.length===0&&D.append(j("div","dirnote","no subdirectories"));for(const h of a.entries){const l=j("button",void 0,h.name);l.type="button",l.onclick=()=>void H(h.path),D.append(l)}}catch(t){D.replaceChildren(j("div","dirnote",t.message))}finally{B=!1}}}return m.addEventListener("change",()=>void H(m.value.trim()||void 0)),H(m.value.trim()||void 0),y}function Xs(m,y,L,D){const B=j("div","panel picker");B.append(j("h2",void 0,m?m.name:"No project")),B.append(j("p","hint",`${L} session${L===1?"":"s"} finished across all projects`));const H=j("div","rows"),M=new Map;for(const c of(m==null?void 0:m.sessions)??[])M.set(c.slot,c);const t=window.matchMedia(wi).matches;for(let c=1;c<=Ke();c++){const f=M.get(c),p=j("button",`row st-${(f==null?void 0:f.status)??"idle"}`);(f==null?void 0:f.status)==="busy"&&p.classList.add("dim"),f||p.classList.add("dim"),p.append(j("span","key",t?String(c):kt(c))),p.append(j("span","nm",f?f.name??f.title??f.cwd.split("/").pop()??"shell":"— empty")),f&&p.append(j("span","tag",f.status)),p.onclick=()=>{re(),D.onPickSlot(c)},H.append(p)}B.append(H);const a=j("div","picker-actions"),h=j("button","btn","Next finished");h.type="button",h.disabled=L===0,h.onclick=()=>{re(),D.onNextDone()};const l=j("button","btn","New session");l.type="button",l.onclick=()=>{re(),D.onNewSession()},a.append(h,l),B.append(a);const r=j("div","legend");r.innerHTML="<b>n</b> next finished <b>p</b> projects <b>c</b> new session <b>r</b> rename <b>x</b> kill <b>m</b> mark seen <b>esc</b> close",B.append(r),ye(B),B.dataset.projects=String(y.length)}function Ys(m,y){const L=j("div","panel");L.append(j("h2",void 0,"Projects")),L.append(j("p","hint",`Each project owns its own ${Ke()} slots.`));const D=j("div","rows");m.forEach((B,H)=>{const M=B.sessions.filter(a=>a.status==="done").length,t=j("button","row st-done");t.append(j("span","key",H<9?String(H+1):"—")),t.append(j("span","nm",B.name)),t.append(j("span","tag",M>0?`${M} done`:B.root)),t.onclick=()=>{re(),y(B.id)},D.append(t)}),L.append(D),ye(L)}function Ei(m,y){const L=j("div","panel");L.append(j("h2",void 0,m.title)),L.append(j("p","hint",m.blocking?"A project is a name and a root directory. New sessions start there.":"New sessions in this project start in its root directory."));const D=j("form"),B=j("input");B.value=m.name??"",B.placeholder="api-service",B.required=!0;const H=j("label","field");H.append(j("span",void 0,"Project name"),B);const M=j("input");M.value=m.root??"",M.placeholder="/home/you/code/api-service",M.required=!0,M.disabled=!!m.rootLocked;const t=j("label","field");t.append(j("span",void 0,m.rootLocked?"Root directory (fixed after creation)":"Root directory"),M),D.append(H,t),m.rootLocked||D.append(yi(M));const a=j("div","actions");if(m.onDelete){const l=j("button","btn danger","Delete project");l.type="button",l.onclick=()=>{var r;re(),(r=m.onDelete)==null||r.call(m)},a.append(l),a.style.justifyContent="space-between"}if(!m.blocking){const l=j("button","btn","Cancel");l.type="button",l.onclick=()=>re(),a.append(l)}const h=j("button","btn primary",m.onDelete?"Save":"Create");h.type="submit",a.append(h),D.append(a),D.onsubmit=l=>{l.preventDefault(),!(!B.value.trim()||!M.value.trim())&&(re(),y(B.value.trim(),M.value.trim()))},L.append(D),ye(L,{dismissible:!m.blocking}),B.focus(),B.select()}function Js(m,y){const L=j("div","panel");L.append(j("h2",void 0,`New session in slot ${m.slot}`)),L.append(j("p","hint","Defaults to the project root."));const D=j("form"),B=(r,c,f)=>{const p=j("input");p.value=c,p.placeholder=f;const o=j("label","field");return o.append(j("span",void 0,r),p),D.append(o),p},H=B("Working directory",m.cwd,m.cwd);D.append(yi(H));const M=B("Command (optional)","","claude"),t=B("Name (optional)","","agent"),a=j("div","actions"),h=j("button","btn","Cancel");h.type="button",h.onclick=()=>re();const l=j("button","btn primary","Start");l.type="submit",a.append(h,l),D.append(a),D.onsubmit=r=>{r.preventDefault(),re(),y({cwd:H.value.trim()||m.cwd,command:M.value.trim()||null,name:t.value.trim()||null})},L.append(D),ye(L)}const Zs=["#f87171","#b91c1c","#fb923c","#c2410c","#fbbf24","#b45309","#a3e635","#4d7c0f","#4ade80","#15803d","#2dd4bf","#0f766e","#22d3ee","#0e7490","#60a5fa","#1d4ed8","#818cf8","#4338ca","#c084fc","#7e22ce","#f472b6","#be185d","#94a3b8","#475569"];function Qs(m,y,L,D){const B=j("div","panel");B.append(j("h2",void 0,`Slot ${m.slot}`)),B.append(j("p","hint",m.cwd));const H=j("form"),M=j("input");M.value=m.name??"",M.placeholder=m.title??"shell";const t=j("label","field");t.append(j("span",void 0,"Name"),M),H.append(t);let a=m.color;const h=j("div","swatches"),l=()=>{for(const i of Array.from(h.children))i.classList.toggle("active",i.dataset.color===(a??""))},r=(i,s)=>{const d=j("button","swatch");d.type="button",d.dataset.color=i??"",d.title=s,d.setAttribute("aria-label",s),i?d.style.setProperty("--tint",i):d.classList.add("none"),d.onclick=()=>{a=i,l()},h.append(d)};r(null,"No colour");for(const i of Zs)r(i,i);l();const c=j("div","field");c.append(j("span",void 0,"Border colour"),h),H.append(c);const f=j("div","actions"),p=j("button","btn danger","Delete");p.type="button",p.onclick=()=>{re(),L()};const o=j("button","btn diff-toggle",D.open?"Hide diff viewer":"Diff viewer");o.type="button",o.style.marginRight="auto",o.onclick=()=>{re(),D.onToggle()};const e=j("button","btn","Cancel");e.type="button",e.onclick=()=>re();const n=j("button","btn primary","Save");n.type="submit",f.append(p,o,e,n),H.append(f),H.onsubmit=i=>{i.preventDefault(),re(),y({name:M.value.trim(),color:a})},B.append(H),ye(B),M.focus(),M.select()}function er(m,y){const L=j("div","panel");L.append(j("h2",void 0,"Settings"));let D=m.ring;const B=j("div","field ring-size");B.append(j("span",void 0,"Terminals around the focus"));const H=j("div","choices");for(const r of Ue){const c=j("button","choice"+(r===D?" active":""));c.type="button",c.append(j("b",void 0,String(r))),c.append(j("span",void 0,r<12?"wide centre":"full ring")),c.onclick=()=>{D=r;for(const f of Array.from(H.children))f.classList.remove("active");c.classList.add("active")},H.append(c)}B.append(H),L.append(B),L.append(j("p","hint ring-size","Slots stay where they are. Shrinking needs the slots above the new size to be empty first, so nothing is killed or hidden behind your back."));const M=j("label","field toggle"),t=j("input");t.type="checkbox",t.checked=m.usage,M.append(t,j("span",void 0,"Enable Claude usage monitoring")),L.append(M),L.append(j("p","hint","The tab asks Claude Code for the real numbers with `claude -p /usage`, which it answers locally and bills nothing. Nothing is read from your credentials, and nothing leaves this machine."));const a=j("div","actions"),h=j("button","btn","Cancel");h.type="button",h.onclick=()=>re();const l=j("button","btn primary","Save");l.onclick=()=>{re(),y({ring:D,usage:t.checked})},a.append(h,l),L.append(a),ye(L)}function tr(m,y){const L=j("div","panel");L.append(j("h2",void 0,`tring ${y} is available`)),L.append(j("p","hint",`You are running ${m}. Update with:`));const D=j("pre","cmd","npm i -g tring-chat");L.append(D),L.append(j("p","hint","Running sessions are not affected until you restart the daemon."));const B=j("div","actions"),H=j("button","btn","Copy command");H.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{H.textContent="Copied"},()=>{H.textContent="Copy failed"})};const M=j("button","btn primary","Close");M.onclick=()=>re(),B.append(H,M),L.append(B),ye(L)}function Li(m,y,L){const D=j("div","panel");D.append(j("h2",void 0,m)),D.append(j("p","hint",y));const B=j("div","actions"),H=j("button","btn","Cancel");H.onclick=()=>re();const M=j("button","btn primary","Confirm");M.onclick=()=>{re(),L()},B.append(H,M),D.append(B),ye(D)}function ir(m){const y=j("div","panel paste-sheet");y.append(j("h2",void 0,"Paste")),y.append(j("p","hint","The clipboard could not be read directly. Long-press the box and paste: text is typed into the terminal, an image goes in as a path."));const L=j("textarea","paste-box");L.rows=4,L.placeholder="paste here",L.autocomplete="off",L.autocapitalize="off",L.spellcheck=!1,L.addEventListener("paste",M=>{var a;const t=li((a=M.clipboardData)==null?void 0:a.files);t.length!==0&&(M.preventDefault(),re(),m.onImages(t))}),y.append(L);const D=j("div","actions"),B=j("button","btn","Cancel");B.onclick=()=>re();const H=j("button","btn primary","Insert");H.onclick=()=>{const M=L.value;re(),M&&m.onText(M)},D.append(B,H),y.append(D),ye(y),L.focus()}function sr(m,y){const L=j("div","panel copy-sheet");L.append(j("h2",void 0,"Copy"));const D=(a,h,l="btn")=>{const r=j("button",l,a);return r.type="button",r.onclick=()=>{y(h).then(c=>{r.textContent=c?"Copied":"Copy failed",setTimeout(()=>{r.textContent=a},1500)})},r};if(m.links.length>0){L.append(j("p","hint","Links on screen, the latest first."));const a=j("div","links");for(const h of m.links){const l=j("div","link");l.append(j("span","url",h),D("Copy",h)),a.append(l)}L.append(a)}L.append(j("p","hint",m.text?"The screen as text. Long-press to select part of it, or copy all of it.":"Nothing on the screen yet."));const B=j("pre","copy-box",m.text);L.append(B);const H=j("div","actions"),M=j("button","btn","Close");M.onclick=()=>re();const t=D("Copy screen",m.text,"btn primary");t.disabled=m.text==="",H.append(M,t),L.append(H),ye(L)}const rr=document.getElementById("bar"),pt=document.getElementById("switcher"),Ae=document.getElementById("ring"),Ge=document.getElementById("usage");let Ce=[],Me=null,le=null,at=null,bt=null,Qt="",vt=!1,pe=null,wt=null,De="ring",nt=null;const Ot=window.matchMedia(wi),ht=new Map,ot=new Map,yt=new Map,xi=new Map;let Et=null,Lt=null;const xe=document.createElement("div");xe.className="focus-cell";const Pt=document.createElement("div");Pt.className="term-host";xe.append(Pt);const ze=new ds(xe,()=>Ye()),ve=new os(Pt),ge=new es({onOpen:()=>{$t(),dr()},onClose:()=>Je("daemon disconnected — reconnecting"),onOutput:(m,y)=>{m===le&&ve.write(y)},onMessage:nr});ve.onInput=m=>{le&&ge.send({type:"input",id:le,data:m})};fs(window);const je={upload:Qi,ready:()=>le!==null,insert:m=>{ve.paste(m),ve.focus()},onError:Je};ps(xe,je);gs(xe,je);ve.shouldSendKey=m=>!Ve()&&!Rt(m);const It=()=>Ce.find(m=>m.id===Me)??null,Te=()=>{var m;return((m=It())==null?void 0:m.sessions)??[]},Ie=m=>Te().find(y=>y.slot===m),Fe=m=>Ce.flatMap(y=>y.sessions).find(y=>y.id===m);function He(){const m=Math.max(0,...Te().map(y=>y.slot));return Ue.find(y=>y>=m&&y>=Ke())??Ue[Ue.length-1]}const Ri=()=>Ce.reduce((m,y)=>m+y.sessions.filter(L=>L.status==="done").length,0);function nr(m){var y,L;switch(m.type){case"state":{Ce=m.projects,wt=m.update??wt;const D=new Set(Ce.flatMap(B=>B.sessions).map(B=>B.id));for(const B of ot.keys())D.has(B)||ot.delete(B);Me=m.activeProjectId??((y=Ce[0])==null?void 0:y.id)??null,ki(),ur(),vr(),pr(),Ns()&&Ti(),mr();break}case"status":{const D=Fe(m.id),B=D==null?void 0:D.status;D&&(D.status=m.status,D.since=m.since,D.title=m.title),m.status==="done"&&B!=="done"&&m.notable&&Hs(),Pe();break}case"screen":m.id===le&&ve.replay(m.ansi);break;case"snapshot":{ot.set(m.id,m.snapshot),(L=ht.get(m.id))==null||L.paint(m.snapshot);break}case"exit":Pe();break;case"error":Je(m.message);break}}const or=()=>({onSelect:m=>lt(m),onAdd:()=>Bi(!1),onContext:m=>gr(m),onUpdate:m=>tr(m.current,m.latest),onSoundToggle:()=>Pe(),onSettings:()=>_r(),onUsage:()=>Ti()}),Xe=()=>zs(rr,Ce,Me,or(),wt,De==="usage");function ki(){Xe(),ar(),Pe()}function ar(){const m=He(),y=`${Me}|${m}|`+Te().map(L=>`${L.slot}:${L.id}`).sort().join(",");if(y!==Qt){Qt=y,Os(Ae,xe,m);for(const L of Array.from(Ae.children))L!==xe&&L.remove();xe.parentElement!==Ae&&Ae.append(xe),yt.clear(),ht.clear();for(let L=1;L<=m;L++){const D=Ie(L),B=document.createElement("div");if(B.className="tile",B.tabIndex=0,B.onmousedown=H=>H.preventDefault(),Ps(B,L,m),!D)B.classList.add("empty"),B.textContent=`+ ${kt(L)}`,B.onclick=()=>Ht(L);else{const H=document.createElement("canvas");B.append(H);const M=new ks(H);ht.set(D.id,M);const t=ot.get(D.id);t&&M.paint(t);const a=document.createElement("div");a.className="label";const h=st("slot-badge");h.textContent=String(L),a.append(h,st("big-nm")),B.append(a);const l=document.createElement("div");l.className="meta";const r=document.createElement("span");r.className="key",r.textContent=String(L),l.append(r,st("nm"),st("cwd")),B.append(l),B.onclick=()=>Be(D.id),B.oncontextmenu=f=>{f.preventDefault(),Oi(D.id)};const c=document.createElement("button");c.className="tile-action",c.onclick=f=>{f.stopPropagation(),ge.send({type:"respawn",id:D.id})},B.append(c),Di(B,D)}yt.set(L,B),Ae.append(B)}requestAnimationFrame(()=>Ye())}}const st=m=>{const y=document.createElement("span");return y.className=m,y};function Di(m,y){if(m.classList.remove("st-idle","st-busy","st-done","st-exited","viewing"),m.style.removeProperty("--tint"),!y)return;m.classList.add(`st-${y.status}`),y.id===le&&m.classList.add("viewing"),y.color&&m.style.setProperty("--tint",y.color);const L=y.name??y.title??"shell",D=m.querySelector(".nm");D&&(D.textContent=L);const B=m.querySelector(".big-nm");B&&(B.textContent=L);const H=m.querySelector(".cwd");H&&(H.textContent=y.cwd.split("/").filter(Boolean).pop()??""),m.title=`${kt(y.slot)} — ${y.cwd}`;const M=m.querySelector(".tile-action"),t=hr(y);M&&(M.hidden=!t,t&&(M.textContent=t.label,M.title=t.title))}function hr(m){return m.status==="exited"?{label:"↻",title:m.command?`Restart: ${m.command}`:`Restart shell (exit ${m.exitCode??"?"})`}:m.command&&m.status==="idle"?{label:"▸",title:`Run: ${m.command}`}:null}function Pe(){for(let y=1;y<=He();y++){const L=yt.get(y);L&&Di(L,Ie(y))}Xe(),dt();const m=Ri();document.title=m>0?`(${m}) tring`:"tring"}let gt="";function dt(){if(pt.hidden=!Ot.matches||De!=="ring",pt.hidden){gt="";return}const m=le?Fe(le)??null:null,y=Te().filter(D=>D.status==="done").length,L=`${m==null?void 0:m.id}|${m==null?void 0:m.status}|${m==null?void 0:m.name}|${m==null?void 0:m.title}|${y}`;L!==gt&&(gt=L,Gs(pt,m,y,{onOpen:Ii,onNext:Ft,onPaste:lr,onCopy:cr}))}function lr(){Ss({...je,fallback:()=>ir({onText:je.insert,onImages:m=>{ct(m,je)}})})}function cr(){if(!le)return;const m=ve.term.buffer.active;sr({text:Cs(m,ve.term.rows),links:Ls(m)},xs)}function Ye(){const{cols:m,rows:y}=ve.fitNow();le&&ge.send({type:"resize",cols:m,rows:y});for(const L of ht.values())L.refresh()}function Be(m){ut(),Ai(m),le&&ve.focus()}function Ai(m){if(m&&m===le)return;const y=m?Fe(m):void 0;if(le&&(bt=le),le=(y==null?void 0:y.id)??null,at=(y==null?void 0:y.slot)??null,ze.setSession(le),!y){ve.clear(),Pe();return}xi.set(y.projectId,y.id);const{cols:L,rows:D}=ve.fitNow();ge.send({type:"focus",id:y.id,cols:L,rows:D}),ve.focus(),Pe()}function dr(){if(!le)return;const{cols:m,rows:y}=ve.fitNow();ge.send({type:"focus",id:le,cols:m,rows:y})}function ur(){if(le===null||at===null)return;const m=us({id:le,slot:at},Te());m&&m.id===le||Ai((m==null?void 0:m.id)??null)}function Mi(m){const y=Ie(m);y?Be(y.id):Ht(m)}function Ti(){De!=="usage"&&(De="usage",Ae.hidden=!0,Ge.hidden=!1,St(Ge,null,null),xt(),nt=setInterval(()=>void xt(),3e4),Si(!0),Xe(),dt())}function ut(){De!=="ring"&&(De="ring",nt&&clearInterval(nt),nt=null,Ge.hidden=!0,Ae.hidden=!1,Si(!1),Xe(),dt(),requestAnimationFrame(()=>Ye()))}async function xt(){if(De==="usage")try{St(Ge,await Ws(),null)}catch(m){St(Ge,null,m.message)}}function _r(){er({ring:Ke(),usage:mt()},m=>{m.usage!==mt()&&($s(m.usage),m.usage||ut()),m.ring!==Ke()?fr(m.ring):(Xe(),xt())})}function fr(m){Bs(m),ki();const y=He();y!==m?Je(`slots above ${m} are still in use — the ring stays at ${y} until they are closed`):$t()}function lt(m){ut(),m!==Me&&(Me=m,le=null,at=null,ze.setSession(null),ve.clear(),Et=m,ge.send({type:"activateProject",projectId:m}))}function pr(){const m=Lt;if(m===null)return;const y=Ie(m);y&&(Lt=null,Be(y.id))}function vr(){const m=Et;if(!m||m!==Me)return;Et=null;const y=xi.get(m);y&&Te().some(L=>L.id===y)&&Be(y)}function Ft(){var B;const m=Te(),y=Ie(((B=Fe(le??""))==null?void 0:B.slot)??0),L=(y==null?void 0:y.slot)??0,D=He();for(let H=1;H<=D;H++){const M=(L+H-1)%D+1,t=m.find(a=>a.slot===M);if((t==null?void 0:t.status)==="done")return Be(t.id)}}function Ht(m){const y=It();y&&Js({cwd:y.root,slot:m},L=>{Ot.matches&&(Lt=m),ge.send({type:"create",projectId:y.id,slot:m,cwd:L.cwd,...L.command?{command:L.command}:{},...L.name?{name:L.name}:{}})})}function Bi(m){Ei({title:m?"Create your first project":"New project",root:"",blocking:m},(y,L)=>ge.send({type:"createProject",name:y,root:L}))}function Oi(m){const y=Fe(m);y&&Qs(y,L=>{L.name!==(y.name??"")&&ge.send({type:"rename",id:m,name:L.name}),L.color!==y.color&&ge.send({type:"color",id:m,color:L.color})},()=>Pi(y),{open:ze.isOpen,onToggle:()=>{ze.isOpen||Be(m),ze.toggle()}})}function Pi(m){Li("Delete session",`Slot ${m.slot} — ${m.cwd}. The slot goes back to empty.`,()=>ge.send({type:"kill",id:m.id}))}function gr(m){const y=Ce.find(L=>L.id===m);y&&Ei({title:"Project settings",name:y.name,root:y.root,rootLocked:!0,onDelete:()=>{const L=y.sessions.length;Li(`Delete ${y.name}?`,L>0?`This kills ${L} session${L===1?"":"s"} in this project.`:"This project has no running sessions.",()=>ge.send({type:"deleteProject",projectId:m}))}},L=>ge.send({type:"renameProject",projectId:m,name:L}))}function mr(){if(Ce.length>0){vt=!1;return}vt||Ve()||(vt=!0,Bi(!0))}document.addEventListener("keydown",m=>{if(Ve())return Sr(m);Rt(m)&&(m.preventDefault(),Ii())});document.addEventListener("click",()=>{Ve()||De!=="ring"||!le||ve.focus()});function Ii(){Ve()||(ut(),pe="picker",Xs(It(),Ce,Ri(),{onPickSlot:m=>{pe=null,Mi(m)},onPickProject:m=>{pe=null,lt(m)},onNextDone:()=>{pe=null,Ft()},onNewSession:()=>{pe=null,Fi()}}))}function Fi(){const m=He(),y=[...Array(m)].map((L,D)=>D+1).find(L=>!Ie(L));y?Ht(y):Je(`all ${m} slots are full`)}function Sr(m){if(pe===null)return;if(pe==="projects"){const B=Number(m.key);if(B>=1&&B<=9&&Ce[B-1]){m.preventDefault();const H=Ce[B-1];re(),pe=null,lt(H.id);return}}const y=Gi(m);if(y!==null&&y<=He()&&pe==="picker"){m.preventDefault(),re(),pe=null,Mi(y);return}if(Rt(m)||m.code==="Space"){m.preventDefault(),re(),pe=null,bt&&Be(bt);return}const L=Vi(m);if(!L)return;m.preventDefault();const D=le?Fe(le):void 0;switch(L){case"close":re(),pe=null;break;case"next-done":re(),pe=null,Ft();break;case"projects":re(),pe="projects",Ys(Ce,B=>{pe=null,lt(B)});break;case"new-session":re(),pe=null,Fi();break;case"rename":if(!D)break;re(),pe=null,Oi(D.id);break;case"kill":if(!D)break;re(),pe=null,Pi(D);break;case"mark-seen":D&&ge.send({type:"ack",id:D.id}),re(),pe=null;break}}let ke=null;function Je(m){$t(),ke=document.createElement("div"),ke.id="toast",ke.textContent=m,document.body.append(ke)}function $t(){ke==null||ke.remove(),ke=null}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});window.addEventListener("resize",()=>Ye());Ot.addEventListener("change",()=>{dt(),requestAnimationFrame(()=>Ye())});ge.connect();
|
|
66
|
+
}`)),this.register((0,l.toDisposable)(()=>y.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(y.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=y.createVertexArray(),y.bindVertexArray(this._vertexArrayObject);const L=new Float32Array([0,0,1,0,0,1,1,1]),A=y.createBuffer();this.register((0,l.toDisposable)(()=>y.deleteBuffer(A))),y.bindBuffer(y.ARRAY_BUFFER,A),y.bufferData(y.ARRAY_BUFFER,L,y.STATIC_DRAW),y.enableVertexAttribArray(3),y.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const I=new Uint8Array([0,1,2,3]),N=y.createBuffer();this.register((0,l.toDisposable)(()=>y.deleteBuffer(N))),y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,N),y.bufferData(y.ELEMENT_ARRAY_BUFFER,I,y.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(y.createBuffer()),this.register((0,l.toDisposable)(()=>y.deleteBuffer(this._attributesBuffer))),y.bindBuffer(y.ARRAY_BUFFER,this._attributesBuffer),y.enableVertexAttribArray(0),y.vertexAttribPointer(0,2,y.FLOAT,!1,f,0),y.vertexAttribDivisor(0,1),y.enableVertexAttribArray(1),y.vertexAttribPointer(1,2,y.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(1,1),y.enableVertexAttribArray(2),y.vertexAttribPointer(2,4,y.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(2,1),this._updateCachedColors(x.colors),this.register(this._themeService.onChangeColors($=>{this._updateCachedColors($),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(u){const v=this._gl;v.useProgram(this._program),v.bindVertexArray(this._vertexArrayObject),v.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),v.bindBuffer(v.ARRAY_BUFFER,this._attributesBuffer),v.bufferData(v.ARRAY_BUFFER,u.attributes,v.DYNAMIC_DRAW),v.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,v.UNSIGNED_BYTE,0,u.count)}handleResize(){this._updateViewportRectangle()}setDimensions(u){this._dimensions=u}_updateCachedColors(u){this._bgFloat=this._colorToFloat32Array(u.background),this._cursorFloat=this._colorToFloat32Array(u.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(u){const v=this._terminal,C=this._vertices;let x,y,L,A,I,N,$,F,b,k,T,O=1;for(x=0;x<v.rows;x++){for(L=-1,A=0,I=0,N=!1,y=0;y<v.cols;y++)$=(x*v.cols+y)*s.RENDER_MODEL_INDICIES_PER_CELL,F=u.cells[$+s.RENDER_MODEL_BG_OFFSET],b=u.cells[$+s.RENDER_MODEL_FG_OFFSET],k=!!(67108864&b),(F!==A||b!==I&&(N||k))&&((A!==0||N&&I!==0)&&(T=8*O++,this._updateRectangle(C,T,I,A,L,y,x)),L=y,A=F,I=b,N=k);(A!==0||N&&I!==0)&&(T=8*O++,this._updateRectangle(C,T,I,A,L,v.cols,x))}C.count=O}updateCursor(u){const v=this._verticesCursor,C=u.cursor;if(!C||C.style==="block")return void(v.count=0);let x,y=0;C.style!=="bar"&&C.style!=="outline"||(x=8*y++,this._addRectangleFloat(v.attributes,x,C.x*this._dimensions.device.cell.width,C.y*this._dimensions.device.cell.height,C.style==="bar"?C.dpr*C.cursorWidth:C.dpr,this._dimensions.device.cell.height,this._cursorFloat)),C.style!=="underline"&&C.style!=="outline"||(x=8*y++,this._addRectangleFloat(v.attributes,x,C.x*this._dimensions.device.cell.width,(C.y+1)*this._dimensions.device.cell.height-C.dpr,C.width*this._dimensions.device.cell.width,C.dpr,this._cursorFloat)),C.style==="outline"&&(x=8*y++,this._addRectangleFloat(v.attributes,x,C.x*this._dimensions.device.cell.width,C.y*this._dimensions.device.cell.height,C.width*this._dimensions.device.cell.width,C.dpr,this._cursorFloat),x=8*y++,this._addRectangleFloat(v.attributes,x,(C.x+C.width)*this._dimensions.device.cell.width-C.dpr,C.y*this._dimensions.device.cell.height,C.dpr,this._dimensions.device.cell.height,this._cursorFloat)),v.count=y}_updateRectangle(u,v,C,x,y,L,A){if(67108864&C)switch(50331648&C){case 16777216:case 33554432:a=this._themeService.colors.ansi[255&C].rgba;break;case 50331648:a=(16777215&C)<<8;break;default:a=this._themeService.colors.foreground.rgba}else switch(50331648&x){case 16777216:case 33554432:a=this._themeService.colors.ansi[255&x].rgba;break;case 50331648:a=(16777215&x)<<8;break;default:a=this._themeService.colors.background.rgba}u.attributes.length<v+4&&(u.attributes=(0,c.expandFloat32Array)(u.attributes,this._terminal.rows*this._terminal.cols*8)),e=y*this._dimensions.device.cell.width,n=A*this._dimensions.device.cell.height,i=(a>>24&255)/255,r=(a>>16&255)/255,d=(a>>8&255)/255,g=1,this._addRectangle(u.attributes,v,e,n,(L-y)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,r,d,g)}_addRectangle(u,v,C,x,y,L,A,I,N,$){u[v]=C/this._dimensions.device.canvas.width,u[v+1]=x/this._dimensions.device.canvas.height,u[v+2]=y/this._dimensions.device.canvas.width,u[v+3]=L/this._dimensions.device.canvas.height,u[v+4]=A,u[v+5]=I,u[v+6]=N,u[v+7]=$}_addRectangleFloat(u,v,C,x,y,L,A){u[v]=C/this._dimensions.device.canvas.width,u[v+1]=x/this._dimensions.device.canvas.height,u[v+2]=y/this._dimensions.device.canvas.width,u[v+3]=L/this._dimensions.device.canvas.height,u[v+4]=A[0],u[v+5]=A[1],u[v+6]=A[2],u[v+7]=A[3]}_colorToFloat32Array(u){return new Float32Array([(u.rgba>>24&255)/255,(u.rgba>>16&255)/255,(u.rgba>>8&255)/255,(255&u.rgba)/255])}}t.RectangleRenderer=_},310:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=o(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,s){const c=l*s*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=o(820),l=o(274),s=o(627),c=o(457),f=o(56),p=o(374),a=o(345),e=o(859),n=o(147),i=o(782),r=o(855),d=o(965),g=o(742),_=o(310),S=o(733);class u extends e.Disposable{constructor(y,L,A,I,N,$,F,b,k){super(),this._terminal=y,this._characterJoinerService=L,this._charSizeService=A,this._coreBrowserService=I,this._coreService=N,this._decorationService=$,this._optionsService=F,this._themeService=b,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new _.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new a.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new a.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new a.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new a.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new a.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new S.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,F,this._themeService)],this.dimensions=(0,p.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(F.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const T={antialias:!1,depth:!1,preserveDrawingBuffer:k};if(this._gl=this._canvas.getContext("webgl2",T),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",O=>{console.log("webglcontextlost event received"),O.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(O)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",O=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(O,U)=>this._setCanvasDevicePixelDimensions(O,U)),this.register(this._coreBrowserService.onWindowChange(O=>{this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,O,(U,q)=>this._setCanvasDevicePixelDimensions(U,q))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var O;for(const U of this._renderLayers)U.dispose();(O=this._canvas.parentElement)==null||O.removeChild(this._canvas),(0,s.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var y;return(y=this._charAtlas)==null?void 0:y.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(y,L){var A,I,N,$;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const F of this._renderLayers)F.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(A=this._rectangleRenderer.value)==null||A.setDimensions(this.dimensions),(I=this._rectangleRenderer.value)==null||I.handleResize(),(N=this._glyphRenderer.value)==null||N.setDimensions(this.dimensions),($=this._glyphRenderer.value)==null||$.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var y;for(const L of this._renderLayers)L.handleBlur(this._terminal);(y=this._cursorBlinkStateManager.value)==null||y.pause(),this._requestRedrawViewport()}handleFocus(){var y;for(const L of this._renderLayers)L.handleFocus(this._terminal);(y=this._cursorBlinkStateManager.value)==null||y.resume(),this._requestRedrawViewport()}handleSelectionChanged(y,L,A){for(const I of this._renderLayers)I.handleSelectionChanged(this._terminal,y,L,A);this._model.selection.update(this._core,y,L,A),this._requestRedrawViewport()}handleCursorMove(){var y;for(const L of this._renderLayers)L.handleCursorMove(this._terminal);(y=this._cursorBlinkStateManager.value)==null||y.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new g.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new d.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var L;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const y=(0,s.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==y&&(this._onChangeTextureAtlas.fire(y.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,a.forwardEvent)(y.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,a.forwardEvent)(y.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=y,this._charAtlas.warmUp(),(L=this._glyphRenderer.value)==null||L.setAtlas(this._charAtlas)}_clearModel(y){var L;this._model.clear(),y&&((L=this._glyphRenderer.value)==null||L.clear())}clearTextureAtlas(){var y;(y=this._charAtlas)==null||y.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var y;this._clearModel(!0);for(const L of this._renderLayers)L.reset(this._terminal);(y=this._cursorBlinkStateManager.value)==null||y.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(y){return-1}deregisterCharacterJoiner(y){return!1}renderRows(y,L){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const A of this._renderLayers)A.handleGridChanged(this._terminal,y,L);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(y,L),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new c.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(y,L){const A=this._core;let I,N,$,F,b,k,T,O,U,q,Y,V,P,R,z=this._workCell;y=C(y,A.rows-1,0),L=C(L,A.rows-1,0);const W=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,G=W-A.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,A.cols-1);let Q=-1;const J=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let oe=!1;for(N=y;N<=L;N++)for($=N+A.buffer.ydisp,F=A.buffer.lines.get($),this._model.lineLengths[N]=0,b=this._characterJoinerService.getJoinedCharacters($),P=0;P<A.cols;P++)if(I=this._cellColorResolver.result.bg,F.loadCell(P,z),P===0&&(I=this._cellColorResolver.result.bg),k=!1,T=P,b.length>0&&P===b[0][0]&&(k=!0,O=b.shift(),z=new v(z,F.translateToString(!0,O[0],O[1]),O[1]-O[0]),T=O[1]-1),U=z.getChars(),q=z.getCode(),V=(N*A.cols+P)*_.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(z,P,$,this.dimensions.device.cell.width),J&&$===W&&(P===K&&(this._model.cursor={x:K,y:G,width:z.getWidth(),style:this._coreBrowserService.isFocused?A.options.cursorStyle||"block":A.options.cursorInactiveStyle,cursorWidth:A.options.cursorWidth,dpr:this._devicePixelRatio},Q=K+z.getWidth()-1),P>=K&&P<=Q&&(this._coreBrowserService.isFocused&&(A.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&A.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),q!==r.NULL_CELL_CODE&&(this._model.lineLengths[N]=P+1),(this._model.cells[V]!==q||this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(oe=!0,U.length>1&&(q|=_.COMBINED_CHAR_BIT_MASK),this._model.cells[V]=q,this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=z.getWidth(),this._glyphRenderer.value.updateCell(P,N,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,Y,I),k))for(z=this._workCell,P++;P<T;P++)R=(N*A.cols+P)*_.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(P,N,r.NULL_CELL_CODE,0,0,0,r.NULL_CELL_CHAR,0,0),this._model.cells[R]=r.NULL_CELL_CODE,this._model.cells[R+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[R+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[R+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;oe&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(y,L){this._canvas.width===y&&this._canvas.height===L||(this._canvas.width=y,this._canvas.height=L,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const y=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:y,end:y})}}t.WebglRenderer=u;class v extends n.AttributeData{constructor(y,L,A){super(),this.content=0,this.combinedData="",this.fg=y.fg,this.bg=y.bg,this.combinedData=L,this._width=A}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(y){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function C(x,y,L=0){return Math.max(Math.min(x,y),L)}t.JoinedCellData=v},381:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=o(374);function l(s,c,f){const p=(0,h.throwIfFalsy)(s.createShader(c));if(s.shaderSource(p,f),s.compileShader(p),s.getShaderParameter(p,s.COMPILE_STATUS))return p;console.error(s.getShaderInfoLog(p)),s.deleteShader(p)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,c,f){const p=(0,h.throwIfFalsy)(s.createProgram());if(s.attachShader(p,(0,h.throwIfFalsy)(l(s,s.VERTEX_SHADER,c))),s.attachShader(p,(0,h.throwIfFalsy)(l(s,s.FRAGMENT_SHADER,f))),s.linkProgram(p),s.getProgramParameter(p,s.LINK_STATUS))return p;console.error(s.getProgramInfoLog(p)),s.deleteProgram(p)},t.createShader=l,t.expandFloat32Array=function(s,c){const f=Math.min(2*s.length,c),p=new Float32Array(f);for(let a=0;a<s.length;a++)p[a]=s[a];return p},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=o(627),l=o(237),s=o(374),c=o(859);class f extends c.Disposable{constructor(a,e,n,i,r,d,g,_){super(),this._container=e,this._alpha=r,this._coreBrowserService=d,this._optionsService=g,this._themeService=_,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(S=>{this._refreshCharAtlas(a,S),this.reset(a)})),this.register((0,c.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(a){}handleFocus(a){}handleCursorMove(a){}handleGridChanged(a,e,n){}handleSelectionChanged(a,e,n,i=!1){}_setTransparency(a,e){if(e===this._alpha)return;const n=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(a,this._themeService.colors),this.handleGridChanged(a,0,a.rows-1)}_refreshCharAtlas(a,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(a,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(a,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(a,this._themeService.colors)}_fillBottomLineAtCells(a,e,n=1){this._ctx.fillRect(a*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(a,e,n,i){this._alpha?this._ctx.clearRect(a*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(a*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(a,e,n,i){this._ctx.font=this._getFont(a,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(n,i,e.getWidth()),this._ctx.fillText(e.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(a,e,n){this._ctx.beginPath(),this._ctx.rect(a*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(a,e,n){return`${n?"italic":""} ${e?a.options.fontWeightBold:a.options.fontWeight} ${a.options.fontSize*this._coreBrowserService.dpr}px ${a.options.fontFamily}`}}t.BaseRenderLayer=f},733:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=o(197),l=o(237),s=o(592);class c extends s.BaseRenderLayer{constructor(p,a,e,n,i,r,d){super(e,p,"link",a,!0,i,r,d),this.register(n.onShowLinkUnderline(g=>this._handleShowLinkUnderline(g))),this.register(n.onHideLinkUnderline(g=>this._handleHideLinkUnderline(g)))}resize(p,a){super.resize(p,a),this._state=void 0}reset(p){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const p=this._state.y2-this._state.y1-1;p>0&&this._clearCells(0,this._state.y1+1,this._state.cols,p),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(p){if(p.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:p.fg!==void 0&&(0,h.is256Color)(p.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[p.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,p.y1===p.y2)this._fillBottomLineAtCells(p.x1,p.y1,p.x2-p.x1);else{this._fillBottomLineAtCells(p.x1,p.y1,p.cols-p.x1);for(let a=p.y1+1;a<p.y2;a++)this._fillBottomLineAtCells(0,a,p.cols);this._fillBottomLineAtCells(0,p.y2,p.x2)}this._state=p}_handleHideLinkUnderline(p){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(o,h,l,s){o.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,o.removeEventListener(h,l,s))}}}},274:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=o(855),l=o(160),s=o(374);let c,f=0,p=0,a=!1,e=!1,n=!1,i=0;t.CellColorResolver=class{constructor(r,d,g,_,S,u){this._terminal=r,this._optionService=d,this._selectionRenderModel=g,this._decorationService=_,this._coreBrowserService=S,this._themeService=u,this.result={fg:0,bg:0,ext:0}}resolve(r,d,g,_){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,p=0,f=0,e=!1,a=!1,n=!1,c=this._themeService.colors,i=0,r.getCode()!==h.NULL_CELL_CODE&&r.extended.underlineStyle===4){const S=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=d*_%(2*Math.round(S))}if(this._decorationService.forEachDecorationAtCell(d,g,"bottom",S=>{S.backgroundColorRGB&&(p=S.backgroundColorRGB.rgba>>8&16777215,e=!0),S.foregroundColorRGB&&(f=S.foregroundColorRGB.rgba>>8&16777215,a=!0)}),n=this._selectionRenderModel.isCellSelected(this._terminal,d,g),n){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:p=(16777215&this.result.fg)<<8|255;break;default:p=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:p=(16777215&this.result.bg)<<8|255}p=l.rgba.blend(p,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else p=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(f=c.selectionForeground.rgba>>8&16777215,a=!0),(0,s.treatGlyphAsBackgroundColor)(r.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}a=!0}}this._decorationService.forEachDecorationAtCell(d,g,"top",S=>{S.backgroundColorRGB&&(p=S.backgroundColorRGB.rgba>>8&16777215,e=!0),S.foregroundColorRGB&&(f=S.foregroundColorRGB.rgba>>8&16777215,a=!0)}),e&&(p=n?-16777216&r.bg&-134217729|p|50331648:-16777216&r.bg|p|50331648),a&&(f=-16777216&r.fg&-67108865|f|50331648),67108864&this.result.fg&&(e&&!a&&(f=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648,a=!0),!e&&a&&(p=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648,e=!0)),c=void 0,this.result.bg=e?p:this.result.bg,this.result.fg=a?f:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=o(509),l=o(197),s=[];t.acquireTextureAtlas=function(c,f,p,a,e,n,i,r){const d=(0,l.generateConfig)(a,e,n,i,f,p,r);for(let S=0;S<s.length;S++){const u=s[S],v=u.ownedBy.indexOf(c);if(v>=0){if((0,l.configEquals)(u.config,d))return u.atlas;u.ownedBy.length===1?(u.atlas.dispose(),s.splice(S,1)):u.ownedBy.splice(v,1);break}}for(let S=0;S<s.length;S++){const u=s[S];if((0,l.configEquals)(u.config,d))return u.ownedBy.push(c),u.atlas}const g=c._core,_={atlas:new h.TextureAtlas(document,d,g.unicodeService),config:d,ownedBy:[c]};return s.push(_),_.atlas},t.removeTerminalFromCache=function(c){for(let f=0;f<s.length;f++){const p=s[f].ownedBy.indexOf(c);if(p!==-1){s[f].ownedBy.length===1?(s[f].atlas.dispose(),s.splice(f,1)):s[f].ownedBy.splice(p,1);break}}}},197:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=o(160);t.generateConfig=function(l,s,c,f,p,a,e){const n={foreground:a.foreground,background:a.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:p.customGlyphs,devicePixelRatio:e,letterSpacing:p.letterSpacing,lineHeight:p.lineHeight,deviceCellWidth:l,deviceCellHeight:s,deviceCharWidth:c,deviceCharHeight:f,fontFamily:p.fontFamily,fontSize:p.fontSize,fontWeight:p.fontWeight,fontWeightBold:p.fontWeightBold,allowTransparency:p.allowTransparency,drawBoldTextInBrightColors:p.drawBoldTextInBrightColors,minimumContrastRatio:p.minimumContrastRatio,colors:n}},t.configEquals=function(l,s){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==s.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===s.devicePixelRatio&&l.customGlyphs===s.customGlyphs&&l.lineHeight===s.lineHeight&&l.letterSpacing===s.letterSpacing&&l.fontFamily===s.fontFamily&&l.fontSize===s.fontSize&&l.fontWeight===s.fontWeight&&l.fontWeightBold===s.fontWeightBold&&l.allowTransparency===s.allowTransparency&&l.deviceCharWidth===s.deviceCharWidth&&l.deviceCharHeight===s.deviceCharHeight&&l.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&l.minimumContrastRatio===s.minimumContrastRatio&&l.colors.foreground.rgba===s.colors.foreground.rgba&&l.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=o(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(o,h){this._renderCallback=o,this._coreBrowserService=h,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(o=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,h>0)return void this._restartInterval(h)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(h)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},o)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=o(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(a,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(a,e)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(a,e)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,e)=>`M1,${.5-e} L${.5-a},${.5-e} L${.5-a},1 M1,${.5+e} L${.5+a},${.5+e} L${.5+a},1`},"╕":{1:(a,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(a,e)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,e)=>`M0,${.5+e} L${.5-a},${.5+e} L${.5-a},1 M0,${.5-e} L${.5+a},${.5-e} L${.5+a},1`},"╘":{1:(a,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(a,e)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,e)=>`M1,${.5-e} L${.5+a},${.5-e} L${.5+a},0 M1,${.5+e} L${.5-a},${.5+e} L${.5-a},0`},"╛":{1:(a,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(a,e)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,e)=>`M0,${.5-e} L${.5-a},${.5-e} L${.5-a},0 M0,${.5+e} L${.5+a},${.5+e} L${.5+a},0`},"╞":{1:(a,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(a,e)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,e)=>`M${.5-a},0 L${.5-a},1 M1,${.5+e} L${.5+a},${.5+e} L${.5+a},1 M1,${.5-e} L${.5+a},${.5-e} L${.5+a},0`},"╡":{1:(a,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(a,e)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,e)=>`M${.5+a},0 L${.5+a},1 M0,${.5+e} L${.5-a},${.5+e} L${.5-a},1 M0,${.5-e} L${.5-a},${.5-e} L${.5-a},0`},"╤":{1:(a,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(a,e)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-a},${.5+e} L${.5-a},1 M1,${.5+e} L${.5+a},${.5+e} L${.5+a},1`},"╧":{1:(a,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(a,e)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-a},${.5-e} L${.5-a},0 M1,${.5-e} L${.5+a},${.5-e} L${.5+a},0`},"╪":{1:(a,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(a,e)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,e)=>`M0,${.5+e} L${.5-a},${.5+e} L${.5-a},1 M1,${.5+e} L${.5+a},${.5+e} L${.5+a},1 M0,${.5-e} L${.5-a},${.5-e} L${.5-a},0 M1,${.5-e} L${.5+a},${.5-e} L${.5+a},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(a,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(a,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(a,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(a,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(a,e,n,i,r,d,g,_){const S=t.blockElementDefinitions[e];if(S)return function(x,y,L,A,I,N){for(let $=0;$<y.length;$++){const F=y[$],b=I/8,k=N/8;x.fillRect(L+F.x*b,A+F.y*k,F.w*b,F.h*k)}}(a,S,n,i,r,d),!0;const u=l[e];if(u)return function(x,y,L,A,I,N){let $=s.get(y);$||($=new Map,s.set(y,$));const F=x.fillStyle;if(typeof F!="string")throw new Error(`Unexpected fillStyle type "${F}"`);let b=$.get(F);if(!b){const k=y[0].length,T=y.length,O=x.canvas.ownerDocument.createElement("canvas");O.width=k,O.height=T;const U=(0,h.throwIfFalsy)(O.getContext("2d")),q=new ImageData(k,T);let Y,V,P,R;if(F.startsWith("#"))Y=parseInt(F.slice(1,3),16),V=parseInt(F.slice(3,5),16),P=parseInt(F.slice(5,7),16),R=F.length>7&&parseInt(F.slice(7,9),16)||1;else{if(!F.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${F}" when drawing pattern glyph`);[Y,V,P,R]=F.substring(5,F.length-1).split(",").map(z=>parseFloat(z))}for(let z=0;z<T;z++)for(let W=0;W<k;W++)q.data[4*(z*k+W)]=Y,q.data[4*(z*k+W)+1]=V,q.data[4*(z*k+W)+2]=P,q.data[4*(z*k+W)+3]=y[z][W]*(255*R);U.putImageData(q,0,0),b=(0,h.throwIfFalsy)(x.createPattern(O,null)),$.set(F,b)}x.fillStyle=b,x.fillRect(L,A,I,N)}(a,u,n,i,r,d),!0;const v=t.boxDrawingDefinitions[e];if(v)return function(x,y,L,A,I,N,$){x.strokeStyle=x.fillStyle;for(const[F,b]of Object.entries(y)){let k;x.beginPath(),x.lineWidth=$*Number.parseInt(F),k=typeof b=="function"?b(.15,.15/N*I):b;for(const T of k.split(" ")){const O=T[0],U=f[O];if(!U){console.error(`Could not find drawing instructions for "${O}"`);continue}const q=T.substring(1).split(",");q[0]&&q[1]&&U(x,p(q,I,N,L,A,!0,$))}x.stroke(),x.closePath()}}(a,v,n,i,r,d,_),!0;const C=t.powerlineDefinitions[e];return!!C&&(function(x,y,L,A,I,N,$,F){const b=new Path2D;b.rect(L,A,I,N),x.clip(b),x.beginPath();const k=$/12;x.lineWidth=F*k;for(const T of y.d.split(" ")){const O=T[0],U=f[O];if(!U){console.error(`Could not find drawing instructions for "${O}"`);continue}const q=T.substring(1).split(",");q[0]&&q[1]&&U(x,p(q,I,N,L,A,!1,F,(y.leftPadding??0)*(k/2),(y.rightPadding??0)*(k/2)))}y.type===1?(x.strokeStyle=x.fillStyle,x.stroke()):x.fill(),x.closePath()}(a,C,n,i,r,d,g,_),!0)};const s=new Map;function c(a,e,n=0){return Math.max(Math.min(a,e),n)}const f={C:(a,e)=>a.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(a,e)=>a.lineTo(e[0],e[1]),M:(a,e)=>a.moveTo(e[0],e[1])};function p(a,e,n,i,r,d,g,_=0,S=0){const u=a.map(v=>parseFloat(v)||parseInt(v));if(u.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<u.length;v+=2)u[v]*=e-_*g-S*g,d&&u[v]!==0&&(u[v]=c(Math.round(u[v]+.5)-.5,e,0)),u[v]+=i+_*g;for(let v=1;v<u.length;v+=2)u[v]*=n,d&&u[v]!==0&&(u[v]=c(Math.round(u[v]+.5)-.5,n,0)),u[v]+=r;return u}},56:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=o(859);t.observeDevicePixelDimensions=function(l,s,c){let f=new s.ResizeObserver(p=>{const a=p.find(i=>i.target===l);if(!a)return;if(!("devicePixelContentBoxSize"in a))return f==null||f.disconnect(),void(f=void 0);const e=a.devicePixelContentBoxSize[0].inlineSize,n=a.devicePixelContentBoxSize[0].blockSize;e>0&&n>0&&c(e,n)});try{f.observe(l,{box:["device-pixel-content-box"]})}catch{f.disconnect(),f=void 0}return(0,h.toDisposable)(()=>f==null?void 0:f.disconnect())}},374:(M,t)=>{function o(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=o,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,f){return s===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!o(l)&&!function(p){return 57344<=p&&p<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return o(l)||function(s){return 9472<=s&&s<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},296:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.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(l,s,c,f=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const p=l.buffers.active.ydisp,a=s[1]-p,e=c[1]-p,n=Math.max(a,0),i=Math.min(e,l.rows-1);n>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=a,this.viewportEndRow=e,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new o}},509:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=o(237),l=o(860),s=o(374),c=o(160),f=o(345),p=o(485),a=o(385),e=o(147),n=o(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let r;class d{get pages(){return this._pages}constructor(v,C,x){this._document=v,this._config=C,this._unicodeService=x,this._didWarmUp=!1,this._cacheMap=new p.FourKeyMap,this._cacheMapCombined=new p.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new f.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new f.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=S(v,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,s.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const v of this.pages)v.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const v=new a.IdleTaskQueue;for(let C=33;C<126;C++)v.enqueue(()=>{if(!this._cacheMap.get(C,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT)){const x=this._drawToCache(C,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT);this._cacheMap.set(C,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT,x)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const v of this._pages)v.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(d.maxAtlasPages&&this._pages.length>=Math.max(4,d.maxAtlasPages)){const C=this._pages.filter($=>2*$.canvas.width<=(d.maxTextureSize||4096)).sort(($,F)=>F.canvas.width!==$.canvas.width?F.canvas.width-$.canvas.width:F.percentageUsed-$.percentageUsed);let x=-1,y=0;for(let $=0;$<C.length;$++)if(C[$].canvas.width!==y)x=$,y=C[$].canvas.width;else if($-x==3)break;const L=C.slice(x,x+4),A=L.map($=>$.glyphs[0].texturePage).sort(($,F)=>$>F?1:-1),I=this.pages.length-L.length,N=this._mergePages(L,I);N.version++;for(let $=A.length-1;$>=0;$--)this._deletePage(A[$]);this.pages.push(N),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(N.canvas)}const v=new g(this._document,this._textureSize);return this._pages.push(v),this._activePages.push(v),this._onAddTextureAtlasCanvas.fire(v.canvas),v}_mergePages(v,C){const x=2*v[0].canvas.width,y=new g(this._document,x,v);for(const[L,A]of v.entries()){const I=L*A.canvas.width%x,N=Math.floor(L/2)*A.canvas.height;y.ctx.drawImage(A.canvas,I,N);for(const F of A.glyphs)F.texturePage=C,F.sizeClipSpace.x=F.size.x/x,F.sizeClipSpace.y=F.size.y/x,F.texturePosition.x+=I,F.texturePosition.y+=N,F.texturePositionClipSpace.x=F.texturePosition.x/x,F.texturePositionClipSpace.y=F.texturePosition.y/x;this._onRemoveTextureAtlasCanvas.fire(A.canvas);const $=this._activePages.indexOf(A);$!==-1&&this._activePages.splice($,1)}return y}_deletePage(v){this._pages.splice(v,1);for(let C=v;C<this._pages.length;C++){const x=this._pages[C];for(const y of x.glyphs)y.texturePage--;x.version++}}getRasterizedGlyphCombinedChar(v,C,x,y,L){return this._getFromCacheMap(this._cacheMapCombined,v,C,x,y,L)}getRasterizedGlyph(v,C,x,y,L){return this._getFromCacheMap(this._cacheMap,v,C,x,y,L)}_getFromCacheMap(v,C,x,y,L,A=!1){return r=v.get(C,x,y,L),r||(r=this._drawToCache(C,x,y,L,A),v.set(C,x,y,L,r)),r}_getColorFromAnsiIndex(v){if(v>=this._config.colors.ansi.length)throw new Error("No color found for idx "+v);return this._config.colors.ansi[v]}_getBackgroundColor(v,C,x,y){if(this._config.allowTransparency)return c.NULL_COLOR;let L;switch(v){case 16777216:case 33554432:L=this._getColorFromAnsiIndex(C);break;case 50331648:const A=e.AttributeData.toColorRGB(C);L=c.channels.toColor(A[0],A[1],A[2]);break;default:L=x?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return L}_getForegroundColor(v,C,x,y,L,A,I,N,$,F){const b=this._getMinimumContrastColor(v,C,x,y,L,A,I,$,N,F);if(b)return b;let k;switch(L){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&$&&A<8&&(A+=8),k=this._getColorFromAnsiIndex(A);break;case 50331648:const T=e.AttributeData.toColorRGB(A);k=c.channels.toColor(T[0],T[1],T[2]);break;default:k=I?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(k=c.color.opaque(k)),N&&(k=c.color.multiplyOpacity(k,h.DIM_OPACITY)),k}_resolveBackgroundRgba(v,C,x){switch(v){case 16777216:case 33554432:return this._getColorFromAnsiIndex(C).rgba;case 50331648:return C<<8;default:return x?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(v,C,x,y){switch(v){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&y&&C<8&&(C+=8),this._getColorFromAnsiIndex(C).rgba;case 50331648:return C<<8;default:return x?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(v,C,x,y,L,A,I,N,$,F){if(this._config.minimumContrastRatio===1||F)return;const b=this._getContrastCache($),k=b.getColor(v,y);if(k!==void 0)return k||void 0;const T=this._resolveBackgroundRgba(C,x,I),O=this._resolveForegroundRgba(L,A,I,N),U=c.rgba.ensureContrastRatio(T,O,this._config.minimumContrastRatio/($?2:1));if(!U)return void b.setColor(v,y,null);const q=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return b.setColor(v,y,q),q}_getContrastCache(v){return v?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(v,C,x,y,L=!1){const A=typeof v=="number"?String.fromCharCode(v):v,I=Math.min(this._config.deviceCellWidth*Math.max(A.length,2)+4,this._textureSize);this._tmpCanvas.width<I&&(this._tmpCanvas.width=I);const N=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<N&&(this._tmpCanvas.height=N),this._tmpCtx.save(),this._workAttributeData.fg=x,this._workAttributeData.bg=C,this._workAttributeData.extended.ext=y,this._workAttributeData.isInvisible())return i;const $=!!this._workAttributeData.isBold(),F=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),k=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),O=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),V=this._workAttributeData.getBgColor(),P=this._workAttributeData.getBgColorMode();if(F){const X=q;q=V,V=X;const se=Y;Y=P,P=se}const R=this._getBackgroundColor(P,V,F,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=R.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const z=$?this._config.fontWeightBold:this._config.fontWeight,W=k?"italic":"";this._tmpCtx.font=`${W} ${z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const G=A.length===1&&(0,s.isPowerlineGlyph)(A.charCodeAt(0)),K=A.length===1&&(0,s.isRestrictedPowerlineGlyph)(A.charCodeAt(0)),Q=this._getForegroundColor(C,P,V,x,Y,q,F,b,$,(0,s.treatGlyphAsBackgroundColor)(A.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;const J=K?0:4;let oe=!1;this._config.customGlyphs!==!1&&(oe=(0,l.tryDrawCustomChar)(this._tmpCtx,A,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let _e,Z=!G;if(_e=typeof v=="number"?this._unicodeService.wcwidth(v):this._unicodeService.getStringCellWidth(v),T){this._tmpCtx.save();const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=X%2==1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Z=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Z=!1;let fe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&fe<8&&(fe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(fe).css}this._tmpCtx.beginPath();const ue=J,ce=Math.ceil(J+this._config.deviceCharHeight)-se-(L?2*X:0),Ee=ce+X,me=ce+2*X;let be=this._workAttributeData.getUnderlineVariantOffset();for(let fe=0;fe<_e;fe++){this._tmpCtx.save();const he=ue+fe*this._config.deviceCellWidth,ee=ue+(fe+1)*this._config.deviceCellWidth,Ne=he+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(ee,ce),this._tmpCtx.moveTo(he,me),this._tmpCtx.lineTo(ee,me);break;case 3:const Qe=X<=1?me:Math.ceil(J+this._config.deviceCharHeight-X/2)-se,et=X<=1?ce:Math.ceil(J+this._config.deviceCharHeight+X/2)-se,Nt=new Path2D;Nt.rect(he,ce,this._config.deviceCellWidth,me-ce),this._tmpCtx.clip(Nt),this._tmpCtx.moveTo(he-this._config.deviceCellWidth/2,Ee),this._tmpCtx.bezierCurveTo(he-this._config.deviceCellWidth/2,et,he,et,he,Ee),this._tmpCtx.bezierCurveTo(he,Qe,Ne,Qe,Ne,Ee),this._tmpCtx.bezierCurveTo(Ne,et,ee,et,ee,Ee),this._tmpCtx.bezierCurveTo(ee,Qe,ee+this._config.deviceCellWidth/2,Qe,ee+this._config.deviceCellWidth/2,Ee);break;case 4:const tt=be===0?0:be>=X?2*X-be:X-be;be>=X||tt===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he+tt,ce),this._tmpCtx.lineTo(ee,ce)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(he+tt,ce),this._tmpCtx.moveTo(he+tt+X,ce),this._tmpCtx.lineTo(ee,ce)),be=(0,s.computeNextVariantOffset)(ee-he,X,be);break;case 5:const $i=.6,Ni=.3,_t=ee-he,Wt=Math.floor($i*_t),Ut=Math.floor(Ni*_t),Wi=_t-Wt-Ut;this._tmpCtx.setLineDash([Wt,Ut,Wi]),this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(ee,ce);break;default:this._tmpCtx.moveTo(he,ce),this._tmpCtx.lineTo(ee,ce)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!oe&&this._config.fontSize>=12&&!this._config.allowTransparency&&A!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const fe=this._tmpCtx.measureText(A);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in fe&&fe.actualBoundingBoxDescent>0){this._tmpCtx.save();const he=new Path2D;he.rect(ue,ce-Math.ceil(X/2),this._config.deviceCellWidth*_e,me-ce+Math.ceil(X/2)),this._tmpCtx.clip(he),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=R.css,this._tmpCtx.strokeText(A,J,J+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=X%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*_e,J+se),this._tmpCtx.stroke()}if(oe||this._tmpCtx.fillText(A,J,J+this._config.deviceCharHeight),A==="_"&&!this._config.allowTransparency){let X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),R,Q,Z);if(X)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=R.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(A,J,J+this._config.deviceCharHeight-se),X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),R,Q,Z),X);se++);}if(O){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),se=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*_e,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();const we=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Pe;if(Pe=this._config.allowTransparency?function(X){for(let se=0;se<X.data.length;se+=4)if(X.data[se+3]>0)return!1;return!0}(we):_(we,R,Q,Z),Pe)return i;const ne=this._findGlyphBoundingBox(we,this._workBoundingBox,I,K,oe,J);let te,ie;for(;;){if(this._activePages.length===0){const X=this._createNewPage();te=X,ie=X.currentRow,ie.height=ne.size.y;break}te=this._activePages[this._activePages.length-1],ie=te.currentRow;for(const X of this._activePages)ne.size.y<=X.currentRow.height&&(te=X,ie=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const se of this._activePages[X].fixedRows)se.height<=ie.height&&ne.size.y<=se.height&&(te=this._activePages[X],ie=se);if(ie.y+ne.size.y>=te.canvas.height||ie.height>ne.size.y+2){let X=!1;if(te.currentRow.y+te.currentRow.height+ne.size.y>=te.canvas.height){let se;for(const ue of this._activePages)if(ue.currentRow.y+ue.currentRow.height+ne.size.y<ue.canvas.height){se=ue;break}if(se)te=se;else if(d.maxAtlasPages&&this._pages.length>=d.maxAtlasPages&&ie.y+ne.size.y<=te.canvas.height&&ie.height>=ne.size.y&&ie.x+ne.size.x<=te.canvas.width)X=!0;else{const ue=this._createNewPage();te=ue,ie=ue.currentRow,ie.height=ne.size.y,X=!0}}X||(te.currentRow.height>0&&te.fixedRows.push(te.currentRow),ie={x:0,y:te.currentRow.y+te.currentRow.height,height:ne.size.y},te.fixedRows.push(ie),te.currentRow={x:0,y:ie.y+ie.height,height:0})}if(ie.x+ne.size.x<=te.canvas.width)break;ie===te.currentRow?(ie.x=0,ie.y+=ie.height,ie.height=0):te.fixedRows.splice(te.fixedRows.indexOf(ie),1)}return ne.texturePage=this._pages.indexOf(te),ne.texturePosition.x=ie.x,ne.texturePosition.y=ie.y,ne.texturePositionClipSpace.x=ie.x/te.canvas.width,ne.texturePositionClipSpace.y=ie.y/te.canvas.height,ne.sizeClipSpace.x/=te.canvas.width,ne.sizeClipSpace.y/=te.canvas.height,ie.height=Math.max(ie.height,ne.size.y),ie.x+=ne.size.x,te.ctx.putImageData(we,ne.texturePosition.x-this._workBoundingBox.left,ne.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ne.size.x,ne.size.y),te.addGlyph(ne),te.version++,ne}_findGlyphBoundingBox(v,C,x,y,L,A){C.top=0;const I=y?this._config.deviceCellHeight:this._tmpCanvas.height,N=y?this._config.deviceCellWidth:x;let $=!1;for(let F=0;F<I;F++){for(let b=0;b<N;b++){const k=F*this._tmpCanvas.width*4+4*b+3;if(v.data[k]!==0){C.top=F,$=!0;break}}if($)break}C.left=0,$=!1;for(let F=0;F<A+N;F++){for(let b=0;b<I;b++){const k=b*this._tmpCanvas.width*4+4*F+3;if(v.data[k]!==0){C.left=F,$=!0;break}}if($)break}C.right=N,$=!1;for(let F=A+N-1;F>=A;F--){for(let b=0;b<I;b++){const k=b*this._tmpCanvas.width*4+4*F+3;if(v.data[k]!==0){C.right=F,$=!0;break}}if($)break}C.bottom=I,$=!1;for(let F=I-1;F>=0;F--){for(let b=0;b<N;b++){const k=F*this._tmpCanvas.width*4+4*b+3;if(v.data[k]!==0){C.bottom=F,$=!0;break}}if($)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:C.right-C.left+1,y:C.bottom-C.top+1},sizeClipSpace:{x:C.right-C.left+1,y:C.bottom-C.top+1},offset:{x:-C.left+A+(y||L?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-C.top+A+(y||L?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=d;class g{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(v){this._glyphs.push(v),this._usedPixels+=v.size.x*v.size.y}constructor(v,C,x){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],x)for(const y of x)this._glyphs.push(...y.glyphs),this._usedPixels+=y._usedPixels;this.canvas=S(v,C,C),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function _(u,v,C,x){const y=v.rgba>>>24,L=v.rgba>>>16&255,A=v.rgba>>>8&255,I=C.rgba>>>24,N=C.rgba>>>16&255,$=C.rgba>>>8&255,F=Math.floor((Math.abs(y-I)+Math.abs(L-N)+Math.abs(A-$))/12);let b=!0;for(let k=0;k<u.data.length;k+=4)u.data[k]===y&&u.data[k+1]===L&&u.data[k+2]===A||x&&Math.abs(u.data[k]-y)+Math.abs(u.data[k+1]-L)+Math.abs(u.data[k+2]-A)<F?u.data[k+3]=0:b=!1;return b}function S(u,v,C){const x=u.createElement("canvas");return x.width=v,x.height=C,x}},160:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let o=0,h=0,l=0,s=0;var c,f,p,a,e;function n(r){const d=r.toString(16);return d.length<2?"0"+d:d}function i(r,d){return r<d?(d+.05)/(r+.05):(r+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(d,g,_,S){return S!==void 0?`#${n(d)}${n(g)}${n(_)}${n(S)}`:`#${n(d)}${n(g)}${n(_)}`},r.toRgba=function(d,g,_,S=255){return(d<<24|g<<16|_<<8|S)>>>0},r.toColor=function(d,g,_,S){return{css:r.toCss(d,g,_,S),rgba:r.toRgba(d,g,_,S)}}}(c||(t.channels=c={})),function(r){function d(g,_){return s=Math.round(255*_),[o,h,l]=e.toChannels(g.rgba),{css:c.toCss(o,h,l,s),rgba:c.toRgba(o,h,l,s)}}r.blend=function(g,_){if(s=(255&_.rgba)/255,s===1)return{css:_.css,rgba:_.rgba};const S=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,C=g.rgba>>24&255,x=g.rgba>>16&255,y=g.rgba>>8&255;return o=C+Math.round((S-C)*s),h=x+Math.round((u-x)*s),l=y+Math.round((v-y)*s),{css:c.toCss(o,h,l),rgba:c.toRgba(o,h,l)}},r.isOpaque=function(g){return(255&g.rgba)==255},r.ensureContrastRatio=function(g,_,S){const u=e.ensureContrastRatio(g.rgba,_.rgba,S);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},r.opaque=function(g){const _=(255|g.rgba)>>>0;return[o,h,l]=e.toChannels(_),{css:c.toCss(o,h,l),rgba:_}},r.opacity=d,r.multiplyOpacity=function(g,_){return s=255&g.rgba,d(g,s*_/255)},r.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(f||(t.color=f={})),function(r){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const S=_.getContext("2d",{willReadFrequently:!0});S&&(d=S,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return o=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(o,h,l);case 5:return o=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),s=parseInt(_.slice(4,5).repeat(2),16),c.toColor(o,h,l,s);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const S=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return o=parseInt(S[1]),h=parseInt(S[2]),l=parseInt(S[3]),s=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),c.toColor(o,h,l,s);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,h,l,s]=d.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(o,h,l,s),css:_}}}(p||(t.css=p={})),function(r){function d(g,_,S){const u=g/255,v=_/255,C=S/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.0722*(C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4))}r.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},r.relativeLuminance2=d}(a||(t.rgb=a={})),function(r){function d(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let y=S>>24&255,L=S>>16&255,A=S>>8&255,I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));for(;I<u&&(y>0||L>0||A>0);)y-=Math.max(0,Math.ceil(.1*y)),L-=Math.max(0,Math.ceil(.1*L)),A-=Math.max(0,Math.ceil(.1*A)),I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));return(y<<24|L<<16|A<<8|255)>>>0}function g(_,S,u){const v=_>>24&255,C=_>>16&255,x=_>>8&255;let y=S>>24&255,L=S>>16&255,A=S>>8&255,I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));for(;I<u&&(y<255||L<255||A<255);)y=Math.min(255,y+Math.ceil(.1*(255-y))),L=Math.min(255,L+Math.ceil(.1*(255-L))),A=Math.min(255,A+Math.ceil(.1*(255-A))),I=i(a.relativeLuminance2(y,L,A),a.relativeLuminance2(v,C,x));return(y<<24|L<<16|A<<8|255)>>>0}r.blend=function(_,S){if(s=(255&S)/255,s===1)return S;const u=S>>24&255,v=S>>16&255,C=S>>8&255,x=_>>24&255,y=_>>16&255,L=_>>8&255;return o=x+Math.round((u-x)*s),h=y+Math.round((v-y)*s),l=L+Math.round((C-L)*s),c.toRgba(o,h,l)},r.ensureContrastRatio=function(_,S,u){const v=a.relativeLuminance(_>>8),C=a.relativeLuminance(S>>8);if(i(v,C)<u){if(C<v){const L=d(_,S,u),A=i(v,a.relativeLuminance(L>>8));if(A<u){const I=g(_,S,u);return A>i(v,a.relativeLuminance(I>>8))?L:I}return L}const x=g(_,S,u),y=i(v,a.relativeLuminance(x>>8));if(y<u){const L=d(_,S,u);return y>i(v,a.relativeLuminance(L>>8))?x:L}return x}},r.reduceLuminance=d,r.increaseLuminance=g,r.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=n,t.contrastRatio=i},345:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.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 h=0;h<this._listeners.length;h++)if(this._listeners[h]===o)return void this._listeners.splice(h,1)}}})),this._event}fire(o,h){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,o,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(o,h){return o(l=>h.fire(l))},t.runAndSubscribe=function(o,h){return h(void 0),o(l=>h(l))}},859:(M,t)=>{function o(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=o,t.getDisposeArrayDisposable=function(h){return{dispose:()=>o(h)}}},485:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(l,s,c){this._data[l]||(this._data[l]={}),this._data[l][s]=c}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=o,t.FourKeyMap=class{constructor(){this._data=new o}set(h,l,s,c,f){this._data.get(h,l)||this._data.set(h,l,new o),this._data.get(h,l).set(s,c,f)}get(h,l,s,c){var f;return(f=this._data.get(h,l))==null?void 0:f.get(s,c)}clear(){this._data.clear()}}},399:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const o=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=o.includes("Firefox"),t.isLegacyEdge=o.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(o),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=o.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(o)},385:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=o(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),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(f){this._idleCallback=void 0;let p=0,a=0,e=f.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),a=Math.max(p,a),n=f.timeRemaining(),1.5*a>n)return e-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-p))}ms`),void this._start();e=n}this.clear()}}class s extends l{_requestCallback(f){return setTimeout(()=>f(this._createDeadline(16)))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const p=Date.now()+f;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},147:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new o;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}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}}t.AttributeData=o;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,c=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=o(133),l=o(855),s=o(147);class c extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(p){const a=new c;return a.setFromCharData(p),a}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let a=!1;if(p[l.CHAR_DATA_CHAR_INDEX].length>2)a=!0;else if(p[l.CHAR_DATA_CHAR_INDEX].length===2){const e=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|p[l.CHAR_DATA_WIDTH_INDEX]<<22:a=!0}else a=!0}else this.content=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[l.CHAR_DATA_WIDTH_INDEX]<<22;a&&(this.combinedData=p[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},855:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},t.utf32ToString=function(o,h=0,l=o.length){let s="";for(let c=h;c<l;++c){let f=o[c];f>65535?(f-=65536,s+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):s+=String.fromCharCode(f)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,h){const l=o.length;if(!l)return 0;let s=0,c=0;if(this._interim){const f=o.charCodeAt(c++);56320<=f&&f<=57343?h[s++]=1024*(this._interim-55296)+f-56320+65536:(h[s++]=this._interim,h[s++]=f),this._interim=0}for(let f=c;f<l;++f){const p=o.charCodeAt(f);if(55296<=p&&p<=56319){if(++f>=l)return this._interim=p,s;const a=o.charCodeAt(f);56320<=a&&a<=57343?h[s++]=1024*(p-55296)+a-56320+65536:(h[s++]=p,h[s++]=a)}else p!==65279&&(h[s++]=p)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,h){const l=o.length;if(!l)return 0;let s,c,f,p,a=0,e=0,n=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,S=0;for(;(_=63&this.interim[++S])&&S<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-S;for(;n<v;){if(n>=l)return 0;if(_=o[n++],(192&_)!=128){n--,d=!0;break}this.interim[S++]=_,g<<=6,g|=63&_}d||(u===2?g<128?n--:h[a++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[a++]=g):g<65536||g>1114111||(h[a++]=g)),this.interim.fill(0)}const i=l-4;let r=n;for(;r<l;){for(;!(!(r<i)||128&(s=o[r])||128&(c=o[r+1])||128&(f=o[r+2])||128&(p=o[r+3]));)h[a++]=s,h[a++]=c,h[a++]=f,h[a++]=p,r+=4;if(s=o[r++],s<128)h[a++]=s;else if((224&s)==192){if(r>=l)return this.interim[0]=s,a;if(c=o[r++],(192&c)!=128){r--;continue}if(e=(31&s)<<6|63&c,e<128){r--;continue}h[a++]=e}else if((240&s)==224){if(r>=l)return this.interim[0]=s,a;if(c=o[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=c,a;if(f=o[r++],(192&f)!=128){r--;continue}if(e=(15&s)<<12|(63&c)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[a++]=e}else if((248&s)==240){if(r>=l)return this.interim[0]=s,a;if(c=o[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=c,a;if(f=o[r++],(192&f)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=c,this.interim[2]=f,a;if(p=o[r++],(192&p)!=128){r--;continue}if(e=(7&s)<<18|(63&c)<<12|(63&f)<<6|63&p,e<65536||e>1114111)continue;h[a++]=e}}return a}}},776:function(M,t,o){var h=this&&this.__decorate||function(e,n,i,r){var d,g=arguments.length,_=g<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,n,i,r);else for(var S=e.length-1;S>=0;S--)(d=e[S])&&(_=(g<3?d(_):g>3?d(n,i,_):d(n,i))||_);return g>3&&_&&Object.defineProperty(n,i,_),_},l=this&&this.__param||function(e,n){return function(i,r){n(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=o(859),c=o(97),f={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let p,a=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),p=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(e,...n){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,n)}};t.LogService=a=h([l(0,c.IOptionsService)],a),t.setTraceLogger=function(e){p=e},t.traceCall=function(e,n,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(...d){if(p.logLevel!==c.LogLevelEnum.TRACE)return r.apply(this,d);p.trace(`GlyphRenderer#${r.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=r.apply(this,d);return p.trace(`GlyphRenderer#${r.name} return`,g),g}}},726:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const o="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const s=function(c,f,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(a,e,n){e[o]===e?e[h].push({id:a,index:n}):(e[h]=[{id:a,index:n}],e[o]=e)})(s,c,p)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},97:(M,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=o(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},D={};function B(M){var t=D[M];if(t!==void 0)return t.exports;var o=D[M]={exports:{}};return E[M].call(o.exports,o,o.exports,B),o.exports}var H={};return(()=>{var M=H;Object.defineProperty(M,"__esModule",{value:!0}),M.WebglAddon=void 0;const t=B(345),o=B(859),h=B(399),l=B(666),s=B(776);class c extends o.Disposable{constructor(p){if(h.isSafari&&(0,h.getSafariVersion)()<16){const a={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",a))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=p,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(p){const a=p._core;if(!p.element)return void this.register(a.onWillOpen(()=>this.activate(p)));this._terminal=p;const e=a.coreService,n=a.optionsService,i=a,r=i._renderService,d=i._characterJoinerService,g=i._charSizeService,_=i._coreBrowserService,S=i._decorationService,u=i._logService,v=i._themeService;(0,s.setTraceLogger)(u),this._renderer=this.register(new l.WebglRenderer(p,d,g,_,e,S,n,v,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this.register((0,o.toDisposable)(()=>{const C=this._terminal._core._renderService;C.setRenderer(this._terminal._core._createRenderer()),C.handleResize(p.cols,p.rows)}))}get textureAtlas(){var p;return(p=this._renderer)==null?void 0:p.textureAtlas}clearTextureAtlas(){var p;(p=this._renderer)==null||p.clearTextureAtlas()}}M.WebglAddon=c})(),H})())})(ni);var ns=ni.exports;const os={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},as=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],ft=[0,95,135,175,215,255];function jt(m,w){if(m<0)return w;if(m<16)return as[m]??w;if(m<232){const E=m-16,D=ft[Math.floor(E/36)%6],B=ft[Math.floor(E/6)%6],H=ft[E%6];return`rgb(${D},${B},${H})`}if(m<256){const E=8+(m-232)*10;return`rgb(${E},${E},${E})`}return`#${(m&16777215).toString(16).padStart(6,"0")}`}const qt="\x1Bc",hs=/Mac|iPhone|iPad/.test(navigator.platform);class ls{constructor(w){de(this,"term");de(this,"fit",new rs.FitAddon);de(this,"onInput",null);de(this,"shouldSendKey",null);de(this,"onSelect",null);this.term=new ss.Terminal({theme:os,fontFamily:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!0,macOptionClickForcesSelection:!0,scrollback:5e3}),this.term.loadAddon(this.fit),this.term.open(w);try{this.term.loadAddon(new ns.WebglAddon)}catch{}this.term.onData(E=>{var D;return(D=this.onInput)==null?void 0:D.call(this,E)}),this.term.attachCustomKeyEventHandler(E=>{var D,B;return((D=this.shouldSendKey)==null?void 0:D.call(this,E))===!1||E.type==="keydown"&&Zi(E,hs)?!1:E.type==="keydown"&&Ji(E)?(E.preventDefault(),(B=this.onInput)==null||B.call(this,Yi),!1):!0}),this.bindTouchScroll(w),this.bindCopyOnSelect(w),this.fitNow()}bindTouchScroll(w){let E=0,D=0;w.addEventListener("touchstart",B=>{B.touches.length===1&&(E=B.touches[0].clientY,D=0)},{capture:!0,passive:!0}),w.addEventListener("touchmove",B=>{if(B.touches.length!==1||!this.wantsWheel())return;B.preventDefault(),B.stopPropagation();const H=B.touches[0];D+=(E-H.clientY)/this.rowHeight(),E=H.clientY;const M=Math.trunc(D);if(M===0)return;D-=M;const t=w.querySelector(".xterm-screen");if(!t)return;const o={deltaY:Math.sign(M),deltaMode:WheelEvent.DOM_DELTA_LINE,clientX:H.clientX,clientY:H.clientY,bubbles:!0,cancelable:!0};for(let h=0;h<Math.abs(M);h++)t.dispatchEvent(new WheelEvent("wheel",o))},{capture:!0,passive:!1})}bindCopyOnSelect(w){w.addEventListener("mouseup",()=>{queueMicrotask(()=>{var D;const E=this.term.getSelection();E&&((D=this.onSelect)==null||D.call(this,E))})})}wantsWheel(){return this.term.modes.mouseTrackingMode!=="none"||this.term.buffer.active.type==="alternate"}rowHeight(){var D;const w=(D=this.term.element)==null?void 0:D.querySelector(".xterm-screen"),E=w&&this.term.rows>0?w.clientHeight/this.term.rows:0;return E>0?E:16}replay(w){this.term.write(qt+w)}write(w){this.term.write(w)}paste(w){this.term.paste(w)}clear(){this.term.write(qt)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}}function cs(m){const w=[];let E=0,D=0,B=!1;for(const H of m.split(`
|
|
67
|
+
`)){const M=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(H);if(M){E=Number(M[1]),D=Number(M[2]),B=!0,w.push({kind:"hunk",text:H});continue}B&&(H.startsWith("+")?w.push({kind:"add",old:null,new:D++,text:H.slice(1)}):H.startsWith("-")?w.push({kind:"del",old:E++,new:null,text:H.slice(1)}):H.startsWith(" ")&&w.push({kind:"ctx",old:E++,new:D++,text:H.slice(1)}))}return w}const oi=240;function ds(m,w){return Math.round(Math.max(oi,Math.min(m,w*.75)))}const us=2e3,ai="tring.diffPanel",Kt=420;function Se(m,w){const E=document.createElement("div");return E.className=m,w!==void 0&&(E.textContent=w),E}function Le(m,w){const E=document.createElement("span");return E.className=m,E.textContent=w,E}function _s(){try{const m=JSON.parse(localStorage.getItem(ai)??"{}");return{width:typeof m.width=="number"?m.width:Kt,open:m.open===!0}}catch{return{width:Kt,open:!1}}}class fs{constructor(w,E){de(this,"el",Se("diff-panel"));de(this,"handle",Se("diff-handle"));de(this,"title",Le("diff-title",""));de(this,"plus",Le("diff-plus",""));de(this,"minus",Le("diff-minus",""));de(this,"scroll",Se("diff-scroll"));de(this,"sessionId",null);de(this,"timer",null);de(this,"inflight",!1);de(this,"last","");de(this,"width");de(this,"opened");this.cell=w,this.onLayout=E;const D=Se("diff-head"),B=document.createElement("button");B.type="button",B.className="diff-close",B.textContent="✕",B.title="Close diff viewer",B.onclick=()=>this.close(),D.append(this.title,this.plus,this.minus,B),this.el.append(D,this.scroll),w.append(this.handle,this.el);const H=_s();this.width=Math.max(oi,H.width),this.opened=H.open,this.bindResize(),this.paint(),this.opened&&this.startPolling()}get isOpen(){return this.opened}open(){this.opened||(this.opened=!0,this.paint(),this.save(),this.onLayout(),this.startPolling())}close(){this.opened&&(this.opened=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.paint(),this.save(),this.onLayout())}toggle(){this.opened?this.close():this.open()}setSession(w){w!==this.sessionId&&(this.sessionId=w,this.last="",this.note(w?"loading…":"no session"),this.opened&&this.tick())}paint(){this.el.hidden=!this.opened,this.handle.hidden=!this.opened,this.el.style.width=`${this.width}px`}save(){try{localStorage.setItem(ai,JSON.stringify({width:this.width,open:this.opened}))}catch{}}startPolling(){this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>void this.tick(),us),this.tick()}async tick(){const w=this.sessionId;if(!(!w||this.inflight||!this.opened)){this.inflight=!0;try{const E=await At(`/api/sessions/${encodeURIComponent(w)}/diff`);if(w!==this.sessionId||!this.opened)return;const D=JSON.stringify(E);if(D===this.last)return;this.last=D,this.render(E)}catch(E){if(w!==this.sessionId)return;this.last="",this.note(E.message)}finally{this.inflight=!1}}}note(w){this.title.textContent="",this.plus.textContent="",this.minus.textContent="",this.scroll.replaceChildren(Se("diff-note",w))}render(w){if("error"in w)return this.note(w.error);const{files:E}=w;let D=0,B=0;for(const o of E)D+=o.added,B+=o.removed;if(this.title.textContent=`${E.length} file${E.length===1?"":"s"} changed`,this.plus.textContent=`+${D}`,this.minus.textContent=`-${B}`,E.length===0){this.scroll.replaceChildren(Se("diff-note","no uncommitted changes"));return}const H=Se("diff-files"),M=Se("diff-body");for(const o of E){const h=this.fileSection(o),l=document.createElement("button");l.type="button",l.className="diff-file-row",l.append(Le("path",o.path),Le("diff-plus",`+${o.added}`),Le("diff-minus",`-${o.removed}`)),l.onclick=()=>h.scrollIntoView({block:"start"}),H.append(l),M.append(h)}w.truncated&&H.append(Se("diff-note","some diffs are over the 1 MB limit and not shown"));const t=this.scroll.scrollTop;this.scroll.replaceChildren(H,M),this.scroll.scrollTop=t}fileSection(w){const E=Se("diff-file");if(E.append(Se("diff-file-head",w.path)),w.note)return E.append(Se("diff-note",w.note)),E;for(const D of cs(w.patch)){if(D.kind==="hunk"){E.append(Se("dl dl-hunk",D.text));continue}const B=Se(`dl dl-${D.kind}`);B.append(Le("ln",D.old===null?"":String(D.old)),Le("ln",D.new===null?"":String(D.new)),Le("tx",D.text)),E.append(B)}return E}bindResize(){let w=0;this.handle.addEventListener("pointerdown",D=>{D.preventDefault(),w=this.el.getBoundingClientRect().right,this.handle.setPointerCapture(D.pointerId),this.handle.classList.add("dragging")}),this.handle.addEventListener("pointermove",D=>{this.handle.hasPointerCapture(D.pointerId)&&(this.width=ds(w-D.clientX,this.cell.clientWidth),this.el.style.width=`${this.width}px`)});const E=D=>{this.handle.hasPointerCapture(D.pointerId)&&(this.handle.releasePointerCapture(D.pointerId),this.handle.classList.remove("dragging"),this.save(),this.onLayout())};this.handle.addEventListener("pointerup",E),this.handle.addEventListener("pointercancel",E)}}function ps(m,w){if(!m)return null;const E=w.find(B=>B.id===m.id);if(E)return E.slot===m.slot?m:{id:E.id,slot:E.slot};const D=w.find(B=>B.slot===m.slot);return D?{id:D.id,slot:D.slot}:null}const hi=/^image\/(png|jpeg|gif|webp)$/;function vs(m){return/\s/.test(m)?`"${m}"`:m}function gs(m){for(const w of["dragover","drop"])m.addEventListener(w,E=>E.preventDefault())}function ms(m,w){let E=0;const D=H=>{m.classList.toggle("dropping",H)},B=H=>{var M;return Array.from(((M=H.dataTransfer)==null?void 0:M.types)??[]).includes("Files")};m.addEventListener("dragenter",H=>{B(H)&&(H.preventDefault(),E++,D(!0))}),m.addEventListener("dragover",H=>{B(H)&&(H.preventDefault(),H.dataTransfer&&(H.dataTransfer.dropEffect="copy"))}),m.addEventListener("dragleave",()=>{E=Math.max(0,E-1),E===0&&D(!1)}),m.addEventListener("drop",H=>{var M;B(H)&&(H.preventDefault(),E=0,D(!1),Ss(Array.from(((M=H.dataTransfer)==null?void 0:M.files)??[]),w))})}async function Ss(m,w){if(m.length===0)return w.onError("nothing to drop");await ct(m,w)}async function ct(m,w){if(!w.ready()){w.onError("focus a session first — the file goes into its prompt");return}const E=[];for(const D of m)try{E.push(vs(await w.upload(D)))}catch(B){w.onError(B.message);break}E.length>0&&w.insert(E.join(" ")+" ")}const Cs=6;function bs(m,w){let E=null,D=null;const B=h=>Number(h.dataset.slot),H=(h,l)=>{var c;const s=((c=document.elementFromPoint(h,l))==null?void 0:c.closest(".tile[data-slot]"))??null;return s&&m.contains(s)?s:null},M=h=>{h!==D&&(D==null||D.classList.remove("drop-target"),D=h,D==null||D.classList.add("drop-target"))},t=()=>{E==null||E.from.classList.remove("dragging"),document.body.classList.remove("tile-dragging"),M(null),E=null},o=()=>{const h=l=>{l.stopPropagation(),l.preventDefault()};window.addEventListener("click",h,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",h,{capture:!0}),0)};m.addEventListener("pointerdown",h=>{if(h.button!==0||!(h.target instanceof Element)||h.target.closest(".tile-action"))return;const l=h.target.closest(".tile[data-slot]");if(!l)return;const s=w.sessionAt(B(l));s&&(E={id:s,from:l,pointer:h.pointerId,x:h.clientX,y:h.clientY,active:!1})}),window.addEventListener("pointermove",h=>{if(!E||h.pointerId!==E.pointer)return;if(!E.active){if(Math.hypot(h.clientX-E.x,h.clientY-E.y)<Cs)return;E.active=!0,E.from.classList.add("dragging"),document.body.classList.add("tile-dragging")}const l=H(h.clientX,h.clientY);M(l&&l!==E.from?l:null)}),window.addEventListener("pointerup",h=>{if(!E||h.pointerId!==E.pointer)return;const{id:l,active:s}=E,c=D;t(),s&&(o(),c&&w.onMove(l,B(c)))}),window.addEventListener("pointercancel",t),window.addEventListener("keydown",h=>{h.key!=="Escape"||!(E!=null&&E.active)||(h.stopPropagation(),h.preventDefault(),t())},{capture:!0})}function li(m){return Array.from(m??[]).filter(w=>hi.test(w.type))}function ws(m,w){m.addEventListener("paste",E=>{var B;const D=li((B=E.clipboardData)==null?void 0:B.files);D.length!==0&&(E.preventDefault(),E.stopPropagation(),ct(D,w))},{capture:!0})}async function ys(m){const w=[];let E="";for(const D of m){const B=D.types.find(H=>hi.test(H));B?w.push(await D.getType(B)):D.types.includes("text/plain")&&(E+=await(await D.getType("text/plain")).text())}return{images:w,text:E}}async function Es(m){if(!m.ready()){m.onError("focus a session first — the paste goes into its prompt");return}let w;try{w=await navigator.clipboard.read()}catch{m.fallback();return}const{images:E,text:D}=await ys(w);E.length>0?await ct(E,m):D?m.insert(D):m.onError("nothing on the clipboard to paste")}function ci(m,w,E){var t,o;let D=Math.max(0,w);for(;D>0&&((t=m.getLine(D))!=null&&t.isWrapped);)D--;let B=Math.min(m.length,E);for(;B<m.length&&((o=m.getLine(B))!=null&&o.isWrapped);)B++;const H=[];let M=null;for(let h=D;h<B;h++){const l=m.getLine(h);if(!l)continue;const s=l.translateToString(!1);l.isWrapped&&M!==null?M+=s:(M!==null&&H.push(M.trimEnd()),M=s)}return M!==null&&H.push(M.trimEnd()),H}function Ls(m,w){const E=ci(m,m.viewportY,m.viewportY+w);for(;E.length>0&&E[E.length-1]==="";)E.pop();return E.join(`
|
|
68
|
+
`)}const xs=/https?:\/\/[^\s<>"'`]+/g,Rs=/[.,;:!?)\]}'"]+$/;function ks(m){const w=new Set;for(const E of m.match(xs)??[]){const D=E.replace(Rs,"");D.length>8&&w.add(D)}return[...w]}const Ds=300;function As(m,w=Ds){const E=ci(m,m.length-w,m.length);return ks(E.reverse().join(`
|
|
69
|
+
`))}async function di(m){var D;try{if((D=navigator.clipboard)!=null&&D.writeText)return await navigator.clipboard.writeText(m),!0}catch{}const w=document.createElement("textarea");w.value=m,w.setAttribute("readonly",""),w.style.position="fixed",w.style.opacity="0",document.body.append(w),w.select();let E=!1;try{E=document.execCommand("copy")}catch{E=!1}return w.remove(),E}const Gt="#071411",Ms="#dceee7";class Ts{constructor(w){de(this,"ctx");de(this,"last",null);this.canvas=w,this.ctx=w.getContext("2d",{alpha:!1})}paint(w=this.last){if(!this.ctx||!w)return;this.last=w;const E=window.devicePixelRatio||1,D=this.canvas.clientWidth,B=this.canvas.clientHeight;if(D===0||B===0)return;(this.canvas.width!==Math.round(D*E)||this.canvas.height!==Math.round(B*E))&&(this.canvas.width=Math.round(D*E),this.canvas.height=Math.round(B*E));const H=this.ctx;H.setTransform(E,0,0,E,0,0),H.fillStyle=Gt,H.fillRect(0,0,D,B);const M=D/Math.max(w.cols,1),t=Math.max(M/.6,1),o=B/Math.max(w.rows.length,1);H.textBaseline="top",H.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<w.rows.length;h++){const l=w.rows[h];if(!l)continue;let s=0;for(const c of l){const f=c.text.length*M;c.bg>=0&&(H.fillStyle=jt(c.bg,Gt),H.fillRect(s,h*o,f,o)),c.text.trim()!==""&&(H.fillStyle=jt(c.fg,Ms),H.fillText(c.text,s,h*o)),s+=f}}}refresh(){this.last&&this.paint(this.last)}}const ze=[4,8,12,16],Vt=16;function ui(m){return m<12?Bs(m/2):Os(m/4+1)}function Bs(m){const w=new Map;for(let E=1;E<=m;E++)w.set(E,{row:1,col:E});for(let E=0;E<m;E++)w.set(m+1+E,{row:3,col:m-E});return{cols:m,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${m+1}`,cells:w}}function Os(m){const w=[];for(let E=1;E<=m;E++)w.push({row:1,col:E});for(let E=2;E<=m-1;E++)w.push({row:E,col:m});for(let E=m;E>=1;E--)w.push({row:m,col:E});for(let E=m-1;E>=2;E--)w.push({row:E,col:1});return{cols:m,rows:m,rowTemplate:`repeat(${m}, 1fr)`,focus:`2 / 2 / ${m} / ${m}`,cells:new Map(w.map((E,D)=>[D+1,E]))}}const _i="tring.ring";let fi=Ps();function Ps(){try{const m=Number(localStorage.getItem(_i));return Is(m)?m:Vt}catch{return Vt}}function Is(m){return ze.includes(m)}function Ve(){return fi}function Fs(m){fi=m;try{localStorage.setItem(_i,String(m))}catch{}}function Hs(m,w,E){const D=ui(E);m.style.gridTemplateColumns=`repeat(${D.cols}, 1fr)`,m.style.gridTemplateRows=D.rowTemplate,w.style.gridArea=D.focus}function $s(m,w,E){const D=ui(E).cells.get(w);D&&(m.style.gridRow=String(D.row),m.style.gridColumn=String(D.col))}const pi="tring.sound";let it=null,Mt=Ns();function Ns(){try{return localStorage.getItem(pi)!=="off"}catch{return!0}}function We(){return Mt}function Ws(m){Mt=m;try{localStorage.setItem(pi,m?"on":"off")}catch{}m&&Tt()}async function Tt(){try{return it??(it=new AudioContext),it.state==="suspended"&&await it.resume(),it}catch{return null}}document.addEventListener("pointerdown",()=>void Tt(),{once:!0});function Xt(m,w,E,D,B){const H=m.createOscillator(),M=m.createGain();H.type="sine",H.frequency.setValueAtTime(E,w),M.gain.setValueAtTime(0,w),M.gain.linearRampToValueAtTime(D,w+.004),M.gain.exponentialRampToValueAtTime(1e-4,w+B),H.connect(M).connect(m.destination),H.start(w),H.stop(w+B)}function Us(){Mt&&Tt().then(m=>{if(!m)return;const w=m.currentTime;for(const E of[0,.085])Xt(m,w+E,1568,.13,.55),Xt(m,w+E,2349,.05,.4)})}const vi="tring.usage",gi="tring.usage.view",mi=(m,w)=>{try{const E=localStorage.getItem(m);return E===null?w:JSON.parse(E)}catch{return w}},Si=(m,w)=>{try{localStorage.setItem(m,JSON.stringify(w))}catch{}};let Bt=mi(vi,!1);const mt=()=>Bt;function zs(m){Bt=m,Si(vi,m)}const js=()=>Bt&&mi(gi,!1),Ci=m=>Si(gi,m),qs=()=>At("/api/usage");function Ue(m){return m>=1e9?`${(m/1e9).toFixed(1)}B`:m>=1e6?`${(m/1e6).toFixed(1)}M`:m>=1e3?`${Math.round(m/1e3)}k`:String(m)}const Yt=m=>`$${m.toFixed(2)}`,Jt=m=>new Date(m).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function ae(m,w,E){const D=document.createElement(m);return w&&(D.className=w),E!==void 0&&(D.textContent=E),D}function bi(m,w,E=!0){const D=Math.min(100,m/w*100),B=ae("div","meter"),H=ae("i");return H.style.width=`${D}%`,E&&(D>=90?H.classList.add("hot"):D>=75&&H.classList.add("warm")),B.append(H),B.setAttribute("role","progressbar"),B.setAttribute("aria-valuenow",String(Math.round(D))),B}function St(m,w,E){m.replaceChildren();const D=ae("div","usage");if(E){D.append(ae("h2",void 0,"Claude usage")),D.append(ae("p","hint",E)),m.append(D);return}if(!w){D.append(ae("p","hint","asking Claude Code…")),m.append(D);return}if(w.limits.length>0){for(const M of w.limits)D.append(Ks(M));D.append(ae("p","source","from Claude Code’s own /usage"))}else{const M=w.window;D.append(Zt("5-hour window",`${Ue(M.tokens)} tokens`,M.resetsAt?`resets ${Jt(M.resetsAt)}`:"nothing running")),D.append(Zt("This week",`${Ue(w.week.tokens)} tokens`,"rolling 7 days")),D.append(ae("p","source",`${w.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const B=ae("div","utotals"),H=(M,t)=>{const o=ae("div","ucell");return o.append(ae("b",void 0,t),ae("span",void 0,M)),o};if(B.append(H("tokens today",Ue(w.today.tokens))),B.append(H("today, est.",Yt(w.today.cost))),B.append(H("this week, est.",Yt(w.week.cost))),B.append(H("cache reads, 7d",Ue(w.week.cacheReadTokens))),D.append(B),w.projects.length>0){D.append(ae("h3",void 0,"By project, last 7 days"));const M=w.projects[0].tokens,t=ae("div","uprojects");for(const o of w.projects.slice(0,8)){const h=ae("div","uproject");h.append(ae("span","nm",o.name)),h.append(bi(o.tokens,M,!1)),h.append(ae("span","tag",Ue(o.tokens))),t.append(h)}D.append(t)}D.append(ae("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${Jt(w.scannedAt)}.`)),m.append(D)}function Ks(m){const w=ae("div","urow"),E=ae("div","uhead");if(E.append(ae("span","ulabel",m.label)),E.append(ae("span","upct",`${m.percent}%`)),w.append(E),w.append(bi(m.percent,100)),m.resets){const D=ae("div","ufoot");D.append(ae("span","unote",`resets ${m.resets}`)),w.append(D)}return w}function Zt(m,w,E){const D=ae("div","urow"),B=ae("div","uhead");B.append(ae("span","ulabel",m)),B.append(ae("span","upct",w)),D.append(B);const H=ae("div","ufoot");return H.append(ae("span","unote",E)),D.append(H),D}function Gs(m,w,E,D,B,H=!1){m.replaceChildren();const M=document.createElement("div");M.className="logo",M.title="tring";for(let l=0;l<9;l++)M.append(document.createElement("i"));m.append(M);for(const l of w){const s=l.sessions.filter(p=>p.status==="done").length,c=document.createElement("button");c.className="tab"+(!H&&l.id===E?" active":""),c.title=l.root;const f=document.createElement("span");if(f.className="nm",f.textContent=l.name,c.append(f),s>0){const p=document.createElement("span");p.className="badge",p.textContent=String(s),c.append(p)}c.onclick=()=>D.onSelect(l.id),c.oncontextmenu=p=>{p.preventDefault(),D.onContext(l.id,{x:p.clientX,y:p.clientY})},m.append(c)}if(mt()){const l=document.createElement("button");l.className="tab pinned"+(H?" active":""),l.title="Claude usage";const s=document.createElement("span");s.className="nm",s.textContent="Usage",l.append(s),l.onclick=()=>D.onUsage(),m.append(l)}const t=document.createElement("button");t.className="add",t.textContent="+",t.title="New project",t.onclick=()=>D.onAdd(),m.append(t);const o=document.createElement("button");o.className="iconbtn"+(We()?" on":""),o.innerHTML=Xs(We()),o.title=We()?"Sound on — click to mute":"Sound off — click to unmute",o.setAttribute("aria-label",o.title),o.setAttribute("aria-pressed",String(We())),o.onclick=()=>{Ws(!We()),D.onSoundToggle()},o.style.marginLeft=B?"0":"auto",m.append(o);const h=document.createElement("button");if(h.className="iconbtn",h.innerHTML=Vs(),h.title="Settings",h.setAttribute("aria-label",h.title),h.onclick=()=>D.onSettings(),m.append(h),B){const l=document.createElement("button");l.className="update",l.textContent=`v${B.latest} available`,l.title=`You are on ${B.current}`,l.onclick=()=>D.onUpdate(B),m.insertBefore(l,o)}}function Vs(){return wi('<path d="M6.09 3.71 L6.43 1.18 L9.57 1.18 L9.91 3.71 L10.76 4.2 L13.12 3.23 L14.69 5.95 L12.67 7.51 L12.67 8.49 L14.69 10.05 L13.12 12.77 L10.76 11.8 L9.91 12.29 L9.57 14.82 L6.43 14.82 L6.09 12.29 L5.24 11.8 L2.88 12.77 L1.31 10.05 L3.33 8.49 L3.33 7.51 L1.31 5.95 L2.88 3.23 L5.24 4.2 Z"/><circle cx="8" cy="8" r="2.4"/>')}function wi(m){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${m}</svg>`}function Xs(m){return wi(`<path d="M8 2a3 3 0 0 1 3 3v3l1.4 2.1a.5.5 0 0 1-.4.8H4a.5.5 0 0 1-.4-.8L5 8V5a3 3 0 0 1 3-3z"/><path d="M6.6 12.6a1.5 1.5 0 0 0 2.8 0"/>${m?"":'<path d="M2.5 2.5l11 11"/>'}`)}const yi="(max-width: 720px)";function Ys(m){return m?{key:String(m.slot),name:m.name??m.title??"shell",status:m.status}:{key:"—",name:"pick a session",status:"idle"}}function Js(m,w,E,D){m.replaceChildren();const B=Ys(w),H=document.createElement("button");H.className=`current st-${B.status}`,H.title="Switch session",H.setAttribute("aria-haspopup","dialog");const M=st("key",B.key),t=st("nm",B.name),o=st("tag",w?B.status:"");H.append(M,t,o,Zs()),H.onclick=()=>D.onOpen(),m.append(H);const h=document.createElement("button");h.className="paste",h.disabled=!w,h.title=w?"Paste from the clipboard":"Focus a session to paste",h.setAttribute("aria-label","Paste"),h.innerHTML=nt('<rect x="4" y="3" width="8" height="11" rx="1.5"/><path d="M6 3V2h4v1M6.5 7h3M6.5 10h3"/>'),h.onclick=()=>D.onPaste(),m.append(h);const l=document.createElement("button");l.className="copy",l.disabled=!w,l.title=w?"Copy text off the screen":"Focus a session to copy",l.setAttribute("aria-label","Copy"),l.innerHTML=nt('<rect x="6" y="6" width="8" height="8" rx="1.5"/><path d="M4 10H3.5A1.5 1.5 0 0 1 2 8.5v-5A1.5 1.5 0 0 1 3.5 2h5A1.5 1.5 0 0 1 10 3.5V4"/>'),l.onclick=()=>D.onCopy(),m.append(l);const s=document.createElement("button");s.className="next",s.disabled=E===0,s.title=E>0?`Next finished session (${E})`:"No finished sessions",s.setAttribute("aria-label",s.title),s.innerHTML=nt('<path d="M5 3l6 5-6 5"/>'),E>0&&s.append(st("badge",String(E))),s.onclick=()=>D.onNext(),m.append(s)}function st(m,w){const E=document.createElement("span");return E.className=m,E.textContent=w,E}function Zs(){const m=document.createElement("span");return m.className="chev",m.innerHTML=nt('<path d="M4 6l4 4 4-4"/>'),m}function nt(m){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${m}</svg>`}const Re=document.getElementById("overlay");let Ct=null;function Ye(){return!Re.hidden}function re(){Re.hidden=!0,Re.replaceChildren();const m=Ct;Ct=null,m==null||m()}function ye(m,w={}){var E;Ct=w.onClosed??null,Re.replaceChildren(m),Re.hidden=!1,w.dismissible!==!1?Re.onclick=D=>{D.target===Re&&re()}:Re.onclick=null,(E=m.querySelector("input, button"))==null||E.focus()}function j(m,w,E){const D=document.createElement(m);return w&&(D.className=w),E!==void 0&&(D.textContent=E),D}function Ei(m){const w=j("div","browser"),E=j("div","crumb"),D=j("div","dirlist");w.append(E,D);let B=!1;async function H(M){if(!B){B=!0,D.replaceChildren(j("div","dirnote","loading…"));try{const t=M?`?path=${encodeURIComponent(M)}`:"",o=await At(`/api/fs${t}`);if(m.value=o.path,E.replaceChildren(),o.parent){const h=j("button","up","↑ "+o.parent);h.type="button",h.onclick=()=>void H(o.parent),E.append(h)}else E.append(j("span","dirnote",o.path));D.replaceChildren(),o.entries.length===0&&D.append(j("div","dirnote","no subdirectories"));for(const h of o.entries){const l=j("button",void 0,h.name);l.type="button",l.onclick=()=>void H(h.path),D.append(l)}}catch(t){D.replaceChildren(j("div","dirnote",t.message))}finally{B=!1}}}return m.addEventListener("change",()=>void H(m.value.trim()||void 0)),H(m.value.trim()||void 0),w}function Qs(m,w,E,D){const B=j("div","panel picker");B.append(j("h2",void 0,m?m.name:"No project")),B.append(j("p","hint",`${E} session${E===1?"":"s"} finished across all projects`));const H=j("div","rows"),M=new Map;for(const c of(m==null?void 0:m.sessions)??[])M.set(c.slot,c);const t=window.matchMedia(yi).matches;for(let c=1;c<=Ve();c++){const f=M.get(c),p=j("button",`row st-${(f==null?void 0:f.status)??"idle"}`);(f==null?void 0:f.status)==="busy"&&p.classList.add("dim"),f||p.classList.add("dim"),p.append(j("span","key",t?String(c):kt(c))),p.append(j("span","nm",f?f.name??f.title??f.cwd.split("/").pop()??"shell":"— empty")),f&&p.append(j("span","tag",f.status)),p.onclick=()=>{re(),D.onPickSlot(c)},H.append(p)}B.append(H);const o=j("div","picker-actions"),h=j("button","btn","Next finished");h.type="button",h.disabled=E===0,h.onclick=()=>{re(),D.onNextDone()};const l=j("button","btn","New session");l.type="button",l.onclick=()=>{re(),D.onNewSession()},o.append(h,l),B.append(o);const s=j("div","legend");s.innerHTML="<b>n</b> next finished <b>p</b> projects <b>c</b> new session <b>r</b> rename <b>x</b> kill <b>m</b> mark seen <b>esc</b> close",B.append(s),ye(B),B.dataset.projects=String(w.length)}function er(m,w){const E=j("div","panel");E.append(j("h2",void 0,"Projects")),E.append(j("p","hint",`Each project owns its own ${Ve()} slots.`));const D=j("div","rows");m.forEach((B,H)=>{const M=B.sessions.filter(o=>o.status==="done").length,t=j("button","row st-done");t.append(j("span","key",H<9?String(H+1):"—")),t.append(j("span","nm",B.name)),t.append(j("span","tag",M>0?`${M} done`:B.root)),t.onclick=()=>{re(),w(B.id)},D.append(t)}),E.append(D),ye(E)}function Li(m,w){const E=j("div","panel");E.append(j("h2",void 0,m.title)),E.append(j("p","hint",m.blocking?"A project is a name and a root directory. New sessions start there.":"New sessions in this project start in its root directory."));const D=j("form"),B=j("input");B.value=m.name??"",B.placeholder="api-service",B.required=!0;const H=j("label","field");H.append(j("span",void 0,"Project name"),B);const M=j("input");M.value=m.root??"",M.placeholder="/home/you/code/api-service",M.required=!0,M.disabled=!!m.rootLocked;const t=j("label","field");t.append(j("span",void 0,m.rootLocked?"Root directory (fixed after creation)":"Root directory"),M),D.append(H,t),m.rootLocked||D.append(Ei(M));const o=j("div","actions");if(m.onDelete){const l=j("button","btn danger","Delete project");l.type="button",l.onclick=()=>{var s;re(),(s=m.onDelete)==null||s.call(m)},o.append(l),o.style.justifyContent="space-between"}if(!m.blocking){const l=j("button","btn","Cancel");l.type="button",l.onclick=()=>re(),o.append(l)}const h=j("button","btn primary",m.onDelete?"Save":"Create");h.type="submit",o.append(h),D.append(o),D.onsubmit=l=>{l.preventDefault(),!(!B.value.trim()||!M.value.trim())&&(re(),w(B.value.trim(),M.value.trim()))},E.append(D),ye(E,{dismissible:!m.blocking}),B.focus(),B.select()}function tr(m,w){const E=j("div","panel");E.append(j("h2",void 0,`New session in slot ${m.slot}`)),E.append(j("p","hint","Defaults to the project root."));const D=j("form"),B=(s,c,f)=>{const p=j("input");p.value=c,p.placeholder=f;const a=j("label","field");return a.append(j("span",void 0,s),p),D.append(a),p},H=B("Working directory",m.cwd,m.cwd);D.append(Ei(H));const M=B("Command (optional)","","claude"),t=B("Name (optional)","","agent"),o=j("div","actions"),h=j("button","btn","Cancel");h.type="button",h.onclick=()=>re();const l=j("button","btn primary","Start");l.type="submit",o.append(h,l),D.append(o),D.onsubmit=s=>{s.preventDefault(),re(),w({cwd:H.value.trim()||m.cwd,command:M.value.trim()||null,name:t.value.trim()||null})},E.append(D),ye(E)}const ir=["#f87171","#b91c1c","#fb923c","#c2410c","#fbbf24","#b45309","#a3e635","#4d7c0f","#4ade80","#15803d","#2dd4bf","#0f766e","#22d3ee","#0e7490","#60a5fa","#1d4ed8","#818cf8","#4338ca","#c084fc","#7e22ce","#f472b6","#be185d","#94a3b8","#475569"];function sr(m,w,E,D){const B=j("div","panel");B.append(j("h2",void 0,`Slot ${m.slot}`)),B.append(j("p","hint",m.cwd));const H=j("form"),M=j("input");M.value=m.name??"",M.placeholder=m.title??"shell";const t=j("label","field");t.append(j("span",void 0,"Name"),M),H.append(t);let o=m.color;const h=j("div","swatches"),l=()=>{for(const i of Array.from(h.children))i.classList.toggle("active",i.dataset.color===(o??""))},s=(i,r)=>{const d=j("button","swatch");d.type="button",d.dataset.color=i??"",d.title=r,d.setAttribute("aria-label",r),i?d.style.setProperty("--tint",i):d.classList.add("none"),d.onclick=()=>{o=i,l()},h.append(d)};s(null,"No colour");for(const i of ir)s(i,i);l();const c=j("div","field");c.append(j("span",void 0,"Border colour"),h),H.append(c);const f=j("div","actions"),p=j("button","btn danger","Delete");p.type="button",p.onclick=()=>{re(),E()};const a=j("button","btn diff-toggle",D.open?"Hide diff viewer":"Diff viewer");a.type="button",a.style.marginRight="auto",a.onclick=()=>{re(),D.onToggle()};const e=j("button","btn","Cancel");e.type="button",e.onclick=()=>re();const n=j("button","btn primary","Save");n.type="submit",f.append(p,a,e,n),H.append(f),H.onsubmit=i=>{i.preventDefault(),re(),w({name:M.value.trim(),color:o})},B.append(H),ye(B),M.focus(),M.select()}function rr(m,w){const E=j("div","panel");E.append(j("h2",void 0,"Settings"));let D=m.ring;const B=j("div","field ring-size");B.append(j("span",void 0,"Terminals around the focus"));const H=j("div","choices");for(const s of ze){const c=j("button","choice"+(s===D?" active":""));c.type="button",c.append(j("b",void 0,String(s))),c.append(j("span",void 0,s<12?"wide centre":"full ring")),c.onclick=()=>{D=s;for(const f of Array.from(H.children))f.classList.remove("active");c.classList.add("active")},H.append(c)}B.append(H),E.append(B),E.append(j("p","hint ring-size","Slots stay where they are. Shrinking needs the slots above the new size to be empty first, so nothing is killed or hidden behind your back."));const M=j("label","field toggle"),t=j("input");t.type="checkbox",t.checked=m.usage,M.append(t,j("span",void 0,"Enable Claude usage monitoring")),E.append(M),E.append(j("p","hint","The tab asks Claude Code for the real numbers with `claude -p /usage`, which it answers locally and bills nothing. Nothing is read from your credentials, and nothing leaves this machine."));const o=j("div","actions"),h=j("button","btn","Cancel");h.type="button",h.onclick=()=>re();const l=j("button","btn primary","Save");l.onclick=()=>{re(),w({ring:D,usage:t.checked})},o.append(h,l),E.append(o),ye(E)}function nr(m,w){const E=j("div","panel");E.append(j("h2",void 0,`tring ${w} is available`)),E.append(j("p","hint",`You are running ${m}. Update with:`));const D=j("pre","cmd","npm i -g tring-chat");E.append(D),E.append(j("p","hint","Running sessions are not affected until you restart the daemon."));const B=j("div","actions"),H=j("button","btn","Copy command");H.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{H.textContent="Copied"},()=>{H.textContent="Copy failed"})};const M=j("button","btn primary","Close");M.onclick=()=>re(),B.append(H,M),E.append(B),ye(E)}function xi(m,w,E){const D=j("div","panel");D.append(j("h2",void 0,m)),D.append(j("p","hint",w));const B=j("div","actions"),H=j("button","btn","Cancel");H.onclick=()=>re();const M=j("button","btn primary","Confirm");M.onclick=()=>{re(),E()},B.append(H,M),D.append(B),ye(D)}function or(m){const w=j("div","panel paste-sheet");w.append(j("h2",void 0,"Paste")),w.append(j("p","hint","The clipboard could not be read directly. Long-press the box and paste: text is typed into the terminal, an image goes in as a path."));const E=j("textarea","paste-box");E.rows=4,E.placeholder="paste here",E.autocomplete="off",E.autocapitalize="off",E.spellcheck=!1,E.addEventListener("paste",M=>{var o;const t=li((o=M.clipboardData)==null?void 0:o.files);t.length!==0&&(M.preventDefault(),re(),m.onImages(t))}),w.append(E);const D=j("div","actions"),B=j("button","btn","Cancel");B.onclick=()=>re();const H=j("button","btn primary","Insert");H.onclick=()=>{const M=E.value;re(),M&&m.onText(M)},D.append(B,H),w.append(D),ye(w),E.focus()}function ar(m,w){const E=j("div","panel copy-sheet");E.append(j("h2",void 0,"Copy"));const D=(o,h,l="btn")=>{const s=j("button",l,o);return s.type="button",s.onclick=()=>{w(h).then(c=>{s.textContent=c?"Copied":"Copy failed",setTimeout(()=>{s.textContent=o},1500)})},s};if(m.links.length>0){E.append(j("p","hint","Links on screen, the latest first."));const o=j("div","links");for(const h of m.links){const l=j("div","link");l.append(j("span","url",h),D("Copy",h)),o.append(l)}E.append(o)}E.append(j("p","hint",m.text?"The screen as text. Long-press to select part of it, or copy all of it.":"Nothing on the screen yet."));const B=j("pre","copy-box",m.text);E.append(B);const H=j("div","actions"),M=j("button","btn","Close");M.onclick=()=>re();const t=D("Copy screen",m.text,"btn primary");t.disabled=m.text==="",H.append(M,t),E.append(H),ye(E)}const hr=document.getElementById("bar"),pt=document.getElementById("switcher"),ke=document.getElementById("ring"),Xe=document.getElementById("usage");let Ce=[],Me=null,le=null,je=null,bt=null,Qt="",vt=!1,pe=null,wt=null,Ae="ring",ot=null;const Ot=window.matchMedia(yi),ht=new Map,at=new Map,yt=new Map,Ri=new Map;let Et=null,Lt=null;const xe=document.createElement("div");xe.className="focus-cell";const Pt=document.createElement("div");Pt.className="term-host";xe.append(Pt);const qe=new fs(xe,()=>Ze()),ve=new ls(Pt),ge=new is({onOpen:()=>{$t(),pr()},onClose:()=>$e("daemon disconnected — reconnecting"),onOutput:(m,w)=>{m===le&&ve.write(w)},onMessage:lr});ve.onInput=m=>{le&&ge.send({type:"input",id:le,data:m})};gs(window);const Ke={upload:ts,ready:()=>le!==null,insert:m=>{ve.paste(m),ve.focus()},onError:$e};ms(xe,Ke);bs(ke,{sessionAt:m=>{var w;return(w=Be(m))==null?void 0:w.id},onMove:(m,w)=>ge.send({type:"move",id:m,slot:w})});ws(xe,Ke);ve.shouldSendKey=m=>!Ye()&&!Rt(m);ve.onSelect=m=>{di(m).then(w=>{w||$e("could not copy the selection"),ve.focus()})};const It=()=>Ce.find(m=>m.id===Me)??null,Te=()=>{var m;return((m=It())==null?void 0:m.sessions)??[]},Be=m=>Te().find(w=>w.slot===m),Fe=m=>Ce.flatMap(w=>w.sessions).find(w=>w.id===m);function He(){const m=Math.max(0,...Te().map(w=>w.slot));return ze.find(w=>w>=m&&w>=Ve())??ze[ze.length-1]}const ki=()=>Ce.reduce((m,w)=>m+w.sessions.filter(E=>E.status==="done").length,0);function lr(m){var w,E;switch(m.type){case"state":{Ce=m.projects,wt=m.update??wt;const D=new Set(Ce.flatMap(B=>B.sessions).map(B=>B.id));for(const B of at.keys())D.has(B)||at.delete(B);Me=m.activeProjectId??((w=Ce[0])==null?void 0:w.id)??null,Di(),vr(),Cr(),Sr(),js()&&Bi(),wr();break}case"status":{const D=Fe(m.id),B=D==null?void 0:D.status;D&&(D.status=m.status,D.since=m.since,D.title=m.title),m.status==="done"&&B!=="done"&&m.notable&&Us(),Ie();break}case"screen":m.id===le&&ve.replay(m.ansi);break;case"snapshot":{at.set(m.id,m.snapshot),(E=ht.get(m.id))==null||E.paint(m.snapshot);break}case"exit":Ie();break;case"error":$e(m.message);break}}const cr=()=>({onSelect:m=>lt(m),onAdd:()=>Oi(!1),onContext:m=>br(m),onUpdate:m=>nr(m.current,m.latest),onSoundToggle:()=>Ie(),onSettings:()=>gr(),onUsage:()=>Bi()}),Je=()=>Gs(hr,Ce,Me,cr(),wt,Ae==="usage");function Di(){Je(),dr(),Ie()}function dr(){const m=He(),w=`${Me}|${m}|`+Te().map(E=>`${E.slot}:${E.id}`).sort().join(",");if(w!==Qt){Qt=w,Hs(ke,xe,m);for(const E of Array.from(ke.children))E!==xe&&E.remove();xe.parentElement!==ke&&ke.append(xe),yt.clear(),ht.clear();for(let E=1;E<=m;E++){const D=Be(E),B=document.createElement("div");if(B.className="tile",B.tabIndex=0,B.onmousedown=H=>H.preventDefault(),$s(B,E,m),B.dataset.slot=String(E),!D)B.classList.add("empty"),B.textContent=`+ ${kt(E)}`,B.onclick=()=>Ht(E);else{const H=document.createElement("canvas");B.append(H);const M=new Ts(H);ht.set(D.id,M);const t=at.get(D.id);t&&M.paint(t);const o=document.createElement("div");o.className="label";const h=rt("slot-badge");h.textContent=String(E),o.append(h,rt("big-nm")),B.append(o);const l=document.createElement("div");l.className="meta";const s=document.createElement("span");s.className="key",s.textContent=String(E),l.append(s,rt("nm"),rt("cwd")),B.append(l),B.onclick=()=>Oe(D.id),B.oncontextmenu=f=>{f.preventDefault(),Pi(D.id)};const c=document.createElement("button");c.className="tile-action",c.onclick=f=>{f.stopPropagation(),ge.send({type:"respawn",id:D.id})},B.append(c),Ai(B,D)}yt.set(E,B),ke.append(B)}requestAnimationFrame(()=>Ze())}}const rt=m=>{const w=document.createElement("span");return w.className=m,w};function Ai(m,w){if(m.classList.remove("st-idle","st-busy","st-done","st-exited","viewing"),m.style.removeProperty("--tint"),!w)return;m.classList.add(`st-${w.status}`),w.id===le&&m.classList.add("viewing"),w.color&&m.style.setProperty("--tint",w.color);const E=w.name??w.title??"shell",D=m.querySelector(".nm");D&&(D.textContent=E);const B=m.querySelector(".big-nm");B&&(B.textContent=E);const H=m.querySelector(".cwd");H&&(H.textContent=w.cwd.split("/").filter(Boolean).pop()??""),m.title=`${kt(w.slot)} — ${w.cwd}`;const M=m.querySelector(".tile-action"),t=ur(w);M&&(M.hidden=!t,t&&(M.textContent=t.label,M.title=t.title))}function ur(m){return m.status==="exited"?{label:"↻",title:m.command?`Restart: ${m.command}`:`Restart shell (exit ${m.exitCode??"?"})`}:m.command&&m.status==="idle"?{label:"▸",title:`Run: ${m.command}`}:null}function Ie(){for(let w=1;w<=He();w++){const E=yt.get(w);E&&Ai(E,Be(w))}Je(),dt();const m=ki();document.title=m>0?`(${m}) tring`:"tring"}let gt="";function dt(){if(pt.hidden=!Ot.matches||Ae!=="ring",pt.hidden){gt="";return}const m=le?Fe(le)??null:null,w=Te().filter(D=>D.status==="done").length,E=`${m==null?void 0:m.id}|${m==null?void 0:m.status}|${m==null?void 0:m.name}|${m==null?void 0:m.title}|${w}`;E!==gt&&(gt=E,Js(pt,m,w,{onOpen:Fi,onNext:Ft,onPaste:_r,onCopy:fr}))}function _r(){Es({...Ke,fallback:()=>or({onText:Ke.insert,onImages:m=>{ct(m,Ke)}})})}function fr(){if(!le)return;const m=ve.term.buffer.active;ar({text:Ls(m,ve.term.rows),links:As(m)},di)}function Ze(){const{cols:m,rows:w}=ve.fitNow();le&&ge.send({type:"resize",cols:m,rows:w});for(const E of ht.values())E.refresh()}function Oe(m){ut(),Mi(m),le&&ve.focus()}function Mi(m){if(m&&m===le)return;const w=m?Fe(m):void 0;if(le&&(bt=le),le=(w==null?void 0:w.id)??null,je=(w==null?void 0:w.slot)??null,qe.setSession(le),!w){ve.clear(),Ie();return}Ri.set(w.projectId,w.id);const{cols:E,rows:D}=ve.fitNow();ge.send({type:"focus",id:w.id,cols:E,rows:D}),ve.focus(),Ie()}function pr(){if(!le)return;const{cols:m,rows:w}=ve.fitNow();ge.send({type:"focus",id:le,cols:m,rows:w})}function vr(){if(le===null||je===null)return;const m=ps({id:le,slot:je},Te());if(m&&m.id===le){je=m.slot;return}Mi((m==null?void 0:m.id)??null)}function Ti(m){const w=Be(m);w?Oe(w.id):Ht(m)}function Bi(){Ae!=="usage"&&(Ae="usage",ke.hidden=!0,Xe.hidden=!1,St(Xe,null,null),xt(),ot=setInterval(()=>void xt(),3e4),Ci(!0),Je(),dt())}function ut(){Ae!=="ring"&&(Ae="ring",ot&&clearInterval(ot),ot=null,Xe.hidden=!0,ke.hidden=!1,Ci(!1),Je(),dt(),requestAnimationFrame(()=>Ze()))}async function xt(){if(Ae==="usage")try{St(Xe,await qs(),null)}catch(m){St(Xe,null,m.message)}}function gr(){rr({ring:Ve(),usage:mt()},m=>{m.usage!==mt()&&(zs(m.usage),m.usage||ut()),m.ring!==Ve()?mr(m.ring):(Je(),xt())})}function mr(m){Fs(m),Di();const w=He();w!==m?$e(`slots above ${m} are still in use — the ring stays at ${w} until they are closed`):$t()}function lt(m){ut(),m!==Me&&(Me=m,le=null,je=null,qe.setSession(null),ve.clear(),Et=m,ge.send({type:"activateProject",projectId:m}))}function Sr(){const m=Lt;if(m===null)return;const w=Be(m);w&&(Lt=null,Oe(w.id))}function Cr(){const m=Et;if(!m||m!==Me)return;Et=null;const w=Ri.get(m);w&&Te().some(E=>E.id===w)&&Oe(w)}function Ft(){var B;const m=Te(),w=Be(((B=Fe(le??""))==null?void 0:B.slot)??0),E=(w==null?void 0:w.slot)??0,D=He();for(let H=1;H<=D;H++){const M=(E+H-1)%D+1,t=m.find(o=>o.slot===M);if((t==null?void 0:t.status)==="done")return Oe(t.id)}}function Ht(m){const w=It();w&&tr({cwd:w.root,slot:m},E=>{Ot.matches&&(Lt=m),ge.send({type:"create",projectId:w.id,slot:m,cwd:E.cwd,...E.command?{command:E.command}:{},...E.name?{name:E.name}:{}})})}function Oi(m){Li({title:m?"Create your first project":"New project",root:"",blocking:m},(w,E)=>ge.send({type:"createProject",name:w,root:E}))}function Pi(m){const w=Fe(m);w&&sr(w,E=>{E.name!==(w.name??"")&&ge.send({type:"rename",id:m,name:E.name}),E.color!==w.color&&ge.send({type:"color",id:m,color:E.color})},()=>Ii(w),{open:qe.isOpen,onToggle:()=>{qe.isOpen||Oe(m),qe.toggle()}})}function Ii(m){xi("Delete session",`Slot ${m.slot} — ${m.cwd}. The slot goes back to empty.`,()=>ge.send({type:"kill",id:m.id}))}function br(m){const w=Ce.find(E=>E.id===m);w&&Li({title:"Project settings",name:w.name,root:w.root,rootLocked:!0,onDelete:()=>{const E=w.sessions.length;xi(`Delete ${w.name}?`,E>0?`This kills ${E} session${E===1?"":"s"} in this project.`:"This project has no running sessions.",()=>ge.send({type:"deleteProject",projectId:m}))}},E=>ge.send({type:"renameProject",projectId:m,name:E}))}function wr(){if(Ce.length>0){vt=!1;return}vt||Ye()||(vt=!0,Oi(!0))}document.addEventListener("keydown",m=>{if(Ye())return yr(m);Rt(m)&&(m.preventDefault(),Fi())});document.addEventListener("click",()=>{Ye()||Ae!=="ring"||!le||ve.focus()});function Fi(){Ye()||(ut(),pe="picker",Qs(It(),Ce,ki(),{onPickSlot:m=>{pe=null,Ti(m)},onPickProject:m=>{pe=null,lt(m)},onNextDone:()=>{pe=null,Ft()},onNewSession:()=>{pe=null,Hi()}}))}function Hi(){const m=He(),w=[...Array(m)].map((E,D)=>D+1).find(E=>!Be(E));w?Ht(w):$e(`all ${m} slots are full`)}function yr(m){if(pe===null)return;if(pe==="projects"){const B=Number(m.key);if(B>=1&&B<=9&&Ce[B-1]){m.preventDefault();const H=Ce[B-1];re(),pe=null,lt(H.id);return}}const w=Vi(m);if(w!==null&&w<=He()&&pe==="picker"){m.preventDefault(),re(),pe=null,Ti(w);return}if(Rt(m)||m.code==="Space"){m.preventDefault(),re(),pe=null,bt&&Oe(bt);return}const E=Xi(m);if(!E)return;m.preventDefault();const D=le?Fe(le):void 0;switch(E){case"close":re(),pe=null;break;case"next-done":re(),pe=null,Ft();break;case"projects":re(),pe="projects",er(Ce,B=>{pe=null,lt(B)});break;case"new-session":re(),pe=null,Hi();break;case"rename":if(!D)break;re(),pe=null,Pi(D.id);break;case"kill":if(!D)break;re(),pe=null,Ii(D);break;case"mark-seen":D&&ge.send({type:"ack",id:D.id}),re(),pe=null;break}}let De=null;function $e(m){$t(),De=document.createElement("div"),De.id="toast",De.textContent=m,document.body.append(De)}function $t(){De==null||De.remove(),De=null}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});window.addEventListener("resize",()=>Ze());Ot.addEventListener("change",()=>{dt(),requestAnimationFrame(()=>Ze())});ge.connect();
|