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.
Files changed (33) hide show
  1. porterminal/__init__.py +19 -3
  2. porterminal/_version.py +34 -0
  3. porterminal/app.py +8 -4
  4. porterminal/application/services/terminal_service.py +116 -28
  5. porterminal/asgi.py +8 -3
  6. porterminal/cli/args.py +50 -0
  7. porterminal/composition.py +13 -5
  8. porterminal/config.py +54 -70
  9. porterminal/container.py +0 -11
  10. porterminal/domain/__init__.py +0 -2
  11. porterminal/domain/entities/output_buffer.py +0 -4
  12. porterminal/domain/ports/__init__.py +1 -2
  13. porterminal/domain/ports/pty_port.py +0 -29
  14. porterminal/domain/ports/tab_repository.py +0 -5
  15. porterminal/infrastructure/config/__init__.py +0 -2
  16. porterminal/infrastructure/config/shell_detector.py +1 -0
  17. porterminal/infrastructure/repositories/in_memory_tab.py +0 -4
  18. porterminal/infrastructure/server.py +10 -3
  19. porterminal/static/assets/app-By4EXMHC.js +72 -0
  20. porterminal/static/assets/app-DQePboVd.css +32 -0
  21. porterminal/static/index.html +16 -25
  22. porterminal/updater.py +115 -168
  23. ptn-0.2.5.dist-info/METADATA +148 -0
  24. {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/RECORD +27 -29
  25. porterminal/infrastructure/config/yaml_loader.py +0 -34
  26. porterminal/static/assets/app-BQiuUo6Q.css +0 -32
  27. porterminal/static/assets/app-YNN_jEhv.js +0 -71
  28. porterminal/static/manifest.json +0 -31
  29. porterminal/static/sw.js +0 -66
  30. ptn-0.1.4.dist-info/METADATA +0 -191
  31. {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/WHEEL +0 -0
  32. {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/entry_points.txt +0 -0
  33. {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/licenses/LICENSE +0 -0
@@ -1,71 +0,0 @@
1
- (function(){const k=document.createElement("link").relList;if(k&&k.supports&&k.supports("modulepreload"))return;for(const A of document.querySelectorAll('link[rel="modulepreload"]'))F(A);new MutationObserver(A=>{for(const $ of A)if($.type==="childList")for(const R of $.addedNodes)R.tagName==="LINK"&&R.rel==="modulepreload"&&F(R)}).observe(document,{childList:!0,subtree:!0});function B(A){const $={};return A.integrity&&($.integrity=A.integrity),A.referrerPolicy&&($.referrerPolicy=A.referrerPolicy),A.crossOrigin==="use-credentials"?$.credentials="include":A.crossOrigin==="anonymous"?$.credentials="omit":$.credentials="same-origin",$}function F(A){if(A.ep)return;A.ep=!0;const $=B(A);fetch(A.href,$)}})();function Ue(){const P=new Map;return{emit(k,B){const F=P.get(k);if(F)for(const A of F)try{A(B)}catch($){console.error(`Error in event handler for "${k}":`,$)}},on(k,B){let F=P.get(k);return F||(F=new Set,P.set(k,F)),F.add(B),()=>this.off(k,B)},off(k,B){const F=P.get(k);F&&F.delete(B)},once(k,B){const F=A=>{this.off(k,F),B(A)};return this.on(k,F)}}}function ze(){let P=null;return{async load(){try{const k=await fetch("/api/config");if(!k.ok)throw new Error(`Config fetch failed: ${k.status}`);return P=await k.json(),P}catch(k){return console.error("Failed to load config:",k),P={shells:[{id:"default",name:"Shell"}],default_shell:"default"},P}},getShells(){return(P==null?void 0:P.shells)??[]},getDefaultShell(){return(P==null?void 0:P.default_shell)??"default"},isLoaded(){return P!==null}}}const we={TAB_ID_REQUIRED:4e3,TAB_NOT_FOUND:4004,SESSION_ENDED:4005},je=/\x1b\[\?[\d;]*c|\x1b\[[\d;]*R/g;function qe(P){return P.includes("\x1B[")?P.replace(je,""):P}function Ge(P,k,B){const F=new TextEncoder,A=new TextDecoder,$=new Map;function R(c){return $.has(c)||$.set(c,{state:"disconnected",pendingReconnect:null,earlyBuffer:[],writeBuffer:[],rafHandle:null}),$.get(c)}function t(c){const f=$.get(c);f!=null&&f.pendingReconnect&&(clearTimeout(f.pendingReconnect),f.pendingReconnect=null)}function a(c,f){f.rafHandle===null&&(f.rafHandle=requestAnimationFrame(()=>{if(f.rafHandle=null,f.writeBuffer.length===0)return;const v=f.writeBuffer.join("");f.writeBuffer=[],c.term.write(v)}))}function h(c){const f=$.get(c.id);f&&f.rafHandle!==null&&(cancelAnimationFrame(f.rafHandle),f.rafHandle=null,f.writeBuffer=[]),c.ws&&(c.ws.onopen=null,c.ws.onmessage=null,c.ws.onclose=null,c.ws.onerror=null,(c.ws.readyState===WebSocket.OPEN||c.ws.readyState===WebSocket.CONNECTING)&&c.ws.close(),c.ws=null),c.heartbeatInterval&&(clearInterval(c.heartbeatInterval),c.heartbeatInterval=null)}function l(c,f){const v=window.location.protocol==="https:"?"wss:":"ws:",o=new URLSearchParams({tab_id:c});return f&&o.set("skip_buffer","1"),`${v}//${window.location.host}/ws?${o}`}const n={connect(c,f){const v=R(c.id);if(t(c.id),!c.tabId){console.error(`Tab ${c.id} has no tabId - cannot connect without server confirmation`),P.emit("connection:error",{tabId:c.id,error:"No tabId"});return}v.state!=="disconnected"&&(h(c),v.state="disconnected"),v.state="connecting",v.earlyBuffer=[];const o=l(c.tabId,f),e=new WebSocket(o);e.binaryType="arraybuffer",c.ws=e,e.onopen=()=>{if(v.state!=="connecting"){e.close();return}c.reconnectAttempts=0,P.emit("connection:open",{tabId:c.id}),c.heartbeatInterval=setInterval(()=>{var s;((s=c.ws)==null?void 0:s.readyState)===WebSocket.OPEN&&c.ws.send(JSON.stringify({type:"ping"}))},k.heartbeatMs),requestAnimationFrame(()=>{var s;if(v.state==="connecting")try{c.fitAddon.fit(),((s=c.ws)==null?void 0:s.readyState)===WebSocket.OPEN&&c.ws.send(JSON.stringify({type:"resize",cols:c.term.cols,rows:c.term.rows}))}finally{v.state="connected";for(const i of v.earlyBuffer)c.term.write(i);v.earlyBuffer=[]}})},e.onmessage=s=>{var i;if(s.data instanceof ArrayBuffer){const r=A.decode(s.data);v.state==="connecting"?v.earlyBuffer.push(r):v.state==="connected"&&(v.writeBuffer.push(r),a(c,v))}else try{const r=JSON.parse(s.data);switch(r.type){case"session_info":B.onSessionInfo(c,r.session_id,r.tab_id??null);break;case"ping":((i=c.ws)==null?void 0:i.readyState)===WebSocket.OPEN&&c.ws.send(JSON.stringify({type:"pong"}));break;case"error":console.error("Server error:",r.message),c.term.write(`\r
2
- \x1B[31mError: ${r.message}\x1B[0m\r
3
- `),P.emit("connection:error",{tabId:c.id,error:r.message});break}}catch(r){console.error("Failed to parse message:",r)}},e.onclose=s=>{if(v.state==="disconnecting"){v.state="disconnected";return}if((v.state==="connecting"||v.state==="connected")&&(v.state="disconnected"),c.heartbeatInterval&&(clearInterval(c.heartbeatInterval),c.heartbeatInterval=null),P.emit("connection:close",{tabId:c.id,code:s.code}),s.code===we.TAB_ID_REQUIRED||s.code===we.TAB_NOT_FOUND||s.code===we.SESSION_ENDED){console.log(`Tab ${c.id} rejected (code ${s.code}) - removing stale tab`),P.emit("tab:stale",{tabId:c.id,serverId:c.tabId,code:s.code});return}if(c.reconnectAttempts<k.maxReconnectAttempts){c.reconnectAttempts++;const i=k.reconnectDelayMs*Math.min(c.reconnectAttempts,5);v.pendingReconnect=setTimeout(()=>{v.pendingReconnect=null,n.connect(c,!0)},i)}else B.onReconnectFailed()},e.onerror=()=>{(v.state==="connecting"||v.state==="connected")&&B.onDisconnect()}},disconnect(c){const f=R(c.id);t(c.id),f.state!=="disconnected"&&(f.state="disconnecting",h(c),f.state="disconnected")},sendInput(c,f){if(R(c.id).state!=="connected"||!c.ws||c.ws.readyState!==WebSocket.OPEN)return;const o=qe(f);o&&c.ws.send(F.encode(o))},sendResize(c,f,v){R(c.id).state!=="connected"||!c.ws||c.ws.readyState!==WebSocket.OPEN||c.ws.send(JSON.stringify({type:"resize",cols:f,rows:v}))},isConnected(c){var v;return R(c.id).state==="connected"&&((v=c.ws)==null?void 0:v.readyState)===WebSocket.OPEN},getState(c){return R(c).state},cleanupTabState(c){const f=$.get(c);f&&f.rafHandle!==null&&cancelAnimationFrame(f.rafHandle),t(c),$.delete(c)}};return n}const ye=1e4;function Ke(P){let k=null;const B=new Map;let F=null,A=null;function $(){return`req_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function R(a){try{const h=JSON.parse(a.data);switch(h.type){case"tab_state_sync":P.onStateSync(h.tabs),A&&(A(),A=null);break;case"tab_state_update":P.onStateUpdate(h.changes);break;case"create_tab_response":{const l=B.get(h.request_id);l&&(clearTimeout(l.timeout),B.delete(h.request_id),h.success&&h.tab?l.resolve(h.tab):l.reject(new Error(h.error||"Failed to create tab")));break}case"close_tab_response":{const l=B.get(h.request_id);l&&(clearTimeout(l.timeout),B.delete(h.request_id),h.success?l.resolve(void 0):l.reject(new Error(h.error||"Failed to close tab")));break}case"rename_tab_response":{const l=B.get(h.request_id);l&&(clearTimeout(l.timeout),B.delete(h.request_id),h.success&&h.tab?l.resolve(h.tab):l.reject(new Error(h.error||"Failed to rename tab")));break}case"pong":break}}catch(h){console.error("Failed to parse management message:",h)}}function t(){F&&(clearInterval(F),F=null);for(const[a,h]of B)clearTimeout(h.timeout),h.reject(new Error("Connection closed")),B.delete(a)}return{connect(){return new Promise((a,h)=>{const n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/management`;k=new WebSocket(n),A=a,k.onopen=()=>{var c;console.log("Management WebSocket connected, waiting for state sync..."),F=setInterval(()=>{(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.send(JSON.stringify({type:"ping"}))},25e3),(c=P.onConnect)==null||c.call(P)},k.onerror=c=>{console.error("Management WebSocket error:",c),A=null,h(new Error("Connection failed"))},k.onmessage=R,k.onclose=()=>{console.log("Management WebSocket disconnected"),A&&(A=null,h(new Error("Connection closed before sync"))),t(),k=null,P.onDisconnect()}})},disconnect(){k&&(t(),k.close(),k=null)},async createTab(a){if(!k||k.readyState!==WebSocket.OPEN)throw new Error("Not connected to management WebSocket");const h=$();return new Promise((l,n)=>{const c=setTimeout(()=>{B.delete(h),n(new Error("Request timeout"))},ye);B.set(h,{resolve:l,reject:n,timeout:c}),k.send(JSON.stringify({type:"create_tab",request_id:h,shell_id:a}))})},async closeTab(a){if(!k||k.readyState!==WebSocket.OPEN)throw new Error("Not connected to management WebSocket");const h=$();return new Promise((l,n)=>{const c=setTimeout(()=>{B.delete(h),n(new Error("Request timeout"))},ye);B.set(h,{resolve:l,reject:n,timeout:c}),k.send(JSON.stringify({type:"close_tab",request_id:h,tab_id:a}))})},async renameTab(a,h){if(!k||k.readyState!==WebSocket.OPEN)throw new Error("Not connected to management WebSocket");const l=$();return new Promise((n,c)=>{const f=setTimeout(()=>{B.delete(l),c(new Error("Request timeout"))},ye);B.set(l,{resolve:n,reject:c,timeout:f}),k.send(JSON.stringify({type:"rename_tab",request_id:l,tab_id:a,name:h}))})},isConnected(){return(k==null?void 0:k.readyState)===WebSocket.OPEN},ping(){(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.send(JSON.stringify({type:"ping"}))}}}var Ee={exports:{}},ke;function Ve(){return ke||(ke=1,(function(P,k){(function(B,F){P.exports=F()})(globalThis,(()=>(()=>{var B={4567:function(R,t,a){var h=this&&this.__decorate||function(i,r,u,m){var _,g=arguments.length,d=g<3?r:m===null?m=Object.getOwnPropertyDescriptor(r,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,m);else for(var p=i.length-1;p>=0;p--)(_=i[p])&&(d=(g<3?_(d):g>3?_(r,u,d):_(r,u))||d);return g>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,m){r(u,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=a(9042),c=a(9924),f=a(844),v=a(4725),o=a(2585),e=a(3656);let s=t.AccessibilityManager=class extends f.Disposable{constructor(i,r,u,m){super(),this._terminal=i,this._coreBrowserService=u,this._renderService=m,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let _=0;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);if(this._topBoundaryFocusListener=_=>this._handleBoundaryFocus(_,0),this._bottomBoundaryFocusListener=_=>this._handleBoundaryFocus(_,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new c.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((_=>this._handleResize(_.rows)))),this.register(this._terminal.onRender((_=>this._refreshRows(_.start,_.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((_=>this._handleChar(_)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
4
- `)))),this.register(this._terminal.onA11yTab((_=>this._handleTab(_)))),this.register(this._terminal.onKey((_=>this._handleKey(_.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,e.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,f.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(i){for(let r=0;r<i;r++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
5
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,r){this._liveRegionDebouncer.refresh(i,r,this._terminal.rows)}_renderRows(i,r){const u=this._terminal.buffer,m=u.lines.length.toString();for(let _=i;_<=r;_++){const g=u.lines.get(u.ydisp+_),d=[],p=(g==null?void 0:g.translateToString(!0,void 0,void 0,d))||"",S=(u.ydisp+_+1).toString(),y=this._rowElements[_];y&&(p.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=p,this._rowColumns.set(y,d)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,r){const u=i.target,m=this._rowElements[r===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==m)return;let _,g;if(r===0?(_=u,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(_=this._rowElements.shift(),g=u,this._rowContainer.removeChild(_)),_.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){const d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{const d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var p;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:i.anchorNode,offset:i.anchorOffset},u={node:i.focusNode,offset:i.focusOffset};if((r.node.compareDocumentPosition(u.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===u.node&&r.offset>u.offset)&&([r,u]=[u,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;const m=this._rowElements.slice(-1)[0];if(u.node.compareDocumentPosition(m)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(u={node:m,offset:((p=m.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(u.node))return;const _=({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}},g=_(r),d=_(u);if(g&&d){if(g.row>d.row||g.row===d.row&&g.column>=d.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(d.row-g.row)*this._terminal.cols-g.column+d.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=s=h([l(1,o.IInstantiationService),l(2,v.ICoreBrowserService),l(3,v.IRenderService)],s)},3614:(R,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,f){return f?"\x1B[200~"+c+"\x1B[201~":c}function l(c,f,v,o){c=h(c=a(c),v.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(c,!0),f.value=""}function n(c,f,v){const o=v.getBoundingClientRect(),e=c.clientX-o.left-10,s=c.clientY-o.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${e}px`,f.style.top=`${s}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=h,t.copyHandler=function(c,f){c.clipboardData&&c.clipboardData.setData("text/plain",f.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,f,v,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),f,v,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(c,f,v,o,e){n(c,f,v),e&&o.rightClickSelect(c),f.value=o.selectionText,f.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(l,n,c){this._css.set(l,n,c)}getCss(l,n){return this._css.get(l,n)}setColor(l,n,c){this._color.set(l,n,c)}getColor(l,n){return this._color.get(l,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},3551:function(R,t,a){var h=this&&this.__decorate||function(s,i,r,u){var m,_=arguments.length,g=_<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,r):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,i,r,u);else for(var d=s.length-1;d>=0;d--)(m=s[d])&&(g=(_<3?m(g):_>3?m(i,r,g):m(i,r))||g);return _>3&&g&&Object.defineProperty(i,r,g),g},l=this&&this.__param||function(s,i){return function(r,u){i(r,u,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),c=a(8460),f=a(844),v=a(2585),o=a(4725);let e=t.Linkifier=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(s,i,r,u,m){super(),this._element=s,this._mouseService=i,this._renderService=r,this._bufferService=u,this._linkProviderService=m,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)((()=>{var _;this._lastMouseEvent=void 0,(_=this._activeProviderReplies)==null||_.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;const i=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const r=s.composedPath();for(let u=0;u<r.length;u++){const m=r[u];if(m.classList.contains("xterm"))break;if(m.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,i){var u,m;this._activeProviderReplies&&i||((u=this._activeProviderReplies)==null||u.forEach((_=>{_==null||_.forEach((g=>{g.link.dispose&&g.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=s.y);let r=!1;for(const[_,g]of this._linkProviderService.linkProviders.entries())i?(m=this._activeProviderReplies)!=null&&m.get(_)&&(r=this._checkLinkProviderResult(_,s,r)):g.provideLinks(s.y,(d=>{var S,y;if(this._isMouseOut)return;const p=d==null?void 0:d.map((b=>({link:b})));(S=this._activeProviderReplies)==null||S.set(_,p),r=this._checkLinkProviderResult(_,s,r),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)}))}_removeIntersectingLinks(s,i){const r=new Set;for(let u=0;u<i.size;u++){const m=i.get(u);if(m)for(let _=0;_<m.length;_++){const g=m[_],d=g.link.range.start.y<s?0:g.link.range.start.x,p=g.link.range.end.y>s?this._bufferService.cols:g.link.range.end.x;for(let S=d;S<=p;S++){if(r.has(S)){m.splice(_--,1);break}r.add(S)}}}}_checkLinkProviderResult(s,i,r){var _;if(!this._activeProviderReplies)return r;const u=this._activeProviderReplies.get(s);let m=!1;for(let g=0;g<s;g++)this._activeProviderReplies.has(g)&&!this._activeProviderReplies.get(g)||(m=!0);if(!m&&u){const g=u.find((d=>this._linkAtPosition(d.link,i)));g&&(r=!0,this._handleNewLink(g))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let g=0;g<this._activeProviderReplies.size;g++){const d=(_=this._activeProviderReplies.get(g))==null?void 0:_.find((p=>this._linkAtPosition(p.link,i)));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;const i=this._positionFromMouseEvent(s,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,i){this._currentLink&&this._lastMouseEvent&&(!s||!i||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(s.link,i)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>{var r,u;return(u=(r=this._currentLink)==null?void 0:r.state)==null?void 0:u.decorations.pointerCursor},set:r=>{var u;(u=this._currentLink)!=null&&u.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,u;return(u=(r=this._currentLink)==null?void 0:r.state)==null?void 0:u.decorations.underline},set:r=>{var u,m,_;(u=this._currentLink)!=null&&u.state&&((_=(m=this._currentLink)==null?void 0:m.state)==null?void 0:_.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((r=>{if(!this._currentLink)return;const u=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,m=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=m&&(this._clearCurrentLink(u,m),this._lastMouseEvent)){const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._askForLink(_,!1)}}))))}_linkHover(s,i,r){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(s,i){const r=s.range,u=this._bufferService.buffer.ydisp,m=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-u-1,r.end.x,r.end.y-u-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(m)}_linkLeave(s,i,r){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(s,i){const r=s.range.start.y*this._bufferService.cols+s.range.start.x,u=s.range.end.y*this._bufferService.cols+s.range.end.x,m=i.y*this._bufferService.cols+i.x;return r<=m&&m<=u}_positionFromMouseEvent(s,i,r){const u=r.getCoords(s,i,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,i,r,u,m){return{x1:s,y1:i,x2:r,y2:u,cols:this._bufferService.cols,fg:m}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,v.IBufferService),l(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,s,i){var r,u=arguments.length,m=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(o,e,s,i);else for(var _=o.length-1;_>=0;_--)(r=o[_])&&(m=(u<3?r(m):u>3?r(e,s,m):r(e,s))||m);return u>3&&m&&Object.defineProperty(e,s,m),m},l=this&&this.__param||function(o,e){return function(s,i){e(s,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=a(511),c=a(2585);let f=t.OscLinkProvider=class{constructor(o,e,s){this._bufferService=o,this._optionsService=e,this._oscLinkService=s}provideLinks(o,e){var p;const s=this._bufferService.buffer.lines.get(o-1);if(!s)return void e(void 0);const i=[],r=this._optionsService.rawOptions.linkHandler,u=new n.CellData,m=s.getTrimmedLength();let _=-1,g=-1,d=!1;for(let S=0;S<m;S++)if(g!==-1||s.hasContent(S)){if(s.loadCell(S,u),u.hasExtendedAttrs()&&u.extended.urlId){if(g===-1){g=S,_=u.extended.urlId;continue}d=u.extended.urlId!==_}else g!==-1&&(d=!0);if(d||g!==-1&&S===m-1){const y=(p=this._oscLinkService.getLinkData(_))==null?void 0:p.uri;if(y){const b={start:{x:g+1,y:o},end:{x:S+(d||S!==m-1?0:1),y:o}};let w=!1;if(!(r!=null&&r.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)=>r?r.activate(x,I,b):v(0,I),hover:(x,I)=>{var W;return(W=r==null?void 0:r.hover)==null?void 0:W.call(r,x,I,b)},leave:(x,I)=>{var W;return(W=r==null?void 0:r.leave)==null?void 0:W.call(r,x,I,b)}})}d=!1,u.hasExtendedAttrs()&&u.extended.urlId?(g=S,_=u.extended.urlId):(g=-1,_=-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 s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=f=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],f)},6193:(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,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),n=a(3551),c=a(9042),f=a(3730),v=a(1680),o=a(3107),e=a(5744),s=a(2950),i=a(1296),r=a(428),u=a(4269),m=a(5114),_=a(8934),g=a(3230),d=a(9312),p=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),x=a(844),I=a(6114),W=a(8437),H=a(2584),O=a(7399),C=a(5941),L=a(9074),D=a(2585),T=a(5435),U=a(4567),j=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(M={}){super(M),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(j.LinkProviderService),this._instantiationService.setService(p.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.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(M){if(this._themeService)for(const E of M){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 G=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)(G)}${H.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors((q=>q.ansi[E.index]=y.channels.toColor(...E.color)));else{const q=z;this._themeService.modifyColors((Z=>Z[q]=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(M){M?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(M){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var M;return(M=this.textarea)==null?void 0:M.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 M=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(M);if(!E)return;const z=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,G=E.getWidth(z),q=this._renderService.dimensions.css.cell.width*G,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=q+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",(E=>{this.hasSelection()&&(0,h.copyHandler)(E,this._selectionService)})));const M=E=>(0,h.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",M)),this.register((0,l.addDisposableDomListener)(this.element,"paste",M)),I.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(E=>{E.button===2&&(0,h.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(E=>{(0,h.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(E=>{E.button===1&&(0,h.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(M=>this._keyUp(M)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(M=>this._keyDown(M)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(M=>this._keyPress(M)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(M=>this._compositionHelper.compositionupdate(M)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(M=>this._inputEvent(M)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(M){var z;if(!M)throw new Error("Terminal requires a parent element.");if(M.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((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=M.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),M.appendChild(this.element);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,l.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),I.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(m.CoreBrowserService,this.textarea,M.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(p.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(r.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(p.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(p.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(u.CharacterJoinerService),this._instantiationService.setService(p.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(p.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(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(_.MouseService),this._instantiationService.setService(p.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.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(d.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(p.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const M=this,E=this.element;function z(q){const Z=M._mouseService.getMouseReportCoords(q,M.screenElement);if(!Z)return!1;let Y,re;switch(q.overrideType||q.type){case"mousemove":re=32,q.buttons===void 0?(Y=3,q.button!==void 0&&(Y=q.button<3?q.button:3)):Y=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":re=0,Y=q.button<3?q.button:3;break;case"mousedown":re=1,Y=q.button<3?q.button:3;break;case"wheel":if(M._customWheelEventHandler&&M._customWheelEventHandler(q)===!1||M.viewport.getLinesScrolled(q)===0)return!1;re=q.deltaY<0?0:1,Y=4;break;default:return!1}return!(re===void 0||Y===void 0||Y>4)&&M.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:Y,action:re,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}const N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:q=>(z(q),q.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(q)),wheel:q=>(z(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&z(q)},mousemove:q=>{q.buttons||z(q)}};this.register(this.coreMouseService.onProtocolChange((q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),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&q?N.mousemove||(E.addEventListener("mousemove",G.mousemove),N.mousemove=G.mousemove):(E.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&q?N.wheel||(E.addEventListener("wheel",G.wheel,{passive:!1}),N.wheel=G.wheel):(E.removeEventListener("wheel",N.wheel),N.wheel=null),2&q?N.mouseup||(N.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&q?N.mousedrag||(N.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(E,"mousedown",(q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return z(q),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(q)}))),this.register((0,l.addDisposableDomListener)(E,"wheel",(q=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){const Z=this.viewport.getLinesScrolled(q);if(Z===0)return;const Y=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.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(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}}),{passive:!1})),this.register((0,l.addDisposableDomListener)(E,"touchstart",(q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(E,"touchmove",(q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)}),{passive:!1}))}refresh(M,E){var z;(z=this._renderService)==null||z.refreshRows(M,E)}updateCursorStyle(M){var E;(E=this._selectionService)!=null&&E.shouldColumnSelect(M)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(M,E,z=0){var N;z===1?(super.scrollLines(M,E,z),this.refresh(0,this.rows-1)):(N=this.viewport)==null||N.scrollLines(M)}paste(M){(0,h.paste)(M,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(M){this._customKeyEventHandler=M}attachCustomWheelEventHandler(M){this._customWheelEventHandler=M}registerLinkProvider(M){return this._linkProviderService.registerLinkProvider(M)}registerCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const E=this._characterJoinerService.register(M);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(M)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(M){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+M)}registerDecoration(M){return this._decorationService.registerDecoration(M)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(M,E,z){this._selectionService.setSelection(M,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 M;(M=this._selectionService)==null||M.clearSelection()}selectAll(){var M;(M=this._selectionService)==null||M.selectAll()}selectLines(M,E){var z;(z=this._selectionService)==null||z.selectLines(M,E)}_keyDown(M){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;const E=this.browser.isMac&&this.options.macOptionIsMeta&&M.altKey;if(!E&&!this._compositionHelper.keydown(M))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||M.key!=="Dead"&&M.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,O.evaluateKeyboardEvent)(M,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(M),z.type===3||z.type===2){const N=this.rows-1;return this.scrollLines(z.type===2?-N:N),this.cancel(M,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,M)||(z.cancel&&this.cancel(M,!0),!z.key||!!(M.key&&!M.ctrlKey&&!M.altKey&&!M.metaKey&&M.key.length===1&&M.key.charCodeAt(0)>=65&&M.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==H.C0.ETX&&z.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||M.altKey||M.ctrlKey?this.cancel(M,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(M,E){const z=M.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||M.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||M.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?z:z&&(!E.keyCode||E.keyCode>47)}_keyUp(M){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1||((function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18})(M)||this.focus(),this.updateCursorStyle(M),this._keyPressHandled=!1)}_keyPress(M){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;if(this.cancel(M),M.charCode)E=M.charCode;else if(M.which===null||M.which===void 0)E=M.keyCode;else{if(M.which===0||M.charCode===0)return!1;E=M.which}return!(!E||(M.altKey||M.ctrlKey||M.metaKey)&&!this._isThirdLevelShift(this.browser,M)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(M){if(M.data&&M.inputType==="insertText"&&(!M.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const E=M.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(M),!0}return!1}resize(M,E){M!==this.cols||E!==this.rows?super.resize(M,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(M,E){var z,N;(z=this._charSizeService)==null||z.measure(),(N=this.viewport)==null||N.syncScrollArea(!0)}clear(){var M;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(W.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(M=this.viewport)==null||M.reset(),this.refresh(0,this.rows-1)}}reset(){var E,z;this.options.rows=this.rows,this.options.cols=this.cols;const M=this._customKeyEventHandler;this._setup(),super.reset(),(E=this._selectionService)==null||E.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=M,this.refresh(0,this.rows-1)}clearTextureAtlas(){var M;(M=this._renderService)==null||M.clearTextureAtlas()}_reportFocus(){var M;(M=this.element)!=null&&M.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(M){if(this._renderService)switch(M){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),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${G};${N}t`)}}cancel(M,E){if(this.options.cancelEvents||E)return M.preventDefault(),M.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,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=n-this._lastRefreshMs,f=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),f)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(R,t,a){var h=this&&this.__decorate||function(s,i,r,u){var m,_=arguments.length,g=_<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,r):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,i,r,u);else for(var d=s.length-1;d>=0;d--)(m=s[d])&&(g=(_<3?m(g):_>3?m(i,r,g):m(i,r))||g);return _>3&&g&&Object.defineProperty(i,r,g),g},l=this&&this.__param||function(s,i){return function(r,u){i(r,u,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=a(3656),c=a(4725),f=a(8460),v=a(844),o=a(2585);let e=t.Viewport=class extends v.Disposable{constructor(s,i,r,u,m,_,g,d){super(),this._viewportElement=s,this._scrollArea=i,this._bufferService=r,this._optionsService=u,this._charSizeService=m,this._renderService=_,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((p=>this._activeBuffer=p.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((p=>this._renderDimensions=p))),this._handleThemeChange(d.colors),this.register(d.onChangeColors((p=>this._handleThemeChange(p)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.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(s){if(s)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 s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){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 s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<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(s,i){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&r<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){const i=this._getPixelsScrolled(s);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(s,i))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=s*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:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let i=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(s,i){var d;let r,u="";const m=[],_=i??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let p=s;p<_;p++){const S=g.get(p);if(!S)continue;const y=(d=g.get(p+1))==null?void 0:d.isWrapped;if(u+=S.translateToString(!y),!y||p===g.length-1){const b=document.createElement("div");b.textContent=u,m.push(b),u.length>0&&(r=b),u=""}}return{bufferElements:m,cursorElement:r}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let i=this._applyScrollModifier(s.deltaY,s);return s.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):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(s,i){const r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&i.altKey||r==="ctrl"&&i.ctrlKey||r==="shift"&&i.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){const i=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(s,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(R,t,a){var h=this&&this.__decorate||function(o,e,s,i){var r,u=arguments.length,m=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(o,e,s,i);else for(var _=o.length-1;_>=0;_--)(r=o[_])&&(m=(u<3?r(m):u>3?r(e,s,m):r(e,s))||m);return u>3&&m&&Object.defineProperty(e,s,m),m},l=this&&this.__param||function(o,e){return function(s,i){e(s,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=a(4725),c=a(844),f=a(2585);let v=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,s,i,r){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=s,this._decorationService=i,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((u=>this._removeDecoration(u)))),this.register((0,c.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=o==null?void 0:o.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const s=o.options.x??0;return s&&s>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 s=this._decorationElements.get(o);s||(s=this._createElement(o),o.element=s,this._decorationElements.set(o,s),this._container.appendChild(s),o.onDispose((()=>{this._decorationElements.delete(o),s.remove()}))),s.style.top=e*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(s)}}_refreshXPosition(o,e=o.element){if(!e)return;const s=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=s?s*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([l(1,f.IBufferService),l(2,n.ICoreBrowserService),l(3,f.IDecorationService),l(4,n.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,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(R,t,a){var h=this&&this.__decorate||function(r,u,m,_){var g,d=arguments.length,p=d<3?u:_===null?_=Object.getOwnPropertyDescriptor(u,m):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,u,m,_);else for(var S=r.length-1;S>=0;S--)(g=r[S])&&(p=(d<3?g(p):d>3?g(u,m,p):g(u,m))||p);return d>3&&p&&Object.defineProperty(u,m,p),p},l=this&&this.__param||function(r,u){return function(m,_){u(m,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=a(5871),c=a(4725),f=a(844),v=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,u,m,_,g,d,p){var y;super(),this._viewportElement=r,this._screenElement=u,this._bufferService=m,this._decorationService=_,this._renderService=g,this._optionsService=d,this._coreBrowserService=p,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(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,f.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 r=Math.floor(this._canvas.width/3),u=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=r,e.center=u,e.right=r,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=e.left,s.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const r=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);o.left=u,o.center=u,o.right=u}_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 u of this._decorationService.decorations)this._colorZoneStore.addDecoration(u);this._ctx.lineWidth=1;const r=this._colorZoneStore.zones;for(const u of r)u.position!=="full"&&this._renderColorZone(u);for(const u of r)u.position==="full"&&this._renderColorZone(u);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(s[r.position||"full"],Math.round((this._canvas.height-1)*(r.startBufferLine/this._bufferService.buffers.active.lines.length)-o[r.position||"full"]/2),e[r.position||"full"],Math.round((this._canvas.height-1)*((r.endBufferLine-r.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[r.position||"full"]))}_queueRefresh(r,u){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=u||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=i=h([l(2,v.IBufferService),l(3,v.IDecorationService),l(4,c.IRenderService),l(5,v.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(R,t,a){var h=this&&this.__decorate||function(o,e,s,i){var r,u=arguments.length,m=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(o,e,s,i);else for(var _=o.length-1;_>=0;_--)(r=o[_])&&(m=(u<3?r(m):u>3?r(e,s,m):r(e,s))||m);return u>3&&m&&Object.defineProperty(e,s,m),m},l=this&&this.__param||function(o,e){return function(s,i){e(s,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=a(4725),c=a(2585),f=a(2584);let v=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,s,i,r,u){this._textarea=o,this._compositionView=e,this._bufferService=s,this._optionsService=i,this._coreService=r,this._renderService=u,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 s;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=e.replace(o,"");this._dataAlreadySent=s,e.length>o.length?this._coreService.triggerDataEvent(s,!0):e.length<o.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}}),0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const u=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(u.width,1)+"px",this._textarea.style.height=Math.max(u.height,1)+"px",this._textarea.style.lineHeight=u.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=v=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,n.IRenderService)],v)},9806:(R,t)=>{function a(h,l,n){const c=n.getBoundingClientRect(),f=h.getComputedStyle(n),v=parseInt(f.getPropertyValue("padding-left")),o=parseInt(f.getPropertyValue("padding-top"));return[l.clientX-c.left-v,l.clientY-c.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,n,c,f,v,o,e,s){if(!v)return;const i=a(h,l,n);return i?(i[0]=Math.ceil((i[0]+(s?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(s?1:0)),i[1]=Math.min(Math.max(i[1],1),f),i):void 0}},9504:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,s,i,r){const u=e-n(e,i),m=s-n(s,i),_=Math.abs(u-m)-(function(g,d,p){let S=0;const y=g-n(g,p),b=d-n(d,p);for(let w=0;w<Math.abs(y-b);w++){const x=c(g,d)==="A"?-1:1,I=p.buffer.lines.get(y+x*w);I!=null&&I.isWrapped&&S++}return S})(e,s,i);return o(_,v(c(e,s),r))}function n(e,s){let i=0,r=s.buffer.lines.get(e),u=r==null?void 0:r.isWrapped;for(;u&&e>=0&&e<s.rows;)i++,r=s.buffer.lines.get(--e),u=r==null?void 0:r.isWrapped;return i}function c(e,s){return e>s?"A":"B"}function f(e,s,i,r,u,m){let _=e,g=s,d="";for(;_!==i||g!==r;)_+=u?1:-1,u&&_>m.cols-1?(d+=m.buffer.translateBufferLineToString(g,!1,e,_),_=0,e=0,g++):!u&&_<0&&(d+=m.buffer.translateBufferLineToString(g,!1,0,e+1),_=m.cols-1,e=_,g--);return d+m.buffer.translateBufferLineToString(g,!1,e,_)}function v(e,s){const i=s?"O":"[";return h.C0.ESC+i+e}function o(e,s){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=s;return i}t.moveToCellSequence=function(e,s,i,r){const u=i.buffer.x,m=i.buffer.y;if(!i.buffer.hasScrollback)return(function(d,p,S,y,b,w){return l(p,y,b,w).length===0?"":o(f(d,p,d,p-n(p,b),!1,b).length,v("D",w))})(u,m,0,s,i,r)+l(m,s,i,r)+(function(d,p,S,y,b,w){let x;x=l(p,y,b,w).length>0?y-n(y,b):p;const I=y,W=(function(H,O,C,L,D,T){let U;return U=l(C,L,D,T).length>0?L-n(L,D):O,H<C&&U<=L||H>=C&&U<L?"C":"D"})(d,p,S,y,b,w);return o(f(d,x,S,I,W==="C",b).length,v(W,w))})(u,m,e,s,i,r);let _;if(m===s)return _=u>e?"D":"C",o(Math.abs(u-e),v(_,r));_=m>s?"D":"C";const g=Math.abs(m-s);return o((function(d,p){return p.cols-d})(m>s?e:u,i)+(g-1)*i.cols+1+((m>s?u:e)-1),v(_,r))}},1296:function(R,t,a){var h=this&&this.__decorate||function(w,x,I,W){var H,O=arguments.length,C=O<3?x:W===null?W=Object.getOwnPropertyDescriptor(x,I):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,x,I,W);else for(var L=w.length-1;L>=0;L--)(H=w[L])&&(C=(O<3?H(C):O>3?H(x,I,C):H(x,I))||C);return O>3&&C&&Object.defineProperty(x,I,C),C},l=this&&this.__param||function(w,x){return function(I,W){x(I,W,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=a(3787),c=a(2550),f=a(2223),v=a(6171),o=a(6052),e=a(4725),s=a(8055),i=a(8460),r=a(844),u=a(2585),m="xterm-dom-renderer-owner-",_="xterm-rows",g="xterm-fg-",d="xterm-bg-",p="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends r.Disposable{constructor(w,x,I,W,H,O,C,L,D,T,U,j,X){super(),this._terminal=w,this._document=x,this._element=I,this._screenElement=W,this._viewportElement=H,this._helperContainer=O,this._linkifier2=C,this._charSizeService=D,this._optionsService=T,this._bufferService=U,this._coreBrowserService=j,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(_),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((K=>this._injectCss(K)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(m+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((K=>this._handleLinkHover(K)))),this.register(this._linkifier2.onHideLinkUnderline((K=>this._handleLinkLeave(K)))),this.register((0,r.toDisposable)((()=>{this._element.classList.remove(m+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new c.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const 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} .${_} 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} .${_} { 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} .${_} .xterm-dim { color: ${s.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}`,W=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;x+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,x+=`@keyframes ${W} { 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} .${_}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${_}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${_}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${_} .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[O,C]of w.ansi.entries())x+=`${this._terminalSelector} .${g}${O} { color: ${C.css}; }${this._terminalSelector} .${g}${O}.xterm-dim { color: ${s.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${d}${O} { background-color: ${C.css}; }`;x+=`${this._terminalSelector} .${g}${f.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(w.background).css}; }${this._terminalSelector} .${g}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${d}${f.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 W=this._document.createElement("div");this._rowContainer.appendChild(W),this._rowElements.push(W)}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(p),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(p),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 W=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,O=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(O>=this._bufferService.rows||C<0)return;const L=this._document.createDocumentFragment();if(I){const D=w[0]>x[0];L.appendChild(this._createSelectionElement(O,D?x[0]:w[0],D?w[0]:x[0],C-O+1))}else{const D=W===O?w[0]:0,T=O===H?x[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(O,D,T));const U=C-O-1;if(L.appendChild(this._createSelectionElement(O+1,0,this._bufferService.cols,U)),O!==C){const j=H===C?x[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,j))}}this._selectionContainer.appendChild(L)}_createSelectionElement(w,x,I,W=1){const H=this._document.createElement("div"),O=x*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(I-x);return O+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-O),H.style.height=W*this.dimensions.css.cell.height+"px",H.style.top=w*this.dimensions.css.cell.height+"px",H.style.left=`${O}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,W=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),O=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],j=I.lines.get(T);if(!U||!j)break;U.replaceChildren(...this._rowFactory.createRow(j,T,T===W,C,L,H,O,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${m}${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,W,H,O){I<0&&(w=0),W<0&&(x=0);const C=this._bufferService.rows-1;I=Math.max(Math.min(I,C),0),W=Math.max(Math.min(W,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,j=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let K=I;K<=W;++K){const M=K+L.ydisp,E=this._rowElements[K],z=L.lines.get(M);if(!E||!z)break;E.replaceChildren(...this._rowFactory.createRow(z,M,M===D,j,X,T,U,this.dimensions.css.cell.width,this._widthCache,O?K===I?w:0:-1,O?(K===W?x:H)-1:-1))}}};t.DomRenderer=b=h([l(7,u.IInstantiationService),l(8,e.ICharSizeService),l(9,u.IOptionsService),l(10,u.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],b)},3787:function(R,t,a){var h=this&&this.__decorate||function(_,g,d,p){var S,y=arguments.length,b=y<3?g:p===null?p=Object.getOwnPropertyDescriptor(g,d):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,g,d,p);else for(var w=_.length-1;w>=0;w--)(S=_[w])&&(b=(y<3?S(b):y>3?S(g,d,b):S(g,d))||b);return y>3&&b&&Object.defineProperty(g,d,b),b},l=this&&this.__param||function(_,g){return function(d,p){g(d,p,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=a(2223),c=a(643),f=a(511),v=a(2585),o=a(8055),e=a(4725),s=a(4269),i=a(6171),r=a(3734);let u=t.DomRendererRowFactory=class{constructor(_,g,d,p,S,y,b){this._document=_,this._characterJoinerService=g,this._optionsService=d,this._coreBrowserService=p,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(_,g,d){this._selectionStart=_,this._selectionEnd=g,this._columnSelectMode=d}createRow(_,g,d,p,S,y,b,w,x,I,W){const H=[],O=this._characterJoinerService.getJoinedCharacters(g),C=this._themeService.colors;let L,D=_.getNoBgTrimmedLength();d&&D<y+1&&(D=y+1);let T=0,U="",j=0,X=0,K=0,M=!1,E=0,z=!1,N=0;const G=[],q=I!==-1&&W!==-1;for(let Z=0;Z<D;Z++){_.loadCell(Z,this._workCell);let Y=this._workCell.getWidth();if(Y===0)continue;let re=!1,he=Z,J=this._workCell;if(O.length>0&&Z===O[0][0]){re=!0;const Q=O.shift();J=new s.JoinedCellData(this._workCell,_.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),he=Q[1]-1,Y=J.getWidth()}const ue=this._isCellInSelection(Z,g),fe=d&&Z===y,se=q&&Z>=I&&Z<=W;let ee=!1;this._decorationService.forEachDecorationAtCell(Z,g,void 0,(Q=>{ee=!0}));let te=J.getChars()||c.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===j)&&(ue&&z&&C.selectionForeground||J.fg===X)&&J.extended.ext===K&&se===M&&N===E&&!fe&&!re&&!ee){J.isInvisible()?U+=c.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(j=J.bg,X=J.fg,K=J.extended.ext,M=se,E=N,z=ue,re&&y>=Z&&y<=he&&(y=Z),!this._coreService.isCursorHidden&&fe&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&G.push("xterm-cursor-blink"),G.push(p==="bar"?"xterm-cursor-bar":p==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline")}}if(J.isBold()&&G.push("xterm-bold"),J.isItalic()&&G.push("xterm-italic"),J.isDim()&&G.push("xterm-dim"),U=J.isInvisible()?c.WHITESPACE_CELL_CHAR:J.getChars()||c.WHITESPACE_CELL_CHAR,J.isUnderline()&&(G.push(`xterm-underline-${J.extended.underlineStyle}`),U===" "&&(U=" "),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${r.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()&&(G.push("xterm-overline"),U===" "&&(U=" ")),J.isStrikethrough()&&G.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,g,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&&G.push("xterm-decoration-top"),oe){case 16777216:case 33554432:ce=C.ansi[ae],G.push(`xterm-bg-${ae}`);break;case 50331648:ce=o.channels.toColor(ae>>16,ae>>8&255,255&ae),this._addStyle(L,`background-color:#${m((ae>>>0).toString(16),"0",6)}`);break;default:_e?(ce=C.foreground,G.push(`xterm-bg-${n.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)||G.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:#${m(V.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,ce,C.foreground,J,le,de)||_e&&G.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}G.length&&(L.className=G.join(" "),G.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(_,g,d,p,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(p.getCode()))return!1;const b=this._getContrastCache(p);let w;if(S||y||(w=b.getColor(g.rgba,d.rgba)),w===void 0){const x=this._optionsService.rawOptions.minimumContrastRatio/(p.isDim()?2:1);w=o.color.ensureContrastRatio(S||g,y||d,x),b.setColor((S||g).rgba,(y||d).rgba,w??null)}return!!w&&(this._addStyle(_,`color:${w.css}`),!0)}_getContrastCache(_){return _.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(_,g){_.setAttribute("style",`${_.getAttribute("style")||""}${g};`)}_isCellInSelection(_,g){const d=this._selectionStart,p=this._selectionEnd;return!(!d||!p)&&(this._columnSelectMode?d[0]<=p[0]?_>=d[0]&&g>=d[1]&&_<p[0]&&g<=p[1]:_<d[0]&&g>=d[1]&&_>=p[0]&&g<=p[1]:g>d[1]&&g<p[1]||d[1]===p[1]&&g===d[1]&&_>=d[0]&&_<p[0]||d[1]<p[1]&&g===p[1]&&_<p[0]||d[1]<p[1]&&g===d[1]&&_>=d[0])}};function m(_,g,d){for(;_.length<d;)_=g+_;return _}t.DomRendererRowFactory=u=h([l(1,e.ICharacterJoinerService),l(2,v.IOptionsService),l(3,e.ICoreBrowserService),l(4,v.ICoreService),l(5,v.IDecorationService),l(6,e.IThemeService)],u)},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 l=a.createElement("span");l.classList.add("xterm-char-measure-element");const n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const f=a.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[l,n,c,f],this._container.appendChild(l),this._container.appendChild(n),this._container.appendChild(c),this._container.appendChild(f),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,h,l,n){a===this._font&&h===this._fontSize&&l===this._weight&&n===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(a,h,l){let n=0;if(!h&&!l&&a.length===1&&(n=a.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const v=this._measure(a,0);return v>0&&(this._flat[n]=v),v}let c=a;h&&(c+="B"),l&&(c+="I");let f=this._holey.get(c);if(f===void 0){let v=0;h&&(v|=1),l&&(v|=2),f=this._measure(a,v),f>0&&this._holey.set(c,f)}return f}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(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(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,c,f){return n===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!(function(v){return 57344<=v&&v<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(n){return 9472<=n&&n<=9631})(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},6052:(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(l,n,c,f=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const v=l.buffers.active.ydisp,o=n[1]-v,e=c[1]-v,s=Math.max(o,0),i=Math.min(e,l.rows-1);s>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=s,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(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,r,u,m){var _,g=arguments.length,d=g<3?r:m===null?m=Object.getOwnPropertyDescriptor(r,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,m);else for(var p=i.length-1;p>=0;p--)(_=i[p])&&(d=(g<3?_(d):g>3?_(r,u,d):_(r,u))||d);return g>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,m){r(u,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=a(2585),c=a(8460),f=a(844);let v=t.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,r,u){super(),this._optionsService=u,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=v=h([l(2,n.IOptionsService)],v);class o extends f.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,u){r!==void 0&&r>0&&u!==void 0&&u>0&&(this._result.width=r,this._result.height=u)}}class e extends o{constructor(r,u,m){super(),this._document=r,this._parentElement=u,this._optionsService=m,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 s extends o{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const u=this._ctx.measureText("W");if(!("width"in u&&"fontBoundingBoxAscent"in u&&"fontBoundingBoxDescent"in u))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const r=this._ctx.measureText("W");return this._validateAndSet(r.width,r.fontBoundingBoxAscent+r.fontBoundingBoxDescent),this._result}}},4269:function(R,t,a){var h=this&&this.__decorate||function(s,i,r,u){var m,_=arguments.length,g=_<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,r):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,i,r,u);else for(var d=s.length-1;d>=0;d--)(m=s[d])&&(g=(_<3?m(g):_>3?m(i,r,g):m(i,r))||g);return _>3&&g&&Object.defineProperty(i,r,g),g},l=this&&this.__param||function(s,i){return function(r,u){i(r,u,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=a(3734),c=a(643),f=a(511),v=a(2585);class o extends n.AttributeData{constructor(i,r,u){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=r,this._width=u}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 He{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(i){const r={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(r),r.id}deregister(i){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===i)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const r=this._bufferService.buffer.lines.get(i);if(!r||r.length===0)return[];const u=[],m=r.translateToString(!0);let _=0,g=0,d=0,p=r.getFg(0),S=r.getBg(0);for(let y=0;y<r.getTrimmedLength();y++)if(r.loadCell(y,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==S){if(y-_>1){const b=this._getJoinedRanges(m,d,g,r,_);for(let w=0;w<b.length;w++)u.push(b[w])}_=y,d=g,p=this._workCell.fg,S=this._workCell.bg}g+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-_>1){const y=this._getJoinedRanges(m,d,g,r,_);for(let b=0;b<y.length;b++)u.push(y[b])}return u}_getJoinedRanges(i,r,u,m,_){const g=i.substring(r,u);let d=[];try{d=this._characterJoiners[0].handler(g)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{const S=this._characterJoiners[p].handler(g);for(let y=0;y<S.length;y++)He._mergeRanges(d,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(d,m,_),d}_stringRangesToCellRanges(i,r,u){let m=0,_=!1,g=0,d=i[m];if(d){for(let p=u;p<this._bufferService.cols;p++){const S=r.getWidth(p),y=r.getString(p).length||c.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!_&&d[0]<=g&&(d[0]=p,_=!0),d[1]<=g){if(d[1]=p,d=i[++m],!d)break;d[0]<=g?(d[0]=p,_=!0):_=!1}g+=y}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(i,r){let u=!1;for(let m=0;m<i.length;m++){const _=i[m];if(u){if(r[1]<=_[0])return i[m-1][1]=r[1],i;if(r[1]<=_[1])return i[m-1][1]=Math.max(r[1],_[1]),i.splice(m,1),i;i.splice(m,1),m--}else{if(r[1]<=_[0])return i.splice(m,0,r),i;if(r[1]<=_[1])return _[0]=Math.min(r[0],_[0]),i;r[0]<_[1]&&(_[0]=Math.min(r[0],_[0]),u=!0)}}return u?i[i.length-1][1]=r[1]:i.push(r),i}};t.CharacterJoinerService=e=h([l(0,v.IBufferService)],e)},5114:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),n=a(3656);class c extends h.Disposable{constructor(o,e,s){super(),this._textarea=o,this._window=e,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((i=>this._screenDprMonitor.setWindow(i)))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=c;class f extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)((()=>this.clearListener())))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const f=this.linkProviders.indexOf(c);f!==-1&&this.linkProviders.splice(f,1)}}}}t.LinkProviderService=l},8934:function(R,t,a){var h=this&&this.__decorate||function(v,o,e,s){var i,r=arguments.length,u=r<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(v,o,e,s);else for(var m=v.length-1;m>=0;m--)(i=v[m])&&(u=(r<3?i(u):r>3?i(o,e,u):i(o,e))||u);return r>3&&u&&Object.defineProperty(o,e,u),u},l=this&&this.__param||function(v,o){return function(e,s){o(e,s,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=a(4725),c=a(9806);let f=t.MouseService=class{constructor(v,o){this._renderService=v,this._charSizeService=o}getCoords(v,o,e,s,i){return(0,c.getCoords)(window,v,o,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(v,o){const e=(0,c.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=f=h([l(0,n.IRenderService),l(1,n.ICharSizeService)],f)},3230:function(R,t,a){var h=this&&this.__decorate||function(i,r,u,m){var _,g=arguments.length,d=g<3?r:m===null?m=Object.getOwnPropertyDescriptor(r,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,m);else for(var p=i.length-1;p>=0;p--)(_=i[p])&&(d=(g<3?_(d):g>3?_(r,u,d):_(r,u))||d);return g>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,m){r(u,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=a(6193),c=a(4725),f=a(8460),v=a(844),o=a(7226),e=a(2585);let s=t.RenderService=class extends v.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,r,u,m,_,g,d,p){super(),this._rowCount=i,this._charSizeService=m,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 f.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new f.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new f.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new f.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((S,y)=>this._renderRows(S,y)),d),this.register(this._renderDebouncer),this.register(d.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(g.onResize((()=>this._fullRefresh()))),this.register(g.buffers.onBufferActivate((()=>{var S;return(S=this._renderer.value)==null?void 0:S.clear()}))),this.register(u.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(_.onDecorationRegistered((()=>this._fullRefresh()))),this.register(_.onDecorationRemoved((()=>this._fullRefresh()))),this.register(u.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(u.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(g.buffer.y,g.buffer.y,!0)))),this.register(p.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(d.window,r),this.register(d.onWindowChange((S=>this._registerIntersectionObserver(S,r))))}_registerIntersectionObserver(i,r){if("IntersectionObserver"in i){const u=new i.IntersectionObserver((m=>this._handleIntersectionChange(m[m.length-1])),{threshold:0});u.observe(r),this._observerDisposable.value=(0,v.toDisposable)((()=>u.disconnect()))}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,r,u=!1){this._isPaused?this._needsFullRefresh=!0:(u||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,r,this._rowCount))}_renderRows(i,r){this._renderer.value&&(i=Math.min(i,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(i,r),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:r}),this._onRender.fire({start:i,end:r}),this._isNextRenderRedrawOnly=!0)}resize(i,r){this._rowCount=r,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw((r=>this.refreshRows(r.start,r.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,r;this._renderer.value&&((r=(i=this._renderer.value).clearTextureAtlas)==null||r.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var u;return(u=this._renderer.value)==null?void 0:u.handleResize(i,r)})):this._renderer.value.handleResize(i,r),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,r,u){var m;this._selectionState.start=i,this._selectionState.end=r,this._selectionState.columnSelectMode=u,(m=this._renderer.value)==null||m.handleSelectionChanged(i,r,u)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=s=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],s)},9312:function(R,t,a){var h=this&&this.__decorate||function(d,p,S,y){var b,w=arguments.length,x=w<3?p:y===null?y=Object.getOwnPropertyDescriptor(p,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(d,p,S,y);else for(var I=d.length-1;I>=0;I--)(b=d[I])&&(x=(w<3?b(x):w>3?b(p,S,x):b(p,S))||x);return w>3&&x&&Object.defineProperty(p,S,x),x},l=this&&this.__param||function(d,p){return function(S,y){p(S,y,d)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=a(9806),c=a(9504),f=a(456),v=a(4725),o=a(8460),e=a(844),s=a(6114),i=a(4841),r=a(511),u=a(2585),m=" ",_=new RegExp(m,"g");let g=t.SelectionService=class extends e.Disposable{constructor(d,p,S,y,b,w,x,I,W){super(),this._element=d,this._screenElement=p,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=x,this._renderService=I,this._coreBrowserService=W,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new r.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new 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 f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const d=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;return!(!d||!p||d[0]===p[0]&&d[1]===p[1])}get selectionText(){const d=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;if(!d||!p)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(d[0]===p[0])return"";const b=d[0]<p[0]?d[0]:p[0],w=d[0]<p[0]?p[0]:d[0];for(let x=d[1];x<=p[1];x++){const I=S.translateBufferLineToString(x,!0,b,w);y.push(I)}}else{const b=d[1]===p[1]?p[0]:void 0;y.push(S.translateBufferLineToString(d[1],!0,d[0],b));for(let w=d[1]+1;w<=p[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(d[1]!==p[1]){const w=S.lines.get(p[1]),x=S.translateBufferLineToString(p[1],!0,0,p[0]);w&&w.isWrapped?y[y.length-1]+=x:y.push(x)}}return y.map((b=>b.replace(_," "))).join(s.isWindows?`\r
8
- `:`
9
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(d){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),s.isLinux&&d&&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(d){const p=this._getMouseBufferCoords(d),S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(S&&y&&p)&&this._areCoordsInSelection(p,S,y)}isCellInSelection(d,p){const S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y)&&this._areCoordsInSelection([d,p],S,y)}_areCoordsInSelection(d,p,S){return d[1]>p[1]&&d[1]<S[1]||p[1]===S[1]&&d[1]===p[1]&&d[0]>=p[0]&&d[0]<S[0]||p[1]<S[1]&&d[1]===S[1]&&d[0]<S[0]||p[1]<S[1]&&d[1]===p[1]&&d[0]>=p[0]}_selectWordAtCursor(d,p){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(d);return!!y&&(this._selectWordAt(y,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(d,p){this._model.clearSelection(),d=Math.max(d,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,d],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(d){this._model.handleTrim(d)&&this.refresh()}_getMouseBufferCoords(d){const p=this._mouseService.getCoords(d,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(d){let p=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,d,this._screenElement)[1];const S=this._renderService.dimensions.css.canvas.height;return p>=0&&p<=S?0:(p>S&&(p-=S),p=Math.min(Math.max(p,-50),50),p/=50,p/Math.abs(p)+Math.round(14*p))}shouldForceSelection(d){return s.isMac?d.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:d.shiftKey}handleMouseDown(d){if(this._mouseDownTimeStamp=d.timeStamp,(d.button!==2||!this.hasSelection)&&d.button===0){if(!this._enabled){if(!this.shouldForceSelection(d))return;d.stopPropagation()}d.preventDefault(),this._dragScrollAmount=0,this._enabled&&d.shiftKey?this._handleIncrementalClick(d):d.detail===1?this._handleSingleClick(d):d.detail===2?this._handleDoubleClick(d):d.detail===3&&this._handleTripleClick(d),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(d){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(d))}_handleSingleClick(d){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(d)?3:0,this._model.selectionStart=this._getMouseBufferCoords(d),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const p=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);p&&p.length!==this._model.selectionStart[0]&&p.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(d){this._selectWordAtCursor(d,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(d){const p=this._getMouseBufferCoords(d);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(d){return d.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(d){if(d.stopImmediatePropagation(),!this._model.selectionStart)return;const p=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(d),!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(d),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]++}p&&p[0]===this._model.selectionEnd[0]&&p[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 d=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(d.ydisp+this._bufferService.rows,d.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=d.ydisp),this.refresh()}}_handleMouseUp(d){const p=d.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&p<500&&d.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(d,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const y=(0,c.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(y,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const d=this._model.finalSelectionStart,p=this._model.finalSelectionEnd,S=!(!d||!p||d[0]===p[0]&&d[1]===p[1]);S?d&&p&&(this._oldSelectionStart&&this._oldSelectionEnd&&d[0]===this._oldSelectionStart[0]&&d[1]===this._oldSelectionStart[1]&&p[0]===this._oldSelectionEnd[0]&&p[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(d,p,S)):this._oldHasSelection&&this._fireOnSelectionChange(d,p,S)}_fireOnSelectionChange(d,p,S){this._oldSelectionStart=d,this._oldSelectionEnd=p,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(d){this.clearSelection(),this._trimListener.dispose(),this._trimListener=d.activeBuffer.lines.onTrim((p=>this._handleTrim(p)))}_convertViewportColToCharacterIndex(d,p){let S=p;for(let y=0;p>=y;y++){const b=d.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&p!==y&&(S+=b-1)}return S}setSelection(d,p,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[d,p],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(d){this._isClickInSelection(d)||(this._selectWordAtCursor(d,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(d,p,S=!0,y=!0){if(d[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(d[1]);if(!w)return;const x=b.translateBufferLineToString(d[1],!1);let I=this._convertViewportColToCharacterIndex(w,d[0]),W=I;const H=d[0]-I;let O=0,C=0,L=0,D=0;if(x.charAt(I)===" "){for(;I>0&&x.charAt(I-1)===" ";)I--;for(;W<x.length&&x.charAt(W+1)===" ";)W++}else{let j=d[0],X=d[0];w.getWidth(j)===0&&(O++,j--),w.getWidth(X)===2&&(C++,X++);const K=w.getString(X).length;for(K>1&&(D+=K-1,W+=K-1);j>0&&I>0&&!this._isCharWordSeparator(w.loadCell(j-1,this._workCell));){w.loadCell(j-1,this._workCell);const M=this._workCell.getChars().length;this._workCell.getWidth()===0?(O++,j--):M>1&&(L+=M-1,I-=M-1),I--,j--}for(;X<w.length&&W+1<x.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);const M=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,X++):M>1&&(D+=M-1,W+=M-1),W++,X++}}W++;let T=I+H-O+L,U=Math.min(this._bufferService.cols,W-I+O+C-L-D);if(p||x.slice(I,W).trim()!==""){if(S&&T===0&&w.getCodePoint(0)!==32){const j=b.lines.get(d[1]-1);if(j&&w.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){const X=this._getWordAt([this._bufferService.cols-1,d[1]-1],!1,!0,!1);if(X){const K=this._bufferService.cols-X.start;T-=K,U+=K}}}if(y&&T+U===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){const j=b.lines.get(d[1]+1);if(j!=null&&j.isWrapped&&j.getCodePoint(0)!==32){const X=this._getWordAt([0,d[1]+1],!1,!1,!0);X&&(U+=X.length)}}return{start:T,length:U}}}_selectWordAt(d,p){const S=this._getWordAt(d,p);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,d[1]--;this._model.selectionStart=[S.start,d[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(d){const p=this._getWordAt(d,!0);if(p){let S=d[1];for(;p.start<0;)p.start+=this._bufferService.cols,S--;if(!this._model.areSelectionValuesReversed())for(;p.start+p.length>this._bufferService.cols;)p.length-=this._bufferService.cols,S++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?p.start:p.start+p.length,S]}}_isCharWordSeparator(d){return d.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars())>=0}_selectLineAt(d){const p=this._bufferService.buffer.getWrappedRangeForLine(d),S={start:{x:0,y:p.first},end:{x:this._bufferService.cols-1,y:p.last}};this._model.selectionStart=[0,p.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=g=h([l(3,u.IBufferService),l(4,u.ICoreService),l(5,v.IMouseService),l(6,u.IOptionsService),l(7,v.IRenderService),l(8,v.ICoreBrowserService)],g)},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(g,d,p,S){var y,b=arguments.length,w=b<3?d:S===null?S=Object.getOwnPropertyDescriptor(d,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(g,d,p,S);else for(var x=g.length-1;x>=0;x--)(y=g[x])&&(w=(b<3?y(w):b>3?y(d,p,w):y(d,p))||w);return b>3&&w&&Object.defineProperty(d,p,w),w},l=this&&this.__param||function(g,d){return function(p,S){d(p,S,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=a(7239),c=a(8055),f=a(8460),v=a(844),o=a(2585),e=c.css.toColor("#ffffff"),s=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),r=c.css.toColor("#000000"),u={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const g=[c.css.toColor("#2e3436"),c.css.toColor("#cc0000"),c.css.toColor("#4e9a06"),c.css.toColor("#c4a000"),c.css.toColor("#3465a4"),c.css.toColor("#75507b"),c.css.toColor("#06989a"),c.css.toColor("#d3d7cf"),c.css.toColor("#555753"),c.css.toColor("#ef2929"),c.css.toColor("#8ae234"),c.css.toColor("#fce94f"),c.css.toColor("#729fcf"),c.css.toColor("#ad7fa8"),c.css.toColor("#34e2e2"),c.css.toColor("#eeeeec")],d=[0,95,135,175,215,255];for(let p=0;p<216;p++){const S=d[p/36%6|0],y=d[p/6%6|0],b=d[p%6];g.push({css:c.channels.toCss(S,y,b),rgba:c.channels.toRgba(S,y,b)})}for(let p=0;p<24;p++){const S=8+10*p;g.push({css:c.channels.toCss(S,S,S),rgba:c.channels.toRgba(S,S,S)})}return g})());let m=t.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new f.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:s,cursor:i,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:u,selectionBackgroundOpaque:c.color.blend(s,u),selectionInactiveBackgroundTransparent:u,selectionInactiveBackgroundOpaque:c.color.blend(s,u),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(g={}){const d=this._colors;if(d.foreground=_(g.foreground,e),d.background=_(g.background,s),d.cursor=_(g.cursor,i),d.cursorAccent=_(g.cursorAccent,r),d.selectionBackgroundTransparent=_(g.selectionBackground,u),d.selectionBackgroundOpaque=c.color.blend(d.background,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundTransparent=_(g.selectionInactiveBackground,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundOpaque=c.color.blend(d.background,d.selectionInactiveBackgroundTransparent),d.selectionForeground=g.selectionForeground?_(g.selectionForeground,c.NULL_COLOR):void 0,d.selectionForeground===c.NULL_COLOR&&(d.selectionForeground=void 0),c.color.isOpaque(d.selectionBackgroundTransparent)&&(d.selectionBackgroundTransparent=c.color.opacity(d.selectionBackgroundTransparent,.3)),c.color.isOpaque(d.selectionInactiveBackgroundTransparent)&&(d.selectionInactiveBackgroundTransparent=c.color.opacity(d.selectionInactiveBackgroundTransparent,.3)),d.ansi=t.DEFAULT_ANSI_COLORS.slice(),d.ansi[0]=_(g.black,t.DEFAULT_ANSI_COLORS[0]),d.ansi[1]=_(g.red,t.DEFAULT_ANSI_COLORS[1]),d.ansi[2]=_(g.green,t.DEFAULT_ANSI_COLORS[2]),d.ansi[3]=_(g.yellow,t.DEFAULT_ANSI_COLORS[3]),d.ansi[4]=_(g.blue,t.DEFAULT_ANSI_COLORS[4]),d.ansi[5]=_(g.magenta,t.DEFAULT_ANSI_COLORS[5]),d.ansi[6]=_(g.cyan,t.DEFAULT_ANSI_COLORS[6]),d.ansi[7]=_(g.white,t.DEFAULT_ANSI_COLORS[7]),d.ansi[8]=_(g.brightBlack,t.DEFAULT_ANSI_COLORS[8]),d.ansi[9]=_(g.brightRed,t.DEFAULT_ANSI_COLORS[9]),d.ansi[10]=_(g.brightGreen,t.DEFAULT_ANSI_COLORS[10]),d.ansi[11]=_(g.brightYellow,t.DEFAULT_ANSI_COLORS[11]),d.ansi[12]=_(g.brightBlue,t.DEFAULT_ANSI_COLORS[12]),d.ansi[13]=_(g.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),d.ansi[14]=_(g.brightCyan,t.DEFAULT_ANSI_COLORS[14]),d.ansi[15]=_(g.brightWhite,t.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){const p=Math.min(d.ansi.length-16,g.extendedAnsi.length);for(let S=0;S<p;S++)d.ansi[S+16]=_(g.extendedAnsi[S],t.DEFAULT_ANSI_COLORS[S+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(g){this._restoreColor(g),this._onChangeColors.fire(this.colors)}_restoreColor(g){if(g!==void 0)switch(g){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[g]=this._restoreColors.ansi[g]}else for(let d=0;d<this._restoreColors.ansi.length;++d)this._colors.ansi[d]=this._restoreColors.ansi[d]}modifyColors(g){g(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function _(g,d){if(g!==void 0)try{return c.css.toColor(g)}catch{}return d}t.ThemeService=m=h([l(0,o.IOptionsService)],m)},6349:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class n extends l.Disposable{constructor(f){super(),this._maxLength=f,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(f){if(this._maxLength===f)return;const v=new Array(f);for(let o=0;o<Math.min(f,this.length);o++)v[o]=this._array[this._getCyclicIndex(o)];this._array=v,this._maxLength=f,this._startIndex=0}get length(){return this._length}set length(f){if(f>this._length)for(let v=this._length;v<f;v++)this._array[v]=void 0;this._length=f}get(f){return this._array[this._getCyclicIndex(f)]}set(f,v){this._array[this._getCyclicIndex(f)]=v}push(f){this._array[this._getCyclicIndex(this._length)]=f,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(f,v,...o){if(v){for(let e=f;e<this._length-v;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+v)];this._length-=v,this.onDeleteEmitter.fire({index:f,amount:v})}for(let e=this._length-1;e>=f;e--)this._array[this._getCyclicIndex(e+o.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<o.length;e++)this._array[this._getCyclicIndex(f+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:f,amount:o.length}),this._length+o.length>this._maxLength){const e=this._length+o.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=o.length}trimStart(f){f>this._length&&(f=this._length),this._startIndex+=f,this._length-=f,this.onTrimEmitter.fire(f)}shiftElements(f,v,o){if(!(v<=0)){if(f<0||f>=this._length)throw new Error("start argument out of range");if(f+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let s=v-1;s>=0;s--)this.set(f+s+o,this.get(f+s));const e=f+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(f+e+o,this.get(f+e))}}_getCyclicIndex(f){return(this._startIndex+f)%this._maxLength}}t.CircularList=n},1439:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,l=5){if(typeof h!="object")return h;const n=Array.isArray(h)?[]:{};for(const c in h)n[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return n}},8055:(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,l=0,n=0;var c,f,v,o,e;function s(r){const u=r.toString(16);return u.length<2?"0"+u:u}function i(r,u){return r<u?(u+.05)/(r+.05):(r+.05)/(u+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(u,m,_,g){return g!==void 0?`#${s(u)}${s(m)}${s(_)}${s(g)}`:`#${s(u)}${s(m)}${s(_)}`},r.toRgba=function(u,m,_,g=255){return(u<<24|m<<16|_<<8|g)>>>0},r.toColor=function(u,m,_,g){return{css:r.toCss(u,m,_,g),rgba:r.toRgba(u,m,_,g)}}})(c||(t.channels=c={})),(function(r){function u(m,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(m.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}r.blend=function(m,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const g=_.rgba>>24&255,d=_.rgba>>16&255,p=_.rgba>>8&255,S=m.rgba>>24&255,y=m.rgba>>16&255,b=m.rgba>>8&255;return a=S+Math.round((g-S)*n),h=y+Math.round((d-y)*n),l=b+Math.round((p-b)*n),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},r.isOpaque=function(m){return(255&m.rgba)==255},r.ensureContrastRatio=function(m,_,g){const d=e.ensureContrastRatio(m.rgba,_.rgba,g);if(d)return c.toColor(d>>24&255,d>>16&255,d>>8&255)},r.opaque=function(m){const _=(255|m.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},r.opacity=u,r.multiplyOpacity=function(m,_){return n=255&m.rgba,u(m,n*_/255)},r.toColorRGB=function(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}})(f||(t.color=f={})),(function(r){let u,m;try{const _=document.createElement("canvas");_.width=1,_.height=1;const g=_.getContext("2d",{willReadFrequently:!0});g&&(u=g,u.globalCompositeOperation="copy",m=u.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const g=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return a=parseInt(g[1]),h=parseInt(g[2]),l=parseInt(g[3]),n=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),c.toColor(a,h,l,n);if(!u||!m)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=m,u.fillStyle=_,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,h,l,n]=u.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}})(v||(t.css=v={})),(function(r){function u(m,_,g){const d=m/255,p=_/255,S=g/255;return .2126*(d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4))+.7152*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}r.relativeLuminance=function(m){return u(m>>16&255,m>>8&255,255&m)},r.relativeLuminance2=u})(o||(t.rgb=o={})),(function(r){function u(_,g,d){const p=_>>24&255,S=_>>16&255,y=_>>8&255;let b=g>>24&255,w=g>>16&255,x=g>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;I<d&&(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(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}function m(_,g,d){const p=_>>24&255,S=_>>16&255,y=_>>8&255;let b=g>>24&255,w=g>>16&255,x=g>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;I<d&&(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(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}r.blend=function(_,g){if(n=(255&g)/255,n===1)return g;const d=g>>24&255,p=g>>16&255,S=g>>8&255,y=_>>24&255,b=_>>16&255,w=_>>8&255;return a=y+Math.round((d-y)*n),h=b+Math.round((p-b)*n),l=w+Math.round((S-w)*n),c.toRgba(a,h,l)},r.ensureContrastRatio=function(_,g,d){const p=o.relativeLuminance(_>>8),S=o.relativeLuminance(g>>8);if(i(p,S)<d){if(S<p){const w=u(_,g,d),x=i(p,o.relativeLuminance(w>>8));if(x<d){const I=m(_,g,d);return x>i(p,o.relativeLuminance(I>>8))?w:I}return w}const y=m(_,g,d),b=i(p,o.relativeLuminance(y>>8));if(b<d){const w=u(_,g,d);return b>i(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=u,r.increaseLuminance=m,r.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}})(e||(t.rgba=e={})),t.toPaddedHex=s,t.contrastRatio=i},8969:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),n=a(4348),c=a(7866),f=a(744),v=a(7302),o=a(6975),e=a(8460),s=a(1753),i=a(1480),r=a(7994),u=a(9282),m=a(5435),_=a(5981),g=a(2660);let d=!1;class p 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 n.InstantiationService,this.optionsService=this.register(new v.OptionsService(y)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(f.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new m.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 _.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<=l.LogLevelEnum.WARN&&!d&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d=!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,f.MINIMUM_COLS),b=Math.max(b,f.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(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),y.push(this.registerCsiHandler({final:"H"},(()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const b of y)b.dispose()}))}}}t.CoreTerminal=p},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 l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a((l=>h.fire(l)))},t.runAndSubscribe=function(a,h){return h(void 0),a((l=>h(l)))}},5435:function(R,t,a){var h=this&&this.__decorate||function(O,C,L,D){var T,U=arguments.length,j=U<3?C:D===null?D=Object.getOwnPropertyDescriptor(C,L):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(O,C,L,D);else for(var X=O.length-1;X>=0;X--)(T=O[X])&&(j=(U<3?T(j):U>3?T(C,L,j):T(C,L))||j);return U>3&&j&&Object.defineProperty(C,L,j),j},l=this&&this.__param||function(O,C){return function(L,D){C(L,D,O)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=a(2584),c=a(7116),f=a(2015),v=a(844),o=a(482),e=a(8437),s=a(8460),i=a(643),r=a(511),u=a(3734),m=a(2585),_=a(1480),g=a(6242),d=a(6351),p=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function b(O,C){if(O>24)return C.setWinLines||!1;switch(O){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(O){O[O.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",O[O.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,j,X,K,M=new f.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=D,this._logService=T,this._optionsService=U,this._oscLinkService=j,this._coreMouseService=X,this._unicodeService=K,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new r.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.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 W(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(n.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(n.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(n.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(n.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(n.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(n.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(n.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(n.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(n.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((E=>(this.setTitle(E),this.setIconName(E),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((E=>this.setIconName(E)))),this._parser.registerOscHandler(2,new g.OscHandler((E=>this.setTitle(E)))),this._parser.registerOscHandler(4,new g.OscHandler((E=>this.setOrReportIndexedColor(E)))),this._parser.registerOscHandler(8,new g.OscHandler((E=>this.setHyperlink(E)))),this._parser.registerOscHandler(10,new g.OscHandler((E=>this.setOrReportFgColor(E)))),this._parser.registerOscHandler(11,new g.OscHandler((E=>this.setOrReportBgColor(E)))),this._parser.registerOscHandler(12,new g.OscHandler((E=>this.setOrReportCursorColor(E)))),this._parser.registerOscHandler(104,new g.OscHandler((E=>this.restoreIndexedColor(E)))),this._parser.registerOscHandler(110,new g.OscHandler((E=>this.restoreFgColor(E)))),this._parser.registerOscHandler(111,new g.OscHandler((E=>this.restoreBgColor(E)))),this._parser.registerOscHandler(112,new g.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 c.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 d.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<=m.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,j=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&&(j=this._parseStack.position+y)}if(this._logService.logLevel<=m.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=j;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 K=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M,this._bufferService.rows-1),Math.min(K,this._bufferService.rows-1))}print(C,L,D){let T,U;const j=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,K=this._bufferService.cols,M=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 G=this._parser.precedingJoinState;for(let q=L;q<D;++q){if(T=C[q],T<127&&j){const he=j[String.fromCharCode(T)];he&&(T=he.charCodeAt(0))}const Z=this._unicodeService.charProperties(T,G);U=_.UnicodeService.extractWidth(Z);const Y=_.UnicodeService.extractShouldJoin(Z),re=Y?_.UnicodeService.extractWidth(G):0;if(G=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>K){if(M){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<K;)he.setCellFromCodepoint(J++,0,1,z)}else if(this._activeBuffer.x=K-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(K-1)===2&&N.setCellFromCodepoint(K-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=G,this._activeBuffer.x<K&&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 d.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new g.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 j=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);j.replaceCells(L,D,this._activeBuffer.getNullCell(this._eraseAttrData()),U),T&&(j.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=_.UnicodeService.extractWidth(L),U=this._activeBuffer.x-T,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),X=new Uint32Array(j.length*D);let K=0;for(let E=0;E<j.length;){const z=j.codePointAt(E)||0;X[K++]=z,E+=z>65535?2:1}let M=K;for(let E=1;E<D;++E)X.copyWithin(M,0,K),M+=K;return this.print(X,0,M),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.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,c.DEFAULT_CHARSET),this._charsetService.setgCharset(1,c.DEFAULT_CHARSET),this._charsetService.setgCharset(2,c.DEFAULT_CHARSET),this._charsetService.setgCharset(3,c.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(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,j=this._coreService,{buffers:X,cols:K}=this._bufferService,{active:M,alt:E}=X,z=this._optionsService.rawOptions,N=Y=>Y?1:2,G=C.params[0];return q=G,Z=L?G===2?4:G===4?N(j.modes.insertMode):G===12?3:G===20?N(z.convertEol):0:G===1?N(D.applicationCursorKeys):G===3?z.windowOptions.setWinLines?K===80?2:K===132?1:0:0:G===6?N(D.origin):G===7?N(D.wraparound):G===8?3:G===9?N(T==="X10"):G===12?N(z.cursorBlink):G===25?N(!j.isCursorHidden):G===45?N(D.reverseWraparound):G===66?N(D.applicationKeypad):G===67?4:G===1e3?N(T==="VT200"):G===1002?N(T==="DRAG"):G===1003?N(T==="ANY"):G===1004?N(D.sendFocus):G===1005?4:G===1006?N(U==="SGR"):G===1015?4:G===1016?N(U==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?N(M===E):G===2004?N(D.bracketedPasteMode):0,j.triggerDataEvent(`${n.C0.ESC}[${L?"":"?"}${q};${Z}$y`),!0;var q,Z}_updateAttrColor(C,L,D,T,U){return L===2?(C|=50331648,C&=-16777216,C|=u.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,j=0;do{if(T[j+U]=C.params[L+j],C.hasSubParams(L+j)){const X=C.getSubParams(L+j);let K=0;do T[1]===5&&(U=1),T[j+K+1+U]=X[K];while(++K<X.length&&K+j+1+U<T.length);break}if(T[1]===5&&j+U>=2||T[1]===2&&j+U>=5)break;T[1]&&(U=1)}while(++j+L<C.length&&j+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 j}_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(`${n.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.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(`${n.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(`${n.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 j=parseInt(T);if(H(j))if(U==="?")L.push({type:0,index:j});else{const X=(0,p.parseColor)(U);X&&L.push({type:1,index:j,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((j=>j.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,p.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,c.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],c.CHARSETS[C[1]]||c.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const 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 r.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(`${n.C0.ESC}${U}${n.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 W=class{constructor(O){this._bufferService=O,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(O){O<this.start?this.start=O:O>this.end&&(this.end=O)}markRangeDirty(O,C){O>C&&(x=O,O=C,C=x),O<this.start&&(this.start=O),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(O){return 0<=O&&O<256}W=h([l(0,m.IBufferService)],W)},844:(R,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,f){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,f)}get(h,l,n,c){var f;return(f=this._data.get(h,l))==null?void 0:f.get(n,c)}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 l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(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 l=this._getKey(h);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,l){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let l=0,n=this._array.length-1;for(;n>=l;){let c=l+n>>1;const f=this._getKey(this._array[c]);if(f>h)n=c-1;else{if(!(f<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(f){this._idleCallback=void 0;let v=0,o=0,e=f.timeRemaining(),s=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),s=f.timeRemaining(),1.5*o>s)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=s}this.clear()}}class n extends l{_requestCallback(f){return setTimeout((()=>f(this._createDeadline(16))))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const v=Date.now()+f;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(l){const n=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=n==null?void 0:n.get(l.cols-1),f=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);f&&c&&(f.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(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(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),n=a(3734),c=a(8437),f=a(4634),v=a(511),o=a(643),e=a(4863),s=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,r,u){this._hasScrollback=i,this._optionsService=r,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=c.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.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 l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,r){return new c.BufferLine(this._bufferService.cols,this.getNullCell(i),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const r=i+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,r){const u=this.getNullCell(c.DEFAULT_ATTR_DATA);let m=0;const _=this._getCorrectBufferLength(r);if(_>this.lines.maxLength&&(this.lines.maxLength=_),this.lines.length>0){if(this._cols<i)for(let d=0;d<this.lines.length;d++)m+=+this.lines.get(d).resize(i,u);let g=0;if(this._rows<r)for(let d=this._rows;d<r;d++)this.lines.length<r+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new c.BufferLine(i,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,u)));else for(let d=this._rows;d>r;d--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(_<this.lines.maxLength){const d=this.lines.length-_;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=_}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,r-1),g&&(this.y+=g),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(i,r),this._cols>i))for(let g=0;g<this.lines.length;g++)m+=+this.lines.get(g).resize(i,u);this._cols=i,this._rows=r,this._memoryCleanupQueue.clear(),m>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,r){this._cols!==i&&(i>this._cols?this._reflowLarger(i,r):this._reflowSmaller(i,r))}_reflowLarger(i,r){const u=(0,f.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(u.length>0){const m=(0,f.reflowLargerCreateNewLayout)(this.lines,u);(0,f.reflowLargerApplyNewLayout)(this.lines,m.layout),this._reflowLargerAdjustViewport(i,r,m.countRemoved)}}_reflowLargerAdjustViewport(i,r,u){const m=this.getNullCell(c.DEFAULT_ATTR_DATA);let _=u;for(;_-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new c.BufferLine(i,m))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(i,r){const u=this.getNullCell(c.DEFAULT_ATTR_DATA),m=[];let _=0;for(let g=this.lines.length-1;g>=0;g--){let d=this.lines.get(g);if(!d||!d.isWrapped&&d.getTrimmedLength()<=i)continue;const p=[d];for(;d.isWrapped&&g>0;)d=this.lines.get(--g),p.unshift(d);const S=this.ybase+this.y;if(S>=g&&S<g+p.length)continue;const y=p[p.length-1].getTrimmedLength(),b=(0,f.reflowSmallerGetNewLineLengths)(p,this._cols,i),w=b.length-p.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(c.DEFAULT_ATTR_DATA,!0);I.push(T)}I.length>0&&(m.push({start:g+p.length+_,newLines:I}),_+=I.length),p.push(...I);let W=b.length-1,H=b[W];H===0&&(W--,H=b[W]);let O=p.length-w-1,C=y;for(;O>=0;){const D=Math.min(C,H);if(p[W]===void 0)break;if(p[W].copyCellsFrom(p[O],C-D,H-D,D,!0),H-=D,H===0&&(W--,H=b[W]),C-=D,C===0){O--;const T=Math.max(O,0);C=(0,f.getWrappedLineTrimmedLength)(p,T,this._cols)}}for(let D=0;D<p.length;D++)b[D]<i&&p[D].setCell(b[D],u);let L=w-x;for(;L-- >0;)this.ybase===0?this.y<r-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+_)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(m.length>0){const g=[],d=[];for(let W=0;W<this.lines.length;W++)d.push(this.lines.get(W));const p=this.lines.length;let S=p-1,y=0,b=m[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+_);let w=0;for(let W=Math.min(this.lines.maxLength-1,p+_-1);W>=0;W--)if(b&&b.start>S+w){for(let H=b.newLines.length-1;H>=0;H--)this.lines.set(W--,b.newLines[H]);W++,g.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=m[++y]}else this.lines.set(W,d[S--]);let x=0;for(let W=g.length-1;W>=0;W--)g[W].index+=x,this.lines.onInsertEmitter.fire(g[W]),x+=g[W].amount;const I=Math.max(0,p+_-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(i,r,u=0,m){const _=this.lines.get(i);return _?_.translateToString(r,u,m):""}getWrappedRangeForLine(i){let r=i,u=i;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:r,last:u}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===i&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const r=new e.Marker(i);return this.markers.push(r),r.register(this.lines.onTrim((u=>{r.line-=u,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((u=>{r.line>=u.index&&(r.line+=u.amount)}))),r.register(this.lines.onDelete((u=>{r.line>=u.index&&r.line<u.index+u.amount&&r.dispose(),r.line>u.index&&(r.line-=u.amount)}))),r.register(r.onDispose((()=>this._removeMarker(r)))),r}_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),l=a(511),n=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let f=0;class v{constructor(e,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const r=s||l.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let u=0;u<e;++u)this.setCell(u,r);this.length=e}get(e){const s=this._data[3*e+0],i=2097151&s;return[this._data[3*e+1],2097152&s?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",s>>22,2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,s){this._data[3*e+1]=s[n.CHAR_DATA_ATTR_INDEX],s[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=s[1],this._data[3*e+0]=2097152|e|s[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=s[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&s}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e]:2097151&s?(0,c.stringFromCodePoint)(2097151&s):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,s){return f=3*e,s.content=this._data[f+0],s.fg=this._data[f+1],s.bg=this._data[f+2],2097152&s.content&&(s.combinedData=this._combined[e]),268435456&s.bg&&(s.extended=this._extendedAttrs[e]),s}setCell(e,s){2097152&s.content&&(this._combined[e]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=s.content,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}setCellFromCodepoint(e,s,i,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=s|i<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,s,i){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,c.stringFromCodePoint)(s):2097151&r?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&r)+(0,c.stringFromCodePoint)(s),r&=-2097152,r|=2097152):r=s|4194304,i&&(r&=-12582913,r|=i<<22),this._data[3*e+0]=r}insertCells(e,s,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length-e){const r=new l.CellData;for(let u=this.length-e-s-1;u>=0;--u)this.setCell(e+s+u,this.loadCell(e+u,r));for(let u=0;u<s;++u)this.setCell(e+u,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,s,i){if(e%=this.length,s<this.length-e){const r=new l.CellData;for(let u=0;u<this.length-e-s;++u)this.setCell(e+u,this.loadCell(e+s+u,r));for(let u=this.length-s;u<this.length;++u)this.setCell(u,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,s,i,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,i);e<s&&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),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,i);e<s&&e<this.length;)this.setCell(e++,i)}resize(e,s){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,s)}else{this._data=this._data.subarray(0,i);const r=Object.keys(this._combined);for(let m=0;m<r.length;m++){const _=parseInt(r[m],10);_>=e&&delete this._combined[_]}const u=Object.keys(this._extendedAttrs);for(let m=0;m<u.length;m++){const _=parseInt(u[m],10);_>=e&&delete this._extendedAttrs[_]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,s=!1){if(s)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 s in e._combined)this._combined[s]=e._combined[s];this._extendedAttrs={};for(const s in e._extendedAttrs)this._extendedAttrs[s]=e._extendedAttrs[s];this.isWrapped=e.isWrapped}clone(){const e=new v(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const s in this._combined)e._combined[s]=this._combined[s];for(const s in this._extendedAttrs)e._extendedAttrs[s]=this._extendedAttrs[s];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,s,i,r,u){const m=e._data;if(u)for(let g=r-1;g>=0;g--){for(let d=0;d<3;d++)this._data[3*(i+g)+d]=m[3*(s+g)+d];268435456&m[3*(s+g)+2]&&(this._extendedAttrs[i+g]=e._extendedAttrs[s+g])}else for(let g=0;g<r;g++){for(let d=0;d<3;d++)this._data[3*(i+g)+d]=m[3*(s+g)+d];268435456&m[3*(s+g)+2]&&(this._extendedAttrs[i+g]=e._extendedAttrs[s+g])}const _=Object.keys(e._combined);for(let g=0;g<_.length;g++){const d=parseInt(_[g],10);d>=s&&(this._combined[d-s+i]=e._combined[d])}}translateToString(e,s,i,r){s=s??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let u="";for(;s<i;){const m=this._data[3*s+0],_=2097151&m,g=2097152&m?this._combined[s]:_?(0,c.stringFromCodePoint)(_):n.WHITESPACE_CELL_CHAR;if(u+=g,r)for(let d=0;d<g.length;++d)r.push(s);s+=m>>22||1}return r&&r.push(s),u}}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,l,n){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(n-1)&&h[l].getWidth(n-1)===1,f=h[l+1].getWidth(0)===2;return c&&f?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,n,c,f){const v=[];for(let o=0;o<h.length-1;o++){let e=o,s=h.get(++e);if(!s.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&s.isWrapped;)i.push(s),s=h.get(++e);if(c>=o&&c<e){o+=i.length-1;continue}let r=0,u=a(i,r,l),m=1,_=0;for(;m<i.length;){const d=a(i,m,l),p=d-_,S=n-u,y=Math.min(p,S);i[r].copyCellsFrom(i[m],_,u,y,!1),u+=y,u===n&&(r++,u=0),_+=y,_===d&&(m++,_=0),u===0&&r!==0&&i[r-1].getWidth(n-1)===2&&(i[r].copyCellsFrom(i[r-1],n-1,u++,1,!1),i[r-1].setCell(n-1,f))}i[r].replaceCells(u,n,f);let g=0;for(let d=i.length-1;d>0&&(d>r||i[d].getTrimmedLength()===0);d--)g++;g>0&&(v.push(o+i.length-g),v.push(g)),o+=i.length-1}return v},t.reflowLargerCreateNewLayout=function(h,l){const n=[];let c=0,f=l[c],v=0;for(let o=0;o<h.length;o++)if(f===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-v,amount:e}),o+=e-1,v+=e,f=l[++c]}else n.push(o);return{layout:n,countRemoved:v}},t.reflowLargerApplyNewLayout=function(h,l){const n=[];for(let c=0;c<l.length;c++)n.push(h.get(l[c]));for(let c=0;c<n.length;c++)h.set(c,n[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,n){const c=[],f=h.map(((s,i)=>a(h,i,l))).reduce(((s,i)=>s+i));let v=0,o=0,e=0;for(;e<f;){if(f-e<n){c.push(f-e);break}v+=n;const s=a(h,o,l);v>s&&(v-=s,o++);const i=h[o].getWidth(v-1)===2;i&&v--;const r=i?n-1:n;c.push(r),e+=r}return c},t.getWrappedLineTrimmedLength=a},5295:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),l=a(844),n=a(9092);class c extends l.Disposable{constructor(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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(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=c},511:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),n=a(3734);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const o=new c;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[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[l.CHAR_DATA_CHAR_INDEX].length===2){const e=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|v[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},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),l=a(844);class n{get id(){return this._id}constructor(f){this.line=f,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(f){return this._disposables.push(f),f}}t.Marker=n,n._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,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
10
- `,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""})(a||(t.C0=a={})),(function(n){n.PAD="€",n.HOP="",n.BPH="‚",n.NBH="ƒ",n.IND="„",n.NEL="…",n.SSA="†",n.ESA="‡",n.HTS="ˆ",n.HTJ="‰",n.VTS="Š",n.PLD="‹",n.PLU="Œ",n.RI="",n.SS2="Ž",n.SS3="",n.DCS="",n.PU1="‘",n.PU2="’",n.STS="“",n.CCH="”",n.MW="•",n.SPA="–",n.EPA="—",n.SOS="˜",n.SGCI="™",n.SCI="š",n.CSI="›",n.ST="œ",n.OSC="",n.PM="ž",n.APC="Ÿ"})(h||(t.C1=h={})),(function(n){n.ST=`${a.ESC}\\`})(l||(t.C1_ESCAPED=l={}))},7399:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),l={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(n,c,f,v){const o={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=n.ctrlKey?"\b":h.C0.DEL,n.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(n.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=n.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,n.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(f?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(f?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",f||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",f||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":c?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":c?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:n.shiftKey?o.type=2:n.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:n.shiftKey?o.type=3:n.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(f&&!v||!n.altKey||n.metaKey)!f||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?o.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(o.key=h.C0.US),n.key==="@"&&(o.key=h.C0.NUL)):n.keyCode===65&&(o.type=1);else{const s=l[n.keyCode],i=s==null?void 0:s[n.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(n.keyCode>=65&&n.keyCode<=90){const r=n.ctrlKey?n.keyCode-64:n.keyCode+32;let u=String.fromCharCode(r);n.shiftKey&&(u=u.toUpperCase()),o.key=h.C0.ESC+u}else if(n.keyCode===32)o.key=h.C0.ESC+(n.ctrlKey?h.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let r=n.code.slice(3,4);n.shiftKey||(r=r.toLowerCase()),o.key=h.C0.ESC+r,o.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?o.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?o.key=h.C0.NUL:n.keyCode>=51&&n.keyCode<=55?o.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?o.key=h.C0.DEL:n.keyCode===219?o.key=h.C0.ESC:n.keyCode===220?o.key=h.C0.FS:n.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(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,l=a.length){let n="";for(let c=h;c<l;++c){let f=a[c];f>65535?(f-=65536,n+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):n+=String.fromCharCode(f)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const f=a.charCodeAt(c++);56320<=f&&f<=57343?h[n++]=1024*(this._interim-55296)+f-56320+65536:(h[n++]=this._interim,h[n++]=f),this._interim=0}for(let f=c;f<l;++f){const v=a.charCodeAt(f);if(55296<=v&&v<=56319){if(++f>=l)return this._interim=v,n;const o=a.charCodeAt(f);56320<=o&&o<=57343?h[n++]=1024*(v-55296)+o-56320+65536:(h[n++]=v,h[n++]=o)}else v!==65279&&(h[n++]=v)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,c,f,v,o=0,e=0,s=0;if(this.interim[0]){let u=!1,m=this.interim[0];m&=(224&m)==192?31:(240&m)==224?15:7;let _,g=0;for(;(_=63&this.interim[++g])&&g<4;)m<<=6,m|=_;const d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=d-g;for(;s<p;){if(s>=l)return 0;if(_=a[s++],(192&_)!=128){s--,u=!0;break}this.interim[g++]=_,m<<=6,m|=63&_}u||(d===2?m<128?s--:h[o++]=m:d===3?m<2048||m>=55296&&m<=57343||m===65279||(h[o++]=m):m<65536||m>1114111||(h[o++]=m)),this.interim.fill(0)}const i=l-4;let r=s;for(;r<l;){for(;!(!(r<i)||128&(n=a[r])||128&(c=a[r+1])||128&(f=a[r+2])||128&(v=a[r+3]));)h[o++]=n,h[o++]=c,h[o++]=f,h[o++]=v,r+=4;if(n=a[r++],n<128)h[o++]=n;else if((224&n)==192){if(r>=l)return this.interim[0]=n,o;if(c=a[r++],(192&c)!=128){r--;continue}if(e=(31&n)<<6|63&c,e<128){r--;continue}h[o++]=e}else if((240&n)==224){if(r>=l)return this.interim[0]=n,o;if(c=a[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=c,o;if(f=a[r++],(192&f)!=128){r--;continue}if(e=(15&n)<<12|(63&c)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(r>=l)return this.interim[0]=n,o;if(c=a[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=c,o;if(f=a[r++],(192&f)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=f,o;if(v=a[r++],(192&v)!=128){r--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&f)<<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),l=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let f=0;f<l.length;++f)c.fill(0,l[f][0],l[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?c[f]:(function(v,o){let e,s=0,i=o.length-1;if(v<o[0][0]||v>o[i][1])return!1;for(;i>=s;)if(e=s+i>>1,v>o[e][1])s=e+1;else{if(!(v<o[e][0]))return!0;i=e-1}return!1})(f,n)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1}charProperties(f,v){let o=this.wcwidth(f),e=o===0&&v!==0;if(e){const s=h.UnicodeService.extractWidth(v);s===0?e=!1:s>o&&(o=s)}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),l=a(844);class n extends l.Disposable{constructor(f){super(),this._action=f,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(f,v){if(v!==void 0&&this._syncCalls>v)return void(this._syncCalls=0);if(this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(f,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+=f.length,this._writeBuffer.push(f),this._callbacks.push(v),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(v)}_innerWrite(f=0,v=!0){const o=f||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,v);if(s){const r=u=>Date.now()-o>=12?setTimeout((()=>this._innerWrite(0,u))):this._innerWrite(o,u);return void s.catch((u=>(queueMicrotask((()=>{throw u})),Promise.resolve(!1)))).then(r)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=n},5941:(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 l(n,c){const f=n.toString(16),v=f.length<2?"0"+f:f;switch(c){case 4:return f[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}t.parseColor=function(n){if(!n)return;let c=n.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const f=a.exec(c);if(f){const v=f[1]?15:f[4]?255:f[7]?4095:65535;return[Math.round(parseInt(f[1]||f[4]||f[7]||f[10],16)/v*255),Math.round(parseInt(f[2]||f[5]||f[8]||f[11],16)/v*255),Math.round(parseInt(f[3]||f[6]||f[9]||f[12],16)/v*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const f=c.length/3,v=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(f*o,f*o+f),16);v[o]=f===1?e<<4:f===2?e:f===3?e>>4:e>>8}return v}},t.toRgbString=function(n,c=16){const[f,v,o]=n;return`rgb:${l(f,c)}/${l(v,c)}/${l(o,c)}`}},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),l=a(8742),n=a(5770),c=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=c,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}registerHandler(v,o){this._handlers[v]===void 0&&(this._handlers[v]=[]);const e=this._handlers[v];return e.push(o),{dispose:()=>{const s=e.indexOf(o);s!==-1&&e.splice(s,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=c,this._ident=0}hook(v,o){if(this.reset(),this._ident=v,this._active=this._handlers[v]||c,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(v,o,e){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].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,s=this._active.length-1,i=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;s>=0&&(e=this._active[s].unhook(v),e!==!0);s--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,e;s--}for(;s>=0;s--)if(e=this._active[s].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",v);this._active=c,this._ident=0}};const f=new l.Params;f.addParam(0),t.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=f,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():f,this._data="",this._hitLimit=!1}put(v,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,o,e),this._data.length>n.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=f,this._data="",this._hitLimit=!1,e)));return this._params=f,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),l=a(8742),n=a(6242),c=a(6351);class f{constructor(s){this.table=new Uint8Array(s)}setDefault(s,i){this.table.fill(s<<4|i)}add(s,i,r,u){this.table[i<<8|s]=r<<4|u}addMany(s,i,r,u){for(let m=0;m<s.length;m++)this.table[i<<8|s[m]]=r<<4|u}}t.TransitionTable=f;const v=160;t.VT500_TRANSITION_TABLE=(function(){const e=new f(4095),s=Array.apply(null,Array(256)).map(((g,d)=>d)),i=(g,d)=>s.slice(g,d),r=i(32,127),u=i(0,24);u.push(25),u.push.apply(u,i(28,32));const m=i(0,14);let _;for(_ in e.setDefault(1,0),e.addMany(r,0,2,0),m)e.addMany([24,26,153,154],_,3,0),e.addMany(i(128,144),_,3,0),e.addMany(i(144,152),_,3,0),e.add(156,_,0,0),e.add(27,_,11,1),e.add(157,_,4,8),e.addMany([152,158,159],_,0,7),e.add(155,_,11,3),e.add(144,_,11,9);return e.addMany(u,0,3,0),e.addMany(u,1,3,1),e.add(127,1,0,1),e.addMany(u,8,0,8),e.addMany(u,3,3,3),e.add(127,3,0,3),e.addMany(u,4,3,4),e.add(127,4,0,4),e.addMany(u,6,3,6),e.addMany(u,5,3,5),e.add(127,5,0,5),e.addMany(u,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(u,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(u,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(u,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(u,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(u,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(u,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(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(s=t.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,u)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,i=[64,126]){let r=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=s.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let m=0;m<s.intermediates.length;++m){const _=s.intermediates.charCodeAt(m);if(32>_||_>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=_}}if(s.final.length!==1)throw new Error("final must be a single byte");const u=s.final.charCodeAt(0);if(i[0]>u||u>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=u,r}identToString(s){const i=[];for(;s;)i.push(String.fromCharCode(255&s)),s>>=8;return i.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,i){const r=this._identifier(s,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);const u=this._escHandlers[r];return u.push(i),{dispose:()=>{const m=u.indexOf(i);m!==-1&&u.splice(m,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,i){this._executeHandlers[s.charCodeAt(0)]=i}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,i){const r=this._identifier(s);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);const u=this._csiHandlers[r];return u.push(i),{dispose:()=>{const m=u.indexOf(i);m!==-1&&u.splice(m,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,i){return this._dcsParser.registerHandler(this._identifier(s),i)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,i){return this._oscParser.registerHandler(s,i)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}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(s,i,r,u,m){this._parseStack.state=s,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=u,this._parseStack.chunkPos=m}parse(s,i,r){let u,m=0,_=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const d=this._parseStack.handlers;let p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&p>-1){for(;p>=0&&(u=d[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&p>-1){for(;p>=0&&(u=d[p](),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 6:if(m=s[this._parseStack.chunkPos],u=this._dcsParser.unhook(m!==24&&m!==26,r),u)return u;m===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(m=s[this._parseStack.chunkPos],u=this._oscParser.end(m!==24&&m!==26,r),u)return u;m===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let d=g;d<i;++d){switch(m=s[d],_=this._transitions.table[this.currentState<<8|(m<160?m:v)],_>>4){case 2:for(let w=d+1;;++w){if(w>=i||(m=s[w])<32||m>126&&m<v){this._printHandler(s,d,w),d=w-1;break}if(++w>=i||(m=s[w])<32||m>126&&m<v){this._printHandler(s,d,w),d=w-1;break}if(++w>=i||(m=s[w])<32||m>126&&m<v){this._printHandler(s,d,w),d=w-1;break}if(++w>=i||(m=s[w])<32||m>126&&m<v){this._printHandler(s,d,w),d=w-1;break}}break;case 3:this._executeHandlers[m]?this._executeHandlers[m]():this._executeHandlerFb(m),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:m,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const p=this._csiHandlers[this._collect<<8|m];let S=p?p.length-1:-1;for(;S>=0&&(u=p[S](this._params),u!==!0);S--)if(u instanceof Promise)return this._preserveStack(3,p,S,_,d),u;S<0&&this._csiHandlerFb(this._collect<<8|m,this._params),this.precedingJoinState=0;break;case 8:do switch(m){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(m-48)}while(++d<i&&(m=s[d])>47&&m<60);d--;break;case 9:this._collect<<=8,this._collect|=m;break;case 10:const y=this._escHandlers[this._collect<<8|m];let b=y?y.length-1:-1;for(;b>=0&&(u=y[b](),u!==!0);b--)if(u instanceof Promise)return this._preserveStack(4,y,b,_,d),u;b<0&&this._escHandlerFb(this._collect<<8|m),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|m,this._params);break;case 13:for(let w=d+1;;++w)if(w>=i||(m=s[w])===24||m===26||m===27||m>127&&m<v){this._dcsParser.put(s,d,w),d=w-1;break}break;case 14:if(u=this._dcsParser.unhook(m!==24&&m!==26),u)return this._preserveStack(6,[],0,_,d),u;m===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let w=d+1;;w++)if(w>=i||(m=s[w])<32||m>127&&m<v){this._oscParser.put(s,d,w),d=w-1;break}break;case 6:if(u=this._oscParser.end(m!==24&&m!==26),u)return this._preserveStack(5,[],0,_,d),u;m===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&_}}}t.EscapeSequenceParser=o},6242:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,f){this._handlers[c]===void 0&&(this._handlers[c]=[]);const v=this._handlers[c];return v.push(f),{dispose:()=>{const o=v.indexOf(f);o!==-1&&v.splice(o,1)}}}clearHandler(c){this._handlers[c]&&delete this._handlers[c]}setHandlerFallback(c){this._handlerFb=c}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,f,v){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,f,v);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,f,v))}start(){this.reset(),this._state=1}put(c,f,v){if(this._state!==3){if(this._state===1)for(;f<v;){const o=c[f++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&v-f>0&&this._put(c,f,v)}}end(c,f=!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=f,e=this._stack.fallThrough,this._stack.paused=!1),!e&&v===!1){for(;o>=0&&(v=this._active[o].end(c),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",c);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,f,v){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,f,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let f=!1;if(this._hitLimit)f=!1;else if(c&&(f=this._handler(this._data),f instanceof Promise))return f.then((v=>(this._data="",this._hitLimit=!1,v)));return this._data="",this._hitLimit=!1,f}}},8742:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(n){const c=new h;if(!n.length)return c;for(let f=Array.isArray(n[0])?1:0;f<n.length;++f){const v=n[f];if(Array.isArray(v))for(let o=0;o<v.length;++o)c.addSubParam(v[o]);else c.addParam(v)}return c}constructor(n=32,c=32){if(this.maxLength=n,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new h(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let c=0;c<this.length;++c){n.push(this.params[c]);const f=this._subParamsIdx[c]>>8,v=255&this._subParamsIdx[c];v-f>0&&n.push(Array.prototype.slice.call(this._subParams,f,v))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>a?a:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>a?a:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const c=this._subParamsIdx[n]>>8,f=255&this._subParamsIdx[n];return f-c>0?this._subParams.subarray(c,f):null}getSubParamsAll(){const n={};for(let c=0;c<this.length;++c){const f=this._subParamsIdx[c]>>8,v=255&this._subParamsIdx[c];v-f>0&&(n[c]=this._subParams.slice(f,v))}return n}addDigit(n){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const f=this._digitIsSub?this._subParams:this.params,v=f[c-1];f[c-1]=~v?Math.min(10*v+n,a):n}}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 l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){h=l;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=a(511);t.BufferApiView=class{constructor(n,c){this._buffer=n,this.type=c}init(n){return this._buffer=n,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(n){const c=this._buffer.lines.get(n);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,n){if(!(l<0||l>=this._line.length))return n?(this._line.loadCell(l,n),n):this._line.loadCell(l,new h.CellData)}translateToString(l,n,c){return this._line.translateToString(l,n,c)}}},8285:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),n=a(844);class c extends n.Disposable{constructor(v){super(),this._core=v,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=c},7975:(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,(l=>h(l.toArray())))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,((l,n)=>h(l,n.toArray())))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(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,s,i,r){var u,m=arguments.length,_=m<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,s,i,r);else for(var g=e.length-1;g>=0;g--)(u=e[g])&&(_=(m<3?u(_):m>3?u(s,i,_):u(s,i))||_);return m>3&&_&&Object.defineProperty(s,i,_),_},l=this&&this.__param||function(e,s){return function(i,r){s(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=a(8460),c=a(844),f=a(5295),v=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends c.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new f.BufferSet(e,this))}resize(e,s){this.cols=e,this.rows=s,this.buffers.resize(e,s),this._onResize.fire({cols:e,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,s=!1){const i=this.buffer;let r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,s),this._cachedBlankLine=r),r.isWrapped=s;const u=i.ybase+i.scrollTop,m=i.ybase+i.scrollBottom;if(i.scrollTop===0){const _=i.lines.isFull;m===i.lines.length-1?_?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(m+1,0,r.clone()),_?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const _=m-u+1;i.lines.shiftElements(u+1,_-1,-1),i.lines.set(m,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,s,i){const r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);const u=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),u!==r.ydisp&&(s||this._onScroll.fire(r.ydisp))}};t.BufferService=o=h([l(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(r,u,m,_){var g,d=arguments.length,p=d<3?u:_===null?_=Object.getOwnPropertyDescriptor(u,m):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,u,m,_);else for(var S=r.length-1;S>=0;S--)(g=r[S])&&(p=(d<3?g(p):d>3?g(u,m,p):g(u,m))||p);return d>3&&p&&Object.defineProperty(u,m,p),p},l=this&&this.__param||function(r,u){return function(m,_){u(m,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=a(2585),c=a(8460),f=a(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:r=>r.button!==4&&r.action===1&&(r.ctrl=!1,r.alt=!1,r.shift=!1,!0)},VT200:{events:19,restrict:r=>r.action!==32},DRAG:{events:23,restrict:r=>r.action!==32||r.button!==3},ANY:{events:31,restrict:r=>!0}};function o(r,u){let m=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(m|=64,m|=r.action):(m|=3&r.button,4&r.button&&(m|=64),8&r.button&&(m|=128),r.action===32?m|=32:r.action!==0||u||(m|=3)),m}const e=String.fromCharCode,s={DEFAULT:r=>{const u=[o(r,!1)+32,r.col+32,r.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${e(u[0])}${e(u[1])}${e(u[2])}`},SGR:r=>{const u=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.col};${r.row}${u}`},SGR_PIXELS:r=>{const u=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.x};${r.y}${u}`}};let i=t.CoreMouseService=class extends f.Disposable{constructor(r,u){super(),this._bufferService=r,this._coreService=u,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new c.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const m of Object.keys(v))this.addProtocol(m,v[m]);for(const m of Object.keys(s))this.addEncoding(m,s[m]);this.reset()}addProtocol(r,u){this._protocols[r]=u}addEncoding(r,u){this._encodings[r]=u}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(r){if(!this._protocols[r])throw new Error(`unknown protocol "${r}"`);this._activeProtocol=r,this._onProtocolChange.fire(this._protocols[r].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(r){if(!this._encodings[r])throw new Error(`unknown encoding "${r}"`);this._activeEncoding=r}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(r){if(r.col<0||r.col>=this._bufferService.cols||r.row<0||r.row>=this._bufferService.rows||r.button===4&&r.action===32||r.button===3&&r.action!==32||r.button!==4&&(r.action===2||r.action===3)||(r.col++,r.row++,r.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,r,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(r))return!1;const u=this._encodings[this._activeEncoding](r);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!0)),this._lastEvent=r,!0}explainEvents(r){return{down:!!(1&r),up:!!(2&r),drag:!!(4&r),move:!!(8&r),wheel:!!(16&r)}}_equalEvents(r,u,m){if(m){if(r.x!==u.x||r.y!==u.y)return!1}else if(r.col!==u.col||r.row!==u.row)return!1;return r.button===u.button&&r.action===u.action&&r.ctrl===u.ctrl&&r.alt===u.alt&&r.shift===u.shift}};t.CoreMouseService=i=h([l(0,n.IBufferService),l(1,n.ICoreService)],i)},6975:function(R,t,a){var h=this&&this.__decorate||function(i,r,u,m){var _,g=arguments.length,d=g<3?r:m===null?m=Object.getOwnPropertyDescriptor(r,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,m);else for(var p=i.length-1;p>=0;p--)(_=i[p])&&(d=(g<3?_(d):g>3?_(r,u,d):_(r,u))||d);return g>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,m){r(u,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=a(1439),c=a(8460),f=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 s=t.CoreService=class extends f.Disposable{constructor(i,r,u){super(),this._bufferService=i,this._logService=r,this._optionsService=u,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new c.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new c.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(i,r=!1){if(this._optionsService.rawOptions.disableStdin)return;const u=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,(()=>i.split("").map((m=>m.charCodeAt(0))))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,(()=>i.split("").map((r=>r.charCodeAt(0))))),this._onBinary.fire(i))}};t.CoreService=s=h([l(0,v.IBufferService),l(1,v.ILogService),l(2,v.IOptionsService)],s)},9074:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),n=a(844),c=a(6106);let f=0,v=0;class o extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList((i=>i==null?void 0:i.marker.line)),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)((()=>this.reset())))}registerDecoration(i){if(i.marker.isDisposed)return;const r=new e(i);if(r){const u=r.marker.onDispose((()=>r.dispose()));r.onDispose((()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),u.dispose())})),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,r,u){let m=0,_=0;for(const g of this._decorations.getKeyIterator(r))m=g.options.x??0,_=m+(g.options.width??1),i>=m&&i<_&&(!u||(g.options.layer??"bottom")===u)&&(yield g)}forEachDecorationAtCell(i,r,u,m){this._decorations.forEachByKey(r,(_=>{f=_.options.x??0,v=f+(_.options.width??1),i>=f&&i<v&&(!u||(_.options.layer??"bottom")===u)&&m(_)}))}}t.DecorationService=o;class e extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class n{constructor(...f){this._entries=new Map;for(const[v,o]of f)this.set(v,o)}set(f,v){const o=this._entries.get(f);return this._entries.set(f,v),o}forEach(f){for(const[v,o]of this._entries.entries())f(v,o)}has(f){return this._entries.has(f)}get(f){return this._entries.get(f)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(h.IInstantiationService,this)}setService(c,f){this._services.set(c,f)}getService(c){return this._services.get(c)}createInstance(c,...f){const v=(0,l.getServiceDependencies)(c).sort(((s,i)=>s.index-i.index)),o=[];for(const s of v){const i=this._services.get(s.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${s.id}.`);o.push(i)}const e=v.length>0?v[0].index:f.length;if(f.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${f.length} static arguments`);return new c(...f,...o)}}},7866:function(R,t,a){var h=this&&this.__decorate||function(e,s,i,r){var u,m=arguments.length,_=m<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,s,i,r);else for(var g=e.length-1;g>=0;g--)(u=e[g])&&(_=(m<3?u(_):m>3?u(s,i,_):u(s,i))||_);return m>3&&_&&Object.defineProperty(s,i,_),_},l=this&&this.__param||function(e,s){return function(i,r){s(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(844),c=a(2585),f={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let v,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),v=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let s=0;s<e.length;s++)typeof e[s]=="function"&&(e[s]=e[s]())}_log(e,s,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...i)}trace(e,...s){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,s)}debug(e,...s){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,s)}info(e,...s){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,s)}warn(e,...s){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,s)}error(e,...s){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,s)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,s,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(...u){if(v.logLevel!==c.LogLevelEnum.TRACE)return r.apply(this,u);v.trace(`GlyphRenderer#${r.name}(${u.map((_=>JSON.stringify(_))).join(", ")})`);const m=r.apply(this,u);return v.trace(`GlyphRenderer#${r.name} return`,m),m}}},7302:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),n=a(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class f extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const s in o)if(s in e)try{const i=o[s];e[s]=this._sanitizeAndValidateOption(s,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(o,e){return this.onOptionChange((s=>{s===o&&e(this.rawOptions[o])}))}onMultipleOptionChange(o,e){return this.onOptionChange((s=>{o.indexOf(s)!==-1&&e()}))}_setupOptions(){const o=s=>{if(!(s in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},e=(s,i)=>{if(!(s in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);i=this._sanitizeAndValidateOption(s,i),this.rawOptions[s]!==i&&(this.rawOptions[s]=i,this._onOptionChange.fire(s))};for(const s in this.rawOptions){const i={get:o.bind(this,s),set:e.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[o];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${o} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${o} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=f},2660:function(R,t,a){var h=this&&this.__decorate||function(f,v,o,e){var s,i=arguments.length,r=i<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(f,v,o,e);else for(var u=f.length-1;u>=0;u--)(s=f[u])&&(r=(i<3?s(r):i>3?s(v,o,r):s(v,o))||r);return i>3&&r&&Object.defineProperty(v,o,r),r},l=this&&this.__param||function(f,v){return function(o,e){v(o,e,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=a(2585);let c=t.OscLinkService=class{constructor(f){this._bufferService=f,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(f){const v=this._bufferService.buffer;if(f.id===void 0){const u=v.addMarker(v.ybase+v.y),m={data:f,id:this._nextId++,lines:[u]};return u.onDispose((()=>this._removeMarkerFromLink(m,u))),this._dataByLinkId.set(m.id,m),m.id}const o=f,e=this._getEntryIdKey(o),s=this._entriesWithId.get(e);if(s)return this.addLineToLink(s.id,v.ybase+v.y),s.id;const i=v.addMarker(v.ybase+v.y),r={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose((()=>this._removeMarkerFromLink(r,i))),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(f,v){const o=this._dataByLinkId.get(f);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(f){var v;return(v=this._dataByLinkId.get(f))==null?void 0:v.data}_getEntryIdKey(f){return`${f.id};;${f.uri}`}_removeMarkerFromLink(f,v){const o=f.lines.indexOf(v);o!==-1&&(f.lines.splice(o,1),f.lines.length===0&&(f.data.id!==void 0&&this._entriesWithId.delete(f.key),this._dataByLinkId.delete(f.id)))}};t.OscLinkService=c=h([l(0,n.IBufferService)],c)},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(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(c,f,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,s){e[a]===e?e[h].push({id:o,index:s}):(e[h]=[{id:o,index:s}],e[a]=e)})(n,c,v)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},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 l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"})(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=a(225);class n{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,v,o=!1){return(16777215&f)<<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 f=new l.UnicodeV6;this.register(f),this._active=f.version,this._activeProvider=f}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(f){if(!this._providers[f])throw new Error(`unknown Unicode version "${f}"`);this._active=f,this._activeProvider=this._providers[f],this._onChange.fire(f)}register(f){this._providers[f.version]=f}wcwidth(f){return this._activeProvider.wcwidth(f)}getStringCellWidth(f){let v=0,o=0;const e=f.length;for(let s=0;s<e;++s){let i=f.charCodeAt(s);if(55296<=i&&i<=56319){if(++s>=e)return v+this.wcwidth(i);const m=f.charCodeAt(s);56320<=m&&m<=57343?i=1024*(i-55296)+m-56320+65536:v+=this.wcwidth(m)}const r=this.charProperties(i,o);let u=n.extractWidth(r);n.extractShouldJoin(r)&&(u-=n.extractWidth(o)),v+=u,o=r}return v}charProperties(f,v){return this._activeProvider.charProperties(f,v)}}t.UnicodeService=n}},F={};function A(R){var t=F[R];if(t!==void 0)return t.exports;var a=F[R]={exports:{}};return B[R].call(a.exports,a,a.exports,A),a.exports}var $={};return(()=>{var R=$;Object.defineProperty(R,"__esModule",{value:!0}),R.Terminal=void 0;const t=A(9042),a=A(3236),h=A(844),l=A(5741),n=A(8285),c=A(7975),f=A(7090),v=["cols","rows"];class o extends h.Disposable{constructor(s){super(),this._core=this.register(new a.Terminal(s)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=u=>this._core.options[u],r=(u,m)=>{this._checkReadonlyOptions(u),this._core.options[u]=m};for(const u in this._core.options){const m={get:i.bind(this,u),set:r.bind(this,u)};Object.defineProperty(this._publicOptions,u,m)}}_checkReadonlyOptions(s){if(v.includes(s))throw new Error(`Option "${s}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const s=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:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(const i in s)this._publicOptions[i]=s[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,i=!0){this._core.input(s,i)}resize(s,i){this._verifyIntegers(s,i),this._core.resize(s,i)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,i,r){this._verifyIntegers(s,i,r),this._core.select(s,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,i){this._verifyIntegers(s,i),this._core.selectLines(s,i)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,i){this._core.write(s,i)}writeln(s,i){this._core.write(s),this._core.write(`\r
11
- `,i)}paste(s){this._core.paste(s)}refresh(s,i){this._verifyIntegers(s,i),this._core.refresh(s,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return t}_verifyIntegers(...s){for(const i of s)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(const i of s)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}R.Terminal=o})(),$})()))})(Ee)),Ee.exports}var Xe=Ve(),Le={exports:{}},Be;function Ye(){return Be||(Be=1,(function(P,k){(function(B,F){P.exports=F()})(self,(()=>(()=>{var B={};return(()=>{var F=B;Object.defineProperty(F,"__esModule",{value:!0}),F.FitAddon=void 0,F.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 $=this._terminal._core;this._terminal.rows===A.rows&&this._terminal.cols===A.cols||($._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,$=A._renderService.dimensions;if($.css.cell.width===0||$.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"))),l=window.getComputedStyle(this._terminal.element),n=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-R;return{cols:Math.max(2,Math.floor(c/$.css.cell.width)),rows:Math.max(1,Math.floor(n/$.css.cell.height))}}}})(),B})()))})(Le)),Le.exports}var Je=Ye(),xe={exports:{}},Ie;function Ze(){return Ie||(Ie=1,(function(P,k){(function(B,F){P.exports=F()})(self,(()=>(()=>{var B={965:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),n=a(855),c=a(859),f=a(381),v=11,o=v*Float32Array.BYTES_PER_ELEMENT;let e,s=0,i=0,r=0;class u extends c.Disposable{constructor(_,g,d,p){super(),this._terminal=_,this._gl=g,this._dimensions=d,this._optionsService=p,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const S=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,f.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(W){let H="";for(let O=1;O<W;O++)H+=` else if (v_texpage == ${O}) { outColor = texture(u_texture[${O}], 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[${W}];
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
- }`})(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)((()=>S.deleteProgram(this._program)))),this._projectionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=S.createVertexArray(),S.bindVertexArray(this._vertexArrayObject);const y=new Float32Array([0,0,1,0,0,1,1,1]),b=S.createBuffer();this.register((0,c.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,c.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,c.toDisposable)((()=>S.deleteBuffer(this._attributesBuffer)))),S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.enableVertexAttribArray(2),S.vertexAttribPointer(2,2,S.FLOAT,!1,o,0),S.vertexAttribDivisor(2,1),S.enableVertexAttribArray(3),S.vertexAttribPointer(3,2,S.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(3,1),S.enableVertexAttribArray(4),S.vertexAttribPointer(4,1,S.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(4,1),S.enableVertexAttribArray(5),S.vertexAttribPointer(5,2,S.FLOAT,!1,o,5*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(5,1),S.enableVertexAttribArray(6),S.vertexAttribPointer(6,2,S.FLOAT,!1,o,7*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(6,1),S.enableVertexAttribArray(1),S.vertexAttribPointer(1,2,S.FLOAT,!1,o,9*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(1,1),S.useProgram(this._program);const I=new Int32Array(l.TextureAtlas.maxAtlasPages);for(let W=0;W<l.TextureAtlas.maxAtlasPages;W++)I[W]=W;S.uniform1iv(this._textureLocation,I),S.uniformMatrix4fv(this._projectionLocation,!1,f.PROJECTION_MATRIX),this._atlasTextures=[];for(let W=0;W<l.TextureAtlas.maxAtlasPages;W++){const H=new f.GLTexture((0,h.throwIfFalsy)(S.createTexture()));this.register((0,c.toDisposable)((()=>S.deleteTexture(H.texture)))),S.activeTexture(S.TEXTURE0+W),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[W]=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(_,g,d,p,S,y,b,w,x){this._updateCell(this._vertices.attributes,_,g,d,p,S,y,b,w,x)}_updateCell(_,g,d,p,S,y,b,w,x,I){s=(d*this._terminal.cols+g)*v,p!==n.NULL_CELL_CODE&&p!==void 0?this._atlas&&(e=w&&w.length>1?this._atlas.getRasterizedGlyphCombinedChar(w,S,y,b,!1):this._atlas.getRasterizedGlyph(p,S,y,b,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),S!==I&&e.offset.x>i?(r=e.offset.x-i,_[s]=-(e.offset.x-r)+this._dimensions.device.char.left,_[s+1]=-e.offset.y+this._dimensions.device.char.top,_[s+2]=(e.size.x-r)/this._dimensions.device.canvas.width,_[s+3]=e.size.y/this._dimensions.device.canvas.height,_[s+4]=e.texturePage,_[s+5]=e.texturePositionClipSpace.x+r/this._atlas.pages[e.texturePage].canvas.width,_[s+6]=e.texturePositionClipSpace.y,_[s+7]=e.sizeClipSpace.x-r/this._atlas.pages[e.texturePage].canvas.width,_[s+8]=e.sizeClipSpace.y):(_[s]=-e.offset.x+this._dimensions.device.char.left,_[s+1]=-e.offset.y+this._dimensions.device.char.top,_[s+2]=e.size.x/this._dimensions.device.canvas.width,_[s+3]=e.size.y/this._dimensions.device.canvas.height,_[s+4]=e.texturePage,_[s+5]=e.texturePositionClipSpace.x,_[s+6]=e.texturePositionClipSpace.y,_[s+7]=e.sizeClipSpace.x,_[s+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(p,x,e.size.x,this._dimensions.device.cell.width)&&(_[s+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):_.fill(0,s,s+v-1-2)}clear(){const _=this._terminal,g=_.cols*_.rows*v;this._vertices.count!==g?this._vertices.attributes=new Float32Array(g):this._vertices.attributes.fill(0);let d=0;for(;d<this._vertices.attributesBuffers.length;d++)this._vertices.count!==g?this._vertices.attributesBuffers[d]=new Float32Array(g):this._vertices.attributesBuffers[d].fill(0);this._vertices.count=g,d=0;for(let p=0;p<_.rows;p++)for(let S=0;S<_.cols;S++)this._vertices.attributes[d+9]=S/_.cols,this._vertices.attributes[d+10]=p/_.rows,d+=v}handleResize(){const _=this._gl;_.useProgram(this._program),_.viewport(0,0,_.canvas.width,_.canvas.height),_.uniform2f(this._resolutionLocation,_.canvas.width,_.canvas.height),this.clear()}render(_){if(!this._atlas)return;const g=this._gl;g.useProgram(this._program),g.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const d=this._vertices.attributesBuffers[this._activeBuffer];let p=0;for(let S=0;S<_.lineLengths.length;S++){const y=S*this._terminal.cols*v,b=this._vertices.attributes.subarray(y,y+_.lineLengths[S]*v);d.set(b,p),p+=b.length}g.bindBuffer(g.ARRAY_BUFFER,this._attributesBuffer),g.bufferData(g.ARRAY_BUFFER,d.subarray(0,p),g.STREAM_DRAW);for(let S=0;S<this._atlas.pages.length;S++)this._atlas.pages[S].version!==this._atlasTextures[S].version&&this._bindAtlasPageTexture(g,this._atlas,S);g.drawElementsInstanced(g.TRIANGLE_STRIP,4,g.UNSIGNED_BYTE,0,p/v)}setAtlas(_){this._atlas=_;for(const g of this._atlasTextures)g.version=-1}_bindAtlasPageTexture(_,g,d){_.activeTexture(_.TEXTURE0+d),_.bindTexture(_.TEXTURE_2D,this._atlasTextures[d].texture),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,g.pages[d].canvas),_.generateMipmap(_.TEXTURE_2D),this._atlasTextures[d].version=g.pages[d].version}setDimensions(_){this._dimensions=_}}t.GlyphRenderer=u},742:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=a(374),l=a(859),n=a(310),c=a(381),f=8*Float32Array.BYTES_PER_ELEMENT;class v{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,s=0,i=0,r=0,u=0,m=0;class _ extends l.Disposable{constructor(d,p,S,y){super(),this._terminal=d,this._gl=p,this._dimensions=S,this._themeService=y,this._vertices=new v,this._verticesCursor=new v;const b=this._gl;this._program=(0,h.throwIfFalsy)((0,c.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,l.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,l.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]),W=b.createBuffer();this.register((0,l.toDisposable)((()=>b.deleteBuffer(W)))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,W),b.bufferData(b.ELEMENT_ARRAY_BUFFER,I,b.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(b.createBuffer()),this.register((0,l.toDisposable)((()=>b.deleteBuffer(this._attributesBuffer)))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,f,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,f,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(d){const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),p.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,d.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,d.count)}handleResize(){this._updateViewportRectangle()}setDimensions(d){this._dimensions=d}_updateCachedColors(d){this._bgFloat=this._colorToFloat32Array(d.background),this._cursorFloat=this._colorToFloat32Array(d.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(d){const p=this._terminal,S=this._vertices;let y,b,w,x,I,W,H,O,C,L,D,T=1;for(y=0;y<p.rows;y++){for(w=-1,x=0,I=0,W=!1,b=0;b<p.cols;b++)H=(y*p.cols+b)*n.RENDER_MODEL_INDICIES_PER_CELL,O=d.cells[H+n.RENDER_MODEL_BG_OFFSET],C=d.cells[H+n.RENDER_MODEL_FG_OFFSET],L=!!(67108864&C),(O!==x||C!==I&&(W||L))&&((x!==0||W&&I!==0)&&(D=8*T++,this._updateRectangle(S,D,I,x,w,b,y)),w=b,x=O,I=C,W=L);(x!==0||W&&I!==0)&&(D=8*T++,this._updateRectangle(S,D,I,x,w,p.cols,y))}S.count=T}updateCursor(d){const p=this._verticesCursor,S=d.cursor;if(!S||S.style==="block")return void(p.count=0);let y,b=0;S.style!=="bar"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(p.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(p.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(p.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(p.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)),p.count=b}_updateRectangle(d,p,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}d.attributes.length<p+4&&(d.attributes=(0,c.expandFloat32Array)(d.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,s=x*this._dimensions.device.cell.height,i=(o>>24&255)/255,r=(o>>16&255)/255,u=(o>>8&255)/255,m=1,this._addRectangle(d.attributes,p,e,s,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,r,u,m)}_addRectangle(d,p,S,y,b,w,x,I,W,H){d[p]=S/this._dimensions.device.canvas.width,d[p+1]=y/this._dimensions.device.canvas.height,d[p+2]=b/this._dimensions.device.canvas.width,d[p+3]=w/this._dimensions.device.canvas.height,d[p+4]=x,d[p+5]=I,d[p+6]=W,d[p+7]=H}_addRectangleFloat(d,p,S,y,b,w,x){d[p]=S/this._dimensions.device.canvas.width,d[p+1]=y/this._dimensions.device.canvas.height,d[p+2]=b/this._dimensions.device.canvas.width,d[p+3]=w/this._dimensions.device.canvas.height,d[p+4]=x[0],d[p+5]=x[1],d[p+6]=x[2],d[p+7]=x[3]}_colorToFloat32Array(d){return new Float32Array([(d.rgba>>24&255)/255,(d.rgba>>16&255)/255,(d.rgba>>8&255)/255,(255&d.rgba)/255])}}t.RectangleRenderer=_},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(l,n){const c=l*n*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),n=a(627),c=a(457),f=a(56),v=a(374),o=a(345),e=a(859),s=a(147),i=a(782),r=a(855),u=a(965),m=a(742),_=a(310),g=a(733);class d extends e.Disposable{constructor(b,w,x,I,W,H,O,C,L){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=x,this._coreBrowserService=I,this._coreService=W,this._decorationService=H,this._optionsService=O,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 _.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new g.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,O,this._themeService)],this.dimensions=(0,v.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(O.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,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((T,U)=>this._setCanvasDevicePixelDimensions(T,U))),this.register(this._coreBrowserService.onWindowChange((T=>{this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,T,((U,j)=>this._setCanvasDevicePixelDimensions(U,j)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)((()=>{var T;for(const U of this._renderLayers)U.dispose();(T=this._canvas.parentElement)==null||T.removeChild(this._canvas),(0,n.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,W,H;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const O of this._renderLayers)O.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(),(W=this._glyphRenderer.value)==null||W.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 m.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new u.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,n.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==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 c.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const x=this._core;let I,W,H,O,C,L,D,T,U,j,X,K,M,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,G=N-x.buffer.ydisp,q=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(W=b;W<=w;W++)for(H=W+x.buffer.ydisp,O=x.buffer.lines.get(H),this._model.lineLengths[W]=0,C=this._characterJoinerService.getJoinedCharacters(H),M=0;M<x.cols;M++)if(I=this._cellColorResolver.result.bg,O.loadCell(M,z),M===0&&(I=this._cellColorResolver.result.bg),L=!1,D=M,C.length>0&&M===C[0][0]&&(L=!0,T=C.shift(),z=new p(z,O.translateToString(!0,T[0],T[1]),T[1]-T[0]),D=T[1]-1),U=z.getChars(),j=z.getCode(),K=(W*x.cols+M)*_.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(z,M,H,this.dimensions.device.cell.width),Y&&H===N&&(M===q&&(this._model.cursor={x:q,y:G,width:z.getWidth(),style:this._coreBrowserService.isFocused?x.options.cursorStyle||"block":x.options.cursorInactiveStyle,cursorWidth:x.options.cursorWidth,dpr:this._devicePixelRatio},Z=q+z.getWidth()-1),M>=q&&M<=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)),j!==r.NULL_CELL_CODE&&(this._model.lineLengths[W]=M+1),(this._model.cells[K]!==j||this._model.cells[K+_.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[K+_.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[K+_.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(re=!0,U.length>1&&(j|=_.COMBINED_CHAR_BIT_MASK),this._model.cells[K]=j,this._model.cells[K+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[K+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[K+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,X=z.getWidth(),this._glyphRenderer.value.updateCell(M,W,j,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,X,I),L))for(z=this._workCell,M++;M<D;M++)E=(W*x.cols+M)*_.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(M,W,r.NULL_CELL_CODE,0,0,0,r.NULL_CELL_CHAR,0,0),this._model.cells[E]=r.NULL_CELL_CODE,this._model.cells[E+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[E+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[E+_.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=d;class p extends s.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=p},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 l(n,c,f){const v=(0,h.throwIfFalsy)(n.createShader(c));if(n.shaderSource(v,f),n.compileShader(v),n.getShaderParameter(v,n.COMPILE_STATUS))return v;console.error(n.getShaderInfoLog(v)),n.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(n,c,f){const v=(0,h.throwIfFalsy)(n.createProgram());if(n.attachShader(v,(0,h.throwIfFalsy)(l(n,n.VERTEX_SHADER,c))),n.attachShader(v,(0,h.throwIfFalsy)(l(n,n.FRAGMENT_SHADER,f))),n.linkProgram(v),n.getProgramParameter(v,n.LINK_STATUS))return v;console.error(n.getProgramInfoLog(v)),n.deleteProgram(v)},t.createShader=l,t.expandFloat32Array=function(n,c){const f=Math.min(2*n.length,c),v=new Float32Array(f);for(let o=0;o<n.length;o++)v[o]=n[o];return v},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),n=a(374),c=a(859);class f extends c.Disposable{constructor(o,e,s,i,r,u,m,_){super(),this._container=e,this._alpha=r,this._coreBrowserService=u,this._optionsService=m,this._themeService=_,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((g=>{this._refreshCharAtlas(o,g),this.reset(o)}))),this.register((0,c.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,s){}handleSelectionChanged(o,e,s,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const s=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),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,s=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*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,s,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,s*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,s*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,s,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(s,i,e.getWidth()),this._ctx.fillText(e.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,s){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,s){return`${s?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=f},733:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),n=a(592);class c extends n.BaseRenderLayer{constructor(v,o,e,s,i,r,u){super(e,v,"link",o,!0,i,r,u),this.register(s.onShowLinkUnderline((m=>this._handleShowLinkUnderline(m)))),this.register(s.onHideLinkUnderline((m=>this._handleHideLinkUnderline(m))))}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===l.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=c},820:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},274:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),n=a(374);let c,f=0,v=0,o=!1,e=!1,s=!1,i=0;t.CellColorResolver=class{constructor(r,u,m,_,g,d){this._terminal=r,this._optionService=u,this._selectionRenderModel=m,this._decorationService=_,this._coreBrowserService=g,this._themeService=d,this.result={fg:0,bg:0,ext:0}}resolve(r,u,m,_){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,v=0,f=0,e=!1,o=!1,s=!1,c=this._themeService.colors,i=0,r.getCode()!==h.NULL_CELL_CODE&&r.extended.underlineStyle===4){const g=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=u*_%(2*Math.round(g))}if(this._decorationService.forEachDecorationAtCell(u,m,"bottom",(g=>{g.backgroundColorRGB&&(v=g.backgroundColorRGB.rgba>>8&16777215,e=!0),g.foregroundColorRGB&&(f=g.foregroundColorRGB.rgba>>8&16777215,o=!0)})),s=this._selectionRenderModel.isCellSelected(this._terminal,u,m),s){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=l.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else v=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(f=c.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(r.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(u,m,"top",(g=>{g.backgroundColorRGB&&(v=g.backgroundColorRGB.rgba>>8&16777215,e=!0),g.foregroundColorRGB&&(f=g.foregroundColorRGB.rgba>>8&16777215,o=!0)})),e&&(v=s?-16777216&r.bg&-134217729|v|50331648:-16777216&r.bg|v|50331648),o&&(f=-16777216&r.fg&-67108865|f|50331648),67108864&this.result.fg&&(e&&!o&&(f=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&c.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&c.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,e=!0)),c=void 0,this.result.bg=e?v:this.result.bg,this.result.fg=o?f: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),l=a(197),n=[];t.acquireTextureAtlas=function(c,f,v,o,e,s,i,r){const u=(0,l.generateConfig)(o,e,s,i,f,v,r);for(let g=0;g<n.length;g++){const d=n[g],p=d.ownedBy.indexOf(c);if(p>=0){if((0,l.configEquals)(d.config,u))return d.atlas;d.ownedBy.length===1?(d.atlas.dispose(),n.splice(g,1)):d.ownedBy.splice(p,1);break}}for(let g=0;g<n.length;g++){const d=n[g];if((0,l.configEquals)(d.config,u))return d.ownedBy.push(c),d.atlas}const m=c._core,_={atlas:new h.TextureAtlas(document,u,m.unicodeService),config:u,ownedBy:[c]};return n.push(_),_.atlas},t.removeTerminalFromCache=function(c){for(let f=0;f<n.length;f++){const v=n[f].ownedBy.indexOf(c);if(v!==-1){n[f].ownedBy.length===1?(n[f].atlas.dispose(),n.splice(f,1)):n[f].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(l,n,c,f,v,o,e){const s={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:l,deviceCellHeight:n,deviceCharWidth:c,deviceCharHeight:f,fontFamily:v.fontFamily,fontSize:v.fontSize,fontWeight:v.fontWeight,fontWeightBold:v.fontWeightBold,allowTransparency:v.allowTransparency,drawBoldTextInBrightColors:v.drawBoldTextInBrightColors,minimumContrastRatio:v.minimumContrastRatio,colors:s}},t.configEquals=function(l,n){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==n.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===n.devicePixelRatio&&l.customGlyphs===n.customGlyphs&&l.lineHeight===n.lineHeight&&l.letterSpacing===n.letterSpacing&&l.fontFamily===n.fontFamily&&l.fontSize===n.fontSize&&l.fontWeight===n.fontWeight&&l.fontWeightBold===n.fontWeightBold&&l.allowTransparency===n.allowTransparency&&l.deviceCharWidth===n.deviceCharWidth&&l.deviceCharHeight===n.deviceCharHeight&&l.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&l.minimumContrastRatio===n.minimumContrastRatio&&l.colors.foreground.rgba===n.colors.foreground.rgba&&l.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(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 l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,s,i,r,u,m,_){const g=t.blockElementDefinitions[e];if(g)return(function(y,b,w,x,I,W){for(let H=0;H<b.length;H++){const O=b[H],C=I/8,L=W/8;y.fillRect(w+O.x*C,x+O.y*L,O.w*C,O.h*L)}})(o,g,s,i,r,u),!0;const d=l[e];if(d)return(function(y,b,w,x,I,W){let H=n.get(b);H||(H=new Map,n.set(b,H));const O=y.fillStyle;if(typeof O!="string")throw new Error(`Unexpected fillStyle type "${O}"`);let C=H.get(O);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")),j=new ImageData(L,D);let X,K,M,E;if(O.startsWith("#"))X=parseInt(O.slice(1,3),16),K=parseInt(O.slice(3,5),16),M=parseInt(O.slice(5,7),16),E=O.length>7&&parseInt(O.slice(7,9),16)||1;else{if(!O.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${O}" when drawing pattern glyph`);[X,K,M,E]=O.substring(5,O.length-1).split(",").map((z=>parseFloat(z)))}for(let z=0;z<D;z++)for(let N=0;N<L;N++)j.data[4*(z*L+N)]=X,j.data[4*(z*L+N)+1]=K,j.data[4*(z*L+N)+2]=M,j.data[4*(z*L+N)+3]=b[z][N]*(255*E);U.putImageData(j,0,0),C=(0,h.throwIfFalsy)(y.createPattern(T,null)),H.set(O,C)}y.fillStyle=C,y.fillRect(w,x,I,W)})(o,d,s,i,r,u),!0;const p=t.boxDrawingDefinitions[e];if(p)return(function(y,b,w,x,I,W,H){y.strokeStyle=y.fillStyle;for(const[O,C]of Object.entries(b)){let L;y.beginPath(),y.lineWidth=H*Number.parseInt(O),L=typeof C=="function"?C(.15,.15/W*I):C;for(const D of L.split(" ")){const T=D[0],U=f[T];if(!U){console.error(`Could not find drawing instructions for "${T}"`);continue}const j=D.substring(1).split(",");j[0]&&j[1]&&U(y,v(j,I,W,w,x,!0,H))}y.stroke(),y.closePath()}})(o,p,s,i,r,u,_),!0;const S=t.powerlineDefinitions[e];return!!S&&((function(y,b,w,x,I,W,H,O){const C=new Path2D;C.rect(w,x,I,W),y.clip(C),y.beginPath();const L=H/12;y.lineWidth=O*L;for(const D of b.d.split(" ")){const T=D[0],U=f[T];if(!U){console.error(`Could not find drawing instructions for "${T}"`);continue}const j=D.substring(1).split(",");j[0]&&j[1]&&U(y,v(j,I,W,w,x,!1,O,(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,s,i,r,u,m,_),!0)};const n=new Map;function c(o,e,s=0){return Math.max(Math.min(o,e),s)}const f={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function v(o,e,s,i,r,u,m,_=0,g=0){const d=o.map((p=>parseFloat(p)||parseInt(p)));if(d.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<d.length;p+=2)d[p]*=e-_*m-g*m,u&&d[p]!==0&&(d[p]=c(Math.round(d[p]+.5)-.5,e,0)),d[p]+=i+_*m;for(let p=1;p<d.length;p+=2)d[p]*=s,u&&d[p]!==0&&(d[p]=c(Math.round(d[p]+.5)-.5,s,0)),d[p]+=r;return d}},56:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,n,c){let f=new n.ResizeObserver((v=>{const o=v.find((i=>i.target===l));if(!o)return;if(!("devicePixelContentBoxSize"in o))return f==null||f.disconnect(),void(f=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,s=o.devicePixelContentBoxSize[0].blockSize;e>0&&s>0&&c(e,s)}));try{f.observe(l,{box:["device-pixel-content-box"]})}catch{f.disconnect(),f=void 0}return(0,h.toDisposable)((()=>f==null?void 0:f.disconnect()))}},374:(R,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,c,f){return n===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!(function(v){return 57344<=v&&v<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(n){return 9472<=n&&n<=9631})(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},296:(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(l,n,c,f=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const v=l.buffers.active.ydisp,o=n[1]-v,e=c[1]-v,s=Math.max(o,0),i=Math.min(e,l.rows-1);s>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=s,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),n=a(374),c=a(160),f=a(345),v=a(485),o=a(385),e=a(147),s=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 r;class u{get pages(){return this._pages}constructor(p,S,y){this._document=p,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 f.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new f.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=g(p,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const p of this.pages)p.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const p=new o.IdleTaskQueue;for(let S=33;S<126;S++)p.enqueue((()=>{if(!this._cacheMap.get(S,s.DEFAULT_COLOR,s.DEFAULT_COLOR,s.DEFAULT_EXT)){const y=this._drawToCache(S,s.DEFAULT_COLOR,s.DEFAULT_COLOR,s.DEFAULT_EXT);this._cacheMap.set(S,s.DEFAULT_COLOR,s.DEFAULT_COLOR,s.DEFAULT_EXT,y)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const p of this._pages)p.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(u.maxAtlasPages&&this._pages.length>=Math.max(4,u.maxAtlasPages)){const S=this._pages.filter((H=>2*H.canvas.width<=(u.maxTextureSize||4096))).sort(((H,O)=>O.canvas.width!==H.canvas.width?O.canvas.width-H.canvas.width:O.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,O)=>H>O?1:-1)),I=this.pages.length-w.length,W=this._mergePages(w,I);W.version++;for(let H=x.length-1;H>=0;H--)this._deletePage(x[H]);this.pages.push(W),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(W.canvas)}const p=new m(this._document,this._textureSize);return this._pages.push(p),this._activePages.push(p),this._onAddTextureAtlasCanvas.fire(p.canvas),p}_mergePages(p,S){const y=2*p[0].canvas.width,b=new m(this._document,y,p);for(const[w,x]of p.entries()){const I=w*x.canvas.width%y,W=Math.floor(w/2)*x.canvas.height;b.ctx.drawImage(x.canvas,I,W);for(const O of x.glyphs)O.texturePage=S,O.sizeClipSpace.x=O.size.x/y,O.sizeClipSpace.y=O.size.y/y,O.texturePosition.x+=I,O.texturePosition.y+=W,O.texturePositionClipSpace.x=O.texturePosition.x/y,O.texturePositionClipSpace.y=O.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(x.canvas);const H=this._activePages.indexOf(x);H!==-1&&this._activePages.splice(H,1)}return b}_deletePage(p){this._pages.splice(p,1);for(let S=p;S<this._pages.length;S++){const y=this._pages[S];for(const b of y.glyphs)b.texturePage--;y.version++}}getRasterizedGlyphCombinedChar(p,S,y,b,w){return this._getFromCacheMap(this._cacheMapCombined,p,S,y,b,w)}getRasterizedGlyph(p,S,y,b,w){return this._getFromCacheMap(this._cacheMap,p,S,y,b,w)}_getFromCacheMap(p,S,y,b,w,x=!1){return r=p.get(S,y,b,w),r||(r=this._drawToCache(S,y,b,w,x),p.set(S,y,b,w,r)),r}_getColorFromAnsiIndex(p){if(p>=this._config.colors.ansi.length)throw new Error("No color found for idx "+p);return this._config.colors.ansi[p]}_getBackgroundColor(p,S,y,b){if(this._config.allowTransparency)return c.NULL_COLOR;let w;switch(p){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const x=e.AttributeData.toColorRGB(S);w=c.channels.toColor(x[0],x[1],x[2]);break;default:w=y?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(p,S,y,b,w,x,I,W,H,O){const C=this._getMinimumContrastColor(p,S,y,b,w,x,I,H,W,O);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=c.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=c.color.opaque(L)),W&&(L=c.color.multiplyOpacity(L,h.DIM_OPACITY)),L}_resolveBackgroundRgba(p,S,y){switch(p){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(p,S,y,b){switch(p){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(p,S,y,b,w,x,I,W,H,O){if(this._config.minimumContrastRatio===1||O)return;const C=this._getContrastCache(H),L=C.getColor(p,b);if(L!==void 0)return L||void 0;const D=this._resolveBackgroundRgba(S,y,I),T=this._resolveForegroundRgba(w,x,I,W),U=c.rgba.ensureContrastRatio(D,T,this._config.minimumContrastRatio/(H?2:1));if(!U)return void C.setColor(p,b,null);const j=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return C.setColor(p,b,j),j}_getContrastCache(p){return p?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(p,S,y,b,w=!1){const x=typeof p=="number"?String.fromCharCode(p):p,I=Math.min(this._config.deviceCellWidth*Math.max(x.length,2)+4,this._textureSize);this._tmpCanvas.width<I&&(this._tmpCanvas.width=I);const W=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<W&&(this._tmpCanvas.height=W),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(),O=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),L=!!this._workAttributeData.isItalic(),D=!!this._workAttributeData.isUnderline(),T=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let j=this._workAttributeData.getFgColor(),X=this._workAttributeData.getFgColorMode(),K=this._workAttributeData.getBgColor(),M=this._workAttributeData.getBgColorMode();if(O){const V=j;j=K,K=V;const ie=X;X=M,M=ie}const E=this._getBackgroundColor(M,K,O,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 G=x.length===1&&(0,n.isPowerlineGlyph)(x.charCodeAt(0)),q=x.length===1&&(0,n.isRestrictedPowerlineGlyph)(x.charCodeAt(0)),Z=this._getForegroundColor(S,M,K,y,X,j,O,C,H,(0,n.treatGlyphAsBackgroundColor)(x.charCodeAt(0)));this._tmpCtx.fillStyle=Z.css;const Y=q?0:4;let re=!1;this._config.customGlyphs!==!1&&(re=(0,l.tryDrawCustomChar)(this._tmpCtx,x,Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let he,J=!G;if(he=typeof p=="number"?this._unicodeService.wcwidth(p):this._unicodeService.getStringCellWidth(p),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,Ae=new Path2D;Ae.rect(ne,oe,this._config.deviceCellWidth,le-oe),this._tmpCtx.clip(Ae),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,n.computeNextVariantOffset)(Q-ne,V,de);break;case 5:const We=.6,$e=.3,be=Q-ne,Te=Math.floor(We*be),Me=Math.floor($e*be),Ne=be-Te-Me;this._tmpCtx.setLineDash([Te,Me,Ne]),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=_(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=_(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):_(ue,E,Z,J),fe)return i;const se=this._findGlyphBoundingBox(ue,this._workBoundingBox,I,q,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(u.maxAtlasPages&&this._pages.length>=u.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(p,S,y,b,w,x){S.top=0;const I=b?this._config.deviceCellHeight:this._tmpCanvas.height,W=b?this._config.deviceCellWidth:y;let H=!1;for(let O=0;O<I;O++){for(let C=0;C<W;C++){const L=O*this._tmpCanvas.width*4+4*C+3;if(p.data[L]!==0){S.top=O,H=!0;break}}if(H)break}S.left=0,H=!1;for(let O=0;O<x+W;O++){for(let C=0;C<I;C++){const L=C*this._tmpCanvas.width*4+4*O+3;if(p.data[L]!==0){S.left=O,H=!0;break}}if(H)break}S.right=W,H=!1;for(let O=x+W-1;O>=x;O--){for(let C=0;C<I;C++){const L=C*this._tmpCanvas.width*4+4*O+3;if(p.data[L]!==0){S.right=O,H=!0;break}}if(H)break}S.bottom=I,H=!1;for(let O=I-1;O>=0;O--){for(let C=0;C<W;C++){const L=O*this._tmpCanvas.width*4+4*C+3;if(p.data[L]!==0){S.bottom=O,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=u;class m{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(p){this._glyphs.push(p),this._usedPixels+=p.size.x*p.size.y}constructor(p,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=g(p,S,S),this.ctx=(0,n.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function _(d,p,S,y){const b=p.rgba>>>24,w=p.rgba>>>16&255,x=p.rgba>>>8&255,I=S.rgba>>>24,W=S.rgba>>>16&255,H=S.rgba>>>8&255,O=Math.floor((Math.abs(b-I)+Math.abs(w-W)+Math.abs(x-H))/12);let C=!0;for(let L=0;L<d.data.length;L+=4)d.data[L]===b&&d.data[L+1]===w&&d.data[L+2]===x||y&&Math.abs(d.data[L]-b)+Math.abs(d.data[L+1]-w)+Math.abs(d.data[L+2]-x)<O?d.data[L+3]=0:C=!1;return C}function g(d,p,S){const y=d.createElement("canvas");return y.width=p,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,l=0,n=0;var c,f,v,o,e;function s(r){const u=r.toString(16);return u.length<2?"0"+u:u}function i(r,u){return r<u?(u+.05)/(r+.05):(r+.05)/(u+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(u,m,_,g){return g!==void 0?`#${s(u)}${s(m)}${s(_)}${s(g)}`:`#${s(u)}${s(m)}${s(_)}`},r.toRgba=function(u,m,_,g=255){return(u<<24|m<<16|_<<8|g)>>>0},r.toColor=function(u,m,_,g){return{css:r.toCss(u,m,_,g),rgba:r.toRgba(u,m,_,g)}}})(c||(t.channels=c={})),(function(r){function u(m,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(m.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}r.blend=function(m,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const g=_.rgba>>24&255,d=_.rgba>>16&255,p=_.rgba>>8&255,S=m.rgba>>24&255,y=m.rgba>>16&255,b=m.rgba>>8&255;return a=S+Math.round((g-S)*n),h=y+Math.round((d-y)*n),l=b+Math.round((p-b)*n),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},r.isOpaque=function(m){return(255&m.rgba)==255},r.ensureContrastRatio=function(m,_,g){const d=e.ensureContrastRatio(m.rgba,_.rgba,g);if(d)return c.toColor(d>>24&255,d>>16&255,d>>8&255)},r.opaque=function(m){const _=(255|m.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},r.opacity=u,r.multiplyOpacity=function(m,_){return n=255&m.rgba,u(m,n*_/255)},r.toColorRGB=function(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}})(f||(t.color=f={})),(function(r){let u,m;try{const _=document.createElement("canvas");_.width=1,_.height=1;const g=_.getContext("2d",{willReadFrequently:!0});g&&(u=g,u.globalCompositeOperation="copy",m=u.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const g=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return a=parseInt(g[1]),h=parseInt(g[2]),l=parseInt(g[3]),n=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),c.toColor(a,h,l,n);if(!u||!m)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=m,u.fillStyle=_,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,h,l,n]=u.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}})(v||(t.css=v={})),(function(r){function u(m,_,g){const d=m/255,p=_/255,S=g/255;return .2126*(d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4))+.7152*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}r.relativeLuminance=function(m){return u(m>>16&255,m>>8&255,255&m)},r.relativeLuminance2=u})(o||(t.rgb=o={})),(function(r){function u(_,g,d){const p=_>>24&255,S=_>>16&255,y=_>>8&255;let b=g>>24&255,w=g>>16&255,x=g>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;I<d&&(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(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}function m(_,g,d){const p=_>>24&255,S=_>>16&255,y=_>>8&255;let b=g>>24&255,w=g>>16&255,x=g>>8&255,I=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;I<d&&(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(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}r.blend=function(_,g){if(n=(255&g)/255,n===1)return g;const d=g>>24&255,p=g>>16&255,S=g>>8&255,y=_>>24&255,b=_>>16&255,w=_>>8&255;return a=y+Math.round((d-y)*n),h=b+Math.round((p-b)*n),l=w+Math.round((S-w)*n),c.toRgba(a,h,l)},r.ensureContrastRatio=function(_,g,d){const p=o.relativeLuminance(_>>8),S=o.relativeLuminance(g>>8);if(i(p,S)<d){if(S<p){const w=u(_,g,d),x=i(p,o.relativeLuminance(w>>8));if(x<d){const I=m(_,g,d);return x>i(p,o.relativeLuminance(I>>8))?w:I}return w}const y=m(_,g,d),b=i(p,o.relativeLuminance(y>>8));if(b<d){const w=u(_,g,d);return b>i(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=u,r.increaseLuminance=m,r.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}})(e||(t.rgba=e={})),t.toPaddedHex=s,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 l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a((l=>h.fire(l)))},t.runAndSubscribe=function(a,h){return h(void 0),a((l=>h(l)))}},859:(R,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},485:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,f){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,f)}get(h,l,n,c){var f;return(f=this._data.get(h,l))==null?void 0:f.get(n,c)}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 l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(f){this._idleCallback=void 0;let v=0,o=0,e=f.timeRemaining(),s=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),s=f.timeRemaining(),1.5*o>s)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=s}this.clear()}}class n extends l{_requestCallback(f){return setTimeout((()=>f(this._createDeadline(16))))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const v=Date.now()+f;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},147:(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(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),n=a(147);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const o=new c;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[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[l.CHAR_DATA_CHAR_INDEX].length===2){const e=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|v[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},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,l=a.length){let n="";for(let c=h;c<l;++c){let f=a[c];f>65535?(f-=65536,n+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):n+=String.fromCharCode(f)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const f=a.charCodeAt(c++);56320<=f&&f<=57343?h[n++]=1024*(this._interim-55296)+f-56320+65536:(h[n++]=this._interim,h[n++]=f),this._interim=0}for(let f=c;f<l;++f){const v=a.charCodeAt(f);if(55296<=v&&v<=56319){if(++f>=l)return this._interim=v,n;const o=a.charCodeAt(f);56320<=o&&o<=57343?h[n++]=1024*(v-55296)+o-56320+65536:(h[n++]=v,h[n++]=o)}else v!==65279&&(h[n++]=v)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,c,f,v,o=0,e=0,s=0;if(this.interim[0]){let u=!1,m=this.interim[0];m&=(224&m)==192?31:(240&m)==224?15:7;let _,g=0;for(;(_=63&this.interim[++g])&&g<4;)m<<=6,m|=_;const d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=d-g;for(;s<p;){if(s>=l)return 0;if(_=a[s++],(192&_)!=128){s--,u=!0;break}this.interim[g++]=_,m<<=6,m|=63&_}u||(d===2?m<128?s--:h[o++]=m:d===3?m<2048||m>=55296&&m<=57343||m===65279||(h[o++]=m):m<65536||m>1114111||(h[o++]=m)),this.interim.fill(0)}const i=l-4;let r=s;for(;r<l;){for(;!(!(r<i)||128&(n=a[r])||128&(c=a[r+1])||128&(f=a[r+2])||128&(v=a[r+3]));)h[o++]=n,h[o++]=c,h[o++]=f,h[o++]=v,r+=4;if(n=a[r++],n<128)h[o++]=n;else if((224&n)==192){if(r>=l)return this.interim[0]=n,o;if(c=a[r++],(192&c)!=128){r--;continue}if(e=(31&n)<<6|63&c,e<128){r--;continue}h[o++]=e}else if((240&n)==224){if(r>=l)return this.interim[0]=n,o;if(c=a[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=c,o;if(f=a[r++],(192&f)!=128){r--;continue}if(e=(15&n)<<12|(63&c)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(r>=l)return this.interim[0]=n,o;if(c=a[r++],(192&c)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=c,o;if(f=a[r++],(192&f)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=f,o;if(v=a[r++],(192&v)!=128){r--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&f)<<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,s,i,r){var u,m=arguments.length,_=m<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,s,i,r);else for(var g=e.length-1;g>=0;g--)(u=e[g])&&(_=(m<3?u(_):m>3?u(s,i,_):u(s,i))||_);return m>3&&_&&Object.defineProperty(s,i,_),_},l=this&&this.__param||function(e,s){return function(i,r){s(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),c=a(97),f={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let v,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),v=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let s=0;s<e.length;s++)typeof e[s]=="function"&&(e[s]=e[s]())}_log(e,s,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...i)}trace(e,...s){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,s)}debug(e,...s){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,s)}info(e,...s){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,s)}warn(e,...s){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,s)}error(e,...s){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,s)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,s,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(...u){if(v.logLevel!==c.LogLevelEnum.TRACE)return r.apply(this,u);v.trace(`GlyphRenderer#${r.name}(${u.map((_=>JSON.stringify(_))).join(", ")})`);const m=r.apply(this,u);return v.trace(`GlyphRenderer#${r.name} return`,m),m}}},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(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(c,f,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,s){e[a]===e?e[h].push({id:o,index:s}):(e[h]=[{id:o,index:s}],e[a]=e)})(n,c,v)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},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 l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"})(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},F={};function A(R){var t=F[R];if(t!==void 0)return t.exports;var a=F[R]={exports:{}};return B[R].call(a.exports,a,a.exports,A),a.exports}var $={};return(()=>{var R=$;Object.defineProperty(R,"__esModule",{value:!0}),R.WebglAddon=void 0;const t=A(345),a=A(859),h=A(399),l=A(666),n=A(776);class c 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,s=o.optionsService,i=o,r=i._renderService,u=i._characterJoinerService,m=i._charSizeService,_=i._coreBrowserService,g=i._decorationService,d=i._logService,p=i._themeService;(0,n.setTraceLogger)(d),this._renderer=this.register(new l.WebglRenderer(v,u,m,_,e,g,s,p,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this.register((0,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=c})(),$})()))})(xe)),xe.exports}var Qe=Ze(),Re={exports:{}},Oe;function et(){return Oe||(Oe=1,(function(P,k){(function(B,F){P.exports=F()})(self,(()=>(()=>{var B={6:(R,t)=>{function a(l){try{const n=new URL(l),c=n.password&&n.username?`${n.protocol}//${n.username}:${n.password}@${n.host}`:n.username?`${n.protocol}//${n.username}@${n.host}`:`${n.protocol}//${n.host}`;return l.toLocaleLowerCase().startsWith(c.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(l,n,c,f={}){this._terminal=l,this._regex=n,this._handler=c,this._options=f}provideLinks(l,n){const c=h.computeLink(l,this._regex,this._terminal,this._handler);n(this._addCallbacks(c))}_addCallbacks(l){return l.map((n=>(n.leave=this._options.leave,n.hover=(c,f)=>{if(this._options.hover){const{range:v}=n;this._options.hover(c,f,v)}},n)))}};class h{static computeLink(n,c,f,v){const o=new RegExp(c.source,(c.flags||"")+"g"),[e,s]=h._getWindowedLineStrings(n-1,f),i=e.join("");let r;const u=[];for(;r=o.exec(i);){const m=r[0];if(!a(m))continue;const[_,g]=h._mapStrIdx(f,s,0,r.index),[d,p]=h._mapStrIdx(f,_,g,m.length);if(_===-1||g===-1||d===-1||p===-1)continue;const S={start:{x:g+1,y:_+1},end:{x:p,y:d+1}};u.push({range:S,text:m,activate:v})}return u}static _getWindowedLineStrings(n,c){let f,v=n,o=n,e=0,s="";const i=[];if(f=c.buffer.active.getLine(n)){const r=f.translateToString(!0);if(f.isWrapped&&r[0]!==" "){for(e=0;(f=c.buffer.active.getLine(--v))&&e<2048&&(s=f.translateToString(!0),e+=s.length,i.push(s),f.isWrapped&&s.indexOf(" ")===-1););i.reverse()}for(i.push(r),e=0;(f=c.buffer.active.getLine(++o))&&f.isWrapped&&e<2048&&(s=f.translateToString(!0),e+=s.length,i.push(s),s.indexOf(" ")===-1););}return[i,v]}static _mapStrIdx(n,c,f,v){const o=n.buffer.active,e=o.getNullCell();let s=f;for(;v;){const i=o.getLine(c);if(!i)return[-1,-1];for(let r=s;r<i.length;++r){i.getCell(r,e);const u=e.getChars();if(e.getWidth()&&(v-=u.length||1,r===i.length-1&&u==="")){const m=o.getLine(c+1);m&&m.isWrapped&&(m.getCell(0,e),e.getWidth()===2&&(v+=1))}if(v<0)return[c,r]}c++,s=0}return[c,s]}}t.LinkComputer=h}},F={};function A(R){var t=F[R];if(t!==void 0)return t.exports;var a=F[R]={exports:{}};return B[R](a,a.exports,A),a.exports}var $={};return(()=>{var R=$;Object.defineProperty(R,"__esModule",{value:!0}),R.WebLinksAddon=void 0;const t=A(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function h(l,n){const c=window.open();if(c){try{c.opener=null}catch{}c.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}R.WebLinksAddon=class{constructor(l=h,n={}){this._handler=l,this._options=n}activate(l){this._terminal=l;const n=this._options,c=n.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,c,this._handler,n))}dispose(){var l;(l=this._linkProvider)==null||l.dispose()}}})(),$})()))})(Re)),Re.exports}var tt=et();function it(P){P.setAttribute("autocomplete","terminal"),P.setAttribute("type","text"),P.setAttribute("name","xterm"),P.setAttribute("autocorrect","on"),P.setAttribute("autocapitalize","none"),P.setAttribute("spellcheck","false"),P.setAttribute("inputmode","text"),P.setAttribute("enterkeyhint","send"),P.setAttribute("role","textbox"),P.setAttribute("aria-label","Terminal input"),P.setAttribute("aria-multiline","false"),P.removeAttribute("aria-hidden"),P.setAttribute("data-form-type","other"),P.setAttribute("data-lpignore","true"),P.setAttribute("data-1p-ignore","true"),P.setAttribute("data-bwignore","true"),P.setAttribute("data-protonpass-ignore","true"),P.setAttribute("data-dashlane-ignore","true"),P.style.setProperty("-webkit-text-security","none","important")}function ge(P,k){return getComputedStyle(document.documentElement).getPropertyValue(P).trim()||k}function st(P,k,B,F,A,$){const R=[],t=new Map;let a=null;function h(){return R.find(o=>o.id===a)??null}function l(){const o=new Set(R.map(s=>s.id));let e=1;for(;o.has(e);)e++;return e}function n(){const o=document.getElementById("tab-bar"),e=document.getElementById("shell-selector");if(!o||!e)return;o.querySelectorAll(".tab-btn").forEach(i=>i.remove()),R.forEach((i,r)=>{const u=document.createElement("button");u.className="tab-btn"+(i.id===a?" active":"");const m=document.createElement("span");if(m.className="tab-label",m.textContent=`${r+1}`,u.appendChild(m),R.length>1){const _=document.createElement("span");_.className="tab-close",_.textContent="×";const g=400;let d=null,p=!1;const S=b=>{b.preventDefault(),b.stopPropagation(),!p&&(_.classList.add("holding"),d=setTimeout(()=>{p=!0,_.classList.remove("holding"),_.classList.add("ready"),v.requestCloseTab(i.id).catch(console.error)},g))},y=()=>{d&&(clearTimeout(d),d=null),_.classList.remove("holding")};_.addEventListener("pointerdown",S),_.addEventListener("pointerup",y),_.addEventListener("pointercancel",y),_.addEventListener("pointerleave",y),_.addEventListener("click",b=>{b.stopPropagation()}),u.appendChild(_)}u.addEventListener("click",()=>v.switchToTab(i.id)),o.insertBefore(u,e)});const s=document.createElement("button");s.className="tab-btn tab-add",s.textContent="+",s.addEventListener("click",()=>{v.requestCreateTab().catch(console.error)}),o.insertBefore(s,e)}function c(o){var d;const e=l(),s=o.shell_id,i=document.createElement("div");i.id=`terminal-${e}`,i.className="terminal-instance",i.style.display="none",(d=document.getElementById("terminal"))==null||d.appendChild(i);const r=new Xe.Terminal({cursorBlink:!0,fontSize:(F.isMobile,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}),u=new Je.FitAddon;r.loadAddon(u);const m=new tt.WebLinksAddon;r.loadAddon(m),r.open(i);const _=i.querySelector(".xterm-helper-textarea");_&&(it(_),/iPad|iPhone|iPod/.test(navigator.userAgent)&&_.addEventListener("beforeinput",p=>{p.inputType==="deleteContentBackward"&&(p.preventDefault(),B.sendInput(g,""))},{capture:!0}));try{const p=new Qe.WebglAddon;p.onContextLoss(()=>p.dispose()),r.loadAddon(p)}catch{}const g={id:e,tabId:o.id,shellId:s,term:r,fitAddon:u,container:i,ws:null,sessionId:o.session_id,heartbeatInterval:null,reconnectAttempts:0};return r.onData(p=>{r.hasSelection()&&r.clearSelection();let S=p;if(p.length===1&&p.charCodeAt(0)>=32&&p.charCodeAt(0)<127){const y=A.ctrl==="sticky"||A.ctrl==="locked",b=A.alt==="sticky"||A.alt==="locked";if(y||b){let w=p;if(y){const x=w.toUpperCase().charCodeAt(0);x>=65&&x<=90&&(w=String.fromCharCode(x-64))}b&&(w="\x1B"+w),S=w}}B.sendInput(g,S),$.onInputSend(S)}),r.onSelectionChange(()=>{const p=r.getSelection();p&&p.length>0&&$.onSelectionCopy(p)}),r.onResize(()=>{$.scheduleResize(g)}),R.push(g),t.set(o.id,g),B.connect(g),P.emit("tab:created",{tab:g}),g}function f(o){const e=t.get(o);if(!e)return;const s=R.indexOf(e);if(s!==-1&&(B.disconnect(e),B.cleanupTabState(e.id),e.term.dispose(),e.container.remove(),R.splice(s,1),t.delete(o),P.emit("tab:closed",{tabId:e.id}),a===e.id&&R.length>0)){const i=R[Math.max(0,s-1)];i&&v.switchToTab(i.id)}}const v={get tabs(){return R},get activeTab(){return h()},get activeTabId(){return a},async requestCreateTab(o){const e=o??this.getDefaultShellId(),s=await k.createTab(e),i=c(s);return this.switchToTab(i.id),n(),i},async requestCloseTab(o){const e=R.find(s=>s.id===o);if(!e||!e.tabId)throw new Error("Tab not found or has no server ID");R.length===1&&await this.requestCreateTab(),B.disconnect(e),await k.closeTab(e.tabId),f(e.tabId),n()},switchToTab(o){const e=R.find(i=>i.id===o);if(!e)return;R.forEach(i=>{i.container.style.display="none"}),e.container.style.display="block",a=o;const s=document.getElementById("shell-select");s&&(s.value=e.shellId),e.term.focus(),setTimeout(()=>{e.fitAddon.fit()},50),n(),P.emit("tab:switched",{tabId:o,tab:e})},applyStateSync(o){const e=new Set(o.map(s=>s.id));for(const[s]of t)e.has(s)||f(s);for(const s of o)t.has(s.id)||c(s);if(R.length>0&&(a===null||!R.find(s=>s.id===a))){const s=R[0];s&&this.switchToTab(s.id)}n()},applyStateUpdate(o){for(const e of o)switch(e.action){case"add":e.tab&&!t.has(e.tab_id)&&c(e.tab);break;case"remove":t.has(e.tab_id)&&f(e.tab_id);break}R.length===0&&this.requestCreateTab().catch(console.error),n()},getTab(o){return R.find(e=>e.id===o)},getTabByServerId(o){return t.get(o)},focusTerminal(){const o=h();o&&o.term.focus()},getDefaultShellId(){const o=document.getElementById("shell-select");return(o==null?void 0:o.value)??"default"}};return v}const rt={Tab:" ",ShiftTab:"\x1B[Z",Enter:"\r","\\Enter":"\\\r",Backspace:"",Delete:"\x1B[3~",Escape:"\x1B",Space:" ",ArrowUp:"\x1B[A",ArrowDown:"\x1B[B",ArrowRight:"\x1B[C",ArrowLeft:"\x1B[D",Home:"\x1B[H",End:"\x1B[F","Ctrl+C":"","Ctrl+D":"","Ctrl+Z":"","Ctrl+L":"\f","Ctrl+R":"","Ctrl+A":"","Ctrl+E":"","Ctrl+W":"","Ctrl+U":""};function nt(P){const k={...rt,...P};return{getSequence(B,F){if(k[B])return k[B];if(B.length===1){let A=B;if((F.shift==="sticky"||F.shift==="locked")&&(A=A.toUpperCase()),F.ctrl==="sticky"||F.ctrl==="locked"){const $=A.toUpperCase().charCodeAt(0);$>=65&&$<=90&&(A=String.fromCharCode($-64))}return(F.alt==="sticky"||F.alt==="locked")&&(A="\x1B"+A),A}return null},registerMapping(B,F){k[B]=F},hasMapping(B){return B in k}}}const ot=300;function at(P,k){const B={ctrl:"off",alt:"off",shift:"off"},F={ctrl:0,alt:0,shift:0};function A($){P.emit("modifier:changed",{modifier:$,state:B[$]}),k==null||k($)}return{get state(){return B},handleTap($){const R=Date.now(),t=F[$];F[$]=R,R-t<ot?B[$]=B[$]==="locked"?"off":"locked":B[$]==="off"?B[$]="sticky":B[$]="off",A($)},consumeSticky(){const $=["ctrl","alt","shift"];for(const R of $)B[R]==="sticky"&&(B[R]="off",A(R))},reset(){const $=["ctrl","alt","shift"];for(const R of $)B[R]!=="off"&&(B[R]="off",A(R))},isActive($){return B[$]==="sticky"||B[$]==="locked"},getState($){return B[$]}}}function ht(P,k,B,F){return{handleKeyButton(A){const $=k.getSequence(A,B.state);$&&(F.sendInput($),F.focusTerminal()),B.consumeSticky()},sendInput(A){F.sendInput(A),P.emit("input:send",{data:A})}}}const ct={minDistance:25,maxTime:300,directionRatio:1.2};function lt(P={}){const{minDistance:k,maxTime:B,directionRatio:F}={...ct,...P};return{detect(A,$,R,t,a){if(a>B)return null;const h=R-A,l=t-$,n=Math.abs(h),c=Math.abs(l);return Math.hypot(h,l)<k?null:n>c*F?{direction:h>0?"down":"up"}:null}}}function dt(){return{touchToPosition(P,k,B){var l;const F=(l=P.element)==null?void 0:l.getBoundingClientRect();if(!F)return{col:0,row:0};const A=k-F.left,$=B-F.top,R=F.width/P.cols,t=F.height/P.rows,a=Math.floor(A/R),h=Math.floor($/t);return{col:Math.max(0,Math.min(a,P.cols-1)),row:Math.max(0,Math.min(h,P.rows-1))}},startSelection(P,k,B){const F=B+Math.floor(P.buffer.active.viewportY);P.select(k,F,1)},extendSelection(P,k,B,F,A){const $=Math.floor(P.buffer.active.viewportY);let R,t,a;A===B?(R=Math.min(k,F),t=B,a=Math.abs(F-k)+1):A>B?(R=k,t=B,a=P.cols-k+(A-B-1)*P.cols+F+1):(R=F,t=A,a=P.cols-F+(B-A-1)*P.cols+k+1),P.select(R,t+$,a)},selectWordAt(P,k,B){const F=P.buffer.active.getLine(B);if(!F)return;let A=k,$=k;for(;A>0;){const t=F.getCell(A-1);if(!t||/\s/.test(t.getChars()))break;A--}for(;$<P.cols-1;){const t=F.getCell($+1);if(!t||/\s/.test(t.getChars()))break;$++}const R=$-A+1;R>0&&P.select(A,B,R)},getSelection(P){return P.getSelection()},clearSelection(P){P.clearSelection()},hasSelection(P){return P.hasSelection()}}}const ut=250,_t=300,ft=30,Ce=20,vt=10,gt=24;function pt(P,k,B,F){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 $=!1,R=null;const t={};function a(){A.longPressTimer&&(clearTimeout(A.longPressTimer),A.longPressTimer=null)}return{attach(h){R=h,t.pointerdown=l=>{if(l.pointerType==="mouse")return;l.stopPropagation(),l.preventDefault(),$=!0,A.startX=l.clientX,A.startY=l.clientY,A.startTime=Date.now(),A.isSelecting=!1,A.pointerId=l.pointerId,a();const n=l.clientX,c=l.clientY;A.longPressTimer=setTimeout(()=>{const f=F.getActiveTerminal();if(f&&$){A.isSelecting=!0;try{h.setPointerCapture(l.pointerId)}catch{}const v=B.touchToPosition(f,n,c);A.selectAnchorCol=v.col,A.selectAnchorRow=v.row,B.startSelection(f,v.col,v.row)}},ut)},t.pointermove=l=>{if(l.pointerType==="mouse"||!$)return;const n=Math.abs(l.clientX-A.startX),c=Math.abs(l.clientY-A.startY),f=Date.now()-A.startTime;if(!A.isSelecting&&(n>Ce||c>Ce)&&a(),!A.isSelecting&&f<300&&n>20&&n>c*1.2){l.preventDefault(),l.stopPropagation();return}if(A.isSelecting){l.preventDefault(),l.stopPropagation();const v=F.getActiveTerminal();if(v){const o=B.touchToPosition(v,l.clientX,l.clientY);B.extendSelection(v,A.selectAnchorCol,A.selectAnchorRow,o.col,o.row)}}},t.pointerup=l=>{if(l.pointerType==="mouse")return;if(A.pointerId){try{h.releasePointerCapture(A.pointerId)}catch{}A.pointerId=null}l.stopPropagation(),a();const n=Math.abs(l.clientX-A.startX),c=Math.abs(l.clientY-A.startY),f=n<Ce&&c<Ce,v=Date.now(),o=v-A.startTime,e=A.isSelecting;A.isSelecting=!1;const s=F.getActiveTerminal();if(e&&s){const r=B.getSelection(s);r&&F.showCopyButton(r,l.clientX,l.clientY),setTimeout(()=>{$=!1},350);return}const i=k.detect(A.startX,A.startY,l.clientX,l.clientY,o);if(i){F.sendArrowKey(i.direction),P.emit("gesture:swipe",{direction:i.direction}),setTimeout(()=>{$=!1},350);return}if(f&&s){const r=Math.hypot(l.clientX-A.lastTapX,l.clientY-A.lastTapY);if(v-A.lastTapTime<_t&&r<ft){const u=B.touchToPosition(s,l.clientX,l.clientY),m=u.row+Math.floor(s.buffer.active.viewportY);B.selectWordAt(s,u.col,m),A.lastTapTime=0;const _=B.getSelection(s);_&&F.showCopyButton(_,l.clientX,l.clientY)}else B.hasSelection(s)&&B.clearSelection(s),A.lastTapTime=v,A.lastTapX=l.clientX,A.lastTapY=l.clientY,F.focusTerminal()}setTimeout(()=>{$=!1},350)},t.pointercancel=l=>{if(l.pointerType!=="mouse"){if(A.pointerId){try{h.releasePointerCapture(A.pointerId)}catch{}A.pointerId=null}a(),A.isSelecting=!1,$=!1}},t.touchstart=l=>{if(l.touches.length===2){l.preventDefault(),l.stopPropagation(),a(),A.isSelecting=!1;const n=l.touches[0],c=l.touches[1],f=n.clientX-c.clientX,v=n.clientY-c.clientY;A.initialDistance=Math.hypot(f,v);const o=F.getActiveTerminal();A.initialFontSize=(o==null?void 0:o.options.fontSize)??14}},t.touchmove=l=>{if(l.touches.length===2&&A.initialDistance>0){l.preventDefault();const n=l.touches[0],c=l.touches[1],f=n.clientX-c.clientX,v=n.clientY-c.clientY,e=Math.hypot(f,v)/A.initialDistance;let s=Math.round(A.initialFontSize*e);s=Math.max(vt,Math.min(gt,s));const i=F.getActiveTerminal();i&&s!==i.options.fontSize&&(i.options.fontSize=s,i.refresh(0,i.rows-1),A.fontSizeChanged=!0,P.emit("gesture:pinch",{scale:e}))}},t.touchend=()=>{A.fontSizeChanged&&(F.scheduleFitAfterFontChange(),A.fontSizeChanged=!1),A.initialDistance=0},t.mousedown=l=>{$&&(l.preventDefault(),l.stopPropagation())},t.mousemove=l=>{$&&(l.preventDefault(),l.stopPropagation())},t.mouseup=l=>{$&&(l.preventDefault(),l.stopPropagation())},h.addEventListener("pointerdown",t.pointerdown,{passive:!1,capture:!0}),h.addEventListener("pointermove",t.pointermove,{passive:!1,capture:!0}),h.addEventListener("pointerup",t.pointerup,{passive:!1,capture:!0}),h.addEventListener("pointercancel",t.pointercancel,{passive:!1,capture:!0}),h.addEventListener("touchstart",t.touchstart,{passive:!1,capture:!0}),h.addEventListener("touchmove",t.touchmove,{passive:!1,capture:!0}),h.addEventListener("touchend",t.touchend,{passive:!1,capture:!0}),h.addEventListener("mousedown",t.mousedown,{passive:!1,capture:!0}),h.addEventListener("mousemove",t.mousemove,{passive:!1,capture:!0}),h.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 $}}}const mt={deduplicationWindowMs:300};function Pe(P){const k=document.createElement("textarea");if(k.value=P,k.style.position="fixed",k.style.top="50%",k.style.left="50%",k.style.width="1px",k.style.height="1px",k.style.padding="0",k.style.border="none",k.style.outline="none",k.style.boxShadow="none",k.style.background="transparent",k.style.color="transparent",k.style.fontSize="1px",k.style.zIndex="99999",k.contentEditable="true",document.body.appendChild(k),k.focus(),k.select(),navigator.userAgent.match(/ipad|iphone/i)){const F=document.createRange();F.selectNodeContents(k);const A=window.getSelection();A==null||A.removeAllRanges(),A==null||A.addRange(F)}k.setSelectionRange(0,P.length);let B=!1;try{B=document.execCommand("copy")}catch(F){console.error("execCommand copy failed:",F)}return k.blur(),document.body.removeChild(k),B}function St(P={}){const{deduplicationWindowMs:k}={...mt,...P};let B="",F=0;const A="ontouchstart"in window||navigator.maxTouchPoints>0;return{copy($,R){var h;if(!$||!$.trim())return!1;const t=Date.now();if($===B&&t-F<k)return!1;let a=!1;return A&&(a=Pe($)),!a&&((h=navigator.clipboard)!=null&&h.writeText)&&(navigator.clipboard.writeText($).then(()=>{}).catch(l=>{console.warn(`Clipboard API failed (${R}):`,l)}),a||(a=!0)),a||(a=Pe($)),a?(B=$,F=t,!0):(console.error(`Copy failed completely (${R})`),!1)},async paste(){var $;try{return($=navigator.clipboard)!=null&&$.readText?await navigator.clipboard.readText():(console.warn("Clipboard API not available"),"")}catch(R){return console.error("Paste failed:",R),""}},reset(){B="",F=0}}}function Ct(P){const k=new Map,B=new Map;return{scheduleResize(F,A=50){const $=k.get(F.id);$&&clearTimeout($);const R=setTimeout(()=>{k.delete(F.id);const t=F.term.cols,a=F.term.rows,h=B.get(F.id);h&&h.cols===t&&h.rows===a||(P(F,t,a),B.set(F.id,{cols:t,rows:a,time:Date.now()}))},A);k.set(F.id,R)},cancelResize(F){const A=k.get(F);A&&(clearTimeout(A),k.delete(F))},getLastDimensions(F){const A=B.get(F);return A?{cols:A.cols,rows:A.rows}:null}}}function bt(P,k){const B=document.getElementById("copy-button");let F="";function A($){B&&(B.textContent=$?"Copied!":"Failed",B.classList.add($?"success":"error"),setTimeout(()=>{B.classList.remove("visible","success","error"),B.textContent="Copy",k.clearSelection()},400))}return{show($,R,t){if(!(!B||!$)){if(F=$,R!==void 0&&t!==void 0){let h=R,l=t-40;const n=80,c=36,f=8;h=Math.max(f+n/2,Math.min(window.innerWidth-f-n/2,h)),l=Math.max(f+c/2,Math.min(window.innerHeight-f-c/2,l)),B.style.left=`${h}px`,B.style.top=`${l}px`}B.classList.add("visible")}},hide(){B&&(F="",B.classList.remove("visible"))},setup(){B&&(B.addEventListener("click",$=>{var t;if($.preventDefault(),$.stopPropagation(),!F){this.hide();return}const R=F;F="",(t=navigator.clipboard)!=null&&t.writeText?navigator.clipboard.writeText(R).then(()=>{A(!0)}).catch(()=>{A(P.copy(R,"copyButton-fallback"))}):A(P.copy(R,"copyButton"))}),document.addEventListener("pointerdown",$=>{$.target!==B&&B.classList.contains("visible")&&(this.hide(),k.clearSelection())}))}}}function wt(){const P=document.getElementById("disconnect-overlay"),k=document.getElementById("disconnect-text"),B=document.getElementById("disconnect-retry");return{show(){P==null||P.classList.remove("hidden")},hide(){P==null||P.classList.add("hidden")},setText(F){k&&(k.textContent=F)},setup(F){B==null||B.addEventListener("click",()=>{this.hide(),F()})}}}function yt(){const P=document.getElementById("connection-dot");return{set(k){P&&(P.className=k==="connected"?"connected":"")}}}const Et=6,Lt=32,Fe=1;function xt(P){const k=P.buffer.active,B=[];for(let F=0;F<k.length;F++){const A=k.getLine(F);A&&B.push(A.translateToString(!0))}for(;B.length>0&&(B[B.length-1]??"").trim()==="";)B.pop();return B.join(`
69
- `)}function Rt(){const P=document.getElementById("textview-overlay"),k=document.getElementById("textview-close"),B=document.getElementById("textview-zoom-in"),F=document.getElementById("textview-zoom-out"),A=document.getElementById("textview-body");let $=10,R=0,t=10;function a(){A&&(A.style.fontSize=`${$}px`)}function h(e){$=Math.max(Et,Math.min(Lt,e)),a()}function l(){h($+Fe)}function n(){h($-Fe)}function c(e){const s=e[0],i=e[1];if(!s||!i)return 0;const r=i.clientX-s.clientX,u=i.clientY-s.clientY;return Math.hypot(r,u)}function f(e){e.touches.length===2&&(R=c(e.touches),t=$)}function v(e){if(e.touches.length===2&&R>0){e.preventDefault();const i=c(e.touches)/R;h(Math.round(t*i))}}function o(){R=0}return{show(e){const s=e.options.fontSize??14;h(s),A&&(A.textContent=xt(e)),P==null||P.classList.remove("hidden"),requestAnimationFrame(()=>{A&&(A.scrollTop=A.scrollHeight)})},hide(){P==null||P.classList.add("hidden"),A&&(A.textContent="")},setup(){k==null||k.addEventListener("click",()=>this.hide()),B==null||B.addEventListener("click",l),F==null||F.addEventListener("click",n),A==null||A.addEventListener("touchstart",f,{passive:!0}),A==null||A.addEventListener("touchmove",v,{passive:!1}),A==null||A.addEventListener("touchend",o,{passive:!0})}}}const De={maxReconnectAttempts:5,reconnectDelayMs:1e3,heartbeatMs:25e3};async function Dt(){var _;const P=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),k=Ue(),B=ze(),F=yt(),A=wt(),$=Rt(),R=St(),t=nt(),a=at(k,g=>{At(g)});let h;const l=Ke({onStateSync:g=>{console.log("Received state sync:",g.length,"tabs"),h.applyStateSync(g)},onStateUpdate:g=>{console.log("Received state update:",g),h.applyStateUpdate(g)},onDisconnect:()=>{console.log("Management WebSocket disconnected"),F.set("disconnected"),A.show()},onConnect:()=>{console.log("Management WebSocket connected"),A.hide()}}),n=Ge(k,{maxReconnectAttempts:De.maxReconnectAttempts,reconnectDelayMs:De.reconnectDelayMs,heartbeatMs:De.heartbeatMs},{onSessionInfo:(g,d,p)=>{g.sessionId=d,p&&(g.tabId=p)},onDisconnect:()=>{F.set("disconnected")},onReconnectFailed:()=>{A.show()}}),c=Ct((g,d,p)=>{n.sendResize(g,d,p)});h=st(k,l,n,{isMobile:P},a.state,{onInputSend:()=>{a.consumeSticky()},onSelectionCopy:g=>{R.copy(g,"selectionChange")},scheduleResize:g=>{c.scheduleResize(g)}});const f=ht(k,t,a,{sendInput:g=>{const d=h.activeTab;d&&n.sendInput(d,g)},focusTerminal:()=>{h.focusTerminal()}}),v=bt(R,{clearSelection:()=>{const g=h.activeTab;g&&g.term.clearSelection()}}),o=lt(),e=dt(),s=pt(k,o,e,{getActiveTerminal:()=>{var g;return((g=h.activeTab)==null?void 0:g.term)??null},sendArrowKey:g=>{const d=h.activeTab;d&&(g==="up"?(n.sendInput(d,"\x1B[A"),navigator.vibrate&&navigator.vibrate(20)):g==="down"&&(n.sendInput(d,"\x1B[B"),navigator.vibrate&&navigator.vibrate(20)))},showCopyButton:(g,d,p)=>{v.show(g,d,p)},focusTerminal:()=>{h.focusTerminal()},scheduleFitAfterFontChange:()=>{const g=h.activeTab;g&&setTimeout(()=>g.fitAddon.fit(),50)}});v.setup(),A.setup(async()=>{try{l.isConnected()||await l.connect();for(const g of h.tabs)n.isConnected(g)||(g.reconnectAttempts=0,n.connect(g,!0));A.hide()}catch(g){console.error("Retry failed:",g)}});const i=await B.load(),r=document.getElementById("shell-select");if(r){r.innerHTML="";for(const g of i.shells){const d=document.createElement("option");d.value=g.id,d.textContent=g.name,g.id===i.default_shell&&(d.selected=!0),r.appendChild(d)}r.addEventListener("change",async()=>{const g=r.value,d=h.activeTab;if(g&&d)try{await h.requestCreateTab(g),await h.requestCloseTab(d.id)}catch(p){console.error("Failed to switch shell:",p)}})}if(i.buttons&&i.buttons.length>0){const g=document.querySelector(".toolbar-row:last-child");if(g)for(const d of i.buttons){const p=document.createElement("button");p.className="tool-btn",p.textContent=d.label,p.dataset.send=d.send,g.appendChild(p)}}Tt(a),Mt(f),kt(()=>{const g=h.activeTab;g&&n.sendInput(g,"")}),Bt(async()=>{const g=await R.paste();if(g){const d=h.activeTab;d&&(n.sendInput(d,g),navigator.vibrate&&navigator.vibrate(30))}h.focusTerminal()}),It(f,h.focusTerminal.bind(h)),Ot(A),Pt(),$.setup(),Ft($,()=>{var g;return((g=h.activeTab)==null?void 0:g.term)??null});const u=document.getElementById("terminal-container");u&&s.attach(u),k.on("connection:open",({tabId:g})=>{g===h.activeTabId&&(F.set("connected"),A.hide())}),k.on("connection:close",({tabId:g})=>{g===h.activeTabId&&F.set("disconnected")}),k.on("tab:closed",({tabId:g})=>{c.cancelResize(g)}),document.addEventListener("visibilitychange",async()=>{if(document.visibilityState==="visible"){a.reset();try{l.isConnected()||await l.connect();for(const g of h.tabs)n.isConnected(g)||n.connect(g,!0)}catch(g){console.error("Failed to reconnect:",g),A.show()}}else a.reset()}),window.addEventListener("blur",()=>{a.reset()});let m;if(window.addEventListener("resize",()=>{clearTimeout(m),m=setTimeout(()=>{const g=h.activeTab;g&&g.fitAddon.fit()},50)}),window.addEventListener("orientationchange",()=>{setTimeout(()=>{const g=h.activeTab;g&&g.fitAddon.fit()},100)}),window.visualViewport){const g=document.getElementById("app");let d;window.visualViewport.addEventListener("resize",()=>{g&&(g.style.height=`${window.visualViewport.height}px`),clearTimeout(d),d=setTimeout(()=>{const p=h.activeTab;p&&p.fitAddon.fit()},50)})}(_=document.getElementById("terminal-container"))==null||_.addEventListener("click",()=>{h.focusTerminal()});try{await l.connect(),setTimeout(async()=>{h.tabs.length===0&&(console.log("No tabs from server, creating one"),await h.requestCreateTab())},100)}catch(g){console.error("Failed to connect management WebSocket:",g),A.show()}console.log("Porterminal initialized (backend-driven)")}function At(P){const k=document.getElementById(`btn-${P}`);if(!k)return;const B=window._modifierManager;if(!B)return;k.classList.remove("sticky","locked");const F=B.getState(P);F==="sticky"?k.classList.add("sticky"):F==="locked"&&k.classList.add("locked")}function Tt(P){window._modifierManager=P;for(const k of["ctrl","alt","shift"]){const B=document.getElementById(`btn-${k}`);if(!B)continue;let F=!1;B.addEventListener("touchstart",A=>{F=!0,A.preventDefault()},{passive:!1}),B.addEventListener("touchend",A=>{A.preventDefault(),P.handleTap(k)},{passive:!1}),B.addEventListener("click",()=>{F||P.handleTap(k),F=!1})}}function Mt(P){const k=document.getElementById("btn-escape");if(!k)return;let B=!1,F=0;const A=300,$=()=>{const R=Date.now();R-F<A?P.sendInput("\x1B\x1B"):P.sendInput("\x1B"),F=R};k.addEventListener("touchstart",R=>{B=!0,R.preventDefault()},{passive:!1}),k.addEventListener("touchend",R=>{R.preventDefault(),$()},{passive:!1}),k.addEventListener("click",()=>{B||$(),B=!1})}function kt(P){const k=document.getElementById("btn-backspace");if(!k)return;const B=400,F=50;let A=null,$=null,R=!1;const t=()=>{R||(R=!0,P(),$=setTimeout(()=>{A=setInterval(P,F)},B))},a=()=>{R=!1,$&&(clearTimeout($),$=null),A&&(clearInterval(A),A=null)};k.addEventListener("pointerdown",h=>{h.preventDefault(),t()},{passive:!1}),k.addEventListener("pointerup",h=>{h.preventDefault(),a()},{passive:!1}),k.addEventListener("pointercancel",a),k.addEventListener("pointerleave",a),k.addEventListener("contextmenu",h=>h.preventDefault())}function Bt(P){const k=document.getElementById("btn-paste");if(!k)return;let B=!1;k.addEventListener("touchstart",F=>{B=!0,F.preventDefault()},{passive:!1}),k.addEventListener("touchend",F=>{F.preventDefault(),P()},{passive:!1}),k.addEventListener("click",()=>{B||P(),B=!1})}function It(P,k){let B=!1;document.querySelectorAll(".tool-btn").forEach(F=>{const A=F;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 $=()=>{A.dataset.key?P.handleKeyButton(A.dataset.key):A.dataset.send&&(P.sendInput(A.dataset.send),k())};A.addEventListener("touchstart",R=>{B=!0,R.preventDefault()},{passive:!1}),A.addEventListener("touchend",R=>{R.preventDefault(),$()},{passive:!1}),A.addEventListener("click",()=>{B||$(),B=!1})})}function Ot(P){const k=document.getElementById("btn-shutdown");k&&k.addEventListener("click",async()=>{if(confirm(`Shutdown server and tunnel?
70
-
71
- This will terminate all sessions.`))try{(await fetch("/api/shutdown",{method:"POST"})).ok&&(P.setText("Server Shutdown"),P.show())}catch(B){console.error("Shutdown failed:",B)}})}function Pt(){const P=document.getElementById("btn-info"),k=document.getElementById("help-overlay"),B=document.getElementById("help-close");if(!P||!k)return;const F=()=>k.classList.remove("hidden"),A=()=>k.classList.add("hidden");P.addEventListener("click",F),B==null||B.addEventListener("click",A),k.addEventListener("click",$=>{$.target===k&&A()})}function Ft(P,k){const B=document.getElementById("btn-textview");B&&B.addEventListener("click",()=>{const F=k();F&&P.show(F)})}"serviceWorker"in navigator&&navigator.serviceWorker.register("/static/sw.js").catch(P=>console.warn("SW registration failed:",P));document.addEventListener("DOMContentLoaded",()=>{Dt()});