ptn 0.1.4__py3-none-any.whl → 0.2.5__py3-none-any.whl
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.
- porterminal/__init__.py +19 -3
- porterminal/_version.py +34 -0
- porterminal/app.py +8 -4
- porterminal/application/services/terminal_service.py +116 -28
- porterminal/asgi.py +8 -3
- porterminal/cli/args.py +50 -0
- porterminal/composition.py +13 -5
- porterminal/config.py +54 -70
- porterminal/container.py +0 -11
- porterminal/domain/__init__.py +0 -2
- porterminal/domain/entities/output_buffer.py +0 -4
- porterminal/domain/ports/__init__.py +1 -2
- porterminal/domain/ports/pty_port.py +0 -29
- porterminal/domain/ports/tab_repository.py +0 -5
- porterminal/infrastructure/config/__init__.py +0 -2
- porterminal/infrastructure/config/shell_detector.py +1 -0
- porterminal/infrastructure/repositories/in_memory_tab.py +0 -4
- porterminal/infrastructure/server.py +10 -3
- porterminal/static/assets/app-By4EXMHC.js +72 -0
- porterminal/static/assets/app-DQePboVd.css +32 -0
- porterminal/static/index.html +16 -25
- porterminal/updater.py +115 -168
- ptn-0.2.5.dist-info/METADATA +148 -0
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/RECORD +27 -29
- porterminal/infrastructure/config/yaml_loader.py +0 -34
- porterminal/static/assets/app-BQiuUo6Q.css +0 -32
- porterminal/static/assets/app-YNN_jEhv.js +0 -71
- porterminal/static/manifest.json +0 -31
- porterminal/static/sw.js +0 -66
- ptn-0.1.4.dist-info/METADATA +0 -191
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/WHEEL +0 -0
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/entry_points.txt +0 -0
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
(function(){const B=document.createElement("link").relList;if(B&&B.supports&&B.supports("modulepreload"))return;for(const A of document.querySelectorAll('link[rel="modulepreload"]'))O(A);new MutationObserver(A=>{for(const W of A)if(W.type==="childList")for(const R of W.addedNodes)R.tagName==="LINK"&&R.rel==="modulepreload"&&O(R)}).observe(document,{childList:!0,subtree:!0});function P(A){const W={};return A.integrity&&(W.integrity=A.integrity),A.referrerPolicy&&(W.referrerPolicy=A.referrerPolicy),A.crossOrigin==="use-credentials"?W.credentials="include":A.crossOrigin==="anonymous"?W.credentials="omit":W.credentials="same-origin",W}function O(A){if(A.ep)return;A.ep=!0;const W=P(A);fetch(A.href,W)}})();function Ke(){const M=new Map;return{emit(B,P){const O=M.get(B);if(O)for(const A of O)try{A(P)}catch(W){console.error(`Error in event handler for "${B}":`,W)}},on(B,P){let O=M.get(B);return O||(O=new Set,M.set(B,O)),O.add(P),()=>this.off(B,P)},off(B,P){const O=M.get(B);O&&O.delete(P)},once(B,P){const O=A=>{this.off(B,O),P(A)};return this.on(B,O)}}}function Ge(){return{async load(){try{const M=await fetch("/api/config");if(!M.ok)throw new Error(`Config fetch failed: ${M.status}`);return await M.json()}catch(M){return console.error("Failed to load config:",M),{shells:[{id:"default",name:"Shell"}],default_shell:"default"}}}}}const ye={TAB_ID_REQUIRED:4e3,TAB_NOT_FOUND:4004,SESSION_ENDED:4005},Ve=/\x1b\[\?[\d;]*c|\x1b\[[\d;]*R/g;function Xe(M){return M.includes("\x1B[")?M.replace(Ve,""):M}function Ye(M,B,P){const O=new TextEncoder,A=new TextDecoder,W=new Map;function R(d){return W.has(d)||W.set(d,{state:"disconnected",pendingReconnect:null,earlyBuffer:[],writeBuffer:[],rafHandle:null}),W.get(d)}function t(d){const v=W.get(d);v!=null&&v.pendingReconnect&&(clearTimeout(v.pendingReconnect),v.pendingReconnect=null)}function a(d,v){v.rafHandle===null&&(v.rafHandle=requestAnimationFrame(()=>{if(v.rafHandle=null,v.writeBuffer.length===0)return;const o=v.writeBuffer.join("");v.writeBuffer=[],d.term.write(o)}))}function h(d,v,o){(d.term.cols!==v||d.term.rows!==o)&&(console.log(`Syncing terminal size to ${v}x${o} (was ${d.term.cols}x${d.term.rows})`),d.term.resize(v,o))}function c(d){const v=W.get(d.id);v&&v.rafHandle!==null&&(cancelAnimationFrame(v.rafHandle),v.rafHandle=null,v.writeBuffer=[]),d.ws&&(d.ws.onopen=null,d.ws.onmessage=null,d.ws.onclose=null,d.ws.onerror=null,(d.ws.readyState===WebSocket.OPEN||d.ws.readyState===WebSocket.CONNECTING)&&d.ws.close(),d.ws=null),d.heartbeatInterval&&(clearInterval(d.heartbeatInterval),d.heartbeatInterval=null)}function s(d,v){const o=window.location.protocol==="https:"?"wss:":"ws:",e=new URLSearchParams({tab_id:d});return v&&e.set("skip_buffer","1"),`${o}//${window.location.host}/ws?${e}`}const u={connect(d,v){const o=R(d.id);if(t(d.id),!d.tabId){console.error(`Tab ${d.id} has no tabId - cannot connect without server confirmation`),M.emit("connection:error",{tabId:d.id,error:"No tabId"});return}o.state!=="disconnected"&&(c(d),o.state="disconnected"),o.state="connecting",o.earlyBuffer=[];const e=s(d.tabId,v),r=new WebSocket(e);r.binaryType="arraybuffer",d.ws=r,r.onopen=()=>{if(o.state!=="connecting"){r.close();return}d.reconnectAttempts=0,M.emit("connection:open",{tabId:d.id}),d.heartbeatInterval=setInterval(()=>{var i;((i=d.ws)==null?void 0:i.readyState)===WebSocket.OPEN&&d.ws.send(JSON.stringify({type:"ping"}))},B.heartbeatMs),requestAnimationFrame(()=>{var i;o.state==="connecting"&&(d.fitAddon.fit(),((i=d.ws)==null?void 0:i.readyState)===WebSocket.OPEN&&d.ws.send(JSON.stringify({type:"resize",cols:d.term.cols,rows:d.term.rows})),requestAnimationFrame(()=>{if(o.state==="connecting")if(o.state="connected",o.earlyBuffer.length>0){const n=o.earlyBuffer.join("");o.earlyBuffer=[],d.term.write(n,()=>{setTimeout(()=>{requestAnimationFrame(()=>{d.term.scrollToBottom(),d.container.style.opacity=""})},0)})}else d.term.scrollToBottom(),d.container.style.opacity=""}))})},r.onmessage=i=>{var n;if(i.data instanceof ArrayBuffer){const _=A.decode(i.data);o.state==="connecting"?o.earlyBuffer.push(_):o.state==="connected"&&(o.writeBuffer.push(_),a(d,o))}else try{const _=JSON.parse(i.data);switch(_.type){case"session_info":P.onSessionInfo(d,_.session_id,_.tab_id??null),_.cols&&_.rows&&h(d,_.cols,_.rows);break;case"resize_sync":_.cols&&_.rows&&h(d,_.cols,_.rows);break;case"ping":((n=d.ws)==null?void 0:n.readyState)===WebSocket.OPEN&&d.ws.send(JSON.stringify({type:"pong"}));break;case"error":console.error("Server error:",_.message),d.term.write(`\r
|
|
2
|
+
\x1B[31mError: ${_.message}\x1B[0m\r
|
|
3
|
+
`),M.emit("connection:error",{tabId:d.id,error:_.message});break}}catch(_){console.error("Failed to parse message:",_)}},r.onclose=i=>{if(o.state==="disconnecting"){o.state="disconnected";return}if((o.state==="connecting"||o.state==="connected")&&(o.state="disconnected"),d.heartbeatInterval&&(clearInterval(d.heartbeatInterval),d.heartbeatInterval=null),M.emit("connection:close",{tabId:d.id,code:i.code}),i.code===ye.TAB_ID_REQUIRED||i.code===ye.TAB_NOT_FOUND||i.code===ye.SESSION_ENDED){console.log(`Tab ${d.id} rejected (code ${i.code}) - removing stale tab`),M.emit("tab:stale",{tabId:d.id,serverId:d.tabId,code:i.code});return}if(d.reconnectAttempts<B.maxReconnectAttempts){d.reconnectAttempts++;const n=B.reconnectDelayMs*Math.min(d.reconnectAttempts,5);o.pendingReconnect=setTimeout(()=>{o.pendingReconnect=null,u.connect(d,!0)},n)}else P.onReconnectFailed()},r.onerror=()=>{(o.state==="connecting"||o.state==="connected")&&P.onDisconnect()}},disconnect(d){const v=R(d.id);t(d.id),v.state!=="disconnected"&&(v.state="disconnecting",c(d),v.state="disconnected")},sendInput(d,v){if(R(d.id).state!=="connected"||!d.ws||d.ws.readyState!==WebSocket.OPEN)return;const e=Xe(v);e&&d.ws.send(O.encode(e))},sendResize(d,v,o){R(d.id).state!=="connected"||!d.ws||d.ws.readyState!==WebSocket.OPEN||d.ws.send(JSON.stringify({type:"resize",cols:v,rows:o}))},isConnected(d){var o;return R(d.id).state==="connected"&&((o=d.ws)==null?void 0:o.readyState)===WebSocket.OPEN},getState(d){return R(d).state},cleanupTabState(d){const v=W.get(d);v&&v.rafHandle!==null&&cancelAnimationFrame(v.rafHandle),t(d),W.delete(d)}};return u}const Je=1e4;function Ze(M){let B=null;const P=new Map;let O=null,A=null;function W(){return`req_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function R(h){try{const c=JSON.parse(h.data);switch(c.type){case"tab_state_sync":M.onStateSync(c.tabs),A&&(A(),A=null);break;case"tab_state_update":M.onStateUpdate(c.changes);break;case"create_tab_response":{const s=P.get(c.request_id);s&&(clearTimeout(s.timeout),P.delete(c.request_id),c.success&&c.tab?s.resolve(c.tab):s.reject(new Error(c.error||"Failed to create tab")));break}case"close_tab_response":{const s=P.get(c.request_id);s&&(clearTimeout(s.timeout),P.delete(c.request_id),c.success?s.resolve(void 0):s.reject(new Error(c.error||"Failed to close tab")));break}case"pong":break}}catch(c){console.error("Failed to parse management message:",c)}}function t(){O&&(clearInterval(O),O=null);for(const[h,c]of P)clearTimeout(c.timeout),c.reject(new Error("Connection closed")),P.delete(h)}function a(h,c){if(!B||B.readyState!==WebSocket.OPEN)return Promise.reject(new Error("Not connected to management WebSocket"));const s=W();return new Promise((u,d)=>{const v=setTimeout(()=>{P.delete(s),d(new Error("Request timeout"))},Je);P.set(s,{resolve:u,reject:d,timeout:v}),B.send(JSON.stringify({type:h,request_id:s,...c}))})}return{connect(){return new Promise((h,c)=>{const u=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/management`;B=new WebSocket(u),A=h,B.onopen=()=>{var d;console.log("Management WebSocket connected, waiting for state sync..."),O=setInterval(()=>{(B==null?void 0:B.readyState)===WebSocket.OPEN&&B.send(JSON.stringify({type:"ping"}))},25e3),(d=M.onConnect)==null||d.call(M)},B.onerror=d=>{console.error("Management WebSocket error:",d),A=null,c(new Error("Connection failed"))},B.onmessage=R,B.onclose=()=>{console.log("Management WebSocket disconnected"),A&&(A=null,c(new Error("Connection closed before sync"))),t(),B=null,M.onDisconnect()}})},disconnect(){B&&(t(),B.close(),B=null)},createTab(h){return a("create_tab",{shell_id:h})},closeTab(h){return a("close_tab",{tab_id:h})},isConnected(){return(B==null?void 0:B.readyState)===WebSocket.OPEN}}}var Ee={exports:{}},Ie;function Qe(){return Ie||(Ie=1,(function(M,B){(function(P,O){M.exports=O()})(globalThis,(()=>(()=>{var P={4567:function(R,t,a){var h=this&&this.__decorate||function(i,n,_,g){var l,p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,_,g);else for(var m=i.length-1;m>=0;m--)(l=i[m])&&(f=(p<3?l(f):p>3?l(n,_,f):l(n,_))||f);return p>3&&f&&Object.defineProperty(n,_,f),f},c=this&&this.__param||function(i,n){return function(_,g){n(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const s=a(9042),u=a(9924),d=a(844),v=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends d.Disposable{constructor(i,n,_,g){super(),this._terminal=i,this._coreBrowserService=_,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 l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,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 u.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((l=>this._handleResize(l.rows)))),this.register(this._terminal.onRender((l=>this._refreshRows(l.start,l.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((l=>this._handleChar(l)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
4
|
+
`)))),this.register(this._terminal.onA11yTab((l=>this._handleTab(l)))),this.register(this._terminal.onKey((l=>this._handleKey(l.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,d.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(i){for(let n=0;n<i;n++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
|
|
5
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=s.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,n){this._liveRegionDebouncer.refresh(i,n,this._terminal.rows)}_renderRows(i,n){const _=this._terminal.buffer,g=_.lines.length.toString();for(let l=i;l<=n;l++){const p=_.lines.get(_.ydisp+l),f=[],m=(p==null?void 0:p.translateToString(!0,void 0,void 0,f))||"",S=(_.ydisp+l+1).toString(),y=this._rowElements[l];y&&(m.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=m,this._rowColumns.set(y,f)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,n){const _=i.target,g=this._rowElements[n===0?1:this._rowElements.length-2];if(_.getAttribute("aria-posinset")===(n===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==g)return;let l,p;if(n===0?(l=_,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(l=this._rowElements.shift(),p=_,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){const f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{const f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var m;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 n={node:i.anchorNode,offset:i.anchorOffset},_={node:i.focusNode,offset:i.focusOffset};if((n.node.compareDocumentPosition(_.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===_.node&&n.offset>_.offset)&&([n,_]=[_,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;const g=this._rowElements.slice(-1)[0];if(_.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(_={node:g,offset:((m=g.textContent)==null?void 0:m.length)??0}),!this._rowContainer.contains(_.node))return;const l=({node:S,offset:y})=>{const b=S instanceof Text?S.parentNode:S;let w=parseInt(b==null?void 0:b.getAttribute("aria-posinset"),10)-1;if(isNaN(w))return console.warn("row is invalid. Race condition?"),null;const x=this._rowColumns.get(b);if(!x)return console.warn("columns is null. Race condition?"),null;let I=y<x.length?x[y]:x.slice(-1)[0]+1;return I>=this._terminal.cols&&(++w,I=0),{row:w,column:I}},p=l(n),f=l(_);if(p&&f){if(p.row>f.row||p.row===f.row&&p.column>=f.column)throw new Error("invalid range");this._terminal.select(p.column,p.row,(f.row-p.row)*this._terminal.cols-p.column+f.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);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([c(1,o.IInstantiationService),c(2,v.ICoreBrowserService),c(3,v.IRenderService)],r)},3614:(R,t)=>{function a(u){return u.replace(/\r?\n/g,"\r")}function h(u,d){return d?"\x1B[200~"+u+"\x1B[201~":u}function c(u,d,v,o){u=h(u=a(u),v.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(u,!0),d.value=""}function s(u,d,v){const o=v.getBoundingClientRect(),e=u.clientX-o.left-10,r=u.clientY-o.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${e}px`,d.style.top=`${r}px`,d.style.zIndex="1000",d.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(u,d){u.clipboardData&&u.clipboardData.setData("text/plain",d.selectionText),u.preventDefault()},t.handlePasteEvent=function(u,d,v,o){u.stopPropagation(),u.clipboardData&&c(u.clipboardData.getData("text/plain"),d,v,o)},t.paste=c,t.moveTextAreaUnderMouseCursor=s,t.rightClickHandler=function(u,d,v,o,e){s(u,d,v),e&&o.rightClickSelect(u),d.value=o.selectionText,d.select()}},7239:(R,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(c,s,u){this._css.set(c,s,u)}getCss(c,s){return this._css.get(c,s)}setColor(c,s,u){this._color.set(c,s,u)}getColor(c,s){return this._color.get(c,s)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,c,s){a.addEventListener(h,c,s);let u=!1;return{dispose:()=>{u||(u=!0,a.removeEventListener(h,c,s))}}}},3551:function(R,t,a){var h=this&&this.__decorate||function(r,i,n,_){var g,l=arguments.length,p=l<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,i,n,_);else for(var f=r.length-1;f>=0;f--)(g=r[f])&&(p=(l<3?g(p):l>3?g(i,n,p):g(i,n))||p);return l>3&&p&&Object.defineProperty(i,n,p),p},c=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const s=a(3656),u=a(8460),d=a(844),v=a(2585),o=a(4725);let e=t.Linkifier=class extends d.Disposable{get currentLink(){return this._currentLink}constructor(r,i,n,_,g){super(),this._element=r,this._mouseService=i,this._renderService=n,this._bufferService=_,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new u.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new u.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,d.toDisposable)((()=>{var l;this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,s.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,s.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const n=r.composedPath();for(let _=0;_<n.length;_++){const g=n[_];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 _,g;this._activeProviderReplies&&i||((_=this._activeProviderReplies)==null||_.forEach((l=>{l==null||l.forEach((p=>{p.link.dispose&&p.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=r.y);let n=!1;for(const[l,p]of this._linkProviderService.linkProviders.entries())i?(g=this._activeProviderReplies)!=null&&g.get(l)&&(n=this._checkLinkProviderResult(l,r,n)):p.provideLinks(r.y,(f=>{var S,y;if(this._isMouseOut)return;const m=f==null?void 0:f.map((b=>({link:b})));(S=this._activeProviderReplies)==null||S.set(l,m),n=this._checkLinkProviderResult(l,r,n),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)}))}_removeIntersectingLinks(r,i){const n=new Set;for(let _=0;_<i.size;_++){const g=i.get(_);if(g)for(let l=0;l<g.length;l++){const p=g[l],f=p.link.range.start.y<r?0:p.link.range.start.x,m=p.link.range.end.y>r?this._bufferService.cols:p.link.range.end.x;for(let S=f;S<=m;S++){if(n.has(S)){g.splice(l--,1);break}n.add(S)}}}}_checkLinkProviderResult(r,i,n){var l;if(!this._activeProviderReplies)return n;const _=this._activeProviderReplies.get(r);let g=!1;for(let p=0;p<r;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(g=!0);if(!g&&_){const p=_.find((f=>this._linkAtPosition(f.link,i)));p&&(n=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let p=0;p<this._activeProviderReplies.size;p++){const f=(l=this._activeProviderReplies.get(p))==null?void 0:l.find((m=>this._linkAtPosition(m.link,i)));if(f){n=!0,this._handleNewLink(f);break}}return n}_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,d.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 n,_;return(_=(n=this._currentLink)==null?void 0:n.state)==null?void 0:_.decorations.pointerCursor},set:n=>{var _;(_=this._currentLink)!=null&&_.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,_;return(_=(n=this._currentLink)==null?void 0:n.state)==null?void 0:_.decorations.underline},set:n=>{var _,g,l;(_=this._currentLink)!=null&&_.state&&((l=(g=this._currentLink)==null?void 0:g.state)==null?void 0:l.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((n=>{if(!this._currentLink)return;const _=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(_,g),this._lastMouseEvent)){const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}}))))}_linkHover(r,i,n){var _;(_=this._currentLink)!=null&&_.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(n,i.text)}_fireUnderlineEvent(r,i){const n=r.range,_=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-_-1,n.end.x,n.end.y-_-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(r,i,n){var _;(_=this._currentLink)!=null&&_.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(n,i.text)}_linkAtPosition(r,i){const n=r.range.start.y*this._bufferService.cols+r.range.start.x,_=r.range.end.y*this._bufferService.cols+r.range.end.x,g=i.y*this._bufferService.cols+i.x;return n<=g&&g<=_}_positionFromMouseEvent(r,i,n){const _=n.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(_)return{x:_[0],y:_[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,n,_,g){return{x1:r,y1:i,x2:n,y2:_,cols:this._bufferService.cols,fg:g}}};t.Linkifier=e=h([c(1,o.IMouseService),c(2,o.IRenderService),c(3,v.IBufferService),c(4,o.ILinkProviderService)],e)},9042:(R,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(R,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,g=_<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 l=o.length-1;l>=0;l--)(n=o[l])&&(g=(_<3?n(g):_>3?n(e,r,g):n(e,r))||g);return _>3&&g&&Object.defineProperty(e,r,g),g},c=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 s=a(511),u=a(2585);let d=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){var m;const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],n=this._optionsService.rawOptions.linkHandler,_=new s.CellData,g=r.getTrimmedLength();let l=-1,p=-1,f=!1;for(let S=0;S<g;S++)if(p!==-1||r.hasContent(S)){if(r.loadCell(S,_),_.hasExtendedAttrs()&&_.extended.urlId){if(p===-1){p=S,l=_.extended.urlId;continue}f=_.extended.urlId!==l}else p!==-1&&(f=!0);if(f||p!==-1&&S===g-1){const y=(m=this._oscLinkService.getLinkData(l))==null?void 0:m.uri;if(y){const b={start:{x:p+1,y:o},end:{x:S+(f||S!==g-1?0:1),y:o}};let w=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{const x=new URL(y);["http:","https:"].includes(x.protocol)||(w=!0)}catch{w=!0}w||i.push({text:y,range:b,activate:(x,I)=>n?n.activate(x,I,b):v(0,I),hover:(x,I)=>{var $;return($=n==null?void 0:n.hover)==null?void 0:$.call(n,x,I,b)},leave:(x,I)=>{var $;return($=n==null?void 0:n.leave)==null?void 0:$.call(n,x,I,b)}})}f=!1,_.hasExtendedAttrs()&&_.extended.urlId?(p=S,l=_.extended.urlId):(p=-1,l=-1)}}e(i)}};function v(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
6
|
+
|
|
7
|
+
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=d=h([c(0,u.IBufferService),c(1,u.IOptionsService),c(2,u.IOscLinkService)],d)},6193:(R,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,c){this._rowCount=c,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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),c=a(3656),s=a(3551),u=a(9042),d=a(3730),v=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),n=a(428),_=a(4269),g=a(5114),l=a(8934),p=a(3230),f=a(9312),m=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),x=a(844),I=a(6114),$=a(8437),H=a(2584),F=a(7399),C=a(5941),L=a(9074),D=a(2585),T=a(5435),U=a(4567),q=a(779);class X extends b.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(k={}){super(k),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(d.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((E,z)=>this.refresh(E,z)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((E=>this._reportWindowsOptions(E)))),this.register(this._inputHandler.onColor((E=>this._handleColorEvent(E)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((E=>this._afterResize(E.cols,E.rows)))),this.register((0,x.toDisposable)((()=>{var E,z;this._customKeyEventHandler=void 0,(z=(E=this.element)==null?void 0:E.parentNode)==null||z.removeChild(this.element)})))}_handleColorEvent(k){if(this._themeService)for(const E of k){let z,N="";switch(E.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;"+E.index}switch(E.type){case 0:const K=y.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[E.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${N};${(0,C.toRgbString)(K)}${H.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors((j=>j.ansi[E.index]=y.channels.toColor(...E.color)));else{const j=z;this._themeService.modifyColors((Z=>Z[j]=y.channels.toColor(...E.color)))}break;case 2:this._themeService.restoreColor(E.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(k){k?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(k){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var k;return(k=this.textarea)==null?void 0:k.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 k=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(k);if(!E)return;const z=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,K=E.getWidth(z),j=this._renderService.dimensions.css.cell.width*K,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,Y=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Y+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=j+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,c.addDisposableDomListener)(this.element,"copy",(E=>{this.hasSelection()&&(0,h.copyHandler)(E,this._selectionService)})));const k=E=>(0,h.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,c.addDisposableDomListener)(this.textarea,"paste",k)),this.register((0,c.addDisposableDomListener)(this.element,"paste",k)),I.isFirefox?this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(E=>{E.button===2&&(0,h.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,c.addDisposableDomListener)(this.element,"contextmenu",(E=>{(0,h.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,c.addDisposableDomListener)(this.element,"auxclick",(E=>{E.button===1&&(0,h.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,c.addDisposableDomListener)(this.textarea,"keyup",(k=>this._keyUp(k)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keydown",(k=>this._keyDown(k)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keypress",(k=>this._keyPress(k)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionupdate",(k=>this._compositionHelper.compositionupdate(k)))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,c.addDisposableDomListener)(this.textarea,"input",(k=>this._inputEvent(k)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(k){var z;if(!k)throw new Error("Terminal requires a parent element.");if(k.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=k.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"),k.appendChild(this.element);const E=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),E.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,c.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),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",u.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,k.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,c.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,c.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(p.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.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(l.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(E);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(v.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(f.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.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,c.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,c.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 k=this,E=this.element;function z(j){const Z=k._mouseService.getMouseReportCoords(j,k.screenElement);if(!Z)return!1;let Y,re;switch(j.overrideType||j.type){case"mousemove":re=32,j.buttons===void 0?(Y=3,j.button!==void 0&&(Y=j.button<3?j.button:3)):Y=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":re=0,Y=j.button<3?j.button:3;break;case"mousedown":re=1,Y=j.button<3?j.button:3;break;case"wheel":if(k._customWheelEventHandler&&k._customWheelEventHandler(j)===!1||k.viewport.getLinesScrolled(j)===0)return!1;re=j.deltaY<0?0:1,Y=4;break;default:return!1}return!(re===void 0||Y===void 0||Y>4)&&k.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:Y,action:re,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}const N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},K={mouseup:j=>(z(j),j.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(j)),wheel:j=>(z(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&z(j)},mousemove:j=>{j.buttons||z(j)}};this.register(this.coreMouseService.onProtocolChange((j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&j?N.mousemove||(E.addEventListener("mousemove",K.mousemove),N.mousemove=K.mousemove):(E.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&j?N.wheel||(E.addEventListener("wheel",K.wheel,{passive:!1}),N.wheel=K.wheel):(E.removeEventListener("wheel",N.wheel),N.wheel=null),2&j?N.mouseup||(N.mouseup=K.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&j?N.mousedrag||(N.mousedrag=K.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,c.addDisposableDomListener)(E,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return z(j),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(j)}))),this.register((0,c.addDisposableDomListener)(E,"wheel",(j=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){const Z=this.viewport.getLinesScrolled(j);if(Z===0)return;const Y=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B");let re="";for(let he=0;he<Math.abs(Z);he++)re+=Y;return this.coreService.triggerDataEvent(re,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,c.addDisposableDomListener)(E,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,c.addDisposableDomListener)(E,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(k,E){var z;(z=this._renderService)==null||z.refreshRows(k,E)}updateCursorStyle(k){var E;(E=this._selectionService)!=null&&E.shouldColumnSelect(k)?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(k,E,z=0){var N;z===1?(super.scrollLines(k,E,z),this.refresh(0,this.rows-1)):(N=this.viewport)==null||N.scrollLines(k)}paste(k){(0,h.paste)(k,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(k){this._customKeyEventHandler=k}attachCustomWheelEventHandler(k){this._customWheelEventHandler=k}registerLinkProvider(k){return this._linkProviderService.registerLinkProvider(k)}registerCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const E=this._characterJoinerService.register(k);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(k)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(k){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+k)}registerDecoration(k){return this._decorationService.registerDecoration(k)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(k,E,z){this._selectionService.setSelection(k,E,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 k;(k=this._selectionService)==null||k.clearSelection()}selectAll(){var k;(k=this._selectionService)==null||k.selectAll()}selectLines(k,E){var z;(z=this._selectionService)==null||z.selectLines(k,E)}_keyDown(k){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;const E=this.browser.isMac&&this.options.macOptionIsMeta&&k.altKey;if(!E&&!this._compositionHelper.keydown(k))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||k.key!=="Dead"&&k.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,F.evaluateKeyboardEvent)(k,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(k),z.type===3||z.type===2){const N=this.rows-1;return this.scrollLines(z.type===2?-N:N),this.cancel(k,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,k)||(z.cancel&&this.cancel(k,!0),!z.key||!!(k.key&&!k.ctrlKey&&!k.altKey&&!k.metaKey&&k.key.length===1&&k.key.charCodeAt(0)>=65&&k.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:k}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||k.altKey||k.ctrlKey?this.cancel(k,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(k,E){const z=k.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||k.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||k.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?z:z&&(!E.keyCode||E.keyCode>47)}_keyUp(k){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1||((function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18})(k)||this.focus(),this.updateCursorStyle(k),this._keyPressHandled=!1)}_keyPress(k){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;if(this.cancel(k),k.charCode)E=k.charCode;else if(k.which===null||k.which===void 0)E=k.keyCode;else{if(k.which===0||k.charCode===0)return!1;E=k.which}return!(!E||(k.altKey||k.ctrlKey||k.metaKey)&&!this._isThirdLevelShift(this.browser,k)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:k}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(k){if(k.data&&k.inputType==="insertText"&&(!k.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const E=k.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(k),!0}return!1}resize(k,E){k!==this.cols||E!==this.rows?super.resize(k,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(k,E){var z,N;(z=this._charSizeService)==null||z.measure(),(N=this.viewport)==null||N.syncScrollArea(!0)}clear(){var k;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 E=1;E<this.rows;E++)this.buffer.lines.push(this.buffer.getBlankLine($.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(k=this.viewport)==null||k.reset(),this.refresh(0,this.rows-1)}}reset(){var E,z;this.options.rows=this.rows,this.options.cols=this.cols;const k=this._customKeyEventHandler;this._setup(),super.reset(),(E=this._selectionService)==null||E.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=k,this.refresh(0,this.rows-1)}clearTextureAtlas(){var k;(k=this._renderService)==null||k.clearTextureAtlas()}_reportFocus(){var k;(k=this.element)!=null&&k.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(k){if(this._renderService)switch(k){case T.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const E=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};${E}t`);break;case T.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const N=this._renderService.dimensions.css.cell.width.toFixed(0),K=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${K};${N}t`)}}cancel(k,E){if(this.options.cancelEvents||E)return k.preventDefault(),k.stopPropagation(),!1}}t.Terminal=X},9924:(R,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,c){this._rowCount=c,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 s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const u=s-this._lastRefreshMs,d=this._debounceThresholdMS-u;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;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(R,t,a){var h=this&&this.__decorate||function(r,i,n,_){var g,l=arguments.length,p=l<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,i,n,_);else for(var f=r.length-1;f>=0;f--)(g=r[f])&&(p=(l<3?g(p):l>3?g(i,n,p):g(i,n))||p);return l>3&&p&&Object.defineProperty(i,n,p),p},c=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=a(3656),u=a(4725),d=a(8460),v=a(844),o=a(2585);let e=t.Viewport=class extends v.Disposable{constructor(r,i,n,_,g,l,p,f){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=n,this._optionsService=_,this._charSizeService=g,this._renderService=l,this._coreBrowserService=p,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((m=>this._renderDimensions=m))),this._handleThemeChange(f.colors),this.register(f.onChangeColors((m=>this._handleThemeChange(m)))),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 n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&n<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 f;let n,_="";const g=[],l=i??this._bufferService.buffer.lines.length,p=this._bufferService.buffer.lines;for(let m=r;m<l;m++){const S=p.get(m);if(!S)continue;const y=(f=p.get(m+1))==null?void 0:f.isWrapped;if(_+=S.translateToString(!y),!y||m===p.length-1){const b=document.createElement("div");b.textContent=_,g.push(b),_.length>0&&(n=b),_=""}}return{bufferElements:g,cursorElement:n}}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 n=this._optionsService.rawOptions.fastScrollModifier;return n==="alt"&&i.altKey||n==="ctrl"&&i.ctrlKey||n==="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([c(2,o.IBufferService),c(3,o.IOptionsService),c(4,u.ICharSizeService),c(5,u.IRenderService),c(6,u.ICoreBrowserService),c(7,u.IThemeService)],e)},3107:function(R,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,g=_<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 l=o.length-1;l>=0;l--)(n=o[l])&&(g=(_<3?n(g):_>3?n(e,r,g):n(e,r))||g);return _>3&&g&&Object.defineProperty(e,r,g),g},c=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 s=a(4725),u=a(844),d=a(2585);let v=t.BufferDecorationRenderer=class extends u.Disposable{constructor(o,e,r,i,n){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,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((_=>this._removeDecoration(_)))),this.register((0,u.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=v=h([c(1,d.IBufferService),c(2,s.ICoreBrowserService),c(3,d.IDecorationService),c(4,s.IRenderService)],v)},5871:(R,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,c){return h>=a.startBufferLine-this._linePadding[c||"full"]&&h<=a.endBufferLine+this._linePadding[c||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(R,t,a){var h=this&&this.__decorate||function(n,_,g,l){var p,f=arguments.length,m=f<3?_:l===null?l=Object.getOwnPropertyDescriptor(_,g):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,_,g,l);else for(var S=n.length-1;S>=0;S--)(p=n[S])&&(m=(f<3?p(m):f>3?p(_,g,m):p(_,g))||m);return f>3&&m&&Object.defineProperty(_,g,m),m},c=this&&this.__param||function(n,_){return function(g,l){_(g,l,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const s=a(5871),u=a(4725),d=a(844),v=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 d.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(n,_,g,l,p,f,m){var y;super(),this._viewportElement=n,this._screenElement=_,this._bufferService=g,this._decorationService=l,this._renderService=p,this._optionsService=f,this._coreBrowserService=m,this._colorZoneStore=new s.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(y=this._viewportElement.parentElement)==null||y.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,d.toDisposable)((()=>{var b;(b=this._canvas)==null||b.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 n=Math.floor(this._canvas.width/3),_=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=n,e.center=_,e.right=n,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 n=this._canvas.height/this._bufferService.buffer.lines.length,_=Math.round(Math.max(Math.min(n,12),6)*this._coreBrowserService.dpr);o.left=_,o.center=_,o.right=_}_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 _ of this._decorationService.decorations)this._colorZoneStore.addDecoration(_);this._ctx.lineWidth=1;const n=this._colorZoneStore.zones;for(const _ of n)_.position!=="full"&&this._renderColorZone(_);for(const _ of n)_.position==="full"&&this._renderColorZone(_);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(n){this._ctx.fillStyle=n.color,this._ctx.fillRect(r[n.position||"full"],Math.round((this._canvas.height-1)*(n.startBufferLine/this._bufferService.buffers.active.lines.length)-o[n.position||"full"]/2),e[n.position||"full"],Math.round((this._canvas.height-1)*((n.endBufferLine-n.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[n.position||"full"]))}_queueRefresh(n,_){this._shouldUpdateDimensions=n||this._shouldUpdateDimensions,this._shouldUpdateAnchor=_||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=i=h([c(2,v.IBufferService),c(3,v.IDecorationService),c(4,u.IRenderService),c(5,v.IOptionsService),c(6,u.ICoreBrowserService)],i)},2950:function(R,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,g=_<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 l=o.length-1;l>=0;l--)(n=o[l])&&(g=(_<3?n(g):_>3?n(e,r,g):n(e,r))||g);return _>3&&g&&Object.defineProperty(e,r,g),g},c=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 s=a(4725),u=a(2585),d=a(2584);let v=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,n,_){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=n,this._renderService=_,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(`${d.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,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"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 _=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(_.width,1)+"px",this._textarea.style.height=Math.max(_.height,1)+"px",this._textarea.style.lineHeight=_.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=v=h([c(2,u.IBufferService),c(3,u.IOptionsService),c(4,u.ICoreService),c(5,s.IRenderService)],v)},9806:(R,t)=>{function a(h,c,s){const u=s.getBoundingClientRect(),d=h.getComputedStyle(s),v=parseInt(d.getPropertyValue("padding-left")),o=parseInt(d.getPropertyValue("padding-top"));return[c.clientX-u.left-v,c.clientY-u.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,c,s,u,d,v,o,e,r){if(!v)return;const i=a(h,c,s);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),u+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),d),i):void 0}},9504:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function c(e,r,i,n){const _=e-s(e,i),g=r-s(r,i),l=Math.abs(_-g)-(function(p,f,m){let S=0;const y=p-s(p,m),b=f-s(f,m);for(let w=0;w<Math.abs(y-b);w++){const x=u(p,f)==="A"?-1:1,I=m.buffer.lines.get(y+x*w);I!=null&&I.isWrapped&&S++}return S})(e,r,i);return o(l,v(u(e,r),n))}function s(e,r){let i=0,n=r.buffer.lines.get(e),_=n==null?void 0:n.isWrapped;for(;_&&e>=0&&e<r.rows;)i++,n=r.buffer.lines.get(--e),_=n==null?void 0:n.isWrapped;return i}function u(e,r){return e>r?"A":"B"}function d(e,r,i,n,_,g){let l=e,p=r,f="";for(;l!==i||p!==n;)l+=_?1:-1,_&&l>g.cols-1?(f+=g.buffer.translateBufferLineToString(p,!1,e,l),l=0,e=0,p++):!_&&l<0&&(f+=g.buffer.translateBufferLineToString(p,!1,0,e+1),l=g.cols-1,e=l,p--);return f+g.buffer.translateBufferLineToString(p,!1,e,l)}function v(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=r;return i}t.moveToCellSequence=function(e,r,i,n){const _=i.buffer.x,g=i.buffer.y;if(!i.buffer.hasScrollback)return(function(f,m,S,y,b,w){return c(m,y,b,w).length===0?"":o(d(f,m,f,m-s(m,b),!1,b).length,v("D",w))})(_,g,0,r,i,n)+c(g,r,i,n)+(function(f,m,S,y,b,w){let x;x=c(m,y,b,w).length>0?y-s(y,b):m;const I=y,$=(function(H,F,C,L,D,T){let U;return U=c(C,L,D,T).length>0?L-s(L,D):F,H<C&&U<=L||H>=C&&U<L?"C":"D"})(f,m,S,y,b,w);return o(d(f,x,S,I,$==="C",b).length,v($,w))})(_,g,e,r,i,n);let l;if(g===r)return l=_>e?"D":"C",o(Math.abs(_-e),v(l,n));l=g>r?"D":"C";const p=Math.abs(g-r);return o((function(f,m){return m.cols-f})(g>r?e:_,i)+(p-1)*i.cols+1+((g>r?_:e)-1),v(l,n))}},1296:function(R,t,a){var h=this&&this.__decorate||function(w,x,I,$){var H,F=arguments.length,C=F<3?x:$===null?$=Object.getOwnPropertyDescriptor(x,I):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,x,I,$);else for(var L=w.length-1;L>=0;L--)(H=w[L])&&(C=(F<3?H(C):F>3?H(x,I,C):H(x,I))||C);return F>3&&C&&Object.defineProperty(x,I,C),C},c=this&&this.__param||function(w,x){return function(I,$){x(I,$,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=a(3787),u=a(2550),d=a(2223),v=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),n=a(844),_=a(2585),g="xterm-dom-renderer-owner-",l="xterm-rows",p="xterm-fg-",f="xterm-bg-",m="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends n.Disposable{constructor(w,x,I,$,H,F,C,L,D,T,U,q,X){super(),this._terminal=w,this._document=x,this._element=I,this._screenElement=$,this._viewportElement=H,this._helperContainer=F,this._linkifier2=C,this._charSizeService=D,this._optionsService=T,this._bufferService=U,this._coreBrowserService=q,this._themeService=X,this._terminalClass=y++,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(l),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,v.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((G=>this._injectCss(G)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((G=>this._handleLinkHover(G)))),this.register(this._linkifier2.onHideLinkUnderline((G=>this._handleLinkLeave(G)))),this.register((0,n.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 u.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 w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(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 x=`${this._terminalSelector} .${l} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=x,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let x=`${this._terminalSelector} .${l} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;x+=`${this._terminalSelector} .${l} .xterm-dim { color: ${r.color.multiplyOpacity(w.foreground,.5).css};}`,x+=`${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}`;x+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,x+=`@keyframes ${$} { 50% { box-shadow: none; }}`,x+=`@keyframes ${H} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,x+=`${this._terminalSelector} .${l}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${l}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${l}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,x+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(const[F,C]of w.ansi.entries())x+=`${this._terminalSelector} .${p}${F} { color: ${C.css}; }${this._terminalSelector} .${p}${F}.xterm-dim { color: ${r.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${f}${F} { background-color: ${C.css}; }`;x+=`${this._terminalSelector} .${p}${d.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(w.background).css}; }${this._terminalSelector} .${p}${d.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${f}${d.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=x}_setDefaultSpacing(){const w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,x){for(let I=this._rowElements.length;I<=x;I++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,x){this._refreshRowElements(w,x),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,x,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,x,I),this.renderRows(0,this._bufferService.rows-1),!w||!x)return;this._selectionRenderModel.update(this._terminal,w,x,I);const $=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(F>=this._bufferService.rows||C<0)return;const L=this._document.createDocumentFragment();if(I){const D=w[0]>x[0];L.appendChild(this._createSelectionElement(F,D?x[0]:w[0],D?w[0]:x[0],C-F+1))}else{const D=$===F?w[0]:0,T=F===H?x[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(F,D,T));const U=C-F-1;if(L.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,U)),F!==C){const q=H===C?x[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,q))}}this._selectionContainer.appendChild(L)}_createSelectionElement(w,x,I,$=1){const H=this._document.createElement("div"),F=x*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(I-x);return F+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-F),H.style.height=$*this.dimensions.css.cell.height+"px",H.style.top=w*this.dimensions.css.cell.height+"px",H.style.left=`${F}px`,H.style.width=`${C}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 w of this._rowElements)w.replaceChildren()}renderRows(w,x){const I=this._bufferService.buffer,$=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=w;D<=x;D++){const T=D+I.ydisp,U=this._rowElements[D],q=I.lines.get(T);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,T,T===$,C,L,H,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,x,I,$,H,F){I<0&&(w=0),$<0&&(x=0);const C=this._bufferService.rows-1;I=Math.max(Math.min(I,C),0),$=Math.max(Math.min($,C),0),H=Math.min(H,this._bufferService.cols);const L=this._bufferService.buffer,D=L.ybase+L.y,T=Math.min(L.x,H-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let G=I;G<=$;++G){const k=G+L.ydisp,E=this._rowElements[G],z=L.lines.get(k);if(!E||!z)break;E.replaceChildren(...this._rowFactory.createRow(z,k,k===D,q,X,T,U,this.dimensions.css.cell.width,this._widthCache,F?G===I?w:0:-1,F?(G===$?x:H)-1:-1))}}};t.DomRenderer=b=h([c(7,_.IInstantiationService),c(8,e.ICharSizeService),c(9,_.IOptionsService),c(10,_.IBufferService),c(11,e.ICoreBrowserService),c(12,e.IThemeService)],b)},3787:function(R,t,a){var h=this&&this.__decorate||function(l,p,f,m){var S,y=arguments.length,b=y<3?p:m===null?m=Object.getOwnPropertyDescriptor(p,f):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(l,p,f,m);else for(var w=l.length-1;w>=0;w--)(S=l[w])&&(b=(y<3?S(b):y>3?S(p,f,b):S(p,f))||b);return y>3&&b&&Object.defineProperty(p,f,b),b},c=this&&this.__param||function(l,p){return function(f,m){p(f,m,l)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=a(2223),u=a(643),d=a(511),v=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),n=a(3734);let _=t.DomRendererRowFactory=class{constructor(l,p,f,m,S,y,b){this._document=l,this._characterJoinerService=p,this._optionsService=f,this._coreBrowserService=m,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new d.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(l,p,f){this._selectionStart=l,this._selectionEnd=p,this._columnSelectMode=f}createRow(l,p,f,m,S,y,b,w,x,I,$){const H=[],F=this._characterJoinerService.getJoinedCharacters(p),C=this._themeService.colors;let L,D=l.getNoBgTrimmedLength();f&&D<y+1&&(D=y+1);let T=0,U="",q=0,X=0,G=0,k=!1,E=0,z=!1,N=0;const K=[],j=I!==-1&&$!==-1;for(let Z=0;Z<D;Z++){l.loadCell(Z,this._workCell);let Y=this._workCell.getWidth();if(Y===0)continue;let re=!1,he=Z,J=this._workCell;if(F.length>0&&Z===F[0][0]){re=!0;const Q=F.shift();J=new r.JoinedCellData(this._workCell,l.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),he=Q[1]-1,Y=J.getWidth()}const ue=this._isCellInSelection(Z,p),fe=f&&Z===y,se=j&&Z>=I&&Z<=$;let ee=!1;this._decorationService.forEachDecorationAtCell(Z,p,void 0,(Q=>{ee=!0}));let te=J.getChars()||u.WHITESPACE_CELL_CHAR;if(te===" "&&(J.isUnderline()||J.isOverline())&&(te=" "),N=Y*w-x.get(te,J.isBold(),J.isItalic()),L){if(T&&(ue&&z||!ue&&!z&&J.bg===q)&&(ue&&z&&C.selectionForeground||J.fg===X)&&J.extended.ext===G&&se===k&&N===E&&!fe&&!re&&!ee){J.isInvisible()?U+=u.WHITESPACE_CELL_CHAR:U+=te,T++;continue}T&&(L.textContent=U),L=this._document.createElement("span"),T=0,U=""}else L=this._document.createElement("span");if(q=J.bg,X=J.fg,G=J.extended.ext,k=se,E=N,z=ue,re&&y>=Z&&y<=he&&(y=Z),!this._coreService.isCursorHidden&&fe&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&K.push("xterm-cursor-blink"),K.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline")}}if(J.isBold()&&K.push("xterm-bold"),J.isItalic()&&K.push("xterm-italic"),J.isDim()&&K.push("xterm-dim"),U=J.isInvisible()?u.WHITESPACE_CELL_CHAR:J.getChars()||u.WHITESPACE_CELL_CHAR,J.isUnderline()&&(K.push(`xterm-underline-${J.extended.underlineStyle}`),U===" "&&(U=" "),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${n.AttributeData.toColorRGB(J.getUnderlineColor()).join(",")})`;else{let Q=J.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&J.isBold()&&Q<8&&(Q+=8),L.style.textDecorationColor=C.ansi[Q].css}J.isOverline()&&(K.push("xterm-overline"),U===" "&&(U=" ")),J.isStrikethrough()&&K.push("xterm-strikethrough"),se&&(L.style.textDecoration="underline");let V=J.getFgColor(),ie=J.getFgColorMode(),ae=J.getBgColor(),oe=J.getBgColorMode();const _e=!!J.isInverse();if(_e){const Q=V;V=ae,ae=Q;const ve=ie;ie=oe,oe=ve}let le,de,ce,ne=!1;switch(this._decorationService.forEachDecorationAtCell(Z,p,void 0,(Q=>{Q.options.layer!=="top"&&ne||(Q.backgroundColorRGB&&(oe=50331648,ae=Q.backgroundColorRGB.rgba>>8&16777215,le=Q.backgroundColorRGB),Q.foregroundColorRGB&&(ie=50331648,V=Q.foregroundColorRGB.rgba>>8&16777215,de=Q.foregroundColorRGB),ne=Q.options.layer==="top")})),!ne&&ue&&(le=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ae=le.rgba>>8&16777215,oe=50331648,ne=!0,C.selectionForeground&&(ie=50331648,V=C.selectionForeground.rgba>>8&16777215,de=C.selectionForeground)),ne&&K.push("xterm-decoration-top"),oe){case 16777216:case 33554432:ce=C.ansi[ae],K.push(`xterm-bg-${ae}`);break;case 50331648:ce=o.channels.toColor(ae>>16,ae>>8&255,255&ae),this._addStyle(L,`background-color:#${g((ae>>>0).toString(16),"0",6)}`);break;default:_e?(ce=C.foreground,K.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):ce=C.background}switch(le||J.isDim()&&(le=o.color.multiplyOpacity(ce,.5)),ie){case 16777216:case 33554432:J.isBold()&&V<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(V+=8),this._applyMinimumContrast(L,ce,C.ansi[V],J,le,void 0)||K.push(`xterm-fg-${V}`);break;case 50331648:const Q=o.channels.toColor(V>>16&255,V>>8&255,255&V);this._applyMinimumContrast(L,ce,Q,J,le,de)||this._addStyle(L,`color:#${g(V.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,ce,C.foreground,J,le,de)||_e&&K.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}K.length&&(L.className=K.join(" "),K.length=0),fe||re||ee?L.textContent=U:T++,N!==this.defaultSpacing&&(L.style.letterSpacing=`${N}px`),H.push(L),Z=he}return L&&T&&(L.textContent=U),H}_applyMinimumContrast(l,p,f,m,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(m.getCode()))return!1;const b=this._getContrastCache(m);let w;if(S||y||(w=b.getColor(p.rgba,f.rgba)),w===void 0){const x=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);w=o.color.ensureContrastRatio(S||p,y||f,x),b.setColor((S||p).rgba,(y||f).rgba,w??null)}return!!w&&(this._addStyle(l,`color:${w.css}`),!0)}_getContrastCache(l){return l.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(l,p){l.setAttribute("style",`${l.getAttribute("style")||""}${p};`)}_isCellInSelection(l,p){const f=this._selectionStart,m=this._selectionEnd;return!(!f||!m)&&(this._columnSelectMode?f[0]<=m[0]?l>=f[0]&&p>=f[1]&&l<m[0]&&p<=m[1]:l<f[0]&&p>=f[1]&&l>=m[0]&&p<=m[1]:p>f[1]&&p<m[1]||f[1]===m[1]&&p===f[1]&&l>=f[0]&&l<m[0]||f[1]<m[1]&&p===m[1]&&l<m[0]||f[1]<m[1]&&p===f[1]&&l>=f[0])}};function g(l,p,f){for(;l.length<f;)l=p+l;return l}t.DomRendererRowFactory=_=h([c(1,e.ICharacterJoinerService),c(2,v.IOptionsService),c(3,e.ICoreBrowserService),c(4,v.ICoreService),c(5,v.IDecorationService),c(6,e.IThemeService)],_)},2550:(R,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 c=a.createElement("span");c.classList.add("xterm-char-measure-element");const s=a.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const u=a.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontStyle="italic";const d=a.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[c,s,u,d],this._container.appendChild(c),this._container.appendChild(s),this._container.appendChild(u),this._container.appendChild(d),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,c,s){a===this._font&&h===this._fontSize&&c===this._weight&&s===this._weightBold||(this._font=a,this._fontSize=h,this._weight=c,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${c}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${c}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(a,h,c){let s=0;if(!h&&!c&&a.length===1&&(s=a.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const v=this._measure(a,0);return v>0&&(this._flat[s]=v),v}let u=a;h&&(u+="B"),c&&(u+="I");let d=this._holey.get(u);if(d===void 0){let v=0;h&&(v|=1),c&&(v|=2),d=this._measure(a,v),d>0&&this._holey.set(u,d)}return d}_measure(a,h){const c=this._measureElements[h];return c.textContent=a.repeat(32),c.offsetWidth/32}}},2223:(R,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:(R,t)=>{function a(c){return 57508<=c&&c<=57558}function h(c){return c>=128512&&c<=128591||c>=127744&&c<=128511||c>=128640&&c<=128767||c>=9728&&c<=9983||c>=9984&&c<=10175||c>=65024&&c<=65039||c>=129280&&c<=129535||c>=127462&&c<=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(c){if(!c)throw new Error("value must not be falsy");return c},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},t.isEmoji=h,t.allowRescaling=function(c,s,u,d){return s===1&&u>Math.ceil(1.5*d)&&c!==void 0&&c>255&&!h(c)&&!a(c)&&!(function(v){return 57344<=v&&v<=63743})(c)},t.treatGlyphAsBackgroundColor=function(c){return a(c)||(function(s){return 9472<=s&&s<=9631})(c)},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(c,s,u=0){return(c-(2*Math.round(s)-u))%(2*Math.round(s))}},6052:(R,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(c,s,u,d=!1){if(this.selectionStart=s,this.selectionEnd=u,!s||!u||s[0]===u[0]&&s[1]===u[1])return void this.clear();const v=c.buffers.active.ydisp,o=s[1]-v,e=u[1]-v,r=Math.max(o,0),i=Math.min(e,c.rows-1);r>=c.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=u[0])}isCellSelected(c,s,u){return!!this.hasSelection&&(u-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&u>=this.viewportCappedStartRow&&s<this.endCol&&u<=this.viewportCappedEndRow:s<this.startCol&&u>=this.viewportCappedStartRow&&s>=this.endCol&&u<=this.viewportCappedEndRow:u>this.viewportStartRow&&u<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(R,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(R,t,a){var h=this&&this.__decorate||function(i,n,_,g){var l,p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,_,g);else for(var m=i.length-1;m>=0;m--)(l=i[m])&&(f=(p<3?l(f):p>3?l(n,_,f):l(n,_))||f);return p>3&&f&&Object.defineProperty(n,_,f),f},c=this&&this.__param||function(i,n){return function(_,g){n(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const s=a(2585),u=a(8460),d=a(844);let v=t.CharSizeService=class extends d.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,n,_){super(),this._optionsService=_,this.width=0,this.height=0,this._onCharSizeChange=this.register(new u.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new r(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,n,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=v=h([c(2,s.IOptionsService)],v);class o extends d.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(n,_){n!==void 0&&n>0&&_!==void 0&&_>0&&(this._result.width=n,this._result.height=_)}}class e extends o{constructor(n,_,g){super(),this._document=n,this._parentElement=_,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(n){super(),this._optionsService=n,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const _=this._ctx.measureText("W");if(!("width"in _&&"fontBoundingBoxAscent"in _&&"fontBoundingBoxDescent"in _))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const n=this._ctx.measureText("W");return this._validateAndSet(n.width,n.fontBoundingBoxAscent+n.fontBoundingBoxDescent),this._result}}},4269:function(R,t,a){var h=this&&this.__decorate||function(r,i,n,_){var g,l=arguments.length,p=l<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,i,n,_);else for(var f=r.length-1;f>=0;f--)(g=r[f])&&(p=(l<3?g(p):l>3?g(i,n,p):g(i,n))||p);return l>3&&p&&Object.defineProperty(i,n,p),p},c=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=a(3734),u=a(643),d=a(511),v=a(2585);class o extends s.AttributeData{constructor(i,n,_){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=n,this._width=_}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 $e{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(i){const n={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(n),n.id}deregister(i){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===i)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const n=this._bufferService.buffer.lines.get(i);if(!n||n.length===0)return[];const _=[],g=n.translateToString(!0);let l=0,p=0,f=0,m=n.getFg(0),S=n.getBg(0);for(let y=0;y<n.getTrimmedLength();y++)if(n.loadCell(y,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==S){if(y-l>1){const b=this._getJoinedRanges(g,f,p,n,l);for(let w=0;w<b.length;w++)_.push(b[w])}l=y,f=p,m=this._workCell.fg,S=this._workCell.bg}p+=this._workCell.getChars().length||u.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-l>1){const y=this._getJoinedRanges(g,f,p,n,l);for(let b=0;b<y.length;b++)_.push(y[b])}return _}_getJoinedRanges(i,n,_,g,l){const p=i.substring(n,_);let f=[];try{f=this._characterJoiners[0].handler(p)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{const S=this._characterJoiners[m].handler(p);for(let y=0;y<S.length;y++)$e._mergeRanges(f,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(f,g,l),f}_stringRangesToCellRanges(i,n,_){let g=0,l=!1,p=0,f=i[g];if(f){for(let m=_;m<this._bufferService.cols;m++){const S=n.getWidth(m),y=n.getString(m).length||u.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!l&&f[0]<=p&&(f[0]=m,l=!0),f[1]<=p){if(f[1]=m,f=i[++g],!f)break;f[0]<=p?(f[0]=m,l=!0):l=!1}p+=y}}f&&(f[1]=this._bufferService.cols)}}static _mergeRanges(i,n){let _=!1;for(let g=0;g<i.length;g++){const l=i[g];if(_){if(n[1]<=l[0])return i[g-1][1]=n[1],i;if(n[1]<=l[1])return i[g-1][1]=Math.max(n[1],l[1]),i.splice(g,1),i;i.splice(g,1),g--}else{if(n[1]<=l[0])return i.splice(g,0,n),i;if(n[1]<=l[1])return l[0]=Math.min(n[0],l[0]),i;n[0]<l[1]&&(l[0]=Math.min(n[0],l[0]),_=!0)}}return _?i[i.length-1][1]=n[1]:i.push(n),i}};t.CharacterJoinerService=e=h([c(0,v.IBufferService)],e)},5114:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),c=a(8460),s=a(3656);class u 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 d(this._window),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new c.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((i=>this._screenDprMonitor.setWindow(i)))),this.register((0,c.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=u;class d extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new c.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,s.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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class c extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(u){return this.linkProviders.push(u),{dispose:()=>{const d=this.linkProviders.indexOf(u);d!==-1&&this.linkProviders.splice(d,1)}}}}t.LinkProviderService=c},8934:function(R,t,a){var h=this&&this.__decorate||function(v,o,e,r){var i,n=arguments.length,_=n<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(v,o,e,r);else for(var g=v.length-1;g>=0;g--)(i=v[g])&&(_=(n<3?i(_):n>3?i(o,e,_):i(o,e))||_);return n>3&&_&&Object.defineProperty(o,e,_),_},c=this&&this.__param||function(v,o){return function(e,r){o(e,r,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=a(4725),u=a(9806);let d=t.MouseService=class{constructor(v,o){this._renderService=v,this._charSizeService=o}getCoords(v,o,e,r,i){return(0,u.getCoords)(window,v,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(v,o){const e=(0,u.getCoordsRelativeToElement)(window,v,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=d=h([c(0,s.IRenderService),c(1,s.ICharSizeService)],d)},3230:function(R,t,a){var h=this&&this.__decorate||function(i,n,_,g){var l,p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,_,g);else for(var m=i.length-1;m>=0;m--)(l=i[m])&&(f=(p<3?l(f):p>3?l(n,_,f):l(n,_))||f);return p>3&&f&&Object.defineProperty(n,_,f),f},c=this&&this.__param||function(i,n){return function(_,g){n(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const s=a(6193),u=a(4725),d=a(8460),v=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends v.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,n,_,g,l,p,f,m){super(),this._rowCount=i,this._charSizeService=g,this._renderer=this.register(new v.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new v.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new d.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new d.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new d.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new d.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new s.RenderDebouncer(((S,y)=>this._renderRows(S,y)),f),this.register(this._renderDebouncer),this.register(f.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(p.onResize((()=>this._fullRefresh()))),this.register(p.buffers.onBufferActivate((()=>{var S;return(S=this._renderer.value)==null?void 0:S.clear()}))),this.register(_.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(l.onDecorationRegistered((()=>this._fullRefresh()))),this.register(l.onDecorationRemoved((()=>this._fullRefresh()))),this.register(_.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(p.cols,p.rows),this._fullRefresh()}))),this.register(_.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(p.buffer.y,p.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(f.window,n),this.register(f.onWindowChange((S=>this._registerIntersectionObserver(S,n))))}_registerIntersectionObserver(i,n){if("IntersectionObserver"in i){const _=new i.IntersectionObserver((g=>this._handleIntersectionChange(g[g.length-1])),{threshold:0});_.observe(n),this._observerDisposable.value=(0,v.toDisposable)((()=>_.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,n,_=!1){this._isPaused?this._needsFullRefresh=!0:(_||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,n,this._rowCount))}_renderRows(i,n){this._renderer.value&&(i=Math.min(i,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(i,n),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:n}),this._onRender.fire({start:i,end:n}),this._isNextRenderRedrawOnly=!0)}resize(i,n){this._rowCount=n,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((n=>this.refreshRows(n.start,n.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,n;this._renderer.value&&((n=(i=this._renderer.value).clearTextureAtlas)==null||n.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var _;return(_=this._renderer.value)==null?void 0:_.handleResize(i,n)})):this._renderer.value.handleResize(i,n),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,n,_){var g;this._selectionState.start=i,this._selectionState.end=n,this._selectionState.columnSelectMode=_,(g=this._renderer.value)==null||g.handleSelectionChanged(i,n,_)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=r=h([c(2,e.IOptionsService),c(3,u.ICharSizeService),c(4,e.IDecorationService),c(5,e.IBufferService),c(6,u.ICoreBrowserService),c(7,u.IThemeService)],r)},9312:function(R,t,a){var h=this&&this.__decorate||function(f,m,S,y){var b,w=arguments.length,x=w<3?m:y===null?y=Object.getOwnPropertyDescriptor(m,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,m,S,y);else for(var I=f.length-1;I>=0;I--)(b=f[I])&&(x=(w<3?b(x):w>3?b(m,S,x):b(m,S))||x);return w>3&&x&&Object.defineProperty(m,S,x),x},c=this&&this.__param||function(f,m){return function(S,y){m(S,y,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=a(9806),u=a(9504),d=a(456),v=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),n=a(511),_=a(2585),g=" ",l=new RegExp(g,"g");let p=t.SelectionService=class extends e.Disposable{constructor(f,m,S,y,b,w,x,I,$){super(),this._element=f,this._screenElement=m,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=x,this._renderService=I,this._coreBrowserService=$,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new n.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 d.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 f=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!f||!m||f[0]===m[0]&&f[1]===m[1])}get selectionText(){const f=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!f||!m)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(f[0]===m[0])return"";const b=f[0]<m[0]?f[0]:m[0],w=f[0]<m[0]?m[0]:f[0];for(let x=f[1];x<=m[1];x++){const I=S.translateBufferLineToString(x,!0,b,w);y.push(I)}}else{const b=f[1]===m[1]?m[0]:void 0;y.push(S.translateBufferLineToString(f[1],!0,f[0],b));for(let w=f[1]+1;w<=m[1]-1;w++){const x=S.lines.get(w),I=S.translateBufferLineToString(w,!0);x!=null&&x.isWrapped?y[y.length-1]+=I:y.push(I)}if(f[1]!==m[1]){const w=S.lines.get(m[1]),x=S.translateBufferLineToString(m[1],!0,0,m[0]);w&&w.isWrapped?y[y.length-1]+=x:y.push(x)}}return y.map((b=>b.replace(l," "))).join(r.isWindows?`\r
|
|
8
|
+
`:`
|
|
9
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(f){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),r.isLinux&&f&&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(f){const m=this._getMouseBufferCoords(f),S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(S&&y&&m)&&this._areCoordsInSelection(m,S,y)}isCellInSelection(f,m){const S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y)&&this._areCoordsInSelection([f,m],S,y)}_areCoordsInSelection(f,m,S){return f[1]>m[1]&&f[1]<S[1]||m[1]===S[1]&&f[1]===m[1]&&f[0]>=m[0]&&f[0]<S[0]||m[1]<S[1]&&f[1]===S[1]&&f[0]<S[0]||m[1]<S[1]&&f[1]===m[1]&&f[0]>=m[0]}_selectWordAtCursor(f,m){var b,w;const S=(w=(b=this._linkifier.currentLink)==null?void 0:b.link)==null?void 0:w.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 y=this._getMouseBufferCoords(f);return!!y&&(this._selectWordAt(y,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(f,m){this._model.clearSelection(),f=Math.max(f,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,f],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(f){this._model.handleTrim(f)&&this.refresh()}_getMouseBufferCoords(f){const m=this._mouseService.getCoords(f,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(f){let m=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,f,this._screenElement)[1];const S=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=S?0:(m>S&&(m-=S),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(f){return r.isMac?f.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:f.shiftKey}handleMouseDown(f){if(this._mouseDownTimeStamp=f.timeStamp,(f.button!==2||!this.hasSelection)&&f.button===0){if(!this._enabled){if(!this.shouldForceSelection(f))return;f.stopPropagation()}f.preventDefault(),this._dragScrollAmount=0,this._enabled&&f.shiftKey?this._handleIncrementalClick(f):f.detail===1?this._handleSingleClick(f):f.detail===2?this._handleDoubleClick(f):f.detail===3&&this._handleTripleClick(f),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(f){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(f))}_handleSingleClick(f){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(f)?3:0,this._model.selectionStart=this._getMouseBufferCoords(f),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(f){this._selectWordAtCursor(f,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(f){const m=this._getMouseBufferCoords(f);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(f){return f.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(f){if(f.stopImmediatePropagation(),!this._model.selectionStart)return;const m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(f),!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(f),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 y=S.lines.get(this._model.selectionEnd[1]);y&&y.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const f=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(f.ydisp+this._bufferService.rows,f.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=f.ydisp),this.refresh()}}_handleMouseUp(f){const m=f.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&f.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(f,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const y=(0,u.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(y,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const f=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,S=!(!f||!m||f[0]===m[0]&&f[1]===m[1]);S?f&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&f[0]===this._oldSelectionStart[0]&&f[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(f,m,S)):this._oldHasSelection&&this._fireOnSelectionChange(f,m,S)}_fireOnSelectionChange(f,m,S){this._oldSelectionStart=f,this._oldSelectionEnd=m,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(f){this.clearSelection(),this._trimListener.dispose(),this._trimListener=f.activeBuffer.lines.onTrim((m=>this._handleTrim(m)))}_convertViewportColToCharacterIndex(f,m){let S=m;for(let y=0;m>=y;y++){const b=f.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&m!==y&&(S+=b-1)}return S}setSelection(f,m,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[f,m],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(f){this._isClickInSelection(f)||(this._selectWordAtCursor(f,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(f,m,S=!0,y=!0){if(f[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(f[1]);if(!w)return;const x=b.translateBufferLineToString(f[1],!1);let I=this._convertViewportColToCharacterIndex(w,f[0]),$=I;const H=f[0]-I;let F=0,C=0,L=0,D=0;if(x.charAt(I)===" "){for(;I>0&&x.charAt(I-1)===" ";)I--;for(;$<x.length&&x.charAt($+1)===" ";)$++}else{let q=f[0],X=f[0];w.getWidth(q)===0&&(F++,q--),w.getWidth(X)===2&&(C++,X++);const G=w.getString(X).length;for(G>1&&(D+=G-1,$+=G-1);q>0&&I>0&&!this._isCharWordSeparator(w.loadCell(q-1,this._workCell));){w.loadCell(q-1,this._workCell);const k=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,q--):k>1&&(L+=k-1,I-=k-1),I--,q--}for(;X<w.length&&$+1<x.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);const k=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,X++):k>1&&(D+=k-1,$+=k-1),$++,X++}}$++;let T=I+H-F+L,U=Math.min(this._bufferService.cols,$-I+F+C-L-D);if(m||x.slice(I,$).trim()!==""){if(S&&T===0&&w.getCodePoint(0)!==32){const q=b.lines.get(f[1]-1);if(q&&w.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const X=this._getWordAt([this._bufferService.cols-1,f[1]-1],!1,!0,!1);if(X){const G=this._bufferService.cols-X.start;T-=G,U+=G}}}if(y&&T+U===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){const q=b.lines.get(f[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const X=this._getWordAt([0,f[1]+1],!1,!1,!0);X&&(U+=X.length)}}return{start:T,length:U}}}_selectWordAt(f,m){const S=this._getWordAt(f,m);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,f[1]--;this._model.selectionStart=[S.start,f[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(f){const m=this._getWordAt(f,!0);if(m){let S=f[1];for(;m.start<0;)m.start+=this._bufferService.cols,S--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,S++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,S]}}_isCharWordSeparator(f){return f.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(f.getChars())>=0}_selectLineAt(f){const m=this._bufferService.buffer.getWrappedRangeForLine(f),S={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=p=h([c(3,_.IBufferService),c(4,_.ICoreService),c(5,v.IMouseService),c(6,_.IOptionsService),c(7,v.IRenderService),c(8,v.ICoreBrowserService)],p)},4725:(R,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(R,t,a){var h=this&&this.__decorate||function(p,f,m,S){var y,b=arguments.length,w=b<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(p,f,m,S);else for(var x=p.length-1;x>=0;x--)(y=p[x])&&(w=(b<3?y(w):b>3?y(f,m,w):y(f,m))||w);return b>3&&w&&Object.defineProperty(f,m,w),w},c=this&&this.__param||function(p,f){return function(m,S){f(m,S,p)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const s=a(7239),u=a(8055),d=a(8460),v=a(844),o=a(2585),e=u.css.toColor("#ffffff"),r=u.css.toColor("#000000"),i=u.css.toColor("#ffffff"),n=u.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const p=[u.css.toColor("#2e3436"),u.css.toColor("#cc0000"),u.css.toColor("#4e9a06"),u.css.toColor("#c4a000"),u.css.toColor("#3465a4"),u.css.toColor("#75507b"),u.css.toColor("#06989a"),u.css.toColor("#d3d7cf"),u.css.toColor("#555753"),u.css.toColor("#ef2929"),u.css.toColor("#8ae234"),u.css.toColor("#fce94f"),u.css.toColor("#729fcf"),u.css.toColor("#ad7fa8"),u.css.toColor("#34e2e2"),u.css.toColor("#eeeeec")],f=[0,95,135,175,215,255];for(let m=0;m<216;m++){const S=f[m/36%6|0],y=f[m/6%6|0],b=f[m%6];p.push({css:u.channels.toCss(S,y,b),rgba:u.channels.toRgba(S,y,b)})}for(let m=0;m<24;m++){const S=8+10*m;p.push({css:u.channels.toCss(S,S,S),rgba:u.channels.toRgba(S,S,S)})}return p})());let g=t.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(p){super(),this._optionsService=p,this._contrastCache=new s.ColorContrastCache,this._halfContrastCache=new s.ColorContrastCache,this._onChangeColors=this.register(new d.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:n,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:u.color.blend(r,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:u.color.blend(r,_),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(p={}){const f=this._colors;if(f.foreground=l(p.foreground,e),f.background=l(p.background,r),f.cursor=l(p.cursor,i),f.cursorAccent=l(p.cursorAccent,n),f.selectionBackgroundTransparent=l(p.selectionBackground,_),f.selectionBackgroundOpaque=u.color.blend(f.background,f.selectionBackgroundTransparent),f.selectionInactiveBackgroundTransparent=l(p.selectionInactiveBackground,f.selectionBackgroundTransparent),f.selectionInactiveBackgroundOpaque=u.color.blend(f.background,f.selectionInactiveBackgroundTransparent),f.selectionForeground=p.selectionForeground?l(p.selectionForeground,u.NULL_COLOR):void 0,f.selectionForeground===u.NULL_COLOR&&(f.selectionForeground=void 0),u.color.isOpaque(f.selectionBackgroundTransparent)&&(f.selectionBackgroundTransparent=u.color.opacity(f.selectionBackgroundTransparent,.3)),u.color.isOpaque(f.selectionInactiveBackgroundTransparent)&&(f.selectionInactiveBackgroundTransparent=u.color.opacity(f.selectionInactiveBackgroundTransparent,.3)),f.ansi=t.DEFAULT_ANSI_COLORS.slice(),f.ansi[0]=l(p.black,t.DEFAULT_ANSI_COLORS[0]),f.ansi[1]=l(p.red,t.DEFAULT_ANSI_COLORS[1]),f.ansi[2]=l(p.green,t.DEFAULT_ANSI_COLORS[2]),f.ansi[3]=l(p.yellow,t.DEFAULT_ANSI_COLORS[3]),f.ansi[4]=l(p.blue,t.DEFAULT_ANSI_COLORS[4]),f.ansi[5]=l(p.magenta,t.DEFAULT_ANSI_COLORS[5]),f.ansi[6]=l(p.cyan,t.DEFAULT_ANSI_COLORS[6]),f.ansi[7]=l(p.white,t.DEFAULT_ANSI_COLORS[7]),f.ansi[8]=l(p.brightBlack,t.DEFAULT_ANSI_COLORS[8]),f.ansi[9]=l(p.brightRed,t.DEFAULT_ANSI_COLORS[9]),f.ansi[10]=l(p.brightGreen,t.DEFAULT_ANSI_COLORS[10]),f.ansi[11]=l(p.brightYellow,t.DEFAULT_ANSI_COLORS[11]),f.ansi[12]=l(p.brightBlue,t.DEFAULT_ANSI_COLORS[12]),f.ansi[13]=l(p.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),f.ansi[14]=l(p.brightCyan,t.DEFAULT_ANSI_COLORS[14]),f.ansi[15]=l(p.brightWhite,t.DEFAULT_ANSI_COLORS[15]),p.extendedAnsi){const m=Math.min(f.ansi.length-16,p.extendedAnsi.length);for(let S=0;S<m;S++)f.ansi[S+16]=l(p.extendedAnsi[S],t.DEFAULT_ANSI_COLORS[S+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(p){this._restoreColor(p),this._onChangeColors.fire(this.colors)}_restoreColor(p){if(p!==void 0)switch(p){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[p]=this._restoreColors.ansi[p]}else for(let f=0;f<this._restoreColors.ansi.length;++f)this._colors.ansi[f]=this._restoreColors.ansi[f]}modifyColors(p){p(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 l(p,f){if(p!==void 0)try{return u.css.toColor(p)}catch{}return f}t.ThemeService=g=h([c(0,o.IOptionsService)],g)},6349:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),c=a(844);class s extends c.Disposable{constructor(d){super(),this._maxLength=d,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(d){if(this._maxLength===d)return;const v=new Array(d);for(let o=0;o<Math.min(d,this.length);o++)v[o]=this._array[this._getCyclicIndex(o)];this._array=v,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let v=this._length;v<d;v++)this._array[v]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,v){this._array[this._getCyclicIndex(d)]=v}push(d){this._array[this._getCyclicIndex(this._length)]=d,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(d,v,...o){if(v){for(let e=d;e<this._length-v;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+v)];this._length-=v,this.onDeleteEmitter.fire({index:d,amount:v})}for(let e=this._length-1;e>=d;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(d+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:d,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(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,v,o){if(!(v<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let r=v-1;r>=0;r--)this.set(d+r+o,this.get(d+r));const e=d+v+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<v;e++)this.set(d+e+o,this.get(d+e))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}t.CircularList=s},1439:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,c=5){if(typeof h!="object")return h;const s=Array.isArray(h)?[]:{};for(const u in h)s[u]=c<=1?h[u]:h[u]&&a(h[u],c-1);return s}},8055:(R,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,c=0,s=0;var u,d,v,o,e;function r(n){const _=n.toString(16);return _.length<2?"0"+_:_}function i(n,_){return n<_?(_+.05)/(n+.05):(n+.05)/(_+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(function(n){n.toCss=function(_,g,l,p){return p!==void 0?`#${r(_)}${r(g)}${r(l)}${r(p)}`:`#${r(_)}${r(g)}${r(l)}`},n.toRgba=function(_,g,l,p=255){return(_<<24|g<<16|l<<8|p)>>>0},n.toColor=function(_,g,l,p){return{css:n.toCss(_,g,l,p),rgba:n.toRgba(_,g,l,p)}}})(u||(t.channels=u={})),(function(n){function _(g,l){return s=Math.round(255*l),[a,h,c]=e.toChannels(g.rgba),{css:u.toCss(a,h,c,s),rgba:u.toRgba(a,h,c,s)}}n.blend=function(g,l){if(s=(255&l.rgba)/255,s===1)return{css:l.css,rgba:l.rgba};const p=l.rgba>>24&255,f=l.rgba>>16&255,m=l.rgba>>8&255,S=g.rgba>>24&255,y=g.rgba>>16&255,b=g.rgba>>8&255;return a=S+Math.round((p-S)*s),h=y+Math.round((f-y)*s),c=b+Math.round((m-b)*s),{css:u.toCss(a,h,c),rgba:u.toRgba(a,h,c)}},n.isOpaque=function(g){return(255&g.rgba)==255},n.ensureContrastRatio=function(g,l,p){const f=e.ensureContrastRatio(g.rgba,l.rgba,p);if(f)return u.toColor(f>>24&255,f>>16&255,f>>8&255)},n.opaque=function(g){const l=(255|g.rgba)>>>0;return[a,h,c]=e.toChannels(l),{css:u.toCss(a,h,c),rgba:l}},n.opacity=_,n.multiplyOpacity=function(g,l){return s=255&g.rgba,_(g,s*l/255)},n.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}})(d||(t.color=d={})),(function(n){let _,g;try{const l=document.createElement("canvas");l.width=1,l.height=1;const p=l.getContext("2d",{willReadFrequently:!0});p&&(_=p,_.globalCompositeOperation="copy",g=_.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return a=parseInt(l.slice(1,2).repeat(2),16),h=parseInt(l.slice(2,3).repeat(2),16),c=parseInt(l.slice(3,4).repeat(2),16),u.toColor(a,h,c);case 5:return a=parseInt(l.slice(1,2).repeat(2),16),h=parseInt(l.slice(2,3).repeat(2),16),c=parseInt(l.slice(3,4).repeat(2),16),s=parseInt(l.slice(4,5).repeat(2),16),u.toColor(a,h,c,s);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}const p=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(p)return a=parseInt(p[1]),h=parseInt(p[2]),c=parseInt(p[3]),s=Math.round(255*(p[5]===void 0?1:parseFloat(p[5]))),u.toColor(a,h,c,s);if(!_||!g)throw new Error("css.toColor: Unsupported css format");if(_.fillStyle=g,_.fillStyle=l,typeof _.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(_.fillRect(0,0,1,1),[a,h,c,s]=_.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:u.toRgba(a,h,c,s),css:l}}})(v||(t.css=v={})),(function(n){function _(g,l,p){const f=g/255,m=l/255,S=p/255;return .2126*(f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}n.relativeLuminance=function(g){return _(g>>16&255,g>>8&255,255&g)},n.relativeLuminance2=_})(o||(t.rgb=o={})),(function(n){function _(l,p,f){const m=l>>24&255,S=l>>16&255,y=l>>8&255;let b=p>>24&255,w=p>>16&255,x=p>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));for(;I<f&&(b>0||w>0||x>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),x-=Math.max(0,Math.ceil(.1*x)),I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));return(b<<24|w<<16|x<<8|255)>>>0}function g(l,p,f){const m=l>>24&255,S=l>>16&255,y=l>>8&255;let b=p>>24&255,w=p>>16&255,x=p>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));for(;I<f&&(b<255||w<255||x<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),x=Math.min(255,x+Math.ceil(.1*(255-x))),I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));return(b<<24|w<<16|x<<8|255)>>>0}n.blend=function(l,p){if(s=(255&p)/255,s===1)return p;const f=p>>24&255,m=p>>16&255,S=p>>8&255,y=l>>24&255,b=l>>16&255,w=l>>8&255;return a=y+Math.round((f-y)*s),h=b+Math.round((m-b)*s),c=w+Math.round((S-w)*s),u.toRgba(a,h,c)},n.ensureContrastRatio=function(l,p,f){const m=o.relativeLuminance(l>>8),S=o.relativeLuminance(p>>8);if(i(m,S)<f){if(S<m){const w=_(l,p,f),x=i(m,o.relativeLuminance(w>>8));if(x<f){const I=g(l,p,f);return x>i(m,o.relativeLuminance(I>>8))?w:I}return w}const y=g(l,p,f),b=i(m,o.relativeLuminance(y>>8));if(b<f){const w=_(l,p,f);return b>i(m,o.relativeLuminance(w>>8))?y:w}return y}},n.reduceLuminance=_,n.increaseLuminance=g,n.toChannels=function(l){return[l>>24&255,l>>16&255,l>>8&255,255&l]}})(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),c=a(2585),s=a(4348),u=a(7866),d=a(744),v=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),n=a(7994),_=a(9282),g=a(5435),l=a(5981),p=a(2660);let f=!1;class m extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((y=>{var b;(b=this._onScrollApi)==null||b.fire(y.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(y){for(const b in y)this.optionsService.options[b]=y[b]}constructor(y){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new s.InstantiationService,this.optionsService=this.register(new v.OptionsService(y)),this._instantiationService.setService(c.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(c.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(u.LogService)),this._instantiationService.setService(c.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(c.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(r.CoreMouseService)),this._instantiationService.setService(c.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(c.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(n.CharsetService),this._instantiationService.setService(c.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(p.OscLinkService),this._instantiationService.setService(c.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((b=>{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((b=>{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 l.WriteBuffer(((b,w)=>this._inputHandler.parse(b,w)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(y,b){this._writeBuffer.write(y,b)}writeSync(y,b){this._logService.logLevel<=c.LogLevelEnum.WARN&&!f&&(this._logService.warn("writeSync is unreliable and will be removed soon."),f=!0),this._writeBuffer.writeSync(y,b)}input(y,b=!0){this.coreService.triggerDataEvent(y,b)}resize(y,b){isNaN(y)||isNaN(b)||(y=Math.max(y,d.MINIMUM_COLS),b=Math.max(b,d.MINIMUM_ROWS),this._bufferService.resize(y,b))}scroll(y,b=!1){this._bufferService.scroll(y,b)}scrollLines(y,b,w){this._bufferService.scrollLines(y,b,w)}scrollPages(y){this.scrollLines(y*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(y){const b=y-this._bufferService.buffer.ydisp;b!==0&&this.scrollLines(b)}registerEscHandler(y,b){return this._inputHandler.registerEscHandler(y,b)}registerDcsHandler(y,b){return this._inputHandler.registerDcsHandler(y,b)}registerCsiHandler(y,b){return this._inputHandler.registerCsiHandler(y,b)}registerOscHandler(y,b){return this._inputHandler.registerOscHandler(y,b)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let y=!1;const b=this.optionsService.rawOptions.windowsPty;b&&b.buildNumber!==void 0&&b.buildNumber!==void 0?y=b.backend==="conpty"&&b.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(y=!0),y?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const y=[];y.push(this.onLineFeed(_.updateWindowsModeWrappedState.bind(null,this._bufferService))),y.push(this.registerCsiHandler({final:"H"},(()=>((0,_.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const b of y)b.dispose()}))}}}t.CoreTerminal=m},8460:(R,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 c=[];for(let s=0;s<this._listeners.length;s++)c.push(this._listeners[s]);for(let s=0;s<c.length;s++)c[s].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((c=>h.fire(c)))},t.runAndSubscribe=function(a,h){return h(void 0),a((c=>h(c)))}},5435:function(R,t,a){var h=this&&this.__decorate||function(F,C,L,D){var T,U=arguments.length,q=U<3?C:D===null?D=Object.getOwnPropertyDescriptor(C,L):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(F,C,L,D);else for(var X=F.length-1;X>=0;X--)(T=F[X])&&(q=(U<3?T(q):U>3?T(C,L,q):T(C,L))||q);return U>3&&q&&Object.defineProperty(C,L,q),q},c=this&&this.__param||function(F,C){return function(L,D){C(L,D,F)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const s=a(2584),u=a(7116),d=a(2015),v=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),n=a(511),_=a(3734),g=a(2585),l=a(1480),p=a(6242),f=a(6351),m=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function b(F,C){if(F>24)return C.setWinLines||!1;switch(F){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var w;(function(F){F[F.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",F[F.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(t.WindowsOptionsReportType=w={}));let x=0;class I extends v.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,D,T,U,q,X,G,k=new d.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=D,this._logService=T,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=X,this._unicodeService=G,this._parser=k,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new n.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((E=>this._activeBuffer=E.activeBuffer))),this._parser.setCsiHandlerFallback(((E,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(E),params:z.toArray()})})),this._parser.setEscHandlerFallback((E=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(E)})})),this._parser.setExecuteHandlerFallback((E=>{this._logService.debug("Unknown EXECUTE code: ",{code:E})})),this._parser.setOscHandlerFallback(((E,z,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:E,action:z,data:N})})),this._parser.setDcsHandlerFallback(((E,z,N)=>{z==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(E),action:z,payload:N})})),this._parser.setPrintHandler(((E,z,N)=>this.print(E,z,N))),this._parser.registerCsiHandler({final:"@"},(E=>this.insertChars(E))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(E=>this.scrollLeft(E))),this._parser.registerCsiHandler({final:"A"},(E=>this.cursorUp(E))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(E=>this.scrollRight(E))),this._parser.registerCsiHandler({final:"B"},(E=>this.cursorDown(E))),this._parser.registerCsiHandler({final:"C"},(E=>this.cursorForward(E))),this._parser.registerCsiHandler({final:"D"},(E=>this.cursorBackward(E))),this._parser.registerCsiHandler({final:"E"},(E=>this.cursorNextLine(E))),this._parser.registerCsiHandler({final:"F"},(E=>this.cursorPrecedingLine(E))),this._parser.registerCsiHandler({final:"G"},(E=>this.cursorCharAbsolute(E))),this._parser.registerCsiHandler({final:"H"},(E=>this.cursorPosition(E))),this._parser.registerCsiHandler({final:"I"},(E=>this.cursorForwardTab(E))),this._parser.registerCsiHandler({final:"J"},(E=>this.eraseInDisplay(E,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(E=>this.eraseInDisplay(E,!0))),this._parser.registerCsiHandler({final:"K"},(E=>this.eraseInLine(E,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(E=>this.eraseInLine(E,!0))),this._parser.registerCsiHandler({final:"L"},(E=>this.insertLines(E))),this._parser.registerCsiHandler({final:"M"},(E=>this.deleteLines(E))),this._parser.registerCsiHandler({final:"P"},(E=>this.deleteChars(E))),this._parser.registerCsiHandler({final:"S"},(E=>this.scrollUp(E))),this._parser.registerCsiHandler({final:"T"},(E=>this.scrollDown(E))),this._parser.registerCsiHandler({final:"X"},(E=>this.eraseChars(E))),this._parser.registerCsiHandler({final:"Z"},(E=>this.cursorBackwardTab(E))),this._parser.registerCsiHandler({final:"`"},(E=>this.charPosAbsolute(E))),this._parser.registerCsiHandler({final:"a"},(E=>this.hPositionRelative(E))),this._parser.registerCsiHandler({final:"b"},(E=>this.repeatPrecedingCharacter(E))),this._parser.registerCsiHandler({final:"c"},(E=>this.sendDeviceAttributesPrimary(E))),this._parser.registerCsiHandler({prefix:">",final:"c"},(E=>this.sendDeviceAttributesSecondary(E))),this._parser.registerCsiHandler({final:"d"},(E=>this.linePosAbsolute(E))),this._parser.registerCsiHandler({final:"e"},(E=>this.vPositionRelative(E))),this._parser.registerCsiHandler({final:"f"},(E=>this.hVPosition(E))),this._parser.registerCsiHandler({final:"g"},(E=>this.tabClear(E))),this._parser.registerCsiHandler({final:"h"},(E=>this.setMode(E))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(E=>this.setModePrivate(E))),this._parser.registerCsiHandler({final:"l"},(E=>this.resetMode(E))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(E=>this.resetModePrivate(E))),this._parser.registerCsiHandler({final:"m"},(E=>this.charAttributes(E))),this._parser.registerCsiHandler({final:"n"},(E=>this.deviceStatus(E))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(E=>this.deviceStatusPrivate(E))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(E=>this.softReset(E))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(E=>this.setCursorStyle(E))),this._parser.registerCsiHandler({final:"r"},(E=>this.setScrollRegion(E))),this._parser.registerCsiHandler({final:"s"},(E=>this.saveCursor(E))),this._parser.registerCsiHandler({final:"t"},(E=>this.windowOptions(E))),this._parser.registerCsiHandler({final:"u"},(E=>this.restoreCursor(E))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(E=>this.insertColumns(E))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(E=>this.deleteColumns(E))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(E=>this.selectProtected(E))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(E=>this.requestMode(E,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(E=>this.requestMode(E,!1))),this._parser.setExecuteHandler(s.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(s.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(s.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(s.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(s.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(s.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(s.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(s.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(s.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new p.OscHandler((E=>(this.setTitle(E),this.setIconName(E),!0)))),this._parser.registerOscHandler(1,new p.OscHandler((E=>this.setIconName(E)))),this._parser.registerOscHandler(2,new p.OscHandler((E=>this.setTitle(E)))),this._parser.registerOscHandler(4,new p.OscHandler((E=>this.setOrReportIndexedColor(E)))),this._parser.registerOscHandler(8,new p.OscHandler((E=>this.setHyperlink(E)))),this._parser.registerOscHandler(10,new p.OscHandler((E=>this.setOrReportFgColor(E)))),this._parser.registerOscHandler(11,new p.OscHandler((E=>this.setOrReportBgColor(E)))),this._parser.registerOscHandler(12,new p.OscHandler((E=>this.setOrReportCursorColor(E)))),this._parser.registerOscHandler(104,new p.OscHandler((E=>this.restoreIndexedColor(E)))),this._parser.registerOscHandler(110,new p.OscHandler((E=>this.restoreFgColor(E)))),this._parser.registerOscHandler(111,new p.OscHandler((E=>this.restoreBgColor(E)))),this._parser.registerOscHandler(112,new p.OscHandler((E=>this.restoreCursorColor(E)))),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 E in u.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:E},(()=>this.selectCharset("("+E))),this._parser.registerEscHandler({intermediates:")",final:E},(()=>this.selectCharset(")"+E))),this._parser.registerEscHandler({intermediates:"*",final:E},(()=>this.selectCharset("*"+E))),this._parser.registerEscHandler({intermediates:"+",final:E},(()=>this.selectCharset("+"+E))),this._parser.registerEscHandler({intermediates:"-",final:E},(()=>this.selectCharset("-"+E))),this._parser.registerEscHandler({intermediates:".",final:E},(()=>this.selectCharset("."+E))),this._parser.registerEscHandler({intermediates:"/",final:E},(()=>this.selectCharset("/"+E)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((E=>(this._logService.error("Parsing error: ",E),E))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new f.DcsHandler(((E,z)=>this.requestStatusString(E,z))))}_preserveStack(C,L,D,T){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=D,this._parseStack.position=T}_logSlowResolvingAsync(C){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let D,T=this._activeBuffer.x,U=this._activeBuffer.y,q=0;const X=this._parseStack.paused;if(X){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(D),D;T=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>y&&(q=this._parseStack.position+y)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(E=>String.fromCharCode(E))).join("")}"`),typeof C=="string"?C.split("").map((E=>E.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<y&&(this._parseBuffer=new Uint32Array(Math.min(C.length,y))),X||this._dirtyRowTracker.clearRange(),C.length>y)for(let E=q;E<C.length;E+=y){const z=E+y<C.length?E+y:C.length,N=typeof C=="string"?this._stringDecoder.decode(C.substring(E,z),this._parseBuffer):this._utf8Decoder.decode(C.subarray(E,z),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,N))return this._preserveStack(T,U,N,E),this._logSlowResolvingAsync(D),D}else if(!X){const E=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,E))return this._preserveStack(T,U,E,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===T&&this._activeBuffer.y===U||this._onCursorMove.fire();const G=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),k=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);k<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(k,this._bufferService.rows-1),Math.min(G,this._bufferService.rows-1))}print(C,L,D){let T,U;const q=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,k=this._coreService.decPrivateModes.wraparound,E=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&&D-L>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let K=this._parser.precedingJoinState;for(let j=L;j<D;++j){if(T=C[j],T<127&&q){const he=q[String.fromCharCode(T)];he&&(T=he.charCodeAt(0))}const Z=this._unicodeService.charProperties(T,K);U=l.UnicodeService.extractWidth(Z);const Y=l.UnicodeService.extractShouldJoin(Z),re=Y?l.UnicodeService.extractWidth(K):0;if(K=Z,X&&this._onA11yChar.fire((0,o.stringFromCodePoint)(T)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-re>G){if(k){const he=N;let J=this._activeBuffer.x-re;for(this._activeBuffer.x=re,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),re>0&&N instanceof e.BufferLine&&N.copyCellsFrom(he,J,0,re,!1);J<G;)he.setCellFromCodepoint(J++,0,1,z)}else if(this._activeBuffer.x=G-1,U===2)continue}if(Y&&this._activeBuffer.x){const he=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-he,T,U);for(let J=U-re;--J>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(E&&(N.insertCells(this._activeBuffer.x,U-re,this._activeBuffer.getNullCell(z)),N.getWidth(G-1)===2&&N.setCellFromCodepoint(G-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,z)),N.setCellFromCodepoint(this._activeBuffer.x++,T,U,z),U>0)for(;--U;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=K,this._activeBuffer.x<G&&D-L>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(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(D=>!b(D.params[0],this._optionsService.rawOptions.windowOptions)||L(D)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new f.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new p.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var C;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&&((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,D,T=!1,U=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);q.replaceCells(L,D,this._activeBuffer.getNullCell(this._eraseAttrData()),U),T&&(q.isWrapped=!1)}_resetBufferLine(C,L=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),D.isWrapped=!1)}eraseInDisplay(C,L=!1){let D;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);D<this._bufferService.rows;D++)this._resetBufferLine(D,L);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,L);this._dirtyRowTracker.markDirty(0);break;case 3:const T=this._activeBuffer.lines.length-this._bufferService.rows;T>0&&(this._activeBuffer.lines.trimStart(T),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-T,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-T,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y,T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-T+1;for(;L--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y;let T;for(T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,T=this._bufferService.rows-1+this._activeBuffer.ybase-T;L--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){const L=this._parser.precedingJoinState;if(!L)return!0;const D=C.params[0]||1,T=l.UnicodeService.extractWidth(L),U=this._activeBuffer.x-T,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),X=new Uint32Array(q.length*D);let G=0;for(let E=0;E<q.length;){const z=q.codePointAt(E)||0;X[G++]=z,E+=z>65535?2:1}let k=G;for(let E=1;E<D;++E)X.copyWithin(k,0,G),k+=G;return this.print(X,0,k),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,u.DEFAULT_CHARSET),this._charsetService.setgCharset(1,u.DEFAULT_CHARSET),this._charsetService.setgCharset(2,u.DEFAULT_CHARSET),this._charsetService.setgCharset(3,u.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,L){const D=this._coreService.decPrivateModes,{activeProtocol:T,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:X,cols:G}=this._bufferService,{active:k,alt:E}=X,z=this._optionsService.rawOptions,N=Y=>Y?1:2,K=C.params[0];return j=K,Z=L?K===2?4:K===4?N(q.modes.insertMode):K===12?3:K===20?N(z.convertEol):0:K===1?N(D.applicationCursorKeys):K===3?z.windowOptions.setWinLines?G===80?2:G===132?1:0:0:K===6?N(D.origin):K===7?N(D.wraparound):K===8?3:K===9?N(T==="X10"):K===12?N(z.cursorBlink):K===25?N(!q.isCursorHidden):K===45?N(D.reverseWraparound):K===66?N(D.applicationKeypad):K===67?4:K===1e3?N(T==="VT200"):K===1002?N(T==="DRAG"):K===1003?N(T==="ANY"):K===1004?N(D.sendFocus):K===1005?4:K===1006?N(U==="SGR"):K===1015?4:K===1016?N(U==="SGR_PIXELS"):K===1048?1:K===47||K===1047||K===1049?N(k===E):K===2004?N(D.bracketedPasteMode):0,q.triggerDataEvent(`${s.C0.ESC}[${L?"":"?"}${j};${Z}$y`),!0;var j,Z}_updateAttrColor(C,L,D,T,U){return L===2?(C|=50331648,C&=-16777216,C|=_.AttributeData.fromColorRGB([D,T,U])):L===5&&(C&=-50331904,C|=33554432|255&D),C}_extractColor(C,L,D){const T=[0,0,-1,0,0,0];let U=0,q=0;do{if(T[q+U]=C.params[L+q],C.hasSubParams(L+q)){const X=C.getSubParams(L+q);let G=0;do T[1]===5&&(U=1),T[q+G+1+U]=X[G];while(++G<X.length&&G+q+1+U<T.length);break}if(T[1]===5&&q+U>=2||T[1]===2&&q+U>=5)break;T[1]&&(U=1)}while(++q+L<C.length&&q+U<T.length);for(let X=2;X<T.length;++X)T[X]===-1&&(T[X]=0);switch(T[0]){case 38:D.fg=this._updateAttrColor(D.fg,T[1],T[3],T[4],T[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,T[1],T[3],T[4],T[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,T[1],T[3],T[4],T[5])}return q}_processUnderline(C,L){L.extended=L.extended.clone(),(!~C||C>5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=C.length;let D;const T=this._curAttrData;for(let U=0;U<L;U++)D=C.params[U],D>=30&&D<=37?(T.fg&=-50331904,T.fg|=16777216|D-30):D>=40&&D<=47?(T.bg&=-50331904,T.bg|=16777216|D-40):D>=90&&D<=97?(T.fg&=-50331904,T.fg|=16777224|D-90):D>=100&&D<=107?(T.bg&=-50331904,T.bg|=16777224|D-100):D===0?this._processSGR0(T):D===1?T.fg|=134217728:D===3?T.bg|=67108864:D===4?(T.fg|=268435456,this._processUnderline(C.hasSubParams(U)?C.getSubParams(U)[0]:1,T)):D===5?T.fg|=536870912:D===7?T.fg|=67108864:D===8?T.fg|=1073741824:D===9?T.fg|=2147483648:D===2?T.bg|=134217728:D===21?this._processUnderline(2,T):D===22?(T.fg&=-134217729,T.bg&=-134217729):D===23?T.bg&=-67108865:D===24?(T.fg&=-268435457,this._processUnderline(0,T)):D===25?T.fg&=-536870913:D===27?T.fg&=-67108865:D===28?T.fg&=-1073741825:D===29?T.fg&=2147483647:D===39?(T.fg&=-67108864,T.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):D===49?(T.bg&=-67108864,T.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?U+=this._extractColor(C,U,T):D===53?T.bg|=1073741824:D===55?T.bg&=-1073741825:D===59?(T.extended=T.extended.clone(),T.extended.underlineColor=-1,T.updateExtended()):D===100?(T.fg&=-67108864,T.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,T.bg&=-67108864,T.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${s.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[${L};${D}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const L=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[?${L};${D}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(C){const L=C.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const D=L%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(C){const L=C.params[0]||1;let D;return(C.length<2||(D=C.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(C){if(!b(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${s.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const L=[],D=C.split(";");for(;D.length>1;){const T=D.shift(),U=D.shift();if(/^\d+$/.exec(T)){const q=parseInt(T);if(H(q))if(U==="?")L.push({type:0,index:q});else{const X=(0,m.parseColor)(U);X&&L.push({type:1,index:q,color:X})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){const L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();const D=C.split(":");let T;const U=D.findIndex((q=>q.startsWith("id=")));return U!==-1&&(T=D[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:T,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){const D=C.split(";");for(let T=0;T<D.length&&!(L>=this._specialColors.length);++T,++L)if(D[T]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,m.parseColor)(D[T]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const L=[],D=C.split(";");for(let T=0;T<D.length;++T)if(/^\d+$/.exec(D[T])){const U=parseInt(D[T]);H(U)&&L.push({type:2,index:U})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,u.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],u.CHARSETS[C[1]]||u.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 C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){const C=new n.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const D=this._activeBuffer.ybase+this._activeBuffer.y+L,T=this._activeBuffer.lines.get(D);T&&(T.fill(C),T.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,L){const D=this._bufferService.buffer,T=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${s.C0.ESC}${U}${s.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[T.cursorStyle]-(T.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}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,C){F>C&&(x=F,F=C,C=x),F<this.start&&(this.start=F),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(F){return 0<=F&&F<256}$=h([c(0,g.IBufferService)],$)},844:(R,t)=>{function a(h){for(const c of h)c.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 c=this._disposables.indexOf(h);c!==-1&&this._disposables.splice(c,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var c;this._isDisposed||h===this._value||((c=this._value)==null||c.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:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(c,s,u){this._data[c]||(this._data[c]={}),this._data[c][s]=u}get(c,s){return this._data[c]?this._data[c][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,c,s,u,d){this._data.get(h,c)||this._data.set(h,c,new a),this._data.get(h,c).set(s,u,d)}get(h,c,s,u){var d;return(d=this._data.get(h,c))==null?void 0:d.get(s,u)}clear(){this._data.clear()}}},6114:(R,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 c=a.match(/Version\/(\d+)/);return c===null||c.length<2?0:parseInt(c[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:(R,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 c=this._getKey(h);if(c===void 0||(a=this._search(c),a===-1)||this._getKey(this._array[a])!==c)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])===c);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,c){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do c(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let c=0,s=this._array.length-1;for(;s>=c;){let u=c+s>>1;const d=this._getKey(this._array[u]);if(d>h)s=u-1;else{if(!(d<h)){for(;u>0&&this._getKey(this._array[u-1])===h;)u--;return u}c=u+1}}return c}}},7226:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class c{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(d){this._idleCallback=void 0;let v=0,o=0,e=d.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),r=d.timeRemaining(),1.5*o>r)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=r}this.clear()}}class s extends c{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){const v=Date.now()+d;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(u){return requestIdleCallback(u)}_cancelCallback(u){cancelIdleCallback(u)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(u){this._queue.clear(),this._queue.enqueue(u)}flush(){this._queue.flush()}}},9282:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(c){const s=c.buffer.lines.get(c.buffer.ybase+c.buffer.y-1),u=s==null?void 0:s.get(c.cols-1),d=c.buffer.lines.get(c.buffer.ybase+c.buffer.y);d&&u&&(d.isWrapped=u[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&u[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(R,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(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,u=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=u}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),c=a(7226),s=a(3734),u=a(8437),d=a(4634),v=a(511),o=a(643),e=a(4863),r=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,n,_){this._hasScrollback=i,this._optionsService=n,this._bufferService=_,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=u.DEFAULT_ATTR_DATA.clone(),this.savedCharset=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new c.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,n){return new u.BufferLine(this._bufferService.cols,this.getNullCell(i),n)}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 n=i+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=u.DEFAULT_ATTR_DATA);let n=this._rows;for(;n--;)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,n){const _=this.getNullCell(u.DEFAULT_ATTR_DATA);let g=0;const l=this._getCorrectBufferLength(n);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<i)for(let f=0;f<this.lines.length;f++)g+=+this.lines.get(f).resize(i,_);let p=0;if(this._rows<n)for(let f=this._rows;f<n;f++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new u.BufferLine(i,_)):this.ybase>0&&this.lines.length<=this.ybase+this.y+p+1?(this.ybase--,p++,this.ydisp>0&&this.ydisp--):this.lines.push(new u.BufferLine(i,_)));else for(let f=this._rows;f>n;f--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){const f=this.lines.length-l;f>0&&(this.lines.trimStart(f),this.ybase=Math.max(this.ybase-f,0),this.ydisp=Math.max(this.ydisp-f,0),this.savedY=Math.max(this.savedY-f,0)),this.lines.maxLength=l}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,n-1),p&&(this.y+=p),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(i,n),this._cols>i))for(let p=0;p<this.lines.length;p++)g+=+this.lines.get(p).resize(i,_);this._cols=i,this._rows=n,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 n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>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,n){this._cols!==i&&(i>this._cols?this._reflowLarger(i,n):this._reflowSmaller(i,n))}_reflowLarger(i,n){const _=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(u.DEFAULT_ATTR_DATA));if(_.length>0){const g=(0,d.reflowLargerCreateNewLayout)(this.lines,_);(0,d.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(i,n,g.countRemoved)}}_reflowLargerAdjustViewport(i,n,_){const g=this.getNullCell(u.DEFAULT_ATTR_DATA);let l=_;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new u.BufferLine(i,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(i,n){const _=this.getNullCell(u.DEFAULT_ATTR_DATA),g=[];let l=0;for(let p=this.lines.length-1;p>=0;p--){let f=this.lines.get(p);if(!f||!f.isWrapped&&f.getTrimmedLength()<=i)continue;const m=[f];for(;f.isWrapped&&p>0;)f=this.lines.get(--p),m.unshift(f);const S=this.ybase+this.y;if(S>=p&&S<p+m.length)continue;const y=m[m.length-1].getTrimmedLength(),b=(0,d.reflowSmallerGetNewLineLengths)(m,this._cols,i),w=b.length-m.length;let x;x=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+w):Math.max(0,this.lines.length-this.lines.maxLength+w);const I=[];for(let D=0;D<w;D++){const T=this.getBlankLine(u.DEFAULT_ATTR_DATA,!0);I.push(T)}I.length>0&&(g.push({start:p+m.length+l,newLines:I}),l+=I.length),m.push(...I);let $=b.length-1,H=b[$];H===0&&($--,H=b[$]);let F=m.length-w-1,C=y;for(;F>=0;){const D=Math.min(C,H);if(m[$]===void 0)break;if(m[$].copyCellsFrom(m[F],C-D,H-D,D,!0),H-=D,H===0&&($--,H=b[$]),C-=D,C===0){F--;const T=Math.max(F,0);C=(0,d.getWrappedLineTrimmedLength)(m,T,this._cols)}}for(let D=0;D<m.length;D++)b[D]<i&&m[D].setCell(b[D],_);let L=w-x;for(;L-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+n-1)}if(g.length>0){const p=[],f=[];for(let $=0;$<this.lines.length;$++)f.push(this.lines.get($));const m=this.lines.length;let S=m-1,y=0,b=g[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let w=0;for(let $=Math.min(this.lines.maxLength-1,m+l-1);$>=0;$--)if(b&&b.start>S+w){for(let H=b.newLines.length-1;H>=0;H--)this.lines.set($--,b.newLines[H]);$++,p.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=g[++y]}else this.lines.set($,f[S--]);let x=0;for(let $=p.length-1;$>=0;$--)p[$].index+=x,this.lines.onInsertEmitter.fire(p[$]),x+=p[$].amount;const I=Math.max(0,m+l-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(i,n,_=0,g){const l=this.lines.get(i);return l?l.translateToString(n,_,g):""}getWrappedRangeForLine(i){let n=i,_=i;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;_+1<this.lines.length&&this.lines.get(_+1).isWrapped;)_++;return{first:n,last:_}}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 n=0;n<this.markers.length;n++)this.markers[n].line===i&&(this.markers[n].dispose(),this.markers.splice(n--,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 n=new e.Marker(i);return this.markers.push(n),n.register(this.lines.onTrim((_=>{n.line-=_,n.line<0&&n.dispose()}))),n.register(this.lines.onInsert((_=>{n.line>=_.index&&(n.line+=_.amount)}))),n.register(this.lines.onDelete((_=>{n.line>=_.index&&n.line<_.index+_.amount&&n.dispose(),n.line>_.index&&(n.line-=_.amount)}))),n.register(n.onDispose((()=>this._removeMarker(n)))),n}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),c=a(511),s=a(643),u=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let d=0;class v{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const n=r||c.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]);for(let _=0;_<e;++_)this.setCell(_,n);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,u.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[s.CHAR_DATA_ATTR_INDEX],r[s.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[s.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[s.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const 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,u.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return d=3*e,r.content=this._data[d+0],r.fg=this._data[d+1],r.bg=this._data[d+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,n){268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}addCodepointToCell(e,r,i){let n=this._data[3*e+0];2097152&n?this._combined[e]+=(0,u.stringFromCodePoint)(r):2097151&n?(this._combined[e]=(0,u.stringFromCodePoint)(2097151&n)+(0,u.stringFromCodePoint)(r),n&=-2097152,n|=2097152):n=r|4194304,i&&(n&=-12582913,n|=i<<22),this._data[3*e+0]=n}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 n=new c.CellData;for(let _=this.length-e-r-1;_>=0;--_)this.setCell(e+r+_,this.loadCell(e+_,n));for(let _=0;_<r;++_)this.setCell(e+_,i)}else for(let n=e;n<this.length;++n)this.setCell(n,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 n=new c.CellData;for(let _=0;_<this.length-e-r;++_)this.setCell(e+_,this.loadCell(e+r+_,n));for(let _=this.length-r;_<this.length;++_)this.setCell(_,i)}else for(let n=e;n<this.length;++n)this.setCell(n,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,n=!1){if(n)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 n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<e;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);const n=Object.keys(this._combined);for(let g=0;g<n.length;g++){const l=parseInt(n[g],10);l>=e&&delete this._combined[l]}const _=Object.keys(this._extendedAttrs);for(let g=0;g<_.length;g++){const l=parseInt(_[g],10);l>=e&&delete this._extendedAttrs[l]}}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 v(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,n,_){const g=e._data;if(_)for(let p=n-1;p>=0;p--){for(let f=0;f<3;f++)this._data[3*(i+p)+f]=g[3*(r+p)+f];268435456&g[3*(r+p)+2]&&(this._extendedAttrs[i+p]=e._extendedAttrs[r+p])}else for(let p=0;p<n;p++){for(let f=0;f<3;f++)this._data[3*(i+p)+f]=g[3*(r+p)+f];268435456&g[3*(r+p)+2]&&(this._extendedAttrs[i+p]=e._extendedAttrs[r+p])}const l=Object.keys(e._combined);for(let p=0;p<l.length;p++){const f=parseInt(l[p],10);f>=r&&(this._combined[f-r+i]=e._combined[f])}}translateToString(e,r,i,n){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let _="";for(;r<i;){const g=this._data[3*r+0],l=2097151&g,p=2097152&g?this._combined[r]:l?(0,u.stringFromCodePoint)(l):s.WHITESPACE_CELL_CHAR;if(_+=p,n)for(let f=0;f<p.length;++f)n.push(r);r+=g>>22||1}return n&&n.push(r),_}}t.BufferLine=v},4841:(R,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:(R,t)=>{function a(h,c,s){if(c===h.length-1)return h[c].getTrimmedLength();const u=!h[c].hasContent(s-1)&&h[c].getWidth(s-1)===1,d=h[c+1].getWidth(0)===2;return u&&d?s-1:s}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,c,s,u,d){const v=[];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(u>=o&&u<e){o+=i.length-1;continue}let n=0,_=a(i,n,c),g=1,l=0;for(;g<i.length;){const f=a(i,g,c),m=f-l,S=s-_,y=Math.min(m,S);i[n].copyCellsFrom(i[g],l,_,y,!1),_+=y,_===s&&(n++,_=0),l+=y,l===f&&(g++,l=0),_===0&&n!==0&&i[n-1].getWidth(s-1)===2&&(i[n].copyCellsFrom(i[n-1],s-1,_++,1,!1),i[n-1].setCell(s-1,d))}i[n].replaceCells(_,s,d);let p=0;for(let f=i.length-1;f>0&&(f>n||i[f].getTrimmedLength()===0);f--)p++;p>0&&(v.push(o+i.length-p),v.push(p)),o+=i.length-1}return v},t.reflowLargerCreateNewLayout=function(h,c){const s=[];let u=0,d=c[u],v=0;for(let o=0;o<h.length;o++)if(d===o){const e=c[++u];h.onDeleteEmitter.fire({index:o-v,amount:e}),o+=e-1,v+=e,d=c[++u]}else s.push(o);return{layout:s,countRemoved:v}},t.reflowLargerApplyNewLayout=function(h,c){const s=[];for(let u=0;u<c.length;u++)s.push(h.get(c[u]));for(let u=0;u<s.length;u++)h.set(u,s[u]);h.length=c.length},t.reflowSmallerGetNewLineLengths=function(h,c,s){const u=[],d=h.map(((r,i)=>a(h,i,c))).reduce(((r,i)=>r+i));let v=0,o=0,e=0;for(;e<d;){if(d-e<s){u.push(d-e);break}v+=s;const r=a(h,o,c);v>r&&(v-=r,o++);const i=h[o].getWidth(v-1)===2;i&&v--;const n=i?s-1:s;u.push(n),e+=n}return u},t.getWrappedLineTrimmedLength=a},5295:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),c=a(844),s=a(9092);class u extends c.Disposable{constructor(v,o){super(),this._optionsService=v,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 s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),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(v,o){this._normal.resize(v,o),this._alt.resize(v,o),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}t.BufferSet=u},511:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),c=a(643),s=a(3734);class u extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const o=new u;return o.setFromCharData(v),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(v){this.fg=v[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[c.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[c.CHAR_DATA_CHAR_INDEX].length===2){const e=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|v[c.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[c.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=u},643:(R,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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),c=a(844);class s{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=s._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,c.disposeArray)(this._disposables),this._disposables.length=0)}register(d){return this._disposables.push(d),d}}t.Marker=s,s._nextId=1},7116:(R,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:(R,t)=>{var a,h,c;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(function(s){s.NUL="\0",s.SOH="",s.STX="",s.ETX="",s.EOT="",s.ENQ="",s.ACK="",s.BEL="\x07",s.BS="\b",s.HT=" ",s.LF=`
|
|
10
|
+
`,s.VT="\v",s.FF="\f",s.CR="\r",s.SO="",s.SI="",s.DLE="",s.DC1="",s.DC2="",s.DC3="",s.DC4="",s.NAK="",s.SYN="",s.ETB="",s.CAN="",s.EM="",s.SUB="",s.ESC="\x1B",s.FS="",s.GS="",s.RS="",s.US="",s.SP=" ",s.DEL=""})(a||(t.C0=a={})),(function(s){s.PAD="",s.HOP="",s.BPH="",s.NBH="",s.IND="",s.NEL="
",s.SSA="",s.ESA="",s.HTS="",s.HTJ="",s.VTS="",s.PLD="",s.PLU="",s.RI="",s.SS2="",s.SS3="",s.DCS="",s.PU1="",s.PU2="",s.STS="",s.CCH="",s.MW="",s.SPA="",s.EPA="",s.SOS="",s.SGCI="",s.SCI="",s.CSI="",s.ST="",s.OSC="",s.PM="",s.APC=""})(h||(t.C1=h={})),(function(s){s.ST=`${a.ESC}\\`})(c||(t.C1_ESCAPED=c={}))},7399:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),c={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(s,u,d,v){const o={type:0,cancel:!1,key:void 0},e=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?o.key=u?h.C0.ESC+"OA":h.C0.ESC+"[A":s.key==="UIKeyInputLeftArrow"?o.key=u?h.C0.ESC+"OD":h.C0.ESC+"[D":s.key==="UIKeyInputRightArrow"?o.key=u?h.C0.ESC+"OC":h.C0.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(o.key=u?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=s.ctrlKey?"\b":h.C0.DEL,s.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(s.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=s.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,s.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(d?"b":"[1;5D"))):o.key=u?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(d?"f":"[1;5C"))):o.key=u?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",d||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=u?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",d||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=u?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:s.shiftKey||s.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":u?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":u?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:s.shiftKey?o.type=2:s.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:s.shiftKey?o.type=3:s.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(!s.ctrlKey||s.shiftKey||s.altKey||s.metaKey)if(d&&!v||!s.altKey||s.metaKey)!d||s.altKey||s.ctrlKey||s.shiftKey||!s.metaKey?s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?o.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(o.key=h.C0.US),s.key==="@"&&(o.key=h.C0.NUL)):s.keyCode===65&&(o.type=1);else{const r=c[s.keyCode],i=r==null?void 0:r[s.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(s.keyCode>=65&&s.keyCode<=90){const n=s.ctrlKey?s.keyCode-64:s.keyCode+32;let _=String.fromCharCode(n);s.shiftKey&&(_=_.toUpperCase()),o.key=h.C0.ESC+_}else if(s.keyCode===32)o.key=h.C0.ESC+(s.ctrlKey?h.C0.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let n=s.code.slice(3,4);s.shiftKey||(n=n.toLowerCase()),o.key=h.C0.ESC+n,o.cancel=!0}}else s.keyCode>=65&&s.keyCode<=90?o.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?o.key=h.C0.NUL:s.keyCode>=51&&s.keyCode<=55?o.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?o.key=h.C0.DEL:s.keyCode===219?o.key=h.C0.ESC:s.keyCode===220?o.key=h.C0.FS:s.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(R,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,c=a.length){let s="";for(let u=h;u<c;++u){let d=a[u];d>65535?(d-=65536,s+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):s+=String.fromCharCode(d)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const c=a.length;if(!c)return 0;let s=0,u=0;if(this._interim){const d=a.charCodeAt(u++);56320<=d&&d<=57343?h[s++]=1024*(this._interim-55296)+d-56320+65536:(h[s++]=this._interim,h[s++]=d),this._interim=0}for(let d=u;d<c;++d){const v=a.charCodeAt(d);if(55296<=v&&v<=56319){if(++d>=c)return this._interim=v,s;const o=a.charCodeAt(d);56320<=o&&o<=57343?h[s++]=1024*(v-55296)+o-56320+65536:(h[s++]=v,h[s++]=o)}else v!==65279&&(h[s++]=v)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const c=a.length;if(!c)return 0;let s,u,d,v,o=0,e=0,r=0;if(this.interim[0]){let _=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let l,p=0;for(;(l=63&this.interim[++p])&&p<4;)g<<=6,g|=l;const f=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=f-p;for(;r<m;){if(r>=c)return 0;if(l=a[r++],(192&l)!=128){r--,_=!0;break}this.interim[p++]=l,g<<=6,g|=63&l}_||(f===2?g<128?r--:h[o++]=g:f===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=c-4;let n=r;for(;n<c;){for(;!(!(n<i)||128&(s=a[n])||128&(u=a[n+1])||128&(d=a[n+2])||128&(v=a[n+3]));)h[o++]=s,h[o++]=u,h[o++]=d,h[o++]=v,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=c)return this.interim[0]=s,o;if(u=a[n++],(192&u)!=128){n--;continue}if(e=(31&s)<<6|63&u,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=c)return this.interim[0]=s,o;if(u=a[n++],(192&u)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=u,o;if(d=a[n++],(192&d)!=128){n--;continue}if(e=(15&s)<<12|(63&u)<<6|63&d,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=c)return this.interim[0]=s,o;if(u=a[n++],(192&u)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=u,o;if(d=a[n++],(192&d)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=u,this.interim[2]=d,o;if(v=a[n++],(192&v)!=128){n--;continue}if(e=(7&s)<<18|(63&u)<<12|(63&d)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),c=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let u;t.UnicodeV6=class{constructor(){if(this.version="6",!u){u=new Uint8Array(65536),u.fill(1),u[0]=0,u.fill(0,1,32),u.fill(0,127,160),u.fill(2,4352,4448),u[9001]=2,u[9002]=2,u.fill(2,11904,42192),u[12351]=1,u.fill(2,44032,55204),u.fill(2,63744,64256),u.fill(2,65040,65050),u.fill(2,65072,65136),u.fill(2,65280,65377),u.fill(2,65504,65511);for(let d=0;d<c.length;++d)u.fill(0,c[d][0],c[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?u[d]:(function(v,o){let e,r=0,i=o.length-1;if(v<o[0][0]||v>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,v>o[e][1])r=e+1;else{if(!(v<o[e][0]))return!0;i=e-1}return!1})(d,s)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,v){let o=this.wcwidth(d),e=o===0&&v!==0;if(e){const r=h.UnicodeService.extractWidth(v);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),c=a(844);class s extends c.Disposable{constructor(d){super(),this._action=d,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(d,v){if(v!==void 0&&this._syncCalls>v)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let 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(d,v){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(v),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(v)}_innerWrite(d=0,v=!0){const o=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],r=this._action(e,v);if(r){const n=_=>Date.now()-o>=12?setTimeout((()=>this._innerWrite(0,_))):this._innerWrite(o,_);return void r.catch((_=>(queueMicrotask((()=>{throw _})),Promise.resolve(!1)))).then(n)}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=s},5941:(R,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 c(s,u){const d=s.toString(16),v=d.length<2?"0"+d:d;switch(u){case 4:return d[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}t.parseColor=function(s){if(!s)return;let u=s.toLowerCase();if(u.indexOf("rgb:")===0){u=u.slice(4);const d=a.exec(u);if(d){const v=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/v*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/v*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/v*255)]}}else if(u.indexOf("#")===0&&(u=u.slice(1),h.exec(u)&&[3,6,9,12].includes(u.length))){const d=u.length/3,v=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(u.slice(d*o,d*o+d),16);v[o]=d===1?e<<4:d===2?e:d===3?e>>4:e>>8}return v}},t.toRgbString=function(s,u=16){const[d,v,o]=s;return`rgb:${c(d,u)}/${c(v,u)}/${c(o,u)}`}},5770:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),c=a(8742),s=a(5770),u=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=u,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}registerHandler(v,o){this._handlers[v]===void 0&&(this._handlers[v]=[]);const e=this._handlers[v];return e.push(o),{dispose:()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=u,this._ident=0}hook(v,o){if(this.reset(),this._ident=v,this._active=this._handlers[v]||u,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(v,o,e){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(v,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(v,o,e))}unhook(v,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(v),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",v);this._active=u,this._ident=0}};const d=new c.Params;d.addParam(0),t.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=d,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():d,this._data="",this._hitLimit=!1}put(v,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,o,e),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let o=!1;if(this._hitLimit)o=!1;else if(v&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then((e=>(this._params=d,this._data="",this._hitLimit=!1,e)));return this._params=d,this._data="",this._hitLimit=!1,o}}},2015:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=a(844),c=a(8742),s=a(6242),u=a(6351);class d{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,n,_){this.table[i<<8|r]=n<<4|_}addMany(r,i,n,_){for(let g=0;g<r.length;g++)this.table[i<<8|r[g]]=n<<4|_}}t.TransitionTable=d;const v=160;t.VT500_TRANSITION_TABLE=(function(){const e=new d(4095),r=Array.apply(null,Array(256)).map(((p,f)=>f)),i=(p,f)=>r.slice(p,f),n=i(32,127),_=i(0,24);_.push(25),_.push.apply(_,i(28,32));const g=i(0,14);let l;for(l in e.setDefault(1,0),e.addMany(n,0,2,0),g)e.addMany([24,26,153,154],l,3,0),e.addMany(i(128,144),l,3,0),e.addMany(i(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(_,0,3,0),e.addMany(_,1,3,1),e.add(127,1,0,1),e.addMany(_,8,0,8),e.addMany(_,3,3,3),e.add(127,3,0,3),e.addMany(_,4,3,4),e.add(127,4,0,4),e.addMany(_,6,3,6),e.addMany(_,5,3,5),e.add(127,5,0,5),e.addMany(_,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,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(n,7,0,7),e.addMany(_,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(_,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(_,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(_,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(_,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(_,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(v,0,2,0),e.add(v,8,5,8),e.add(v,6,0,6),e.add(v,11,0,11),e.add(v,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 c.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,_)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new s.OscParser),this._dcsParser=this.register(new u.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(r,i=[64,126]){let n=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=r.prefix.charCodeAt(0),n&&60>n||n>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 l=r.intermediates.charCodeAt(g);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=l}}if(r.final.length!==1)throw new Error("final must be a single byte");const _=r.final.charCodeAt(0);if(i[0]>_||_>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=_,n}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 n=this._identifier(r,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);const _=this._escHandlers[n];return _.push(i),{dispose:()=>{const g=_.indexOf(i);g!==-1&&_.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 n=this._identifier(r);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);const _=this._csiHandlers[n];return _.push(i),{dispose:()=>{const g=_.indexOf(i);g!==-1&&_.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,n,_,g){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=_,this._parseStack.chunkPos=g}parse(r,i,n){let _,g=0,l=0,p=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,p=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const f=this._parseStack.handlers;let m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&m>-1){for(;m>=0&&(_=f[m](this._params),_!==!0);m--)if(_ instanceof Promise)return this._parseStack.handlerPos=m,_}this._parseStack.handlers=[];break;case 4:if(n===!1&&m>-1){for(;m>=0&&(_=f[m](),_!==!0);m--)if(_ instanceof Promise)return this._parseStack.handlerPos=m,_}this._parseStack.handlers=[];break;case 6:if(g=r[this._parseStack.chunkPos],_=this._dcsParser.unhook(g!==24&&g!==26,n),_)return _;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],_=this._oscParser.end(g!==24&&g!==26,n),_)return _;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,p=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let f=p;f<i;++f){switch(g=r[f],l=this._transitions.table[this.currentState<<8|(g<160?g:v)],l>>4){case 2:for(let w=f+1;;++w){if(w>=i||(g=r[w])<32||g>126&&g<v){this._printHandler(r,f,w),f=w-1;break}if(++w>=i||(g=r[w])<32||g>126&&g<v){this._printHandler(r,f,w),f=w-1;break}if(++w>=i||(g=r[w])<32||g>126&&g<v){this._printHandler(r,f,w),f=w-1;break}if(++w>=i||(g=r[w])<32||g>126&&g<v){this._printHandler(r,f,w),f=w-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:f,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const m=this._csiHandlers[this._collect<<8|g];let S=m?m.length-1:-1;for(;S>=0&&(_=m[S](this._params),_!==!0);S--)if(_ instanceof Promise)return this._preserveStack(3,m,S,l,f),_;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(++f<i&&(g=r[f])>47&&g<60);f--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const y=this._escHandlers[this._collect<<8|g];let b=y?y.length-1:-1;for(;b>=0&&(_=y[b](),_!==!0);b--)if(_ instanceof Promise)return this._preserveStack(4,y,b,l,f),_;b<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 w=f+1;;++w)if(w>=i||(g=r[w])===24||g===26||g===27||g>127&&g<v){this._dcsParser.put(r,f,w),f=w-1;break}break;case 14:if(_=this._dcsParser.unhook(g!==24&&g!==26),_)return this._preserveStack(6,[],0,l,f),_;g===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let w=f+1;;w++)if(w>=i||(g=r[w])<32||g>127&&g<v){this._oscParser.put(r,f,w),f=w-1;break}break;case 6:if(_=this._oscParser.end(g!==24&&g!==26),_)return this._preserveStack(5,[],0,l,f),_;g===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&l}}}t.EscapeSequenceParser=o},6242:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),c=a(482),s=[];t.OscParser=class{constructor(){this._state=0,this._active=s,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(u,d){this._handlers[u]===void 0&&(this._handlers[u]=[]);const v=this._handlers[u];return v.push(d),{dispose:()=>{const o=v.indexOf(d);o!==-1&&v.splice(o,1)}}}clearHandler(u){this._handlers[u]&&delete this._handlers[u]}setHandlerFallback(u){this._handlerFb=u}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=s}reset(){if(this._state===2)for(let u=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;u>=0;--u)this._active[u].end(!1);this._stack.paused=!1,this._active=s,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||s,this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].start();else this._handlerFb(this._id,"START")}_put(u,d,v){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(u,d,v);else this._handlerFb(this._id,"PUT",(0,c.utf32ToString)(u,d,v))}start(){this.reset(),this._state=1}put(u,d,v){if(this._state!==3){if(this._state===1)for(;d<v;){const o=u[d++];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&&v-d>0&&this._put(u,d,v)}}end(u,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,v=d,e=this._stack.fallThrough,this._stack.paused=!1),!e&&v===!1){for(;o>=0&&(v=this._active[o].end(u),v!==!0);o--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,v;o--}for(;o>=0;o--)if(v=this._active[o].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,v}else this._handlerFb(this._id,"END",u);this._active=s,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(u){this._handler=u,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(u,d,v){this._hitLimit||(this._data+=(0,c.utf32ToString)(u,d,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(u){let d=!1;if(this._hitLimit)d=!1;else if(u&&(d=this._handler(this._data),d instanceof Promise))return d.then((v=>(this._data="",this._hitLimit=!1,v)));return this._data="",this._hitLimit=!1,d}}},8742:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(s){const u=new h;if(!s.length)return u;for(let d=Array.isArray(s[0])?1:0;d<s.length;++d){const v=s[d];if(Array.isArray(v))for(let o=0;o<v.length;++o)u.addSubParam(v[o]);else u.addParam(v)}return u}constructor(s=32,u=32){if(this.maxLength=s,this.maxSubParamsLength=u,u>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(u),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const s=new h(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){const s=[];for(let u=0;u<this.length;++u){s.push(this.params[u]);const d=this._subParamsIdx[u]>>8,v=255&this._subParamsIdx[u];v-d>0&&s.push(Array.prototype.slice.call(this._subParams,d,v))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>a?a:s}}addSubParam(s){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>a?a:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(255&this._subParamsIdx[s])-(this._subParamsIdx[s]>>8)>0}getSubParams(s){const u=this._subParamsIdx[s]>>8,d=255&this._subParamsIdx[s];return d-u>0?this._subParams.subarray(u,d):null}getSubParamsAll(){const s={};for(let u=0;u<this.length;++u){const d=this._subParamsIdx[u]>>8,v=255&this._subParamsIdx[u];v-d>0&&(s[u]=this._subParams.slice(d,v))}return s}addDigit(s){let u;if(this._rejectDigits||!(u=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const d=this._digitIsSub?this._subParams:this.params,v=d[u-1];d[u-1]=~v?Math.min(10*v+s,a):s}}t.Params=h},5741:(R,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 c={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(c),h.dispose=()=>this._wrappedAddonDispose(c),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let c=0;c<this._addons.length;c++)if(this._addons[c]===a){h=c;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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),c=a(511);t.BufferApiView=class{constructor(s,u){this._buffer=s,this.type=u}init(s){return this._buffer=s,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(s){const u=this._buffer.lines.get(s);if(u)return new h.BufferLineApiView(u)}getNullCell(){return new c.CellData}}},3785:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(c){this._line=c}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(c,s){if(!(c<0||c>=this._line.length))return s?(this._line.loadCell(c,s),s):this._line.loadCell(c,new h.CellData)}translateToString(c,s,u){return this._line.translateToString(c,s,u)}}},8285:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),c=a(8460),s=a(844);class u extends s.Disposable{constructor(v){super(),this._core=v,this._onBufferChange=this.register(new c.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=u},7975:(R,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,(c=>h(c.toArray())))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,((c,s)=>h(c,s.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:(R,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(R,t,a){var h=this&&this.__decorate||function(e,r,i,n){var _,g=arguments.length,l=g<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,r,i,n);else for(var p=e.length-1;p>=0;p--)(_=e[p])&&(l=(g<3?_(l):g>3?_(r,i,l):_(r,i))||l);return g>3&&l&&Object.defineProperty(r,i,l),l},c=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const s=a(8460),u=a(844),d=a(5295),v=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends u.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new d.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 n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=i.getBlankLine(e,r),this._cachedBlankLine=n),n.isWrapped=r;const _=i.ybase+i.scrollTop,g=i.ybase+i.scrollBottom;if(i.scrollTop===0){const l=i.lines.isFull;g===i.lines.length-1?l?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(g+1,0,n.clone()),l?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const l=g-_+1;i.lines.shiftElements(_+1,l-1,-1),i.lines.set(g,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,r,i){const n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const _=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),_!==n.ydisp&&(r||this._onScroll.fire(n.ydisp))}};t.BufferService=o=h([c(0,v.IOptionsService)],o)},7994:(R,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(R,t,a){var h=this&&this.__decorate||function(n,_,g,l){var p,f=arguments.length,m=f<3?_:l===null?l=Object.getOwnPropertyDescriptor(_,g):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,_,g,l);else for(var S=n.length-1;S>=0;S--)(p=n[S])&&(m=(f<3?p(m):f>3?p(_,g,m):p(_,g))||m);return f>3&&m&&Object.defineProperty(_,g,m),m},c=this&&this.__param||function(n,_){return function(g,l){_(g,l,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const s=a(2585),u=a(8460),d=a(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:n=>n.button!==4&&n.action===1&&(n.ctrl=!1,n.alt=!1,n.shift=!1,!0)},VT200:{events:19,restrict:n=>n.action!==32},DRAG:{events:23,restrict:n=>n.action!==32||n.button!==3},ANY:{events:31,restrict:n=>!0}};function o(n,_){let g=(n.ctrl?16:0)|(n.shift?4:0)|(n.alt?8:0);return n.button===4?(g|=64,g|=n.action):(g|=3&n.button,4&n.button&&(g|=64),8&n.button&&(g|=128),n.action===32?g|=32:n.action!==0||_||(g|=3)),g}const e=String.fromCharCode,r={DEFAULT:n=>{const _=[o(n,!1)+32,n.col+32,n.row+32];return _[0]>255||_[1]>255||_[2]>255?"":`\x1B[M${e(_[0])}${e(_[1])}${e(_[2])}`},SGR:n=>{const _=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.col};${n.row}${_}`},SGR_PIXELS:n=>{const _=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.x};${n.y}${_}`}};let i=t.CoreMouseService=class extends d.Disposable{constructor(n,_){super(),this._bufferService=n,this._coreService=_,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new u.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const g of Object.keys(v))this.addProtocol(g,v[g]);for(const g of Object.keys(r))this.addEncoding(g,r[g]);this.reset()}addProtocol(n,_){this._protocols[n]=_}addEncoding(n,_){this._encodings[n]=_}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(n){if(!this._protocols[n])throw new Error(`unknown protocol "${n}"`);this._activeProtocol=n,this._onProtocolChange.fire(this._protocols[n].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(n){if(!this._encodings[n])throw new Error(`unknown encoding "${n}"`);this._activeEncoding=n}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(n){if(n.col<0||n.col>=this._bufferService.cols||n.row<0||n.row>=this._bufferService.rows||n.button===4&&n.action===32||n.button===3&&n.action!==32||n.button!==4&&(n.action===2||n.action===3)||(n.col++,n.row++,n.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,n,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(n))return!1;const _=this._encodings[this._activeEncoding](n);return _&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(_):this._coreService.triggerDataEvent(_,!0)),this._lastEvent=n,!0}explainEvents(n){return{down:!!(1&n),up:!!(2&n),drag:!!(4&n),move:!!(8&n),wheel:!!(16&n)}}_equalEvents(n,_,g){if(g){if(n.x!==_.x||n.y!==_.y)return!1}else if(n.col!==_.col||n.row!==_.row)return!1;return n.button===_.button&&n.action===_.action&&n.ctrl===_.ctrl&&n.alt===_.alt&&n.shift===_.shift}};t.CoreMouseService=i=h([c(0,s.IBufferService),c(1,s.ICoreService)],i)},6975:function(R,t,a){var h=this&&this.__decorate||function(i,n,_,g){var l,p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,_,g);else for(var m=i.length-1;m>=0;m--)(l=i[m])&&(f=(p<3?l(f):p>3?l(n,_,f):l(n,_))||f);return p>3&&f&&Object.defineProperty(n,_,f),f},c=this&&this.__param||function(i,n){return function(_,g){n(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const s=a(1439),u=a(8460),d=a(844),v=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 d.Disposable{constructor(i,n,_){super(),this._bufferService=i,this._logService=n,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new u.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new u.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}reset(){this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}triggerDataEvent(i,n=!1){if(this._optionsService.rawOptions.disableStdin)return;const _=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&_.ybase!==_.ydisp&&this._onRequestScrollToBottom.fire(),n&&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((n=>n.charCodeAt(0))))),this._onBinary.fire(i))}};t.CoreService=r=h([c(0,v.IBufferService),c(1,v.ILogService),c(2,v.IOptionsService)],r)},9074:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),c=a(8460),s=a(844),u=a(6106);let d=0,v=0;class o extends s.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new u.SortedList((i=>i==null?void 0:i.marker.line)),this._onDecorationRegistered=this.register(new c.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new c.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,s.toDisposable)((()=>this.reset())))}registerDecoration(i){if(i.marker.isDisposed)return;const n=new e(i);if(n){const _=n.marker.onDispose((()=>n.dispose()));n.onDispose((()=>{n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),_.dispose())})),this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,n,_){let g=0,l=0;for(const p of this._decorations.getKeyIterator(n))g=p.options.x??0,l=g+(p.options.width??1),i>=g&&i<l&&(!_||(p.options.layer??"bottom")===_)&&(yield p)}forEachDecorationAtCell(i,n,_,g){this._decorations.forEachByKey(n,(l=>{d=l.options.x??0,v=d+(l.options.width??1),i>=d&&i<v&&(!_||(l.options.layer??"bottom")===_)&&g(l)}))}}t.DecorationService=o;class e extends s.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new c.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new c.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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),c=a(8343);class s{constructor(...d){this._entries=new Map;for(const[v,o]of d)this.set(v,o)}set(d,v){const o=this._entries.get(d);return this._entries.set(d,v),o}forEach(d){for(const[v,o]of this._entries.entries())d(v,o)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}t.ServiceCollection=s,t.InstantiationService=class{constructor(){this._services=new s,this._services.set(h.IInstantiationService,this)}setService(u,d){this._services.set(u,d)}getService(u){return this._services.get(u)}createInstance(u,...d){const v=(0,c.getServiceDependencies)(u).sort(((r,i)=>r.index-i.index)),o=[];for(const r of v){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${u.name} depends on UNKNOWN service ${r.id}.`);o.push(i)}const e=v.length>0?v[0].index:d.length;if(d.length!==e)throw new Error(`[createInstance] First service dependency of ${u.name} at position ${e+1} conflicts with ${d.length} static arguments`);return new u(...d,...o)}}},7866:function(R,t,a){var h=this&&this.__decorate||function(e,r,i,n){var _,g=arguments.length,l=g<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,r,i,n);else for(var p=e.length-1;p>=0;p--)(_=e[p])&&(l=(g<3?_(l):g>3?_(r,i,l):_(r,i))||l);return g>3&&l&&Object.defineProperty(r,i,l),l},c=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(844),u=a(2585),d={trace:u.LogLevelEnum.TRACE,debug:u.LogLevelEnum.DEBUG,info:u.LogLevelEnum.INFO,warn:u.LogLevelEnum.WARN,error:u.LogLevelEnum.ERROR,off:u.LogLevelEnum.OFF};let v,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=u.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),v=this}_updateLogLevel(){this._logLevel=d[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<=u.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<=u.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<=u.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<=u.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<=u.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([c(0,u.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(..._){if(v.logLevel!==u.LogLevelEnum.TRACE)return n.apply(this,_);v.trace(`GlyphRenderer#${n.name}(${_.map((l=>JSON.stringify(l))).join(", ")})`);const g=n.apply(this,_);return v.trace(`GlyphRenderer#${n.name} return`,g),g}}},7302:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),c=a(844),s=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:s.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const u=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends c.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,c.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=u.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=d},2660:function(R,t,a){var h=this&&this.__decorate||function(d,v,o,e){var r,i=arguments.length,n=i<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(d,v,o,e);else for(var _=d.length-1;_>=0;_--)(r=d[_])&&(n=(i<3?r(n):i>3?r(v,o,n):r(v,o))||n);return i>3&&n&&Object.defineProperty(v,o,n),n},c=this&&this.__param||function(d,v){return function(o,e){v(o,e,d)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const s=a(2585);let u=t.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){const v=this._bufferService.buffer;if(d.id===void 0){const _=v.addMarker(v.ybase+v.y),g={data:d,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(g,_))),this._dataByLinkId.set(g.id,g),g.id}const o=d,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,v.ybase+v.y),r.id;const i=v.addMarker(v.ybase+v.y),n={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose((()=>this._removeMarkerFromLink(n,i))),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(d,v){const o=this._dataByLinkId.get(d);if(o&&o.lines.every((e=>e.line!==v))){const e=this._bufferService.buffer.addMarker(v);o.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(o,e)))}}getLinkData(d){var v;return(v=this._dataByLinkId.get(d))==null?void 0:v.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,v){const o=d.lines.indexOf(v);o!==-1&&(d.lines.splice(o,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};t.OscLinkService=u=h([c(0,s.IBufferService)],u)},8343:(R,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(c){return c[h]||[]},t.createDecorator=function(c){if(t.serviceRegistry.has(c))return t.serviceRegistry.get(c);const s=function(u,d,v){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)})(s,u,v)};return s.toString=()=>c,t.serviceRegistry.set(c,s),s}},2585:(R,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 c;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"})(c||(t.LogLevelEnum=c={})),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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),c=a(225);class s{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,v,o=!1){return(16777215&d)<<3|(3&v)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const d=new c.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let v=0,o=0;const e=d.length;for(let r=0;r<e;++r){let i=d.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return v+this.wcwidth(i);const g=d.charCodeAt(r);56320<=g&&g<=57343?i=1024*(i-55296)+g-56320+65536:v+=this.wcwidth(g)}const n=this.charProperties(i,o);let _=s.extractWidth(n);s.extractShouldJoin(n)&&(_-=s.extractWidth(o)),v+=_,o=n}return v}charProperties(d,v){return this._activeProvider.charProperties(d,v)}}t.UnicodeService=s}},O={};function A(R){var t=O[R];if(t!==void 0)return t.exports;var a=O[R]={exports:{}};return P[R].call(a.exports,a,a.exports,A),a.exports}var W={};return(()=>{var R=W;Object.defineProperty(R,"__esModule",{value:!0}),R.Terminal=void 0;const t=A(9042),a=A(3236),h=A(844),c=A(5741),s=A(8285),u=A(7975),d=A(7090),v=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};const i=_=>this._core.options[_],n=(_,g)=>{this._checkReadonlyOptions(_),this._core.options[_]=g};for(const _ in this._core.options){const g={get:i.bind(this,_),set:n.bind(this,_)};Object.defineProperty(this._publicOptions,_,g)}}_checkReadonlyOptions(r){if(v.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 u.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new s.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,n){this._verifyIntegers(r,i,n),this._core.select(r,i,n)}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
|
|
11
|
+
`,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")}}R.Terminal=o})(),W})()))})(Ee)),Ee.exports}var et=Qe(),Le={exports:{}},Oe;function tt(){return Oe||(Oe=1,(function(M,B){(function(P,O){M.exports=O()})(self,(()=>(()=>{var P={};return(()=>{var O=P;Object.defineProperty(O,"__esModule",{value:!0}),O.FitAddon=void 0,O.FitAddon=class{activate(A){this._terminal=A}dispose(){}fit(){const A=this.proposeDimensions();if(!A||!this._terminal||isNaN(A.cols)||isNaN(A.rows))return;const W=this._terminal._core;this._terminal.rows===A.rows&&this._terminal.cols===A.cols||(W._renderService.clear(),this._terminal.resize(A.cols,A.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const A=this._terminal._core,W=A._renderService.dimensions;if(W.css.cell.width===0||W.css.cell.height===0)return;const R=this._terminal.options.scrollback===0?0:A.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),s=a-(parseInt(c.getPropertyValue("padding-top"))+parseInt(c.getPropertyValue("padding-bottom"))),u=h-(parseInt(c.getPropertyValue("padding-right"))+parseInt(c.getPropertyValue("padding-left")))-R;return{cols:Math.max(2,Math.floor(u/W.css.cell.width)),rows:Math.max(1,Math.floor(s/W.css.cell.height))}}}})(),P})()))})(Le)),Le.exports}var it=tt(),xe={exports:{}},Pe;function st(){return Pe||(Pe=1,(function(M,B){(function(P,O){M.exports=O()})(self,(()=>(()=>{var P={965:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),c=a(509),s=a(855),u=a(859),d=a(381),v=11,o=v*Float32Array.BYTES_PER_ELEMENT;let e,r=0,i=0,n=0;class _ extends u.Disposable{constructor(l,p,f,m){super(),this._terminal=l,this._gl=p,this._dimensions=f,this._optionsService=m,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const S=this._gl;c.TextureAtlas.maxAtlasPages===void 0&&(c.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),c.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,d.createProgram)(S,`#version 300 es
|
|
12
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
13
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
14
|
+
layout (location = 2) in vec2 a_offset;
|
|
15
|
+
layout (location = 3) in vec2 a_size;
|
|
16
|
+
layout (location = 4) in float a_texpage;
|
|
17
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
18
|
+
layout (location = 6) in vec2 a_texsize;
|
|
19
|
+
|
|
20
|
+
uniform mat4 u_projection;
|
|
21
|
+
uniform vec2 u_resolution;
|
|
22
|
+
|
|
23
|
+
out vec2 v_texcoord;
|
|
24
|
+
flat out int v_texpage;
|
|
25
|
+
|
|
26
|
+
void main() {
|
|
27
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
28
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
29
|
+
v_texpage = int(a_texpage);
|
|
30
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
31
|
+
}`,(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
|
|
32
|
+
precision lowp float;
|
|
33
|
+
|
|
34
|
+
in vec2 v_texcoord;
|
|
35
|
+
flat in int v_texpage;
|
|
36
|
+
|
|
37
|
+
uniform sampler2D u_texture[${$}];
|
|
38
|
+
|
|
39
|
+
out vec4 outColor;
|
|
40
|
+
|
|
41
|
+
void main() {
|
|
42
|
+
if (v_texpage == 0) {
|
|
43
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
44
|
+
} ${H}
|
|
45
|
+
}`})(c.TextureAtlas.maxAtlasPages))),this.register((0,u.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 y=new Float32Array([0,0,1,0,0,1,1,1]),b=S.createBuffer();this.register((0,u.toDisposable)((()=>S.deleteBuffer(b)))),S.bindBuffer(S.ARRAY_BUFFER,b),S.bufferData(S.ARRAY_BUFFER,y,S.STATIC_DRAW),S.enableVertexAttribArray(0),S.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const w=new Uint8Array([0,1,2,3]),x=S.createBuffer();this.register((0,u.toDisposable)((()=>S.deleteBuffer(x)))),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,x),S.bufferData(S.ELEMENT_ARRAY_BUFFER,w,S.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(S.createBuffer()),this.register((0,u.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(c.TextureAtlas.maxAtlasPages);for(let $=0;$<c.TextureAtlas.maxAtlasPages;$++)I[$]=$;S.uniform1iv(this._textureLocation,I),S.uniformMatrix4fv(this._projectionLocation,!1,d.PROJECTION_MATRIX),this._atlasTextures=[];for(let $=0;$<c.TextureAtlas.maxAtlasPages;$++){const H=new d.GLTexture((0,h.throwIfFalsy)(S.createTexture()));this.register((0,u.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(l,p,f,m,S,y,b,w,x){this._updateCell(this._vertices.attributes,l,p,f,m,S,y,b,w,x)}_updateCell(l,p,f,m,S,y,b,w,x,I){r=(f*this._terminal.cols+p)*v,m!==s.NULL_CELL_CODE&&m!==void 0?this._atlas&&(e=w&&w.length>1?this._atlas.getRasterizedGlyphCombinedChar(w,S,y,b,!1):this._atlas.getRasterizedGlyph(m,S,y,b,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),S!==I&&e.offset.x>i?(n=e.offset.x-i,l[r]=-(e.offset.x-n)+this._dimensions.device.char.left,l[r+1]=-e.offset.y+this._dimensions.device.char.top,l[r+2]=(e.size.x-n)/this._dimensions.device.canvas.width,l[r+3]=e.size.y/this._dimensions.device.canvas.height,l[r+4]=e.texturePage,l[r+5]=e.texturePositionClipSpace.x+n/this._atlas.pages[e.texturePage].canvas.width,l[r+6]=e.texturePositionClipSpace.y,l[r+7]=e.sizeClipSpace.x-n/this._atlas.pages[e.texturePage].canvas.width,l[r+8]=e.sizeClipSpace.y):(l[r]=-e.offset.x+this._dimensions.device.char.left,l[r+1]=-e.offset.y+this._dimensions.device.char.top,l[r+2]=e.size.x/this._dimensions.device.canvas.width,l[r+3]=e.size.y/this._dimensions.device.canvas.height,l[r+4]=e.texturePage,l[r+5]=e.texturePositionClipSpace.x,l[r+6]=e.texturePositionClipSpace.y,l[r+7]=e.sizeClipSpace.x,l[r+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(m,x,e.size.x,this._dimensions.device.cell.width)&&(l[r+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):l.fill(0,r,r+v-1-2)}clear(){const l=this._terminal,p=l.cols*l.rows*v;this._vertices.count!==p?this._vertices.attributes=new Float32Array(p):this._vertices.attributes.fill(0);let f=0;for(;f<this._vertices.attributesBuffers.length;f++)this._vertices.count!==p?this._vertices.attributesBuffers[f]=new Float32Array(p):this._vertices.attributesBuffers[f].fill(0);this._vertices.count=p,f=0;for(let m=0;m<l.rows;m++)for(let S=0;S<l.cols;S++)this._vertices.attributes[f+9]=S/l.cols,this._vertices.attributes[f+10]=m/l.rows,f+=v}handleResize(){const l=this._gl;l.useProgram(this._program),l.viewport(0,0,l.canvas.width,l.canvas.height),l.uniform2f(this._resolutionLocation,l.canvas.width,l.canvas.height),this.clear()}render(l){if(!this._atlas)return;const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const f=this._vertices.attributesBuffers[this._activeBuffer];let m=0;for(let S=0;S<l.lineLengths.length;S++){const y=S*this._terminal.cols*v,b=this._vertices.attributes.subarray(y,y+l.lineLengths[S]*v);f.set(b,m),m+=b.length}p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,f.subarray(0,m),p.STREAM_DRAW);for(let S=0;S<this._atlas.pages.length;S++)this._atlas.pages[S].version!==this._atlasTextures[S].version&&this._bindAtlasPageTexture(p,this._atlas,S);p.drawElementsInstanced(p.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,m/v)}setAtlas(l){this._atlas=l;for(const p of this._atlasTextures)p.version=-1}_bindAtlasPageTexture(l,p,f){l.activeTexture(l.TEXTURE0+f),l.bindTexture(l.TEXTURE_2D,this._atlasTextures[f].texture),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,p.pages[f].canvas),l.generateMipmap(l.TEXTURE_2D),this._atlasTextures[f].version=p.pages[f].version}setDimensions(l){this._dimensions=l}}t.GlyphRenderer=_},742:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=a(374),c=a(859),s=a(310),u=a(381),d=8*Float32Array.BYTES_PER_ELEMENT;class v{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,r=0,i=0,n=0,_=0,g=0;class l extends c.Disposable{constructor(f,m,S,y){super(),this._terminal=f,this._gl=m,this._dimensions=S,this._themeService=y,this._vertices=new v,this._verticesCursor=new v;const b=this._gl;this._program=(0,h.throwIfFalsy)((0,u.createProgram)(b,`#version 300 es
|
|
46
|
+
layout (location = 0) in vec2 a_position;
|
|
47
|
+
layout (location = 1) in vec2 a_size;
|
|
48
|
+
layout (location = 2) in vec4 a_color;
|
|
49
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
50
|
+
|
|
51
|
+
uniform mat4 u_projection;
|
|
52
|
+
|
|
53
|
+
out vec4 v_color;
|
|
54
|
+
|
|
55
|
+
void main() {
|
|
56
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
57
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
58
|
+
v_color = a_color;
|
|
59
|
+
}`,`#version 300 es
|
|
60
|
+
precision lowp float;
|
|
61
|
+
|
|
62
|
+
in vec4 v_color;
|
|
63
|
+
|
|
64
|
+
out vec4 outColor;
|
|
65
|
+
|
|
66
|
+
void main() {
|
|
67
|
+
outColor = v_color;
|
|
68
|
+
}`)),this.register((0,c.toDisposable)((()=>b.deleteProgram(this._program)))),this._projectionLocation=(0,h.throwIfFalsy)(b.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=b.createVertexArray(),b.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),x=b.createBuffer();this.register((0,c.toDisposable)((()=>b.deleteBuffer(x)))),b.bindBuffer(b.ARRAY_BUFFER,x),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const I=new Uint8Array([0,1,2,3]),$=b.createBuffer();this.register((0,c.toDisposable)((()=>b.deleteBuffer($)))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,$),b.bufferData(b.ELEMENT_ARRAY_BUFFER,I,b.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(b.createBuffer()),this.register((0,c.toDisposable)((()=>b.deleteBuffer(this._attributesBuffer)))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,d,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,d,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,d,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(y.colors),this.register(this._themeService.onChangeColors((H=>{this._updateCachedColors(H),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(f){const m=this._gl;m.useProgram(this._program),m.bindVertexArray(this._vertexArrayObject),m.uniformMatrix4fv(this._projectionLocation,!1,u.PROJECTION_MATRIX),m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.bufferData(m.ARRAY_BUFFER,f.attributes,m.DYNAMIC_DRAW),m.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,m.UNSIGNED_BYTE,0,f.count)}handleResize(){this._updateViewportRectangle()}setDimensions(f){this._dimensions=f}_updateCachedColors(f){this._bgFloat=this._colorToFloat32Array(f.background),this._cursorFloat=this._colorToFloat32Array(f.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(f){const m=this._terminal,S=this._vertices;let y,b,w,x,I,$,H,F,C,L,D,T=1;for(y=0;y<m.rows;y++){for(w=-1,x=0,I=0,$=!1,b=0;b<m.cols;b++)H=(y*m.cols+b)*s.RENDER_MODEL_INDICIES_PER_CELL,F=f.cells[H+s.RENDER_MODEL_BG_OFFSET],C=f.cells[H+s.RENDER_MODEL_FG_OFFSET],L=!!(67108864&C),(F!==x||C!==I&&($||L))&&((x!==0||$&&I!==0)&&(D=8*T++,this._updateRectangle(S,D,I,x,w,b,y)),w=b,x=F,I=C,$=L);(x!==0||$&&I!==0)&&(D=8*T++,this._updateRectangle(S,D,I,x,w,m.cols,y))}S.count=T}updateCursor(f){const m=this._verticesCursor,S=f.cursor;if(!S||S.style==="block")return void(m.count=0);let y,b=0;S.style!=="bar"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(m.attributes,y,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"||(y=8*b++,this._addRectangleFloat(m.attributes,y,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"&&(y=8*b++,this._addRectangleFloat(m.attributes,y,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),y=8*b++,this._addRectangleFloat(m.attributes,y,(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)),m.count=b}_updateRectangle(f,m,S,y,b,w,x){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&y){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&y].rgba;break;case 50331648:o=(16777215&y)<<8;break;default:o=this._themeService.colors.background.rgba}f.attributes.length<m+4&&(f.attributes=(0,u.expandFloat32Array)(f.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,r=x*this._dimensions.device.cell.height,i=(o>>24&255)/255,n=(o>>16&255)/255,_=(o>>8&255)/255,g=1,this._addRectangle(f.attributes,m,e,r,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,n,_,g)}_addRectangle(f,m,S,y,b,w,x,I,$,H){f[m]=S/this._dimensions.device.canvas.width,f[m+1]=y/this._dimensions.device.canvas.height,f[m+2]=b/this._dimensions.device.canvas.width,f[m+3]=w/this._dimensions.device.canvas.height,f[m+4]=x,f[m+5]=I,f[m+6]=$,f[m+7]=H}_addRectangleFloat(f,m,S,y,b,w,x){f[m]=S/this._dimensions.device.canvas.width,f[m+1]=y/this._dimensions.device.canvas.height,f[m+2]=b/this._dimensions.device.canvas.width,f[m+3]=w/this._dimensions.device.canvas.height,f[m+4]=x[0],f[m+5]=x[1],f[m+6]=x[2],f[m+7]=x[3]}_colorToFloat32Array(f){return new Float32Array([(f.rgba>>24&255)/255,(f.rgba>>16&255)/255,(f.rgba>>8&255)/255,(255&f.rgba)/255])}}t.RectangleRenderer=l},310:(R,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(c,s){const u=c*s*t.RENDER_MODEL_INDICIES_PER_CELL;u!==this.cells.length&&(this.cells=new Uint32Array(u),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),c=a(274),s=a(627),u=a(457),d=a(56),v=a(374),o=a(345),e=a(859),r=a(147),i=a(782),n=a(855),_=a(965),g=a(742),l=a(310),p=a(733);class f extends e.Disposable{constructor(b,w,x,I,$,H,F,C,L){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=x,this._coreBrowserService=I,this._coreService=$,this._decorationService=H,this._optionsService=F,this._themeService=C,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new l.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 c.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new p.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,F,this._themeService)],this.dimensions=(0,v.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(F.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const D={antialias:!1,depth:!1,preserveDrawingBuffer:L};if(this._gl=this._canvas.getContext("webgl2",D),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",(T=>{console.log("webglcontextlost event received"),T.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(T)}),3e3)}))),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",(T=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,d.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((T,U)=>this._setCanvasDevicePixelDimensions(T,U))),this.register(this._coreBrowserService.onWindowChange((T=>{this._observerDisposable.value=(0,d.observeDevicePixelDimensions)(this._canvas,T,((U,q)=>this._setCanvasDevicePixelDimensions(U,q)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)((()=>{var T;for(const U of this._renderLayers)U.dispose();(T=this._canvas.parentElement)==null||T.removeChild(this._canvas),(0,s.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var b;return(b=this._charAtlas)==null?void 0:b.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(b,w){var x,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`,(x=this._rectangleRenderer.value)==null||x.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 b;for(const w of this._renderLayers)w.handleBlur(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.pause(),this._requestRedrawViewport()}handleFocus(){var b;for(const w of this._renderLayers)w.handleFocus(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.resume(),this._requestRedrawViewport()}handleSelectionChanged(b,w,x){for(const I of this._renderLayers)I.handleSelectionChanged(this._terminal,b,w,x);this._model.selection.update(this._core,b,w,x),this._requestRedrawViewport()}handleCursorMove(){var b;for(const w of this._renderLayers)w.handleCursorMove(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.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 _.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var w;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,s.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),(w=this._glyphRenderer.value)==null||w.setAtlas(this._charAtlas)}_clearModel(b){var w;this._model.clear(),b&&((w=this._glyphRenderer.value)==null||w.clear())}clearTextureAtlas(){var b;(b=this._charAtlas)==null||b.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var b;this._clearModel(!0);for(const w of this._renderLayers)w.reset(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){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 x of this._renderLayers)x.handleGridChanged(this._terminal,b,w);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(b,w),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 u.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const x=this._core;let I,$,H,F,C,L,D,T,U,q,X,G,k,E,z=this._workCell;b=S(b,x.rows-1,0),w=S(w,x.rows-1,0);const N=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,K=N-x.buffer.ydisp,j=Math.min(this._terminal.buffer.active.cursorX,x.cols-1);let Z=-1;const Y=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let re=!1;for($=b;$<=w;$++)for(H=$+x.buffer.ydisp,F=x.buffer.lines.get(H),this._model.lineLengths[$]=0,C=this._characterJoinerService.getJoinedCharacters(H),k=0;k<x.cols;k++)if(I=this._cellColorResolver.result.bg,F.loadCell(k,z),k===0&&(I=this._cellColorResolver.result.bg),L=!1,D=k,C.length>0&&k===C[0][0]&&(L=!0,T=C.shift(),z=new m(z,F.translateToString(!0,T[0],T[1]),T[1]-T[0]),D=T[1]-1),U=z.getChars(),q=z.getCode(),G=($*x.cols+k)*l.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(z,k,H,this.dimensions.device.cell.width),Y&&H===N&&(k===j&&(this._model.cursor={x:j,y:K,width:z.getWidth(),style:this._coreBrowserService.isFocused?x.options.cursorStyle||"block":x.options.cursorInactiveStyle,cursorWidth:x.options.cursorWidth,dpr:this._devicePixelRatio},Z=j+z.getWidth()-1),k>=j&&k<=Z&&(this._coreBrowserService.isFocused&&(x.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&x.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),q!==n.NULL_CELL_CODE&&(this._model.lineLengths[$]=k+1),(this._model.cells[G]!==q||this._model.cells[G+l.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[G+l.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[G+l.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(re=!0,U.length>1&&(q|=l.COMBINED_CHAR_BIT_MASK),this._model.cells[G]=q,this._model.cells[G+l.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[G+l.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[G+l.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,X=z.getWidth(),this._glyphRenderer.value.updateCell(k,$,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,X,I),L))for(z=this._workCell,k++;k<D;k++)E=($*x.cols+k)*l.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(k,$,n.NULL_CELL_CODE,0,0,0,n.NULL_CELL_CHAR,0,0),this._model.cells[E]=n.NULL_CELL_CODE,this._model.cells[E+l.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[E+l.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[E+l.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;re&&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(b,w){this._canvas.width===b&&this._canvas.height===w||(this._canvas.width=b,this._canvas.height=w,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const b=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:b,end:b})}}t.WebglRenderer=f;class m extends r.AttributeData{constructor(b,w,x){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=x}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function S(y,b,w=0){return Math.max(Math.min(y,b),w)}t.JoinedCellData=m},381:(R,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 c(s,u,d){const v=(0,h.throwIfFalsy)(s.createShader(u));if(s.shaderSource(v,d),s.compileShader(v),s.getShaderParameter(v,s.COMPILE_STATUS))return v;console.error(s.getShaderInfoLog(v)),s.deleteShader(v)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,u,d){const v=(0,h.throwIfFalsy)(s.createProgram());if(s.attachShader(v,(0,h.throwIfFalsy)(c(s,s.VERTEX_SHADER,u))),s.attachShader(v,(0,h.throwIfFalsy)(c(s,s.FRAGMENT_SHADER,d))),s.linkProgram(v),s.getProgramParameter(v,s.LINK_STATUS))return v;console.error(s.getProgramInfoLog(v)),s.deleteProgram(v)},t.createShader=c,t.expandFloat32Array=function(s,u){const d=Math.min(2*s.length,u),v=new Float32Array(d);for(let o=0;o<s.length;o++)v[o]=s[o];return v},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),c=a(237),s=a(374),u=a(859);class d extends u.Disposable{constructor(o,e,r,i,n,_,g,l){super(),this._container=e,this._alpha=n,this._coreBrowserService=_,this._optionsService=g,this._themeService=l,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((p=>{this._refreshCharAtlas(o,p),this.reset(o)}))),this.register((0,u.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,s.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=c.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=d},733:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),c=a(237),s=a(592);class u extends s.BaseRenderLayer{constructor(v,o,e,r,i,n,_){super(e,v,"link",o,!0,i,n,_),this.register(r.onShowLinkUnderline((g=>this._handleShowLinkUnderline(g)))),this.register(r.onHideLinkUnderline((g=>this._handleHideLinkUnderline(g))))}resize(v,o){super.resize(v,o),this._state=void 0}reset(v){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const v=this._state.y2-this._state.y1-1;v>0&&this._clearCells(0,this._state.y1+1,this._state.cols,v),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(v){if(v.fg===c.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:v.fg!==void 0&&(0,h.is256Color)(v.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[v.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,v.y1===v.y2)this._fillBottomLineAtCells(v.x1,v.y1,v.x2-v.x1);else{this._fillBottomLineAtCells(v.x1,v.y1,v.cols-v.x1);for(let o=v.y1+1;o<v.y2;o++)this._fillBottomLineAtCells(0,o,v.cols);this._fillBottomLineAtCells(0,v.y2,v.x2)}this._state=v}_handleHideLinkUnderline(v){this._clearCurrentLink()}}t.LinkRenderLayer=u},820:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,c,s){a.addEventListener(h,c,s);let u=!1;return{dispose:()=>{u||(u=!0,a.removeEventListener(h,c,s))}}}},274:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),c=a(160),s=a(374);let u,d=0,v=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(n,_,g,l,p,f){this._terminal=n,this._optionService=_,this._selectionRenderModel=g,this._decorationService=l,this._coreBrowserService=p,this._themeService=f,this.result={fg:0,bg:0,ext:0}}resolve(n,_,g,l){if(this.result.bg=n.bg,this.result.fg=n.fg,this.result.ext=268435456&n.bg?n.extended.ext:0,v=0,d=0,e=!1,o=!1,r=!1,u=this._themeService.colors,i=0,n.getCode()!==h.NULL_CELL_CODE&&n.extended.underlineStyle===4){const p=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=_*l%(2*Math.round(p))}if(this._decorationService.forEachDecorationAtCell(_,g,"bottom",(p=>{p.backgroundColorRGB&&(v=p.backgroundColorRGB.rgba>>8&16777215,e=!0),p.foregroundColorRGB&&(d=p.foregroundColorRGB.rgba>>8&16777215,o=!0)})),r=this._selectionRenderModel.isCellSelected(this._terminal,_,g),r){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:v=(16777215&this.result.fg)<<8|255;break;default:v=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:v=(16777215&this.result.bg)<<8|255}v=c.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else v=(this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,u.selectionForeground&&(d=u.selectionForeground.rgba>>8&16777215,o=!0),(0,s.treatGlyphAsBackgroundColor)(n.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)d=(this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:d=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:d=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:d=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:d=(16777215&this.result.fg)<<8|255;break;default:d=this._themeService.colors.foreground.rgba}d=c.rgba.blend(d,4294967040&(this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(_,g,"top",(p=>{p.backgroundColorRGB&&(v=p.backgroundColorRGB.rgba>>8&16777215,e=!0),p.foregroundColorRGB&&(d=p.foregroundColorRGB.rgba>>8&16777215,o=!0)})),e&&(v=r?-16777216&n.bg&-134217729|v|50331648:-16777216&n.bg|v|50331648),o&&(d=-16777216&n.fg&-67108865|d|50331648),67108864&this.result.fg&&(e&&!o&&(d=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&u.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,o=!0),!e&&o&&(v=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&u.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,e=!0)),u=void 0,this.result.bg=e?v:this.result.bg,this.result.fg=o?d:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),c=a(197),s=[];t.acquireTextureAtlas=function(u,d,v,o,e,r,i,n){const _=(0,c.generateConfig)(o,e,r,i,d,v,n);for(let p=0;p<s.length;p++){const f=s[p],m=f.ownedBy.indexOf(u);if(m>=0){if((0,c.configEquals)(f.config,_))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),s.splice(p,1)):f.ownedBy.splice(m,1);break}}for(let p=0;p<s.length;p++){const f=s[p];if((0,c.configEquals)(f.config,_))return f.ownedBy.push(u),f.atlas}const g=u._core,l={atlas:new h.TextureAtlas(document,_,g.unicodeService),config:_,ownedBy:[u]};return s.push(l),l.atlas},t.removeTerminalFromCache=function(u){for(let d=0;d<s.length;d++){const v=s[d].ownedBy.indexOf(u);if(v!==-1){s[d].ownedBy.length===1?(s[d].atlas.dispose(),s.splice(d,1)):s[d].ownedBy.splice(v,1);break}}}},197:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(c,s,u,d,v,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:v.customGlyphs,devicePixelRatio:e,letterSpacing:v.letterSpacing,lineHeight:v.lineHeight,deviceCellWidth:c,deviceCellHeight:s,deviceCharWidth:u,deviceCharHeight:d,fontFamily:v.fontFamily,fontSize:v.fontSize,fontWeight:v.fontWeight,fontWeightBold:v.fontWeightBold,allowTransparency:v.allowTransparency,drawBoldTextInBrightColors:v.drawBoldTextInBrightColors,minimumContrastRatio:v.minimumContrastRatio,colors:r}},t.configEquals=function(c,s){for(let u=0;u<c.colors.ansi.length;u++)if(c.colors.ansi[u].rgba!==s.colors.ansi[u].rgba)return!1;return c.devicePixelRatio===s.devicePixelRatio&&c.customGlyphs===s.customGlyphs&&c.lineHeight===s.lineHeight&&c.letterSpacing===s.letterSpacing&&c.fontFamily===s.fontFamily&&c.fontSize===s.fontSize&&c.fontWeight===s.fontWeight&&c.fontWeightBold===s.fontWeightBold&&c.allowTransparency===s.allowTransparency&&c.deviceCharWidth===s.deviceCharWidth&&c.deviceCharHeight===s.deviceCharHeight&&c.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&c.minimumContrastRatio===s.minimumContrastRatio&&c.colors.foreground.rgba===s.colors.foreground.rgba&&c.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(c){return(50331648&c)==16777216||(50331648&c)==33554432}},237:(R,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:(R,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:(R,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 c={"░":[[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,n,_,g,l){const p=t.blockElementDefinitions[e];if(p)return(function(y,b,w,x,I,$){for(let H=0;H<b.length;H++){const F=b[H],C=I/8,L=$/8;y.fillRect(w+F.x*C,x+F.y*L,F.w*C,F.h*L)}})(o,p,r,i,n,_),!0;const f=c[e];if(f)return(function(y,b,w,x,I,$){let H=s.get(b);H||(H=new Map,s.set(b,H));const F=y.fillStyle;if(typeof F!="string")throw new Error(`Unexpected fillStyle type "${F}"`);let C=H.get(F);if(!C){const L=b[0].length,D=b.length,T=y.canvas.ownerDocument.createElement("canvas");T.width=L,T.height=D;const U=(0,h.throwIfFalsy)(T.getContext("2d")),q=new ImageData(L,D);let X,G,k,E;if(F.startsWith("#"))X=parseInt(F.slice(1,3),16),G=parseInt(F.slice(3,5),16),k=parseInt(F.slice(5,7),16),E=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`);[X,G,k,E]=F.substring(5,F.length-1).split(",").map((z=>parseFloat(z)))}for(let z=0;z<D;z++)for(let N=0;N<L;N++)q.data[4*(z*L+N)]=X,q.data[4*(z*L+N)+1]=G,q.data[4*(z*L+N)+2]=k,q.data[4*(z*L+N)+3]=b[z][N]*(255*E);U.putImageData(q,0,0),C=(0,h.throwIfFalsy)(y.createPattern(T,null)),H.set(F,C)}y.fillStyle=C,y.fillRect(w,x,I,$)})(o,f,r,i,n,_),!0;const m=t.boxDrawingDefinitions[e];if(m)return(function(y,b,w,x,I,$,H){y.strokeStyle=y.fillStyle;for(const[F,C]of Object.entries(b)){let L;y.beginPath(),y.lineWidth=H*Number.parseInt(F),L=typeof C=="function"?C(.15,.15/$*I):C;for(const D of L.split(" ")){const T=D[0],U=d[T];if(!U){console.error(`Could not find drawing instructions for "${T}"`);continue}const q=D.substring(1).split(",");q[0]&&q[1]&&U(y,v(q,I,$,w,x,!0,H))}y.stroke(),y.closePath()}})(o,m,r,i,n,_,l),!0;const S=t.powerlineDefinitions[e];return!!S&&((function(y,b,w,x,I,$,H,F){const C=new Path2D;C.rect(w,x,I,$),y.clip(C),y.beginPath();const L=H/12;y.lineWidth=F*L;for(const D of b.d.split(" ")){const T=D[0],U=d[T];if(!U){console.error(`Could not find drawing instructions for "${T}"`);continue}const q=D.substring(1).split(",");q[0]&&q[1]&&U(y,v(q,I,$,w,x,!1,F,(b.leftPadding??0)*(L/2),(b.rightPadding??0)*(L/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()})(o,S,r,i,n,_,g,l),!0)};const s=new Map;function u(o,e,r=0){return Math.max(Math.min(o,e),r)}const d={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 v(o,e,r,i,n,_,g,l=0,p=0){const f=o.map((m=>parseFloat(m)||parseInt(m)));if(f.length<2)throw new Error("Too few arguments for instruction");for(let m=0;m<f.length;m+=2)f[m]*=e-l*g-p*g,_&&f[m]!==0&&(f[m]=u(Math.round(f[m]+.5)-.5,e,0)),f[m]+=i+l*g;for(let m=1;m<f.length;m+=2)f[m]*=r,_&&f[m]!==0&&(f[m]=u(Math.round(f[m]+.5)-.5,r,0)),f[m]+=n;return f}},56:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(c,s,u){let d=new s.ResizeObserver((v=>{const o=v.find((i=>i.target===c));if(!o)return;if(!("devicePixelContentBoxSize"in o))return d==null||d.disconnect(),void(d=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&u(e,r)}));try{d.observe(c,{box:["device-pixel-content-box"]})}catch{d.disconnect(),d=void 0}return(0,h.toDisposable)((()=>d==null?void 0:d.disconnect()))}},374:(R,t)=>{function a(c){return 57508<=c&&c<=57558}function h(c){return c>=128512&&c<=128591||c>=127744&&c<=128511||c>=128640&&c<=128767||c>=9728&&c<=9983||c>=9984&&c<=10175||c>=65024&&c<=65039||c>=129280&&c<=129535||c>=127462&&c<=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(c){if(!c)throw new Error("value must not be falsy");return c},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},t.isEmoji=h,t.allowRescaling=function(c,s,u,d){return s===1&&u>Math.ceil(1.5*d)&&c!==void 0&&c>255&&!h(c)&&!a(c)&&!(function(v){return 57344<=v&&v<=63743})(c)},t.treatGlyphAsBackgroundColor=function(c){return a(c)||(function(s){return 9472<=s&&s<=9631})(c)},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(c,s,u=0){return(c-(2*Math.round(s)-u))%(2*Math.round(s))}},296:(R,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(c,s,u,d=!1){if(this.selectionStart=s,this.selectionEnd=u,!s||!u||s[0]===u[0]&&s[1]===u[1])return void this.clear();const v=c.buffers.active.ydisp,o=s[1]-v,e=u[1]-v,r=Math.max(o,0),i=Math.min(e,c.rows-1);r>=c.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=u[0])}isCellSelected(c,s,u){return!!this.hasSelection&&(u-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&u>=this.viewportCappedStartRow&&s<this.endCol&&u<=this.viewportCappedEndRow:s<this.startCol&&u>=this.viewportCappedStartRow&&s>=this.endCol&&u<=this.viewportCappedEndRow:u>this.viewportStartRow&&u<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),c=a(860),s=a(374),u=a(160),d=a(345),v=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 n;class _{get pages(){return this._pages}constructor(m,S,y){this._document=m,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new v.FourKeyMap,this._cacheMapCombined=new v.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 d.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new d.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=p(m,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,s.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const m of this.pages)m.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const m=new o.IdleTaskQueue;for(let S=33;S<126;S++)m.enqueue((()=>{if(!this._cacheMap.get(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const y=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,y)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const m of this._pages)m.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(_.maxAtlasPages&&this._pages.length>=Math.max(4,_.maxAtlasPages)){const S=this._pages.filter((H=>2*H.canvas.width<=(_.maxTextureSize||4096))).sort(((H,F)=>F.canvas.width!==H.canvas.width?F.canvas.width-H.canvas.width:F.percentageUsed-H.percentageUsed));let y=-1,b=0;for(let H=0;H<S.length;H++)if(S[H].canvas.width!==b)y=H,b=S[H].canvas.width;else if(H-y==3)break;const w=S.slice(y,y+4),x=w.map((H=>H.glyphs[0].texturePage)).sort(((H,F)=>H>F?1:-1)),I=this.pages.length-w.length,$=this._mergePages(w,I);$.version++;for(let H=x.length-1;H>=0;H--)this._deletePage(x[H]);this.pages.push($),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire($.canvas)}const m=new g(this._document,this._textureSize);return this._pages.push(m),this._activePages.push(m),this._onAddTextureAtlasCanvas.fire(m.canvas),m}_mergePages(m,S){const y=2*m[0].canvas.width,b=new g(this._document,y,m);for(const[w,x]of m.entries()){const I=w*x.canvas.width%y,$=Math.floor(w/2)*x.canvas.height;b.ctx.drawImage(x.canvas,I,$);for(const F of x.glyphs)F.texturePage=S,F.sizeClipSpace.x=F.size.x/y,F.sizeClipSpace.y=F.size.y/y,F.texturePosition.x+=I,F.texturePosition.y+=$,F.texturePositionClipSpace.x=F.texturePosition.x/y,F.texturePositionClipSpace.y=F.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(x.canvas);const H=this._activePages.indexOf(x);H!==-1&&this._activePages.splice(H,1)}return b}_deletePage(m){this._pages.splice(m,1);for(let S=m;S<this._pages.length;S++){const y=this._pages[S];for(const b of y.glyphs)b.texturePage--;y.version++}}getRasterizedGlyphCombinedChar(m,S,y,b,w){return this._getFromCacheMap(this._cacheMapCombined,m,S,y,b,w)}getRasterizedGlyph(m,S,y,b,w){return this._getFromCacheMap(this._cacheMap,m,S,y,b,w)}_getFromCacheMap(m,S,y,b,w,x=!1){return n=m.get(S,y,b,w),n||(n=this._drawToCache(S,y,b,w,x),m.set(S,y,b,w,n)),n}_getColorFromAnsiIndex(m){if(m>=this._config.colors.ansi.length)throw new Error("No color found for idx "+m);return this._config.colors.ansi[m]}_getBackgroundColor(m,S,y,b){if(this._config.allowTransparency)return u.NULL_COLOR;let w;switch(m){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const x=e.AttributeData.toColorRGB(S);w=u.channels.toColor(x[0],x[1],x[2]);break;default:w=y?u.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(m,S,y,b,w,x,I,$,H,F){const C=this._getMinimumContrastColor(m,S,y,b,w,x,I,H,$,F);if(C)return C;let L;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&H&&x<8&&(x+=8),L=this._getColorFromAnsiIndex(x);break;case 50331648:const D=e.AttributeData.toColorRGB(x);L=u.channels.toColor(D[0],D[1],D[2]);break;default:L=I?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(L=u.color.opaque(L)),$&&(L=u.color.multiplyOpacity(L,h.DIM_OPACITY)),L}_resolveBackgroundRgba(m,S,y){switch(m){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(m,S,y,b){switch(m){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&b&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(m,S,y,b,w,x,I,$,H,F){if(this._config.minimumContrastRatio===1||F)return;const C=this._getContrastCache(H),L=C.getColor(m,b);if(L!==void 0)return L||void 0;const D=this._resolveBackgroundRgba(S,y,I),T=this._resolveForegroundRgba(w,x,I,$),U=u.rgba.ensureContrastRatio(D,T,this._config.minimumContrastRatio/(H?2:1));if(!U)return void C.setColor(m,b,null);const q=u.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return C.setColor(m,b,q),q}_getContrastCache(m){return m?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(m,S,y,b,w=!1){const x=typeof m=="number"?String.fromCharCode(m):m,I=Math.min(this._config.deviceCellWidth*Math.max(x.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=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return i;const H=!!this._workAttributeData.isBold(),F=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),L=!!this._workAttributeData.isItalic(),D=!!this._workAttributeData.isUnderline(),T=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),X=this._workAttributeData.getFgColorMode(),G=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(F){const V=q;q=G,G=V;const ie=X;X=k,k=ie}const E=this._getBackgroundColor(k,G,F,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=E.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=L?"italic":"";this._tmpCtx.font=`${N} ${z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const K=x.length===1&&(0,s.isPowerlineGlyph)(x.charCodeAt(0)),j=x.length===1&&(0,s.isRestrictedPowerlineGlyph)(x.charCodeAt(0)),Z=this._getForegroundColor(S,k,G,y,X,q,F,C,H,(0,s.treatGlyphAsBackgroundColor)(x.charCodeAt(0)));this._tmpCtx.fillStyle=Z.css;const Y=j?0:4;let re=!1;this._config.customGlyphs!==!1&&(re=(0,c.tryDrawCustomChar)(this._tmpCtx,x,Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let he,J=!K;if(he=typeof m=="number"?this._unicodeService.wcwidth(m):this._unicodeService.getStringCellWidth(m),D){this._tmpCtx.save();const V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ie=V%2==1?.5:0;if(this._tmpCtx.lineWidth=V,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())J=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{J=!1;let ce=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ce<8&&(ce+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ce).css}this._tmpCtx.beginPath();const ae=Y,oe=Math.ceil(Y+this._config.deviceCharHeight)-ie-(w?2*V:0),_e=oe+V,le=oe+2*V;let de=this._workAttributeData.getUnderlineVariantOffset();for(let ce=0;ce<he;ce++){this._tmpCtx.save();const ne=ae+ce*this._config.deviceCellWidth,Q=ae+(ce+1)*this._config.deviceCellWidth,ve=ne+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe),this._tmpCtx.moveTo(ne,le),this._tmpCtx.lineTo(Q,le);break;case 3:const pe=V<=1?le:Math.ceil(Y+this._config.deviceCharHeight-V/2)-ie,me=V<=1?oe:Math.ceil(Y+this._config.deviceCharHeight+V/2)-ie,ke=new Path2D;ke.rect(ne,oe,this._config.deviceCellWidth,le-oe),this._tmpCtx.clip(ke),this._tmpCtx.moveTo(ne-this._config.deviceCellWidth/2,_e),this._tmpCtx.bezierCurveTo(ne-this._config.deviceCellWidth/2,me,ne,me,ne,_e),this._tmpCtx.bezierCurveTo(ne,pe,ve,pe,ve,_e),this._tmpCtx.bezierCurveTo(ve,me,Q,me,Q,_e),this._tmpCtx.bezierCurveTo(Q,pe,Q+this._config.deviceCellWidth/2,pe,Q+this._config.deviceCellWidth/2,_e);break;case 4:const Se=de===0?0:de>=V?2*V-de:V-de;de>=V||Se===0?(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ne+Se,oe),this._tmpCtx.lineTo(Q,oe)):(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(ne+Se,oe),this._tmpCtx.moveTo(ne+Se+V,oe),this._tmpCtx.lineTo(Q,oe)),de=(0,s.computeNextVariantOffset)(Q-ne,V,de);break;case 5:const ze=.6,qe=.3,we=Q-ne,Me=Math.floor(ze*we),Be=Math.floor(qe*we),je=we-Me-Be;this._tmpCtx.setLineDash([Me,Be,je]),this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe);break;default:this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!re&&this._config.fontSize>=12&&!this._config.allowTransparency&&x!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ce=this._tmpCtx.measureText(x);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ce&&ce.actualBoundingBoxDescent>0){this._tmpCtx.save();const ne=new Path2D;ne.rect(ae,oe-Math.ceil(V/2),this._config.deviceCellWidth*he,le-oe+Math.ceil(V/2)),this._tmpCtx.clip(ne),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(x,Y,Y+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ie=V%2==1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+ie),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*he,Y+ie),this._tmpCtx.stroke()}if(re||this._tmpCtx.fillText(x,Y,Y+this._config.deviceCharHeight),x==="_"&&!this._config.allowTransparency){let V=l(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),E,Z,J);if(V)for(let ie=1;ie<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(x,Y,Y+this._config.deviceCharHeight-ie),V=l(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),E,Z,J),V);ie++);}if(T){const V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),ie=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+Math.floor(this._config.deviceCharHeight/2)-ie),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*he,Y+Math.floor(this._config.deviceCharHeight/2)-ie),this._tmpCtx.stroke()}this._tmpCtx.restore();const ue=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let fe;if(fe=this._config.allowTransparency?(function(V){for(let ie=0;ie<V.data.length;ie+=4)if(V.data[ie+3]>0)return!1;return!0})(ue):l(ue,E,Z,J),fe)return i;const se=this._findGlyphBoundingBox(ue,this._workBoundingBox,I,j,re,Y);let ee,te;for(;;){if(this._activePages.length===0){const V=this._createNewPage();ee=V,te=V.currentRow,te.height=se.size.y;break}ee=this._activePages[this._activePages.length-1],te=ee.currentRow;for(const V of this._activePages)se.size.y<=V.currentRow.height&&(ee=V,te=V.currentRow);for(let V=this._activePages.length-1;V>=0;V--)for(const ie of this._activePages[V].fixedRows)ie.height<=te.height&&se.size.y<=ie.height&&(ee=this._activePages[V],te=ie);if(te.y+se.size.y>=ee.canvas.height||te.height>se.size.y+2){let V=!1;if(ee.currentRow.y+ee.currentRow.height+se.size.y>=ee.canvas.height){let ie;for(const ae of this._activePages)if(ae.currentRow.y+ae.currentRow.height+se.size.y<ae.canvas.height){ie=ae;break}if(ie)ee=ie;else if(_.maxAtlasPages&&this._pages.length>=_.maxAtlasPages&&te.y+se.size.y<=ee.canvas.height&&te.height>=se.size.y&&te.x+se.size.x<=ee.canvas.width)V=!0;else{const ae=this._createNewPage();ee=ae,te=ae.currentRow,te.height=se.size.y,V=!0}}V||(ee.currentRow.height>0&&ee.fixedRows.push(ee.currentRow),te={x:0,y:ee.currentRow.y+ee.currentRow.height,height:se.size.y},ee.fixedRows.push(te),ee.currentRow={x:0,y:te.y+te.height,height:0})}if(te.x+se.size.x<=ee.canvas.width)break;te===ee.currentRow?(te.x=0,te.y+=te.height,te.height=0):ee.fixedRows.splice(ee.fixedRows.indexOf(te),1)}return se.texturePage=this._pages.indexOf(ee),se.texturePosition.x=te.x,se.texturePosition.y=te.y,se.texturePositionClipSpace.x=te.x/ee.canvas.width,se.texturePositionClipSpace.y=te.y/ee.canvas.height,se.sizeClipSpace.x/=ee.canvas.width,se.sizeClipSpace.y/=ee.canvas.height,te.height=Math.max(te.height,se.size.y),te.x+=se.size.x,ee.ctx.putImageData(ue,se.texturePosition.x-this._workBoundingBox.left,se.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,se.size.x,se.size.y),ee.addGlyph(se),ee.version++,se}_findGlyphBoundingBox(m,S,y,b,w,x){S.top=0;const I=b?this._config.deviceCellHeight:this._tmpCanvas.height,$=b?this._config.deviceCellWidth:y;let H=!1;for(let F=0;F<I;F++){for(let C=0;C<$;C++){const L=F*this._tmpCanvas.width*4+4*C+3;if(m.data[L]!==0){S.top=F,H=!0;break}}if(H)break}S.left=0,H=!1;for(let F=0;F<x+$;F++){for(let C=0;C<I;C++){const L=C*this._tmpCanvas.width*4+4*F+3;if(m.data[L]!==0){S.left=F,H=!0;break}}if(H)break}S.right=$,H=!1;for(let F=x+$-1;F>=x;F--){for(let C=0;C<I;C++){const L=C*this._tmpCanvas.width*4+4*F+3;if(m.data[L]!==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 C=0;C<$;C++){const L=F*this._tmpCanvas.width*4+4*C+3;if(m.data[L]!==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+x+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+x+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=_;class g{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(m){this._glyphs.push(m),this._usedPixels+=m.size.x*m.size.y}constructor(m,S,y){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],y)for(const b of y)this._glyphs.push(...b.glyphs),this._usedPixels+=b._usedPixels;this.canvas=p(m,S,S),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function l(f,m,S,y){const b=m.rgba>>>24,w=m.rgba>>>16&255,x=m.rgba>>>8&255,I=S.rgba>>>24,$=S.rgba>>>16&255,H=S.rgba>>>8&255,F=Math.floor((Math.abs(b-I)+Math.abs(w-$)+Math.abs(x-H))/12);let C=!0;for(let L=0;L<f.data.length;L+=4)f.data[L]===b&&f.data[L+1]===w&&f.data[L+2]===x||y&&Math.abs(f.data[L]-b)+Math.abs(f.data[L+1]-w)+Math.abs(f.data[L+2]-x)<F?f.data[L+3]=0:C=!1;return C}function p(f,m,S){const y=f.createElement("canvas");return y.width=m,y.height=S,y}},160:(R,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,c=0,s=0;var u,d,v,o,e;function r(n){const _=n.toString(16);return _.length<2?"0"+_:_}function i(n,_){return n<_?(_+.05)/(n+.05):(n+.05)/(_+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(function(n){n.toCss=function(_,g,l,p){return p!==void 0?`#${r(_)}${r(g)}${r(l)}${r(p)}`:`#${r(_)}${r(g)}${r(l)}`},n.toRgba=function(_,g,l,p=255){return(_<<24|g<<16|l<<8|p)>>>0},n.toColor=function(_,g,l,p){return{css:n.toCss(_,g,l,p),rgba:n.toRgba(_,g,l,p)}}})(u||(t.channels=u={})),(function(n){function _(g,l){return s=Math.round(255*l),[a,h,c]=e.toChannels(g.rgba),{css:u.toCss(a,h,c,s),rgba:u.toRgba(a,h,c,s)}}n.blend=function(g,l){if(s=(255&l.rgba)/255,s===1)return{css:l.css,rgba:l.rgba};const p=l.rgba>>24&255,f=l.rgba>>16&255,m=l.rgba>>8&255,S=g.rgba>>24&255,y=g.rgba>>16&255,b=g.rgba>>8&255;return a=S+Math.round((p-S)*s),h=y+Math.round((f-y)*s),c=b+Math.round((m-b)*s),{css:u.toCss(a,h,c),rgba:u.toRgba(a,h,c)}},n.isOpaque=function(g){return(255&g.rgba)==255},n.ensureContrastRatio=function(g,l,p){const f=e.ensureContrastRatio(g.rgba,l.rgba,p);if(f)return u.toColor(f>>24&255,f>>16&255,f>>8&255)},n.opaque=function(g){const l=(255|g.rgba)>>>0;return[a,h,c]=e.toChannels(l),{css:u.toCss(a,h,c),rgba:l}},n.opacity=_,n.multiplyOpacity=function(g,l){return s=255&g.rgba,_(g,s*l/255)},n.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}})(d||(t.color=d={})),(function(n){let _,g;try{const l=document.createElement("canvas");l.width=1,l.height=1;const p=l.getContext("2d",{willReadFrequently:!0});p&&(_=p,_.globalCompositeOperation="copy",g=_.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return a=parseInt(l.slice(1,2).repeat(2),16),h=parseInt(l.slice(2,3).repeat(2),16),c=parseInt(l.slice(3,4).repeat(2),16),u.toColor(a,h,c);case 5:return a=parseInt(l.slice(1,2).repeat(2),16),h=parseInt(l.slice(2,3).repeat(2),16),c=parseInt(l.slice(3,4).repeat(2),16),s=parseInt(l.slice(4,5).repeat(2),16),u.toColor(a,h,c,s);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}const p=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(p)return a=parseInt(p[1]),h=parseInt(p[2]),c=parseInt(p[3]),s=Math.round(255*(p[5]===void 0?1:parseFloat(p[5]))),u.toColor(a,h,c,s);if(!_||!g)throw new Error("css.toColor: Unsupported css format");if(_.fillStyle=g,_.fillStyle=l,typeof _.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(_.fillRect(0,0,1,1),[a,h,c,s]=_.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:u.toRgba(a,h,c,s),css:l}}})(v||(t.css=v={})),(function(n){function _(g,l,p){const f=g/255,m=l/255,S=p/255;return .2126*(f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}n.relativeLuminance=function(g){return _(g>>16&255,g>>8&255,255&g)},n.relativeLuminance2=_})(o||(t.rgb=o={})),(function(n){function _(l,p,f){const m=l>>24&255,S=l>>16&255,y=l>>8&255;let b=p>>24&255,w=p>>16&255,x=p>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));for(;I<f&&(b>0||w>0||x>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),x-=Math.max(0,Math.ceil(.1*x)),I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));return(b<<24|w<<16|x<<8|255)>>>0}function g(l,p,f){const m=l>>24&255,S=l>>16&255,y=l>>8&255;let b=p>>24&255,w=p>>16&255,x=p>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));for(;I<f&&(b<255||w<255||x<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),x=Math.min(255,x+Math.ceil(.1*(255-x))),I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(m,S,y));return(b<<24|w<<16|x<<8|255)>>>0}n.blend=function(l,p){if(s=(255&p)/255,s===1)return p;const f=p>>24&255,m=p>>16&255,S=p>>8&255,y=l>>24&255,b=l>>16&255,w=l>>8&255;return a=y+Math.round((f-y)*s),h=b+Math.round((m-b)*s),c=w+Math.round((S-w)*s),u.toRgba(a,h,c)},n.ensureContrastRatio=function(l,p,f){const m=o.relativeLuminance(l>>8),S=o.relativeLuminance(p>>8);if(i(m,S)<f){if(S<m){const w=_(l,p,f),x=i(m,o.relativeLuminance(w>>8));if(x<f){const I=g(l,p,f);return x>i(m,o.relativeLuminance(I>>8))?w:I}return w}const y=g(l,p,f),b=i(m,o.relativeLuminance(y>>8));if(b<f){const w=_(l,p,f);return b>i(m,o.relativeLuminance(w>>8))?y:w}return y}},n.reduceLuminance=_,n.increaseLuminance=g,n.toChannels=function(l){return[l>>24&255,l>>16&255,l>>8&255,255&l]}})(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},345:(R,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 c=[];for(let s=0;s<this._listeners.length;s++)c.push(this._listeners[s]);for(let s=0;s<c.length;s++)c[s].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((c=>h.fire(c)))},t.runAndSubscribe=function(a,h){return h(void 0),a((c=>h(c)))}},859:(R,t)=>{function a(h){for(const c of h)c.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 c=this._disposables.indexOf(h);c!==-1&&this._disposables.splice(c,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var c;this._isDisposed||h===this._value||((c=this._value)==null||c.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:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(c,s,u){this._data[c]||(this._data[c]={}),this._data[c][s]=u}get(c,s){return this._data[c]?this._data[c][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,c,s,u,d){this._data.get(h,c)||this._data.set(h,c,new a),this._data.get(h,c).set(s,u,d)}get(h,c,s,u){var d;return(d=this._data.get(h,c))==null?void 0:d.get(s,u)}clear(){this._data.clear()}}},399:(R,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 c=a.match(/Version\/(\d+)/);return c===null||c.length<2?0:parseInt(c[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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class c{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(d){this._idleCallback=void 0;let v=0,o=0,e=d.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),r=d.timeRemaining(),1.5*o>r)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=r}this.clear()}}class s extends c{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){const v=Date.now()+d;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(u){return requestIdleCallback(u)}_cancelCallback(u){cancelIdleCallback(u)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(u){this._queue.clear(),this._queue.enqueue(u)}flush(){this._queue.flush()}}},147:(R,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(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,u=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=u}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),c=a(855),s=a(147);class u extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const o=new u;return o.setFromCharData(v),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(v){this.fg=v[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[c.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[c.CHAR_DATA_CHAR_INDEX].length===2){const e=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|v[c.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[c.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=u},855:(R,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:(R,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,c=a.length){let s="";for(let u=h;u<c;++u){let d=a[u];d>65535?(d-=65536,s+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):s+=String.fromCharCode(d)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const c=a.length;if(!c)return 0;let s=0,u=0;if(this._interim){const d=a.charCodeAt(u++);56320<=d&&d<=57343?h[s++]=1024*(this._interim-55296)+d-56320+65536:(h[s++]=this._interim,h[s++]=d),this._interim=0}for(let d=u;d<c;++d){const v=a.charCodeAt(d);if(55296<=v&&v<=56319){if(++d>=c)return this._interim=v,s;const o=a.charCodeAt(d);56320<=o&&o<=57343?h[s++]=1024*(v-55296)+o-56320+65536:(h[s++]=v,h[s++]=o)}else v!==65279&&(h[s++]=v)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const c=a.length;if(!c)return 0;let s,u,d,v,o=0,e=0,r=0;if(this.interim[0]){let _=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let l,p=0;for(;(l=63&this.interim[++p])&&p<4;)g<<=6,g|=l;const f=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=f-p;for(;r<m;){if(r>=c)return 0;if(l=a[r++],(192&l)!=128){r--,_=!0;break}this.interim[p++]=l,g<<=6,g|=63&l}_||(f===2?g<128?r--:h[o++]=g:f===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=c-4;let n=r;for(;n<c;){for(;!(!(n<i)||128&(s=a[n])||128&(u=a[n+1])||128&(d=a[n+2])||128&(v=a[n+3]));)h[o++]=s,h[o++]=u,h[o++]=d,h[o++]=v,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=c)return this.interim[0]=s,o;if(u=a[n++],(192&u)!=128){n--;continue}if(e=(31&s)<<6|63&u,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=c)return this.interim[0]=s,o;if(u=a[n++],(192&u)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=u,o;if(d=a[n++],(192&d)!=128){n--;continue}if(e=(15&s)<<12|(63&u)<<6|63&d,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=c)return this.interim[0]=s,o;if(u=a[n++],(192&u)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=u,o;if(d=a[n++],(192&d)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=u,this.interim[2]=d,o;if(v=a[n++],(192&v)!=128){n--;continue}if(e=(7&s)<<18|(63&u)<<12|(63&d)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(R,t,a){var h=this&&this.__decorate||function(e,r,i,n){var _,g=arguments.length,l=g<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,r,i,n);else for(var p=e.length-1;p>=0;p--)(_=e[p])&&(l=(g<3?_(l):g>3?_(r,i,l):_(r,i))||l);return g>3&&l&&Object.defineProperty(r,i,l),l},c=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(859),u=a(97),d={trace:u.LogLevelEnum.TRACE,debug:u.LogLevelEnum.DEBUG,info:u.LogLevelEnum.INFO,warn:u.LogLevelEnum.WARN,error:u.LogLevelEnum.ERROR,off:u.LogLevelEnum.OFF};let v,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=u.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),v=this}_updateLogLevel(){this._logLevel=d[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<=u.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<=u.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<=u.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<=u.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<=u.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([c(0,u.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(..._){if(v.logLevel!==u.LogLevelEnum.TRACE)return n.apply(this,_);v.trace(`GlyphRenderer#${n.name}(${_.map((l=>JSON.stringify(l))).join(", ")})`);const g=n.apply(this,_);return v.trace(`GlyphRenderer#${n.name} return`,g),g}}},726:(R,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(c){return c[h]||[]},t.createDecorator=function(c){if(t.serviceRegistry.has(c))return t.serviceRegistry.get(c);const s=function(u,d,v){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)})(s,u,v)};return s.toString=()=>c,t.serviceRegistry.set(c,s),s}},97:(R,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 c;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"})(c||(t.LogLevelEnum=c={})),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")}},O={};function A(R){var t=O[R];if(t!==void 0)return t.exports;var a=O[R]={exports:{}};return P[R].call(a.exports,a,a.exports,A),a.exports}var W={};return(()=>{var R=W;Object.defineProperty(R,"__esModule",{value:!0}),R.WebglAddon=void 0;const t=A(345),a=A(859),h=A(399),c=A(666),s=A(776);class u extends a.Disposable{constructor(v){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=v,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(v){const o=v._core;if(!v.element)return void this.register(o.onWillOpen((()=>this.activate(v))));this._terminal=v;const e=o.coreService,r=o.optionsService,i=o,n=i._renderService,_=i._characterJoinerService,g=i._charSizeService,l=i._coreBrowserService,p=i._decorationService,f=i._logService,m=i._themeService;(0,s.setTraceLogger)(f),this._renderer=this.register(new c.WebglRenderer(v,_,g,l,e,p,r,m,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)),n.setRenderer(this._renderer),this.register((0,a.toDisposable)((()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(v.cols,v.rows)})))}get textureAtlas(){var v;return(v=this._renderer)==null?void 0:v.textureAtlas}clearTextureAtlas(){var v;(v=this._renderer)==null||v.clearTextureAtlas()}}R.WebglAddon=u})(),W})()))})(xe)),xe.exports}var rt=st(),Re={exports:{}},Fe;function nt(){return Fe||(Fe=1,(function(M,B){(function(P,O){M.exports=O()})(self,(()=>(()=>{var P={6:(R,t)=>{function a(c){try{const s=new URL(c),u=s.password&&s.username?`${s.protocol}//${s.username}:${s.password}@${s.host}`:s.username?`${s.protocol}//${s.username}@${s.host}`:`${s.protocol}//${s.host}`;return c.toLocaleLowerCase().startsWith(u.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(c,s,u,d={}){this._terminal=c,this._regex=s,this._handler=u,this._options=d}provideLinks(c,s){const u=h.computeLink(c,this._regex,this._terminal,this._handler);s(this._addCallbacks(u))}_addCallbacks(c){return c.map((s=>(s.leave=this._options.leave,s.hover=(u,d)=>{if(this._options.hover){const{range:v}=s;this._options.hover(u,d,v)}},s)))}};class h{static computeLink(s,u,d,v){const o=new RegExp(u.source,(u.flags||"")+"g"),[e,r]=h._getWindowedLineStrings(s-1,d),i=e.join("");let n;const _=[];for(;n=o.exec(i);){const g=n[0];if(!a(g))continue;const[l,p]=h._mapStrIdx(d,r,0,n.index),[f,m]=h._mapStrIdx(d,l,p,g.length);if(l===-1||p===-1||f===-1||m===-1)continue;const S={start:{x:p+1,y:l+1},end:{x:m,y:f+1}};_.push({range:S,text:g,activate:v})}return _}static _getWindowedLineStrings(s,u){let d,v=s,o=s,e=0,r="";const i=[];if(d=u.buffer.active.getLine(s)){const n=d.translateToString(!0);if(d.isWrapped&&n[0]!==" "){for(e=0;(d=u.buffer.active.getLine(--v))&&e<2048&&(r=d.translateToString(!0),e+=r.length,i.push(r),d.isWrapped&&r.indexOf(" ")===-1););i.reverse()}for(i.push(n),e=0;(d=u.buffer.active.getLine(++o))&&d.isWrapped&&e<2048&&(r=d.translateToString(!0),e+=r.length,i.push(r),r.indexOf(" ")===-1););}return[i,v]}static _mapStrIdx(s,u,d,v){const o=s.buffer.active,e=o.getNullCell();let r=d;for(;v;){const i=o.getLine(u);if(!i)return[-1,-1];for(let n=r;n<i.length;++n){i.getCell(n,e);const _=e.getChars();if(e.getWidth()&&(v-=_.length||1,n===i.length-1&&_==="")){const g=o.getLine(u+1);g&&g.isWrapped&&(g.getCell(0,e),e.getWidth()===2&&(v+=1))}if(v<0)return[u,n]}u++,r=0}return[u,r]}}t.LinkComputer=h}},O={};function A(R){var t=O[R];if(t!==void 0)return t.exports;var a=O[R]={exports:{}};return P[R](a,a.exports,A),a.exports}var W={};return(()=>{var R=W;Object.defineProperty(R,"__esModule",{value:!0}),R.WebLinksAddon=void 0;const t=A(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function h(c,s){const u=window.open();if(u){try{u.opener=null}catch{}u.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}R.WebLinksAddon=class{constructor(c=h,s={}){this._handler=c,this._options=s}activate(c){this._terminal=c;const s=this._options,u=s.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,u,this._handler,s))}dispose(){var c;(c=this._linkProvider)==null||c.dispose()}}})(),W})()))})(Re)),Re.exports}var ot=nt();function at(M){M.setAttribute("inputmode","text"),M.setAttribute("enterkeyhint","send"),M.setAttribute("role","textbox"),M.setAttribute("aria-label","Terminal input"),M.setAttribute("aria-multiline","false"),M.removeAttribute("aria-hidden"),M.setAttribute("autocomplete","off"),M.setAttribute("autocorrect","off"),M.setAttribute("autocapitalize","none"),M.setAttribute("spellcheck","false"),M.setAttribute("writingsuggestions","false"),M.setAttribute("data-form-type","other"),M.setAttribute("data-lpignore","true"),M.setAttribute("data-1p-ignore","true"),M.setAttribute("data-bwignore","true"),M.setAttribute("data-protonpass-ignore","true"),M.setAttribute("data-dashlane-ignore","true")}function ge(M,B){return getComputedStyle(document.documentElement).getPropertyValue(M).trim()||B}function ht(M,B,P,O,A){const W=[],R=new Map;let t=null;function a(){return W.find(v=>v.id===t)??null}function h(){const v=new Set(W.map(e=>e.id));let o=1;for(;v.has(o);)o++;return o}function c(){const v=document.getElementById("tab-bar"),o=document.getElementById("shell-selector");if(!v||!o)return;v.querySelectorAll(".tab-btn").forEach(r=>r.remove()),W.forEach((r,i)=>{const n=document.createElement("button");n.className="tab-btn"+(r.id===t?" active":"");const _=document.createElement("span");if(_.className="tab-label",_.textContent=`${i+1}`,n.appendChild(_),W.length>1){const g=document.createElement("span");g.className="tab-close",g.textContent="×";const l=400;let p=null,f=!1;const m=y=>{y.preventDefault(),y.stopPropagation(),!f&&(g.classList.add("holding"),p=setTimeout(()=>{f=!0,g.classList.remove("holding"),g.classList.add("ready"),d.requestCloseTab(r.id).catch(console.error)},l))},S=()=>{p&&(clearTimeout(p),p=null),g.classList.remove("holding")};g.addEventListener("pointerdown",m),g.addEventListener("pointerup",S),g.addEventListener("pointercancel",S),g.addEventListener("pointerleave",S),g.addEventListener("click",y=>{y.stopPropagation()}),n.appendChild(g)}n.addEventListener("click",()=>d.switchToTab(r.id)),v.insertBefore(n,o)});const e=document.createElement("button");e.className="tab-btn tab-add",e.textContent="+",e.addEventListener("click",()=>{d.requestCreateTab().catch(console.error)}),v.insertBefore(e,o)}function s(v){var p;const o=h(),e=v.shell_id,r=document.createElement("div");r.id=`terminal-${o}`,r.className="terminal-instance",r.style.display="none",r.style.opacity="0",(p=document.getElementById("terminal"))==null||p.appendChild(r);const i=new et.Terminal({cursorBlink:!0,fontSize:10,fontFamily:"Menlo, Monaco, Consolas, monospace",theme:{background:ge("--bg-primary","#1e1e1e"),foreground:ge("--text-primary","#cccccc"),cursor:ge("--cursor-color","#aeafad"),cursorAccent:ge("--bg-primary","#1e1e1e"),selectionBackground:ge("--selection-bg","rgba(38, 79, 120, 0.5)"),black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#e5e5e5"},scrollback:5e3,convertEol:!0,allowProposedApi:!0,rightClickSelectsWord:!0,altClickMovesCursor:!1,smoothScrollDuration:0,scrollSensitivity:1,fastScrollSensitivity:5,allowTransparency:!1}),n=new it.FitAddon;i.loadAddon(n);const _=new ot.WebLinksAddon;i.loadAddon(_),i.open(r);const g=r.querySelector(".xterm-helper-textarea");g&&(at(g),/iPad|iPhone|iPod/.test(navigator.userAgent)&&g.addEventListener("beforeinput",f=>{f.inputType==="deleteContentBackward"&&(f.preventDefault(),P.sendInput(l,""))},{capture:!0}));try{const f=new rt.WebglAddon;f.onContextLoss(()=>f.dispose()),i.loadAddon(f)}catch{}const l={id:o,tabId:v.id,shellId:e,term:i,fitAddon:n,container:r,ws:null,sessionId:v.session_id,heartbeatInterval:null,reconnectAttempts:0};return i.onData(f=>{i.hasSelection()&&i.clearSelection();let m=f;if(f.length===1&&f.charCodeAt(0)>=32&&f.charCodeAt(0)<127){const S=O.ctrl==="sticky"||O.ctrl==="locked",y=O.alt==="sticky"||O.alt==="locked";if(S||y){let b=f;if(S){const w=b.toUpperCase().charCodeAt(0);w>=65&&w<=90&&(b=String.fromCharCode(w-64))}y&&(b="\x1B"+b),m=b}}P.sendInput(l,m),A.onInputSend(m)}),i.onSelectionChange(()=>{const f=i.getSelection();f&&f.length>0&&A.onSelectionCopy(f)}),i.onResize(()=>{A.scheduleResize(l)}),W.push(l),R.set(v.id,l),P.connect(l),M.emit("tab:created",{tab:l}),l}function u(v){const o=R.get(v);if(!o)return;const e=W.indexOf(o);if(e!==-1&&(P.disconnect(o),P.cleanupTabState(o.id),o.term.dispose(),o.container.remove(),W.splice(e,1),R.delete(v),M.emit("tab:closed",{tabId:o.id}),t===o.id&&W.length>0)){const r=W[Math.max(0,e-1)];r&&d.switchToTab(r.id)}}const d={get tabs(){return W},get activeTab(){return a()},get activeTabId(){return t},async requestCreateTab(v){const o=v??this.getDefaultShellId(),e=await B.createTab(o),r=s(e);return this.switchToTab(r.id),c(),r},async requestCloseTab(v){const o=W.find(e=>e.id===v);if(!o||!o.tabId)throw new Error("Tab not found or has no server ID");W.length===1&&await this.requestCreateTab(),P.disconnect(o),await B.closeTab(o.tabId),u(o.tabId),c()},switchToTab(v){const o=W.find(r=>r.id===v);if(!o)return;W.forEach(r=>{r.container.style.display="none"}),o.container.style.display="block",t=v;const e=document.getElementById("shell-select");e&&(e.value=o.shellId),o.term.focus(),requestAnimationFrame(()=>{o.fitAddon.fit(),o.container.style.opacity!=="0"&&o.term.scrollToBottom()}),c(),M.emit("tab:switched",{tabId:v,tab:o})},applyStateSync(v){const o=new Set(v.map(e=>e.id));for(const[e]of R)o.has(e)||u(e);for(const e of v)R.has(e.id)||s(e);if(W.length>0&&(t===null||!W.find(e=>e.id===t))){const e=W[0];e&&this.switchToTab(e.id)}c()},applyStateUpdate(v){for(const o of v)switch(o.action){case"add":o.tab&&!R.has(o.tab_id)&&s(o.tab);break;case"remove":R.has(o.tab_id)&&u(o.tab_id);break}W.length===0&&this.requestCreateTab().catch(console.error),c()},focusTerminal(){const v=a();v&&v.term.focus()},getDefaultShellId(){const v=document.getElementById("shell-select");return(v==null?void 0:v.value)??"default"}};return d}const Ne=[{key:"1",label:"1",sequence:"1"},{key:"2",label:"2",sequence:"2"},{key:"ArrowUp",label:"↑",sequence:"\x1B[A",className:"arrow"},{key:"3",label:"3",sequence:"3"},{key:"/",label:"/",sequence:"/"},{key:"Home",label:"Hm",sequence:"\x1B[H"},{key:"End",label:"Ed",sequence:"\x1B[F"},{key:"Delete",label:"Del",sequence:"\x1B[3~"},{key:"Enter",label:"↵",sequence:"\r",className:"icon enter"}],Te=[{key:"ShiftTab",label:"Sft⇥",sequence:"\x1B[Z"},{key:"Ctrl+B",label:"^B",sequence:"",className:"tmux"},{key:"Ctrl+C",label:"^C",sequence:"",className:"danger"},{key:"Tab",label:"⇥",sequence:" ",className:"icon"},{key:"ArrowLeft",label:"←",sequence:"\x1B[D",className:"arrow"},{key:"ArrowDown",label:"↓",sequence:"\x1B[B",className:"arrow"},{key:"ArrowRight",label:"→",sequence:"\x1B[C",className:"arrow"},{key:"\\Enter",label:"\\↵",sequence:"\\\r"}],ct=[{key:"Ctrl+A",label:"^A",sequence:""},{key:"Ctrl+D",label:"^D",sequence:""},{key:"Ctrl+E",label:"^E",sequence:""},{key:"Ctrl+L",label:"^L",sequence:"\f"},{key:"Ctrl+R",label:"^R",sequence:""},{key:"Ctrl+U",label:"^U",sequence:""},{key:"Ctrl+W",label:"^W",sequence:""},{key:"Ctrl+Z",label:"^Z",sequence:""}],lt=[{key:"Escape",label:"Esc",sequence:"\x1B"},{key:"Backspace",label:"⌫",sequence:""},{key:"Space",label:" ",sequence:" "}];function dt(){const M={};for(const B of[...Ne,...Te,...ct,...lt])M[B.key]=B.sequence;return M}function ut(M){const B={...dt(),...M};return{getSequence(P,O){if(B[P])return B[P];if(P.length===1){let A=P;if((O.shift==="sticky"||O.shift==="locked")&&(A=A.toUpperCase()),O.ctrl==="sticky"||O.ctrl==="locked"){const W=A.toUpperCase().charCodeAt(0);W>=65&&W<=90&&(A=String.fromCharCode(W-64))}return(O.alt==="sticky"||O.alt==="locked")&&(A="\x1B"+A),A}return null}}}const _t=300;function ft(M,B){const P={ctrl:"off",alt:"off",shift:"off"},O={ctrl:0,alt:0,shift:0};function A(W){M.emit("modifier:changed",{modifier:W,state:P[W]}),B==null||B(W)}return{get state(){return P},handleTap(W){const R=Date.now(),t=O[W];O[W]=R,R-t<_t?P[W]=P[W]==="locked"?"off":"locked":P[W]==="off"?P[W]="sticky":P[W]="off",A(W)},consumeSticky(){const W=["ctrl","alt","shift"];for(const R of W)P[R]==="sticky"&&(P[R]="off",A(R))},reset(){const W=["ctrl","alt","shift"];for(const R of W)P[R]!=="off"&&(P[R]="off",A(R))},getState(W){return P[W]}}}function vt(M,B,P,O){return{handleKeyButton(A){const W=B.getSequence(A,P.state);W&&(O.sendInput(W),O.focusTerminal()),P.consumeSticky()},sendInput(A){O.sendInput(A),M.emit("input:send",{data:A})}}}const gt={minDistance:25,maxTime:300,directionRatio:1.2};function pt(M={}){const{minDistance:B,maxTime:P,directionRatio:O}={...gt,...M};return{detect(A,W,R,t,a){if(a>P)return null;const h=R-A,c=t-W,s=Math.abs(h),u=Math.abs(c);return Math.hypot(h,c)<B?null:s>u*O?{direction:h>0?"down":"up"}:null}}}function mt(){return{touchToPosition(M,B,P){var c;const O=(c=M.element)==null?void 0:c.getBoundingClientRect();if(!O)return{col:0,row:0};const A=B-O.left,W=P-O.top,R=O.width/M.cols,t=O.height/M.rows,a=Math.floor(A/R),h=Math.floor(W/t);return{col:Math.max(0,Math.min(a,M.cols-1)),row:Math.max(0,Math.min(h,M.rows-1))}},startSelection(M,B,P){const O=P+Math.floor(M.buffer.active.viewportY);M.select(B,O,1)},extendSelection(M,B,P,O,A){const W=Math.floor(M.buffer.active.viewportY);let R,t,a;A===P?(R=Math.min(B,O),t=P,a=Math.abs(O-B)+1):A>P?(R=B,t=P,a=M.cols-B+(A-P-1)*M.cols+O+1):(R=O,t=A,a=M.cols-O+(P-A-1)*M.cols+B+1),M.select(R,t+W,a)},selectWordAt(M,B,P){const O=M.buffer.active.getLine(P);if(!O)return;let A=B,W=B;for(;A>0;){const t=O.getCell(A-1);if(!t||/\s/.test(t.getChars()))break;A--}for(;W<M.cols-1;){const t=O.getCell(W+1);if(!t||/\s/.test(t.getChars()))break;W++}const R=W-A+1;R>0&&M.select(A,P,R)},getSelection(M){return M.getSelection()},clearSelection(M){M.clearSelection()},hasSelection(M){return M.hasSelection()}}}const St=250,Ct=300,bt=30,Ce=20,wt=10,yt=24;function Et(M,B,P,O){const A={initialDistance:0,initialFontSize:14,isSelecting:!1,longPressTimer:null,startX:0,startY:0,startTime:0,fontSizeChanged:!1,lastTapTime:0,lastTapX:0,lastTapY:0,selectAnchorCol:0,selectAnchorRow:0,pointerId:null};let W=!1,R=null;const t={};function a(){A.longPressTimer&&(clearTimeout(A.longPressTimer),A.longPressTimer=null)}function h(c){if(A.pointerId){try{c.releasePointerCapture(A.pointerId)}catch{}A.pointerId=null}}return{attach(c){R=c,t.pointerdown=s=>{if(s.pointerType==="mouse")return;s.stopPropagation(),s.preventDefault(),W=!0,A.startX=s.clientX,A.startY=s.clientY,A.startTime=Date.now(),A.isSelecting=!1,A.pointerId=s.pointerId,a();const u=s.clientX,d=s.clientY;A.longPressTimer=setTimeout(()=>{const v=O.getActiveTerminal();if(v&&W){A.isSelecting=!0;try{c.setPointerCapture(s.pointerId)}catch{}const o=P.touchToPosition(v,u,d);A.selectAnchorCol=o.col,A.selectAnchorRow=o.row,P.startSelection(v,o.col,o.row)}},St)},t.pointermove=s=>{if(s.pointerType==="mouse"||!W)return;const u=Math.abs(s.clientX-A.startX),d=Math.abs(s.clientY-A.startY),v=Date.now()-A.startTime;if(!A.isSelecting&&(u>Ce||d>Ce)&&a(),!A.isSelecting&&v<300&&u>20&&u>d*1.2){s.preventDefault(),s.stopPropagation();return}if(A.isSelecting){s.preventDefault(),s.stopPropagation();const o=O.getActiveTerminal();if(o){const e=P.touchToPosition(o,s.clientX,s.clientY);P.extendSelection(o,A.selectAnchorCol,A.selectAnchorRow,e.col,e.row)}}},t.pointerup=s=>{if(s.pointerType==="mouse")return;h(c),s.stopPropagation(),a();const u=Math.abs(s.clientX-A.startX),d=Math.abs(s.clientY-A.startY),v=u<Ce&&d<Ce,o=Date.now(),e=o-A.startTime,r=A.isSelecting;A.isSelecting=!1;const i=O.getActiveTerminal();if(r&&i){const _=P.getSelection(i);_&&O.showCopyButton(_,s.clientX,s.clientY),setTimeout(()=>{W=!1},350);return}const n=B.detect(A.startX,A.startY,s.clientX,s.clientY,e);if(n){O.sendArrowKey(n.direction),M.emit("gesture:swipe",{direction:n.direction}),setTimeout(()=>{W=!1},350);return}if(v&&i){const _=Math.hypot(s.clientX-A.lastTapX,s.clientY-A.lastTapY);if(o-A.lastTapTime<Ct&&_<bt){const g=P.touchToPosition(i,s.clientX,s.clientY),l=g.row+Math.floor(i.buffer.active.viewportY);P.selectWordAt(i,g.col,l),A.lastTapTime=0;const p=P.getSelection(i);p&&O.showCopyButton(p,s.clientX,s.clientY)}else P.hasSelection(i)&&P.clearSelection(i),A.lastTapTime=o,A.lastTapX=s.clientX,A.lastTapY=s.clientY,O.focusTerminal()}setTimeout(()=>{W=!1},350)},t.pointercancel=s=>{s.pointerType!=="mouse"&&(h(c),a(),A.isSelecting=!1,W=!1)},t.touchstart=s=>{if(s.touches.length===2){s.preventDefault(),s.stopPropagation(),a(),A.isSelecting=!1;const u=s.touches[0],d=s.touches[1],v=u.clientX-d.clientX,o=u.clientY-d.clientY;A.initialDistance=Math.hypot(v,o);const e=O.getActiveTerminal();A.initialFontSize=(e==null?void 0:e.options.fontSize)??14}},t.touchmove=s=>{if(s.touches.length===2&&A.initialDistance>0){s.preventDefault();const u=s.touches[0],d=s.touches[1],v=u.clientX-d.clientX,o=u.clientY-d.clientY,r=Math.hypot(v,o)/A.initialDistance;let i=Math.round(A.initialFontSize*r);i=Math.max(wt,Math.min(yt,i));const n=O.getActiveTerminal();n&&i!==n.options.fontSize&&(n.options.fontSize=i,n.refresh(0,n.rows-1),A.fontSizeChanged=!0,M.emit("gesture:pinch",{scale:r}))}},t.touchend=()=>{A.fontSizeChanged&&(O.scheduleFitAfterFontChange(),A.fontSizeChanged=!1),A.initialDistance=0},t.mousedown=s=>{W&&(s.preventDefault(),s.stopPropagation())},t.mousemove=s=>{W&&(s.preventDefault(),s.stopPropagation())},t.mouseup=s=>{W&&(s.preventDefault(),s.stopPropagation())},c.addEventListener("pointerdown",t.pointerdown,{passive:!1,capture:!0}),c.addEventListener("pointermove",t.pointermove,{passive:!1,capture:!0}),c.addEventListener("pointerup",t.pointerup,{passive:!1,capture:!0}),c.addEventListener("pointercancel",t.pointercancel,{passive:!1,capture:!0}),c.addEventListener("touchstart",t.touchstart,{passive:!1,capture:!0}),c.addEventListener("touchmove",t.touchmove,{passive:!1,capture:!0}),c.addEventListener("touchend",t.touchend,{passive:!1,capture:!0}),c.addEventListener("mousedown",t.mousedown,{passive:!1,capture:!0}),c.addEventListener("mousemove",t.mousemove,{passive:!1,capture:!0}),c.addEventListener("mouseup",t.mouseup,{passive:!1,capture:!0})},detach(){R&&(t.pointerdown&&R.removeEventListener("pointerdown",t.pointerdown,{capture:!0}),t.pointermove&&R.removeEventListener("pointermove",t.pointermove,{capture:!0}),t.pointerup&&R.removeEventListener("pointerup",t.pointerup,{capture:!0}),t.pointercancel&&R.removeEventListener("pointercancel",t.pointercancel,{capture:!0}),t.touchstart&&R.removeEventListener("touchstart",t.touchstart,{capture:!0}),t.touchmove&&R.removeEventListener("touchmove",t.touchmove,{capture:!0}),t.touchend&&R.removeEventListener("touchend",t.touchend,{capture:!0}),t.mousedown&&R.removeEventListener("mousedown",t.mousedown,{capture:!0}),t.mousemove&&R.removeEventListener("mousemove",t.mousemove,{capture:!0}),t.mouseup&&R.removeEventListener("mouseup",t.mouseup,{capture:!0}),R=null)},isGestureActive(){return W}}}const Lt=300;function He(M){const B=document.createElement("textarea");if(B.value=M,B.style.position="fixed",B.style.top="50%",B.style.left="50%",B.style.width="1px",B.style.height="1px",B.style.padding="0",B.style.border="none",B.style.outline="none",B.style.boxShadow="none",B.style.background="transparent",B.style.color="transparent",B.style.fontSize="1px",B.style.zIndex="99999",B.contentEditable="true",document.body.appendChild(B),B.focus(),B.select(),navigator.userAgent.match(/ipad|iphone/i)){const O=document.createRange();O.selectNodeContents(B);const A=window.getSelection();A==null||A.removeAllRanges(),A==null||A.addRange(O)}B.setSelectionRange(0,M.length);let P=!1;try{P=document.execCommand("copy")}catch(O){console.error("execCommand copy failed:",O)}return B.blur(),document.body.removeChild(B),P}function xt(){let M="",B=0;const P="ontouchstart"in window||navigator.maxTouchPoints>0;return{copy(O,A){var t;if(!O||!O.trim())return!1;const W=Date.now();if(O===M&&W-B<Lt)return!1;let R=!1;return P&&(R=He(O)),!R&&((t=navigator.clipboard)!=null&&t.writeText)&&(navigator.clipboard.writeText(O).then(()=>{}).catch(a=>{console.warn(`Clipboard API failed (${A}):`,a)}),R||(R=!0)),R||(R=He(O)),R?(M=O,B=W,!0):(console.error(`Copy failed completely (${A})`),!1)},async paste(){var O;try{return(O=navigator.clipboard)!=null&&O.readText?await navigator.clipboard.readText():(console.warn("Clipboard API not available"),"")}catch(A){return console.error("Paste failed:",A),""}},reset(){M="",B=0}}}function Rt(M){const B=new Map,P=new Map;return{scheduleResize(O,A=50){const W=B.get(O.id);W&&clearTimeout(W);const R=setTimeout(()=>{B.delete(O.id);const t=O.term.cols,a=O.term.rows,h=P.get(O.id);h&&h.cols===t&&h.rows===a||(M(O,t,a),P.set(O.id,{cols:t,rows:a,time:Date.now()}))},A);B.set(O.id,R)},cancelResize(O){const A=B.get(O);A&&(clearTimeout(A),B.delete(O))}}}function Dt(M,B){const P=document.getElementById("copy-button");let O="";function A(W){P&&(P.textContent=W?"Copied!":"Failed",P.classList.add(W?"success":"error"),setTimeout(()=>{P.classList.remove("visible","success","error"),P.textContent="Copy",B.clearSelection()},400))}return{show(W,R,t){if(!(!P||!W)){if(O=W,R!==void 0&&t!==void 0){let h=R,c=t-40;const s=80,u=36,d=8;h=Math.max(d+s/2,Math.min(window.innerWidth-d-s/2,h)),c=Math.max(d+u/2,Math.min(window.innerHeight-d-u/2,c)),P.style.left=`${h}px`,P.style.top=`${c}px`}P.classList.add("visible")}},hide(){P&&(O="",P.classList.remove("visible"))},setup(){P&&(P.addEventListener("click",W=>{var t;if(W.preventDefault(),W.stopPropagation(),!O){this.hide();return}const R=O;O="",(t=navigator.clipboard)!=null&&t.writeText?navigator.clipboard.writeText(R).then(()=>{A(!0)}).catch(()=>{A(M.copy(R,"copyButton-fallback"))}):A(M.copy(R,"copyButton"))}),document.addEventListener("pointerdown",W=>{W.target!==P&&P.classList.contains("visible")&&(this.hide(),B.clearSelection())}))}}}function At(){const M=document.getElementById("disconnect-overlay"),B=document.getElementById("disconnect-text"),P=document.getElementById("disconnect-retry");return{show(){M==null||M.classList.remove("hidden")},hide(){M==null||M.classList.add("hidden")},setText(O){B&&(B.textContent=O)},setup(O){P==null||P.addEventListener("click",()=>{this.hide(),O()})}}}function Tt(){const M=document.getElementById("connection-dot");return{set(B){M&&(M.className=B==="connected"?"connected":"")}}}const kt=6,Mt=32,We=1;function Bt(M){const B=M.buffer.active,P=[];for(let O=0;O<B.length;O++){const A=B.getLine(O);A&&P.push(A.translateToString(!0))}for(;P.length>0&&(P[P.length-1]??"").trim()==="";)P.pop();return P.join(`
|
|
69
|
+
`)}function It(){const M=document.getElementById("textview-overlay"),B=document.getElementById("textview-close"),P=document.getElementById("textview-zoom-in"),O=document.getElementById("textview-zoom-out"),A=document.getElementById("textview-body");let W=10,R=0,t=10;function a(){A&&(A.style.fontSize=`${W}px`)}function h(e){W=Math.max(kt,Math.min(Mt,e)),a()}function c(){h(W+We)}function s(){h(W-We)}function u(e){const r=e[0],i=e[1];if(!r||!i)return 0;const n=i.clientX-r.clientX,_=i.clientY-r.clientY;return Math.hypot(n,_)}function d(e){e.touches.length===2&&(R=u(e.touches),t=W)}function v(e){if(e.touches.length===2&&R>0){e.preventDefault();const i=u(e.touches)/R;h(Math.round(t*i))}}function o(){R=0}return{show(e){const r=e.options.fontSize??14;h(r),A&&(A.textContent=Bt(e)),M==null||M.classList.remove("hidden"),requestAnimationFrame(()=>{A&&(A.scrollTop=A.scrollHeight)})},hide(){M==null||M.classList.add("hidden"),A&&(A.textContent="")},setup(){B==null||B.addEventListener("click",()=>this.hide()),P==null||P.addEventListener("click",c),O==null||O.addEventListener("click",s),A==null||A.addEventListener("touchstart",d,{passive:!0}),A==null||A.addEventListener("touchmove",v,{passive:!1}),A==null||A.addEventListener("touchend",o,{passive:!0})}}}const Ot=["1","2","3","Tab","/","Delete"],Pt=["Home","ArrowUp","End"],Ft=new Set(["Tab"]),Ht="ArrowLeft";function De(M){return Ne.find(B=>B.key===M)||Te.find(B=>B.key===M)}function be(M){const B=document.createElement("button");return B.className="tool-btn",M.className&&(B.className+=" "+M.className),B.dataset.key=M.key,B.textContent=M.label,B}function Wt(){const M=document.getElementById("toolbar-row1"),B=document.getElementById("toolbar-row2"),P=document.getElementById("btn-backspace"),O=document.getElementById("btn-paste");if(!M||!B||!P)return;for(const R of Ot){const t=De(R);t&&M.insertBefore(be(t),P)}let A=P;for(const R of Pt){const t=De(R);if(t){const a=be(t);A.insertAdjacentElement("afterend",a),A=a}}const W=De("Enter");W&&M.appendChild(be(W));for(const R of Te)Ft.has(R.key)||(R.key===Ht&&O&&B.appendChild(O),B.appendChild(be(R)))}const Ae={maxReconnectAttempts:5,reconnectDelayMs:1e3,heartbeatMs:25e3};async function $t(){var g;const M=Ke(),B=Ge(),P=Tt(),O=At(),A=It(),W=xt(),R=ut(),t=ft(M,l=>{Nt(l)});let a;const h=Ze({onStateSync:l=>{console.log("Received state sync:",l.length,"tabs"),a.applyStateSync(l)},onStateUpdate:l=>{console.log("Received state update:",l),a.applyStateUpdate(l)},onDisconnect:()=>{console.log("Management WebSocket disconnected"),P.set("disconnected"),O.show()},onConnect:()=>{console.log("Management WebSocket connected"),O.hide()}}),c=Ye(M,{maxReconnectAttempts:Ae.maxReconnectAttempts,reconnectDelayMs:Ae.reconnectDelayMs,heartbeatMs:Ae.heartbeatMs},{onSessionInfo:(l,p,f)=>{l.sessionId=p,f&&(l.tabId=f)},onDisconnect:()=>{P.set("disconnected")},onReconnectFailed:()=>{O.show()}}),s=Rt((l,p,f)=>{c.sendResize(l,p,f)});a=ht(M,h,c,t.state,{onInputSend:()=>{t.consumeSticky()},onSelectionCopy:l=>{W.copy(l,"selectionChange")},scheduleResize:l=>{s.scheduleResize(l)}});const u=vt(M,R,t,{sendInput:l=>{const p=a.activeTab;p&&c.sendInput(p,l)},focusTerminal:()=>{a.focusTerminal()}}),d=Dt(W,{clearSelection:()=>{const l=a.activeTab;l&&l.term.clearSelection()}}),v=pt(),o=mt(),e=Et(M,v,o,{getActiveTerminal:()=>{var l;return((l=a.activeTab)==null?void 0:l.term)??null},sendArrowKey:l=>{const p=a.activeTab;p&&(l==="up"?(c.sendInput(p,"\x1B[A"),navigator.vibrate&&navigator.vibrate(20)):l==="down"&&(c.sendInput(p,"\x1B[B"),navigator.vibrate&&navigator.vibrate(20)))},showCopyButton:(l,p,f)=>{d.show(l,p,f)},focusTerminal:()=>{a.focusTerminal()},scheduleFitAfterFontChange:()=>{const l=a.activeTab;l&&setTimeout(()=>l.fitAddon.fit(),50)}});d.setup(),O.setup(async()=>{try{h.isConnected()||await h.connect();for(const l of a.tabs)c.isConnected(l)||(l.reconnectAttempts=0,c.connect(l,!0));O.hide()}catch(l){console.error("Retry failed:",l)}});const r=await B.load(),i=document.getElementById("shell-select");if(i){i.innerHTML="";for(const l of r.shells){const p=document.createElement("option");p.value=l.id,p.textContent=l.name,l.id===r.default_shell&&(p.selected=!0),i.appendChild(p)}i.addEventListener("change",async()=>{const l=i.value,p=a.activeTab;if(l&&p)try{await a.requestCreateTab(l),await a.requestCloseTab(p.id)}catch(f){console.error("Failed to switch shell:",f)}})}if(r.buttons&&r.buttons.length>0){const l=document.getElementById("toolbar-row3");if(l){for(const p of r.buttons){const f=document.createElement("button");f.className="tool-btn",f.textContent=p.label;const m=p.send||"",y=(Array.isArray(m)?m:[m]).map(b=>typeof b=="number"?b:b.replace(/\r/g,"{CR}").replace(/\n/g,"{LF}").replace(/\x1b/g,"{ESC}"));f.dataset.send=JSON.stringify(y),l.appendChild(f)}l.classList.remove("hidden")}}Wt(),Ut(t),zt(u),qt(()=>{const l=a.activeTab;l&&c.sendInput(l,"")}),jt(async()=>{const l=await W.paste();if(l){const p=a.activeTab;p&&(c.sendInput(p,l),navigator.vibrate&&navigator.vibrate(30))}a.focusTerminal()}),Kt(u,a.focusTerminal.bind(a)),Gt(O),Vt(),A.setup(),Xt(A,()=>{var l;return((l=a.activeTab)==null?void 0:l.term)??null});const n=document.getElementById("terminal-container");n&&e.attach(n),M.on("connection:open",({tabId:l})=>{l===a.activeTabId&&(P.set("connected"),O.hide())}),M.on("connection:close",({tabId:l})=>{l===a.activeTabId&&P.set("disconnected")}),M.on("tab:closed",({tabId:l})=>{s.cancelResize(l)}),document.addEventListener("visibilitychange",async()=>{if(document.visibilityState==="visible"){t.reset();try{h.isConnected()||await h.connect();for(const l of a.tabs)c.isConnected(l)||c.connect(l,!0)}catch(l){console.error("Failed to reconnect:",l),O.show()}}else t.reset()}),window.addEventListener("blur",()=>{t.reset()});let _;if(window.addEventListener("resize",()=>{clearTimeout(_),_=setTimeout(()=>{const l=a.activeTab;l&&l.fitAddon.fit()},50)}),window.addEventListener("orientationchange",()=>{setTimeout(()=>{const l=a.activeTab;l&&l.fitAddon.fit()},100)}),window.visualViewport){const l=document.getElementById("app");let p;window.visualViewport.addEventListener("resize",()=>{l&&(l.style.height=`${window.visualViewport.height}px`),clearTimeout(p),p=setTimeout(()=>{const f=a.activeTab;f&&f.fitAddon.fit()},50)})}(g=document.getElementById("terminal-container"))==null||g.addEventListener("click",()=>{a.focusTerminal()});try{await h.connect(),setTimeout(async()=>{a.tabs.length===0&&(console.log("No tabs from server, creating one"),await a.requestCreateTab())},100)}catch(l){console.error("Failed to connect management WebSocket:",l),O.show()}console.log("Porterminal initialized (backend-driven)")}function Nt(M){const B=document.getElementById(`btn-${M}`);if(!B)return;const P=window._modifierManager;if(!P)return;B.classList.remove("sticky","locked");const O=P.getState(M);O==="sticky"?B.classList.add("sticky"):O==="locked"&&B.classList.add("locked")}function Ut(M){window._modifierManager=M;for(const B of["ctrl","alt","shift"]){const P=document.getElementById(`btn-${B}`);if(!P)continue;let O=!1;P.addEventListener("touchstart",A=>{O=!0,A.preventDefault()},{passive:!1}),P.addEventListener("touchend",A=>{A.preventDefault(),M.handleTap(B)},{passive:!1}),P.addEventListener("click",()=>{O||M.handleTap(B),O=!1})}}function zt(M){const B=document.getElementById("btn-escape");if(!B)return;let P=!1,O=0;const A=300,W=()=>{const R=Date.now();R-O<A?M.sendInput("\x1B\x1B"):M.sendInput("\x1B"),O=R};B.addEventListener("touchstart",R=>{P=!0,R.preventDefault()},{passive:!1}),B.addEventListener("touchend",R=>{R.preventDefault(),W()},{passive:!1}),B.addEventListener("click",()=>{P||W(),P=!1})}function qt(M){const B=document.getElementById("btn-backspace");if(!B)return;const P=400,O=50;let A=null,W=null,R=!1;const t=()=>{R||(R=!0,M(),W=setTimeout(()=>{A=setInterval(M,O)},P))},a=()=>{R=!1,W&&(clearTimeout(W),W=null),A&&(clearInterval(A),A=null)};B.addEventListener("pointerdown",h=>{h.preventDefault(),t()},{passive:!1}),B.addEventListener("pointerup",h=>{h.preventDefault(),a()},{passive:!1}),B.addEventListener("pointercancel",a),B.addEventListener("pointerleave",a),B.addEventListener("contextmenu",h=>h.preventDefault())}function Ue(M,B,P={}){const O=document.getElementById(M);if(!O)return;let A=!1;const{preventDefault:W=!0}=P;O.addEventListener("touchstart",R=>{A=!0,W&&R.preventDefault()},{passive:!W}),O.addEventListener("touchend",R=>{W&&R.preventDefault(),B()},{passive:!W}),O.addEventListener("click",()=>{A||B(),A=!1})}function jt(M){Ue("btn-paste",M)}function Kt(M,B){let P=!1;document.querySelectorAll(".tool-btn").forEach(O=>{const A=O;if(A.dataset.bound||(A.dataset.bound="true",A.id==="btn-ctrl"||A.id==="btn-alt"||A.id==="btn-escape"||A.id==="btn-paste"||A.id==="btn-backspace"||A.id==="btn-shutdown"))return;const W=async()=>{if(A.dataset.key)M.handleKeyButton(A.dataset.key);else if(A.dataset.send){const t=JSON.parse(A.dataset.send);for(const a of t)if(typeof a=="number")await new Promise(h=>setTimeout(h,a));else{const h=a.replace(/\{CR\}/g,"\r").replace(/\{LF\}/g,`
|
|
70
|
+
`).replace(/\{ESC\}/g,"\x1B");M.sendInput(h)}B()}};let R=!1;A.addEventListener("touchstart",t=>{P=!0,R=!0,t.preventDefault()},{passive:!1}),A.addEventListener("touchmove",t=>{if(!R)return;const a=t.touches[0];if(!a)return;const h=A.getBoundingClientRect();(a.clientX<h.left||a.clientX>h.right||a.clientY<h.top||a.clientY>h.bottom)&&(R=!1)},{passive:!0}),A.addEventListener("touchend",t=>{t.preventDefault(),R&&W(),R=!1},{passive:!1}),A.addEventListener("click",()=>{P||W(),P=!1})})}function Gt(M){const B=document.getElementById("btn-shutdown");B&&B.addEventListener("click",async()=>{if(confirm(`Shutdown server and tunnel?
|
|
71
|
+
|
|
72
|
+
This will terminate all sessions.`))try{(await fetch("/api/shutdown",{method:"POST"})).ok&&(M.setText("Server Shutdown"),M.show())}catch(P){console.error("Shutdown failed:",P)}})}function Vt(){const M=document.getElementById("btn-info"),B=document.getElementById("help-overlay"),P=document.getElementById("help-close");if(!M||!B)return;const O=()=>B.classList.remove("hidden"),A=()=>B.classList.add("hidden");M.addEventListener("click",O),P==null||P.addEventListener("click",A),B.addEventListener("click",W=>{W.target===B&&A()})}function Xt(M,B){Ue("btn-textview",()=>{const P=B();P&&M.show(P)},{preventDefault:!1})}document.addEventListener("DOMContentLoaded",()=>{$t()});
|