tring-chat 0.1.11 → 0.1.13

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.
@@ -1,66 +0,0 @@
1
- var Ti=Object.defineProperty;var Bi=(C,L,D)=>L in C?Ti(C,L,{enumerable:!0,configurable:!0,writable:!0,value:D}):C[L]=D;var be=(C,L,D)=>Bi(C,typeof L!="symbol"?L+"":L,D);(function(){const L=document.createElement("link").relList;if(L&&L.supports&&L.supports("modulepreload"))return;for(const O of document.querySelectorAll('link[rel="modulepreload"]'))T(O);new MutationObserver(O=>{for(const W of O)if(W.type==="childList")for(const M of W.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&T(M)}).observe(document,{childList:!0,subtree:!0});function D(O){const W={};return O.integrity&&(W.integrity=O.integrity),O.referrerPolicy&&(W.referrerPolicy=O.referrerPolicy),O.crossOrigin==="use-credentials"?W.credentials="include":O.crossOrigin==="anonymous"?W.credentials="omit":W.credentials="same-origin",W}function T(O){if(O.ep)return;O.ep=!0;const W=D(O);fetch(O.href,W)}})();const Pi=16,Oi={code:"Space",ctrl:!0};function Ii(){const C=[];for(let L=1;L<=10;L++){const D=L===10?0:L;C.push({slot:L,code:`Digit${D}`,legend:String(D)})}for(let L=11;L<=Pi;L++){const D=L-10;C.push({slot:L,code:`Digit${D}`,ctrl:!0,legend:`Ctrl+${D}`}),C.push({slot:L,code:`Digit${D}`,shift:!0,legend:`Shift+${D}`})}return C}const Xt=Ii(),Fi={KeyN:"next-done",KeyP:"projects",KeyC:"new-session",KeyR:"rename",KeyX:"kill",KeyM:"mark-seen",Escape:"close"};function Yt(C,L){return L.code===C.code&&L.ctrlKey===!!C.ctrl&&L.shiftKey===!!C.shift&&!L.altKey&&!L.metaKey}function Et(C){return Yt(Oi,C)}function Hi(C){for(const L of Xt)if(Yt(L,C))return L.slot;return null}function $i(C){return C.ctrlKey||C.altKey||C.metaKey?null:Fi[C.code]??null}function Lt(C){return Xt.filter(L=>L.slot===C).map(L=>L.legend).join(" / ")}function Ni(C){const L=C.indexOf(0);return L<0?null:{id:new TextDecoder().decode(C.subarray(0,L)),data:C.subarray(L+1)}}const $t="tring.token";function Wi(C,L,D){const T=new URLSearchParams(C).get("token");if(T){try{L.setItem($t,T)}catch{}try{D==null||D()}catch{}return T}try{return L.getItem($t)??void 0}catch{return}}const xt=location.origin,Ue=Wi(location.search,localStorage,()=>{const C=new URL(location.href);C.searchParams.delete("token"),history.replaceState(null,"",`${C.pathname}${C.search}${C.hash}`)});async function Jt(C){const L=await fetch(`${xt}${C}`,{headers:Ue?{authorization:`Bearer ${Ue}`}:{}}),D=await L.json().catch(()=>({}));if(!L.ok)throw new Error(D.error??`request failed (${L.status})`);return D}async function Ui(C){const L=await fetch(`${xt}/api/upload`,{method:"POST",headers:{...Ue?{authorization:`Bearer ${Ue}`}:{},"content-type":C.type||"application/octet-stream"},body:C}),D=await L.json().catch(()=>({}));if(!L.ok||!D.path)throw new Error(D.error??`upload failed (${L.status})`);return D.path}class zi{constructor(L,D=Ue){be(this,"ws",null);be(this,"retry",0);be(this,"closed",!1);this.h=L,this.token=D}connect(){const L=xt.replace(/^http/,"ws"),D=new WebSocket(L);D.binaryType="arraybuffer",this.ws=D,D.onopen=()=>{this.retry=0,this.send({type:"hello",...this.token?{token:this.token}:{}}),this.h.onOpen()},D.onmessage=T=>{if(T.data instanceof ArrayBuffer){const O=Ni(new Uint8Array(T.data));O&&this.h.onOutput(O.id,O.data);return}this.h.onMessage(JSON.parse(String(T.data)))},D.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(L){var D;((D=this.ws)==null?void 0:D.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(L))}dispose(){var L;this.closed=!0,(L=this.ws)==null||L.close()}}var Zt={exports:{}};(function(C,L){(function(D,T){C.exports=T()})(globalThis,()=>(()=>{var D={4567:function(M,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<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=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>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.AccessibilityManager=void 0;const n=a(9042),c=a(9924),p=a(844),f=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends p.Disposable{constructor(i,s,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,p.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let s=0;s<i;s++)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+=n.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 m=d.lines.get(d.ydisp+_),u=[],v=(m==null?void 0:m.translateToString(!0,void 0,void 0,u))||"",S=(d.ydisp+_+1).toString(),E=this._rowElements[_];E&&(v.length===0?(E.innerText=" ",this._rowColumns.set(E,[0,1])):(E.textContent=v,this._rowColumns.set(E,u)),E.setAttribute("aria-posinset",S),E.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 _,m;if(s===0?(_=d,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(_=this._rowElements.shift(),m=d,this._rowContainer.removeChild(_)),_.removeEventListener("focus",this._topBoundaryFocusListener),m.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:S,offset:E})=>{const w=S instanceof Text?S.parentNode:S;let y=parseInt(w==null?void 0:w.getAttribute("aria-posinset"),10)-1;if(isNaN(y))return console.warn("row is invalid. Race condition?"),null;const k=this._rowColumns.get(w);if(!k)return console.warn("columns is null. Race condition?"),null;let I=E<k.length?k[E]:k.slice(-1)[0]+1;return I>=this._terminal.cols&&(++y,I=0),{row:y,column:I}},m=_(s),u=_(d);if(m&&u){if(m.row>u.row||m.row===u.row&&m.column>=u.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(u.row-m.row)*this._terminal.cols-m.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=r=h([l(1,o.IInstantiationService),l(2,f.ICoreBrowserService),l(3,f.IRenderService)],r)},3614:(M,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,p){return p?"\x1B[200~"+c+"\x1B[201~":c}function l(c,p,f,o){c=h(c=a(c),f.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),f.triggerDataEvent(c,!0),p.value=""}function n(c,p,f){const o=f.getBoundingClientRect(),e=c.clientX-o.left-10,r=c.clientY-o.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${e}px`,p.style.top=`${r}px`,p.style.zIndex="1000",p.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,p){c.clipboardData&&c.clipboardData.setData("text/plain",p.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,p,f,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),p,f,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(c,p,f,o,e){n(c,p,f),e&&o.rightClickSelect(c),p.value=o.selectionText,p.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,n,c){this._css.set(l,n,c)}getCss(l,n){return this._css.get(l,n)}setColor(l,n,c){this._color.set(l,n,c)}getColor(l,n){return this._color.get(l,n)}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,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},3551:function(M,t,a){var h=this&&this.__decorate||function(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),c=a(8460),p=a(844),f=a(2585),o=a(4725);let e=t.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(r,i,s,d,g){super(),this._element=r,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,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.toDisposable)(()=>{var _;this._lastMouseEvent=void 0,(_=this._activeProviderReplies)==null||_.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const s=r.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(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,i){var d,g;this._activeProviderReplies&&i||((d=this._activeProviderReplies)==null||d.forEach(_=>{_==null||_.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=r.y);let s=!1;for(const[_,m]of this._linkProviderService.linkProviders.entries())i?(g=this._activeProviderReplies)!=null&&g.get(_)&&(s=this._checkLinkProviderResult(_,r,s)):m.provideLinks(r.y,u=>{var S,E;if(this._isMouseOut)return;const v=u==null?void 0:u.map(w=>({link:w}));(S=this._activeProviderReplies)==null||S.set(_,v),s=this._checkLinkProviderResult(_,r,s),((E=this._activeProviderReplies)==null?void 0:E.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)})}_removeIntersectingLinks(r,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 m=g[_],u=m.link.range.start.y<r?0:m.link.range.start.x,v=m.link.range.end.y>r?this._bufferService.cols:m.link.range.end.x;for(let S=u;S<=v;S++){if(s.has(S)){g.splice(_--,1);break}s.add(S)}}}}_checkLinkProviderResult(r,i,s){var _;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(r);let g=!1;for(let m=0;m<r;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(g=!0);if(!g&&d){const m=d.find(u=>this._linkAtPosition(u.link,i));m&&(s=!0,this._handleNewLink(m))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let m=0;m<this._activeProviderReplies.size;m++){const u=(_=this._activeProviderReplies.get(m))==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(r){if(!this._currentLink)return;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,i){this._currentLink&&this._lastMouseEvent&&(!r||!i||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(r.link,i)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.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(r.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(r,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&&r.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(s,i.text)}_fireUnderlineEvent(r,i){const s=r.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(r,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&&r.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(s,i.text)}_linkAtPosition(r,i){const s=r.range.start.y*this._bufferService.cols+r.range.start.x,d=r.range.end.y*this._bufferService.cols+r.range.end.x,g=i.y*this._bufferService.cols+i.x;return s<=g&&g<=d}_positionFromMouseEvent(r,i,s){const d=s.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,s,d,g){return{x1:r,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,f.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,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=a(511),c=a(2585);let p=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){var v;const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],s=this._optionsService.rawOptions.linkHandler,d=new n.CellData,g=r.getTrimmedLength();let _=-1,m=-1,u=!1;for(let S=0;S<g;S++)if(m!==-1||r.hasContent(S)){if(r.loadCell(S,d),d.hasExtendedAttrs()&&d.extended.urlId){if(m===-1){m=S,_=d.extended.urlId;continue}u=d.extended.urlId!==_}else m!==-1&&(u=!0);if(u||m!==-1&&S===g-1){const E=(v=this._oscLinkService.getLinkData(_))==null?void 0:v.uri;if(E){const w={start:{x:m+1,y:o},end:{x:S+(u||S!==g-1?0:1),y:o}};let y=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const k=new URL(E);["http:","https:"].includes(k.protocol)||(y=!0)}catch{y=!0}y||i.push({text:E,range:w,activate:(k,I)=>s?s.activate(k,I,w):f(0,I),hover:(k,I)=>{var $;return($=s==null?void 0:s.hover)==null?void 0:$.call(s,k,I,w)},leave:(k,I)=>{var $;return($=s==null?void 0:s.leave)==null?void 0:$.call(s,k,I,w)}})}u=!1,d.hasExtendedAttrs()&&d.extended.urlId?(m=S,_=d.extended.urlId):(m=-1,_=-1)}}e(i)}};function f(o,e){if(confirm(`Do you want to navigate to ${e}?
4
-
5
- WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=p=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],p)},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),n=a(3551),c=a(9042),p=a(3730),f=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),s=a(428),d=a(4269),g=a(5114),_=a(8934),m=a(3230),u=a(9312),v=a(4725),S=a(6731),E=a(8055),w=a(8969),y=a(8460),k=a(844),I=a(6114),$=a(8437),H=a(2584),F=a(7399),b=a(5941),R=a(9074),A=a(2585),B=a(5435),U=a(4567),j=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 k.MutableDisposable),this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new y.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new y.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new y.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new y.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new y.EventEmitter),this._onBlur=this.register(new y.EventEmitter),this._onA11yCharEmitter=this.register(new y.EventEmitter),this._onA11yTabEmitter=this.register(new y.EventEmitter),this._onWillOpen=this.register(new y.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(R.DecorationService),this._instantiationService.setService(A.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(j.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((x,z)=>this.refresh(x,z))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(x=>this._reportWindowsOptions(x))),this.register(this._inputHandler.onColor(x=>this._handleColorEvent(x))),this.register((0,y.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,y.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,y.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,y.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(x=>this._afterResize(x.cols,x.rows))),this.register((0,k.toDisposable)(()=>{var x,z;this._customKeyEventHandler=void 0,(z=(x=this.element)==null?void 0:x.parentNode)==null||z.removeChild(this.element)}))}_handleColorEvent(P){if(this._themeService)for(const x of P){let z,N="";switch(x.index){case 256:z="foreground",N="10";break;case 257:z="background",N="11";break;case 258:z="cursor",N="12";break;default:z="ansi",N="4;"+x.index}switch(x.type){case 0:const G=E.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[x.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${N};${(0,b.toRgbString)(G)}${H.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors(K=>K.ansi[x.index]=E.channels.toColor(...x.color));else{const K=z;this._themeService.modifyColors(Q=>Q[K]=E.channels.toColor(...x.color))}break;case 2:this._themeService.restoreColor(x.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(H.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(H.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,x=this.buffer.lines.get(P);if(!x)return;const z=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,G=x.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=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",x=>{this.hasSelection()&&(0,h.copyHandler)(x,this._selectionService)}));const P=x=>(0,h.handlePasteEvent)(x,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",x=>{x.button===2&&(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",x=>{(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",x=>{x.button===1&&(0,h.moveTextAreaUnderMouseCursor)(x,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 x=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),x.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",N=>this.updateCursorStyle(N))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),x.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",N=>this._handleTextAreaFocus(N))),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(S.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(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(N=>this._onRender.fire(N))),this.onResize(N=>this._renderService.resize(N.cols,N.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.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(n.Linkifier,this.screenElement)),this.element.appendChild(x);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(f.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(N=>this.scrollLines(N.amount,N.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(N=>this.scrollLines(N.amount,N.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,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",N=>this._selectionService.handleMouseDown(N))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",N=>this._handleScreenReaderModeOptionChange(N))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",N=>{!this._overviewRulerRenderer&&N&&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,x=this.element;function z(K){const Q=P._mouseService.getMouseReportCoords(K,P.screenElement);if(!Q)return!1;let J,ne;switch(K.overrideType||K.type){case"mousemove":ne=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":ne=0,J=K.button<3?K.button:3;break;case"mousedown":ne=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;ne=K.deltaY<0?0:1,J=4;break;default:return!1}return!(ne===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:ne,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:K=>(z(K),K.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.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?N.mousemove||(x.addEventListener("mousemove",G.mousemove),N.mousemove=G.mousemove):(x.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&K?N.wheel||(x.addEventListener("wheel",G.wheel,{passive:!1}),N.wheel=G.wheel):(x.removeEventListener("wheel",N.wheel),N.wheel=null),2&K?N.mouseup||(N.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&K?N.mousedrag||(N.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(x,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return z(K),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(K)})),this.register((0,l.addDisposableDomListener)(x,"wheel",K=>{if(!N.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=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let ne="";for(let ue=0;ue<Math.abs(Q);ue++)ne+=J;return this.coreService.triggerDataEvent(ne,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(x,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,l.addDisposableDomListener)(x,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(P,x){var z;(z=this._renderService)==null||z.refreshRows(P,x)}updateCursorStyle(P){var x;(x=this._selectionService)!=null&&x.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,x,z=0){var N;z===1?(super.scrollLines(P,x,z),this.refresh(0,this.rows-1)):(N=this.viewport)==null||N.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 x=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),x}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,x,z){this._selectionService.setSelection(P,x,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,x){var z;(z=this._selectionService)==null||z.selectLines(P,x)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;const x=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!x&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;x||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 N=this.rows-1;return this.scrollLines(z.type===2?-N:N),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!==H.C0.ETX&&z.key!==H.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,x){const z=P.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||P.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||P.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?z:z&&(!x.keyCode||x.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||(function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18}(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)x=P.charCode;else if(P.which===null||P.which===void 0)x=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;x=P.which}return!(!x||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(x,!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 x=P.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(P),!0}return!1}resize(P,x){P!==this.cols||x!==this.rows?super.resize(P,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,x){var z,N;(z=this._charSizeService)==null||z.measure(),(N=this.viewport)==null||N.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 x=1;x<this.rows;x++)this.buffer.lines.push(this.buffer.getBlankLine($.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 x,z;this.options.rows=this.rows,this.options.cols=this.cols;const P=this._customKeyEventHandler;this._setup(),super.reset(),(x=this._selectionService)==null||x.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(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case B.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const x=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${z};${x}t`);break;case B.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const N=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${G};${N}t`)}}cancel(P,x){if(this.options.cancelEvents||x)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 n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=n-this._lastRefreshMs,p=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},p)}}_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(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=a(3656),c=a(4725),p=a(8460),f=a(844),o=a(2585);let e=t.Viewport=class extends f.Disposable{constructor(r,i,s,d,g,_,m,u){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=s,this._optionsService=d,this._charSizeService=g,this._renderService=_,this._coreBrowserService=m,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 p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.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(r){this._viewportElement.style.backgroundColor=r.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(r){if(r)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 r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){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 r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<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(r,i){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&s<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);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(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*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:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){var u;let s,d="";const g=[],_=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let v=r;v<_;v++){const S=m.get(v);if(!S)continue;const E=(u=m.get(v+1))==null?void 0:u.isWrapped;if(d+=S.translateToString(!E),!E||v===m.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(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.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):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&i.altKey||s==="ctrl"&&i.ctrlKey||s==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,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,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=a(4725),c=a(844),p=a(2585);let f=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,r,i,s){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,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 r=o.options.x??0;return r&&r>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 r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose(()=>{this._decorationElements.delete(o),r.remove()})),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*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=f=h([l(1,p.IBufferService),l(2,n.ICoreBrowserService),l(3,p.IDecorationService),l(4,n.IRenderService)],f)},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 m,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 S=s.length-1;S>=0;S--)(m=s[S])&&(v=(u<3?m(v):u>3?m(d,g,v):m(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 n=a(5871),c=a(4725),p=a(844),f=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,g,_,m,u,v){var E;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=g,this._decorationService=_,this._renderService=m,this._optionsService=u,this._coreBrowserService=v,this._colorZoneStore=new n.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(),(E=this._viewportElement.parentElement)==null||E.insertBefore(this._canvas,this._viewportElement);const S=this._canvas.getContext("2d");if(!S)throw new Error("Ctx cannot be null");this._ctx=S,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.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(),r.full=0,r.left=0,r.center=e.left,r.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(r[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,f.IBufferService),l(3,f.IDecorationService),l(4,c.IRenderService),l(5,f.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=a(4725),c=a(2585),p=a(2584);let f=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,s,d){this._textarea=o,this._compositionView=e,this._bufferService=r,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 r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!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,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${p.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),r=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=r+"px",this._compositionView.style.lineHeight=r+"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=f=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,n.IRenderService)],f)},9806:(M,t)=>{function a(h,l,n){const c=n.getBoundingClientRect(),p=h.getComputedStyle(n),f=parseInt(p.getPropertyValue("padding-left")),o=parseInt(p.getPropertyValue("padding-top"));return[l.clientX-c.left-f,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,n,c,p,f,o,e,r){if(!f)return;const i=a(h,l,n);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),p),i):void 0}},9504:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,r,i,s){const d=e-n(e,i),g=r-n(r,i),_=Math.abs(d-g)-function(m,u,v){let S=0;const E=m-n(m,v),w=u-n(u,v);for(let y=0;y<Math.abs(E-w);y++){const k=c(m,u)==="A"?-1:1,I=v.buffer.lines.get(E+k*y);I!=null&&I.isWrapped&&S++}return S}(e,r,i);return o(_,f(c(e,r),s))}function n(e,r){let i=0,s=r.buffer.lines.get(e),d=s==null?void 0:s.isWrapped;for(;d&&e>=0&&e<r.rows;)i++,s=r.buffer.lines.get(--e),d=s==null?void 0:s.isWrapped;return i}function c(e,r){return e>r?"A":"B"}function p(e,r,i,s,d,g){let _=e,m=r,u="";for(;_!==i||m!==s;)_+=d?1:-1,d&&_>g.cols-1?(u+=g.buffer.translateBufferLineToString(m,!1,e,_),_=0,e=0,m++):!d&&_<0&&(u+=g.buffer.translateBufferLineToString(m,!1,0,e+1),_=g.cols-1,e=_,m--);return u+g.buffer.translateBufferLineToString(m,!1,e,_)}function f(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=r;return i}t.moveToCellSequence=function(e,r,i,s){const d=i.buffer.x,g=i.buffer.y;if(!i.buffer.hasScrollback)return function(u,v,S,E,w,y){return l(v,E,w,y).length===0?"":o(p(u,v,u,v-n(v,w),!1,w).length,f("D",y))}(d,g,0,r,i,s)+l(g,r,i,s)+function(u,v,S,E,w,y){let k;k=l(v,E,w,y).length>0?E-n(E,w):v;const I=E,$=function(H,F,b,R,A,B){let U;return U=l(b,R,A,B).length>0?R-n(R,A):F,H<b&&U<=R||H>=b&&U<R?"C":"D"}(u,v,S,E,w,y);return o(p(u,k,S,I,$==="C",w).length,f($,y))}(d,g,e,r,i,s);let _;if(g===r)return _=d>e?"D":"C",o(Math.abs(d-e),f(_,s));_=g>r?"D":"C";const m=Math.abs(g-r);return o(function(u,v){return v.cols-u}(g>r?e:d,i)+(m-1)*i.cols+1+((g>r?d:e)-1),f(_,s))}},1296:function(M,t,a){var h=this&&this.__decorate||function(y,k,I,$){var H,F=arguments.length,b=F<3?k:$===null?$=Object.getOwnPropertyDescriptor(k,I):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(y,k,I,$);else for(var R=y.length-1;R>=0;R--)(H=y[R])&&(b=(F<3?H(b):F>3?H(k,I,b):H(k,I))||b);return F>3&&b&&Object.defineProperty(k,I,b),b},l=this&&this.__param||function(y,k){return function(I,$){k(I,$,y)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=a(3787),c=a(2550),p=a(2223),f=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),s=a(844),d=a(2585),g="xterm-dom-renderer-owner-",_="xterm-rows",m="xterm-fg-",u="xterm-bg-",v="xterm-focus",S="xterm-selection";let E=1,w=t.DomRenderer=class extends s.Disposable{constructor(y,k,I,$,H,F,b,R,A,B,U,j,Y){super(),this._terminal=y,this._document=k,this._element=I,this._screenElement=$,this._viewportElement=H,this._helperContainer=F,this._linkifier2=b,this._charSizeService=A,this._optionsService=B,this._bufferService=U,this._coreBrowserService=j,this._themeService=Y,this._terminalClass=E++,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(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,f.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=R.createInstance(n.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 y=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*y,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*y),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/y),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/y),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 k=`${this._terminalSelector} .${_} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=k,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(y){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let k=`${this._terminalSelector} .${_} { color: ${y.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;k+=`${this._terminalSelector} .${_} .xterm-dim { color: ${r.color.multiplyOpacity(y.foreground,.5).css};}`,k+=`${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}`,$=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;k+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,k+=`@keyframes ${$} { 50% { box-shadow: none; }}`,k+=`@keyframes ${H} { 0% { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css}; } 50% { background-color: inherit; color: ${y.cursor.css}; }}`,k+=`${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: ${$} 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${y.cursor.css} !important; color: ${y.cursorAccent.css} !important;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${y.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${y.cursor.css} inset;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${y.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,k+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${y.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${y.selectionInactiveBackgroundOpaque.css};}`;for(const[F,b]of y.ansi.entries())k+=`${this._terminalSelector} .${m}${F} { color: ${b.css}; }${this._terminalSelector} .${m}${F}.xterm-dim { color: ${r.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${u}${F} { background-color: ${b.css}; }`;k+=`${this._terminalSelector} .${m}${p.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(y.background).css}; }${this._terminalSelector} .${m}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(y.background),.5).css}; }${this._terminalSelector} .${u}${p.INVERTED_DEFAULT_COLOR} { background-color: ${y.foreground.css}; }`,this._themeStyleElement.textContent=k}_setDefaultSpacing(){const y=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${y}px`,this._rowFactory.defaultSpacing=y}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(y,k){for(let I=this._rowElements.length;I<=k;I++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>k;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(y,k){this._refreshRowElements(y,k),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(y,k,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(y,k,I),this.renderRows(0,this._bufferService.rows-1),!y||!k)return;this._selectionRenderModel.update(this._terminal,y,k,I);const $=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(F>=this._bufferService.rows||b<0)return;const R=this._document.createDocumentFragment();if(I){const A=y[0]>k[0];R.appendChild(this._createSelectionElement(F,A?k[0]:y[0],A?y[0]:k[0],b-F+1))}else{const A=$===F?y[0]:0,B=F===H?k[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(F,A,B));const U=b-F-1;if(R.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,U)),F!==b){const j=H===b?k[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(b,0,j))}}this._selectionContainer.appendChild(R)}_createSelectionElement(y,k,I,$=1){const H=this._document.createElement("div"),F=k*this.dimensions.css.cell.width;let b=this.dimensions.css.cell.width*(I-k);return F+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-F),H.style.height=$*this.dimensions.css.cell.height+"px",H.style.top=y*this.dimensions.css.cell.height+"px",H.style.left=`${F}px`,H.style.width=`${b}px`,H}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 y of this._rowElements)y.replaceChildren()}renderRows(y,k){const I=this._bufferService.buffer,$=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let A=y;A<=k;A++){const B=A+I.ydisp,U=this._rowElements[A],j=I.lines.get(B);if(!U||!j)break;U.replaceChildren(...this._rowFactory.createRow(j,B,B===$,b,R,H,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!0)}_handleLinkLeave(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!1)}_setCellUnderline(y,k,I,$,H,F){I<0&&(y=0),$<0&&(k=0);const b=this._bufferService.rows-1;I=Math.max(Math.min(I,b),0),$=Math.max(Math.min($,b),0),H=Math.min(H,this._bufferService.cols);const R=this._bufferService.buffer,A=R.ybase+R.y,B=Math.min(R.x,H-1),U=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let V=I;V<=$;++V){const P=V+R.ydisp,x=this._rowElements[V],z=R.lines.get(P);if(!x||!z)break;x.replaceChildren(...this._rowFactory.createRow(z,P,P===A,j,Y,B,U,this.dimensions.css.cell.width,this._widthCache,F?V===I?y:0:-1,F?(V===$?k:H)-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(_,m,u,v){var S,E=arguments.length,w=E<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(_,m,u,v);else for(var y=_.length-1;y>=0;y--)(S=_[y])&&(w=(E<3?S(w):E>3?S(m,u,w):S(m,u))||w);return E>3&&w&&Object.defineProperty(m,u,w),w},l=this&&this.__param||function(_,m){return function(u,v){m(u,v,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=a(2223),c=a(643),p=a(511),f=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),s=a(3734);let d=t.DomRendererRowFactory=class{constructor(_,m,u,v,S,E,w){this._document=_,this._characterJoinerService=m,this._optionsService=u,this._coreBrowserService=v,this._coreService=S,this._decorationService=E,this._themeService=w,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(_,m,u){this._selectionStart=_,this._selectionEnd=m,this._columnSelectMode=u}createRow(_,m,u,v,S,E,w,y,k,I,$){const H=[],F=this._characterJoinerService.getJoinedCharacters(m),b=this._themeService.colors;let R,A=_.getNoBgTrimmedLength();u&&A<E+1&&(A=E+1);let B=0,U="",j=0,Y=0,V=0,P=!1,x=0,z=!1,N=0;const G=[],K=I!==-1&&$!==-1;for(let Q=0;Q<A;Q++){_.loadCell(Q,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let ne=!1,ue=Q,Z=this._workCell;if(F.length>0&&Q===F[0][0]){ne=!0;const ee=F.shift();Z=new r.JoinedCellData(this._workCell,_.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),ue=ee[1]-1,J=Z.getWidth()}const Ce=this._isCellInSelection(Q,m),Me=u&&Q===E,re=K&&Q>=I&&Q<=$;let te=!1;this._decorationService.forEachDecorationAtCell(Q,m,void 0,ee=>{te=!0});let ie=Z.getChars()||c.WHITESPACE_CELL_CHAR;if(ie===" "&&(Z.isUnderline()||Z.isOverline())&&(ie=" "),N=J*y-k.get(ie,Z.isBold(),Z.isItalic()),R){if(B&&(Ce&&z||!Ce&&!z&&Z.bg===j)&&(Ce&&z&&b.selectionForeground||Z.fg===Y)&&Z.extended.ext===V&&re===P&&N===x&&!Me&&!ne&&!te){Z.isInvisible()?U+=c.WHITESPACE_CELL_CHAR:U+=ie,B++;continue}B&&(R.textContent=U),R=this._document.createElement("span"),B=0,U=""}else R=this._document.createElement("span");if(j=Z.bg,Y=Z.fg,V=Z.extended.ext,P=re,x=N,z=Ce,ne&&E>=Q&&E<=ue&&(E=Q),!this._coreService.isCursorHidden&&Me&&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(S)switch(S){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())R.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ee=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ee<8&&(ee+=8),R.style.textDecorationColor=b.ansi[ee].css}Z.isOverline()&&(G.push("xterm-overline"),U===" "&&(U=" ")),Z.isStrikethrough()&&G.push("xterm-strikethrough"),re&&(R.style.textDecoration="underline");let X=Z.getFgColor(),se=Z.getFgColorMode(),de=Z.getBgColor(),le=Z.getBgColorMode();const we=!!Z.isInverse();if(we){const ee=X;X=de,de=ee;const Fe=se;se=le,le=Fe}let ve,Se,_e,he=!1;switch(this._decorationService.forEachDecorationAtCell(Q,m,void 0,ee=>{ee.options.layer!=="top"&&he||(ee.backgroundColorRGB&&(le=50331648,de=ee.backgroundColorRGB.rgba>>8&16777215,ve=ee.backgroundColorRGB),ee.foregroundColorRGB&&(se=50331648,X=ee.foregroundColorRGB.rgba>>8&16777215,Se=ee.foregroundColorRGB),he=ee.options.layer==="top")}),!he&&Ce&&(ve=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,de=ve.rgba>>8&16777215,le=50331648,he=!0,b.selectionForeground&&(se=50331648,X=b.selectionForeground.rgba>>8&16777215,Se=b.selectionForeground)),he&&G.push("xterm-decoration-top"),le){case 16777216:case 33554432:_e=b.ansi[de],G.push(`xterm-bg-${de}`);break;case 50331648:_e=o.channels.toColor(de>>16,de>>8&255,255&de),this._addStyle(R,`background-color:#${g((de>>>0).toString(16),"0",6)}`);break;default:we?(_e=b.foreground,G.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):_e=b.background}switch(ve||Z.isDim()&&(ve=o.color.multiplyOpacity(_e,.5)),se){case 16777216:case 33554432:Z.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(R,_e,b.ansi[X],Z,ve,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(R,_e,ee,Z,ve,Se)||this._addStyle(R,`color:#${g(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,_e,b.foreground,Z,ve,Se)||we&&G.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}G.length&&(R.className=G.join(" "),G.length=0),Me||ne||te?R.textContent=U:B++,N!==this.defaultSpacing&&(R.style.letterSpacing=`${N}px`),H.push(R),Q=ue}return R&&B&&(R.textContent=U),H}_applyMinimumContrast(_,m,u,v,S,E){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(v.getCode()))return!1;const w=this._getContrastCache(v);let y;if(S||E||(y=w.getColor(m.rgba,u.rgba)),y===void 0){const k=this._optionsService.rawOptions.minimumContrastRatio/(v.isDim()?2:1);y=o.color.ensureContrastRatio(S||m,E||u,k),w.setColor((S||m).rgba,(E||u).rgba,y??null)}return!!y&&(this._addStyle(_,`color:${y.css}`),!0)}_getContrastCache(_){return _.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(_,m){_.setAttribute("style",`${_.getAttribute("style")||""}${m};`)}_isCellInSelection(_,m){const u=this._selectionStart,v=this._selectionEnd;return!(!u||!v)&&(this._columnSelectMode?u[0]<=v[0]?_>=u[0]&&m>=u[1]&&_<v[0]&&m<=v[1]:_<u[0]&&m>=u[1]&&_>=v[0]&&m<=v[1]:m>u[1]&&m<v[1]||u[1]===v[1]&&m===u[1]&&_>=u[0]&&_<v[0]||u[1]<v[1]&&m===v[1]&&_<v[0]||u[1]<v[1]&&m===u[1]&&_>=u[0])}};function g(_,m,u){for(;_.length<u;)_=m+_;return _}t.DomRendererRowFactory=d=h([l(1,e.ICharacterJoinerService),l(2,f.IOptionsService),l(3,e.ICoreBrowserService),l(4,f.ICoreService),l(5,f.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 n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const p=a.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[l,n,c,p],this._container.appendChild(l),this._container.appendChild(n),this._container.appendChild(c),this._container.appendChild(p),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,n){a===this._font&&h===this._fontSize&&l===this._weight&&n===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(a,h,l){let n=0;if(!h&&!l&&a.length===1&&(n=a.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const f=this._measure(a,0);return f>0&&(this._flat[n]=f),f}let c=a;h&&(c+="B"),l&&(c+="I");let p=this._holey.get(c);if(p===void 0){let f=0;h&&(f|=1),l&&(f|=2),p=this._measure(a,f),p>0&&this._holey.set(c,p)}return p}_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,n,c,p){return n===1&&c>Math.ceil(1.5*p)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(f){return 57344<=f&&f<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=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,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},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,n,c,p=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const f=l.buffers.active.ydisp,o=n[1]-f,e=c[1]-f,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=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 _,m=arguments.length,u=m<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=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>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 n=a(2585),c=a(8460),p=a(844);let f=t.CharSizeService=class extends p.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 r(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=f=h([l(2,n.IOptionsService)],f);class o extends p.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 r 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(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=a(3734),c=a(643),p=a(511),f=a(2585);class o extends n.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 Qt{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.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,m=0,u=0,v=s.getFg(0),S=s.getBg(0);for(let E=0;E<s.getTrimmedLength();E++)if(s.loadCell(E,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==v||this._workCell.bg!==S){if(E-_>1){const w=this._getJoinedRanges(g,u,m,s,_);for(let y=0;y<w.length;y++)d.push(w[y])}_=E,u=m,v=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-_>1){const E=this._getJoinedRanges(g,u,m,s,_);for(let w=0;w<E.length;w++)d.push(E[w])}return d}_getJoinedRanges(i,s,d,g,_){const m=i.substring(s,d);let u=[];try{u=this._characterJoiners[0].handler(m)}catch(v){console.error(v)}for(let v=1;v<this._characterJoiners.length;v++)try{const S=this._characterJoiners[v].handler(m);for(let E=0;E<S.length;E++)Qt._mergeRanges(u,S[E])}catch(S){console.error(S)}return this._stringRangesToCellRanges(u,g,_),u}_stringRangesToCellRanges(i,s,d){let g=0,_=!1,m=0,u=i[g];if(u){for(let v=d;v<this._bufferService.cols;v++){const S=s.getWidth(v),E=s.getString(v).length||c.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!_&&u[0]<=m&&(u[0]=v,_=!0),u[1]<=m){if(u[1]=v,u=i[++g],!u)break;u[0]<=m?(u[0]=v,_=!0):_=!1}m+=E}}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,f.IBufferService)],e)},5114:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),n=a(3656);class c extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(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 p 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,n.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 p=this.linkProviders.indexOf(c);p!==-1&&this.linkProviders.splice(p,1)}}}}t.LinkProviderService=l},8934:function(M,t,a){var h=this&&this.__decorate||function(f,o,e,r){var i,s=arguments.length,d=s<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(f,o,e,r);else for(var g=f.length-1;g>=0;g--)(i=f[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(f,o){return function(e,r){o(e,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=a(4725),c=a(9806);let p=t.MouseService=class{constructor(f,o){this._renderService=f,this._charSizeService=o}getCoords(f,o,e,r,i){return(0,c.getCoords)(window,f,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(f,o){const e=(0,c.getCoordsRelativeToElement)(window,f,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=p=h([l(0,n.IRenderService),l(1,n.ICharSizeService)],p)},3230:function(M,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<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=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>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 n=a(6193),c=a(4725),p=a(8460),f=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends f.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,s,d,g,_,m,u,v){super(),this._rowCount=i,this._charSizeService=g,this._renderer=this.register(new f.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new f.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 p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((S,E)=>this._renderRows(S,E),u),this.register(this._renderDebouncer),this.register(u.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>{var S;return(S=this._renderer.value)==null?void 0:S.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(m.cols,m.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(v.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(u.window,s),this.register(u.onWindowChange(S=>this._registerIntersectionObserver(S,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,f.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=r=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)],r)},9312:function(M,t,a){var h=this&&this.__decorate||function(u,v,S,E){var w,y=arguments.length,k=y<3?v:E===null?E=Object.getOwnPropertyDescriptor(v,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(u,v,S,E);else for(var I=u.length-1;I>=0;I--)(w=u[I])&&(k=(y<3?w(k):y>3?w(v,S,k):w(v,S))||k);return y>3&&k&&Object.defineProperty(v,S,k),k},l=this&&this.__param||function(u,v){return function(S,E){v(S,E,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=a(9806),c=a(9504),p=a(456),f=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),s=a(511),d=a(2585),g=" ",_=new RegExp(g,"g");let m=t.SelectionService=class extends e.Disposable{constructor(u,v,S,E,w,y,k,I,$){super(),this._element=u,this._screenElement=v,this._linkifier=S,this._bufferService=E,this._coreService=w,this._mouseService=y,this._optionsService=k,this._renderService=I,this._coreBrowserService=$,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=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(H=>this._handleTrim(H)),this.register(this._bufferService.buffers.onBufferActivate(H=>this._handleBufferActivate(H))),this.enable(),this._model=new p.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 S=this._bufferService.buffer,E=[];if(this._activeSelectionMode===3){if(u[0]===v[0])return"";const w=u[0]<v[0]?u[0]:v[0],y=u[0]<v[0]?v[0]:u[0];for(let k=u[1];k<=v[1];k++){const I=S.translateBufferLineToString(k,!0,w,y);E.push(I)}}else{const w=u[1]===v[1]?v[0]:void 0;E.push(S.translateBufferLineToString(u[1],!0,u[0],w));for(let y=u[1]+1;y<=v[1]-1;y++){const k=S.lines.get(y),I=S.translateBufferLineToString(y,!0);k!=null&&k.isWrapped?E[E.length-1]+=I:E.push(I)}if(u[1]!==v[1]){const y=S.lines.get(v[1]),k=S.translateBufferLineToString(v[1],!0,0,v[0]);y&&y.isWrapped?E[E.length-1]+=k:E.push(k)}}return E.map(w=>w.replace(_," ")).join(r.isWindows?`\r
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())),r.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),S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!!(S&&E&&v)&&this._areCoordsInSelection(v,S,E)}isCellInSelection(u,v){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E)&&this._areCoordsInSelection([u,v],S,E)}_areCoordsInSelection(u,v,S){return u[1]>v[1]&&u[1]<S[1]||v[1]===S[1]&&u[1]===v[1]&&u[0]>=v[0]&&u[0]<S[0]||v[1]<S[1]&&u[1]===S[1]&&u[0]<S[0]||v[1]<S[1]&&u[1]===v[1]&&u[0]>=v[0]}_selectWordAtCursor(u,v){var w,y;const S=(y=(w=this._linkifier.currentLink)==null?void 0:w.link)==null?void 0:y.range;if(S)return this._model.selectionStart=[S.start.x-1,S.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const E=this._getMouseBufferCoords(u);return!!E&&(this._selectWordAt(E,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,n.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const S=this._renderService.dimensions.css.canvas.height;return v>=0&&v<=S?0:(v>S&&(v-=S),v=Math.min(Math.max(v,-50),50),v/=50,v/Math.abs(v)+Math.round(14*v))}shouldForceSelection(u){return r.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&&!(r.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 S=this._bufferService.buffer;if(this._model.selectionEnd[1]<S.lines.length){const E=S.lines.get(this._model.selectionEnd[1]);E&&E.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 S=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const E=(0,c.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(E,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd,S=!(!u||!v||u[0]===v[0]&&u[1]===v[1]);S?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,S)):this._oldHasSelection&&this._fireOnSelectionChange(u,v,S)}_fireOnSelectionChange(u,v,S){this._oldSelectionStart=u,this._oldSelectionEnd=v,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim(v=>this._handleTrim(v))}_convertViewportColToCharacterIndex(u,v){let S=v;for(let E=0;v>=E;E++){const w=u.loadCell(E,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:w>1&&v!==E&&(S+=w-1)}return S}setSelection(u,v,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,v],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,v,S=!0,E=!0){if(u[0]>=this._bufferService.cols)return;const w=this._bufferService.buffer,y=w.lines.get(u[1]);if(!y)return;const k=w.translateBufferLineToString(u[1],!1);let I=this._convertViewportColToCharacterIndex(y,u[0]),$=I;const H=u[0]-I;let F=0,b=0,R=0,A=0;if(k.charAt(I)===" "){for(;I>0&&k.charAt(I-1)===" ";)I--;for(;$<k.length&&k.charAt($+1)===" ";)$++}else{let j=u[0],Y=u[0];y.getWidth(j)===0&&(F++,j--),y.getWidth(Y)===2&&(b++,Y++);const V=y.getString(Y).length;for(V>1&&(A+=V-1,$+=V-1);j>0&&I>0&&!this._isCharWordSeparator(y.loadCell(j-1,this._workCell));){y.loadCell(j-1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,j--):P>1&&(R+=P-1,I-=P-1),I--,j--}for(;Y<y.length&&$+1<k.length&&!this._isCharWordSeparator(y.loadCell(Y+1,this._workCell));){y.loadCell(Y+1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):P>1&&(A+=P-1,$+=P-1),$++,Y++}}$++;let B=I+H-F+R,U=Math.min(this._bufferService.cols,$-I+F+b-R-A);if(v||k.slice(I,$).trim()!==""){if(S&&B===0&&y.getCodePoint(0)!==32){const j=w.lines.get(u[1]-1);if(j&&y.isWrapped&&j.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;B-=V,U+=V}}}if(E&&B+U===this._bufferService.cols&&y.getCodePoint(this._bufferService.cols-1)!==32){const j=w.lines.get(u[1]+1);if(j!=null&&j.isWrapped&&j.getCodePoint(0)!==32){const Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:B,length:U}}}_selectWordAt(u,v){const S=this._getWordAt(u,v);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[S.start,u[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(u){const v=this._getWordAt(u,!0);if(v){let S=u[1];for(;v.start<0;)v.start+=this._bufferService.cols,S--;if(!this._model.areSelectionValuesReversed())for(;v.start+v.length>this._bufferService.cols;)v.length-=this._bufferService.cols,S++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?v.start:v.start+v.length,S]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){const v=this._bufferService.buffer.getWrappedRangeForLine(u),S={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)(S,this._bufferService.cols)}};t.SelectionService=m=h([l(3,d.IBufferService),l(4,d.ICoreService),l(5,f.IMouseService),l(6,d.IOptionsService),l(7,f.IRenderService),l(8,f.ICoreBrowserService)],m)},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(m,u,v,S){var E,w=arguments.length,y=w<3?u:S===null?S=Object.getOwnPropertyDescriptor(u,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(m,u,v,S);else for(var k=m.length-1;k>=0;k--)(E=m[k])&&(y=(w<3?E(y):w>3?E(u,v,y):E(u,v))||y);return w>3&&y&&Object.defineProperty(u,v,y),y},l=this&&this.__param||function(m,u){return function(v,S){u(v,S,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=a(7239),c=a(8055),p=a(8460),f=a(844),o=a(2585),e=c.css.toColor("#ffffff"),r=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 m=[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 S=u[v/36%6|0],E=u[v/6%6|0],w=u[v%6];m.push({css:c.channels.toCss(S,E,w),rgba:c.channels.toRgba(S,E,w)})}for(let v=0;v<24;v++){const S=8+10*v;m.push({css:c.channels.toCss(S,S,S),rgba:c.channels.toRgba(S,S,S)})}return m})());let g=t.ThemeService=class extends f.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:c.color.blend(r,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:c.color.blend(r,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(m={}){const u=this._colors;if(u.foreground=_(m.foreground,e),u.background=_(m.background,r),u.cursor=_(m.cursor,i),u.cursorAccent=_(m.cursorAccent,s),u.selectionBackgroundTransparent=_(m.selectionBackground,d),u.selectionBackgroundOpaque=c.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=_(m.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=c.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=m.selectionForeground?_(m.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]=_(m.black,t.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=_(m.red,t.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=_(m.green,t.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=_(m.yellow,t.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=_(m.blue,t.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=_(m.magenta,t.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=_(m.cyan,t.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=_(m.white,t.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=_(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=_(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=_(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=_(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=_(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=_(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=_(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=_(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const v=Math.min(u.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<v;S++)u.ansi[S+16]=_(m.extendedAnsi[S],t.DEFAULT_ANSI_COLORS[S+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(m){this._restoreColor(m),this._onChangeColors.fire(this.colors)}_restoreColor(m){if(m!==void 0)switch(m){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[m]=this._restoreColors.ansi[m]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(m){m(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 _(m,u){if(m!==void 0)try{return c.css.toColor(m)}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 n extends l.Disposable{constructor(p){super(),this._maxLength=p,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(p){if(this._maxLength===p)return;const f=new Array(p);for(let o=0;o<Math.min(p,this.length);o++)f[o]=this._array[this._getCyclicIndex(o)];this._array=f,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let f=this._length;f<p;f++)this._array[f]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,f){this._array[this._getCyclicIndex(p)]=f}push(p){this._array[this._getCyclicIndex(this._length)]=p,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(p,f,...o){if(f){for(let e=p;e<this._length-f;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+f)];this._length-=f,this.onDeleteEmitter.fire({index:p,amount:f})}for(let e=this._length-1;e>=p;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(p+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:p,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(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,f,o){if(!(f<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let r=f-1;r>=0;r--)this.set(p+r+o,this.get(p+r));const e=p+f+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<f;e++)this.set(p+e+o,this.get(p+e))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}t.CircularList=n},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 n=Array.isArray(h)?[]:{};for(const c in h)n[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return n}},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,n=0;var c,p,f,o,e;function r(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,_,m){return m!==void 0?`#${r(d)}${r(g)}${r(_)}${r(m)}`:`#${r(d)}${r(g)}${r(_)}`},s.toRgba=function(d,g,_,m=255){return(d<<24|g<<16|_<<8|m)>>>0},s.toColor=function(d,g,_,m){return{css:s.toCss(d,g,_,m),rgba:s.toRgba(d,g,_,m)}}}(c||(t.channels=c={})),function(s){function d(g,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}s.blend=function(g,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const m=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,S=g.rgba>>24&255,E=g.rgba>>16&255,w=g.rgba>>8&255;return a=S+Math.round((m-S)*n),h=E+Math.round((u-E)*n),l=w+Math.round((v-w)*n),{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,_,m){const u=e.ensureContrastRatio(g.rgba,_.rgba,m);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 n=255&g.rgba,d(g,n*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(p||(t.color=p={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const m=_.getContext("2d",{willReadFrequently:!0});m&&(d=m,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),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const m=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),c.toColor(a,h,l,n);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,n]=d.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}}(f||(t.css=f={})),function(s){function d(g,_,m){const u=g/255,v=_/255,S=m/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*(S<=.03928?S/12.92:Math.pow((S+.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(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,k=m>>8&255,I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));for(;I<u&&(w>0||y>0||k>0);)w-=Math.max(0,Math.ceil(.1*w)),y-=Math.max(0,Math.ceil(.1*y)),k-=Math.max(0,Math.ceil(.1*k)),I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|k<<8|255)>>>0}function g(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,k=m>>8&255,I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));for(;I<u&&(w<255||y<255||k<255);)w=Math.min(255,w+Math.ceil(.1*(255-w))),y=Math.min(255,y+Math.ceil(.1*(255-y))),k=Math.min(255,k+Math.ceil(.1*(255-k))),I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|k<<8|255)>>>0}s.blend=function(_,m){if(n=(255&m)/255,n===1)return m;const u=m>>24&255,v=m>>16&255,S=m>>8&255,E=_>>24&255,w=_>>16&255,y=_>>8&255;return a=E+Math.round((u-E)*n),h=w+Math.round((v-w)*n),l=y+Math.round((S-y)*n),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,m,u){const v=o.relativeLuminance(_>>8),S=o.relativeLuminance(m>>8);if(i(v,S)<u){if(S<v){const y=d(_,m,u),k=i(v,o.relativeLuminance(y>>8));if(k<u){const I=g(_,m,u);return k>i(v,o.relativeLuminance(I>>8))?y:I}return y}const E=g(_,m,u),w=i(v,o.relativeLuminance(E>>8));if(w<u){const y=d(_,m,u);return w>i(v,o.relativeLuminance(y>>8))?E:y}return E}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),n=a(4348),c=a(7866),p=a(744),f=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),s=a(7994),d=a(9282),g=a(5435),_=a(5981),m=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(E=>{var w;(w=this._onScrollApi)==null||w.fire(E.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(E){for(const w in E)this.optionsService.options[w]=E[w]}constructor(E){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 n.InstantiationService,this.optionsService=this.register(new f.OptionsService(E)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.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(r.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(m.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,y)=>this._inputHandler.parse(w,y))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(E,w){this._writeBuffer.write(E,w)}writeSync(E,w){this._logService.logLevel<=l.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(E,w)}input(E,w=!0){this.coreService.triggerDataEvent(E,w)}resize(E,w){isNaN(E)||isNaN(w)||(E=Math.max(E,p.MINIMUM_COLS),w=Math.max(w,p.MINIMUM_ROWS),this._bufferService.resize(E,w))}scroll(E,w=!1){this._bufferService.scroll(E,w)}scrollLines(E,w,y){this._bufferService.scrollLines(E,w,y)}scrollPages(E){this.scrollLines(E*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(E){const w=E-this._bufferService.buffer.ydisp;w!==0&&this.scrollLines(w)}registerEscHandler(E,w){return this._inputHandler.registerEscHandler(E,w)}registerDcsHandler(E,w){return this._inputHandler.registerDcsHandler(E,w)}registerCsiHandler(E,w){return this._inputHandler.registerCsiHandler(E,w)}registerOscHandler(E,w){return this._inputHandler.registerOscHandler(E,w)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let E=!1;const w=this.optionsService.rawOptions.windowsPty;w&&w.buildNumber!==void 0&&w.buildNumber!==void 0?E=w.backend==="conpty"&&w.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(E=!0),E?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const E=[];E.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),E.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const w of E)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 n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].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,R,A){var B,U=arguments.length,j=U<3?b:A===null?A=Object.getOwnPropertyDescriptor(b,R):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(F,b,R,A);else for(var Y=F.length-1;Y>=0;Y--)(B=F[Y])&&(j=(U<3?B(j):U>3?B(b,R,j):B(b,R))||j);return U>3&&j&&Object.defineProperty(b,R,j),j},l=this&&this.__param||function(F,b){return function(R,A){b(R,A,F)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=a(2584),c=a(7116),p=a(2015),f=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),s=a(511),d=a(3734),g=a(2585),_=a(1480),m=a(6242),u=a(6351),v=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E=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 y;(function(F){F[F.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",F[F.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(y||(t.WindowsOptionsReportType=y={}));let k=0;class I extends f.Disposable{getAttrData(){return this._curAttrData}constructor(b,R,A,B,U,j,Y,V,P=new p.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=R,this._coreService=A,this._logService=B,this._optionsService=U,this._oscLinkService=j,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 r.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new r.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new r.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new r.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new r.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new r.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new r.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new r.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new r.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new r.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new r.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 $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(x=>this._activeBuffer=x.activeBuffer)),this._parser.setCsiHandlerFallback((x,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:z.toArray()})}),this._parser.setEscHandlerFallback(x=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(x)})}),this._parser.setExecuteHandlerFallback(x=>{this._logService.debug("Unknown EXECUTE code: ",{code:x})}),this._parser.setOscHandlerFallback((x,z,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:z,data:N})}),this._parser.setDcsHandlerFallback((x,z,N)=>{z==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:z,payload:N})}),this._parser.setPrintHandler((x,z,N)=>this.print(x,z,N)),this._parser.registerCsiHandler({final:"@"},x=>this.insertChars(x)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},x=>this.scrollLeft(x)),this._parser.registerCsiHandler({final:"A"},x=>this.cursorUp(x)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},x=>this.scrollRight(x)),this._parser.registerCsiHandler({final:"B"},x=>this.cursorDown(x)),this._parser.registerCsiHandler({final:"C"},x=>this.cursorForward(x)),this._parser.registerCsiHandler({final:"D"},x=>this.cursorBackward(x)),this._parser.registerCsiHandler({final:"E"},x=>this.cursorNextLine(x)),this._parser.registerCsiHandler({final:"F"},x=>this.cursorPrecedingLine(x)),this._parser.registerCsiHandler({final:"G"},x=>this.cursorCharAbsolute(x)),this._parser.registerCsiHandler({final:"H"},x=>this.cursorPosition(x)),this._parser.registerCsiHandler({final:"I"},x=>this.cursorForwardTab(x)),this._parser.registerCsiHandler({final:"J"},x=>this.eraseInDisplay(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},x=>this.eraseInDisplay(x,!0)),this._parser.registerCsiHandler({final:"K"},x=>this.eraseInLine(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},x=>this.eraseInLine(x,!0)),this._parser.registerCsiHandler({final:"L"},x=>this.insertLines(x)),this._parser.registerCsiHandler({final:"M"},x=>this.deleteLines(x)),this._parser.registerCsiHandler({final:"P"},x=>this.deleteChars(x)),this._parser.registerCsiHandler({final:"S"},x=>this.scrollUp(x)),this._parser.registerCsiHandler({final:"T"},x=>this.scrollDown(x)),this._parser.registerCsiHandler({final:"X"},x=>this.eraseChars(x)),this._parser.registerCsiHandler({final:"Z"},x=>this.cursorBackwardTab(x)),this._parser.registerCsiHandler({final:"`"},x=>this.charPosAbsolute(x)),this._parser.registerCsiHandler({final:"a"},x=>this.hPositionRelative(x)),this._parser.registerCsiHandler({final:"b"},x=>this.repeatPrecedingCharacter(x)),this._parser.registerCsiHandler({final:"c"},x=>this.sendDeviceAttributesPrimary(x)),this._parser.registerCsiHandler({prefix:">",final:"c"},x=>this.sendDeviceAttributesSecondary(x)),this._parser.registerCsiHandler({final:"d"},x=>this.linePosAbsolute(x)),this._parser.registerCsiHandler({final:"e"},x=>this.vPositionRelative(x)),this._parser.registerCsiHandler({final:"f"},x=>this.hVPosition(x)),this._parser.registerCsiHandler({final:"g"},x=>this.tabClear(x)),this._parser.registerCsiHandler({final:"h"},x=>this.setMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"h"},x=>this.setModePrivate(x)),this._parser.registerCsiHandler({final:"l"},x=>this.resetMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"l"},x=>this.resetModePrivate(x)),this._parser.registerCsiHandler({final:"m"},x=>this.charAttributes(x)),this._parser.registerCsiHandler({final:"n"},x=>this.deviceStatus(x)),this._parser.registerCsiHandler({prefix:"?",final:"n"},x=>this.deviceStatusPrivate(x)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},x=>this.softReset(x)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},x=>this.setCursorStyle(x)),this._parser.registerCsiHandler({final:"r"},x=>this.setScrollRegion(x)),this._parser.registerCsiHandler({final:"s"},x=>this.saveCursor(x)),this._parser.registerCsiHandler({final:"t"},x=>this.windowOptions(x)),this._parser.registerCsiHandler({final:"u"},x=>this.restoreCursor(x)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},x=>this.insertColumns(x)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},x=>this.deleteColumns(x)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},x=>this.selectProtected(x)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},x=>this.requestMode(x,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},x=>this.requestMode(x,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(x=>(this.setTitle(x),this.setIconName(x),!0))),this._parser.registerOscHandler(1,new m.OscHandler(x=>this.setIconName(x))),this._parser.registerOscHandler(2,new m.OscHandler(x=>this.setTitle(x))),this._parser.registerOscHandler(4,new m.OscHandler(x=>this.setOrReportIndexedColor(x))),this._parser.registerOscHandler(8,new m.OscHandler(x=>this.setHyperlink(x))),this._parser.registerOscHandler(10,new m.OscHandler(x=>this.setOrReportFgColor(x))),this._parser.registerOscHandler(11,new m.OscHandler(x=>this.setOrReportBgColor(x))),this._parser.registerOscHandler(12,new m.OscHandler(x=>this.setOrReportCursorColor(x))),this._parser.registerOscHandler(104,new m.OscHandler(x=>this.restoreIndexedColor(x))),this._parser.registerOscHandler(110,new m.OscHandler(x=>this.restoreFgColor(x))),this._parser.registerOscHandler(111,new m.OscHandler(x=>this.restoreBgColor(x))),this._parser.registerOscHandler(112,new m.OscHandler(x=>this.restoreCursorColor(x))),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 x in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:x},()=>this.selectCharset("("+x)),this._parser.registerEscHandler({intermediates:")",final:x},()=>this.selectCharset(")"+x)),this._parser.registerEscHandler({intermediates:"*",final:x},()=>this.selectCharset("*"+x)),this._parser.registerEscHandler({intermediates:"+",final:x},()=>this.selectCharset("+"+x)),this._parser.registerEscHandler({intermediates:"-",final:x},()=>this.selectCharset("-"+x)),this._parser.registerEscHandler({intermediates:".",final:x},()=>this.selectCharset("."+x)),this._parser.registerEscHandler({intermediates:"/",final:x},()=>this.selectCharset("/"+x));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(x=>(this._logService.error("Parsing error: ",x),x)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler((x,z)=>this.requestStatusString(x,z)))}_preserveStack(b,R,A,B){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=A,this._parseStack.position=B}_logSlowResolvingAsync(b){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([b,new Promise((R,A)=>setTimeout(()=>A("#SLOW_TIMEOUT"),5e3))]).catch(R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,R){let A,B=this._activeBuffer.x,U=this._activeBuffer.y,j=0;const Y=this._parseStack.paused;if(Y){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync(A),A;B=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>E&&(j=this._parseStack.position+E)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,x=>String.fromCharCode(x)).join("")}"`),typeof b=="string"?b.split("").map(x=>x.charCodeAt(0)):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<E&&(this._parseBuffer=new Uint32Array(Math.min(b.length,E))),Y||this._dirtyRowTracker.clearRange(),b.length>E)for(let x=j;x<b.length;x+=E){const z=x+E<b.length?x+E:b.length,N=typeof b=="string"?this._stringDecoder.decode(b.substring(x,z),this._parseBuffer):this._utf8Decoder.decode(b.subarray(x,z),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,N))return this._preserveStack(B,U,N,x),this._logSlowResolvingAsync(A),A}else if(!Y){const x=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,x))return this._preserveStack(B,U,x,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===B&&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,R,A){let B,U;const j=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,V=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,x=this._coreService.modes.insertMode,z=this._curAttrData;let N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-R>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let G=this._parser.precedingJoinState;for(let K=R;K<A;++K){if(B=b[K],B<127&&j){const ue=j[String.fromCharCode(B)];ue&&(B=ue.charCodeAt(0))}const Q=this._unicodeService.charProperties(B,G);U=_.UnicodeService.extractWidth(Q);const J=_.UnicodeService.extractShouldJoin(Q),ne=J?_.UnicodeService.extractWidth(G):0;if(G=Q,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(B)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-ne>V){if(P){const ue=N;let Z=this._activeBuffer.x-ne;for(this._activeBuffer.x=ne,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ne>0&&N instanceof e.BufferLine&&N.copyCellsFrom(ue,Z,0,ne,!1);Z<V;)ue.setCellFromCodepoint(Z++,0,1,z)}else if(this._activeBuffer.x=V-1,U===2)continue}if(J&&this._activeBuffer.x){const ue=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-ue,B,U);for(let Z=U-ne;--Z>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(x&&(N.insertCells(this._activeBuffer.x,U-ne,this._activeBuffer.getNullCell(z)),N.getWidth(V-1)===2&&N.setCellFromCodepoint(V-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,z)),N.setCellFromCodepoint(this._activeBuffer.x++,B,U,z),U>0)for(;--U;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=G,this._activeBuffer.x<V&&A-R>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,R){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,R):this._parser.registerCsiHandler(b,A=>!w(A.params[0],this._optionsService.rawOptions.windowOptions)||R(A))}registerDcsHandler(b,R){return this._parser.registerDcsHandler(b,new u.DcsHandler(R))}registerEscHandler(b,R){return this._parser.registerEscHandler(b,R)}registerOscHandler(b,R){return this._parser.registerOscHandler(b,new m.OscHandler(R))}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 R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.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,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=b,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+R)}cursorUp(b){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,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 R=b.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=b.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=b.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){const R=b.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,R,A,B=!1,U=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);j.replaceCells(R,A,this._activeBuffer.getNullCell(this._eraseAttrData()),U),B&&(j.isWrapped=!1)}_resetBufferLine(b,R=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),A.isWrapped=!1)}eraseInDisplay(b,R=!1){let A;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);A<this._bufferService.rows;A++)this._resetBufferLine(A,R);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,R);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,R);this._dirtyRowTracker.markDirty(0);break;case 3:const B=this._activeBuffer.lines.length-this._bufferService.rows;B>0&&(this._activeBuffer.lines.trimStart(B),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-B,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-B,0),this._onScroll.fire(0))}return!0}eraseInLine(b,R=!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,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let R=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-B+1;for(;R--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(A,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 R=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let B;for(B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,B=this._bufferService.rows-1+this._activeBuffer.ybase-B;R--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(B,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 R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.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 R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let R=b.params[0]||1;for(;R--;)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 R=b.params[0]||1;for(;R--;)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 R=b.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);B.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 R=b.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);B.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 R=b.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);B.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 R=b.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);B.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.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 R=this._parser.precedingJoinState;if(!R)return!0;const A=b.params[0]||1,B=_.UnicodeService.extractWidth(R),U=this._activeBuffer.x-B,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(j.length*A);let V=0;for(let x=0;x<j.length;){const z=j.codePointAt(x)||0;Y[V++]=z,x+=z>65535?2:1}let P=V;for(let x=1;x<A;++x)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(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let R=0;R<b.length;R++)switch(b.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let R=0;R<b.length;R++)switch(b.params[R]){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 R=0;R<b.length;R++)switch(b.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let R=0;R<b.length;R++)switch(b.params[R]){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[R]===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,R){const A=this._coreService.decPrivateModes,{activeProtocol:B,activeEncoding:U}=this._coreMouseService,j=this._coreService,{buffers:Y,cols:V}=this._bufferService,{active:P,alt:x}=Y,z=this._optionsService.rawOptions,N=J=>J?1:2,G=b.params[0];return K=G,Q=R?G===2?4:G===4?N(j.modes.insertMode):G===12?3:G===20?N(z.convertEol):0:G===1?N(A.applicationCursorKeys):G===3?z.windowOptions.setWinLines?V===80?2:V===132?1:0:0:G===6?N(A.origin):G===7?N(A.wraparound):G===8?3:G===9?N(B==="X10"):G===12?N(z.cursorBlink):G===25?N(!j.isCursorHidden):G===45?N(A.reverseWraparound):G===66?N(A.applicationKeypad):G===67?4:G===1e3?N(B==="VT200"):G===1002?N(B==="DRAG"):G===1003?N(B==="ANY"):G===1004?N(A.sendFocus):G===1005?4:G===1006?N(U==="SGR"):G===1015?4:G===1016?N(U==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?N(P===x):G===2004?N(A.bracketedPasteMode):0,j.triggerDataEvent(`${n.C0.ESC}[${R?"":"?"}${K};${Q}$y`),!0;var K,Q}_updateAttrColor(b,R,A,B,U){return R===2?(b|=50331648,b&=-16777216,b|=d.AttributeData.fromColorRGB([A,B,U])):R===5&&(b&=-50331904,b|=33554432|255&A),b}_extractColor(b,R,A){const B=[0,0,-1,0,0,0];let U=0,j=0;do{if(B[j+U]=b.params[R+j],b.hasSubParams(R+j)){const Y=b.getSubParams(R+j);let V=0;do B[1]===5&&(U=1),B[j+V+1+U]=Y[V];while(++V<Y.length&&V+j+1+U<B.length);break}if(B[1]===5&&j+U>=2||B[1]===2&&j+U>=5)break;B[1]&&(U=1)}while(++j+R<b.length&&j+U<B.length);for(let Y=2;Y<B.length;++Y)B[Y]===-1&&(B[Y]=0);switch(B[0]){case 38:A.fg=this._updateAttrColor(A.fg,B[1],B[3],B[4],B[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,B[1],B[3],B[4],B[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,B[1],B[3],B[4],B[5])}return j}_processUnderline(b,R){R.extended=R.extended.clone(),(!~b||b>5)&&(b=1),R.extended.underlineStyle=b,R.fg|=268435456,b===0&&(R.fg&=-268435457),R.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 R=b.length;let A;const B=this._curAttrData;for(let U=0;U<R;U++)A=b.params[U],A>=30&&A<=37?(B.fg&=-50331904,B.fg|=16777216|A-30):A>=40&&A<=47?(B.bg&=-50331904,B.bg|=16777216|A-40):A>=90&&A<=97?(B.fg&=-50331904,B.fg|=16777224|A-90):A>=100&&A<=107?(B.bg&=-50331904,B.bg|=16777224|A-100):A===0?this._processSGR0(B):A===1?B.fg|=134217728:A===3?B.bg|=67108864:A===4?(B.fg|=268435456,this._processUnderline(b.hasSubParams(U)?b.getSubParams(U)[0]:1,B)):A===5?B.fg|=536870912:A===7?B.fg|=67108864:A===8?B.fg|=1073741824:A===9?B.fg|=2147483648:A===2?B.bg|=134217728:A===21?this._processUnderline(2,B):A===22?(B.fg&=-134217729,B.bg&=-134217729):A===23?B.bg&=-67108865:A===24?(B.fg&=-268435457,this._processUnderline(0,B)):A===25?B.fg&=-536870913:A===27?B.fg&=-67108865:A===28?B.fg&=-1073741825:A===29?B.fg&=2147483647:A===39?(B.fg&=-67108864,B.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):A===49?(B.bg&=-67108864,B.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?U+=this._extractColor(b,U,B):A===53?B.bg|=1073741824:A===55?B.bg&=-1073741825:A===59?(B.extended=B.extended.clone(),B.extended.underlineColor=-1,B.updateExtended()):A===100?(B.fg&=-67108864,B.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,B.bg&=-67108864,B.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${R};${A}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){const R=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${R};${A}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 R=b.params[0]||1;switch(R){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 A=R%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(b){const R=b.params[0]||1;let A;return(b.length<2||(A=b.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(b){if(!w(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:R!==2&&this._onRequestWindowsOptionsReport.fire(y.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(y.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==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 R=[],A=b.split(";");for(;A.length>1;){const B=A.shift(),U=A.shift();if(/^\d+$/.exec(B)){const j=parseInt(B);if(H(j))if(U==="?")R.push({type:0,index:j});else{const Y=(0,v.parseColor)(U);Y&&R.push({type:1,index:j,color:Y})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(b){const R=b.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(b,R){this._getCurrentLinkId()&&this._finishHyperlink();const A=b.split(":");let B;const U=A.findIndex(j=>j.startsWith("id="));return U!==-1&&(B=A[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:B,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,R){const A=b.split(";");for(let B=0;B<A.length&&!(R>=this._specialColors.length);++B,++R)if(A[B]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const U=(0,v.parseColor)(A[B]);U&&this._onColor.fire([{type:1,index:this._specialColors[R],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 R=[],A=b.split(";");for(let B=0;B<A.length;++B)if(/^\d+$/.exec(A[B])){const U=parseInt(A[B]);H(U)&&R.push({type:2,index:U})}return R.length&&this._onColor.fire(R),!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(S[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 R=0;R<this._bufferService.rows;++R){const A=this._activeBuffer.ybase+this._activeBuffer.y+R,B=this._activeBuffer.lines.get(A);B&&(B.fill(b),B.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,R){const A=this._bufferService.buffer,B=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${U}${n.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[B.cursorStyle]-(B.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,R){this._dirtyRowTracker.markRangeDirty(b,R)}}t.InputHandler=I;let $=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&&(k=F,F=b,b=k),F<this.start&&(this.start=F),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(F){return 0<=F&&F<256}$=h([l(0,g.IBufferService)],$)},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,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,p){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,p)}get(h,l,n,c){var p;return(p=this._data.get(h,l))==null?void 0:p.get(n,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,n=this._array.length-1;for(;n>=l;){let c=l+n>>1;const p=this._getKey(this._array[c]);if(p>h)n=c-1;else{if(!(p<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(p){this._tasks.push(p),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(p){this._idleCallback=void 0;let f=0,o=0,e=p.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),r=p.timeRemaining(),1.5*o>r)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=r}this.clear()}}class n extends l{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const f=Date.now()+p;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,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 n=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=n==null?void 0:n.get(l.cols-1),p=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);p&&c&&(p.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(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}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(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,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),n=a(3734),c=a(8437),p=a(4634),f=a(511),o=a(643),e=a(4863),r=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=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=f.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 n.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 n.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 m=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+m+1?(this.ybase--,m++,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),m&&(this.y+=m),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 m=0;m<this.lines.length;m++)g+=+this.lines.get(m).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,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(d.length>0){const g=(0,p.reflowLargerCreateNewLayout)(this.lines,d);(0,p.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 m=this.lines.length-1;m>=0;m--){let u=this.lines.get(m);if(!u||!u.isWrapped&&u.getTrimmedLength()<=i)continue;const v=[u];for(;u.isWrapped&&m>0;)u=this.lines.get(--m),v.unshift(u);const S=this.ybase+this.y;if(S>=m&&S<m+v.length)continue;const E=v[v.length-1].getTrimmedLength(),w=(0,p.reflowSmallerGetNewLineLengths)(v,this._cols,i),y=w.length-v.length;let k;k=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+y):Math.max(0,this.lines.length-this.lines.maxLength+y);const I=[];for(let A=0;A<y;A++){const B=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);I.push(B)}I.length>0&&(g.push({start:m+v.length+_,newLines:I}),_+=I.length),v.push(...I);let $=w.length-1,H=w[$];H===0&&($--,H=w[$]);let F=v.length-y-1,b=E;for(;F>=0;){const A=Math.min(b,H);if(v[$]===void 0)break;if(v[$].copyCellsFrom(v[F],b-A,H-A,A,!0),H-=A,H===0&&($--,H=w[$]),b-=A,b===0){F--;const B=Math.max(F,0);b=(0,p.getWrappedLineTrimmedLength)(v,B,this._cols)}}for(let A=0;A<v.length;A++)w[A]<i&&v[A].setCell(w[A],d);let R=y-k;for(;R-- >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+y,this.ybase+s-1)}if(g.length>0){const m=[],u=[];for(let $=0;$<this.lines.length;$++)u.push(this.lines.get($));const v=this.lines.length;let S=v-1,E=0,w=g[E];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+_);let y=0;for(let $=Math.min(this.lines.maxLength-1,v+_-1);$>=0;$--)if(w&&w.start>S+y){for(let H=w.newLines.length-1;H>=0;H--)this.lines.set($--,w.newLines[H]);$++,m.push({index:S+1,amount:w.newLines.length}),y+=w.newLines.length,w=g[++E]}else this.lines.set($,u[S--]);let k=0;for(let $=m.length-1;$>=0;$--)m[$].index+=k,this.lines.onInsertEmitter.fire(m[$]),k+=m[$].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),n=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let p=0;class f{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=r||l.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let d=0;d<e;++d)this.setCell(d,s);this.length=e}get(e){const r=this._data[3*e+0],i=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,r){this._data[3*e+1]=r[n.CHAR_DATA_ATTR_INDEX],r[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[n.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 r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?(0,c.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return p=3*e,r.content=this._data[p+0],r.fg=this._data[p+1],r.bg=this._data[p+2],2097152&r.content&&(r.combinedData=this._combined[e]),268435456&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,r,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,c.stringFromCodePoint)(r):2097151&s?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&s)+(0,c.stringFromCodePoint)(r),s&=-2097152,s|=2097152):s=r|4194304,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,r,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length-e){const s=new l.CellData;for(let d=this.length-e-r-1;d>=0;--d)this.setCell(e+r+d,this.loadCell(e+d,s));for(let d=0;d<r;++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,r,i){if(e%=this.length,r<this.length-e){const s=new l.CellData;for(let d=0;d<this.length-e-r;++d)this.setCell(e+d,this.loadCell(e+r+d,s));for(let d=this.length-r;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,r,i,s=!1){if(s)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);e<r&&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),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.setCell(e++,i)}resize(e,r){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,r)}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,r=!1){if(r)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 r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(const r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){const e=new f(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const r in this._combined)e._combined[r]=this._combined[r];for(const r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];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,r,i,s,d){const g=e._data;if(d)for(let m=s-1;m>=0;m--){for(let u=0;u<3;u++)this._data[3*(i+m)+u]=g[3*(r+m)+u];268435456&g[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}else for(let m=0;m<s;m++){for(let u=0;u<3;u++)this._data[3*(i+m)+u]=g[3*(r+m)+u];268435456&g[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}const _=Object.keys(e._combined);for(let m=0;m<_.length;m++){const u=parseInt(_[m],10);u>=r&&(this._combined[u-r+i]=e._combined[u])}}translateToString(e,r,i,s){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;r<i;){const g=this._data[3*r+0],_=2097151&g,m=2097152&g?this._combined[r]:_?(0,c.stringFromCodePoint)(_):n.WHITESPACE_CELL_CHAR;if(d+=m,s)for(let u=0;u<m.length;++u)s.push(r);r+=g>>22||1}return s&&s.push(r),d}}t.BufferLine=f},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,n){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(n-1)&&h[l].getWidth(n-1)===1,p=h[l+1].getWidth(0)===2;return c&&p?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,n,c,p){const f=[];for(let o=0;o<h.length-1;o++){let e=o,r=h.get(++e);if(!r.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&r.isWrapped;)i.push(r),r=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-_,S=n-d,E=Math.min(v,S);i[s].copyCellsFrom(i[g],_,d,E,!1),d+=E,d===n&&(s++,d=0),_+=E,_===u&&(g++,_=0),d===0&&s!==0&&i[s-1].getWidth(n-1)===2&&(i[s].copyCellsFrom(i[s-1],n-1,d++,1,!1),i[s-1].setCell(n-1,p))}i[s].replaceCells(d,n,p);let m=0;for(let u=i.length-1;u>0&&(u>s||i[u].getTrimmedLength()===0);u--)m++;m>0&&(f.push(o+i.length-m),f.push(m)),o+=i.length-1}return f},t.reflowLargerCreateNewLayout=function(h,l){const n=[];let c=0,p=l[c],f=0;for(let o=0;o<h.length;o++)if(p===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-f,amount:e}),o+=e-1,f+=e,p=l[++c]}else n.push(o);return{layout:n,countRemoved:f}},t.reflowLargerApplyNewLayout=function(h,l){const n=[];for(let c=0;c<l.length;c++)n.push(h.get(l[c]));for(let c=0;c<n.length;c++)h.set(c,n[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,n){const c=[],p=h.map((r,i)=>a(h,i,l)).reduce((r,i)=>r+i);let f=0,o=0,e=0;for(;e<p;){if(p-e<n){c.push(p-e);break}f+=n;const r=a(h,o,l);f>r&&(f-=r,o++);const i=h[o].getWidth(f-1)===2;i&&f--;const s=i?n-1:n;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),n=a(9092);class c extends l.Disposable{constructor(f,o){super(),this._optionsService=f,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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.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(f){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(f),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(f,o){this._normal.resize(f,o),this._alt.resize(f,o),this.setupTabStops(f)}setupTabStops(f){this._normal.setupTabStops(f),this._alt.setupTabStops(f)}}t.BufferSet=c},511:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),n=a(3734);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new c;return o.setFromCharData(f),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(f){this.fg=f[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[l.CHAR_DATA_CHAR_INDEX].length===2){const e=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|f[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[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 n{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=n._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(p){return this._disposables.push(p),p}}t.Marker=n,n._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(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
8
- `,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""}(a||(t.C0=a={})),function(n){n.PAD="€",n.HOP="",n.BPH="‚",n.NBH="ƒ",n.IND="„",n.NEL="…",n.SSA="†",n.ESA="‡",n.HTS="ˆ",n.HTJ="‰",n.VTS="Š",n.PLD="‹",n.PLU="Œ",n.RI="",n.SS2="Ž",n.SS3="",n.DCS="",n.PU1="‘",n.PU2="’",n.STS="“",n.CCH="”",n.MW="•",n.SPA="–",n.EPA="—",n.SOS="˜",n.SGCI="™",n.SCI="š",n.CSI="›",n.ST="œ",n.OSC="",n.PM="ž",n.APC="Ÿ"}(h||(t.C1=h={})),function(n){n.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(n,c,p,f){const o={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=n.ctrlKey?"\b":h.C0.DEL,n.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(n.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=n.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,n.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(p?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(p?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",p||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(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",p||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:n.shiftKey||n.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:n.shiftKey?o.type=2:n.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:n.shiftKey?o.type=3:n.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(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(p&&!f||!n.altKey||n.metaKey)!p||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?o.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(o.key=h.C0.US),n.key==="@"&&(o.key=h.C0.NUL)):n.keyCode===65&&(o.type=1);else{const r=l[n.keyCode],i=r==null?void 0:r[n.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(n.keyCode>=65&&n.keyCode<=90){const s=n.ctrlKey?n.keyCode-64:n.keyCode+32;let d=String.fromCharCode(s);n.shiftKey&&(d=d.toUpperCase()),o.key=h.C0.ESC+d}else if(n.keyCode===32)o.key=h.C0.ESC+(n.ctrlKey?h.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let s=n.code.slice(3,4);n.shiftKey||(s=s.toLowerCase()),o.key=h.C0.ESC+s,o.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?o.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?o.key=h.C0.NUL:n.keyCode>=51&&n.keyCode<=55?o.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?o.key=h.C0.DEL:n.keyCode===219?o.key=h.C0.ESC:n.keyCode===220?o.key=h.C0.FS:n.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 n="";for(let c=h;c<l;++c){let p=a[c];p>65535?(p-=65536,n+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):n+=String.fromCharCode(p)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const p=a.charCodeAt(c++);56320<=p&&p<=57343?h[n++]=1024*(this._interim-55296)+p-56320+65536:(h[n++]=this._interim,h[n++]=p),this._interim=0}for(let p=c;p<l;++p){const f=a.charCodeAt(p);if(55296<=f&&f<=56319){if(++p>=l)return this._interim=f,n;const o=a.charCodeAt(p);56320<=o&&o<=57343?h[n++]=1024*(f-55296)+o-56320+65536:(h[n++]=f,h[n++]=o)}else f!==65279&&(h[n++]=f)}return n}},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 n,c,p,f,o=0,e=0,r=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,m=0;for(;(_=63&this.interim[++m])&&m<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-m;for(;r<v;){if(r>=l)return 0;if(_=a[r++],(192&_)!=128){r--,d=!0;break}this.interim[m++]=_,g<<=6,g|=63&_}d||(u===2?g<128?r--: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=r;for(;s<l;){for(;!(!(s<i)||128&(n=a[s])||128&(c=a[s+1])||128&(p=a[s+2])||128&(f=a[s+3]));)h[o++]=n,h[o++]=c,h[o++]=p,h[o++]=f,s+=4;if(n=a[s++],n<128)h[o++]=n;else if((224&n)==192){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&n)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&n)==224){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(e=(15&n)<<12|(63&c)<<6|63&p,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=p,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&p)<<6|63&f,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]],n=[[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 p=0;p<l.length;++p)c.fill(0,l[p][0],l[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?c[p]:function(f,o){let e,r=0,i=o.length-1;if(f<o[0][0]||f>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,f>o[e][1])r=e+1;else{if(!(f<o[e][0]))return!0;i=e-1}return!1}(p,n)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,f){let o=this.wcwidth(p),e=o===0&&f!==0;if(e){const r=h.UnicodeService.extractWidth(f);r===0?e=!1:r>o&&(o=r)}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 n extends l.Disposable{constructor(p){super(),this._action=p,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(p,f){if(f!==void 0&&this._syncCalls>f)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),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(p,f){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+=p.length,this._writeBuffer.push(p),this._callbacks.push(f),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(f)}_innerWrite(p=0,f=!0){const o=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],r=this._action(e,f);if(r){const s=d=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(o,d);return void r.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=n},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(n,c){const p=n.toString(16),f=p.length<2?"0"+p:p;switch(c){case 4:return p[0];case 8:return f;case 12:return(f+f).slice(0,3);default:return f+f}}t.parseColor=function(n){if(!n)return;let c=n.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const p=a.exec(c);if(p){const f=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/f*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/f*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/f*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const p=c.length/3,f=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(p*o,p*o+p),16);f[o]=p===1?e<<4:p===2?e:p===3?e>>4:e>>8}return f}},t.toRgbString=function(n,c=16){const[p,f,o]=n;return`rgb:${l(p,c)}/${l(f,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),n=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(f,o){this._handlers[f]===void 0&&(this._handlers[f]=[]);const e=this._handlers[f];return e.push(o),{dispose:()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}reset(){if(this._active.length)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].unhook(!1);this._stack.paused=!1,this._active=c,this._ident=0}hook(f,o){if(this.reset(),this._ident=f,this._active=this._handlers[f]||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(f,o,e){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(f,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(f,o,e))}unhook(f,o=!0){if(this._active.length){let e=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;r>=0&&(e=this._active[r].unhook(f),e!==!0);r--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,e;r--}for(;r>=0;r--)if(e=this._active[r].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",f);this._active=c,this._ident=0}};const p=new l.Params;p.addParam(0),t.DcsHandler=class{constructor(f){this._handler=f,this._data="",this._params=p,this._hitLimit=!1}hook(f){this._params=f.length>1||f.params[0]?f.clone():p,this._data="",this._hitLimit=!1}put(f,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(f,o,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(f){let o=!1;if(this._hitLimit)o=!1;else if(f&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=p,this._data="",this._hitLimit=!1,e));return this._params=p,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),n=a(6242),c=a(6351);class p{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,s,d){this.table[i<<8|r]=s<<4|d}addMany(r,i,s,d){for(let g=0;g<r.length;g++)this.table[i<<8|r[g]]=s<<4|d}}t.TransitionTable=p;const f=160;t.VT500_TRANSITION_TABLE=function(){const e=new p(4095),r=Array.apply(null,Array(256)).map((m,u)=>u),i=(m,u)=>r.slice(m,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(f,0,2,0),e.add(f,8,5,8),e.add(f,6,0,6),e.add(f,11,0,11),e.add(f,13,13,13),e}();class o extends h.Disposable{constructor(r=t.VT500_TRANSITION_TABLE){super(),this._transitions=r,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 n.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(r,i=[64,126]){let s=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=r.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<r.intermediates.length;++g){const _=r.intermediates.charCodeAt(g);if(32>_||_>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=_}}if(r.final.length!==1)throw new Error("final must be a single byte");const d=r.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(r){const i=[];for(;r;)i.push(String.fromCharCode(255&r)),r>>=8;return i.reverse().join("")}setPrintHandler(r){this._printHandler=r}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(r,i){const s=this._identifier(r,[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(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]}setEscHandlerFallback(r){this._escHandlerFb=r}setExecuteHandler(r,i){this._executeHandlers[r.charCodeAt(0)]=i}clearExecuteHandler(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]}setExecuteHandlerFallback(r){this._executeHandlerFb=r}registerCsiHandler(r,i){const s=this._identifier(r);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(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]}setCsiHandlerFallback(r){this._csiHandlerFb=r}registerDcsHandler(r,i){return this._dcsParser.registerHandler(this._identifier(r),i)}clearDcsHandler(r){this._dcsParser.clearHandler(this._identifier(r))}setDcsHandlerFallback(r){this._dcsParser.setHandlerFallback(r)}registerOscHandler(r,i){return this._oscParser.registerHandler(r,i)}clearOscHandler(r){this._oscParser.clearHandler(r)}setOscHandlerFallback(r){this._oscParser.setHandlerFallback(r)}setErrorHandler(r){this._errorHandler=r}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(r,i,s,d,g){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=g}parse(r,i,s){let d,g=0,_=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=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=r[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=r[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,m=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=m;u<i;++u){switch(g=r[u],_=this._transitions.table[this.currentState<<8|(g<160?g:f)],_>>4){case 2:for(let y=u+1;;++y){if(y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-1;break}if(++y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-1;break}if(++y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-1;break}if(++y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-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 S=v?v.length-1:-1;for(;S>=0&&(d=v[S](this._params),d!==!0);S--)if(d instanceof Promise)return this._preserveStack(3,v,S,_,u),d;S<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=r[u])>47&&g<60);u--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const E=this._escHandlers[this._collect<<8|g];let w=E?E.length-1:-1;for(;w>=0&&(d=E[w](),d!==!0);w--)if(d instanceof Promise)return this._preserveStack(4,E,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 y=u+1;;++y)if(y>=i||(g=r[y])===24||g===26||g===27||g>127&&g<f){this._dcsParser.put(r,u,y),u=y-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 y=u+1;;y++)if(y>=i||(g=r[y])<32||g>127&&g<f){this._oscParser.put(r,u,y),u=y-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),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,p){this._handlers[c]===void 0&&(this._handlers[c]=[]);const f=this._handlers[c];return f.push(p),{dispose:()=>{const o=f.indexOf(p);o!==-1&&f.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=n}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=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,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,p,f){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,p,f);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,p,f))}start(){this.reset(),this._state=1}put(c,p,f){if(this._state!==3){if(this._state===1)for(;p<f;){const o=c[p++];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&&f-p>0&&this._put(c,p,f)}}end(c,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let f=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,f=p,e=this._stack.fallThrough,this._stack.paused=!1),!e&&f===!1){for(;o>=0&&(f=this._active[o].end(c),f!==!0);o--)if(f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,f;o--}for(;o>=0;o--)if(f=this._active[o].end(!1),f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,f}else this._handlerFb(this._id,"END",c);this._active=n,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,p,f){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,p,f),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let p=!1;if(this._hitLimit)p=!1;else if(c&&(p=this._handler(this._data),p instanceof Promise))return p.then(f=>(this._data="",this._hitLimit=!1,f));return this._data="",this._hitLimit=!1,p}}},8742:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(n){const c=new h;if(!n.length)return c;for(let p=Array.isArray(n[0])?1:0;p<n.length;++p){const f=n[p];if(Array.isArray(f))for(let o=0;o<f.length;++o)c.addSubParam(f[o]);else c.addParam(f)}return c}constructor(n=32,c=32){if(this.maxLength=n,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new h(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let c=0;c<this.length;++c){n.push(this.params[c]);const p=this._subParamsIdx[c]>>8,f=255&this._subParamsIdx[c];f-p>0&&n.push(Array.prototype.slice.call(this._subParams,p,f))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>a?a:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>a?a:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const c=this._subParamsIdx[n]>>8,p=255&this._subParamsIdx[n];return p-c>0?this._subParams.subarray(c,p):null}getSubParamsAll(){const n={};for(let c=0;c<this.length;++c){const p=this._subParamsIdx[c]>>8,f=255&this._subParamsIdx[c];f-p>0&&(n[c]=this._subParams.slice(p,f))}return n}addDigit(n){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const p=this._digitIsSub?this._subParams:this.params,f=p[c-1];p[c-1]=~f?Math.min(10*f+n,a):n}}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(n,c){this._buffer=n,this.type=c}init(n){return this._buffer=n,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(n){const c=this._buffer.lines.get(n);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,n){if(!(l<0||l>=this._line.length))return n?(this._line.loadCell(l,n),n):this._line.loadCell(l,new h.CellData)}translateToString(l,n,c){return this._line.translateToString(l,n,c)}}},8285:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),n=a(844);class c extends n.Disposable{constructor(f){super(),this._core=f,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,n)=>h(l,n.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,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=a(8460),c=a(844),p=a(5295),f=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 n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.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 p.BufferSet(e,this))}resize(e,r){this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!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,r),this._cachedBlankLine=s),s.isWrapped=r;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,r,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&&(r||this._onScroll.fire(s.ydisp))}};t.BufferService=o=h([l(0,f.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 m,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 S=s.length-1;S>=0;S--)(m=s[S])&&(v=(u<3?m(v):u>3?m(d,g,v):m(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 n=a(2585),c=a(8460),p=a(844),f={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,r={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 p.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(f))this.addProtocol(g,f[g]);for(const g of Object.keys(r))this.addEncoding(g,r[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,n.IBufferService),l(1,n.ICoreService)],i)},6975:function(M,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<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=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>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 n=a(1439),c=a(8460),p=a(844),f=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 r=t.CoreService=class extends p.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,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.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=r=h([l(0,f.IBufferService),l(1,f.ILogService),l(2,f.IOptionsService)],r)},9074:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),n=a(844),c=a(6106);let p=0,f=0;class o extends n.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,n.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 m of this._decorations.getKeyIterator(s))g=m.options.x??0,_=g+(m.options.width??1),i>=g&&i<_&&(!d||(m.options.layer??"bottom")===d)&&(yield m)}forEachDecorationAtCell(i,s,d,g){this._decorations.forEachByKey(s,_=>{p=_.options.x??0,f=p+(_.options.width??1),i>=p&&i<f&&(!d||(_.options.layer??"bottom")===d)&&g(_)})}}t.DecorationService=o;class e extends n.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 n{constructor(...p){this._entries=new Map;for(const[f,o]of p)this.set(f,o)}set(p,f){const o=this._entries.get(p);return this._entries.set(p,f),o}forEach(p){for(const[f,o]of this._entries.entries())p(f,o)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(h.IInstantiationService,this)}setService(c,p){this._services.set(c,p)}getService(c){return this._services.get(c)}createInstance(c,...p){const f=(0,l.getServiceDependencies)(c).sort((r,i)=>r.index-i.index),o=[];for(const r of f){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${r.id}.`);o.push(i)}const e=f.length>0?f[0].index:p.length;if(p.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${p.length} static arguments`);return new c(...p,...o)}}},7866:function(M,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(844),c=a(2585),p={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 f,o=t.LogService=class extends n.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())),f=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){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,r)}debug(e,...r){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,r)}info(e,...r){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,r)}warn(e,...r){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,r)}error(e,...r){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,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(f.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);f.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return f.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),n=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:n.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 p 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 r in o)if(r in e)try{const i=o[r];e[r]=this._sanitizeAndValidateOption(r,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(r=>{r===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(r=>{o.indexOf(r)!==-1&&e()})}_setupOptions(){const o=r=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},e=(r,i)=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(const r in this.rawOptions){const i={get:o.bind(this,r),set:e.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(r){return r==="block"||r==="underline"||r==="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=p},2660:function(M,t,a){var h=this&&this.__decorate||function(p,f,o,e){var r,i=arguments.length,s=i<3?f:e===null?e=Object.getOwnPropertyDescriptor(f,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(p,f,o,e);else for(var d=p.length-1;d>=0;d--)(r=p[d])&&(s=(i<3?r(s):i>3?r(f,o,s):r(f,o))||s);return i>3&&s&&Object.defineProperty(f,o,s),s},l=this&&this.__param||function(p,f){return function(o,e){f(o,e,p)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=a(2585);let c=t.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){const f=this._bufferService.buffer;if(p.id===void 0){const d=f.addMarker(f.ybase+f.y),g={data:p,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(g,d)),this._dataByLinkId.set(g.id,g),g.id}const o=p,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,f.ybase+f.y),r.id;const i=f.addMarker(f.ybase+f.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(p,f){const o=this._dataByLinkId.get(p);if(o&&o.lines.every(e=>e.line!==f)){const e=this._bufferService.buffer.addMarker(f);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(p){var f;return(f=this._dataByLinkId.get(p))==null?void 0:f.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,f){const o=p.lines.indexOf(f);o!==-1&&(p.lines.splice(o,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};t.OscLinkService=c=h([l(0,n.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 n=function(c,p,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(n,c,f)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},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(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.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 n{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,f,o=!1){return(16777215&p)<<3|(3&f)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const p=new l.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let f=0,o=0;const e=p.length;for(let r=0;r<e;++r){let i=p.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return f+this.wcwidth(i);const g=p.charCodeAt(r);56320<=g&&g<=57343?i=1024*(i-55296)+g-56320+65536:f+=this.wcwidth(g)}const s=this.charProperties(i,o);let d=n.extractWidth(s);n.extractShouldJoin(s)&&(d-=n.extractWidth(o)),f+=d,o=s}return f}charProperties(p,f){return this._activeProvider.charProperties(p,f)}}t.UnicodeService=n}},T={};function O(M){var t=T[M];if(t!==void 0)return t.exports;var a=T[M]={exports:{}};return D[M].call(a.exports,a,a.exports,O),a.exports}var W={};return(()=>{var M=W;Object.defineProperty(M,"__esModule",{value:!0}),M.Terminal=void 0;const t=O(9042),a=O(3236),h=O(844),l=O(5741),n=O(8285),c=O(7975),p=O(7090),f=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),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(r){if(f.includes(r))throw new Error(`Option "${r}" 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 p.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 n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const r=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:r.applicationCursorKeys,applicationKeypadMode:r.applicationKeypad,bracketedPasteMode:r.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:r.origin,reverseWraparoundMode:r.reverseWraparound,sendFocusMode:r.sendFocus,wraparoundMode:r.wraparound}}get options(){return this._publicOptions}set options(r){for(const i in r)this._publicOptions[i]=r[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(r,i=!0){this._core.input(r,i)}resize(r,i){this._verifyIntegers(r,i),this._core.resize(r,i)}open(r){this._core.open(r)}attachCustomKeyEventHandler(r){this._core.attachCustomKeyEventHandler(r)}attachCustomWheelEventHandler(r){this._core.attachCustomWheelEventHandler(r)}registerLinkProvider(r){return this._core.registerLinkProvider(r)}registerCharacterJoiner(r){return this._checkProposedApi(),this._core.registerCharacterJoiner(r)}deregisterCharacterJoiner(r){this._checkProposedApi(),this._core.deregisterCharacterJoiner(r)}registerMarker(r=0){return this._verifyIntegers(r),this._core.registerMarker(r)}registerDecoration(r){return this._checkProposedApi(),this._verifyPositiveIntegers(r.x??0,r.width??0,r.height??0),this._core.registerDecoration(r)}hasSelection(){return this._core.hasSelection()}select(r,i,s){this._verifyIntegers(r,i,s),this._core.select(r,i,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(r,i){this._verifyIntegers(r,i),this._core.selectLines(r,i)}dispose(){super.dispose()}scrollLines(r){this._verifyIntegers(r),this._core.scrollLines(r)}scrollPages(r){this._verifyIntegers(r),this._core.scrollPages(r)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(r){this._verifyIntegers(r),this._core.scrollToLine(r)}clear(){this._core.clear()}write(r,i){this._core.write(r,i)}writeln(r,i){this._core.write(r),this._core.write(`\r
9
- `,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}M.Terminal=o})(),W})())})(Zt);var ji=Zt.exports,ei={exports:{}};(function(C,L){(function(D,T){C.exports=T()})(self,()=>(()=>{var D={};return(()=>{var T=D;Object.defineProperty(T,"__esModule",{value:!0}),T.FitAddon=void 0,T.FitAddon=class{activate(O){this._terminal=O}dispose(){}fit(){const O=this.proposeDimensions();if(!O||!this._terminal||isNaN(O.cols)||isNaN(O.rows))return;const W=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(W._renderService.clear(),this._terminal.resize(O.cols,O.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const O=this._terminal._core,W=O._renderService.dimensions;if(W.css.cell.width===0||W.css.cell.height===0)return;const M=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),n=a-(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/W.css.cell.width)),rows:Math.max(1,Math.floor(n/W.css.cell.height))}}}})(),D})())})(ei);var qi=ei.exports,ti={exports:{}};(function(C,L){(function(D,T){C.exports=T()})(self,()=>(()=>{var D={965:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),n=a(855),c=a(859),p=a(381),f=11,o=f*Float32Array.BYTES_PER_ELEMENT;let e,r=0,i=0,s=0;class d extends c.Disposable{constructor(_,m,u,v){super(),this._terminal=_,this._gl=m,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 S=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,p.createProgram)(S,`#version 300 es
10
- layout (location = 0) in vec2 a_unitquad;
11
- layout (location = 1) in vec2 a_cellpos;
12
- layout (location = 2) in vec2 a_offset;
13
- layout (location = 3) in vec2 a_size;
14
- layout (location = 4) in float a_texpage;
15
- layout (location = 5) in vec2 a_texcoord;
16
- layout (location = 6) in vec2 a_texsize;
17
-
18
- uniform mat4 u_projection;
19
- uniform vec2 u_resolution;
20
-
21
- out vec2 v_texcoord;
22
- flat out int v_texpage;
23
-
24
- void main() {
25
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
26
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
27
- v_texpage = int(a_texpage);
28
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
29
- }`,function($){let H="";for(let F=1;F<$;F++)H+=` else if (v_texpage == ${F}) { outColor = texture(u_texture[${F}], v_texcoord); }`;return`#version 300 es
30
- precision lowp float;
31
-
32
- in vec2 v_texcoord;
33
- flat in int v_texpage;
34
-
35
- uniform sampler2D u_texture[${$}];
36
-
37
- out vec4 outColor;
38
-
39
- void main() {
40
- if (v_texpage == 0) {
41
- outColor = texture(u_texture[0], v_texcoord);
42
- } ${H}
43
- }`}(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)(()=>S.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=S.createVertexArray(),S.bindVertexArray(this._vertexArrayObject);const E=new Float32Array([0,0,1,0,0,1,1,1]),w=S.createBuffer();this.register((0,c.toDisposable)(()=>S.deleteBuffer(w))),S.bindBuffer(S.ARRAY_BUFFER,w),S.bufferData(S.ARRAY_BUFFER,E,S.STATIC_DRAW),S.enableVertexAttribArray(0),S.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const y=new Uint8Array([0,1,2,3]),k=S.createBuffer();this.register((0,c.toDisposable)(()=>S.deleteBuffer(k))),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,k),S.bufferData(S.ELEMENT_ARRAY_BUFFER,y,S.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(S.createBuffer()),this.register((0,c.toDisposable)(()=>S.deleteBuffer(this._attributesBuffer))),S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.enableVertexAttribArray(2),S.vertexAttribPointer(2,2,S.FLOAT,!1,o,0),S.vertexAttribDivisor(2,1),S.enableVertexAttribArray(3),S.vertexAttribPointer(3,2,S.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(3,1),S.enableVertexAttribArray(4),S.vertexAttribPointer(4,1,S.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(4,1),S.enableVertexAttribArray(5),S.vertexAttribPointer(5,2,S.FLOAT,!1,o,5*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(5,1),S.enableVertexAttribArray(6),S.vertexAttribPointer(6,2,S.FLOAT,!1,o,7*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(6,1),S.enableVertexAttribArray(1),S.vertexAttribPointer(1,2,S.FLOAT,!1,o,9*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(1,1),S.useProgram(this._program);const I=new Int32Array(l.TextureAtlas.maxAtlasPages);for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++)I[$]=$;S.uniform1iv(this._textureLocation,I),S.uniformMatrix4fv(this._projectionLocation,!1,p.PROJECTION_MATRIX),this._atlasTextures=[];for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++){const H=new p.GLTexture((0,h.throwIfFalsy)(S.createTexture()));this.register((0,c.toDisposable)(()=>S.deleteTexture(H.texture))),S.activeTexture(S.TEXTURE0+$),S.bindTexture(S.TEXTURE_2D,H.texture),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texImage2D(S.TEXTURE_2D,0,S.RGBA,1,1,0,S.RGBA,S.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[$]=H}S.enable(S.BLEND),S.blendFunc(S.SRC_ALPHA,S.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(_,m,u,v,S,E,w,y,k){this._updateCell(this._vertices.attributes,_,m,u,v,S,E,w,y,k)}_updateCell(_,m,u,v,S,E,w,y,k,I){r=(u*this._terminal.cols+m)*f,v!==n.NULL_CELL_CODE&&v!==void 0?this._atlas&&(e=y&&y.length>1?this._atlas.getRasterizedGlyphCombinedChar(y,S,E,w,!1):this._atlas.getRasterizedGlyph(v,S,E,w,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),S!==I&&e.offset.x>i?(s=e.offset.x-i,_[r]=-(e.offset.x-s)+this._dimensions.device.char.left,_[r+1]=-e.offset.y+this._dimensions.device.char.top,_[r+2]=(e.size.x-s)/this._dimensions.device.canvas.width,_[r+3]=e.size.y/this._dimensions.device.canvas.height,_[r+4]=e.texturePage,_[r+5]=e.texturePositionClipSpace.x+s/this._atlas.pages[e.texturePage].canvas.width,_[r+6]=e.texturePositionClipSpace.y,_[r+7]=e.sizeClipSpace.x-s/this._atlas.pages[e.texturePage].canvas.width,_[r+8]=e.sizeClipSpace.y):(_[r]=-e.offset.x+this._dimensions.device.char.left,_[r+1]=-e.offset.y+this._dimensions.device.char.top,_[r+2]=e.size.x/this._dimensions.device.canvas.width,_[r+3]=e.size.y/this._dimensions.device.canvas.height,_[r+4]=e.texturePage,_[r+5]=e.texturePositionClipSpace.x,_[r+6]=e.texturePositionClipSpace.y,_[r+7]=e.sizeClipSpace.x,_[r+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(v,k,e.size.x,this._dimensions.device.cell.width)&&(_[r+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):_.fill(0,r,r+f-1-2)}clear(){const _=this._terminal,m=_.cols*_.rows*f;this._vertices.count!==m?this._vertices.attributes=new Float32Array(m):this._vertices.attributes.fill(0);let u=0;for(;u<this._vertices.attributesBuffers.length;u++)this._vertices.count!==m?this._vertices.attributesBuffers[u]=new Float32Array(m):this._vertices.attributesBuffers[u].fill(0);this._vertices.count=m,u=0;for(let v=0;v<_.rows;v++)for(let S=0;S<_.cols;S++)this._vertices.attributes[u+9]=S/_.cols,this._vertices.attributes[u+10]=v/_.rows,u+=f}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 m=this._gl;m.useProgram(this._program),m.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const u=this._vertices.attributesBuffers[this._activeBuffer];let v=0;for(let S=0;S<_.lineLengths.length;S++){const E=S*this._terminal.cols*f,w=this._vertices.attributes.subarray(E,E+_.lineLengths[S]*f);u.set(w,v),v+=w.length}m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.bufferData(m.ARRAY_BUFFER,u.subarray(0,v),m.STREAM_DRAW);for(let S=0;S<this._atlas.pages.length;S++)this._atlas.pages[S].version!==this._atlasTextures[S].version&&this._bindAtlasPageTexture(m,this._atlas,S);m.drawElementsInstanced(m.TRIANGLE_STRIP,4,m.UNSIGNED_BYTE,0,v/f)}setAtlas(_){this._atlas=_;for(const m of this._atlasTextures)m.version=-1}_bindAtlasPageTexture(_,m,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,m.pages[u].canvas),_.generateMipmap(_.TEXTURE_2D),this._atlasTextures[u].version=m.pages[u].version}setDimensions(_){this._dimensions=_}}t.GlyphRenderer=d},742:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=a(374),l=a(859),n=a(310),c=a(381),p=8*Float32Array.BYTES_PER_ELEMENT;class f{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,r=0,i=0,s=0,d=0,g=0;class _ extends l.Disposable{constructor(u,v,S,E){super(),this._terminal=u,this._gl=v,this._dimensions=S,this._themeService=E,this._vertices=new f,this._verticesCursor=new f;const w=this._gl;this._program=(0,h.throwIfFalsy)((0,c.createProgram)(w,`#version 300 es
44
- layout (location = 0) in vec2 a_position;
45
- layout (location = 1) in vec2 a_size;
46
- layout (location = 2) in vec4 a_color;
47
- layout (location = 3) in vec2 a_unitquad;
48
-
49
- uniform mat4 u_projection;
50
-
51
- out vec4 v_color;
52
-
53
- void main() {
54
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
55
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
56
- v_color = a_color;
57
- }`,`#version 300 es
58
- precision lowp float;
59
-
60
- in vec4 v_color;
61
-
62
- out vec4 outColor;
63
-
64
- void main() {
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 y=new Float32Array([0,0,1,0,0,1,1,1]),k=w.createBuffer();this.register((0,l.toDisposable)(()=>w.deleteBuffer(k))),w.bindBuffer(w.ARRAY_BUFFER,k),w.bufferData(w.ARRAY_BUFFER,y,w.STATIC_DRAW),w.enableVertexAttribArray(3),w.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const I=new Uint8Array([0,1,2,3]),$=w.createBuffer();this.register((0,l.toDisposable)(()=>w.deleteBuffer($))),w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,$),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,p,0),w.vertexAttribDivisor(0,1),w.enableVertexAttribArray(1),w.vertexAttribPointer(1,2,w.FLOAT,!1,p,2*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(1,1),w.enableVertexAttribArray(2),w.vertexAttribPointer(2,4,w.FLOAT,!1,p,4*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(2,1),this._updateCachedColors(E.colors),this.register(this._themeService.onChangeColors(H=>{this._updateCachedColors(H),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,S=this._vertices;let E,w,y,k,I,$,H,F,b,R,A,B=1;for(E=0;E<v.rows;E++){for(y=-1,k=0,I=0,$=!1,w=0;w<v.cols;w++)H=(E*v.cols+w)*n.RENDER_MODEL_INDICIES_PER_CELL,F=u.cells[H+n.RENDER_MODEL_BG_OFFSET],b=u.cells[H+n.RENDER_MODEL_FG_OFFSET],R=!!(67108864&b),(F!==k||b!==I&&($||R))&&((k!==0||$&&I!==0)&&(A=8*B++,this._updateRectangle(S,A,I,k,y,w,E)),y=w,k=F,I=b,$=R);(k!==0||$&&I!==0)&&(A=8*B++,this._updateRectangle(S,A,I,k,y,v.cols,E))}S.count=B}updateCursor(u){const v=this._verticesCursor,S=u.cursor;if(!S||S.style==="block")return void(v.count=0);let E,w=0;S.style!=="bar"&&S.style!=="outline"||(E=8*w++,this._addRectangleFloat(v.attributes,E,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.style==="bar"?S.dpr*S.cursorWidth:S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.style!=="underline"&&S.style!=="outline"||(E=8*w++,this._addRectangleFloat(v.attributes,E,S.x*this._dimensions.device.cell.width,(S.y+1)*this._dimensions.device.cell.height-S.dpr,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat)),S.style==="outline"&&(E=8*w++,this._addRectangleFloat(v.attributes,E,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat),E=8*w++,this._addRectangleFloat(v.attributes,E,(S.x+S.width)*this._dimensions.device.cell.width-S.dpr,S.y*this._dimensions.device.cell.height,S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),v.count=w}_updateRectangle(u,v,S,E,w,y,k){if(67108864&S)switch(50331648&S){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&S].rgba;break;case 50331648:o=(16777215&S)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&E){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&E].rgba;break;case 50331648:o=(16777215&E)<<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,r=k*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,r,(y-w)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,s,d,g)}_addRectangle(u,v,S,E,w,y,k,I,$,H){u[v]=S/this._dimensions.device.canvas.width,u[v+1]=E/this._dimensions.device.canvas.height,u[v+2]=w/this._dimensions.device.canvas.width,u[v+3]=y/this._dimensions.device.canvas.height,u[v+4]=k,u[v+5]=I,u[v+6]=$,u[v+7]=H}_addRectangleFloat(u,v,S,E,w,y,k){u[v]=S/this._dimensions.device.canvas.width,u[v+1]=E/this._dimensions.device.canvas.height,u[v+2]=w/this._dimensions.device.canvas.width,u[v+3]=y/this._dimensions.device.canvas.height,u[v+4]=k[0],u[v+5]=k[1],u[v+6]=k[2],u[v+7]=k[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,n){const c=l*n*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(n))}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),n=a(627),c=a(457),p=a(56),f=a(374),o=a(345),e=a(859),r=a(147),i=a(782),s=a(855),d=a(965),g=a(742),_=a(310),m=a(733);class u extends e.Disposable{constructor(w,y,k,I,$,H,F,b,R){super(),this._terminal=w,this._characterJoinerService=y,this._charSizeService=k,this._coreBrowserService=I,this._coreService=$,this._decorationService=H,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 m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,F,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(F.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const A={antialias:!1,depth:!1,preserveDrawingBuffer:R};if(this._gl=this._canvas.getContext("webgl2",A),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",B=>{console.log("webglcontextlost event received"),B.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(B)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",B=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(B,U)=>this._setCanvasDevicePixelDimensions(B,U)),this.register(this._coreBrowserService.onWindowChange(B=>{this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._canvas,B,(U,j)=>this._setCanvasDevicePixelDimensions(U,j))})),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 B;for(const U of this._renderLayers)U.dispose();(B=this._canvas.parentElement)==null||B.removeChild(this._canvas),(0,n.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,y){var k,I,$,H;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`,(k=this._rectangleRenderer.value)==null||k.setDimensions(this.dimensions),(I=this._rectangleRenderer.value)==null||I.handleResize(),($=this._glyphRenderer.value)==null||$.setDimensions(this.dimensions),(H=this._glyphRenderer.value)==null||H.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var w;for(const y of this._renderLayers)y.handleBlur(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.pause(),this._requestRedrawViewport()}handleFocus(){var w;for(const y of this._renderLayers)y.handleFocus(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.resume(),this._requestRedrawViewport()}handleSelectionChanged(w,y,k){for(const I of this._renderLayers)I.handleSelectionChanged(this._terminal,w,y,k);this._model.selection.update(this._core,w,y,k),this._requestRedrawViewport()}handleCursorMove(){var w;for(const y of this._renderLayers)y.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 y;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const w=(0,n.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(),(y=this._glyphRenderer.value)==null||y.setAtlas(this._charAtlas)}_clearModel(w){var y;this._model.clear(),w&&((y=this._glyphRenderer.value)==null||y.clear())}clearTextureAtlas(){var w;(w=this._charAtlas)==null||w.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var w;this._clearModel(!0);for(const y of this._renderLayers)y.reset(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(w){return-1}deregisterCharacterJoiner(w){return!1}renderRows(w,y){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 k of this._renderLayers)k.handleGridChanged(this._terminal,w,y);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(w,y),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,y){const k=this._core;let I,$,H,F,b,R,A,B,U,j,Y,V,P,x,z=this._workCell;w=S(w,k.rows-1,0),y=S(y,k.rows-1,0);const N=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,G=N-k.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,k.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 ne=!1;for($=w;$<=y;$++)for(H=$+k.buffer.ydisp,F=k.buffer.lines.get(H),this._model.lineLengths[$]=0,b=this._characterJoinerService.getJoinedCharacters(H),P=0;P<k.cols;P++)if(I=this._cellColorResolver.result.bg,F.loadCell(P,z),P===0&&(I=this._cellColorResolver.result.bg),R=!1,A=P,b.length>0&&P===b[0][0]&&(R=!0,B=b.shift(),z=new v(z,F.translateToString(!0,B[0],B[1]),B[1]-B[0]),A=B[1]-1),U=z.getChars(),j=z.getCode(),V=($*k.cols+P)*_.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(z,P,H,this.dimensions.device.cell.width),J&&H===N&&(P===K&&(this._model.cursor={x:K,y:G,width:z.getWidth(),style:this._coreBrowserService.isFocused?k.options.cursorStyle||"block":k.options.cursorInactiveStyle,cursorWidth:k.options.cursorWidth,dpr:this._devicePixelRatio},Q=K+z.getWidth()-1),P>=K&&P<=Q&&(this._coreBrowserService.isFocused&&(k.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&k.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)),j!==s.NULL_CELL_CODE&&(this._model.lineLengths[$]=P+1),(this._model.cells[V]!==j||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)&&(ne=!0,U.length>1&&(j|=_.COMBINED_CHAR_BIT_MASK),this._model.cells[V]=j,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,$,j,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,Y,I),R))for(z=this._workCell,P++;P<A;P++)x=($*k.cols+P)*_.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(P,$,s.NULL_CELL_CODE,0,0,0,s.NULL_CELL_CHAR,0,0),this._model.cells[x]=s.NULL_CELL_CODE,this._model.cells[x+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[x+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[x+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ne&&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,y){this._canvas.width===w&&this._canvas.height===y||(this._canvas.width=w,this._canvas.height=y,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 r.AttributeData{constructor(w,y,k){super(),this.content=0,this.combinedData="",this.fg=w.fg,this.bg=w.bg,this.combinedData=y,this._width=k}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 S(E,w,y=0){return Math.max(Math.min(E,w),y)}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(n,c,p){const f=(0,h.throwIfFalsy)(n.createShader(c));if(n.shaderSource(f,p),n.compileShader(f),n.getShaderParameter(f,n.COMPILE_STATUS))return f;console.error(n.getShaderInfoLog(f)),n.deleteShader(f)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(n,c,p){const f=(0,h.throwIfFalsy)(n.createProgram());if(n.attachShader(f,(0,h.throwIfFalsy)(l(n,n.VERTEX_SHADER,c))),n.attachShader(f,(0,h.throwIfFalsy)(l(n,n.FRAGMENT_SHADER,p))),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS))return f;console.error(n.getProgramInfoLog(f)),n.deleteProgram(f)},t.createShader=l,t.expandFloat32Array=function(n,c){const p=Math.min(2*n.length,c),f=new Float32Array(p);for(let o=0;o<n.length;o++)f[o]=n[o];return f},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),n=a(374),c=a(859);class p extends c.Disposable{constructor(o,e,r,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-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,c.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),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,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=p},733:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),n=a(592);class c extends n.BaseRenderLayer{constructor(f,o,e,r,i,s,d){super(e,f,"link",o,!0,i,s,d),this.register(r.onShowLinkUnderline(g=>this._handleShowLinkUnderline(g))),this.register(r.onHideLinkUnderline(g=>this._handleHideLinkUnderline(g)))}resize(f,o){super.resize(f,o),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,h.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let o=f.y1+1;o<f.y2;o++)this._fillBottomLineAtCells(0,o,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},274:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),n=a(374);let c,p=0,f=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(s,d,g,_,m,u){this._terminal=s,this._optionService=d,this._selectionRenderModel=g,this._decorationService=_,this._coreBrowserService=m,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,f=0,p=0,e=!1,o=!1,r=!1,c=this._themeService.colors,i=0,s.getCode()!==h.NULL_CELL_CODE&&s.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=d*_%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(d,g,"bottom",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(p=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),r=this._selectionRenderModel.isCellSelected(this._terminal,d,g),r){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)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}else 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}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(p=c.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(s.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))p=(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:p=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:p=(16777215&this.result.bg)<<8|255}else 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}p=l.rgba.blend(p,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(d,g,"top",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(p=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(f=r?-16777216&s.bg&-134217729|f|50331648:-16777216&s.bg|f|50331648),o&&(p=-16777216&s.fg&-67108865|p|50331648),67108864&this.result.fg&&(e&&!o&&(p=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&&(f=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?f:this.result.bg,this.result.fg=o?p: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),n=[];t.acquireTextureAtlas=function(c,p,f,o,e,r,i,s){const d=(0,l.generateConfig)(o,e,r,i,p,f,s);for(let m=0;m<n.length;m++){const u=n[m],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(),n.splice(m,1)):u.ownedBy.splice(v,1);break}}for(let m=0;m<n.length;m++){const u=n[m];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 n.push(_),_.atlas},t.removeTerminalFromCache=function(c){for(let p=0;p<n.length;p++){const f=n[p].ownedBy.indexOf(c);if(f!==-1){n[p].ownedBy.length===1?(n[p].atlas.dispose(),n.splice(p,1)):n[p].ownedBy.splice(f,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,n,c,p,f,o,e){const r={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:f.customGlyphs,devicePixelRatio:e,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:l,deviceCellHeight:n,deviceCharWidth:c,deviceCharHeight:p,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:r}},t.configEquals=function(l,n){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==n.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===n.devicePixelRatio&&l.customGlyphs===n.customGlyphs&&l.lineHeight===n.lineHeight&&l.letterSpacing===n.letterSpacing&&l.fontFamily===n.fontFamily&&l.fontSize===n.fontSize&&l.fontWeight===n.fontWeight&&l.fontWeightBold===n.fontWeightBold&&l.allowTransparency===n.allowTransparency&&l.deviceCharWidth===n.deviceCharWidth&&l.deviceCharHeight===n.deviceCharHeight&&l.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&l.minimumContrastRatio===n.minimumContrastRatio&&l.colors.foreground.rgba===n.colors.foreground.rgba&&l.colors.background.rgba===n.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,r,i,s,d,g,_){const m=t.blockElementDefinitions[e];if(m)return function(E,w,y,k,I,$){for(let H=0;H<w.length;H++){const F=w[H],b=I/8,R=$/8;E.fillRect(y+F.x*b,k+F.y*R,F.w*b,F.h*R)}}(o,m,r,i,s,d),!0;const u=l[e];if(u)return function(E,w,y,k,I,$){let H=n.get(w);H||(H=new Map,n.set(w,H));const F=E.fillStyle;if(typeof F!="string")throw new Error(`Unexpected fillStyle type "${F}"`);let b=H.get(F);if(!b){const R=w[0].length,A=w.length,B=E.canvas.ownerDocument.createElement("canvas");B.width=R,B.height=A;const U=(0,h.throwIfFalsy)(B.getContext("2d")),j=new ImageData(R,A);let Y,V,P,x;if(F.startsWith("#"))Y=parseInt(F.slice(1,3),16),V=parseInt(F.slice(3,5),16),P=parseInt(F.slice(5,7),16),x=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,x]=F.substring(5,F.length-1).split(",").map(z=>parseFloat(z))}for(let z=0;z<A;z++)for(let N=0;N<R;N++)j.data[4*(z*R+N)]=Y,j.data[4*(z*R+N)+1]=V,j.data[4*(z*R+N)+2]=P,j.data[4*(z*R+N)+3]=w[z][N]*(255*x);U.putImageData(j,0,0),b=(0,h.throwIfFalsy)(E.createPattern(B,null)),H.set(F,b)}E.fillStyle=b,E.fillRect(y,k,I,$)}(o,u,r,i,s,d),!0;const v=t.boxDrawingDefinitions[e];if(v)return function(E,w,y,k,I,$,H){E.strokeStyle=E.fillStyle;for(const[F,b]of Object.entries(w)){let R;E.beginPath(),E.lineWidth=H*Number.parseInt(F),R=typeof b=="function"?b(.15,.15/$*I):b;for(const A of R.split(" ")){const B=A[0],U=p[B];if(!U){console.error(`Could not find drawing instructions for "${B}"`);continue}const j=A.substring(1).split(",");j[0]&&j[1]&&U(E,f(j,I,$,y,k,!0,H))}E.stroke(),E.closePath()}}(o,v,r,i,s,d,_),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(E,w,y,k,I,$,H,F){const b=new Path2D;b.rect(y,k,I,$),E.clip(b),E.beginPath();const R=H/12;E.lineWidth=F*R;for(const A of w.d.split(" ")){const B=A[0],U=p[B];if(!U){console.error(`Could not find drawing instructions for "${B}"`);continue}const j=A.substring(1).split(",");j[0]&&j[1]&&U(E,f(j,I,$,y,k,!1,F,(w.leftPadding??0)*(R/2),(w.rightPadding??0)*(R/2)))}w.type===1?(E.strokeStyle=E.fillStyle,E.stroke()):E.fill(),E.closePath()}(o,S,r,i,s,d,g,_),!0)};const n=new Map;function c(o,e,r=0){return Math.max(Math.min(o,e),r)}const p={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 f(o,e,r,i,s,d,g,_=0,m=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-m*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]*=r,d&&u[v]!==0&&(u[v]=c(Math.round(u[v]+.5)-.5,r,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,n,c){let p=new n.ResizeObserver(f=>{const o=f.find(i=>i.target===l);if(!o)return;if(!("devicePixelContentBoxSize"in o))return p==null||p.disconnect(),void(p=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&c(e,r)});try{p.observe(l,{box:["device-pixel-content-box"]})}catch{p.disconnect(),p=void 0}return(0,h.toDisposable)(()=>p==null?void 0:p.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,n,c,p){return n===1&&c>Math.ceil(1.5*p)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(f){return 57344<=f&&f<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=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,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},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,n,c,p=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const f=l.buffers.active.ydisp,o=n[1]-f,e=c[1]-f,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=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),n=a(374),c=a(160),p=a(345),f=a(485),o=a(385),e=a(147),r=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,S,E){this._document=v,this._config=S,this._unicodeService=E,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.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 p.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new p.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(v,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.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 S=33;S<126;S++)v.enqueue(()=>{if(!this._cacheMap.get(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const E=this._drawToCache(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,E)}})}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 S=this._pages.filter(H=>2*H.canvas.width<=(d.maxTextureSize||4096)).sort((H,F)=>F.canvas.width!==H.canvas.width?F.canvas.width-H.canvas.width:F.percentageUsed-H.percentageUsed);let E=-1,w=0;for(let H=0;H<S.length;H++)if(S[H].canvas.width!==w)E=H,w=S[H].canvas.width;else if(H-E==3)break;const y=S.slice(E,E+4),k=y.map(H=>H.glyphs[0].texturePage).sort((H,F)=>H>F?1:-1),I=this.pages.length-y.length,$=this._mergePages(y,I);$.version++;for(let H=k.length-1;H>=0;H--)this._deletePage(k[H]);this.pages.push($),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire($.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,S){const E=2*v[0].canvas.width,w=new g(this._document,E,v);for(const[y,k]of v.entries()){const I=y*k.canvas.width%E,$=Math.floor(y/2)*k.canvas.height;w.ctx.drawImage(k.canvas,I,$);for(const F of k.glyphs)F.texturePage=S,F.sizeClipSpace.x=F.size.x/E,F.sizeClipSpace.y=F.size.y/E,F.texturePosition.x+=I,F.texturePosition.y+=$,F.texturePositionClipSpace.x=F.texturePosition.x/E,F.texturePositionClipSpace.y=F.texturePosition.y/E;this._onRemoveTextureAtlasCanvas.fire(k.canvas);const H=this._activePages.indexOf(k);H!==-1&&this._activePages.splice(H,1)}return w}_deletePage(v){this._pages.splice(v,1);for(let S=v;S<this._pages.length;S++){const E=this._pages[S];for(const w of E.glyphs)w.texturePage--;E.version++}}getRasterizedGlyphCombinedChar(v,S,E,w,y){return this._getFromCacheMap(this._cacheMapCombined,v,S,E,w,y)}getRasterizedGlyph(v,S,E,w,y){return this._getFromCacheMap(this._cacheMap,v,S,E,w,y)}_getFromCacheMap(v,S,E,w,y,k=!1){return s=v.get(S,E,w,y),s||(s=this._drawToCache(S,E,w,y,k),v.set(S,E,w,y,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,S,E,w){if(this._config.allowTransparency)return c.NULL_COLOR;let y;switch(v){case 16777216:case 33554432:y=this._getColorFromAnsiIndex(S);break;case 50331648:const k=e.AttributeData.toColorRGB(S);y=c.channels.toColor(k[0],k[1],k[2]);break;default:y=E?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return y}_getForegroundColor(v,S,E,w,y,k,I,$,H,F){const b=this._getMinimumContrastColor(v,S,E,w,y,k,I,H,$,F);if(b)return b;let R;switch(y){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&H&&k<8&&(k+=8),R=this._getColorFromAnsiIndex(k);break;case 50331648:const A=e.AttributeData.toColorRGB(k);R=c.channels.toColor(A[0],A[1],A[2]);break;default:R=I?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(R=c.color.opaque(R)),$&&(R=c.color.multiplyOpacity(R,h.DIM_OPACITY)),R}_resolveBackgroundRgba(v,S,E){switch(v){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return E?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(v,S,E,w){switch(v){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&w&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return E?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(v,S,E,w,y,k,I,$,H,F){if(this._config.minimumContrastRatio===1||F)return;const b=this._getContrastCache(H),R=b.getColor(v,w);if(R!==void 0)return R||void 0;const A=this._resolveBackgroundRgba(S,E,I),B=this._resolveForegroundRgba(y,k,I,$),U=c.rgba.ensureContrastRatio(A,B,this._config.minimumContrastRatio/(H?2:1));if(!U)return void b.setColor(v,w,null);const j=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return b.setColor(v,w,j),j}_getContrastCache(v){return v?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(v,S,E,w,y=!1){const k=typeof v=="number"?String.fromCharCode(v):v,I=Math.min(this._config.deviceCellWidth*Math.max(k.length,2)+4,this._textureSize);this._tmpCanvas.width<I&&(this._tmpCanvas.width=I);const $=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<$&&(this._tmpCanvas.height=$),this._tmpCtx.save(),this._workAttributeData.fg=E,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=w,this._workAttributeData.isInvisible())return i;const H=!!this._workAttributeData.isBold(),F=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),R=!!this._workAttributeData.isItalic(),A=!!this._workAttributeData.isUnderline(),B=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let j=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),V=this._workAttributeData.getBgColor(),P=this._workAttributeData.getBgColorMode();if(F){const X=j;j=V,V=X;const se=Y;Y=P,P=se}const x=this._getBackgroundColor(P,V,F,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const z=H?this._config.fontWeightBold:this._config.fontWeight,N=R?"italic":"";this._tmpCtx.font=`${N} ${z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const G=k.length===1&&(0,n.isPowerlineGlyph)(k.charCodeAt(0)),K=k.length===1&&(0,n.isRestrictedPowerlineGlyph)(k.charCodeAt(0)),Q=this._getForegroundColor(S,P,V,E,Y,j,F,b,H,(0,n.treatGlyphAsBackgroundColor)(k.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;const J=K?0:4;let ne=!1;this._config.customGlyphs!==!1&&(ne=(0,l.tryDrawCustomChar)(this._tmpCtx,k,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let ue,Z=!G;if(ue=typeof v=="number"?this._unicodeService.wcwidth(v):this._unicodeService.getStringCellWidth(v),A){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 _e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&_e<8&&(_e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(_e).css}this._tmpCtx.beginPath();const de=J,le=Math.ceil(J+this._config.deviceCharHeight)-se-(y?2*X:0),we=le+X,ve=le+2*X;let Se=this._workAttributeData.getUnderlineVariantOffset();for(let _e=0;_e<ue;_e++){this._tmpCtx.save();const he=de+_e*this._config.deviceCellWidth,ee=de+(_e+1)*this._config.deviceCellWidth,Fe=he+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ee,le),this._tmpCtx.moveTo(he,ve),this._tmpCtx.lineTo(ee,ve);break;case 3:const Ve=X<=1?ve:Math.ceil(J+this._config.deviceCharHeight-X/2)-se,Xe=X<=1?le:Math.ceil(J+this._config.deviceCharHeight+X/2)-se,It=new Path2D;It.rect(he,le,this._config.deviceCellWidth,ve-le),this._tmpCtx.clip(It),this._tmpCtx.moveTo(he-this._config.deviceCellWidth/2,we),this._tmpCtx.bezierCurveTo(he-this._config.deviceCellWidth/2,Xe,he,Xe,he,we),this._tmpCtx.bezierCurveTo(he,Ve,Fe,Ve,Fe,we),this._tmpCtx.bezierCurveTo(Fe,Xe,ee,Xe,ee,we),this._tmpCtx.bezierCurveTo(ee,Ve,ee+this._config.deviceCellWidth/2,Ve,ee+this._config.deviceCellWidth/2,we);break;case 4:const Ye=Se===0?0:Se>=X?2*X-Se:X-Se;Se>=X||Ye===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he+Ye,le),this._tmpCtx.lineTo(ee,le)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(he+Ye,le),this._tmpCtx.moveTo(he+Ye+X,le),this._tmpCtx.lineTo(ee,le)),Se=(0,n.computeNextVariantOffset)(ee-he,X,Se);break;case 5:const ki=.6,Ai=.3,lt=ee-he,Ft=Math.floor(ki*lt),Ht=Math.floor(Ai*lt),Mi=lt-Ft-Ht;this._tmpCtx.setLineDash([Ft,Ht,Mi]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ee,le);break;default:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ee,le)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ne&&this._config.fontSize>=12&&!this._config.allowTransparency&&k!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const _e=this._tmpCtx.measureText(k);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in _e&&_e.actualBoundingBoxDescent>0){this._tmpCtx.save();const he=new Path2D;he.rect(de,le-Math.ceil(X/2),this._config.deviceCellWidth*ue,ve-le+Math.ceil(X/2)),this._tmpCtx.clip(he),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(k,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*ue,J+se),this._tmpCtx.stroke()}if(ne||this._tmpCtx.fillText(k,J,J+this._config.deviceCharHeight),k==="_"&&!this._config.allowTransparency){let X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),x,Q,Z);if(X)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(k,J,J+this._config.deviceCharHeight-se),X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),x,Q,Z),X);se++);}if(B){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*ue,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();const Ce=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Me;if(Me=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}(Ce):_(Ce,x,Q,Z),Me)return i;const re=this._findGlyphBoundingBox(Ce,this._workBoundingBox,I,K,ne,J);let te,ie;for(;;){if(this._activePages.length===0){const X=this._createNewPage();te=X,ie=X.currentRow,ie.height=re.size.y;break}te=this._activePages[this._activePages.length-1],ie=te.currentRow;for(const X of this._activePages)re.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&&re.size.y<=se.height&&(te=this._activePages[X],ie=se);if(ie.y+re.size.y>=te.canvas.height||ie.height>re.size.y+2){let X=!1;if(te.currentRow.y+te.currentRow.height+re.size.y>=te.canvas.height){let se;for(const de of this._activePages)if(de.currentRow.y+de.currentRow.height+re.size.y<de.canvas.height){se=de;break}if(se)te=se;else if(d.maxAtlasPages&&this._pages.length>=d.maxAtlasPages&&ie.y+re.size.y<=te.canvas.height&&ie.height>=re.size.y&&ie.x+re.size.x<=te.canvas.width)X=!0;else{const de=this._createNewPage();te=de,ie=de.currentRow,ie.height=re.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:re.size.y},te.fixedRows.push(ie),te.currentRow={x:0,y:ie.y+ie.height,height:0})}if(ie.x+re.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 re.texturePage=this._pages.indexOf(te),re.texturePosition.x=ie.x,re.texturePosition.y=ie.y,re.texturePositionClipSpace.x=ie.x/te.canvas.width,re.texturePositionClipSpace.y=ie.y/te.canvas.height,re.sizeClipSpace.x/=te.canvas.width,re.sizeClipSpace.y/=te.canvas.height,ie.height=Math.max(ie.height,re.size.y),ie.x+=re.size.x,te.ctx.putImageData(Ce,re.texturePosition.x-this._workBoundingBox.left,re.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,re.size.x,re.size.y),te.addGlyph(re),te.version++,re}_findGlyphBoundingBox(v,S,E,w,y,k){S.top=0;const I=w?this._config.deviceCellHeight:this._tmpCanvas.height,$=w?this._config.deviceCellWidth:E;let H=!1;for(let F=0;F<I;F++){for(let b=0;b<$;b++){const R=F*this._tmpCanvas.width*4+4*b+3;if(v.data[R]!==0){S.top=F,H=!0;break}}if(H)break}S.left=0,H=!1;for(let F=0;F<k+$;F++){for(let b=0;b<I;b++){const R=b*this._tmpCanvas.width*4+4*F+3;if(v.data[R]!==0){S.left=F,H=!0;break}}if(H)break}S.right=$,H=!1;for(let F=k+$-1;F>=k;F--){for(let b=0;b<I;b++){const R=b*this._tmpCanvas.width*4+4*F+3;if(v.data[R]!==0){S.right=F,H=!0;break}}if(H)break}S.bottom=I,H=!1;for(let F=I-1;F>=0;F--){for(let b=0;b<$;b++){const R=F*this._tmpCanvas.width*4+4*b+3;if(v.data[R]!==0){S.bottom=F,H=!0;break}}if(H)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:S.right-S.left+1,y:S.bottom-S.top+1},sizeClipSpace:{x:S.right-S.left+1,y:S.bottom-S.top+1},offset:{x:-S.left+k+(w||y?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+k+(w||y?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,S,E){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],E)for(const w of E)this._glyphs.push(...w.glyphs),this._usedPixels+=w._usedPixels;this.canvas=m(v,S,S),this.ctx=(0,n.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,S,E){const w=v.rgba>>>24,y=v.rgba>>>16&255,k=v.rgba>>>8&255,I=S.rgba>>>24,$=S.rgba>>>16&255,H=S.rgba>>>8&255,F=Math.floor((Math.abs(w-I)+Math.abs(y-$)+Math.abs(k-H))/12);let b=!0;for(let R=0;R<u.data.length;R+=4)u.data[R]===w&&u.data[R+1]===y&&u.data[R+2]===k||E&&Math.abs(u.data[R]-w)+Math.abs(u.data[R+1]-y)+Math.abs(u.data[R+2]-k)<F?u.data[R+3]=0:b=!1;return b}function m(u,v,S){const E=u.createElement("canvas");return E.width=v,E.height=S,E}},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,n=0;var c,p,f,o,e;function r(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,_,m){return m!==void 0?`#${r(d)}${r(g)}${r(_)}${r(m)}`:`#${r(d)}${r(g)}${r(_)}`},s.toRgba=function(d,g,_,m=255){return(d<<24|g<<16|_<<8|m)>>>0},s.toColor=function(d,g,_,m){return{css:s.toCss(d,g,_,m),rgba:s.toRgba(d,g,_,m)}}}(c||(t.channels=c={})),function(s){function d(g,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}s.blend=function(g,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const m=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,S=g.rgba>>24&255,E=g.rgba>>16&255,w=g.rgba>>8&255;return a=S+Math.round((m-S)*n),h=E+Math.round((u-E)*n),l=w+Math.round((v-w)*n),{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,_,m){const u=e.ensureContrastRatio(g.rgba,_.rgba,m);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 n=255&g.rgba,d(g,n*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(p||(t.color=p={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const m=_.getContext("2d",{willReadFrequently:!0});m&&(d=m,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),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const m=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),c.toColor(a,h,l,n);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,n]=d.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}}(f||(t.css=f={})),function(s){function d(g,_,m){const u=g/255,v=_/255,S=m/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*(S<=.03928?S/12.92:Math.pow((S+.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(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,k=m>>8&255,I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));for(;I<u&&(w>0||y>0||k>0);)w-=Math.max(0,Math.ceil(.1*w)),y-=Math.max(0,Math.ceil(.1*y)),k-=Math.max(0,Math.ceil(.1*k)),I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|k<<8|255)>>>0}function g(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,k=m>>8&255,I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));for(;I<u&&(w<255||y<255||k<255);)w=Math.min(255,w+Math.ceil(.1*(255-w))),y=Math.min(255,y+Math.ceil(.1*(255-y))),k=Math.min(255,k+Math.ceil(.1*(255-k))),I=i(o.relativeLuminance2(w,y,k),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|k<<8|255)>>>0}s.blend=function(_,m){if(n=(255&m)/255,n===1)return m;const u=m>>24&255,v=m>>16&255,S=m>>8&255,E=_>>24&255,w=_>>16&255,y=_>>8&255;return a=E+Math.round((u-E)*n),h=w+Math.round((v-w)*n),l=y+Math.round((S-y)*n),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,m,u){const v=o.relativeLuminance(_>>8),S=o.relativeLuminance(m>>8);if(i(v,S)<u){if(S<v){const y=d(_,m,u),k=i(v,o.relativeLuminance(y>>8));if(k<u){const I=g(_,m,u);return k>i(v,o.relativeLuminance(I>>8))?y:I}return y}const E=g(_,m,u),w=i(v,o.relativeLuminance(E>>8));if(w<u){const y=d(_,m,u);return w>i(v,o.relativeLuminance(y>>8))?E:y}return E}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=r,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 n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].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,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,p){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,p)}get(h,l,n,c){var p;return(p=this._data.get(h,l))==null?void 0:p.get(n,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(p){this._tasks.push(p),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(p){this._idleCallback=void 0;let f=0,o=0,e=p.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),r=p.timeRemaining(),1.5*o>r)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=r}this.clear()}}class n extends l{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const f=Date.now()+p;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,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(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}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(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,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),n=a(147);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new c;return o.setFromCharData(f),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(f){this.fg=f[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[l.CHAR_DATA_CHAR_INDEX].length===2){const e=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|f[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[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 n="";for(let c=h;c<l;++c){let p=a[c];p>65535?(p-=65536,n+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):n+=String.fromCharCode(p)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const p=a.charCodeAt(c++);56320<=p&&p<=57343?h[n++]=1024*(this._interim-55296)+p-56320+65536:(h[n++]=this._interim,h[n++]=p),this._interim=0}for(let p=c;p<l;++p){const f=a.charCodeAt(p);if(55296<=f&&f<=56319){if(++p>=l)return this._interim=f,n;const o=a.charCodeAt(p);56320<=o&&o<=57343?h[n++]=1024*(f-55296)+o-56320+65536:(h[n++]=f,h[n++]=o)}else f!==65279&&(h[n++]=f)}return n}},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 n,c,p,f,o=0,e=0,r=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,m=0;for(;(_=63&this.interim[++m])&&m<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-m;for(;r<v;){if(r>=l)return 0;if(_=a[r++],(192&_)!=128){r--,d=!0;break}this.interim[m++]=_,g<<=6,g|=63&_}d||(u===2?g<128?r--: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=r;for(;s<l;){for(;!(!(s<i)||128&(n=a[s])||128&(c=a[s+1])||128&(p=a[s+2])||128&(f=a[s+3]));)h[o++]=n,h[o++]=c,h[o++]=p,h[o++]=f,s+=4;if(n=a[s++],n<128)h[o++]=n;else if((224&n)==192){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&n)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&n)==224){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(e=(15&n)<<12|(63&c)<<6|63&p,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=p,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&p)<<6|63&f,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(M,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),c=a(97),p={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 f,o=t.LogService=class extends n.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())),f=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){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,r)}debug(e,...r){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,r)}info(e,...r){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,r)}warn(e,...r){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,r)}error(e,...r){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,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(f.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);f.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return f.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 n=function(c,p,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(n,c,f)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},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(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.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")}},T={};function O(M){var t=T[M];if(t!==void 0)return t.exports;var a=T[M]={exports:{}};return D[M].call(a.exports,a,a.exports,O),a.exports}var W={};return(()=>{var M=W;Object.defineProperty(M,"__esModule",{value:!0}),M.WebglAddon=void 0;const t=O(345),a=O(859),h=O(399),l=O(666),n=O(776);class c extends a.Disposable{constructor(f){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=f,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(f){const o=f._core;if(!f.element)return void this.register(o.onWillOpen(()=>this.activate(f)));this._terminal=f;const e=o.coreService,r=o.optionsService,i=o,s=i._renderService,d=i._characterJoinerService,g=i._charSizeService,_=i._coreBrowserService,m=i._decorationService,u=i._logService,v=i._themeService;(0,n.setTraceLogger)(u),this._renderer=this.register(new l.WebglRenderer(f,d,g,_,e,m,r,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 S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(f.cols,f.rows)}))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}M.WebglAddon=c})(),W})())})(ti);var Ki=ti.exports;const Gi={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},Vi=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],ct=[0,95,135,175,215,255];function Nt(C,L){if(C<0)return L;if(C<16)return Vi[C]??L;if(C<232){const D=C-16,T=ct[Math.floor(D/36)%6],O=ct[Math.floor(D/6)%6],W=ct[D%6];return`rgb(${T},${O},${W})`}if(C<256){const D=8+(C-232)*10;return`rgb(${D},${D},${D})`}return`#${(C&16777215).toString(16).padStart(6,"0")}`}const Wt="\x1Bc";class Xi{constructor(L){be(this,"term");be(this,"fit",new qi.FitAddon);be(this,"onInput",null);be(this,"shouldSendKey",null);this.term=new ji.Terminal({theme:Gi,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(L);try{this.term.loadAddon(new Ki.WebglAddon)}catch{}this.term.onData(D=>{var T;return(T=this.onInput)==null?void 0:T.call(this,D)}),this.term.attachCustomKeyEventHandler(D=>{var T;return((T=this.shouldSendKey)==null?void 0:T.call(this,D))??!0}),this.bindTouchScroll(L),this.fitNow()}bindTouchScroll(L){let D=0,T=0;L.addEventListener("touchstart",O=>{O.touches.length===1&&(D=O.touches[0].clientY,T=0)},{capture:!0,passive:!0}),L.addEventListener("touchmove",O=>{if(O.touches.length!==1||!this.wantsWheel())return;O.preventDefault(),O.stopPropagation();const W=O.touches[0];T+=(D-W.clientY)/this.rowHeight(),D=W.clientY;const M=Math.trunc(T);if(M===0)return;T-=M;const t=L.querySelector(".xterm-screen");if(!t)return;const a={deltaY:Math.sign(M),deltaMode:WheelEvent.DOM_DELTA_LINE,clientX:W.clientX,clientY:W.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 T;const L=(T=this.term.element)==null?void 0:T.querySelector(".xterm-screen"),D=L&&this.term.rows>0?L.clientHeight/this.term.rows:0;return D>0?D:16}replay(L){this.term.write(Wt+L)}write(L){this.term.write(L)}paste(L){this.term.paste(L)}clear(){this.term.write(Wt)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}}function Yi(C,L){if(!C)return null;if(L.some(T=>T.id===C.id))return C;const D=L.find(T=>T.slot===C.slot);return D?{id:D.id,slot:D.slot}:null}const Rt=/^image\/(png|jpeg|gif|webp)$/;function Ji(C){return/\s/.test(C)?`"${C}"`:C}function Zi(C){for(const L of["dragover","drop"])C.addEventListener(L,D=>D.preventDefault())}function Qi(C,L){let D=0;const T=W=>{C.classList.toggle("dropping",W)},O=W=>{var M;return Array.from(((M=W.dataTransfer)==null?void 0:M.types)??[]).includes("Files")};C.addEventListener("dragenter",W=>{O(W)&&(W.preventDefault(),D++,T(!0))}),C.addEventListener("dragover",W=>{O(W)&&(W.preventDefault(),W.dataTransfer&&(W.dataTransfer.dropEffect="copy"))}),C.addEventListener("dragleave",()=>{D=Math.max(0,D-1),D===0&&T(!1)}),C.addEventListener("drop",W=>{var M;O(W)&&(W.preventDefault(),D=0,T(!1),es(Array.from(((M=W.dataTransfer)==null?void 0:M.files)??[]),L))})}async function es(C,L){const D=C.filter(T=>Rt.test(T.type));if(D.length===0){L.onError(C.length>0?"only PNG, JPEG, GIF and WebP images can be dropped on a terminal":"nothing to drop");return}await nt(D,L)}async function nt(C,L){if(!L.ready()){L.onError("focus a session first — the image goes into its prompt");return}const D=[];for(const T of C)try{D.push(Ji(await L.upload(T)))}catch(O){L.onError(O.message);break}D.length>0&&L.insert(D.join(" ")+" ")}function ii(C){return Array.from(C??[]).filter(L=>Rt.test(L.type))}function ts(C,L){C.addEventListener("paste",D=>{var O;const T=ii((O=D.clipboardData)==null?void 0:O.files);T.length!==0&&(D.preventDefault(),D.stopPropagation(),nt(T,L))},{capture:!0})}async function is(C){const L=[];let D="";for(const T of C){const O=T.types.find(W=>Rt.test(W));O?L.push(await T.getType(O)):T.types.includes("text/plain")&&(D+=await(await T.getType("text/plain")).text())}return{images:L,text:D}}async function ss(C){if(!C.ready()){C.onError("focus a session first — the paste goes into its prompt");return}let L;try{L=await navigator.clipboard.read()}catch{C.fallback();return}const{images:D,text:T}=await is(L);D.length>0?await nt(D,C):T?C.insert(T):C.onError("nothing on the clipboard to paste")}const Ut="#071411",rs="#dceee7";class ns{constructor(L){be(this,"ctx");be(this,"last",null);this.canvas=L,this.ctx=L.getContext("2d",{alpha:!1})}paint(L=this.last){if(!this.ctx||!L)return;this.last=L;const D=window.devicePixelRatio||1,T=this.canvas.clientWidth,O=this.canvas.clientHeight;if(T===0||O===0)return;(this.canvas.width!==Math.round(T*D)||this.canvas.height!==Math.round(O*D))&&(this.canvas.width=Math.round(T*D),this.canvas.height=Math.round(O*D));const W=this.ctx;W.setTransform(D,0,0,D,0,0),W.fillStyle=Ut,W.fillRect(0,0,T,O);const M=T/Math.max(L.cols,1),t=Math.max(M/.6,1),a=O/Math.max(L.rows.length,1);W.textBaseline="top",W.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<L.rows.length;h++){const l=L.rows[h];if(!l)continue;let n=0;for(const c of l){const p=c.text.length*M;c.bg>=0&&(W.fillStyle=Nt(c.bg,Ut),W.fillRect(n,h*a,p,a)),c.text.trim()!==""&&(W.fillStyle=Nt(c.fg,rs),W.fillText(c.text,n,h*a)),n+=p}}}refresh(){this.last&&this.paint(this.last)}}const Ne=[4,8,12,16],zt=16;function si(C){return C<12?os(C/2):as(C/4+1)}function os(C){const L=new Map;for(let D=1;D<=C;D++)L.set(D,{row:1,col:D});for(let D=0;D<C;D++)L.set(C+1+D,{row:3,col:C-D});return{cols:C,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${C+1}`,cells:L}}function as(C){const L=[];for(let D=1;D<=C;D++)L.push({row:1,col:D});for(let D=2;D<=C-1;D++)L.push({row:D,col:C});for(let D=C;D>=1;D--)L.push({row:C,col:D});for(let D=C-1;D>=2;D--)L.push({row:D,col:1});return{cols:C,rows:C,rowTemplate:`repeat(${C}, 1fr)`,focus:`2 / 2 / ${C} / ${C}`,cells:new Map(L.map((D,T)=>[T+1,D]))}}const ri="tring.ring";let ni=hs();function hs(){try{const C=Number(localStorage.getItem(ri));return ls(C)?C:zt}catch{return zt}}function ls(C){return Ne.includes(C)}function ze(){return ni}function cs(C){ni=C;try{localStorage.setItem(ri,String(C))}catch{}}function ds(C,L,D){const T=si(D);C.style.gridTemplateColumns=`repeat(${T.cols}, 1fr)`,C.style.gridTemplateRows=T.rowTemplate,L.style.gridArea=T.focus}function us(C,L,D){const T=si(D).cells.get(L);T&&(C.style.gridRow=String(T.row),C.style.gridColumn=String(T.col))}const oi="tring.sound";let Je=null,Dt=_s();function _s(){try{return localStorage.getItem(oi)!=="off"}catch{return!0}}function He(){return Dt}function fs(C){Dt=C;try{localStorage.setItem(oi,C?"on":"off")}catch{}C&&kt()}async function kt(){try{return Je??(Je=new AudioContext),Je.state==="suspended"&&await Je.resume(),Je}catch{return null}}document.addEventListener("pointerdown",()=>void kt(),{once:!0});function jt(C,L,D,T,O){const W=C.createOscillator(),M=C.createGain();W.type="sine",W.frequency.setValueAtTime(D,L),M.gain.setValueAtTime(0,L),M.gain.linearRampToValueAtTime(T,L+.004),M.gain.exponentialRampToValueAtTime(1e-4,L+O),W.connect(M).connect(C.destination),W.start(L),W.stop(L+O)}function ps(){Dt&&kt().then(C=>{if(!C)return;const L=C.currentTime;for(const D of[0,.085])jt(C,L+D,1568,.13,.55),jt(C,L+D,2349,.05,.4)})}const ai="tring.usage",hi="tring.usage.view",li=(C,L)=>{try{const D=localStorage.getItem(C);return D===null?L:JSON.parse(D)}catch{return L}},ci=(C,L)=>{try{localStorage.setItem(C,JSON.stringify(L))}catch{}};let At=li(ai,!1);const ft=()=>At;function vs(C){At=C,ci(ai,C)}const gs=()=>At&&li(hi,!1),di=C=>ci(hi,C),ms=()=>Jt("/api/usage");function $e(C){return C>=1e9?`${(C/1e9).toFixed(1)}B`:C>=1e6?`${(C/1e6).toFixed(1)}M`:C>=1e3?`${Math.round(C/1e3)}k`:String(C)}const qt=C=>`$${C.toFixed(2)}`,Kt=C=>new Date(C).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function oe(C,L,D){const T=document.createElement(C);return L&&(T.className=L),D!==void 0&&(T.textContent=D),T}function ui(C,L,D=!0){const T=Math.min(100,C/L*100),O=oe("div","meter"),W=oe("i");return W.style.width=`${T}%`,D&&(T>=90?W.classList.add("hot"):T>=75&&W.classList.add("warm")),O.append(W),O.setAttribute("role","progressbar"),O.setAttribute("aria-valuenow",String(Math.round(T))),O}function pt(C,L,D){C.replaceChildren();const T=oe("div","usage");if(D){T.append(oe("h2",void 0,"Claude usage")),T.append(oe("p","hint",D)),C.append(T);return}if(!L){T.append(oe("p","hint","asking Claude Code…")),C.append(T);return}if(L.limits.length>0){for(const M of L.limits)T.append(Ss(M));T.append(oe("p","source","from Claude Code’s own /usage"))}else{const M=L.window;T.append(Gt("5-hour window",`${$e(M.tokens)} tokens`,M.resetsAt?`resets ${Kt(M.resetsAt)}`:"nothing running")),T.append(Gt("This week",`${$e(L.week.tokens)} tokens`,"rolling 7 days")),T.append(oe("p","source",`${L.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const O=oe("div","utotals"),W=(M,t)=>{const a=oe("div","ucell");return a.append(oe("b",void 0,t),oe("span",void 0,M)),a};if(O.append(W("tokens today",$e(L.today.tokens))),O.append(W("today, est.",qt(L.today.cost))),O.append(W("this week, est.",qt(L.week.cost))),O.append(W("cache reads, 7d",$e(L.week.cacheReadTokens))),T.append(O),L.projects.length>0){T.append(oe("h3",void 0,"By project, last 7 days"));const M=L.projects[0].tokens,t=oe("div","uprojects");for(const a of L.projects.slice(0,8)){const h=oe("div","uproject");h.append(oe("span","nm",a.name)),h.append(ui(a.tokens,M,!1)),h.append(oe("span","tag",$e(a.tokens))),t.append(h)}T.append(t)}T.append(oe("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${Kt(L.scannedAt)}.`)),C.append(T)}function Ss(C){const L=oe("div","urow"),D=oe("div","uhead");if(D.append(oe("span","ulabel",C.label)),D.append(oe("span","upct",`${C.percent}%`)),L.append(D),L.append(ui(C.percent,100)),C.resets){const T=oe("div","ufoot");T.append(oe("span","unote",`resets ${C.resets}`)),L.append(T)}return L}function Gt(C,L,D){const T=oe("div","urow"),O=oe("div","uhead");O.append(oe("span","ulabel",C)),O.append(oe("span","upct",L)),T.append(O);const W=oe("div","ufoot");return W.append(oe("span","unote",D)),T.append(W),T}function Cs(C,L,D,T,O,W=!1){C.replaceChildren();const M=document.createElement("div");M.className="logo",M.title="tring";for(let l=0;l<9;l++)M.append(document.createElement("i"));C.append(M);for(const l of L){const n=l.sessions.filter(f=>f.status==="done").length,c=document.createElement("button");c.className="tab"+(!W&&l.id===D?" active":""),c.title=l.root;const p=document.createElement("span");if(p.className="nm",p.textContent=l.name,c.append(p),n>0){const f=document.createElement("span");f.className="badge",f.textContent=String(n),c.append(f)}c.onclick=()=>T.onSelect(l.id),c.oncontextmenu=f=>{f.preventDefault(),T.onContext(l.id,{x:f.clientX,y:f.clientY})},C.append(c)}if(ft()){const l=document.createElement("button");l.className="tab pinned"+(W?" active":""),l.title="Claude usage";const n=document.createElement("span");n.className="nm",n.textContent="Usage",l.append(n),l.onclick=()=>T.onUsage(),C.append(l)}const t=document.createElement("button");t.className="add",t.textContent="+",t.title="New project",t.onclick=()=>T.onAdd(),C.append(t);const a=document.createElement("button");a.className="iconbtn"+(He()?" on":""),a.innerHTML=ws(He()),a.title=He()?"Sound on — click to mute":"Sound off — click to unmute",a.setAttribute("aria-label",a.title),a.setAttribute("aria-pressed",String(He())),a.onclick=()=>{fs(!He()),T.onSoundToggle()},a.style.marginLeft=O?"0":"auto",C.append(a);const h=document.createElement("button");if(h.className="iconbtn",h.innerHTML=bs(),h.title="Settings",h.setAttribute("aria-label",h.title),h.onclick=()=>T.onSettings(),C.append(h),O){const l=document.createElement("button");l.className="update",l.textContent=`v${O.latest} available`,l.title=`You are on ${O.current}`,l.onclick=()=>T.onUpdate(O),C.insertBefore(l,a)}}function bs(){return _i('<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 _i(C){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">${C}</svg>`}function ws(C){return _i(`<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"/>${C?"":'<path d="M2.5 2.5l11 11"/>'}`)}const fi="(max-width: 720px)";function ys(C){return C?{key:String(C.slot),name:C.name??C.title??"shell",status:C.status}:{key:"—",name:"pick a session",status:"idle"}}function Es(C,L,D,T){C.replaceChildren();const O=ys(L),W=document.createElement("button");W.className=`current st-${O.status}`,W.title="Switch session",W.setAttribute("aria-haspopup","dialog");const M=Ze("key",O.key),t=Ze("nm",O.name),a=Ze("tag",L?O.status:"");W.append(M,t,a,Ls()),W.onclick=()=>T.onOpen(),C.append(W);const h=document.createElement("button");h.className="paste",h.disabled=!L,h.title=L?"Paste from the clipboard":"Focus a session to paste",h.setAttribute("aria-label","Paste"),h.innerHTML=vt('<rect x="4" y="3" width="8" height="11" rx="1.5"/><path d="M6 3V2h4v1M6.5 7h3M6.5 10h3"/>'),h.onclick=()=>T.onPaste(),C.append(h);const l=document.createElement("button");l.className="next",l.disabled=D===0,l.title=D>0?`Next finished session (${D})`:"No finished sessions",l.setAttribute("aria-label",l.title),l.innerHTML=vt('<path d="M5 3l6 5-6 5"/>'),D>0&&l.append(Ze("badge",String(D))),l.onclick=()=>T.onNext(),C.append(l)}function Ze(C,L){const D=document.createElement("span");return D.className=C,D.textContent=L,D}function Ls(){const C=document.createElement("span");return C.className="chev",C.innerHTML=vt('<path d="M4 6l4 4 4-4"/>'),C}function vt(C){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">${C}</svg>`}const Ee=document.getElementById("overlay");let gt=null;function qe(){return!Ee.hidden}function ae(){Ee.hidden=!0,Ee.replaceChildren();const C=gt;gt=null,C==null||C()}function ye(C,L={}){var D;gt=L.onClosed??null,Ee.replaceChildren(C),Ee.hidden=!1,L.dismissible!==!1?Ee.onclick=T=>{T.target===Ee&&ae()}:Ee.onclick=null,(D=C.querySelector("input, button"))==null||D.focus()}function q(C,L,D){const T=document.createElement(C);return L&&(T.className=L),D!==void 0&&(T.textContent=D),T}function pi(C){const L=q("div","browser"),D=q("div","crumb"),T=q("div","dirlist");L.append(D,T);let O=!1;async function W(M){if(!O){O=!0,T.replaceChildren(q("div","dirnote","loading…"));try{const t=M?`?path=${encodeURIComponent(M)}`:"",a=await Jt(`/api/fs${t}`);if(C.value=a.path,D.replaceChildren(),a.parent){const h=q("button","up","↑ "+a.parent);h.type="button",h.onclick=()=>void W(a.parent),D.append(h)}else D.append(q("span","dirnote",a.path));T.replaceChildren(),a.entries.length===0&&T.append(q("div","dirnote","no subdirectories"));for(const h of a.entries){const l=q("button",void 0,h.name);l.type="button",l.onclick=()=>void W(h.path),T.append(l)}}catch(t){T.replaceChildren(q("div","dirnote",t.message))}finally{O=!1}}}return C.addEventListener("change",()=>void W(C.value.trim()||void 0)),W(C.value.trim()||void 0),L}function xs(C,L,D,T){const O=q("div","panel picker");O.append(q("h2",void 0,C?C.name:"No project")),O.append(q("p","hint",`${D} session${D===1?"":"s"} finished across all projects`));const W=q("div","rows"),M=new Map;for(const c of(C==null?void 0:C.sessions)??[])M.set(c.slot,c);const t=window.matchMedia(fi).matches;for(let c=1;c<=ze();c++){const p=M.get(c),f=q("button",`row st-${(p==null?void 0:p.status)??"idle"}`);(p==null?void 0:p.status)==="busy"&&f.classList.add("dim"),p||f.classList.add("dim"),f.append(q("span","key",t?String(c):Lt(c))),f.append(q("span","nm",p?p.name??p.title??p.cwd.split("/").pop()??"shell":"— empty")),p&&f.append(q("span","tag",p.status)),f.onclick=()=>{ae(),T.onPickSlot(c)},W.append(f)}O.append(W);const a=q("div","picker-actions"),h=q("button","btn","Next finished");h.type="button",h.disabled=D===0,h.onclick=()=>{ae(),T.onNextDone()};const l=q("button","btn","New session");l.type="button",l.onclick=()=>{ae(),T.onNewSession()},a.append(h,l),O.append(a);const n=q("div","legend");n.innerHTML="<b>n</b> next finished &nbsp; <b>p</b> projects &nbsp; <b>c</b> new session &nbsp; <b>r</b> rename &nbsp; <b>x</b> kill &nbsp; <b>m</b> mark seen &nbsp; <b>esc</b> close",O.append(n),ye(O),O.dataset.projects=String(L.length)}function Rs(C,L){const D=q("div","panel");D.append(q("h2",void 0,"Projects")),D.append(q("p","hint",`Each project owns its own ${ze()} slots.`));const T=q("div","rows");C.forEach((O,W)=>{const M=O.sessions.filter(a=>a.status==="done").length,t=q("button","row st-done");t.append(q("span","key",W<9?String(W+1):"—")),t.append(q("span","nm",O.name)),t.append(q("span","tag",M>0?`${M} done`:O.root)),t.onclick=()=>{ae(),L(O.id)},T.append(t)}),D.append(T),ye(D)}function vi(C,L){const D=q("div","panel");D.append(q("h2",void 0,C.title)),D.append(q("p","hint",C.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 T=q("form"),O=q("input");O.value=C.name??"",O.placeholder="api-service",O.required=!0;const W=q("label","field");W.append(q("span",void 0,"Project name"),O);const M=q("input");M.value=C.root??"",M.placeholder="/home/you/code/api-service",M.required=!0,M.disabled=!!C.rootLocked;const t=q("label","field");t.append(q("span",void 0,C.rootLocked?"Root directory (fixed after creation)":"Root directory"),M),T.append(W,t),C.rootLocked||T.append(pi(M));const a=q("div","actions");if(C.onDelete){const l=q("button","btn danger","Delete project");l.type="button",l.onclick=()=>{var n;ae(),(n=C.onDelete)==null||n.call(C)},a.append(l),a.style.justifyContent="space-between"}if(!C.blocking){const l=q("button","btn","Cancel");l.type="button",l.onclick=()=>ae(),a.append(l)}const h=q("button","btn primary",C.onDelete?"Save":"Create");h.type="submit",a.append(h),T.append(a),T.onsubmit=l=>{l.preventDefault(),!(!O.value.trim()||!M.value.trim())&&(ae(),L(O.value.trim(),M.value.trim()))},D.append(T),ye(D,{dismissible:!C.blocking}),O.focus(),O.select()}function Ds(C,L){const D=q("div","panel");D.append(q("h2",void 0,`New session in slot ${C.slot}`)),D.append(q("p","hint","Defaults to the project root."));const T=q("form"),O=(n,c,p)=>{const f=q("input");f.value=c,f.placeholder=p;const o=q("label","field");return o.append(q("span",void 0,n),f),T.append(o),f},W=O("Working directory",C.cwd,C.cwd);T.append(pi(W));const M=O("Command (optional)","","claude"),t=O("Name (optional)","","agent"),a=q("div","actions"),h=q("button","btn","Cancel");h.type="button",h.onclick=()=>ae();const l=q("button","btn primary","Start");l.type="submit",a.append(h,l),T.append(a),T.onsubmit=n=>{n.preventDefault(),ae(),L({cwd:W.value.trim()||C.cwd,command:M.value.trim()||null,name:t.value.trim()||null})},D.append(T),ye(D)}const ks=["#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 As(C,L){const D=q("div","panel");D.append(q("h2",void 0,`Slot ${C.slot}`)),D.append(q("p","hint",C.cwd));const T=q("form"),O=q("input");O.value=C.name??"",O.placeholder=C.title??"shell";const W=q("label","field");W.append(q("span",void 0,"Name"),O),T.append(W);let M=C.color;const t=q("div","swatches"),a=()=>{for(const f of Array.from(t.children))f.classList.toggle("active",f.dataset.color===(M??""))},h=(f,o)=>{const e=q("button","swatch");e.type="button",e.dataset.color=f??"",e.title=o,e.setAttribute("aria-label",o),f?e.style.setProperty("--tint",f):e.classList.add("none"),e.onclick=()=>{M=f,a()},t.append(e)};h(null,"No colour");for(const f of ks)h(f,f);a();const l=q("div","field");l.append(q("span",void 0,"Border colour"),t),T.append(l);const n=q("div","actions"),c=q("button","btn","Cancel");c.type="button",c.onclick=()=>ae();const p=q("button","btn primary","Save");p.type="submit",n.append(c,p),T.append(n),T.onsubmit=f=>{f.preventDefault(),ae(),L({name:O.value.trim(),color:M})},D.append(T),ye(D),O.focus(),O.select()}function Ms(C,L){const D=q("div","panel");D.append(q("h2",void 0,"Settings"));let T=C.ring;const O=q("div","field ring-size");O.append(q("span",void 0,"Terminals around the focus"));const W=q("div","choices");for(const n of Ne){const c=q("button","choice"+(n===T?" active":""));c.type="button",c.append(q("b",void 0,String(n))),c.append(q("span",void 0,n<12?"wide centre":"full ring")),c.onclick=()=>{T=n;for(const p of Array.from(W.children))p.classList.remove("active");c.classList.add("active")},W.append(c)}O.append(W),D.append(O),D.append(q("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=q("label","field toggle"),t=q("input");t.type="checkbox",t.checked=C.usage,M.append(t,q("span",void 0,"Enable Claude usage monitoring")),D.append(M),D.append(q("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=q("div","actions"),h=q("button","btn","Cancel");h.type="button",h.onclick=()=>ae();const l=q("button","btn primary","Save");l.onclick=()=>{ae(),L({ring:T,usage:t.checked})},a.append(h,l),D.append(a),ye(D)}function Ts(C,L){const D=q("div","panel");D.append(q("h2",void 0,`tring ${L} is available`)),D.append(q("p","hint",`You are running ${C}. Update with:`));const T=q("pre","cmd","npm i -g tring-chat");D.append(T),D.append(q("p","hint","Running sessions are not affected until you restart the daemon."));const O=q("div","actions"),W=q("button","btn","Copy command");W.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{W.textContent="Copied"},()=>{W.textContent="Copy failed"})};const M=q("button","btn primary","Close");M.onclick=()=>ae(),O.append(W,M),D.append(O),ye(D)}function gi(C,L,D){const T=q("div","panel");T.append(q("h2",void 0,C)),T.append(q("p","hint",L));const O=q("div","actions"),W=q("button","btn","Cancel");W.onclick=()=>ae();const M=q("button","btn primary","Confirm");M.onclick=()=>{ae(),D()},O.append(W,M),T.append(O),ye(T)}function Bs(C){const L=q("div","panel paste-sheet");L.append(q("h2",void 0,"Paste")),L.append(q("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 D=q("textarea","paste-box");D.rows=4,D.placeholder="paste here",D.autocomplete="off",D.autocapitalize="off",D.spellcheck=!1,D.addEventListener("paste",M=>{var a;const t=ii((a=M.clipboardData)==null?void 0:a.files);t.length!==0&&(M.preventDefault(),ae(),C.onImages(t))}),L.append(D);const T=q("div","actions"),O=q("button","btn","Cancel");O.onclick=()=>ae();const W=q("button","btn primary","Insert");W.onclick=()=>{const M=D.value;ae(),M&&C.onText(M)},T.append(O,W),L.append(T),ye(L),D.focus()}const Ps=document.getElementById("bar"),dt=document.getElementById("switcher"),De=document.getElementById("ring"),je=document.getElementById("usage");let me=[],ke=null,ce=null,it=null,mt=null,Vt="",ut=!1,fe=null,St=null,Re="ring",et=null;const Mt=window.matchMedia(fi),st=new Map,tt=new Map,Ct=new Map,mi=new Map;let bt=null,wt=null;const Le=document.createElement("div");Le.className="focus-cell";const ge=new Xi(Le),pe=new zi({onOpen:()=>{Ot(),Ns()},onClose:()=>Ge("daemon disconnected — reconnecting"),onOutput:(C,L)=>{C===ce&&ge.write(L)},onMessage:Os});ge.onInput=C=>{ce&&pe.send({type:"input",id:ce,data:C})};Zi(window);const We={upload:Ui,ready:()=>ce!==null,insert:C=>{ge.paste(C),ge.focus()},onError:Ge};Qi(Le,We);ts(Le,We);ge.shouldSendKey=C=>!qe()&&!Et(C);const Tt=()=>me.find(C=>C.id===ke)??null,Ae=()=>{var C;return((C=Tt())==null?void 0:C.sessions)??[]},Be=C=>Ae().find(L=>L.slot===C),Pe=C=>me.flatMap(L=>L.sessions).find(L=>L.id===C);function Oe(){const C=Math.max(0,...Ae().map(L=>L.slot));return Ne.find(L=>L>=C&&L>=ze())??Ne[Ne.length-1]}const Si=()=>me.reduce((C,L)=>C+L.sessions.filter(D=>D.status==="done").length,0);function Os(C){var L,D;switch(C.type){case"state":{me=C.projects,St=C.update??St;const T=new Set(me.flatMap(O=>O.sessions).map(O=>O.id));for(const O of tt.keys())T.has(O)||tt.delete(O);ke=C.activeProjectId??((L=me[0])==null?void 0:L.id)??null,Ci(),Ws(),qs(),js(),gs()&&Ei(),Gs();break}case"status":{const T=Pe(C.id),O=T==null?void 0:T.status;T&&(T.status=C.status,T.since=C.since,T.title=C.title),C.status==="done"&&O!=="done"&&C.notable&&ps(),Te();break}case"screen":C.id===ce&&ge.replay(C.ansi);break;case"snapshot":{tt.set(C.id,C.snapshot),(D=st.get(C.id))==null||D.paint(C.snapshot);break}case"exit":Te();break;case"error":Ge(C.message);break}}const Is=()=>({onSelect:C=>rt(C),onAdd:()=>Li(!1),onContext:C=>Ks(C),onUpdate:C=>Ts(C.current,C.latest),onSoundToggle:()=>Te(),onSettings:()=>Us(),onUsage:()=>Ei()}),Ke=()=>Cs(Ps,me,ke,Is(),St,Re==="usage");function Ci(){Ke(),Fs(),Te()}function Fs(){const C=Oe(),L=`${ke}|${C}|`+Ae().map(D=>`${D.slot}:${D.id}`).sort().join(",");if(L!==Vt){Vt=L,ds(De,Le,C);for(const D of Array.from(De.children))D!==Le&&D.remove();Le.parentElement!==De&&De.append(Le),Ct.clear(),st.clear();for(let D=1;D<=C;D++){const T=Be(D),O=document.createElement("div");if(O.className="tile",O.tabIndex=0,O.onmousedown=W=>W.preventDefault(),us(O,D,C),!T)O.classList.add("empty"),O.textContent=`+ ${Lt(D)}`,O.onclick=()=>Pt(D);else{const W=document.createElement("canvas");O.append(W);const M=new ns(W);st.set(T.id,M);const t=tt.get(T.id);t&&M.paint(t);const a=document.createElement("div");a.className="label";const h=Qe("slot-badge");h.textContent=String(D),a.append(h,Qe("big-nm")),O.append(a);const l=document.createElement("div");l.className="meta";const n=document.createElement("span");n.className="key",n.textContent=String(D),l.append(n,Qe("nm"),Qe("cwd")),O.append(l),O.onclick=()=>Ie(T.id),O.oncontextmenu=p=>{p.preventDefault(),xi(T.id)};const c=document.createElement("button");c.className="tile-action",c.onclick=p=>{p.stopPropagation(),pe.send({type:"respawn",id:T.id})},O.append(c),bi(O,T)}Ct.set(D,O),De.append(O)}requestAnimationFrame(()=>at())}}const Qe=C=>{const L=document.createElement("span");return L.className=C,L};function bi(C,L){if(C.classList.remove("st-idle","st-busy","st-done","st-exited","viewing"),C.style.removeProperty("--tint"),!L)return;C.classList.add(`st-${L.status}`),L.id===ce&&C.classList.add("viewing"),L.color&&C.style.setProperty("--tint",L.color);const D=L.name??L.title??"shell",T=C.querySelector(".nm");T&&(T.textContent=D);const O=C.querySelector(".big-nm");O&&(O.textContent=D);const W=C.querySelector(".cwd");W&&(W.textContent=L.cwd.split("/").filter(Boolean).pop()??""),C.title=`${Lt(L.slot)} — ${L.cwd}`;const M=C.querySelector(".tile-action"),t=Hs(L);M&&(M.hidden=!t,t&&(M.textContent=t.label,M.title=t.title))}function Hs(C){return C.status==="exited"?{label:"↻",title:C.command?`Restart: ${C.command}`:`Restart shell (exit ${C.exitCode??"?"})`}:C.command&&C.status==="idle"?{label:"▸",title:`Run: ${C.command}`}:null}function Te(){for(let L=1;L<=Oe();L++){const D=Ct.get(L);D&&bi(D,Be(L))}Ke(),ot();const C=Si();document.title=C>0?`(${C}) tring`:"tring"}let _t="";function ot(){if(dt.hidden=!Mt.matches||Re!=="ring",dt.hidden){_t="";return}const C=ce?Pe(ce)??null:null,L=Ae().filter(T=>T.status==="done").length,D=`${C==null?void 0:C.id}|${C==null?void 0:C.status}|${C==null?void 0:C.name}|${C==null?void 0:C.title}|${L}`;D!==_t&&(_t=D,Es(dt,C,L,{onOpen:Ri,onNext:Bt,onPaste:$s}))}function $s(){ss({...We,fallback:()=>Bs({onText:We.insert,onImages:C=>{nt(C,We)}})})}function at(){const{cols:C,rows:L}=ge.fitNow();ce&&pe.send({type:"resize",cols:C,rows:L});for(const D of st.values())D.refresh()}function Ie(C){ht(),wi(C),ce&&ge.focus()}function wi(C){if(C&&C===ce)return;const L=C?Pe(C):void 0;if(ce&&(mt=ce),ce=(L==null?void 0:L.id)??null,it=(L==null?void 0:L.slot)??null,!L){ge.clear(),Te();return}mi.set(L.projectId,L.id);const{cols:D,rows:T}=ge.fitNow();pe.send({type:"focus",id:L.id,cols:D,rows:T}),ge.focus(),Te()}function Ns(){if(!ce)return;const{cols:C,rows:L}=ge.fitNow();pe.send({type:"focus",id:ce,cols:C,rows:L})}function Ws(){if(ce===null||it===null)return;const C=Yi({id:ce,slot:it},Ae());C&&C.id===ce||wi((C==null?void 0:C.id)??null)}function yi(C){const L=Be(C);L?Ie(L.id):Pt(C)}function Ei(){Re!=="usage"&&(Re="usage",De.hidden=!0,je.hidden=!1,pt(je,null,null),yt(),et=setInterval(()=>void yt(),3e4),di(!0),Ke(),ot())}function ht(){Re!=="ring"&&(Re="ring",et&&clearInterval(et),et=null,je.hidden=!0,De.hidden=!1,di(!1),Ke(),ot(),requestAnimationFrame(()=>at()))}async function yt(){if(Re==="usage")try{pt(je,await ms(),null)}catch(C){pt(je,null,C.message)}}function Us(){Ms({ring:ze(),usage:ft()},C=>{C.usage!==ft()&&(vs(C.usage),C.usage||ht()),C.ring!==ze()?zs(C.ring):(Ke(),yt())})}function zs(C){cs(C),Ci();const L=Oe();L!==C?Ge(`slots above ${C} are still in use — the ring stays at ${L} until they are closed`):Ot()}function rt(C){ht(),C!==ke&&(ke=C,ce=null,it=null,ge.clear(),bt=C,pe.send({type:"activateProject",projectId:C}))}function js(){const C=wt;if(C===null)return;const L=Be(C);L&&(wt=null,Ie(L.id))}function qs(){const C=bt;if(!C||C!==ke)return;bt=null;const L=mi.get(C);L&&Ae().some(D=>D.id===L)&&Ie(L)}function Bt(){var O;const C=Ae(),L=Be(((O=Pe(ce??""))==null?void 0:O.slot)??0),D=(L==null?void 0:L.slot)??0,T=Oe();for(let W=1;W<=T;W++){const M=(D+W-1)%T+1,t=C.find(a=>a.slot===M);if((t==null?void 0:t.status)==="done")return Ie(t.id)}}function Pt(C){const L=Tt();L&&Ds({cwd:L.root,slot:C},D=>{Mt.matches&&(wt=C),pe.send({type:"create",projectId:L.id,slot:C,cwd:D.cwd,...D.command?{command:D.command}:{},...D.name?{name:D.name}:{}})})}function Li(C){vi({title:C?"Create your first project":"New project",root:"",blocking:C},(L,D)=>pe.send({type:"createProject",name:L,root:D}))}function xi(C){const L=Pe(C);L&&As(L,D=>{D.name!==(L.name??"")&&pe.send({type:"rename",id:C,name:D.name}),D.color!==L.color&&pe.send({type:"color",id:C,color:D.color})})}function Ks(C){const L=me.find(D=>D.id===C);L&&vi({title:"Project settings",name:L.name,root:L.root,rootLocked:!0,onDelete:()=>{const D=L.sessions.length;gi(`Delete ${L.name}?`,D>0?`This kills ${D} session${D===1?"":"s"} in this project.`:"This project has no running sessions.",()=>pe.send({type:"deleteProject",projectId:C}))}},D=>pe.send({type:"renameProject",projectId:C,name:D}))}function Gs(){if(me.length>0){ut=!1;return}ut||qe()||(ut=!0,Li(!0))}document.addEventListener("keydown",C=>{if(qe())return Vs(C);Et(C)&&(C.preventDefault(),Ri())});document.addEventListener("click",()=>{qe()||Re!=="ring"||!ce||ge.focus()});function Ri(){qe()||(ht(),fe="picker",xs(Tt(),me,Si(),{onPickSlot:C=>{fe=null,yi(C)},onPickProject:C=>{fe=null,rt(C)},onNextDone:()=>{fe=null,Bt()},onNewSession:()=>{fe=null,Di()}}))}function Di(){const C=Oe(),L=[...Array(C)].map((D,T)=>T+1).find(D=>!Be(D));L?Pt(L):Ge(`all ${C} slots are full`)}function Vs(C){if(fe===null)return;if(fe==="projects"){const O=Number(C.key);if(O>=1&&O<=9&&me[O-1]){C.preventDefault();const W=me[O-1];ae(),fe=null,rt(W.id);return}}const L=Hi(C);if(L!==null&&L<=Oe()&&fe==="picker"){C.preventDefault(),ae(),fe=null,yi(L);return}if(Et(C)||C.code==="Space"){C.preventDefault(),ae(),fe=null,mt&&Ie(mt);return}const D=$i(C);if(!D)return;C.preventDefault();const T=ce?Pe(ce):void 0;switch(D){case"close":ae(),fe=null;break;case"next-done":ae(),fe=null,Bt();break;case"projects":ae(),fe="projects",Rs(me,O=>{fe=null,rt(O)});break;case"new-session":ae(),fe=null,Di();break;case"rename":if(!T)break;ae(),fe=null,xi(T.id);break;case"kill":if(!T)break;ae(),fe=null,gi("Kill session",`Slot ${T.slot} — ${T.cwd}`,()=>pe.send({type:"kill",id:T.id}));break;case"mark-seen":T&&pe.send({type:"ack",id:T.id}),ae(),fe=null;break}}let xe=null;function Ge(C){Ot(),xe=document.createElement("div"),xe.id="toast",xe.textContent=C,document.body.append(xe)}function Ot(){xe==null||xe.remove(),xe=null}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});window.addEventListener("resize",()=>at());Mt.addEventListener("change",()=>{ot(),requestAnimationFrame(()=>at())});pe.connect();